X64 transport [Part 5] (Update plugins.cpp)
[xy_vsfilter.git] / src / log4cplus / ltmain.sh
blobd41416a5b71b5c9801b175ae3c08e7415eeef96a
1 # Generated from ltmain.m4sh.
3 # libtool (GNU libtool) 2.2.10
4 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
7 # 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
8 # This is free software; see the source for copying conditions. There is NO
9 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # GNU Libtool is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # As a special exception to the GNU General Public License,
17 # if you distribute this file as part of a program or library that
18 # is built using GNU Libtool, you may include this file under the
19 # same distribution terms that you use for the rest of that program.
21 # GNU Libtool is distributed in the hope that it will be useful, but
22 # WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 # General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with GNU Libtool; see the file COPYING. If not, a copy
28 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
29 # or obtained by writing to the Free Software Foundation, Inc.,
30 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
32 # Usage: $progname [OPTION]... [MODE-ARG]...
34 # Provide generalized library-building support services.
36 # --config show all configuration variables
37 # --debug enable verbose shell tracing
38 # -n, --dry-run display commands without modifying any files
39 # --features display basic configuration information and exit
40 # --mode=MODE use operation mode MODE
41 # --preserve-dup-deps don't remove duplicate dependency libraries
42 # --quiet, --silent don't print informational messages
43 # --no-quiet, --no-silent
44 # print informational messages (default)
45 # --tag=TAG use configuration variables from tag TAG
46 # -v, --verbose print more informational messages than default
47 # --no-verbose don't print the extra informational messages
48 # --version print version information
49 # -h, --help, --help-all print short, long, or detailed help message
51 # MODE must be one of the following:
53 # clean remove files from the build directory
54 # compile compile a source file into a libtool object
55 # execute automatically set library path, then run a program
56 # finish complete the installation of libtool libraries
57 # install install libraries or executables
58 # link create a library or an executable
59 # uninstall remove libraries from an installed directory
61 # MODE-ARGS vary depending on the MODE. When passed as first option,
62 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
63 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
65 # When reporting a bug, please describe a test case to reproduce it and
66 # include the following information:
68 # host-triplet: $host
69 # shell: $SHELL
70 # compiler: $LTCC
71 # compiler flags: $LTCFLAGS
72 # linker: $LD (gnu? $with_gnu_ld)
73 # $progname: (GNU libtool) 2.2.10
74 # automake: $automake_version
75 # autoconf: $autoconf_version
77 # Report bugs to <bug-libtool@gnu.org>.
79 PROGRAM=libtool
80 PACKAGE=libtool
81 VERSION=2.2.10
82 TIMESTAMP=""
83 package_revision=1.3175
85 # Be Bourne compatible
86 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
87 emulate sh
88 NULLCMD=:
89 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
90 # is contrary to our usage. Disable this feature.
91 alias -g '${1+"$@"}'='"$@"'
92 setopt NO_GLOB_SUBST
93 else
94 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
96 BIN_SH=xpg4; export BIN_SH # for Tru64
97 DUALCASE=1; export DUALCASE # for MKS sh
99 # A function that is used when there is no print builtin or printf.
100 func_fallback_echo ()
102 eval 'cat <<_LTECHO_EOF
104 _LTECHO_EOF'
107 # NLS nuisances: We save the old values to restore during execute mode.
108 lt_user_locale=
109 lt_safe_locale=
110 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
112 eval "if test \"\${$lt_var+set}\" = set; then
113 save_$lt_var=\$$lt_var
114 $lt_var=C
115 export $lt_var
116 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
117 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
119 done
120 LC_ALL=C
121 LANGUAGE=C
122 export LANGUAGE LC_ALL
124 $lt_unset CDPATH
127 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
128 # is ksh but when the shell is invoked as "sh" and the current value of
129 # the _XPG environment variable is not equal to 1 (one), the special
130 # positional parameter $0, within a function call, is the name of the
131 # function.
132 progpath="$0"
136 : ${CP="cp -f"}
137 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
138 : ${EGREP="grep -E"}
139 : ${FGREP="grep -F"}
140 : ${GREP="grep"}
141 : ${LN_S="ln -s"}
142 : ${MAKE="make"}
143 : ${MKDIR="mkdir"}
144 : ${MV="mv -f"}
145 : ${RM="rm -f"}
146 : ${SED="sed"}
147 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
148 : ${Xsed="$SED -e 1s/^X//"}
150 # Global variables:
151 EXIT_SUCCESS=0
152 EXIT_FAILURE=1
153 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
154 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
156 exit_status=$EXIT_SUCCESS
158 # Make sure IFS has a sensible default
159 lt_nl='
161 IFS=" $lt_nl"
163 dirname="s,/[^/]*$,,"
164 basename="s,^.*/,,"
166 # func_dirname_and_basename file append nondir_replacement
167 # perform func_basename and func_dirname in a single function
168 # call:
169 # dirname: Compute the dirname of FILE. If nonempty,
170 # add APPEND to the result, otherwise set result
171 # to NONDIR_REPLACEMENT.
172 # value returned in "$func_dirname_result"
173 # basename: Compute filename of FILE.
174 # value retuned in "$func_basename_result"
175 # Implementation must be kept synchronized with func_dirname
176 # and func_basename. For efficiency, we do not delegate to
177 # those functions but instead duplicate the functionality here.
178 func_dirname_and_basename ()
180 # Extract subdirectory from the argument.
181 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
182 if test "X$func_dirname_result" = "X${1}"; then
183 func_dirname_result="${3}"
184 else
185 func_dirname_result="$func_dirname_result${2}"
187 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
190 # Generated shell functions inserted here.
192 # These SED scripts presuppose an absolute path with a trailing slash.
193 pathcar='s,^/\([^/]*\).*$,\1,'
194 pathcdr='s,^/[^/]*,,'
195 removedotparts=':dotsl
196 s@/\./@/@g
197 t dotsl
198 s,/\.$,/,'
199 collapseslashes='s@/\{1,\}@/@g'
200 finalslash='s,/*$,/,'
202 # func_normal_abspath PATH
203 # Remove doubled-up and trailing slashes, "." path components,
204 # and cancel out any ".." path components in PATH after making
205 # it an absolute path.
206 # value returned in "$func_normal_abspath_result"
207 func_normal_abspath ()
209 # Start from root dir and reassemble the path.
210 func_normal_abspath_result=
211 func_normal_abspath_tpath=$1
212 func_normal_abspath_altnamespace=
213 case $func_normal_abspath_tpath in
215 # Empty path, that just means $cwd.
216 func_stripname '' '/' "`pwd`"
217 func_normal_abspath_result=$func_stripname_result
218 return
220 # The next three entries are used to spot a run of precisely
221 # two leading slashes without using negated character classes;
222 # we take advantage of case's first-match behaviour.
223 ///*)
224 # Unusual form of absolute path, do nothing.
226 //*)
227 # Not necessarily an ordinary path; POSIX reserves leading '//'
228 # and for example Cygwin uses it to access remote file shares
229 # over CIFS/SMB, so we conserve a leading double slash if found.
230 func_normal_abspath_altnamespace=/
233 # Absolute path, do nothing.
236 # Relative path, prepend $cwd.
237 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
239 esac
240 # Cancel out all the simple stuff to save iterations. We also want
241 # the path to end with a slash for ease of parsing, so make sure
242 # there is one (and only one) here.
243 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
244 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
245 while :; do
246 # Processed it all yet?
247 if test "$func_normal_abspath_tpath" = / ; then
248 # If we ascended to the root using ".." the result may be empty now.
249 if test -z "$func_normal_abspath_result" ; then
250 func_normal_abspath_result=/
252 break
254 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
255 -e "$pathcar"`
256 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
257 -e "$pathcdr"`
258 # Figure out what to do with it
259 case $func_normal_abspath_tcomponent in
261 # Trailing empty path component, ignore it.
264 # Parent dir; strip last assembled component from result.
265 func_dirname "$func_normal_abspath_result"
266 func_normal_abspath_result=$func_dirname_result
269 # Actual path component, append it.
270 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
272 esac
273 done
274 # Restore leading double-slash if one was found on entry.
275 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
278 # func_relative_path SRCDIR DSTDIR
279 # generates a relative path from SRCDIR to DSTDIR, with a trailing
280 # slash if non-empty, suitable for immediately appending a filename
281 # without needing to append a separator.
282 # value returned in "$func_relative_path_result"
283 func_relative_path ()
285 func_relative_path_result=
286 func_normal_abspath "$1"
287 func_relative_path_tlibdir=$func_normal_abspath_result
288 func_normal_abspath "$2"
289 func_relative_path_tbindir=$func_normal_abspath_result
291 # Ascend the tree starting from libdir
292 while :; do
293 # check if we have found a prefix of bindir
294 case $func_relative_path_tbindir in
295 $func_relative_path_tlibdir)
296 # found an exact match
297 func_relative_path_tcancelled=
298 break
300 $func_relative_path_tlibdir*)
301 # found a matching prefix
302 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
303 func_relative_path_tcancelled=$func_stripname_result
304 if test -z "$func_relative_path_result"; then
305 func_relative_path_result=.
307 break
310 func_dirname $func_relative_path_tlibdir
311 func_relative_path_tlibdir=${func_dirname_result}
312 if test "x$func_relative_path_tlibdir" = x ; then
313 # Have to descend all the way to the root!
314 func_relative_path_result=../$func_relative_path_result
315 func_relative_path_tcancelled=$func_relative_path_tbindir
316 break
318 func_relative_path_result=../$func_relative_path_result
320 esac
321 done
323 # Now calculate path; take care to avoid doubling-up slashes.
324 func_stripname '' '/' "$func_relative_path_result"
325 func_relative_path_result=$func_stripname_result
326 func_stripname '/' '/' "$func_relative_path_tcancelled"
327 if test "x$func_stripname_result" != x ; then
328 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
331 # Normalisation. If bindir is libdir, return empty string,
332 # else relative path ending with a slash; either way, target
333 # file name can be directly appended.
334 if test ! -z "$func_relative_path_result"; then
335 func_stripname './' '' "$func_relative_path_result/"
336 func_relative_path_result=$func_stripname_result
340 # The name of this program:
341 func_dirname_and_basename "$progpath"
342 progname=$func_basename_result
344 # Make sure we have an absolute path for reexecution:
345 case $progpath in
346 [\\/]*|[A-Za-z]:\\*) ;;
347 *[\\/]*)
348 progdir=$func_dirname_result
349 progdir=`cd "$progdir" && pwd`
350 progpath="$progdir/$progname"
353 save_IFS="$IFS"
354 IFS=:
355 for progdir in $PATH; do
356 IFS="$save_IFS"
357 test -x "$progdir/$progname" && break
358 done
359 IFS="$save_IFS"
360 test -n "$progdir" || progdir=`pwd`
361 progpath="$progdir/$progname"
363 esac
365 # Sed substitution that helps us do robust quoting. It backslashifies
366 # metacharacters that are still active within double-quoted strings.
367 Xsed="${SED}"' -e 1s/^X//'
368 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
370 # Same as above, but do not quote variable references.
371 double_quote_subst='s/\(["`\\]\)/\\\1/g'
373 # Re-`\' parameter expansions in output of double_quote_subst that were
374 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
375 # in input to double_quote_subst, that '$' was protected from expansion.
376 # Since each input `\' is now two `\'s, look for any number of runs of
377 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
378 bs='\\'
379 bs2='\\\\'
380 bs4='\\\\\\\\'
381 dollar='\$'
382 sed_double_backslash="\
383 s/$bs4/&\\
385 s/^$bs2$dollar/$bs&/
386 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
387 s/\n//g"
389 # Standard options:
390 opt_dry_run=false
391 opt_help=false
392 opt_quiet=false
393 opt_verbose=false
394 opt_warning=:
396 # func_echo arg...
397 # Echo program name prefixed message, along with the current mode
398 # name if it has been set yet.
399 func_echo ()
401 $ECHO "$progname${mode+: }$mode: $*"
404 # func_verbose arg...
405 # Echo program name prefixed message in verbose mode only.
406 func_verbose ()
408 $opt_verbose && func_echo ${1+"$@"}
410 # A bug in bash halts the script if the last line of a function
411 # fails when set -e is in force, so we need another command to
412 # work around that:
416 # func_echo_all arg...
417 # Invoke $ECHO with all args, space-separated.
418 func_echo_all ()
420 $ECHO "$*"
423 # func_error arg...
424 # Echo program name prefixed message to standard error.
425 func_error ()
427 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
430 # func_warning arg...
431 # Echo program name prefixed warning message to standard error.
432 func_warning ()
434 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
436 # bash bug again:
440 # func_fatal_error arg...
441 # Echo program name prefixed message to standard error, and exit.
442 func_fatal_error ()
444 func_error ${1+"$@"}
445 exit $EXIT_FAILURE
448 # func_fatal_help arg...
449 # Echo program name prefixed message to standard error, followed by
450 # a help hint, and exit.
451 func_fatal_help ()
453 func_error ${1+"$@"}
454 func_fatal_error "$help"
456 help="Try \`$progname --help' for more information." ## default
459 # func_grep expression filename
460 # Check whether EXPRESSION matches any line of FILENAME, without output.
461 func_grep ()
463 $GREP "$1" "$2" >/dev/null 2>&1
467 # func_mkdir_p directory-path
468 # Make sure the entire path to DIRECTORY-PATH is available.
469 func_mkdir_p ()
471 my_directory_path="$1"
472 my_dir_list=
474 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
476 # Protect directory names starting with `-'
477 case $my_directory_path in
478 -*) my_directory_path="./$my_directory_path" ;;
479 esac
481 # While some portion of DIR does not yet exist...
482 while test ! -d "$my_directory_path"; do
483 # ...make a list in topmost first order. Use a colon delimited
484 # list incase some portion of path contains whitespace.
485 my_dir_list="$my_directory_path:$my_dir_list"
487 # If the last portion added has no slash in it, the list is done
488 case $my_directory_path in */*) ;; *) break ;; esac
490 # ...otherwise throw away the child directory and loop
491 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
492 done
493 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
495 save_mkdir_p_IFS="$IFS"; IFS=':'
496 for my_dir in $my_dir_list; do
497 IFS="$save_mkdir_p_IFS"
498 # mkdir can fail with a `File exist' error if two processes
499 # try to create one of the directories concurrently. Don't
500 # stop in that case!
501 $MKDIR "$my_dir" 2>/dev/null || :
502 done
503 IFS="$save_mkdir_p_IFS"
505 # Bail out if we (or some other process) failed to create a directory.
506 test -d "$my_directory_path" || \
507 func_fatal_error "Failed to create \`$1'"
512 # func_mktempdir [string]
513 # Make a temporary directory that won't clash with other running
514 # libtool processes, and avoids race conditions if possible. If
515 # given, STRING is the basename for that directory.
516 func_mktempdir ()
518 my_template="${TMPDIR-/tmp}/${1-$progname}"
520 if test "$opt_dry_run" = ":"; then
521 # Return a directory name, but don't create it in dry-run mode
522 my_tmpdir="${my_template}-$$"
523 else
525 # If mktemp works, use that first and foremost
526 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
528 if test ! -d "$my_tmpdir"; then
529 # Failing that, at least try and use $RANDOM to avoid a race
530 my_tmpdir="${my_template}-${RANDOM-0}$$"
532 save_mktempdir_umask=`umask`
533 umask 0077
534 $MKDIR "$my_tmpdir"
535 umask $save_mktempdir_umask
538 # If we're not in dry-run mode, bomb out on failure
539 test -d "$my_tmpdir" || \
540 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
543 $ECHO "$my_tmpdir"
547 # func_quote_for_eval arg
548 # Aesthetically quote ARG to be evaled later.
549 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
550 # is double-quoted, suitable for a subsequent eval, whereas
551 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
552 # which are still active within double quotes backslashified.
553 func_quote_for_eval ()
555 case $1 in
556 *[\\\`\"\$]*)
557 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
559 func_quote_for_eval_unquoted_result="$1" ;;
560 esac
562 case $func_quote_for_eval_unquoted_result in
563 # Double-quote args containing shell metacharacters to delay
564 # word splitting, command substitution and and variable
565 # expansion for a subsequent eval.
566 # Many Bourne shells cannot handle close brackets correctly
567 # in scan sets, so we specify it separately.
568 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
569 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
572 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
573 esac
577 # func_quote_for_expand arg
578 # Aesthetically quote ARG to be evaled later; same as above,
579 # but do not quote variable references.
580 func_quote_for_expand ()
582 case $1 in
583 *[\\\`\"]*)
584 my_arg=`$ECHO "$1" | $SED \
585 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
587 my_arg="$1" ;;
588 esac
590 case $my_arg in
591 # Double-quote args containing shell metacharacters to delay
592 # word splitting and command substitution for a subsequent eval.
593 # Many Bourne shells cannot handle close brackets correctly
594 # in scan sets, so we specify it separately.
595 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
596 my_arg="\"$my_arg\""
598 esac
600 func_quote_for_expand_result="$my_arg"
604 # func_show_eval cmd [fail_exp]
605 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
606 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
607 # is given, then evaluate it.
608 func_show_eval ()
610 my_cmd="$1"
611 my_fail_exp="${2-:}"
613 ${opt_silent-false} || {
614 func_quote_for_expand "$my_cmd"
615 eval "func_echo $func_quote_for_expand_result"
618 if ${opt_dry_run-false}; then :; else
619 eval "$my_cmd"
620 my_status=$?
621 if test "$my_status" -eq 0; then :; else
622 eval "(exit $my_status); $my_fail_exp"
628 # func_show_eval_locale cmd [fail_exp]
629 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
630 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
631 # is given, then evaluate it. Use the saved locale for evaluation.
632 func_show_eval_locale ()
634 my_cmd="$1"
635 my_fail_exp="${2-:}"
637 ${opt_silent-false} || {
638 func_quote_for_expand "$my_cmd"
639 eval "func_echo $func_quote_for_expand_result"
642 if ${opt_dry_run-false}; then :; else
643 eval "$lt_user_locale
644 $my_cmd"
645 my_status=$?
646 eval "$lt_safe_locale"
647 if test "$my_status" -eq 0; then :; else
648 eval "(exit $my_status); $my_fail_exp"
654 # func_version
655 # Echo version message to standard output and exit.
656 func_version ()
658 $SED -n '/(C)/!b go
659 :more
660 /\./!{
662 s/\n# / /
663 b more
666 /^# '$PROGRAM' (GNU /,/# warranty; / {
667 s/^# //
668 s/^# *$//
669 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
671 }' < "$progpath"
672 exit $?
675 # func_usage
676 # Echo short help message to standard output and exit.
677 func_usage ()
679 $SED -n '/^# Usage:/,/^# *.*--help/ {
680 s/^# //
681 s/^# *$//
682 s/\$progname/'$progname'/
684 }' < "$progpath"
685 echo
686 $ECHO "run \`$progname --help | more' for full usage"
687 exit $?
690 # func_help [NOEXIT]
691 # Echo long help message to standard output and exit,
692 # unless 'noexit' is passed as argument.
693 func_help ()
695 $SED -n '/^# Usage:/,/# Report bugs to/ {
696 s/^# //
697 s/^# *$//
698 s*\$progname*'$progname'*
699 s*\$host*'"$host"'*
700 s*\$SHELL*'"$SHELL"'*
701 s*\$LTCC*'"$LTCC"'*
702 s*\$LTCFLAGS*'"$LTCFLAGS"'*
703 s*\$LD*'"$LD"'*
704 s/\$with_gnu_ld/'"$with_gnu_ld"'/
705 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
706 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
708 }' < "$progpath"
709 ret=$?
710 if test -z "$1"; then
711 exit $ret
715 # func_missing_arg argname
716 # Echo program name prefixed message to standard error and set global
717 # exit_cmd.
718 func_missing_arg ()
720 func_error "missing argument for $1."
721 exit_cmd=exit
724 exit_cmd=:
731 magic="%%%MAGIC variable%%%"
732 magic_exe="%%%MAGIC EXE variable%%%"
734 # Global variables.
735 # $mode is unset
736 nonopt=
737 execute_dlfiles=
738 preserve_args=
739 lo2o="s/\\.lo\$/.${objext}/"
740 o2lo="s/\\.${objext}\$/.lo/"
741 extracted_archives=
742 extracted_serial=0
744 opt_dry_run=false
745 opt_duplicate_deps=false
746 opt_silent=false
747 opt_debug=:
749 # If this variable is set in any of the actions, the command in it
750 # will be execed at the end. This prevents here-documents from being
751 # left over by shells.
752 exec_cmd=
754 # func_fatal_configuration arg...
755 # Echo program name prefixed message to standard error, followed by
756 # a configuration failure hint, and exit.
757 func_fatal_configuration ()
759 func_error ${1+"$@"}
760 func_error "See the $PACKAGE documentation for more information."
761 func_fatal_error "Fatal configuration error."
765 # func_config
766 # Display the configuration for all the tags in this script.
767 func_config ()
769 re_begincf='^# ### BEGIN LIBTOOL'
770 re_endcf='^# ### END LIBTOOL'
772 # Default configuration.
773 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
775 # Now print the configurations for the tags.
776 for tagname in $taglist; do
777 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
778 done
780 exit $?
783 # func_features
784 # Display the features supported by this script.
785 func_features ()
787 echo "host: $host"
788 if test "$build_libtool_libs" = yes; then
789 echo "enable shared libraries"
790 else
791 echo "disable shared libraries"
793 if test "$build_old_libs" = yes; then
794 echo "enable static libraries"
795 else
796 echo "disable static libraries"
799 exit $?
802 # func_enable_tag tagname
803 # Verify that TAGNAME is valid, and either flag an error and exit, or
804 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
805 # variable here.
806 func_enable_tag ()
808 # Global variable:
809 tagname="$1"
811 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
812 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
813 sed_extractcf="/$re_begincf/,/$re_endcf/p"
815 # Validate tagname.
816 case $tagname in
817 *[!-_A-Za-z0-9,/]*)
818 func_fatal_error "invalid tag name: $tagname"
820 esac
822 # Don't test for the "default" C tag, as we know it's
823 # there but not specially marked.
824 case $tagname in
825 CC) ;;
827 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
828 taglist="$taglist $tagname"
830 # Evaluate the configuration. Be careful to quote the path
831 # and the sed script, to avoid splitting on whitespace, but
832 # also don't use non-portable quotes within backquotes within
833 # quotes we have to do it in 2 steps:
834 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
835 eval "$extractedcf"
836 else
837 func_error "ignoring unknown tag $tagname"
840 esac
843 # Parse options once, thoroughly. This comes as soon as possible in
844 # the script to make things like `libtool --version' happen quickly.
847 # Shorthand for --mode=foo, only valid as the first argument
848 case $1 in
849 clean|clea|cle|cl)
850 shift; set dummy --mode clean ${1+"$@"}; shift
852 compile|compil|compi|comp|com|co|c)
853 shift; set dummy --mode compile ${1+"$@"}; shift
855 execute|execut|execu|exec|exe|ex|e)
856 shift; set dummy --mode execute ${1+"$@"}; shift
858 finish|finis|fini|fin|fi|f)
859 shift; set dummy --mode finish ${1+"$@"}; shift
861 install|instal|insta|inst|ins|in|i)
862 shift; set dummy --mode install ${1+"$@"}; shift
864 link|lin|li|l)
865 shift; set dummy --mode link ${1+"$@"}; shift
867 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
868 shift; set dummy --mode uninstall ${1+"$@"}; shift
870 esac
872 # Parse non-mode specific arguments:
873 while test "$#" -gt 0; do
874 opt="$1"
875 shift
877 case $opt in
878 --config) func_config ;;
880 --debug) preserve_args="$preserve_args $opt"
881 func_echo "enabling shell trace mode"
882 opt_debug='set -x'
883 $opt_debug
886 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
887 execute_dlfiles="$execute_dlfiles $1"
888 shift
891 --dry-run | -n) opt_dry_run=: ;;
892 --features) func_features ;;
893 --finish) mode="finish" ;;
895 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
896 case $1 in
897 # Valid mode arguments:
898 clean) ;;
899 compile) ;;
900 execute) ;;
901 finish) ;;
902 install) ;;
903 link) ;;
904 relink) ;;
905 uninstall) ;;
907 # Catch anything else as an error
908 *) func_error "invalid argument for $opt"
909 exit_cmd=exit
910 break
912 esac
914 mode="$1"
915 shift
918 --preserve-dup-deps)
919 opt_duplicate_deps=: ;;
921 --quiet|--silent) preserve_args="$preserve_args $opt"
922 opt_silent=:
923 opt_verbose=false
926 --no-quiet|--no-silent)
927 preserve_args="$preserve_args $opt"
928 opt_silent=false
931 --verbose| -v) preserve_args="$preserve_args $opt"
932 opt_silent=false
933 opt_verbose=:
936 --no-verbose) preserve_args="$preserve_args $opt"
937 opt_verbose=false
940 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
941 preserve_args="$preserve_args $opt $1"
942 func_enable_tag "$1" # tagname is set here
943 shift
946 # Separate optargs to long options:
947 -dlopen=*|--mode=*|--tag=*)
948 func_opt_split "$opt"
949 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
950 shift
953 -\?|-h) func_usage ;;
954 --help) opt_help=: ;;
955 --help-all) opt_help=': help-all' ;;
956 --version) func_version ;;
958 -*) func_fatal_help "unrecognized option \`$opt'" ;;
960 *) nonopt="$opt"
961 break
963 esac
964 done
967 case $host in
968 *cygwin* | *mingw* | *pw32* | *cegcc*)
969 # don't eliminate duplications in $postdeps and $predeps
970 opt_duplicate_compiler_generated_deps=:
973 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
975 esac
977 # Having warned about all mis-specified options, bail out if
978 # anything was wrong.
979 $exit_cmd $EXIT_FAILURE
982 # func_check_version_match
983 # Ensure that we are using m4 macros, and libtool script from the same
984 # release of libtool.
985 func_check_version_match ()
987 if test "$package_revision" != "$macro_revision"; then
988 if test "$VERSION" != "$macro_version"; then
989 if test -z "$macro_version"; then
990 cat >&2 <<_LT_EOF
991 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
992 $progname: definition of this LT_INIT comes from an older release.
993 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
994 $progname: and run autoconf again.
995 _LT_EOF
996 else
997 cat >&2 <<_LT_EOF
998 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
999 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1000 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1001 $progname: and run autoconf again.
1002 _LT_EOF
1004 else
1005 cat >&2 <<_LT_EOF
1006 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1007 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1008 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1009 $progname: of $PACKAGE $VERSION and run autoconf again.
1010 _LT_EOF
1013 exit $EXIT_MISMATCH
1018 ## ----------- ##
1019 ## Main. ##
1020 ## ----------- ##
1022 $opt_help || {
1023 # Sanity checks first:
1024 func_check_version_match
1026 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1027 func_fatal_configuration "not configured to build any kind of library"
1030 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1033 # Darwin sucks
1034 eval std_shrext=\"$shrext_cmds\"
1037 # Only execute mode is allowed to have -dlopen flags.
1038 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1039 func_error "unrecognized option \`-dlopen'"
1040 $ECHO "$help" 1>&2
1041 exit $EXIT_FAILURE
1044 # Change the help message to a mode-specific one.
1045 generic_help="$help"
1046 help="Try \`$progname --help --mode=$mode' for more information."
1050 # func_lalib_p file
1051 # True iff FILE is a libtool `.la' library or `.lo' object file.
1052 # This function is only a basic sanity check; it will hardly flush out
1053 # determined imposters.
1054 func_lalib_p ()
1056 test -f "$1" &&
1057 $SED -e 4q "$1" 2>/dev/null \
1058 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1061 # func_lalib_unsafe_p file
1062 # True iff FILE is a libtool `.la' library or `.lo' object file.
1063 # This function implements the same check as func_lalib_p without
1064 # resorting to external programs. To this end, it redirects stdin and
1065 # closes it afterwards, without saving the original file descriptor.
1066 # As a safety measure, use it only where a negative result would be
1067 # fatal anyway. Works if `file' does not exist.
1068 func_lalib_unsafe_p ()
1070 lalib_p=no
1071 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1072 for lalib_p_l in 1 2 3 4
1074 read lalib_p_line
1075 case "$lalib_p_line" in
1076 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1077 esac
1078 done
1079 exec 0<&5 5<&-
1081 test "$lalib_p" = yes
1084 # func_ltwrapper_script_p file
1085 # True iff FILE is a libtool wrapper script
1086 # This function is only a basic sanity check; it will hardly flush out
1087 # determined imposters.
1088 func_ltwrapper_script_p ()
1090 func_lalib_p "$1"
1093 # func_ltwrapper_executable_p file
1094 # True iff FILE is a libtool wrapper executable
1095 # This function is only a basic sanity check; it will hardly flush out
1096 # determined imposters.
1097 func_ltwrapper_executable_p ()
1099 func_ltwrapper_exec_suffix=
1100 case $1 in
1101 *.exe) ;;
1102 *) func_ltwrapper_exec_suffix=.exe ;;
1103 esac
1104 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1107 # func_ltwrapper_scriptname file
1108 # Assumes file is an ltwrapper_executable
1109 # uses $file to determine the appropriate filename for a
1110 # temporary ltwrapper_script.
1111 func_ltwrapper_scriptname ()
1113 func_ltwrapper_scriptname_result=""
1114 if func_ltwrapper_executable_p "$1"; then
1115 func_dirname_and_basename "$1" "" "."
1116 func_stripname '' '.exe' "$func_basename_result"
1117 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1121 # func_ltwrapper_p file
1122 # True iff FILE is a libtool wrapper script or wrapper executable
1123 # This function is only a basic sanity check; it will hardly flush out
1124 # determined imposters.
1125 func_ltwrapper_p ()
1127 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1131 # func_execute_cmds commands fail_cmd
1132 # Execute tilde-delimited COMMANDS.
1133 # If FAIL_CMD is given, eval that upon failure.
1134 # FAIL_CMD may read-access the current command in variable CMD!
1135 func_execute_cmds ()
1137 $opt_debug
1138 save_ifs=$IFS; IFS='~'
1139 for cmd in $1; do
1140 IFS=$save_ifs
1141 eval cmd=\"$cmd\"
1142 func_show_eval "$cmd" "${2-:}"
1143 done
1144 IFS=$save_ifs
1148 # func_source file
1149 # Source FILE, adding directory component if necessary.
1150 # Note that it is not necessary on cygwin/mingw to append a dot to
1151 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1152 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1153 # `FILE.' does not work on cygwin managed mounts.
1154 func_source ()
1156 $opt_debug
1157 case $1 in
1158 */* | *\\*) . "$1" ;;
1159 *) . "./$1" ;;
1160 esac
1164 # func_infer_tag arg
1165 # Infer tagged configuration to use if any are available and
1166 # if one wasn't chosen via the "--tag" command line option.
1167 # Only attempt this if the compiler in the base compile
1168 # command doesn't match the default compiler.
1169 # arg is usually of the form 'gcc ...'
1170 func_infer_tag ()
1172 $opt_debug
1174 # FreeBSD-specific: where we install compilers with non-standard names
1175 tag_compilers_CC="*cc cc* *gcc gcc* clang"
1176 tag_compilers_CXX="*c++ c++* *g++ g++* clang++"
1177 base_compiler=`set -- "$@"; echo $1`
1179 # If $tagname isn't set, then try to infer if the default "CC" tag applies
1180 if test -z "$tagname"; then
1181 for zp in $tag_compilers_CC; do
1182 case $base_compiler in
1183 $zp) tagname="CC"; break;;
1184 esac
1185 done
1188 if test -n "$available_tags" && test -z "$tagname"; then
1189 CC_quoted=
1190 for arg in $CC; do
1191 func_quote_for_eval "$arg"
1192 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1193 done
1194 CC_expanded=`func_echo_all $CC`
1195 CC_quoted_expanded=`func_echo_all $CC_quoted`
1196 case $@ in
1197 # Blanks in the command may have been stripped by the calling shell,
1198 # but not from the CC environment variable when configure was run.
1199 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1200 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1201 # Blanks at the start of $base_compile will cause this to fail
1202 # if we don't check for them as well.
1204 for z in $available_tags; do
1205 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1206 # Evaluate the configuration.
1207 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1208 CC_quoted=
1209 for arg in $CC; do
1210 # Double-quote args containing other shell metacharacters.
1211 func_quote_for_eval "$arg"
1212 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1213 done
1214 CC_expanded=`func_echo_all $CC`
1215 CC_quoted_expanded=`func_echo_all $CC_quoted`
1216 case "$@ " in
1217 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1218 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1219 # The compiler in the base compile command matches
1220 # the one in the tagged configuration.
1221 # Assume this is the tagged configuration we want.
1222 tagname=$z
1223 break
1225 esac
1227 # FreeBSD-specific: try compilers based on inferred tag
1228 if test -z "$tagname"; then
1229 eval "tag_compilers=\$tag_compilers_${z}"
1230 if test -n "$tag_compilers"; then
1231 for zp in $tag_compilers; do
1232 case $base_compiler in
1233 $zp) tagname=$z; break;;
1234 esac
1235 done
1236 if test -n "$tagname"; then
1237 break
1242 done
1243 # If $tagname still isn't set, then no tagged configuration
1244 # was found and let the user know that the "--tag" command
1245 # line option must be used.
1246 if test -z "$tagname"; then
1247 func_echo "unable to infer tagged configuration"
1248 func_fatal_error "specify a tag with \`--tag'"
1249 # else
1250 # func_verbose "using $tagname tagged configuration"
1253 esac
1259 # func_write_libtool_object output_name pic_name nonpic_name
1260 # Create a libtool object file (analogous to a ".la" file),
1261 # but don't create it if we're doing a dry run.
1262 func_write_libtool_object ()
1264 write_libobj=${1}
1265 if test "$build_libtool_libs" = yes; then
1266 write_lobj=\'${2}\'
1267 else
1268 write_lobj=none
1271 if test "$build_old_libs" = yes; then
1272 write_oldobj=\'${3}\'
1273 else
1274 write_oldobj=none
1277 $opt_dry_run || {
1278 cat >${write_libobj}T <<EOF
1279 # $write_libobj - a libtool object file
1280 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1282 # Please DO NOT delete this file!
1283 # It is necessary for linking the library.
1285 # Name of the PIC object.
1286 pic_object=$write_lobj
1288 # Name of the non-PIC object
1289 non_pic_object=$write_oldobj
1292 $MV "${write_libobj}T" "${write_libobj}"
1296 # func_mode_compile arg...
1297 func_mode_compile ()
1299 $opt_debug
1300 # Get the compilation command and the source file.
1301 base_compile=
1302 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1303 suppress_opt=yes
1304 suppress_output=
1305 arg_mode=normal
1306 libobj=
1307 later=
1308 pie_flag=
1310 for arg
1312 case $arg_mode in
1313 arg )
1314 # do not "continue". Instead, add this to base_compile
1315 lastarg="$arg"
1316 arg_mode=normal
1319 target )
1320 libobj="$arg"
1321 arg_mode=normal
1322 continue
1325 normal )
1326 # Accept any command-line options.
1327 case $arg in
1329 test -n "$libobj" && \
1330 func_fatal_error "you cannot specify \`-o' more than once"
1331 arg_mode=target
1332 continue
1335 -pie | -fpie | -fPIE)
1336 pie_flag="$pie_flag $arg"
1337 continue
1340 -shared | -static | -prefer-pic | -prefer-non-pic)
1341 later="$later $arg"
1342 continue
1345 -no-suppress)
1346 suppress_opt=no
1347 continue
1350 -Xcompiler)
1351 arg_mode=arg # the next one goes into the "base_compile" arg list
1352 continue # The current "srcfile" will either be retained or
1353 ;; # replaced later. I would guess that would be a bug.
1355 -Wc,*)
1356 func_stripname '-Wc,' '' "$arg"
1357 args=$func_stripname_result
1358 lastarg=
1359 save_ifs="$IFS"; IFS=','
1360 for arg in $args; do
1361 IFS="$save_ifs"
1362 func_quote_for_eval "$arg"
1363 lastarg="$lastarg $func_quote_for_eval_result"
1364 done
1365 IFS="$save_ifs"
1366 func_stripname ' ' '' "$lastarg"
1367 lastarg=$func_stripname_result
1369 # Add the arguments to base_compile.
1370 base_compile="$base_compile $lastarg"
1371 continue
1375 # Accept the current argument as the source file.
1376 # The previous "srcfile" becomes the current argument.
1378 lastarg="$srcfile"
1379 srcfile="$arg"
1381 esac # case $arg
1383 esac # case $arg_mode
1385 # Aesthetically quote the previous argument.
1386 func_quote_for_eval "$lastarg"
1387 base_compile="$base_compile $func_quote_for_eval_result"
1388 done # for arg
1390 case $arg_mode in
1391 arg)
1392 func_fatal_error "you must specify an argument for -Xcompile"
1394 target)
1395 func_fatal_error "you must specify a target with \`-o'"
1398 # Get the name of the library object.
1399 test -z "$libobj" && {
1400 func_basename "$srcfile"
1401 libobj="$func_basename_result"
1404 esac
1406 # Recognize several different file suffixes.
1407 # If the user specifies -o file.o, it is replaced with file.lo
1408 case $libobj in
1409 *.[cCFSifmso] | \
1410 *.ada | *.adb | *.ads | *.asm | \
1411 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1412 *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
1413 func_xform "$libobj"
1414 libobj=$func_xform_result
1416 esac
1418 case $libobj in
1419 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1421 func_fatal_error "cannot determine name of library object from \`$libobj'"
1423 esac
1425 func_infer_tag $base_compile
1427 for arg in $later; do
1428 case $arg in
1429 -shared)
1430 test "$build_libtool_libs" != yes && \
1431 func_fatal_configuration "can not build a shared library"
1432 build_old_libs=no
1433 continue
1436 -static)
1437 build_libtool_libs=no
1438 build_old_libs=yes
1439 continue
1442 -prefer-pic)
1443 pic_mode=yes
1444 continue
1447 -prefer-non-pic)
1448 pic_mode=no
1449 continue
1451 esac
1452 done
1454 func_quote_for_eval "$libobj"
1455 test "X$libobj" != "X$func_quote_for_eval_result" \
1456 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1457 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1458 func_dirname_and_basename "$obj" "/" ""
1459 objname="$func_basename_result"
1460 xdir="$func_dirname_result"
1461 lobj=${xdir}$objdir/$objname
1463 test -z "$base_compile" && \
1464 func_fatal_help "you must specify a compilation command"
1466 # Delete any leftover library objects.
1467 if test "$build_old_libs" = yes; then
1468 removelist="$obj $lobj $libobj ${libobj}T"
1469 else
1470 removelist="$lobj $libobj ${libobj}T"
1473 # On Cygwin there's no "real" PIC flag so we must build both object types
1474 case $host_os in
1475 cygwin* | mingw* | pw32* | os2* | cegcc*)
1476 pic_mode=default
1478 esac
1479 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1480 # non-PIC code in shared libraries is not supported
1481 pic_mode=default
1484 # Calculate the filename of the output object if compiler does
1485 # not support -o with -c
1486 if test "$compiler_c_o" = no; then
1487 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
1488 lockfile="$output_obj.lock"
1489 else
1490 output_obj=
1491 need_locks=no
1492 lockfile=
1495 # Lock this critical section if it is needed
1496 # We use this script file to make the link, it avoids creating a new file
1497 if test "$need_locks" = yes; then
1498 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1499 func_echo "Waiting for $lockfile to be removed"
1500 sleep 2
1501 done
1502 elif test "$need_locks" = warn; then
1503 if test -f "$lockfile"; then
1504 $ECHO "\
1505 *** ERROR, $lockfile exists and contains:
1506 `cat $lockfile 2>/dev/null`
1508 This indicates that another process is trying to use the same
1509 temporary object file, and libtool could not work around it because
1510 your compiler does not support \`-c' and \`-o' together. If you
1511 repeat this compilation, it may succeed, by chance, but you had better
1512 avoid parallel builds (make -j) in this platform, or get a better
1513 compiler."
1515 $opt_dry_run || $RM $removelist
1516 exit $EXIT_FAILURE
1518 removelist="$removelist $output_obj"
1519 $ECHO "$srcfile" > "$lockfile"
1522 $opt_dry_run || $RM $removelist
1523 removelist="$removelist $lockfile"
1524 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1526 if test -n "$fix_srcfile_path"; then
1527 eval srcfile=\"$fix_srcfile_path\"
1529 func_quote_for_eval "$srcfile"
1530 qsrcfile=$func_quote_for_eval_result
1532 # Only build a PIC object if we are building libtool libraries.
1533 if test "$build_libtool_libs" = yes; then
1534 # Without this assignment, base_compile gets emptied.
1535 fbsd_hideous_sh_bug=$base_compile
1537 if test "$pic_mode" != no; then
1538 command="$base_compile $qsrcfile $pic_flag"
1539 else
1540 # Don't build PIC code
1541 command="$base_compile $qsrcfile"
1544 func_mkdir_p "$xdir$objdir"
1546 if test -z "$output_obj"; then
1547 # Place PIC objects in $objdir
1548 command="$command -o $lobj"
1551 func_show_eval_locale "$command" \
1552 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1554 if test "$need_locks" = warn &&
1555 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1556 $ECHO "\
1557 *** ERROR, $lockfile contains:
1558 `cat $lockfile 2>/dev/null`
1560 but it should contain:
1561 $srcfile
1563 This indicates that another process is trying to use the same
1564 temporary object file, and libtool could not work around it because
1565 your compiler does not support \`-c' and \`-o' together. If you
1566 repeat this compilation, it may succeed, by chance, but you had better
1567 avoid parallel builds (make -j) in this platform, or get a better
1568 compiler."
1570 $opt_dry_run || $RM $removelist
1571 exit $EXIT_FAILURE
1574 # Just move the object if needed, then go on to compile the next one
1575 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1576 func_show_eval '$MV "$output_obj" "$lobj"' \
1577 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1580 # Allow error messages only from the first compilation.
1581 if test "$suppress_opt" = yes; then
1582 suppress_output=' >/dev/null 2>&1'
1586 # Only build a position-dependent object if we build old libraries.
1587 if test "$build_old_libs" = yes; then
1588 if test "$pic_mode" != yes; then
1589 # Don't build PIC code
1590 command="$base_compile $qsrcfile$pie_flag"
1591 else
1592 command="$base_compile $qsrcfile $pic_flag"
1594 if test "$compiler_c_o" = yes; then
1595 command="$command -o $obj"
1598 # Suppress compiler output if we already did a PIC compilation.
1599 command="$command$suppress_output"
1600 func_show_eval_locale "$command" \
1601 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1603 if test "$need_locks" = warn &&
1604 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1605 $ECHO "\
1606 *** ERROR, $lockfile contains:
1607 `cat $lockfile 2>/dev/null`
1609 but it should contain:
1610 $srcfile
1612 This indicates that another process is trying to use the same
1613 temporary object file, and libtool could not work around it because
1614 your compiler does not support \`-c' and \`-o' together. If you
1615 repeat this compilation, it may succeed, by chance, but you had better
1616 avoid parallel builds (make -j) in this platform, or get a better
1617 compiler."
1619 $opt_dry_run || $RM $removelist
1620 exit $EXIT_FAILURE
1623 # Just move the object if needed
1624 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1625 func_show_eval '$MV "$output_obj" "$obj"' \
1626 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1630 $opt_dry_run || {
1631 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1633 # Unlock the critical section if it was locked
1634 if test "$need_locks" != no; then
1635 removelist=$lockfile
1636 $RM "$lockfile"
1640 exit $EXIT_SUCCESS
1643 $opt_help || {
1644 test "$mode" = compile && func_mode_compile ${1+"$@"}
1647 func_mode_help ()
1649 # We need to display help for each of the modes.
1650 case $mode in
1652 # Generic help is extracted from the usage comments
1653 # at the start of this file.
1654 func_help
1657 clean)
1658 $ECHO \
1659 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1661 Remove files from the build directory.
1663 RM is the name of the program to use to delete files associated with each FILE
1664 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1665 to RM.
1667 If FILE is a libtool library, object or program, all the files associated
1668 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1671 compile)
1672 $ECHO \
1673 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1675 Compile a source file into a libtool library object.
1677 This mode accepts the following additional options:
1679 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1680 -no-suppress do not suppress compiler output for multiple passes
1681 -prefer-pic try to build PIC objects only
1682 -prefer-non-pic try to build non-PIC objects only
1683 -shared do not build a \`.o' file suitable for static linking
1684 -static only build a \`.o' file suitable for static linking
1685 -Wc,FLAG pass FLAG directly to the compiler
1687 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1688 from the given SOURCEFILE.
1690 The output file name is determined by removing the directory component from
1691 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1692 library object suffix, \`.lo'."
1695 execute)
1696 $ECHO \
1697 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1699 Automatically set library path, then run a program.
1701 This mode accepts the following additional options:
1703 -dlopen FILE add the directory containing FILE to the library path
1705 This mode sets the library path environment variable according to \`-dlopen'
1706 flags.
1708 If any of the ARGS are libtool executable wrappers, then they are translated
1709 into their corresponding uninstalled binary, and any of their required library
1710 directories are added to the library path.
1712 Then, COMMAND is executed, with ARGS as arguments."
1715 finish)
1716 $ECHO \
1717 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1719 Complete the installation of libtool libraries.
1721 Each LIBDIR is a directory that contains libtool libraries.
1723 The commands that this mode executes may require superuser privileges. Use
1724 the \`--dry-run' option if you just want to see what would be executed."
1727 install)
1728 $ECHO \
1729 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1731 Install executables or libraries.
1733 INSTALL-COMMAND is the installation command. The first component should be
1734 either the \`install' or \`cp' program.
1736 The following components of INSTALL-COMMAND are treated specially:
1738 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1740 The rest of the components are interpreted as arguments to that command (only
1741 BSD-compatible install options are recognized)."
1744 link)
1745 $ECHO \
1746 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1748 Link object files or libraries together to form another library, or to
1749 create an executable program.
1751 LINK-COMMAND is a command using the C compiler that you would use to create
1752 a program from several object files.
1754 The following components of LINK-COMMAND are treated specially:
1756 -all-static do not do any dynamic linking at all
1757 -avoid-version do not add a version suffix if possible
1758 -bindir BINDIR specify path to binaries directory (for systems where
1759 libraries must be found in the PATH setting at runtime)
1760 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1761 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1762 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1763 -export-symbols SYMFILE
1764 try to export only the symbols listed in SYMFILE
1765 -export-symbols-regex REGEX
1766 try to export only the symbols matching REGEX
1767 -LLIBDIR search LIBDIR for required installed libraries
1768 -lNAME OUTPUT-FILE requires the installed library libNAME
1769 -module build a library that can dlopened
1770 -no-fast-install disable the fast-install mode
1771 -no-install link a not-installable executable
1772 -no-undefined declare that a library does not refer to external symbols
1773 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1774 -objectlist FILE Use a list of object files found in FILE to specify objects
1775 -precious-files-regex REGEX
1776 don't remove output files matching REGEX
1777 -release RELEASE specify package release information
1778 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1779 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1780 -shared only do dynamic linking of libtool libraries
1781 -shrext SUFFIX override the standard shared library file extension
1782 -static do not do any dynamic linking of uninstalled libtool libraries
1783 -static-libtool-libs
1784 do not do any dynamic linking of libtool libraries
1785 -version-info CURRENT[:REVISION[:AGE]]
1786 specify library version info [each variable defaults to 0]
1787 -weak LIBNAME declare that the target provides the LIBNAME interface
1788 -Wc,FLAG
1789 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
1790 -Wl,FLAG
1791 -Xlinker FLAG pass linker-specific FLAG directly to the linker
1792 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
1794 All other options (arguments beginning with \`-') are ignored.
1796 Every other argument is treated as a filename. Files ending in \`.la' are
1797 treated as uninstalled libtool libraries, other files are standard or library
1798 object files.
1800 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1801 only library objects (\`.lo' files) may be specified, and \`-rpath' is
1802 required, except when creating a convenience library.
1804 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1805 using \`ar' and \`ranlib', or on Windows using \`lib'.
1807 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1808 is created, otherwise an executable program is created."
1811 uninstall)
1812 $ECHO \
1813 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1815 Remove libraries from an installation directory.
1817 RM is the name of the program to use to delete files associated with each FILE
1818 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1819 to RM.
1821 If FILE is a libtool library, all the files associated with it are deleted.
1822 Otherwise, only FILE itself is deleted using RM."
1826 func_fatal_help "invalid operation mode \`$mode'"
1828 esac
1830 echo
1831 $ECHO "Try \`$progname --help' for more information about other modes."
1834 # Now that we've collected a possible --mode arg, show help if necessary
1835 if $opt_help; then
1836 if test "$opt_help" = :; then
1837 func_mode_help
1838 else
1840 func_help noexit
1841 for mode in compile link execute install finish uninstall clean; do
1842 func_mode_help
1843 done
1844 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
1846 func_help noexit
1847 for mode in compile link execute install finish uninstall clean; do
1848 echo
1849 func_mode_help
1850 done
1852 sed '1d
1853 /^When reporting/,/^Report/{
1858 /information about other modes/d
1859 /more detailed .*MODE/d
1860 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
1862 exit $?
1866 # func_mode_execute arg...
1867 func_mode_execute ()
1869 $opt_debug
1870 # The first argument is the command name.
1871 cmd="$nonopt"
1872 test -z "$cmd" && \
1873 func_fatal_help "you must specify a COMMAND"
1875 # Handle -dlopen flags immediately.
1876 for file in $execute_dlfiles; do
1877 test -f "$file" \
1878 || func_fatal_help "\`$file' is not a file"
1880 dir=
1881 case $file in
1882 *.la)
1883 # Check to see that this really is a libtool archive.
1884 func_lalib_unsafe_p "$file" \
1885 || func_fatal_help "\`$lib' is not a valid libtool archive"
1887 # Read the libtool library.
1888 dlname=
1889 library_names=
1890 func_source "$file"
1892 # Skip this library if it cannot be dlopened.
1893 if test -z "$dlname"; then
1894 # Warn if it was a shared library.
1895 test -n "$library_names" && \
1896 func_warning "\`$file' was not linked with \`-export-dynamic'"
1897 continue
1900 func_dirname "$file" "" "."
1901 dir="$func_dirname_result"
1903 if test -f "$dir/$objdir/$dlname"; then
1904 dir="$dir/$objdir"
1905 else
1906 if test ! -f "$dir/$dlname"; then
1907 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1912 *.lo)
1913 # Just add the directory containing the .lo file.
1914 func_dirname "$file" "" "."
1915 dir="$func_dirname_result"
1919 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1920 continue
1922 esac
1924 # Get the absolute pathname.
1925 absdir=`cd "$dir" && pwd`
1926 test -n "$absdir" && dir="$absdir"
1928 # Now add the directory to shlibpath_var.
1929 if eval "test -z \"\$$shlibpath_var\""; then
1930 eval "$shlibpath_var=\"\$dir\""
1931 else
1932 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1934 done
1936 # This variable tells wrapper scripts just to set shlibpath_var
1937 # rather than running their programs.
1938 libtool_execute_magic="$magic"
1940 # Check if any of the arguments is a wrapper script.
1941 args=
1942 for file
1944 case $file in
1945 -* | *.la | *.lo ) ;;
1947 # Do a test to see if this is really a libtool program.
1948 if func_ltwrapper_script_p "$file"; then
1949 func_source "$file"
1950 # Transform arg to wrapped name.
1951 file="$progdir/$program"
1952 elif func_ltwrapper_executable_p "$file"; then
1953 func_ltwrapper_scriptname "$file"
1954 func_source "$func_ltwrapper_scriptname_result"
1955 # Transform arg to wrapped name.
1956 file="$progdir/$program"
1959 esac
1960 # Quote arguments (to preserve shell metacharacters).
1961 func_quote_for_eval "$file"
1962 args="$args $func_quote_for_eval_result"
1963 done
1965 if test "X$opt_dry_run" = Xfalse; then
1966 if test -n "$shlibpath_var"; then
1967 # Export the shlibpath_var.
1968 eval "export $shlibpath_var"
1971 # Restore saved environment variables
1972 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1974 eval "if test \"\${save_$lt_var+set}\" = set; then
1975 $lt_var=\$save_$lt_var; export $lt_var
1976 else
1977 $lt_unset $lt_var
1979 done
1981 # Now prepare to actually exec the command.
1982 exec_cmd="\$cmd$args"
1983 else
1984 # Display what would be done.
1985 if test -n "$shlibpath_var"; then
1986 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1987 echo "export $shlibpath_var"
1989 $ECHO "$cmd$args"
1990 exit $EXIT_SUCCESS
1994 test "$mode" = execute && func_mode_execute ${1+"$@"}
1997 # func_mode_finish arg...
1998 func_mode_finish ()
2000 $opt_debug
2001 libdirs="$nonopt"
2002 admincmds=
2004 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2005 for dir
2007 libdirs="$libdirs $dir"
2008 done
2010 for libdir in $libdirs; do
2011 if test -n "$finish_cmds"; then
2012 # Do each command in the finish commands.
2013 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2014 '"$cmd"'"'
2016 if test -n "$finish_eval"; then
2017 # Do the single finish_eval.
2018 eval cmds=\"$finish_eval\"
2019 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2020 $cmds"
2022 done
2025 # Exit here if they wanted silent mode.
2026 $opt_silent && exit $EXIT_SUCCESS
2028 echo "----------------------------------------------------------------------"
2029 echo "Libraries have been installed in:"
2030 for libdir in $libdirs; do
2031 $ECHO " $libdir"
2032 done
2033 echo
2034 echo "If you ever happen to want to link against installed libraries"
2035 echo "in a given directory, LIBDIR, you must either use libtool, and"
2036 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2037 echo "flag during linking and do at least one of the following:"
2038 if test -n "$shlibpath_var"; then
2039 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2040 echo " during execution"
2042 if test -n "$runpath_var"; then
2043 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2044 echo " during linking"
2046 if test -n "$hardcode_libdir_flag_spec"; then
2047 libdir=LIBDIR
2048 eval flag=\"$hardcode_libdir_flag_spec\"
2050 $ECHO " - use the \`$flag' linker flag"
2052 if test -n "$admincmds"; then
2053 $ECHO " - have your system administrator run these commands:$admincmds"
2055 if test -f /etc/ld.so.conf; then
2056 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2058 echo
2060 echo "See any operating system documentation about shared libraries for"
2061 case $host in
2062 solaris2.[6789]|solaris2.1[0-9])
2063 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2064 echo "pages."
2067 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2069 esac
2070 echo "----------------------------------------------------------------------"
2071 exit $EXIT_SUCCESS
2074 test "$mode" = finish && func_mode_finish ${1+"$@"}
2077 # func_mode_install arg...
2078 func_mode_install ()
2080 $opt_debug
2081 # There may be an optional sh(1) argument at the beginning of
2082 # install_prog (especially on Windows NT).
2083 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2084 # Allow the use of GNU shtool's install command.
2085 case $nonopt in *shtool*) :;; *) false;; esac; then
2086 # Aesthetically quote it.
2087 func_quote_for_eval "$nonopt"
2088 install_prog="$func_quote_for_eval_result "
2089 arg=$1
2090 shift
2091 else
2092 install_prog=
2093 arg=$nonopt
2096 # The real first argument should be the name of the installation program.
2097 # Aesthetically quote it.
2098 func_quote_for_eval "$arg"
2099 install_prog="$install_prog$func_quote_for_eval_result"
2100 install_shared_prog=$install_prog
2101 case " $install_prog " in
2102 *[\\\ /]cp\ *) install_cp=: ;;
2103 *) install_cp=false ;;
2104 esac
2106 # We need to accept at least all the BSD install flags.
2107 dest=
2108 files=
2109 opts=
2110 prev=
2111 install_type=
2112 isdir=no
2113 stripme=
2114 no_mode=:
2115 for arg
2117 arg2=
2118 if test -n "$dest"; then
2119 files="$files $dest"
2120 dest=$arg
2121 continue
2124 case $arg in
2125 -d) isdir=yes ;;
2127 if $install_cp; then :; else
2128 prev=$arg
2131 -g | -m | -o)
2132 prev=$arg
2135 stripme=" -s"
2136 continue
2141 # If the previous option needed an argument, then skip it.
2142 if test -n "$prev"; then
2143 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2144 arg2=$install_override_mode
2145 no_mode=false
2147 prev=
2148 else
2149 dest=$arg
2150 continue
2153 esac
2155 # Aesthetically quote the argument.
2156 func_quote_for_eval "$arg"
2157 install_prog="$install_prog $func_quote_for_eval_result"
2158 if test -n "$arg2"; then
2159 func_quote_for_eval "$arg2"
2161 install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
2162 done
2164 test -z "$install_prog" && \
2165 func_fatal_help "you must specify an install program"
2167 test -n "$prev" && \
2168 func_fatal_help "the \`$prev' option requires an argument"
2170 if test -n "$install_override_mode" && $no_mode; then
2171 if $install_cp; then :; else
2172 func_quote_for_eval "$install_override_mode"
2173 install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
2177 if test -z "$files"; then
2178 if test -z "$dest"; then
2179 func_fatal_help "no file or destination specified"
2180 else
2181 func_fatal_help "you must specify a destination"
2185 # Strip any trailing slash from the destination.
2186 func_stripname '' '/' "$dest"
2187 dest=$func_stripname_result
2189 # Check to see that the destination is a directory.
2190 test -d "$dest" && isdir=yes
2191 if test "$isdir" = yes; then
2192 destdir="$dest"
2193 destname=
2194 else
2195 func_dirname_and_basename "$dest" "" "."
2196 destdir="$func_dirname_result"
2197 destname="$func_basename_result"
2199 # Not a directory, so check to see that there is only one file specified.
2200 set dummy $files; shift
2201 test "$#" -gt 1 && \
2202 func_fatal_help "\`$dest' is not a directory"
2204 case $destdir in
2205 [\\/]* | [A-Za-z]:[\\/]*) ;;
2207 for file in $files; do
2208 case $file in
2209 *.lo) ;;
2211 func_fatal_help "\`$destdir' must be an absolute directory name"
2213 esac
2214 done
2216 esac
2218 # This variable tells wrapper scripts just to set variables rather
2219 # than running their programs.
2220 libtool_install_magic="$magic"
2222 staticlibs=
2223 future_libdirs=
2224 current_libdirs=
2225 for file in $files; do
2227 # Do each installation.
2228 case $file in
2229 *.$libext)
2230 # Do the static libraries later.
2231 staticlibs="$staticlibs $file"
2234 *.la)
2235 # Check to see that this really is a libtool archive.
2236 func_lalib_unsafe_p "$file" \
2237 || func_fatal_help "\`$file' is not a valid libtool archive"
2239 library_names=
2240 old_library=
2241 relink_command=
2242 func_source "$file"
2244 # Add the libdir to current_libdirs if it is the destination.
2245 if test "X$destdir" = "X$libdir"; then
2246 case "$current_libdirs " in
2247 *" $libdir "*) ;;
2248 *) current_libdirs="$current_libdirs $libdir" ;;
2249 esac
2250 else
2251 # Note the libdir as a future libdir.
2252 case "$future_libdirs " in
2253 *" $libdir "*) ;;
2254 *) future_libdirs="$future_libdirs $libdir" ;;
2255 esac
2258 func_dirname "$file" "/" ""
2259 dir="$func_dirname_result"
2260 dir="$dir$objdir"
2262 if test -n "$relink_command"; then
2263 # Determine the prefix the user has applied to our future dir.
2264 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2266 # Don't allow the user to place us outside of our expected
2267 # location b/c this prevents finding dependent libraries that
2268 # are installed to the same prefix.
2269 # At present, this check doesn't affect windows .dll's that
2270 # are installed into $libdir/../bin (currently, that works fine)
2271 # but it's something to keep an eye on.
2272 test "$inst_prefix_dir" = "$destdir" && \
2273 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2275 if test -n "$inst_prefix_dir"; then
2276 # Stick the inst_prefix_dir data into the link command.
2277 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2278 else
2279 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2282 func_warning "relinking \`$file'"
2283 func_show_eval "$relink_command" \
2284 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2287 # See the names of the shared library.
2288 set dummy $library_names; shift
2289 if test -n "$1"; then
2290 realname="$1"
2291 shift
2293 srcname="$realname"
2294 test -n "$relink_command" && srcname="$realname"T
2296 # Install the shared library and build the symlinks.
2297 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2298 'exit $?'
2299 tstripme="$stripme"
2300 case $host_os in
2301 cygwin* | mingw* | pw32* | cegcc*)
2302 case $realname in
2303 *.dll.a)
2304 tstripme=""
2306 esac
2308 esac
2309 if test -n "$tstripme" && test -n "$striplib"; then
2310 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2313 if test "$#" -gt 0; then
2314 # Delete the old symlinks, and create new ones.
2315 # Try `ln -sf' first, because the `ln' binary might depend on
2316 # the symlink we replace! Solaris /bin/ln does not understand -f,
2317 # so we also need to try rm && ln -s.
2318 for linkname
2320 test "$linkname" != "$realname" \
2321 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2322 done
2325 # Do each command in the postinstall commands.
2326 lib="$destdir/$realname"
2327 func_execute_cmds "$postinstall_cmds" 'exit $?'
2330 # Install the pseudo-library for information purposes.
2331 func_basename "$file"
2332 name="$func_basename_result"
2333 instname="$dir/$name"i
2334 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2336 # Maybe install the static library, too.
2337 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2340 *.lo)
2341 # Install (i.e. copy) a libtool object.
2343 # Figure out destination file name, if it wasn't already specified.
2344 if test -n "$destname"; then
2345 destfile="$destdir/$destname"
2346 else
2347 func_basename "$file"
2348 destfile="$func_basename_result"
2349 destfile="$destdir/$destfile"
2352 # Deduce the name of the destination old-style object file.
2353 case $destfile in
2354 *.lo)
2355 func_lo2o "$destfile"
2356 staticdest=$func_lo2o_result
2358 *.$objext)
2359 staticdest="$destfile"
2360 destfile=
2363 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2365 esac
2367 # Install the libtool object if requested.
2368 test -n "$destfile" && \
2369 func_show_eval "$install_prog $file $destfile" 'exit $?'
2371 # Install the old object if enabled.
2372 if test "$build_old_libs" = yes; then
2373 # Deduce the name of the old-style object file.
2374 func_lo2o "$file"
2375 staticobj=$func_lo2o_result
2376 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2378 exit $EXIT_SUCCESS
2382 # Figure out destination file name, if it wasn't already specified.
2383 if test -n "$destname"; then
2384 destfile="$destdir/$destname"
2385 else
2386 func_basename "$file"
2387 destfile="$func_basename_result"
2388 destfile="$destdir/$destfile"
2391 # If the file is missing, and there is a .exe on the end, strip it
2392 # because it is most likely a libtool script we actually want to
2393 # install
2394 stripped_ext=""
2395 case $file in
2396 *.exe)
2397 if test ! -f "$file"; then
2398 func_stripname '' '.exe' "$file"
2399 file=$func_stripname_result
2400 stripped_ext=".exe"
2403 esac
2405 # Do a test to see if this is really a libtool program.
2406 case $host in
2407 *cygwin* | *mingw*)
2408 if func_ltwrapper_executable_p "$file"; then
2409 func_ltwrapper_scriptname "$file"
2410 wrapper=$func_ltwrapper_scriptname_result
2411 else
2412 func_stripname '' '.exe' "$file"
2413 wrapper=$func_stripname_result
2417 wrapper=$file
2419 esac
2420 if func_ltwrapper_script_p "$wrapper"; then
2421 notinst_deplibs=
2422 relink_command=
2424 func_source "$wrapper"
2426 # Check the variables that should have been set.
2427 test -z "$generated_by_libtool_version" && \
2428 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2430 finalize=yes
2431 for lib in $notinst_deplibs; do
2432 # Check to see that each library is installed.
2433 libdir=
2434 if test -f "$lib"; then
2435 func_source "$lib"
2437 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
2438 if test -n "$libdir" && test ! -f "$libfile"; then
2439 func_warning "\`$lib' has not been installed in \`$libdir'"
2440 finalize=no
2442 done
2444 relink_command=
2445 func_source "$wrapper"
2447 outputname=
2448 if test "$fast_install" = no && test -n "$relink_command"; then
2449 $opt_dry_run || {
2450 if test "$finalize" = yes; then
2451 tmpdir=`func_mktempdir`
2452 func_basename "$file$stripped_ext"
2453 file="$func_basename_result"
2454 outputname="$tmpdir/$file"
2455 # Replace the output file specification.
2456 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
2458 $opt_silent || {
2459 func_quote_for_expand "$relink_command"
2460 eval "func_echo $func_quote_for_expand_result"
2462 if eval "$relink_command"; then :
2463 else
2464 func_error "error: relink \`$file' with the above command before installing it"
2465 $opt_dry_run || ${RM}r "$tmpdir"
2466 continue
2468 file="$outputname"
2469 else
2470 func_warning "cannot relink \`$file'"
2473 else
2474 # Install the binary that we compiled earlier.
2475 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
2479 # remove .exe since cygwin /usr/bin/install will append another
2480 # one anyway
2481 case $install_prog,$host in
2482 */usr/bin/install*,*cygwin*)
2483 case $file:$destfile in
2484 *.exe:*.exe)
2485 # this is ok
2487 *.exe:*)
2488 destfile=$destfile.exe
2490 *:*.exe)
2491 func_stripname '' '.exe' "$destfile"
2492 destfile=$func_stripname_result
2494 esac
2496 esac
2497 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2498 $opt_dry_run || if test -n "$outputname"; then
2499 ${RM}r "$tmpdir"
2502 esac
2503 done
2505 for file in $staticlibs; do
2506 func_basename "$file"
2507 name="$func_basename_result"
2509 # Set up the ranlib parameters.
2510 oldlib="$destdir/$name"
2512 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2514 if test -n "$stripme" && test -n "$old_striplib"; then
2515 func_show_eval "$old_striplib $oldlib" 'exit $?'
2518 # Do each command in the postinstall commands.
2519 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2520 done
2522 test -n "$future_libdirs" && \
2523 func_warning "remember to run \`$progname --finish$future_libdirs'"
2525 if test -n "$current_libdirs"; then
2526 # Maybe just do a dry run.
2527 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2528 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2529 else
2530 exit $EXIT_SUCCESS
2534 test "$mode" = install && func_mode_install ${1+"$@"}
2537 # func_generate_dlsyms outputname originator pic_p
2538 # Extract symbols from dlprefiles and create ${outputname}S.o with
2539 # a dlpreopen symbol table.
2540 func_generate_dlsyms ()
2542 $opt_debug
2543 my_outputname="$1"
2544 my_originator="$2"
2545 my_pic_p="${3-no}"
2546 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2547 my_dlsyms=
2549 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2550 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2551 my_dlsyms="${my_outputname}S.c"
2552 else
2553 func_error "not configured to extract global symbols from dlpreopened files"
2557 if test -n "$my_dlsyms"; then
2558 case $my_dlsyms in
2559 "") ;;
2560 *.c)
2561 # Discover the nlist of each of the dlfiles.
2562 nlist="$output_objdir/${my_outputname}.nm"
2564 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2566 # Parse the name list into a source file.
2567 func_verbose "creating $output_objdir/$my_dlsyms"
2569 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2570 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2571 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2573 #ifdef __cplusplus
2574 extern \"C\" {
2575 #endif
2577 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
2578 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
2579 #endif
2581 /* External symbol declarations for the compiler. */\
2584 if test "$dlself" = yes; then
2585 func_verbose "generating symbol list for \`$output'"
2587 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2589 # Add our own program objects to the symbol list.
2590 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
2591 for progfile in $progfiles; do
2592 func_verbose "extracting global C symbols from \`$progfile'"
2593 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2594 done
2596 if test -n "$exclude_expsyms"; then
2597 $opt_dry_run || {
2598 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2599 eval '$MV "$nlist"T "$nlist"'
2603 if test -n "$export_symbols_regex"; then
2604 $opt_dry_run || {
2605 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2606 eval '$MV "$nlist"T "$nlist"'
2610 # Prepare the list of exported symbols
2611 if test -z "$export_symbols"; then
2612 export_symbols="$output_objdir/$outputname.exp"
2613 $opt_dry_run || {
2614 $RM $export_symbols
2615 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2616 case $host in
2617 *cygwin* | *mingw* | *cegcc* )
2618 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2619 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2621 esac
2623 else
2624 $opt_dry_run || {
2625 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2626 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2627 eval '$MV "$nlist"T "$nlist"'
2628 case $host in
2629 *cygwin* | *mingw* | *cegcc* )
2630 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2631 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2633 esac
2638 for dlprefile in $dlprefiles; do
2639 func_verbose "extracting global C symbols from \`$dlprefile'"
2640 func_basename "$dlprefile"
2641 name="$func_basename_result"
2642 $opt_dry_run || {
2643 eval '$ECHO ": $name " >> "$nlist"'
2644 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2646 done
2648 $opt_dry_run || {
2649 # Make sure we have at least an empty file.
2650 test -f "$nlist" || : > "$nlist"
2652 if test -n "$exclude_expsyms"; then
2653 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2654 $MV "$nlist"T "$nlist"
2657 # Try sorting and uniquifying the output.
2658 if $GREP -v "^: " < "$nlist" |
2659 if sort -k 3 </dev/null >/dev/null 2>&1; then
2660 sort -k 3
2661 else
2662 sort +2
2663 fi |
2664 uniq > "$nlist"S; then
2666 else
2667 $GREP -v "^: " < "$nlist" > "$nlist"S
2670 if test -f "$nlist"S; then
2671 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2672 else
2673 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
2676 echo >> "$output_objdir/$my_dlsyms" "\
2678 /* The mapping between symbol names and symbols. */
2679 typedef struct {
2680 const char *name;
2681 void *address;
2682 } lt_dlsymlist;
2684 case $host in
2685 *cygwin* | *mingw* | *cegcc* )
2686 echo >> "$output_objdir/$my_dlsyms" "\
2687 /* DATA imports from DLLs on WIN32 con't be const, because
2688 runtime relocations are performed -- see ld's documentation
2689 on pseudo-relocs. */"
2690 lt_dlsym_const= ;;
2691 *osf5*)
2692 echo >> "$output_objdir/$my_dlsyms" "\
2693 /* This system does not cope well with relocations in const data */"
2694 lt_dlsym_const= ;;
2696 lt_dlsym_const=const ;;
2697 esac
2699 echo >> "$output_objdir/$my_dlsyms" "\
2700 extern $lt_dlsym_const lt_dlsymlist
2701 lt_${my_prefix}_LTX_preloaded_symbols[];
2702 $lt_dlsym_const lt_dlsymlist
2703 lt_${my_prefix}_LTX_preloaded_symbols[] =
2705 { \"$my_originator\", (void *) 0 },"
2707 case $need_lib_prefix in
2709 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2712 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2714 esac
2715 echo >> "$output_objdir/$my_dlsyms" "\
2716 {0, (void *) 0}
2719 /* This works around a problem in FreeBSD linker */
2720 #ifdef FREEBSD_WORKAROUND
2721 static const void *lt_preloaded_setup() {
2722 return lt_${my_prefix}_LTX_preloaded_symbols;
2724 #endif
2726 #ifdef __cplusplus
2728 #endif\
2730 } # !$opt_dry_run
2732 pic_flag_for_symtable=
2733 case "$compile_command " in
2734 *" -static "*) ;;
2736 case $host in
2737 # compiling the symbol table file with pic_flag works around
2738 # a FreeBSD bug that causes programs to crash when -lm is
2739 # linked before any other PIC object. But we must not use
2740 # pic_flag when linking with -static. The problem exists in
2741 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2742 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2743 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2744 *-*-hpux*)
2745 pic_flag_for_symtable=" $pic_flag" ;;
2747 if test "X$my_pic_p" != Xno; then
2748 pic_flag_for_symtable=" $pic_flag"
2751 esac
2753 esac
2754 symtab_cflags=
2755 for arg in $LTCFLAGS; do
2756 case $arg in
2757 -pie | -fpie | -fPIE) ;;
2758 *) symtab_cflags="$symtab_cflags $arg" ;;
2759 esac
2760 done
2762 # Now compile the dynamic symbol file.
2763 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2765 # Clean up the generated files.
2766 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2768 # Transform the symbol file into the correct name.
2769 symfileobj="$output_objdir/${my_outputname}S.$objext"
2770 case $host in
2771 *cygwin* | *mingw* | *cegcc* )
2772 if test -f "$output_objdir/$my_outputname.def"; then
2773 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2774 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2775 else
2776 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2777 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2781 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2782 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2784 esac
2786 *-*-freebsd*)
2787 # FreeBSD doesn't need this...
2790 func_fatal_error "unknown suffix for \`$my_dlsyms'"
2792 esac
2793 else
2794 # We keep going just in case the user didn't refer to
2795 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2796 # really was required.
2798 # Nullify the symbol file.
2799 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
2800 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
2804 # func_win32_libid arg
2805 # return the library type of file 'arg'
2807 # Need a lot of goo to handle *both* DLLs and import libs
2808 # Has to be a shell function in order to 'eat' the argument
2809 # that is supplied when $file_magic_command is called.
2810 # Despite the name, also deal with 64 bit binaries.
2811 func_win32_libid ()
2813 $opt_debug
2814 win32_libid_type="unknown"
2815 win32_fileres=`file -L $1 2>/dev/null`
2816 case $win32_fileres in
2817 *ar\ archive\ import\ library*) # definitely import
2818 win32_libid_type="x86 archive import"
2820 *ar\ archive*) # could be an import, or static
2821 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
2822 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2823 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
2824 win32_nmres=`eval $NM -f posix -A $1 |
2825 $SED -n -e '
2826 1,100{
2827 / I /{
2828 s,.*,import,
2833 case $win32_nmres in
2834 import*) win32_libid_type="x86 archive import";;
2835 *) win32_libid_type="x86 archive static";;
2836 esac
2839 *DLL*)
2840 win32_libid_type="x86 DLL"
2842 *executable*) # but shell scripts are "executable" too...
2843 case $win32_fileres in
2844 *MS\ Windows\ PE\ Intel*)
2845 win32_libid_type="x86 DLL"
2847 esac
2849 esac
2850 $ECHO "$win32_libid_type"
2855 # func_extract_an_archive dir oldlib
2856 func_extract_an_archive ()
2858 $opt_debug
2859 f_ex_an_ar_dir="$1"; shift
2860 f_ex_an_ar_oldlib="$1"
2861 if test "$lock_old_archive_extraction" = yes; then
2862 lockfile=$f_ex_an_ar_oldlib.lock
2863 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2864 func_echo "Waiting for $lockfile to be removed"
2865 sleep 2
2866 done
2868 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
2869 'stat=$?; rm -f "$lockfile"; exit $stat'
2870 if test "$lock_old_archive_extraction" = yes; then
2871 $opt_dry_run || rm -f "$lockfile"
2873 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2875 else
2876 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2881 # func_extract_archives gentop oldlib ...
2882 func_extract_archives ()
2884 $opt_debug
2885 my_gentop="$1"; shift
2886 my_oldlibs=${1+"$@"}
2887 my_oldobjs=""
2888 my_xlib=""
2889 my_xabs=""
2890 my_xdir=""
2892 for my_xlib in $my_oldlibs; do
2893 # Extract the objects.
2894 case $my_xlib in
2895 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2896 *) my_xabs=`pwd`"/$my_xlib" ;;
2897 esac
2898 func_basename "$my_xlib"
2899 my_xlib="$func_basename_result"
2900 my_xlib_u=$my_xlib
2901 while :; do
2902 case " $extracted_archives " in
2903 *" $my_xlib_u "*)
2904 func_arith $extracted_serial + 1
2905 extracted_serial=$func_arith_result
2906 my_xlib_u=lt$extracted_serial-$my_xlib ;;
2907 *) break ;;
2908 esac
2909 done
2910 extracted_archives="$extracted_archives $my_xlib_u"
2911 my_xdir="$my_gentop/$my_xlib_u"
2913 func_mkdir_p "$my_xdir"
2915 case $host in
2916 *-darwin*)
2917 func_verbose "Extracting $my_xabs"
2918 # Do not bother doing anything if just a dry run
2919 $opt_dry_run || {
2920 darwin_orig_dir=`pwd`
2921 cd $my_xdir || exit $?
2922 darwin_archive=$my_xabs
2923 darwin_curdir=`pwd`
2924 darwin_base_archive=`basename "$darwin_archive"`
2925 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2926 if test -n "$darwin_arches"; then
2927 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2928 darwin_arch=
2929 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2930 for darwin_arch in $darwin_arches ; do
2931 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2932 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2933 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2934 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2935 cd "$darwin_curdir"
2936 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2937 done # $darwin_arches
2938 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
2939 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
2940 darwin_file=
2941 darwin_files=
2942 for darwin_file in $darwin_filelist; do
2943 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
2944 $LIPO -create -output "$darwin_file" $darwin_files
2945 done # $darwin_filelist
2946 $RM -rf unfat-$$
2947 cd "$darwin_orig_dir"
2948 else
2949 cd $darwin_orig_dir
2950 func_extract_an_archive "$my_xdir" "$my_xabs"
2951 fi # $darwin_arches
2952 } # !$opt_dry_run
2955 func_extract_an_archive "$my_xdir" "$my_xabs"
2957 esac
2958 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
2959 done
2961 func_extract_archives_result="$my_oldobjs"
2965 # func_emit_wrapper [arg=no]
2967 # Emit a libtool wrapper script on stdout.
2968 # Don't directly open a file because we may want to
2969 # incorporate the script contents within a cygwin/mingw
2970 # wrapper executable. Must ONLY be called from within
2971 # func_mode_link because it depends on a number of variables
2972 # set therein.
2974 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2975 # variable will take. If 'yes', then the emitted script
2976 # will assume that the directory in which it is stored is
2977 # the $objdir directory. This is a cygwin/mingw-specific
2978 # behavior.
2979 func_emit_wrapper ()
2981 func_emit_wrapper_arg1=${1-no}
2983 $ECHO "\
2984 #! $SHELL
2986 # $output - temporary wrapper script for $objdir/$outputname
2987 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2989 # The $output program cannot be directly executed until all the libtool
2990 # libraries that it depends on are installed.
2992 # This wrapper script should never be moved out of the build directory.
2993 # If it is, it will not operate correctly.
2995 # Sed substitution that helps us do robust quoting. It backslashifies
2996 # metacharacters that are still active within double-quoted strings.
2997 sed_quote_subst='$sed_quote_subst'
2999 # Be Bourne compatible
3000 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3001 emulate sh
3002 NULLCMD=:
3003 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3004 # is contrary to our usage. Disable this feature.
3005 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3006 setopt NO_GLOB_SUBST
3007 else
3008 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3010 BIN_SH=xpg4; export BIN_SH # for Tru64
3011 DUALCASE=1; export DUALCASE # for MKS sh
3013 # The HP-UX ksh and POSIX shell print the target directory to stdout
3014 # if CDPATH is set.
3015 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3017 relink_command=\"$relink_command\"
3019 # This environment variable determines our operation mode.
3020 if test \"\$libtool_install_magic\" = \"$magic\"; then
3021 # install mode needs the following variables:
3022 generated_by_libtool_version='$macro_version'
3023 notinst_deplibs='$notinst_deplibs'
3024 else
3025 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3026 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3027 file=\"\$0\""
3029 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3030 $ECHO "\
3032 # A function that is used when there is no print builtin or printf.
3033 func_fallback_echo ()
3035 eval 'cat <<_LTECHO_EOF
3037 _LTECHO_EOF'
3039 ECHO=\"$qECHO\"
3042 # Very basic option parsing. These options are (a) specific to
3043 # the libtool wrapper, (b) are identical between the wrapper
3044 # /script/ and the wrapper /executable/ which is used only on
3045 # windows platforms, and (c) all begin with the string "--lt-"
3046 # (application programs are unlikely to have options which match
3047 # this pattern).
3049 # There are only two supported options: --lt-debug and
3050 # --lt-dump-script. There is, deliberately, no --lt-help.
3052 # The first argument to this parsing function should be the
3053 # script's $0 value, followed by "$@".
3054 lt_option_debug=
3055 func_parse_lt_options ()
3057 lt_script_arg0=\$0
3058 shift
3059 for lt_opt
3061 case \"\$lt_opt\" in
3062 --lt-debug) lt_option_debug=1 ;;
3063 --lt-dump-script)
3064 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3065 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3066 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3067 cat \"\$lt_dump_D/\$lt_dump_F\"
3068 exit 0
3070 --lt-*)
3071 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3072 exit 1
3074 esac
3075 done
3077 # Print the debug banner immediately:
3078 if test -n \"\$lt_option_debug\"; then
3079 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3083 # Used when --lt-debug. Prints its arguments to stdout
3084 # (redirection is the responsibility of the caller)
3085 func_lt_dump_args ()
3087 lt_dump_args_N=1;
3088 for lt_arg
3090 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3091 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3092 done
3095 # Core function for launching the target application
3096 func_exec_program_core ()
3099 case $host in
3100 # Backslashes separate directories on plain windows
3101 *-*-mingw | *-*-os2* | *-cegcc*)
3102 $ECHO "\
3103 if test -n \"\$lt_option_debug\"; then
3104 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3105 func_lt_dump_args \${1+\"\$@\"} 1>&2
3107 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3112 $ECHO "\
3113 if test -n \"\$lt_option_debug\"; then
3114 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3115 func_lt_dump_args \${1+\"\$@\"} 1>&2
3117 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3120 esac
3121 $ECHO "\
3122 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3123 exit 1
3126 # A function to encapsulate launching the target application
3127 # Strips options in the --lt-* namespace from \$@ and
3128 # launches target application with the remaining arguments.
3129 func_exec_program ()
3131 for lt_wr_arg
3133 case \$lt_wr_arg in
3134 --lt-*) ;;
3135 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
3136 esac
3137 shift
3138 done
3139 func_exec_program_core \${1+\"\$@\"}
3142 # Parse options
3143 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
3145 # Find the directory that this script lives in.
3146 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
3147 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3149 # Follow symbolic links until we get to the real thisdir.
3150 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
3151 while test -n \"\$file\"; do
3152 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
3154 # If there was a directory component, then change thisdir.
3155 if test \"x\$destdir\" != \"x\$file\"; then
3156 case \"\$destdir\" in
3157 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3158 *) thisdir=\"\$thisdir/\$destdir\" ;;
3159 esac
3162 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
3163 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
3164 done
3166 # Usually 'no', except on cygwin/mingw when embedded into
3167 # the cwrapper.
3168 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
3169 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3170 # special case for '.'
3171 if test \"\$thisdir\" = \".\"; then
3172 thisdir=\`pwd\`
3174 # remove .libs from thisdir
3175 case \"\$thisdir\" in
3176 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
3177 $objdir ) thisdir=. ;;
3178 esac
3181 # Try to get the absolute directory name.
3182 absdir=\`cd \"\$thisdir\" && pwd\`
3183 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3186 if test "$fast_install" = yes; then
3187 $ECHO "\
3188 program=lt-'$outputname'$exeext
3189 progdir=\"\$thisdir/$objdir\"
3191 if test ! -f \"\$progdir/\$program\" ||
3192 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3193 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3195 file=\"\$\$-\$program\"
3197 if test ! -d \"\$progdir\"; then
3198 $MKDIR \"\$progdir\"
3199 else
3200 $RM \"\$progdir/\$file\"
3203 $ECHO "\
3205 # relink executable if necessary
3206 if test -n \"\$relink_command\"; then
3207 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3208 else
3209 $ECHO \"\$relink_command_output\" >&2
3210 $RM \"\$progdir/\$file\"
3211 exit 1
3215 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3216 { $RM \"\$progdir/\$program\";
3217 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3218 $RM \"\$progdir/\$file\"
3220 else
3221 $ECHO "\
3222 program='$outputname'
3223 progdir=\"\$thisdir/$objdir\"
3227 $ECHO "\
3229 if test -f \"\$progdir/\$program\"; then"
3231 # Export our shlibpath_var if we have one.
3232 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3233 $ECHO "\
3234 # Add our own library path to $shlibpath_var
3235 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3237 # Some systems cannot cope with colon-terminated $shlibpath_var
3238 # The second colon is a workaround for a bug in BeOS R4 sed
3239 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
3241 export $shlibpath_var
3245 # fixup the dll searchpath if we need to.
3246 if test -n "$dllsearchpath"; then
3247 $ECHO "\
3248 # Add the dll search path components to the executable PATH
3249 PATH=$dllsearchpath:\$PATH
3253 $ECHO "\
3254 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3255 # Run the actual program with our arguments.
3256 func_exec_program \${1+\"\$@\"}
3258 else
3259 # The program doesn't exist.
3260 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3261 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3262 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3263 exit 1
3270 # func_to_host_path arg
3272 # Convert paths to host format when used with build tools.
3273 # Intended for use with "native" mingw (where libtool itself
3274 # is running under the msys shell), or in the following cross-
3275 # build environments:
3276 # $build $host
3277 # mingw (msys) mingw [e.g. native]
3278 # cygwin mingw
3279 # *nix + wine mingw
3280 # where wine is equipped with the `winepath' executable.
3281 # In the native mingw case, the (msys) shell automatically
3282 # converts paths for any non-msys applications it launches,
3283 # but that facility isn't available from inside the cwrapper.
3284 # Similar accommodations are necessary for $host mingw and
3285 # $build cygwin. Calling this function does no harm for other
3286 # $host/$build combinations not listed above.
3288 # ARG is the path (on $build) that should be converted to
3289 # the proper representation for $host. The result is stored
3290 # in $func_to_host_path_result.
3291 func_to_host_path ()
3293 func_to_host_path_result="$1"
3294 if test -n "$1"; then
3295 case $host in
3296 *mingw* )
3297 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3298 case $build in
3299 *mingw* ) # actually, msys
3300 # awkward: cmd appends spaces to result
3301 func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
3302 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3304 *cygwin* )
3305 func_to_host_path_result=`cygpath -w "$1" |
3306 $SED -e "$lt_sed_naive_backslashify"`
3309 # Unfortunately, winepath does not exit with a non-zero
3310 # error code, so we are forced to check the contents of
3311 # stdout. On the other hand, if the command is not
3312 # found, the shell will set an exit code of 127 and print
3313 # *an error message* to stdout. So we must check for both
3314 # error code of zero AND non-empty stdout, which explains
3315 # the odd construction:
3316 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3317 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3318 func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
3319 $SED -e "$lt_sed_naive_backslashify"`
3320 else
3321 # Allow warning below.
3322 func_to_host_path_result=
3325 esac
3326 if test -z "$func_to_host_path_result" ; then
3327 func_error "Could not determine host path corresponding to"
3328 func_error " \`$1'"
3329 func_error "Continuing, but uninstalled executables may not work."
3330 # Fallback:
3331 func_to_host_path_result="$1"
3334 esac
3337 # end: func_to_host_path
3339 # func_to_host_pathlist arg
3341 # Convert pathlists to host format when used with build tools.
3342 # See func_to_host_path(), above. This function supports the
3343 # following $build/$host combinations (but does no harm for
3344 # combinations not listed here):
3345 # $build $host
3346 # mingw (msys) mingw [e.g. native]
3347 # cygwin mingw
3348 # *nix + wine mingw
3350 # Path separators are also converted from $build format to
3351 # $host format. If ARG begins or ends with a path separator
3352 # character, it is preserved (but converted to $host format)
3353 # on output.
3355 # ARG is a pathlist (on $build) that should be converted to
3356 # the proper representation on $host. The result is stored
3357 # in $func_to_host_pathlist_result.
3358 func_to_host_pathlist ()
3360 func_to_host_pathlist_result="$1"
3361 if test -n "$1"; then
3362 case $host in
3363 *mingw* )
3364 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3365 # Remove leading and trailing path separator characters from
3366 # ARG. msys behavior is inconsistent here, cygpath turns them
3367 # into '.;' and ';.', and winepath ignores them completely.
3368 func_stripname : : "$1"
3369 func_to_host_pathlist_tmp1=$func_stripname_result
3370 case $build in
3371 *mingw* ) # Actually, msys.
3372 # Awkward: cmd appends spaces to result.
3373 func_to_host_pathlist_result=`
3374 ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
3375 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3377 *cygwin* )
3378 func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
3379 $SED -e "$lt_sed_naive_backslashify"`
3382 # unfortunately, winepath doesn't convert pathlists
3383 func_to_host_pathlist_result=""
3384 func_to_host_pathlist_oldIFS=$IFS
3385 IFS=:
3386 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3387 IFS=$func_to_host_pathlist_oldIFS
3388 if test -n "$func_to_host_pathlist_f" ; then
3389 func_to_host_path "$func_to_host_pathlist_f"
3390 if test -n "$func_to_host_path_result" ; then
3391 if test -z "$func_to_host_pathlist_result" ; then
3392 func_to_host_pathlist_result="$func_to_host_path_result"
3393 else
3394 func_append func_to_host_pathlist_result ";$func_to_host_path_result"
3398 done
3399 IFS=$func_to_host_pathlist_oldIFS
3401 esac
3402 if test -z "$func_to_host_pathlist_result"; then
3403 func_error "Could not determine the host path(s) corresponding to"
3404 func_error " \`$1'"
3405 func_error "Continuing, but uninstalled executables may not work."
3406 # Fallback. This may break if $1 contains DOS-style drive
3407 # specifications. The fix is not to complicate the expression
3408 # below, but for the user to provide a working wine installation
3409 # with winepath so that path translation in the cross-to-mingw
3410 # case works properly.
3411 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3412 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3413 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3415 # Now, add the leading and trailing path separators back
3416 case "$1" in
3417 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3419 esac
3420 case "$1" in
3421 *: ) func_append func_to_host_pathlist_result ";"
3423 esac
3425 esac
3428 # end: func_to_host_pathlist
3430 # func_emit_cwrapperexe_src
3431 # emit the source code for a wrapper executable on stdout
3432 # Must ONLY be called from within func_mode_link because
3433 # it depends on a number of variable set therein.
3434 func_emit_cwrapperexe_src ()
3436 cat <<EOF
3438 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3439 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3441 The $output program cannot be directly executed until all the libtool
3442 libraries that it depends on are installed.
3444 This wrapper executable should never be moved out of the build directory.
3445 If it is, it will not operate correctly.
3448 cat <<"EOF"
3449 #ifdef _MSC_VER
3450 # define _CRT_SECURE_NO_DEPRECATE 1
3451 #endif
3452 #include <stdio.h>
3453 #include <stdlib.h>
3454 #ifdef _MSC_VER
3455 # include <direct.h>
3456 # include <process.h>
3457 # include <io.h>
3458 #else
3459 # include <unistd.h>
3460 # include <stdint.h>
3461 # ifdef __CYGWIN__
3462 # include <io.h>
3463 # endif
3464 #endif
3465 #include <malloc.h>
3466 #include <stdarg.h>
3467 #include <assert.h>
3468 #include <string.h>
3469 #include <ctype.h>
3470 #include <errno.h>
3471 #include <fcntl.h>
3472 #include <sys/stat.h>
3474 /* declarations of non-ANSI functions */
3475 #if defined(__MINGW32__)
3476 # ifdef __STRICT_ANSI__
3477 int _putenv (const char *);
3478 # endif
3479 #elif defined(__CYGWIN__)
3480 # ifdef __STRICT_ANSI__
3481 char *realpath (const char *, char *);
3482 int putenv (char *);
3483 int setenv (const char *, const char *, int);
3484 # endif
3485 /* #elif defined (other platforms) ... */
3486 #endif
3488 /* portability defines, excluding path handling macros */
3489 #if defined(_MSC_VER)
3490 # define setmode _setmode
3491 # define stat _stat
3492 # define chmod _chmod
3493 # define getcwd _getcwd
3494 # define putenv _putenv
3495 # define S_IXUSR _S_IEXEC
3496 # ifndef _INTPTR_T_DEFINED
3497 # define _INTPTR_T_DEFINED
3498 # define intptr_t int
3499 # endif
3500 #elif defined(__MINGW32__)
3501 # define setmode _setmode
3502 # define stat _stat
3503 # define chmod _chmod
3504 # define getcwd _getcwd
3505 # define putenv _putenv
3506 #elif defined(__CYGWIN__)
3507 # define HAVE_SETENV
3508 # define FOPEN_WB "wb"
3509 /* #elif defined (other platforms) ... */
3510 #endif
3512 #if defined(PATH_MAX)
3513 # define LT_PATHMAX PATH_MAX
3514 #elif defined(MAXPATHLEN)
3515 # define LT_PATHMAX MAXPATHLEN
3516 #else
3517 # define LT_PATHMAX 1024
3518 #endif
3520 #ifndef S_IXOTH
3521 # define S_IXOTH 0
3522 #endif
3523 #ifndef S_IXGRP
3524 # define S_IXGRP 0
3525 #endif
3527 /* path handling portability macros */
3528 #ifndef DIR_SEPARATOR
3529 # define DIR_SEPARATOR '/'
3530 # define PATH_SEPARATOR ':'
3531 #endif
3533 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3534 defined (__OS2__)
3535 # define HAVE_DOS_BASED_FILE_SYSTEM
3536 # define FOPEN_WB "wb"
3537 # ifndef DIR_SEPARATOR_2
3538 # define DIR_SEPARATOR_2 '\\'
3539 # endif
3540 # ifndef PATH_SEPARATOR_2
3541 # define PATH_SEPARATOR_2 ';'
3542 # endif
3543 #endif
3545 #ifndef DIR_SEPARATOR_2
3546 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3547 #else /* DIR_SEPARATOR_2 */
3548 # define IS_DIR_SEPARATOR(ch) \
3549 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3550 #endif /* DIR_SEPARATOR_2 */
3552 #ifndef PATH_SEPARATOR_2
3553 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3554 #else /* PATH_SEPARATOR_2 */
3555 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3556 #endif /* PATH_SEPARATOR_2 */
3558 #ifndef FOPEN_WB
3559 # define FOPEN_WB "w"
3560 #endif
3561 #ifndef _O_BINARY
3562 # define _O_BINARY 0
3563 #endif
3565 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3566 #define XFREE(stale) do { \
3567 if (stale) { free ((void *) stale); stale = 0; } \
3568 } while (0)
3570 #if defined(LT_DEBUGWRAPPER)
3571 static int lt_debug = 1;
3572 #else
3573 static int lt_debug = 0;
3574 #endif
3576 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
3578 void *xmalloc (size_t num);
3579 char *xstrdup (const char *string);
3580 const char *base_name (const char *name);
3581 char *find_executable (const char *wrapper);
3582 char *chase_symlinks (const char *pathspec);
3583 int make_executable (const char *path);
3584 int check_executable (const char *path);
3585 char *strendzap (char *str, const char *pat);
3586 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
3587 void lt_fatal (const char *file, int line, const char *message, ...);
3588 static const char *nonnull (const char *s);
3589 static const char *nonempty (const char *s);
3590 void lt_setenv (const char *name, const char *value);
3591 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3592 void lt_update_exe_path (const char *name, const char *value);
3593 void lt_update_lib_path (const char *name, const char *value);
3594 char **prepare_spawn (char **argv);
3595 void lt_dump_script (FILE *f);
3598 cat <<EOF
3599 const char * MAGIC_EXE = "$magic_exe";
3600 const char * LIB_PATH_VARNAME = "$shlibpath_var";
3603 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3604 func_to_host_pathlist "$temp_rpath"
3605 cat <<EOF
3606 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
3608 else
3609 cat <<"EOF"
3610 const char * LIB_PATH_VALUE = "";
3614 if test -n "$dllsearchpath"; then
3615 func_to_host_pathlist "$dllsearchpath:"
3616 cat <<EOF
3617 const char * EXE_PATH_VARNAME = "PATH";
3618 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
3620 else
3621 cat <<"EOF"
3622 const char * EXE_PATH_VARNAME = "";
3623 const char * EXE_PATH_VALUE = "";
3627 if test "$fast_install" = yes; then
3628 cat <<EOF
3629 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3631 else
3632 cat <<EOF
3633 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3638 cat <<"EOF"
3640 #define LTWRAPPER_OPTION_PREFIX "--lt-"
3642 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3643 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
3644 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
3647 main (int argc, char *argv[])
3649 char **newargz;
3650 int newargc;
3651 char *tmp_pathspec;
3652 char *actual_cwrapper_path;
3653 char *actual_cwrapper_name;
3654 char *target_name;
3655 char *lt_argv_zero;
3656 intptr_t rval = 127;
3658 int i;
3660 program_name = (char *) xstrdup (base_name (argv[0]));
3661 newargz = XMALLOC (char *, argc + 1);
3663 /* very simple arg parsing; don't want to rely on getopt
3664 * also, copy all non cwrapper options to newargz, except
3665 * argz[0], which is handled differently
3667 newargc=0;
3668 for (i = 1; i < argc; i++)
3670 if (strcmp (argv[i], dumpscript_opt) == 0)
3673 case "$host" in
3674 *mingw* | *cygwin* )
3675 # make stdout use "unix" line endings
3676 echo " setmode(1,_O_BINARY);"
3678 esac
3680 cat <<"EOF"
3681 lt_dump_script (stdout);
3682 return 0;
3684 if (strcmp (argv[i], debug_opt) == 0)
3686 lt_debug = 1;
3687 continue;
3689 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
3691 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
3692 namespace, but it is not one of the ones we know about and
3693 have already dealt with, above (inluding dump-script), then
3694 report an error. Otherwise, targets might begin to believe
3695 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
3696 namespace. The first time any user complains about this, we'll
3697 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
3698 or a configure.ac-settable value.
3700 lt_fatal (__FILE__, __LINE__,
3701 "unrecognized %s option: '%s'",
3702 ltwrapper_option_prefix, argv[i]);
3704 /* otherwise ... */
3705 newargz[++newargc] = xstrdup (argv[i]);
3707 newargz[++newargc] = NULL;
3710 cat <<EOF
3711 /* The GNU banner must be the first non-error debug message */
3712 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
3714 cat <<"EOF"
3715 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
3716 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
3718 tmp_pathspec = find_executable (argv[0]);
3719 if (tmp_pathspec == NULL)
3720 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
3721 lt_debugprintf (__FILE__, __LINE__,
3722 "(main) found exe (before symlink chase) at: %s\n",
3723 tmp_pathspec);
3725 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3726 lt_debugprintf (__FILE__, __LINE__,
3727 "(main) found exe (after symlink chase) at: %s\n",
3728 actual_cwrapper_path);
3729 XFREE (tmp_pathspec);
3731 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
3732 strendzap (actual_cwrapper_path, actual_cwrapper_name);
3734 /* wrapper name transforms */
3735 strendzap (actual_cwrapper_name, ".exe");
3736 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3737 XFREE (actual_cwrapper_name);
3738 actual_cwrapper_name = tmp_pathspec;
3739 tmp_pathspec = 0;
3741 /* target_name transforms -- use actual target program name; might have lt- prefix */
3742 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3743 strendzap (target_name, ".exe");
3744 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3745 XFREE (target_name);
3746 target_name = tmp_pathspec;
3747 tmp_pathspec = 0;
3749 lt_debugprintf (__FILE__, __LINE__,
3750 "(main) libtool target name: %s\n",
3751 target_name);
3754 cat <<EOF
3755 newargz[0] =
3756 XMALLOC (char, (strlen (actual_cwrapper_path) +
3757 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3758 strcpy (newargz[0], actual_cwrapper_path);
3759 strcat (newargz[0], "$objdir");
3760 strcat (newargz[0], "/");
3763 cat <<"EOF"
3764 /* stop here, and copy so we don't have to do this twice */
3765 tmp_pathspec = xstrdup (newargz[0]);
3767 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3768 strcat (newargz[0], actual_cwrapper_name);
3770 /* DO want the lt- prefix here if it exists, so use target_name */
3771 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3772 XFREE (tmp_pathspec);
3773 tmp_pathspec = NULL;
3776 case $host_os in
3777 mingw*)
3778 cat <<"EOF"
3780 char* p;
3781 while ((p = strchr (newargz[0], '\\')) != NULL)
3783 *p = '/';
3785 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
3787 *p = '/';
3792 esac
3794 cat <<"EOF"
3795 XFREE (target_name);
3796 XFREE (actual_cwrapper_path);
3797 XFREE (actual_cwrapper_name);
3799 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3800 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
3801 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3802 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3804 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
3805 nonnull (lt_argv_zero));
3806 for (i = 0; i < newargc; i++)
3808 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
3809 i, nonnull (newargz[i]));
3814 case $host_os in
3815 mingw*)
3816 cat <<"EOF"
3817 /* execv doesn't actually work on mingw as expected on unix */
3818 newargz = prepare_spawn (newargz);
3819 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
3820 if (rval == -1)
3822 /* failed to start process */
3823 lt_debugprintf (__FILE__, __LINE__,
3824 "(main) failed to launch target \"%s\": %s\n",
3825 lt_argv_zero, nonnull (strerror (errno)));
3826 return 127;
3828 return rval;
3832 cat <<"EOF"
3833 execv (lt_argv_zero, newargz);
3834 return rval; /* =127, but avoids unused variable warning */
3837 esac
3839 cat <<"EOF"
3842 void *
3843 xmalloc (size_t num)
3845 void *p = (void *) malloc (num);
3846 if (!p)
3847 lt_fatal (__FILE__, __LINE__, "memory exhausted");
3849 return p;
3852 char *
3853 xstrdup (const char *string)
3855 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3856 string) : NULL;
3859 const char *
3860 base_name (const char *name)
3862 const char *base;
3864 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3865 /* Skip over the disk name in MSDOS pathnames. */
3866 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3867 name += 2;
3868 #endif
3870 for (base = name; *name; name++)
3871 if (IS_DIR_SEPARATOR (*name))
3872 base = name + 1;
3873 return base;
3877 check_executable (const char *path)
3879 struct stat st;
3881 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
3882 nonempty (path));
3883 if ((!path) || (!*path))
3884 return 0;
3886 if ((stat (path, &st) >= 0)
3887 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3888 return 1;
3889 else
3890 return 0;
3894 make_executable (const char *path)
3896 int rval = 0;
3897 struct stat st;
3899 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
3900 nonempty (path));
3901 if ((!path) || (!*path))
3902 return 0;
3904 if (stat (path, &st) >= 0)
3906 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3908 return rval;
3911 /* Searches for the full path of the wrapper. Returns
3912 newly allocated full path name if found, NULL otherwise
3913 Does not chase symlinks, even on platforms that support them.
3915 char *
3916 find_executable (const char *wrapper)
3918 int has_slash = 0;
3919 const char *p;
3920 const char *p_next;
3921 /* static buffer for getcwd */
3922 char tmp[LT_PATHMAX + 1];
3923 int tmp_len;
3924 char *concat_name;
3926 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
3927 nonempty (wrapper));
3929 if ((wrapper == NULL) || (*wrapper == '\0'))
3930 return NULL;
3932 /* Absolute path? */
3933 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3934 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3936 concat_name = xstrdup (wrapper);
3937 if (check_executable (concat_name))
3938 return concat_name;
3939 XFREE (concat_name);
3941 else
3943 #endif
3944 if (IS_DIR_SEPARATOR (wrapper[0]))
3946 concat_name = xstrdup (wrapper);
3947 if (check_executable (concat_name))
3948 return concat_name;
3949 XFREE (concat_name);
3951 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3953 #endif
3955 for (p = wrapper; *p; p++)
3956 if (*p == '/')
3958 has_slash = 1;
3959 break;
3961 if (!has_slash)
3963 /* no slashes; search PATH */
3964 const char *path = getenv ("PATH");
3965 if (path != NULL)
3967 for (p = path; *p; p = p_next)
3969 const char *q;
3970 size_t p_len;
3971 for (q = p; *q; q++)
3972 if (IS_PATH_SEPARATOR (*q))
3973 break;
3974 p_len = q - p;
3975 p_next = (*q == '\0' ? q : q + 1);
3976 if (p_len == 0)
3978 /* empty path: current directory */
3979 if (getcwd (tmp, LT_PATHMAX) == NULL)
3980 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
3981 nonnull (strerror (errno)));
3982 tmp_len = strlen (tmp);
3983 concat_name =
3984 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3985 memcpy (concat_name, tmp, tmp_len);
3986 concat_name[tmp_len] = '/';
3987 strcpy (concat_name + tmp_len + 1, wrapper);
3989 else
3991 concat_name =
3992 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3993 memcpy (concat_name, p, p_len);
3994 concat_name[p_len] = '/';
3995 strcpy (concat_name + p_len + 1, wrapper);
3997 if (check_executable (concat_name))
3998 return concat_name;
3999 XFREE (concat_name);
4002 /* not found in PATH; assume curdir */
4004 /* Relative path | not found in path: prepend cwd */
4005 if (getcwd (tmp, LT_PATHMAX) == NULL)
4006 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4007 nonnull (strerror (errno)));
4008 tmp_len = strlen (tmp);
4009 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4010 memcpy (concat_name, tmp, tmp_len);
4011 concat_name[tmp_len] = '/';
4012 strcpy (concat_name + tmp_len + 1, wrapper);
4014 if (check_executable (concat_name))
4015 return concat_name;
4016 XFREE (concat_name);
4017 return NULL;
4020 char *
4021 chase_symlinks (const char *pathspec)
4023 #ifndef S_ISLNK
4024 return xstrdup (pathspec);
4025 #else
4026 char buf[LT_PATHMAX];
4027 struct stat s;
4028 char *tmp_pathspec = xstrdup (pathspec);
4029 char *p;
4030 int has_symlinks = 0;
4031 while (strlen (tmp_pathspec) && !has_symlinks)
4033 lt_debugprintf (__FILE__, __LINE__,
4034 "checking path component for symlinks: %s\n",
4035 tmp_pathspec);
4036 if (lstat (tmp_pathspec, &s) == 0)
4038 if (S_ISLNK (s.st_mode) != 0)
4040 has_symlinks = 1;
4041 break;
4044 /* search backwards for last DIR_SEPARATOR */
4045 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4046 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4047 p--;
4048 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4050 /* no more DIR_SEPARATORS left */
4051 break;
4053 *p = '\0';
4055 else
4057 lt_fatal (__FILE__, __LINE__,
4058 "error accessing file \"%s\": %s",
4059 tmp_pathspec, nonnull (strerror (errno)));
4062 XFREE (tmp_pathspec);
4064 if (!has_symlinks)
4066 return xstrdup (pathspec);
4069 tmp_pathspec = realpath (pathspec, buf);
4070 if (tmp_pathspec == 0)
4072 lt_fatal (__FILE__, __LINE__,
4073 "could not follow symlinks for %s", pathspec);
4075 return xstrdup (tmp_pathspec);
4076 #endif
4079 char *
4080 strendzap (char *str, const char *pat)
4082 size_t len, patlen;
4084 assert (str != NULL);
4085 assert (pat != NULL);
4087 len = strlen (str);
4088 patlen = strlen (pat);
4090 if (patlen <= len)
4092 str += len - patlen;
4093 if (strcmp (str, pat) == 0)
4094 *str = '\0';
4096 return str;
4099 void
4100 lt_debugprintf (const char *file, int line, const char *fmt, ...)
4102 va_list args;
4103 if (lt_debug)
4105 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4106 va_start (args, fmt);
4107 (void) vfprintf (stderr, fmt, args);
4108 va_end (args);
4112 static void
4113 lt_error_core (int exit_status, const char *file,
4114 int line, const char *mode,
4115 const char *message, va_list ap)
4117 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4118 vfprintf (stderr, message, ap);
4119 fprintf (stderr, ".\n");
4121 if (exit_status >= 0)
4122 exit (exit_status);
4125 void
4126 lt_fatal (const char *file, int line, const char *message, ...)
4128 va_list ap;
4129 va_start (ap, message);
4130 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4131 va_end (ap);
4134 static const char *
4135 nonnull (const char *s)
4137 return s ? s : "(null)";
4140 static const char *
4141 nonempty (const char *s)
4143 return (s && !*s) ? "(empty)" : nonnull (s);
4146 void
4147 lt_setenv (const char *name, const char *value)
4149 lt_debugprintf (__FILE__, __LINE__,
4150 "(lt_setenv) setting '%s' to '%s'\n",
4151 nonnull (name), nonnull (value));
4153 #ifdef HAVE_SETENV
4154 /* always make a copy, for consistency with !HAVE_SETENV */
4155 char *str = xstrdup (value);
4156 setenv (name, str, 1);
4157 #else
4158 int len = strlen (name) + 1 + strlen (value) + 1;
4159 char *str = XMALLOC (char, len);
4160 sprintf (str, "%s=%s", name, value);
4161 if (putenv (str) != EXIT_SUCCESS)
4163 XFREE (str);
4165 #endif
4169 char *
4170 lt_extend_str (const char *orig_value, const char *add, int to_end)
4172 char *new_value;
4173 if (orig_value && *orig_value)
4175 int orig_value_len = strlen (orig_value);
4176 int add_len = strlen (add);
4177 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4178 if (to_end)
4180 strcpy (new_value, orig_value);
4181 strcpy (new_value + orig_value_len, add);
4183 else
4185 strcpy (new_value, add);
4186 strcpy (new_value + add_len, orig_value);
4189 else
4191 new_value = xstrdup (add);
4193 return new_value;
4196 void
4197 lt_update_exe_path (const char *name, const char *value)
4199 lt_debugprintf (__FILE__, __LINE__,
4200 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4201 nonnull (name), nonnull (value));
4203 if (name && *name && value && *value)
4205 char *new_value = lt_extend_str (getenv (name), value, 0);
4206 /* some systems can't cope with a ':'-terminated path #' */
4207 int len = strlen (new_value);
4208 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4210 new_value[len-1] = '\0';
4212 lt_setenv (name, new_value);
4213 XFREE (new_value);
4217 void
4218 lt_update_lib_path (const char *name, const char *value)
4220 lt_debugprintf (__FILE__, __LINE__,
4221 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4222 nonnull (name), nonnull (value));
4224 if (name && *name && value && *value)
4226 char *new_value = lt_extend_str (getenv (name), value, 0);
4227 lt_setenv (name, new_value);
4228 XFREE (new_value);
4233 case $host_os in
4234 mingw*)
4235 cat <<"EOF"
4237 /* Prepares an argument vector before calling spawn().
4238 Note that spawn() does not by itself call the command interpreter
4239 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4240 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4241 GetVersionEx(&v);
4242 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4243 }) ? "cmd.exe" : "command.com").
4244 Instead it simply concatenates the arguments, separated by ' ', and calls
4245 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4246 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4247 special way:
4248 - Space and tab are interpreted as delimiters. They are not treated as
4249 delimiters if they are surrounded by double quotes: "...".
4250 - Unescaped double quotes are removed from the input. Their only effect is
4251 that within double quotes, space and tab are treated like normal
4252 characters.
4253 - Backslashes not followed by double quotes are not special.
4254 - But 2*n+1 backslashes followed by a double quote become
4255 n backslashes followed by a double quote (n >= 0):
4256 \" -> "
4257 \\\" -> \"
4258 \\\\\" -> \\"
4260 #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4261 #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4262 char **
4263 prepare_spawn (char **argv)
4265 size_t argc;
4266 char **new_argv;
4267 size_t i;
4269 /* Count number of arguments. */
4270 for (argc = 0; argv[argc] != NULL; argc++)
4273 /* Allocate new argument vector. */
4274 new_argv = XMALLOC (char *, argc + 1);
4276 /* Put quoted arguments into the new argument vector. */
4277 for (i = 0; i < argc; i++)
4279 const char *string = argv[i];
4281 if (string[0] == '\0')
4282 new_argv[i] = xstrdup ("\"\"");
4283 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4285 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4286 size_t length;
4287 unsigned int backslashes;
4288 const char *s;
4289 char *quoted_string;
4290 char *p;
4292 length = 0;
4293 backslashes = 0;
4294 if (quote_around)
4295 length++;
4296 for (s = string; *s != '\0'; s++)
4298 char c = *s;
4299 if (c == '"')
4300 length += backslashes + 1;
4301 length++;
4302 if (c == '\\')
4303 backslashes++;
4304 else
4305 backslashes = 0;
4307 if (quote_around)
4308 length += backslashes + 1;
4310 quoted_string = XMALLOC (char, length + 1);
4312 p = quoted_string;
4313 backslashes = 0;
4314 if (quote_around)
4315 *p++ = '"';
4316 for (s = string; *s != '\0'; s++)
4318 char c = *s;
4319 if (c == '"')
4321 unsigned int j;
4322 for (j = backslashes + 1; j > 0; j--)
4323 *p++ = '\\';
4325 *p++ = c;
4326 if (c == '\\')
4327 backslashes++;
4328 else
4329 backslashes = 0;
4331 if (quote_around)
4333 unsigned int j;
4334 for (j = backslashes; j > 0; j--)
4335 *p++ = '\\';
4336 *p++ = '"';
4338 *p = '\0';
4340 new_argv[i] = quoted_string;
4342 else
4343 new_argv[i] = (char *) string;
4345 new_argv[argc] = NULL;
4347 return new_argv;
4351 esac
4353 cat <<"EOF"
4354 void lt_dump_script (FILE* f)
4357 func_emit_wrapper yes |
4358 $SED -e 's/\([\\"]\)/\\\1/g' \
4359 -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
4361 cat <<"EOF"
4365 # end: func_emit_cwrapperexe_src
4367 # func_win32_import_lib_p ARG
4368 # True if ARG is an import lib, as indicated by $file_magic_cmd
4369 func_win32_import_lib_p ()
4371 $opt_debug
4372 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
4373 *import*) : ;;
4374 *) false ;;
4375 esac
4378 # func_mode_link arg...
4379 func_mode_link ()
4381 $opt_debug
4382 case $host in
4383 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4384 # It is impossible to link a dll without this setting, and
4385 # we shouldn't force the makefile maintainer to figure out
4386 # which system we are compiling for in order to pass an extra
4387 # flag for every libtool invocation.
4388 # allow_undefined=no
4390 # FIXME: Unfortunately, there are problems with the above when trying
4391 # to make a dll which has undefined symbols, in which case not
4392 # even a static library is built. For now, we need to specify
4393 # -no-undefined on the libtool link line when we can be certain
4394 # that all symbols are satisfied, otherwise we get a static library.
4395 allow_undefined=yes
4398 allow_undefined=yes
4400 esac
4401 libtool_args=$nonopt
4402 base_compile="$nonopt $@"
4403 compile_command=$nonopt
4404 finalize_command=$nonopt
4406 compile_rpath=
4407 finalize_rpath=
4408 compile_shlibpath=
4409 finalize_shlibpath=
4410 convenience=
4411 old_convenience=
4412 deplibs=
4413 old_deplibs=
4414 compiler_flags=
4415 linker_flags=
4416 dllsearchpath=
4417 lib_search_path=`pwd`
4418 inst_prefix_dir=
4419 new_inherited_linker_flags=
4421 avoid_version=no
4422 bindir=
4423 dlfiles=
4424 dlprefiles=
4425 dlself=no
4426 export_dynamic=no
4427 export_symbols=
4428 export_symbols_regex=
4429 generated=
4430 libobjs=
4431 ltlibs=
4432 module=no
4433 no_install=no
4434 objs=
4435 non_pic_objects=
4436 precious_files_regex=
4437 prefer_static_libs=no
4438 preload=no
4439 prev=
4440 prevarg=
4441 release=
4442 rpath=
4443 xrpath=
4444 perm_rpath=
4445 temp_rpath=
4446 thread_safe=no
4447 vinfo=
4448 vinfo_number=no
4449 weak_libs=
4450 single_module="${wl}-single_module"
4451 func_infer_tag $base_compile
4453 # We need to know -static, to get the right output filenames.
4454 for arg
4456 case $arg in
4457 -shared)
4458 test "$build_libtool_libs" != yes && \
4459 func_fatal_configuration "can not build a shared library"
4460 build_old_libs=no
4461 break
4463 -all-static | -static | -static-libtool-libs)
4464 case $arg in
4465 -all-static)
4466 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4467 func_warning "complete static linking is impossible in this configuration"
4469 if test -n "$link_static_flag"; then
4470 dlopen_self=$dlopen_self_static
4472 prefer_static_libs=yes
4474 -static)
4475 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4476 dlopen_self=$dlopen_self_static
4478 prefer_static_libs=built
4480 -static-libtool-libs)
4481 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4482 dlopen_self=$dlopen_self_static
4484 prefer_static_libs=yes
4486 esac
4487 build_libtool_libs=no
4488 build_old_libs=yes
4489 break
4491 esac
4492 done
4494 # See if our shared archives depend on static archives.
4495 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4497 # Go through the arguments, transforming them on the way.
4498 while test "$#" -gt 0; do
4499 arg="$1"
4500 shift
4501 func_quote_for_eval "$arg"
4502 qarg=$func_quote_for_eval_unquoted_result
4503 func_append libtool_args " $func_quote_for_eval_result"
4505 # If the previous option needs an argument, assign it.
4506 if test -n "$prev"; then
4507 case $prev in
4508 output)
4509 func_append compile_command " @OUTPUT@"
4510 func_append finalize_command " @OUTPUT@"
4512 esac
4514 case $prev in
4515 bindir)
4516 bindir="$arg"
4517 prev=
4518 continue
4520 dlfiles|dlprefiles)
4521 if test "$preload" = no; then
4522 # Add the symbol object into the linking commands.
4523 func_append compile_command " @SYMFILE@"
4524 func_append finalize_command " @SYMFILE@"
4525 preload=yes
4527 case $arg in
4528 *.la | *.lo) ;; # We handle these cases below.
4529 force)
4530 if test "$dlself" = no; then
4531 dlself=needless
4532 export_dynamic=yes
4534 prev=
4535 continue
4537 self)
4538 if test "$prev" = dlprefiles; then
4539 dlself=yes
4540 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4541 dlself=yes
4542 else
4543 dlself=needless
4544 export_dynamic=yes
4546 prev=
4547 continue
4550 if test "$prev" = dlfiles; then
4551 dlfiles="$dlfiles $arg"
4552 else
4553 dlprefiles="$dlprefiles $arg"
4555 prev=
4556 continue
4558 esac
4560 expsyms)
4561 export_symbols="$arg"
4562 test -f "$arg" \
4563 || func_fatal_error "symbol file \`$arg' does not exist"
4564 prev=
4565 continue
4567 expsyms_regex)
4568 export_symbols_regex="$arg"
4569 prev=
4570 continue
4572 framework)
4573 case $host in
4574 *-*-darwin*)
4575 case "$deplibs " in
4576 *" $qarg.ltframework "*) ;;
4577 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4579 esac
4581 esac
4582 prev=
4583 continue
4585 inst_prefix)
4586 inst_prefix_dir="$arg"
4587 prev=
4588 continue
4590 objectlist)
4591 if test -f "$arg"; then
4592 save_arg=$arg
4593 moreargs=
4594 for fil in `cat "$save_arg"`
4596 # moreargs="$moreargs $fil"
4597 arg=$fil
4598 # A libtool-controlled object.
4600 # Check to see that this really is a libtool object.
4601 if func_lalib_unsafe_p "$arg"; then
4602 pic_object=
4603 non_pic_object=
4605 # Read the .lo file
4606 func_source "$arg"
4608 if test -z "$pic_object" ||
4609 test -z "$non_pic_object" ||
4610 test "$pic_object" = none &&
4611 test "$non_pic_object" = none; then
4612 func_fatal_error "cannot find name of object for \`$arg'"
4615 # Extract subdirectory from the argument.
4616 func_dirname "$arg" "/" ""
4617 xdir="$func_dirname_result"
4619 if test "$pic_object" != none; then
4620 # Prepend the subdirectory the object is found in.
4621 pic_object="$xdir$pic_object"
4623 if test "$prev" = dlfiles; then
4624 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4625 dlfiles="$dlfiles $pic_object"
4626 prev=
4627 continue
4628 else
4629 # If libtool objects are unsupported, then we need to preload.
4630 prev=dlprefiles
4634 # CHECK ME: I think I busted this. -Ossama
4635 if test "$prev" = dlprefiles; then
4636 # Preload the old-style object.
4637 dlprefiles="$dlprefiles $pic_object"
4638 prev=
4641 # A PIC object.
4642 func_append libobjs " $pic_object"
4643 arg="$pic_object"
4646 # Non-PIC object.
4647 if test "$non_pic_object" != none; then
4648 # Prepend the subdirectory the object is found in.
4649 non_pic_object="$xdir$non_pic_object"
4651 # A standard non-PIC object
4652 func_append non_pic_objects " $non_pic_object"
4653 if test -z "$pic_object" || test "$pic_object" = none ; then
4654 arg="$non_pic_object"
4656 else
4657 # If the PIC object exists, use it instead.
4658 # $xdir was prepended to $pic_object above.
4659 non_pic_object="$pic_object"
4660 func_append non_pic_objects " $non_pic_object"
4662 else
4663 # Only an error if not doing a dry-run.
4664 if $opt_dry_run; then
4665 # Extract subdirectory from the argument.
4666 func_dirname "$arg" "/" ""
4667 xdir="$func_dirname_result"
4669 func_lo2o "$arg"
4670 pic_object=$xdir$objdir/$func_lo2o_result
4671 non_pic_object=$xdir$func_lo2o_result
4672 func_append libobjs " $pic_object"
4673 func_append non_pic_objects " $non_pic_object"
4674 else
4675 func_fatal_error "\`$arg' is not a valid libtool object"
4678 done
4679 else
4680 func_fatal_error "link input file \`$arg' does not exist"
4682 arg=$save_arg
4683 prev=
4684 continue
4686 precious_regex)
4687 precious_files_regex="$arg"
4688 prev=
4689 continue
4691 release)
4692 release="-$arg"
4693 prev=
4694 continue
4696 rpath | xrpath)
4697 # We need an absolute path.
4698 case $arg in
4699 [\\/]* | [A-Za-z]:[\\/]*) ;;
4701 func_fatal_error "only absolute run-paths are allowed"
4703 esac
4704 if test "$prev" = rpath; then
4705 case "$rpath " in
4706 *" $arg "*) ;;
4707 *) rpath="$rpath $arg" ;;
4708 esac
4709 else
4710 case "$xrpath " in
4711 *" $arg "*) ;;
4712 *) xrpath="$xrpath $arg" ;;
4713 esac
4715 prev=
4716 continue
4718 shrext)
4719 shrext_cmds="$arg"
4720 prev=
4721 continue
4723 weak)
4724 weak_libs="$weak_libs $arg"
4725 prev=
4726 continue
4728 xcclinker)
4729 linker_flags="$linker_flags $qarg"
4730 compiler_flags="$compiler_flags $qarg"
4731 prev=
4732 func_append compile_command " $qarg"
4733 func_append finalize_command " $qarg"
4734 continue
4736 xcompiler)
4737 compiler_flags="$compiler_flags $qarg"
4738 prev=
4739 func_append compile_command " $qarg"
4740 func_append finalize_command " $qarg"
4741 continue
4743 xlinker)
4744 linker_flags="$linker_flags $qarg"
4745 compiler_flags="$compiler_flags $wl$qarg"
4746 prev=
4747 func_append compile_command " $wl$qarg"
4748 func_append finalize_command " $wl$qarg"
4749 continue
4752 eval "$prev=\"\$arg\""
4753 prev=
4754 continue
4756 esac
4757 fi # test -n "$prev"
4759 prevarg="$arg"
4761 case $arg in
4762 -all-static)
4763 if test -n "$link_static_flag"; then
4764 # See comment for -static flag below, for more details.
4765 func_append compile_command " $link_static_flag"
4766 func_append finalize_command " $link_static_flag"
4768 continue
4771 -allow-undefined)
4772 # FIXME: remove this flag sometime in the future.
4773 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
4776 -avoid-version)
4777 avoid_version=yes
4778 continue
4781 -bindir)
4782 prev=bindir
4783 continue
4786 -dlopen)
4787 prev=dlfiles
4788 continue
4791 -dlpreopen)
4792 prev=dlprefiles
4793 continue
4796 -export-dynamic)
4797 export_dynamic=yes
4798 continue
4801 -export-symbols | -export-symbols-regex)
4802 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
4803 func_fatal_error "more than one -exported-symbols argument is not allowed"
4805 if test "X$arg" = "X-export-symbols"; then
4806 prev=expsyms
4807 else
4808 prev=expsyms_regex
4810 continue
4813 -framework)
4814 prev=framework
4815 continue
4818 -inst-prefix-dir)
4819 prev=inst_prefix
4820 continue
4823 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
4824 # so, if we see these flags be careful not to treat them like -L
4825 -L[A-Z][A-Z]*:*)
4826 case $with_gcc/$host in
4827 no/*-*-irix* | /*-*-irix*)
4828 func_append compile_command " $arg"
4829 func_append finalize_command " $arg"
4831 esac
4832 continue
4835 -L*)
4836 func_stripname '-L' '' "$arg"
4837 dir=$func_stripname_result
4838 if test -z "$dir"; then
4839 if test "$#" -gt 0; then
4840 func_fatal_error "require no space between \`-L' and \`$1'"
4841 else
4842 func_fatal_error "need path for \`-L' option"
4845 # We need an absolute path.
4846 case $dir in
4847 [\\/]* | [A-Za-z]:[\\/]*) ;;
4849 absdir=`cd "$dir" && pwd`
4850 test -z "$absdir" && \
4851 func_fatal_error "cannot determine absolute directory name of \`$dir'"
4852 dir="$absdir"
4854 esac
4855 case "$deplibs " in
4856 *" -L$dir "*) ;;
4858 deplibs="$deplibs -L$dir"
4859 lib_search_path="$lib_search_path $dir"
4861 esac
4862 case $host in
4863 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4864 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
4865 case :$dllsearchpath: in
4866 *":$dir:"*) ;;
4867 ::) dllsearchpath=$dir;;
4868 *) dllsearchpath="$dllsearchpath:$dir";;
4869 esac
4870 case :$dllsearchpath: in
4871 *":$testbindir:"*) ;;
4872 ::) dllsearchpath=$testbindir;;
4873 *) dllsearchpath="$dllsearchpath:$testbindir";;
4874 esac
4876 esac
4877 continue
4880 -l*)
4881 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
4882 case $host in
4883 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
4884 # These systems don't actually have a C or math library (as such)
4885 continue
4887 *-*-os2*)
4888 # These systems don't actually have a C library (as such)
4889 test "X$arg" = "X-lc" && continue
4891 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4892 # Do not include libc due to us having libc/libc_r.
4893 test "X$arg" = "X-lc" && continue
4895 *-*-rhapsody* | *-*-darwin1.[012])
4896 # Rhapsody C and math libraries are in the System framework
4897 deplibs="$deplibs System.ltframework"
4898 continue
4900 *-*-sco3.2v5* | *-*-sco5v6*)
4901 # Causes problems with __ctype
4902 test "X$arg" = "X-lc" && continue
4904 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
4905 # Compiler inserts libc in the correct place for threads to work
4906 test "X$arg" = "X-lc" && continue
4908 esac
4909 elif test "X$arg" = "X-lc_r"; then
4910 case $host in
4911 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4912 # Do not include libc_r directly, use -pthread flag.
4913 continue
4915 esac
4917 deplibs="$deplibs $arg"
4918 continue
4921 -module)
4922 module=yes
4923 continue
4926 # Tru64 UNIX uses -model [arg] to determine the layout of C++
4927 # classes, name mangling, and exception handling.
4928 # Darwin uses the -arch flag to determine output architecture.
4929 -model|-arch|-isysroot)
4930 compiler_flags="$compiler_flags $arg"
4931 func_append compile_command " $arg"
4932 func_append finalize_command " $arg"
4933 prev=xcompiler
4934 continue
4937 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4938 compiler_flags="$compiler_flags $arg"
4939 func_append compile_command " $arg"
4940 func_append finalize_command " $arg"
4941 case "$new_inherited_linker_flags " in
4942 *" $arg "*) ;;
4943 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
4944 esac
4945 deplibs="$deplibs $arg"
4946 continue
4949 -multi_module)
4950 single_module="${wl}-multi_module"
4951 continue
4954 -no-fast-install)
4955 fast_install=no
4956 continue
4959 -no-install)
4960 case $host in
4961 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
4962 # The PATH hackery in wrapper scripts is required on Windows
4963 # and Darwin in order for the loader to find any dlls it needs.
4964 func_warning "\`-no-install' is ignored for $host"
4965 func_warning "assuming \`-no-fast-install' instead"
4966 fast_install=no
4968 *) no_install=yes ;;
4969 esac
4970 continue
4973 -no-undefined)
4974 allow_undefined=no
4975 continue
4978 -objectlist)
4979 prev=objectlist
4980 continue
4983 -o) prev=output ;;
4985 -precious-files-regex)
4986 prev=precious_regex
4987 continue
4990 -release)
4991 prev=release
4992 continue
4995 -rpath)
4996 prev=rpath
4997 continue
5001 prev=xrpath
5002 continue
5005 -R*)
5006 func_stripname '-R' '' "$arg"
5007 dir=$func_stripname_result
5008 # We need an absolute path.
5009 case $dir in
5010 [\\/]* | [A-Za-z]:[\\/]*) ;;
5012 func_fatal_error "only absolute run-paths are allowed"
5014 esac
5015 case "$xrpath " in
5016 *" $dir "*) ;;
5017 *) xrpath="$xrpath $dir" ;;
5018 esac
5019 continue
5022 -shared)
5023 # The effects of -shared are defined in a previous loop.
5024 continue
5027 -shrext)
5028 prev=shrext
5029 continue
5032 -static | -static-libtool-libs)
5033 # The effects of -static are defined in a previous loop.
5034 # We used to do the same as -all-static on platforms that
5035 # didn't have a PIC flag, but the assumption that the effects
5036 # would be equivalent was wrong. It would break on at least
5037 # Digital Unix and AIX.
5038 continue
5041 -thread-safe)
5042 thread_safe=yes
5043 continue
5046 -version-info)
5047 prev=vinfo
5048 continue
5051 -version-number)
5052 prev=vinfo
5053 vinfo_number=yes
5054 continue
5057 -weak)
5058 prev=weak
5059 continue
5062 -Wc,*)
5063 func_stripname '-Wc,' '' "$arg"
5064 args=$func_stripname_result
5065 arg=
5066 save_ifs="$IFS"; IFS=','
5067 for flag in $args; do
5068 IFS="$save_ifs"
5069 func_quote_for_eval "$flag"
5070 arg="$arg $func_quote_for_eval_result"
5071 compiler_flags="$compiler_flags $func_quote_for_eval_result"
5072 done
5073 IFS="$save_ifs"
5074 func_stripname ' ' '' "$arg"
5075 arg=$func_stripname_result
5078 -Wl,*)
5079 func_stripname '-Wl,' '' "$arg"
5080 args=$func_stripname_result
5081 arg=
5082 save_ifs="$IFS"; IFS=','
5083 for flag in $args; do
5084 IFS="$save_ifs"
5085 func_quote_for_eval "$flag"
5086 arg="$arg $wl$func_quote_for_eval_result"
5087 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
5088 linker_flags="$linker_flags $func_quote_for_eval_result"
5089 done
5090 IFS="$save_ifs"
5091 func_stripname ' ' '' "$arg"
5092 arg=$func_stripname_result
5095 -Xcompiler)
5096 prev=xcompiler
5097 continue
5100 -Xlinker)
5101 prev=xlinker
5102 continue
5105 -XCClinker)
5106 prev=xcclinker
5107 continue
5110 # -msg_* for osf cc
5111 -msg_*)
5112 func_quote_for_eval "$arg"
5113 arg="$func_quote_for_eval_result"
5116 # Flags to be passed through unchanged, with rationale:
5117 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5118 # -r[0-9][0-9]* specify processor for the SGI compiler
5119 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5120 # +DA*, +DD* enable 64-bit mode for the HP compiler
5121 # -q* compiler args for the IBM compiler
5122 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5123 # -F/path path to uninstalled frameworks, gcc on darwin
5124 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5125 # @file GCC response files
5126 # -tp=* Portland pgcc target processor selection
5127 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5128 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
5129 func_quote_for_eval "$arg"
5130 arg="$func_quote_for_eval_result"
5131 func_append compile_command " $arg"
5132 func_append finalize_command " $arg"
5133 compiler_flags="$compiler_flags $arg"
5134 continue
5137 # Some other compiler flag.
5138 -* | +*)
5139 func_quote_for_eval "$arg"
5140 arg="$func_quote_for_eval_result"
5143 *.$objext)
5144 # A standard object.
5145 objs="$objs $arg"
5148 *.lo)
5149 # A libtool-controlled object.
5151 # Check to see that this really is a libtool object.
5152 if func_lalib_unsafe_p "$arg"; then
5153 pic_object=
5154 non_pic_object=
5156 # Read the .lo file
5157 func_source "$arg"
5159 if test -z "$pic_object" ||
5160 test -z "$non_pic_object" ||
5161 test "$pic_object" = none &&
5162 test "$non_pic_object" = none; then
5163 func_fatal_error "cannot find name of object for \`$arg'"
5166 # Extract subdirectory from the argument.
5167 func_dirname "$arg" "/" ""
5168 xdir="$func_dirname_result"
5170 if test "$pic_object" != none; then
5171 # Prepend the subdirectory the object is found in.
5172 pic_object="$xdir$pic_object"
5174 if test "$prev" = dlfiles; then
5175 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5176 dlfiles="$dlfiles $pic_object"
5177 prev=
5178 continue
5179 else
5180 # If libtool objects are unsupported, then we need to preload.
5181 prev=dlprefiles
5185 # CHECK ME: I think I busted this. -Ossama
5186 if test "$prev" = dlprefiles; then
5187 # Preload the old-style object.
5188 dlprefiles="$dlprefiles $pic_object"
5189 prev=
5192 # A PIC object.
5193 func_append libobjs " $pic_object"
5194 arg="$pic_object"
5197 # Non-PIC object.
5198 if test "$non_pic_object" != none; then
5199 # Prepend the subdirectory the object is found in.
5200 non_pic_object="$xdir$non_pic_object"
5202 # A standard non-PIC object
5203 func_append non_pic_objects " $non_pic_object"
5204 if test -z "$pic_object" || test "$pic_object" = none ; then
5205 arg="$non_pic_object"
5207 else
5208 # If the PIC object exists, use it instead.
5209 # $xdir was prepended to $pic_object above.
5210 non_pic_object="$pic_object"
5211 func_append non_pic_objects " $non_pic_object"
5213 else
5214 # Only an error if not doing a dry-run.
5215 if $opt_dry_run; then
5216 # Extract subdirectory from the argument.
5217 func_dirname "$arg" "/" ""
5218 xdir="$func_dirname_result"
5220 func_lo2o "$arg"
5221 pic_object=$xdir$objdir/$func_lo2o_result
5222 non_pic_object=$xdir$func_lo2o_result
5223 func_append libobjs " $pic_object"
5224 func_append non_pic_objects " $non_pic_object"
5225 else
5226 func_fatal_error "\`$arg' is not a valid libtool object"
5231 *.$libext)
5232 # An archive.
5233 deplibs="$deplibs $arg"
5234 old_deplibs="$old_deplibs $arg"
5235 continue
5238 *.la)
5239 # A libtool-controlled library.
5241 if test "$prev" = dlfiles; then
5242 # This library was specified with -dlopen.
5243 dlfiles="$dlfiles $arg"
5244 prev=
5245 elif test "$prev" = dlprefiles; then
5246 # The library was specified with -dlpreopen.
5247 dlprefiles="$dlprefiles $arg"
5248 prev=
5249 else
5250 deplibs="$deplibs $arg"
5252 continue
5255 # Some other compiler argument.
5257 # Unknown arguments in both finalize_command and compile_command need
5258 # to be aesthetically quoted because they are evaled later.
5259 func_quote_for_eval "$arg"
5260 arg="$func_quote_for_eval_result"
5262 esac # arg
5264 # Now actually substitute the argument into the commands.
5265 if test -n "$arg"; then
5266 func_append compile_command " $arg"
5267 func_append finalize_command " $arg"
5269 done # argument parsing loop
5271 test -n "$prev" && \
5272 func_fatal_help "the \`$prevarg' option requires an argument"
5274 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5275 eval arg=\"$export_dynamic_flag_spec\"
5276 func_append compile_command " $arg"
5277 func_append finalize_command " $arg"
5280 oldlibs=
5281 # calculate the name of the file, without its directory
5282 func_basename "$output"
5283 outputname="$func_basename_result"
5284 libobjs_save="$libobjs"
5286 if test -n "$shlibpath_var"; then
5287 # get the directories listed in $shlibpath_var
5288 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
5289 else
5290 shlib_search_path=
5292 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5293 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5295 func_dirname "$output" "/" ""
5296 output_objdir="$func_dirname_result$objdir"
5297 # Create the object directory.
5298 func_mkdir_p "$output_objdir"
5300 # Determine the type of output
5301 case $output in
5303 func_fatal_help "you must specify an output file"
5305 *.$libext) linkmode=oldlib ;;
5306 *.lo | *.$objext) linkmode=obj ;;
5307 *.la) linkmode=lib ;;
5308 *) linkmode=prog ;; # Anything else should be a program.
5309 esac
5311 specialdeplibs=
5313 libs=
5314 # Find all interdependent deplibs by searching for libraries
5315 # that are linked more than once (e.g. -la -lb -la)
5316 for deplib in $deplibs; do
5317 if $opt_duplicate_deps ; then
5318 case "$libs " in
5319 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5320 esac
5322 libs="$libs $deplib"
5323 done
5325 if test "$linkmode" = lib; then
5326 libs="$predeps $libs $compiler_lib_search_path $postdeps"
5328 # Compute libraries that are listed more than once in $predeps
5329 # $postdeps and mark them as special (i.e., whose duplicates are
5330 # not to be eliminated).
5331 pre_post_deps=
5332 if $opt_duplicate_compiler_generated_deps; then
5333 for pre_post_dep in $predeps $postdeps; do
5334 case "$pre_post_deps " in
5335 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
5336 esac
5337 pre_post_deps="$pre_post_deps $pre_post_dep"
5338 done
5340 pre_post_deps=
5343 deplibs=
5344 newdependency_libs=
5345 newlib_search_path=
5346 need_relink=no # whether we're linking any uninstalled libtool libraries
5347 notinst_deplibs= # not-installed libtool libraries
5348 notinst_path= # paths that contain not-installed libtool libraries
5350 case $linkmode in
5351 lib)
5352 passes="conv dlpreopen link"
5353 for file in $dlfiles $dlprefiles; do
5354 case $file in
5355 *.la) ;;
5357 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5359 esac
5360 done
5362 prog)
5363 compile_deplibs=
5364 finalize_deplibs=
5365 alldeplibs=no
5366 newdlfiles=
5367 newdlprefiles=
5368 passes="conv scan dlopen dlpreopen link"
5370 *) passes="conv"
5372 esac
5374 for pass in $passes; do
5375 # The preopen pass in lib mode reverses $deplibs; put it back here
5376 # so that -L comes before libs that need it for instance...
5377 if test "$linkmode,$pass" = "lib,link"; then
5378 ## FIXME: Find the place where the list is rebuilt in the wrong
5379 ## order, and fix it there properly
5380 tmp_deplibs=
5381 for deplib in $deplibs; do
5382 tmp_deplibs="$deplib $tmp_deplibs"
5383 done
5384 deplibs="$tmp_deplibs"
5387 if test "$linkmode,$pass" = "lib,link" ||
5388 test "$linkmode,$pass" = "prog,scan"; then
5389 libs="$deplibs"
5390 deplibs=
5392 if test "$linkmode" = prog; then
5393 case $pass in
5394 dlopen) libs="$dlfiles" ;;
5395 dlpreopen) libs="$dlprefiles" ;;
5396 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5397 esac
5399 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5400 # Collect and forward deplibs of preopened libtool libs
5401 for lib in $dlprefiles; do
5402 # Ignore non-libtool-libs
5403 dependency_libs=
5404 case $lib in
5405 *.la) func_source "$lib" ;;
5406 esac
5408 # Collect preopened libtool deplibs, except any this library
5409 # has declared as weak libs
5410 for deplib in $dependency_libs; do
5411 func_basename "$deplib"
5412 deplib_base=$func_basename_result
5413 case " $weak_libs " in
5414 *" $deplib_base "*) ;;
5415 *) deplibs="$deplibs $deplib" ;;
5416 esac
5417 done
5418 done
5419 libs="$dlprefiles"
5421 if test "$pass" = dlopen; then
5422 # Collect dlpreopened libraries
5423 save_deplibs="$deplibs"
5424 deplibs=
5427 for deplib in $libs; do
5428 lib=
5429 found=no
5430 case $deplib in
5431 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5432 if test "$linkmode,$pass" = "prog,link"; then
5433 compile_deplibs="$deplib $compile_deplibs"
5434 finalize_deplibs="$deplib $finalize_deplibs"
5435 else
5436 compiler_flags="$compiler_flags $deplib"
5439 case $linkmode in
5440 lib)
5441 deplibs="$deplib $deplibs"
5442 test "$pass" = conv && continue
5443 newdependency_libs="$deplib $newdependency_libs"
5445 prog)
5446 if test "$pass" = conv; then
5447 deplibs="$deplib $deplibs"
5448 continue
5450 if test "$pass" = scan; then
5451 deplibs="$deplib $deplibs"
5452 else
5453 compile_deplibs="$deplib $compile_deplibs"
5454 finalize_deplibs="$deplib $finalize_deplibs"
5459 esac # linkmode
5461 continue
5463 -l*)
5464 if test "$linkmode" != lib && test "$linkmode" != prog; then
5465 func_warning "\`-l' is ignored for archives/objects"
5466 continue
5468 func_stripname '-l' '' "$deplib"
5469 name=$func_stripname_result
5470 if test "$linkmode" = lib; then
5471 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5472 else
5473 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5475 for searchdir in $searchdirs; do
5476 for search_ext in .la $std_shrext .so .a; do
5477 # Search the libtool library
5478 lib="$searchdir/lib${name}${search_ext}"
5479 if test -f "$lib"; then
5480 if test "$search_ext" = ".la"; then
5481 found=yes
5482 else
5483 found=no
5485 break 2
5487 done
5488 done
5489 if test "$found" != yes; then
5490 # deplib doesn't seem to be a libtool library
5491 if test "$linkmode,$pass" = "prog,link"; then
5492 compile_deplibs="$deplib $compile_deplibs"
5493 finalize_deplibs="$deplib $finalize_deplibs"
5494 else
5495 deplibs="$deplib $deplibs"
5496 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5498 continue
5499 else # deplib is a libtool library
5500 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5501 # We need to do some special things here, and not later.
5502 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5503 case " $predeps $postdeps " in
5504 *" $deplib "*)
5505 if func_lalib_p "$lib"; then
5506 library_names=
5507 old_library=
5508 func_source "$lib"
5509 for l in $old_library $library_names; do
5510 ll="$l"
5511 done
5512 if test "X$ll" = "X$old_library" ; then # only static version available
5513 found=no
5514 func_dirname "$lib" "" "."
5515 ladir="$func_dirname_result"
5516 lib=$ladir/$old_library
5517 if test "$linkmode,$pass" = "prog,link"; then
5518 compile_deplibs="$deplib $compile_deplibs"
5519 finalize_deplibs="$deplib $finalize_deplibs"
5520 else
5521 deplibs="$deplib $deplibs"
5522 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5524 continue
5528 *) ;;
5529 esac
5532 ;; # -l
5533 *.ltframework)
5534 if test "$linkmode,$pass" = "prog,link"; then
5535 compile_deplibs="$deplib $compile_deplibs"
5536 finalize_deplibs="$deplib $finalize_deplibs"
5537 else
5538 deplibs="$deplib $deplibs"
5539 if test "$linkmode" = lib ; then
5540 case "$new_inherited_linker_flags " in
5541 *" $deplib "*) ;;
5542 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5543 esac
5546 continue
5548 -L*)
5549 case $linkmode in
5550 lib)
5551 deplibs="$deplib $deplibs"
5552 test "$pass" = conv && continue
5553 newdependency_libs="$deplib $newdependency_libs"
5554 func_stripname '-L' '' "$deplib"
5555 newlib_search_path="$newlib_search_path $func_stripname_result"
5557 prog)
5558 if test "$pass" = conv; then
5559 deplibs="$deplib $deplibs"
5560 continue
5562 if test "$pass" = scan; then
5563 deplibs="$deplib $deplibs"
5564 else
5565 compile_deplibs="$deplib $compile_deplibs"
5566 finalize_deplibs="$deplib $finalize_deplibs"
5568 func_stripname '-L' '' "$deplib"
5569 newlib_search_path="$newlib_search_path $func_stripname_result"
5572 func_warning "\`-L' is ignored for archives/objects"
5574 esac # linkmode
5575 continue
5576 ;; # -L
5577 -R*)
5578 if test "$pass" = link; then
5579 func_stripname '-R' '' "$deplib"
5580 dir=$func_stripname_result
5581 # Make sure the xrpath contains only unique directories.
5582 case "$xrpath " in
5583 *" $dir "*) ;;
5584 *) xrpath="$xrpath $dir" ;;
5585 esac
5587 deplibs="$deplib $deplibs"
5588 continue
5590 *.la) lib="$deplib" ;;
5591 *.$libext)
5592 if test "$pass" = conv; then
5593 deplibs="$deplib $deplibs"
5594 continue
5596 case $linkmode in
5597 lib)
5598 # Linking convenience modules into shared libraries is allowed,
5599 # but linking other static libraries is non-portable.
5600 case " $dlpreconveniencelibs " in
5601 *" $deplib "*) ;;
5603 valid_a_lib=no
5604 case $deplibs_check_method in
5605 match_pattern*)
5606 set dummy $deplibs_check_method; shift
5607 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5608 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
5609 | $EGREP "$match_pattern_regex" > /dev/null; then
5610 valid_a_lib=yes
5613 pass_all)
5614 valid_a_lib=yes
5616 esac
5617 if test "$valid_a_lib" != yes; then
5618 echo
5619 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5620 echo "*** I have the capability to make that library automatically link in when"
5621 echo "*** you link to this library. But I can only do this if you have a"
5622 echo "*** shared version of the library, which you do not appear to have"
5623 echo "*** because the file extensions .$libext of this argument makes me believe"
5624 echo "*** that it is just a static archive that I should not use here."
5625 else
5626 echo
5627 $ECHO "*** Warning: Linking the shared library $output against the"
5628 $ECHO "*** static library $deplib is not portable!"
5629 deplibs="$deplib $deplibs"
5632 esac
5633 continue
5635 prog)
5636 if test "$pass" != link; then
5637 deplibs="$deplib $deplibs"
5638 else
5639 compile_deplibs="$deplib $compile_deplibs"
5640 finalize_deplibs="$deplib $finalize_deplibs"
5642 continue
5644 esac # linkmode
5645 ;; # *.$libext
5646 *.lo | *.$objext)
5647 if test "$pass" = conv; then
5648 deplibs="$deplib $deplibs"
5649 elif test "$linkmode" = prog; then
5650 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5651 # If there is no dlopen support or we're linking statically,
5652 # we need to preload.
5653 newdlprefiles="$newdlprefiles $deplib"
5654 compile_deplibs="$deplib $compile_deplibs"
5655 finalize_deplibs="$deplib $finalize_deplibs"
5656 else
5657 newdlfiles="$newdlfiles $deplib"
5660 continue
5662 %DEPLIBS%)
5663 alldeplibs=yes
5664 continue
5666 esac # case $deplib
5668 if test "$found" = yes || test -f "$lib"; then :
5669 else
5670 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
5673 # Check to see that this really is a libtool archive.
5674 func_lalib_unsafe_p "$lib" \
5675 || func_fatal_error "\`$lib' is not a valid libtool archive"
5677 func_dirname "$lib" "" "."
5678 ladir="$func_dirname_result"
5680 dlname=
5681 dlopen=
5682 dlpreopen=
5683 libdir=
5684 library_names=
5685 old_library=
5686 inherited_linker_flags=
5687 # If the library was installed with an old release of libtool,
5688 # it will not redefine variables installed, or shouldnotlink
5689 installed=yes
5690 shouldnotlink=no
5691 avoidtemprpath=
5694 # Read the .la file
5695 func_source "$lib"
5697 # Convert "-framework foo" to "foo.ltframework"
5698 if test -n "$inherited_linker_flags"; then
5699 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
5700 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5701 case " $new_inherited_linker_flags " in
5702 *" $tmp_inherited_linker_flag "*) ;;
5703 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
5704 esac
5705 done
5707 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
5708 if test "$linkmode,$pass" = "lib,link" ||
5709 test "$linkmode,$pass" = "prog,scan" ||
5710 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
5711 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
5712 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
5715 if test "$pass" = conv; then
5716 # Only check for convenience libraries
5717 deplibs="$lib $deplibs"
5718 if test -z "$libdir"; then
5719 if test -z "$old_library"; then
5720 func_fatal_error "cannot find name of link library for \`$lib'"
5722 # It is a libtool convenience library, so add in its objects.
5723 convenience="$convenience $ladir/$objdir/$old_library"
5724 old_convenience="$old_convenience $ladir/$objdir/$old_library"
5725 elif test "$linkmode" != prog && test "$linkmode" != lib; then
5726 func_fatal_error "\`$lib' is not a convenience library"
5728 tmp_libs=
5729 for deplib in $dependency_libs; do
5730 deplibs="$deplib $deplibs"
5731 if $opt_duplicate_deps ; then
5732 case "$tmp_libs " in
5733 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5734 esac
5736 tmp_libs="$tmp_libs $deplib"
5737 done
5738 continue
5739 fi # $pass = conv
5742 # Get the name of the library we link against.
5743 linklib=
5744 for l in $old_library $library_names; do
5745 linklib="$l"
5746 done
5747 if test -z "$linklib"; then
5748 func_fatal_error "cannot find name of link library for \`$lib'"
5751 # This library was specified with -dlopen.
5752 if test "$pass" = dlopen; then
5753 if test -z "$libdir"; then
5754 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
5756 if test -z "$dlname" ||
5757 test "$dlopen_support" != yes ||
5758 test "$build_libtool_libs" = no; then
5759 # If there is no dlname, no dlopen support or we're linking
5760 # statically, we need to preload. We also need to preload any
5761 # dependent libraries so libltdl's deplib preloader doesn't
5762 # bomb out in the load deplibs phase.
5763 dlprefiles="$dlprefiles $lib $dependency_libs"
5764 else
5765 newdlfiles="$newdlfiles $lib"
5767 continue
5768 fi # $pass = dlopen
5770 # We need an absolute path.
5771 case $ladir in
5772 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
5774 abs_ladir=`cd "$ladir" && pwd`
5775 if test -z "$abs_ladir"; then
5776 func_warning "cannot determine absolute directory name of \`$ladir'"
5777 func_warning "passing it literally to the linker, although it might fail"
5778 abs_ladir="$ladir"
5781 esac
5782 func_basename "$lib"
5783 laname="$func_basename_result"
5785 # Find the relevant object directory and library name.
5786 if test "X$installed" = Xyes; then
5787 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5788 func_warning "library \`$lib' was moved."
5789 dir="$ladir"
5790 absdir="$abs_ladir"
5791 libdir="$abs_ladir"
5792 else
5793 dir="$libdir"
5794 absdir="$libdir"
5796 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
5797 else
5798 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5799 dir="$ladir"
5800 absdir="$abs_ladir"
5801 # Remove this search path later
5802 notinst_path="$notinst_path $abs_ladir"
5803 else
5804 dir="$ladir/$objdir"
5805 absdir="$abs_ladir/$objdir"
5806 # Remove this search path later
5807 notinst_path="$notinst_path $abs_ladir"
5809 fi # $installed = yes
5810 func_stripname 'lib' '.la' "$laname"
5811 name=$func_stripname_result
5813 # This library was specified with -dlpreopen.
5814 if test "$pass" = dlpreopen; then
5815 if test -z "$libdir" && test "$linkmode" = prog; then
5816 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
5818 # Prefer using a static library (so that no silly _DYNAMIC symbols
5819 # are required to link).
5820 if test -n "$old_library"; then
5821 newdlprefiles="$newdlprefiles $dir/$old_library"
5822 # Keep a list of preopened convenience libraries to check
5823 # that they are being used correctly in the link pass.
5824 test -z "$libdir" && \
5825 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
5826 # Otherwise, use the dlname, so that lt_dlopen finds it.
5827 elif test -n "$dlname"; then
5828 newdlprefiles="$newdlprefiles $dir/$dlname"
5829 else
5830 newdlprefiles="$newdlprefiles $dir/$linklib"
5832 fi # $pass = dlpreopen
5834 if test -z "$libdir"; then
5835 # Link the convenience library
5836 if test "$linkmode" = lib; then
5837 deplibs="$dir/$old_library $deplibs"
5838 elif test "$linkmode,$pass" = "prog,link"; then
5839 compile_deplibs="$dir/$old_library $compile_deplibs"
5840 finalize_deplibs="$dir/$old_library $finalize_deplibs"
5841 else
5842 deplibs="$lib $deplibs" # used for prog,scan pass
5844 continue
5848 if test "$linkmode" = prog && test "$pass" != link; then
5849 newlib_search_path="$newlib_search_path $ladir"
5850 deplibs="$lib $deplibs"
5852 linkalldeplibs=no
5853 if test "$link_all_deplibs" != no || test -z "$library_names" ||
5854 test "$build_libtool_libs" = no; then
5855 linkalldeplibs=yes
5858 tmp_libs=
5859 for deplib in $dependency_libs; do
5860 case $deplib in
5861 -L*) func_stripname '-L' '' "$deplib"
5862 newlib_search_path="$newlib_search_path $func_stripname_result"
5864 esac
5865 # Need to link against all dependency_libs?
5866 if test "$linkalldeplibs" = yes; then
5867 deplibs="$deplib $deplibs"
5868 else
5869 # Need to hardcode shared library paths
5870 # or/and link against static libraries
5871 newdependency_libs="$deplib $newdependency_libs"
5873 if $opt_duplicate_deps ; then
5874 case "$tmp_libs " in
5875 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5876 esac
5878 tmp_libs="$tmp_libs $deplib"
5879 done # for deplib
5880 continue
5881 fi # $linkmode = prog...
5883 if test "$linkmode,$pass" = "prog,link"; then
5884 if test -n "$library_names" &&
5885 { { test "$prefer_static_libs" = no ||
5886 test "$prefer_static_libs,$installed" = "built,yes"; } ||
5887 test -z "$old_library"; }; then
5888 # We need to hardcode the library path
5889 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
5890 # Make sure the rpath contains only unique directories.
5891 case "$temp_rpath:" in
5892 *"$absdir:"*) ;;
5893 *) temp_rpath="$temp_rpath$absdir:" ;;
5894 esac
5897 # Hardcode the library path.
5898 # Skip directories that are in the system default run-time
5899 # search path.
5900 case " $sys_lib_dlsearch_path " in
5901 *" $absdir "*) ;;
5903 case "$compile_rpath " in
5904 *" $absdir "*) ;;
5905 *) compile_rpath="$compile_rpath $absdir"
5906 esac
5908 esac
5909 case " $sys_lib_dlsearch_path " in
5910 *" $libdir "*) ;;
5912 case "$finalize_rpath " in
5913 *" $libdir "*) ;;
5914 *) finalize_rpath="$finalize_rpath $libdir"
5915 esac
5917 esac
5918 fi # $linkmode,$pass = prog,link...
5920 if test "$alldeplibs" = yes &&
5921 { test "$deplibs_check_method" = pass_all ||
5922 { test "$build_libtool_libs" = yes &&
5923 test -n "$library_names"; }; }; then
5924 # We only need to search for static libraries
5925 continue
5929 link_static=no # Whether the deplib will be linked statically
5930 use_static_libs=$prefer_static_libs
5931 if test "$use_static_libs" = built && test "$installed" = yes; then
5932 use_static_libs=no
5934 if test -n "$library_names" &&
5935 { test "$use_static_libs" = no || test -z "$old_library"; }; then
5936 case $host in
5937 *cygwin* | *mingw* | *cegcc*)
5938 # No point in relinking DLLs because paths are not encoded
5939 notinst_deplibs="$notinst_deplibs $lib"
5940 need_relink=no
5943 if test "$installed" = no; then
5944 notinst_deplibs="$notinst_deplibs $lib"
5945 need_relink=yes
5948 esac
5949 # This is a shared library
5951 # Warn about portability, can't link against -module's on some
5952 # systems (darwin). Don't bleat about dlopened modules though!
5953 dlopenmodule=""
5954 for dlpremoduletest in $dlprefiles; do
5955 if test "X$dlpremoduletest" = "X$lib"; then
5956 dlopenmodule="$dlpremoduletest"
5957 break
5959 done
5960 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
5961 echo
5962 if test "$linkmode" = prog; then
5963 $ECHO "*** Warning: Linking the executable $output against the loadable module"
5964 else
5965 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
5967 $ECHO "*** $linklib is not portable!"
5969 if test "$linkmode" = lib &&
5970 test "$hardcode_into_libs" = yes; then
5971 # Hardcode the library path.
5972 # Skip directories that are in the system default run-time
5973 # search path.
5974 case " $sys_lib_dlsearch_path " in
5975 *" $absdir "*) ;;
5977 case "$compile_rpath " in
5978 *" $absdir "*) ;;
5979 *) compile_rpath="$compile_rpath $absdir"
5980 esac
5982 esac
5983 case " $sys_lib_dlsearch_path " in
5984 *" $libdir "*) ;;
5986 case "$finalize_rpath " in
5987 *" $libdir "*) ;;
5988 *) finalize_rpath="$finalize_rpath $libdir"
5989 esac
5991 esac
5994 if test -n "$old_archive_from_expsyms_cmds"; then
5995 # figure out the soname
5996 set dummy $library_names
5997 shift
5998 realname="$1"
5999 shift
6000 libname=`eval "\\$ECHO \"$libname_spec\""`
6001 # use dlname if we got it. it's perfectly good, no?
6002 if test -n "$dlname"; then
6003 soname="$dlname"
6004 elif test -n "$soname_spec"; then
6005 # bleh windows
6006 case $host in
6007 *cygwin* | mingw* | *cegcc*)
6008 func_arith $current - $age
6009 major=$func_arith_result
6010 versuffix="-$major"
6012 esac
6013 eval soname=\"$soname_spec\"
6014 else
6015 soname="$realname"
6018 # Make a new name for the extract_expsyms_cmds to use
6019 soroot="$soname"
6020 func_basename "$soroot"
6021 soname="$func_basename_result"
6022 func_stripname 'lib' '.dll' "$soname"
6023 newlib=libimp-$func_stripname_result.a
6025 # If the library has no export list, then create one now
6026 if test -f "$output_objdir/$soname-def"; then :
6027 else
6028 func_verbose "extracting exported symbol list from \`$soname'"
6029 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6032 # Create $newlib
6033 if test -f "$output_objdir/$newlib"; then :; else
6034 func_verbose "generating import library for \`$soname'"
6035 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6037 # make sure the library variables are pointing to the new library
6038 dir=$output_objdir
6039 linklib=$newlib
6040 fi # test -n "$old_archive_from_expsyms_cmds"
6042 if test "$linkmode" = prog || test "$mode" != relink; then
6043 add_shlibpath=
6044 add_dir=
6045 add=
6046 lib_linked=yes
6047 case $hardcode_action in
6048 immediate | unsupported)
6049 if test "$hardcode_direct" = no; then
6050 add="$dir/$linklib"
6051 case $host in
6052 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6053 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6054 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6055 *-*-unixware7*) add_dir="-L$dir" ;;
6056 *-*-darwin* )
6057 # if the lib is a (non-dlopened) module then we can not
6058 # link against it, someone is ignoring the earlier warnings
6059 if /usr/bin/file -L $add 2> /dev/null |
6060 $GREP ": [^:]* bundle" >/dev/null ; then
6061 if test "X$dlopenmodule" != "X$lib"; then
6062 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6063 if test -z "$old_library" ; then
6064 echo
6065 echo "*** And there doesn't seem to be a static archive available"
6066 echo "*** The link will probably fail, sorry"
6067 else
6068 add="$dir/$old_library"
6070 elif test -n "$old_library"; then
6071 add="$dir/$old_library"
6074 esac
6075 elif test "$hardcode_minus_L" = no; then
6076 case $host in
6077 *-*-sunos*) add_shlibpath="$dir" ;;
6078 esac
6079 add_dir="-L$dir"
6080 add="-l$name"
6081 elif test "$hardcode_shlibpath_var" = no; then
6082 add_shlibpath="$dir"
6083 add="-l$name"
6084 else
6085 lib_linked=no
6088 relink)
6089 if test "$hardcode_direct" = yes &&
6090 test "$hardcode_direct_absolute" = no; then
6091 add="$dir/$linklib"
6092 elif test "$hardcode_minus_L" = yes; then
6093 add_dir="-L$dir"
6094 # Try looking first in the location we're being installed to.
6095 if test -n "$inst_prefix_dir"; then
6096 case $libdir in
6097 [\\/]*)
6098 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6100 esac
6102 add="-l$name"
6103 elif test "$hardcode_shlibpath_var" = yes; then
6104 add_shlibpath="$dir"
6105 add="-l$name"
6106 else
6107 lib_linked=no
6110 *) lib_linked=no ;;
6111 esac
6113 if test "$lib_linked" != yes; then
6114 func_fatal_configuration "unsupported hardcode properties"
6117 if test -n "$add_shlibpath"; then
6118 case :$compile_shlibpath: in
6119 *":$add_shlibpath:"*) ;;
6120 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
6121 esac
6123 if test "$linkmode" = prog; then
6124 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6125 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6126 else
6127 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6128 test -n "$add" && deplibs="$add $deplibs"
6129 if test "$hardcode_direct" != yes &&
6130 test "$hardcode_minus_L" != yes &&
6131 test "$hardcode_shlibpath_var" = yes; then
6132 case :$finalize_shlibpath: in
6133 *":$libdir:"*) ;;
6134 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6135 esac
6140 if test "$linkmode" = prog || test "$mode" = relink; then
6141 add_shlibpath=
6142 add_dir=
6143 add=
6144 # Finalize command for both is simple: just hardcode it.
6145 if test "$hardcode_direct" = yes &&
6146 test "$hardcode_direct_absolute" = no; then
6147 add="$libdir/$linklib"
6148 elif test "$hardcode_minus_L" = yes; then
6149 add_dir="-L$libdir"
6150 add="-l$name"
6151 elif test "$hardcode_shlibpath_var" = yes; then
6152 case :$finalize_shlibpath: in
6153 *":$libdir:"*) ;;
6154 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6155 esac
6156 add="-l$name"
6157 elif test "$hardcode_automatic" = yes; then
6158 if test -n "$inst_prefix_dir" &&
6159 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6160 add="$inst_prefix_dir$libdir/$linklib"
6161 else
6162 add="$libdir/$linklib"
6164 else
6165 # We cannot seem to hardcode it, guess we'll fake it.
6166 add_dir="-L$libdir"
6167 # Try looking first in the location we're being installed to.
6168 if test -n "$inst_prefix_dir"; then
6169 case $libdir in
6170 [\\/]*)
6171 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6173 esac
6175 add="-l$name"
6178 if test "$linkmode" = prog; then
6179 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6180 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6181 else
6182 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6183 test -n "$add" && deplibs="$add $deplibs"
6186 elif test "$linkmode" = prog; then
6187 # Here we assume that one of hardcode_direct or hardcode_minus_L
6188 # is not unsupported. This is valid on all known static and
6189 # shared platforms.
6190 if test "$hardcode_direct" != unsupported; then
6191 test -n "$old_library" && linklib="$old_library"
6192 compile_deplibs="$dir/$linklib $compile_deplibs"
6193 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6194 else
6195 compile_deplibs="-l$name -L$dir $compile_deplibs"
6196 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6198 elif test "$build_libtool_libs" = yes; then
6199 # Not a shared library
6200 if test "$deplibs_check_method" != pass_all; then
6201 # We're trying link a shared library against a static one
6202 # but the system doesn't support it.
6204 # Just print a warning and add the library to dependency_libs so
6205 # that the program can be linked against the static library.
6206 echo
6207 $ECHO "*** Warning: This system can not link to static lib archive $lib."
6208 echo "*** I have the capability to make that library automatically link in when"
6209 echo "*** you link to this library. But I can only do this if you have a"
6210 echo "*** shared version of the library, which you do not appear to have."
6211 if test "$module" = yes; then
6212 echo "*** But as you try to build a module library, libtool will still create "
6213 echo "*** a static module, that should work as long as the dlopening application"
6214 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6215 if test -z "$global_symbol_pipe"; then
6216 echo
6217 echo "*** However, this would only work if libtool was able to extract symbol"
6218 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6219 echo "*** not find such a program. So, this module is probably useless."
6220 echo "*** \`nm' from GNU binutils and a full rebuild may help."
6222 if test "$build_old_libs" = no; then
6223 build_libtool_libs=module
6224 build_old_libs=yes
6225 else
6226 build_libtool_libs=no
6229 else
6230 deplibs="$dir/$old_library $deplibs"
6231 link_static=yes
6233 fi # link shared/static library?
6235 if test "$linkmode" = lib; then
6236 if test -n "$dependency_libs" &&
6237 { test "$hardcode_into_libs" != yes ||
6238 test "$build_old_libs" = yes ||
6239 test "$link_static" = yes; }; then
6240 # Extract -R from dependency_libs
6241 temp_deplibs=
6242 for libdir in $dependency_libs; do
6243 case $libdir in
6244 -R*) func_stripname '-R' '' "$libdir"
6245 temp_xrpath=$func_stripname_result
6246 case " $xrpath " in
6247 *" $temp_xrpath "*) ;;
6248 *) xrpath="$xrpath $temp_xrpath";;
6249 esac;;
6250 *) temp_deplibs="$temp_deplibs $libdir";;
6251 esac
6252 done
6253 dependency_libs="$temp_deplibs"
6256 newlib_search_path="$newlib_search_path $absdir"
6257 # Link against this library
6258 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6259 # ... and its dependency_libs
6260 tmp_libs=
6261 for deplib in $dependency_libs; do
6262 newdependency_libs="$deplib $newdependency_libs"
6263 if $opt_duplicate_deps ; then
6264 case "$tmp_libs " in
6265 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6266 esac
6268 tmp_libs="$tmp_libs $deplib"
6269 done
6271 if test "$link_all_deplibs" != no; then
6272 # Add the search paths of all dependency libraries
6273 for deplib in $dependency_libs; do
6274 path=
6275 case $deplib in
6276 -L*) path="$deplib" ;;
6277 *.la)
6278 func_dirname "$deplib" "" "."
6279 dir="$func_dirname_result"
6280 # We need an absolute path.
6281 case $dir in
6282 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
6284 absdir=`cd "$dir" && pwd`
6285 if test -z "$absdir"; then
6286 func_warning "cannot determine absolute directory name of \`$dir'"
6287 absdir="$dir"
6290 esac
6291 if $GREP "^installed=no" $deplib > /dev/null; then
6292 case $host in
6293 *-*-darwin*)
6294 depdepl=
6295 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
6296 if test -n "$deplibrary_names" ; then
6297 for tmp in $deplibrary_names ; do
6298 depdepl=$tmp
6299 done
6300 if test -f "$absdir/$objdir/$depdepl" ; then
6301 depdepl="$absdir/$objdir/$depdepl"
6302 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6303 if test -z "$darwin_install_name"; then
6304 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6306 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
6307 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
6308 path=
6313 path="-L$absdir/$objdir"
6315 esac
6316 else
6317 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6318 test -z "$libdir" && \
6319 func_fatal_error "\`$deplib' is not a valid libtool archive"
6320 test "$absdir" != "$libdir" && \
6321 func_warning "\`$deplib' seems to be moved"
6323 path="-L$absdir"
6326 esac
6327 case " $deplibs " in
6328 *" $path "*) ;;
6329 *) deplibs="$path $deplibs" ;;
6330 esac
6331 done
6332 fi # link_all_deplibs != no
6333 fi # linkmode = lib
6334 done # for deplib in $libs
6335 if test "$pass" = link; then
6336 if test "$linkmode" = "prog"; then
6337 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
6338 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
6339 else
6340 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6343 dependency_libs="$newdependency_libs"
6344 if test "$pass" = dlpreopen; then
6345 # Link the dlpreopened libraries before other libraries
6346 for deplib in $save_deplibs; do
6347 deplibs="$deplib $deplibs"
6348 done
6350 if test "$pass" != dlopen; then
6351 if test "$pass" != conv; then
6352 # Make sure lib_search_path contains only unique directories.
6353 lib_search_path=
6354 for dir in $newlib_search_path; do
6355 case "$lib_search_path " in
6356 *" $dir "*) ;;
6357 *) lib_search_path="$lib_search_path $dir" ;;
6358 esac
6359 done
6360 newlib_search_path=
6363 if test "$linkmode,$pass" != "prog,link"; then
6364 vars="deplibs"
6365 else
6366 vars="compile_deplibs finalize_deplibs"
6368 for var in $vars dependency_libs; do
6369 # Add libraries to $var in reverse order
6370 eval tmp_libs=\"\$$var\"
6371 new_libs=
6372 for deplib in $tmp_libs; do
6373 # FIXME: Pedantically, this is the right thing to do, so
6374 # that some nasty dependency loop isn't accidentally
6375 # broken:
6376 #new_libs="$deplib $new_libs"
6377 # Pragmatically, this seems to cause very few problems in
6378 # practice:
6379 case $deplib in
6380 -L*) new_libs="$deplib $new_libs" ;;
6381 -R*) ;;
6383 # And here is the reason: when a library appears more
6384 # than once as an explicit dependence of a library, or
6385 # is implicitly linked in more than once by the
6386 # compiler, it is considered special, and multiple
6387 # occurrences thereof are not removed. Compare this
6388 # with having the same library being listed as a
6389 # dependency of multiple other libraries: in this case,
6390 # we know (pedantically, we assume) the library does not
6391 # need to be listed more than once, so we keep only the
6392 # last copy. This is not always right, but it is rare
6393 # enough that we require users that really mean to play
6394 # such unportable linking tricks to link the library
6395 # using -Wl,-lname, so that libtool does not consider it
6396 # for duplicate removal.
6397 case " $specialdeplibs " in
6398 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6400 case " $new_libs " in
6401 *" $deplib "*) ;;
6402 *) new_libs="$deplib $new_libs" ;;
6403 esac
6405 esac
6407 esac
6408 done
6409 tmp_libs=
6410 for deplib in $new_libs; do
6411 case $deplib in
6412 -L*)
6413 case " $tmp_libs " in
6414 *" $deplib "*) ;;
6415 *) tmp_libs="$tmp_libs $deplib" ;;
6416 esac
6418 *) tmp_libs="$tmp_libs $deplib" ;;
6419 esac
6420 done
6421 eval $var=\"$tmp_libs\"
6422 done # for var
6424 # Last step: remove runtime libs from dependency_libs
6425 # (they stay in deplibs)
6426 tmp_libs=
6427 for i in $dependency_libs ; do
6428 case " $predeps $postdeps $compiler_lib_search_path " in
6429 *" $i "*)
6430 i=""
6432 esac
6433 if test -n "$i" ; then
6434 tmp_libs="$tmp_libs $i"
6436 done
6437 dependency_libs=$tmp_libs
6438 done # for pass
6439 if test "$linkmode" = prog; then
6440 dlfiles="$newdlfiles"
6442 if test "$linkmode" = prog || test "$linkmode" = lib; then
6443 dlprefiles="$newdlprefiles"
6446 case $linkmode in
6447 oldlib)
6448 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6449 func_warning "\`-dlopen' is ignored for archives"
6452 case " $deplibs" in
6453 *\ -l* | *\ -L*)
6454 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6455 esac
6457 test -n "$rpath" && \
6458 func_warning "\`-rpath' is ignored for archives"
6460 test -n "$xrpath" && \
6461 func_warning "\`-R' is ignored for archives"
6463 test -n "$vinfo" && \
6464 func_warning "\`-version-info/-version-number' is ignored for archives"
6466 test -n "$release" && \
6467 func_warning "\`-release' is ignored for archives"
6469 test -n "$export_symbols$export_symbols_regex" && \
6470 func_warning "\`-export-symbols' is ignored for archives"
6472 # Now set the variables for building old libraries.
6473 build_libtool_libs=no
6474 oldlibs="$output"
6475 objs="$objs$old_deplibs"
6478 lib)
6479 # Make sure we only generate libraries of the form `libNAME.la'.
6480 case $outputname in
6481 lib*)
6482 func_stripname 'lib' '.la' "$outputname"
6483 name=$func_stripname_result
6484 eval shared_ext=\"$shrext_cmds\"
6485 eval libname=\"$libname_spec\"
6488 test "$module" = no && \
6489 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6491 if test "$need_lib_prefix" != no; then
6492 # Add the "lib" prefix for modules if required
6493 func_stripname '' '.la' "$outputname"
6494 name=$func_stripname_result
6495 eval shared_ext=\"$shrext_cmds\"
6496 eval libname=\"$libname_spec\"
6497 else
6498 func_stripname '' '.la' "$outputname"
6499 libname=$func_stripname_result
6502 esac
6504 if test -n "$objs"; then
6505 if test "$deplibs_check_method" != pass_all; then
6506 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6507 else
6508 echo
6509 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6510 $ECHO "*** objects $objs is not portable!"
6511 libobjs="$libobjs $objs"
6515 test "$dlself" != no && \
6516 func_warning "\`-dlopen self' is ignored for libtool libraries"
6518 set dummy $rpath
6519 shift
6520 test "$#" -gt 1 && \
6521 func_warning "ignoring multiple \`-rpath's for a libtool library"
6523 install_libdir="$1"
6525 oldlibs=
6526 if test -z "$rpath"; then
6527 if test "$build_libtool_libs" = yes; then
6528 # Building a libtool convenience library.
6529 # Some compilers have problems with a `.al' extension so
6530 # convenience libraries should have the same extension an
6531 # archive normally would.
6532 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6533 build_libtool_libs=convenience
6534 build_old_libs=yes
6537 test -n "$vinfo" && \
6538 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6540 test -n "$release" && \
6541 func_warning "\`-release' is ignored for convenience libraries"
6542 else
6544 # Parse the version information argument.
6545 save_ifs="$IFS"; IFS=':'
6546 set dummy $vinfo 0 0 0
6547 shift
6548 IFS="$save_ifs"
6550 test -n "$7" && \
6551 func_fatal_help "too many parameters to \`-version-info'"
6553 # convert absolute version numbers to libtool ages
6554 # this retains compatibility with .la files and attempts
6555 # to make the code below a bit more comprehensible
6557 case $vinfo_number in
6558 yes)
6559 number_major="$1"
6560 number_minor="$2"
6561 number_revision="$3"
6563 # There are really only two kinds -- those that
6564 # use the current revision as the major version
6565 # and those that subtract age and use age as
6566 # a minor version. But, then there is irix
6567 # which has an extra 1 added just for fun
6569 case $version_type in
6570 darwin|linux|osf|windows|none)
6571 func_arith $number_major + $number_minor
6572 current=$func_arith_result
6573 age="$number_minor"
6574 revision="$number_revision"
6576 freebsd-aout|freebsd-elf|qnx|sunos)
6577 current="$number_major"
6578 revision="$number_minor"
6579 age="0"
6581 irix|nonstopux)
6582 func_arith $number_major + $number_minor
6583 current=$func_arith_result
6584 age="$number_minor"
6585 revision="$number_minor"
6586 lt_irix_increment=no
6588 esac
6591 current="$1"
6592 revision="$2"
6593 age="$3"
6595 esac
6597 # Check that each of the things are valid numbers.
6598 case $current in
6599 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]) ;;
6601 func_error "CURRENT \`$current' must be a nonnegative integer"
6602 func_fatal_error "\`$vinfo' is not valid version information"
6604 esac
6606 case $revision in
6607 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]) ;;
6609 func_error "REVISION \`$revision' must be a nonnegative integer"
6610 func_fatal_error "\`$vinfo' is not valid version information"
6612 esac
6614 case $age in
6615 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]) ;;
6617 func_error "AGE \`$age' must be a nonnegative integer"
6618 func_fatal_error "\`$vinfo' is not valid version information"
6620 esac
6622 if test "$age" -gt "$current"; then
6623 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6624 func_fatal_error "\`$vinfo' is not valid version information"
6627 # Calculate the version variables.
6628 major=
6629 versuffix=
6630 verstring=
6631 case $version_type in
6632 none) ;;
6634 darwin)
6635 # Like Linux, but with the current version available in
6636 # verstring for coding it into the library header
6637 func_arith $current - $age
6638 major=.$func_arith_result
6639 versuffix="$major.$age.$revision"
6640 # Darwin ld doesn't like 0 for these options...
6641 func_arith $current + 1
6642 minor_current=$func_arith_result
6643 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6644 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6647 freebsd-aout)
6648 major=".$current"
6649 versuffix=".$current.$revision";
6652 freebsd-elf)
6653 major=".$current"
6654 versuffix=".$current"
6657 irix | nonstopux)
6658 if test "X$lt_irix_increment" = "Xno"; then
6659 func_arith $current - $age
6660 else
6661 func_arith $current - $age + 1
6663 major=$func_arith_result
6665 case $version_type in
6666 nonstopux) verstring_prefix=nonstopux ;;
6667 *) verstring_prefix=sgi ;;
6668 esac
6669 verstring="$verstring_prefix$major.$revision"
6671 # Add in all the interfaces that we are compatible with.
6672 loop=$revision
6673 while test "$loop" -ne 0; do
6674 func_arith $revision - $loop
6675 iface=$func_arith_result
6676 func_arith $loop - 1
6677 loop=$func_arith_result
6678 verstring="$verstring_prefix$major.$iface:$verstring"
6679 done
6681 # Before this point, $major must not contain `.'.
6682 major=.$major
6683 versuffix="$major.$revision"
6686 linux)
6687 func_arith $current - $age
6688 major=.$func_arith_result
6689 versuffix="$major.$age.$revision"
6692 osf)
6693 func_arith $current - $age
6694 major=.$func_arith_result
6695 versuffix=".$current.$age.$revision"
6696 verstring="$current.$age.$revision"
6698 # Add in all the interfaces that we are compatible with.
6699 loop=$age
6700 while test "$loop" -ne 0; do
6701 func_arith $current - $loop
6702 iface=$func_arith_result
6703 func_arith $loop - 1
6704 loop=$func_arith_result
6705 verstring="$verstring:${iface}.0"
6706 done
6708 # Make executables depend on our current version.
6709 verstring="$verstring:${current}.0"
6712 qnx)
6713 major=".$current"
6714 versuffix=".$current"
6717 sunos)
6718 major=".$current"
6719 versuffix=".$current.$revision"
6722 windows)
6723 # Use '-' rather than '.', since we only want one
6724 # extension on DOS 8.3 filesystems.
6725 func_arith $current - $age
6726 major=$func_arith_result
6727 versuffix="-$major"
6731 func_fatal_configuration "unknown library version type \`$version_type'"
6733 esac
6735 # Clear the version info if we defaulted, and they specified a release.
6736 if test -z "$vinfo" && test -n "$release"; then
6737 major=
6738 case $version_type in
6739 darwin)
6740 # we can't check for "0.0" in archive_cmds due to quoting
6741 # problems, so we reset it completely
6742 verstring=
6745 verstring="0.0"
6747 esac
6748 if test "$need_version" = no; then
6749 versuffix=
6750 else
6751 versuffix=".0.0"
6755 # Remove version info from name if versioning should be avoided
6756 if test "$avoid_version" = yes && test "$need_version" = no; then
6757 major=
6758 versuffix=
6759 verstring=""
6762 # Check to see if the archive will have undefined symbols.
6763 if test "$allow_undefined" = yes; then
6764 if test "$allow_undefined_flag" = unsupported; then
6765 func_warning "undefined symbols not allowed in $host shared libraries"
6766 build_libtool_libs=no
6767 build_old_libs=yes
6769 else
6770 # Don't allow undefined symbols.
6771 allow_undefined_flag="$no_undefined_flag"
6776 func_generate_dlsyms "$libname" "$libname" "yes"
6777 libobjs="$libobjs $symfileobj"
6778 test "X$libobjs" = "X " && libobjs=
6780 if test "$mode" != relink; then
6781 # Remove our outputs, but don't remove object files since they
6782 # may have been created when compiling PIC objects.
6783 removelist=
6784 tempremovelist=`$ECHO "$output_objdir/*"`
6785 for p in $tempremovelist; do
6786 case $p in
6787 *.$objext | *.gcno)
6789 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
6790 if test "X$precious_files_regex" != "X"; then
6791 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6792 then
6793 continue
6796 removelist="$removelist $p"
6798 *) ;;
6799 esac
6800 done
6801 test -n "$removelist" && \
6802 func_show_eval "${RM}r \$removelist"
6805 # Now set the variables for building old libraries.
6806 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
6807 oldlibs="$oldlibs $output_objdir/$libname.$libext"
6809 # Transform .lo files to .o files.
6810 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
6813 # Eliminate all temporary directories.
6814 #for path in $notinst_path; do
6815 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
6816 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
6817 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
6818 #done
6820 if test -n "$xrpath"; then
6821 # If the user specified any rpath flags, then add them.
6822 temp_xrpath=
6823 for libdir in $xrpath; do
6824 temp_xrpath="$temp_xrpath -R$libdir"
6825 case "$finalize_rpath " in
6826 *" $libdir "*) ;;
6827 *) finalize_rpath="$finalize_rpath $libdir" ;;
6828 esac
6829 done
6830 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
6831 dependency_libs="$temp_xrpath $dependency_libs"
6835 # Make sure dlfiles contains only unique files that won't be dlpreopened
6836 old_dlfiles="$dlfiles"
6837 dlfiles=
6838 for lib in $old_dlfiles; do
6839 case " $dlprefiles $dlfiles " in
6840 *" $lib "*) ;;
6841 *) dlfiles="$dlfiles $lib" ;;
6842 esac
6843 done
6845 # Make sure dlprefiles contains only unique files
6846 old_dlprefiles="$dlprefiles"
6847 dlprefiles=
6848 for lib in $old_dlprefiles; do
6849 case "$dlprefiles " in
6850 *" $lib "*) ;;
6851 *) dlprefiles="$dlprefiles $lib" ;;
6852 esac
6853 done
6855 if test "$build_libtool_libs" = yes; then
6856 if test -n "$rpath"; then
6857 case $host in
6858 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
6859 # these systems don't actually have a c library (as such)!
6861 *-*-rhapsody* | *-*-darwin1.[012])
6862 # Rhapsody C library is in the System framework
6863 deplibs="$deplibs System.ltframework"
6865 *-*-netbsd*)
6866 # Don't link with libc until the a.out ld.so is fixed.
6868 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6869 # Do not include libc due to us having libc/libc_r.
6871 *-*-sco3.2v5* | *-*-sco5v6*)
6872 # Causes problems with __ctype
6874 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6875 # Compiler inserts libc in the correct place for threads to work
6878 # Add libc to deplibs on all other systems if necessary.
6879 if test "$build_libtool_need_lc" = "yes"; then
6880 deplibs="$deplibs -lc"
6883 esac
6886 # Transform deplibs into only deplibs that can be linked in shared.
6887 name_save=$name
6888 libname_save=$libname
6889 release_save=$release
6890 versuffix_save=$versuffix
6891 major_save=$major
6892 # I'm not sure if I'm treating the release correctly. I think
6893 # release should show up in the -l (ie -lgmp5) so we don't want to
6894 # add it in twice. Is that correct?
6895 release=""
6896 versuffix=""
6897 major=""
6898 newdeplibs=
6899 droppeddeps=no
6900 case $deplibs_check_method in
6901 pass_all)
6902 # Don't check for shared/static. Everything works.
6903 # This might be a little naive. We might want to check
6904 # whether the library exists or not. But this is on
6905 # osf3 & osf4 and I'm not really sure... Just
6906 # implementing what was already the behavior.
6907 newdeplibs=$deplibs
6909 test_compile)
6910 # This code stresses the "libraries are programs" paradigm to its
6911 # limits. Maybe even breaks it. We compile a program, linking it
6912 # against the deplibs as a proxy for the library. Then we can check
6913 # whether they linked in statically or dynamically with ldd.
6914 $opt_dry_run || $RM conftest.c
6915 cat > conftest.c <<EOF
6916 int main() { return 0; }
6918 $opt_dry_run || $RM conftest
6919 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
6920 ldd_output=`ldd conftest`
6921 for i in $deplibs; do
6922 case $i in
6923 -l*)
6924 func_stripname -l '' "$i"
6925 name=$func_stripname_result
6926 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6927 case " $predeps $postdeps " in
6928 *" $i "*)
6929 newdeplibs="$newdeplibs $i"
6930 i=""
6932 esac
6934 if test -n "$i" ; then
6935 libname=`eval "\\$ECHO \"$libname_spec\""`
6936 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6937 set dummy $deplib_matches; shift
6938 deplib_match=$1
6939 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6940 newdeplibs="$newdeplibs $i"
6941 else
6942 droppeddeps=yes
6943 echo
6944 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6945 echo "*** I have the capability to make that library automatically link in when"
6946 echo "*** you link to this library. But I can only do this if you have a"
6947 echo "*** shared version of the library, which I believe you do not have"
6948 echo "*** because a test_compile did reveal that the linker did not use it for"
6949 echo "*** its dynamic dependency list that programs get resolved with at runtime."
6954 newdeplibs="$newdeplibs $i"
6956 esac
6957 done
6958 else
6959 # Error occurred in the first compile. Let's try to salvage
6960 # the situation: Compile a separate program for each library.
6961 for i in $deplibs; do
6962 case $i in
6963 -l*)
6964 func_stripname -l '' "$i"
6965 name=$func_stripname_result
6966 $opt_dry_run || $RM conftest
6967 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
6968 ldd_output=`ldd conftest`
6969 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6970 case " $predeps $postdeps " in
6971 *" $i "*)
6972 newdeplibs="$newdeplibs $i"
6973 i=""
6975 esac
6977 if test -n "$i" ; then
6978 libname=`eval "\\$ECHO \"$libname_spec\""`
6979 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6980 set dummy $deplib_matches; shift
6981 deplib_match=$1
6982 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6983 newdeplibs="$newdeplibs $i"
6984 else
6985 droppeddeps=yes
6986 echo
6987 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6988 echo "*** I have the capability to make that library automatically link in when"
6989 echo "*** you link to this library. But I can only do this if you have a"
6990 echo "*** shared version of the library, which you do not appear to have"
6991 echo "*** because a test_compile did reveal that the linker did not use this one"
6992 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
6995 else
6996 droppeddeps=yes
6997 echo
6998 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
6999 echo "*** make it link in! You will probably need to install it or some"
7000 echo "*** library that it depends on before this library will be fully"
7001 echo "*** functional. Installing it before continuing would be even better."
7005 newdeplibs="$newdeplibs $i"
7007 esac
7008 done
7011 file_magic*)
7012 set dummy $deplibs_check_method; shift
7013 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7014 for a_deplib in $deplibs; do
7015 case $a_deplib in
7016 -l*)
7017 func_stripname -l '' "$a_deplib"
7018 name=$func_stripname_result
7019 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7020 case " $predeps $postdeps " in
7021 *" $a_deplib "*)
7022 newdeplibs="$newdeplibs $a_deplib"
7023 a_deplib=""
7025 esac
7027 if test -n "$a_deplib" ; then
7028 libname=`eval "\\$ECHO \"$libname_spec\""`
7029 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7030 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7031 for potent_lib in $potential_libs; do
7032 # Follow soft links.
7033 if ls -lLd "$potent_lib" 2>/dev/null |
7034 $GREP " -> " >/dev/null; then
7035 continue
7037 # The statement above tries to avoid entering an
7038 # endless loop below, in case of cyclic links.
7039 # We might still enter an endless loop, since a link
7040 # loop can be closed while we follow links,
7041 # but so what?
7042 potlib="$potent_lib"
7043 while test -h "$potlib" 2>/dev/null; do
7044 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7045 case $potliblink in
7046 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7047 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7048 esac
7049 done
7050 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7051 $SED -e 10q |
7052 $EGREP "$file_magic_regex" > /dev/null; then
7053 newdeplibs="$newdeplibs $a_deplib"
7054 a_deplib=""
7055 break 2
7057 done
7058 done
7060 if test -n "$a_deplib" ; then
7061 droppeddeps=yes
7062 echo
7063 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7064 echo "*** I have the capability to make that library automatically link in when"
7065 echo "*** you link to this library. But I can only do this if you have a"
7066 echo "*** shared version of the library, which you do not appear to have"
7067 echo "*** because I did check the linker path looking for a file starting"
7068 if test -z "$potlib" ; then
7069 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7070 else
7071 $ECHO "*** with $libname and none of the candidates passed a file format test"
7072 $ECHO "*** using a file magic. Last file checked: $potlib"
7077 # Add a -L argument.
7078 newdeplibs="$newdeplibs $a_deplib"
7080 esac
7081 done # Gone through all deplibs.
7083 match_pattern*)
7084 set dummy $deplibs_check_method; shift
7085 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7086 for a_deplib in $deplibs; do
7087 case $a_deplib in
7088 -l*)
7089 func_stripname -l '' "$a_deplib"
7090 name=$func_stripname_result
7091 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7092 case " $predeps $postdeps " in
7093 *" $a_deplib "*)
7094 newdeplibs="$newdeplibs $a_deplib"
7095 a_deplib=""
7097 esac
7099 if test -n "$a_deplib" ; then
7100 libname=`eval "\\$ECHO \"$libname_spec\""`
7101 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7102 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7103 for potent_lib in $potential_libs; do
7104 potlib="$potent_lib" # see symlink-check above in file_magic test
7105 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7106 $EGREP "$match_pattern_regex" > /dev/null; then
7107 newdeplibs="$newdeplibs $a_deplib"
7108 a_deplib=""
7109 break 2
7111 done
7112 done
7114 if test -n "$a_deplib" ; then
7115 droppeddeps=yes
7116 echo
7117 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7118 echo "*** I have the capability to make that library automatically link in when"
7119 echo "*** you link to this library. But I can only do this if you have a"
7120 echo "*** shared version of the library, which you do not appear to have"
7121 echo "*** because I did check the linker path looking for a file starting"
7122 if test -z "$potlib" ; then
7123 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7124 else
7125 $ECHO "*** with $libname and none of the candidates passed a file format test"
7126 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7131 # Add a -L argument.
7132 newdeplibs="$newdeplibs $a_deplib"
7134 esac
7135 done # Gone through all deplibs.
7137 none | unknown | *)
7138 newdeplibs=""
7139 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7140 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7141 for i in $predeps $postdeps ; do
7142 # can't use Xsed below, because $i might contain '/'
7143 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7144 done
7146 case $tmp_deplibs in
7147 *[!\ \ ]*)
7148 echo
7149 if test "X$deplibs_check_method" = "Xnone"; then
7150 echo "*** Warning: inter-library dependencies are not supported in this platform."
7151 else
7152 echo "*** Warning: inter-library dependencies are not known to be supported."
7154 echo "*** All declared inter-library dependencies are being dropped."
7155 droppeddeps=yes
7157 esac
7159 esac
7160 versuffix=$versuffix_save
7161 major=$major_save
7162 release=$release_save
7163 libname=$libname_save
7164 name=$name_save
7166 case $host in
7167 *-*-rhapsody* | *-*-darwin1.[012])
7168 # On Rhapsody replace the C library with the System framework
7169 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7171 esac
7173 if test "$droppeddeps" = yes; then
7174 if test "$module" = yes; then
7175 echo
7176 echo "*** Warning: libtool could not satisfy all declared inter-library"
7177 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7178 echo "*** a static module, that should work as long as the dlopening"
7179 echo "*** application is linked with the -dlopen flag."
7180 if test -z "$global_symbol_pipe"; then
7181 echo
7182 echo "*** However, this would only work if libtool was able to extract symbol"
7183 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7184 echo "*** not find such a program. So, this module is probably useless."
7185 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7187 if test "$build_old_libs" = no; then
7188 oldlibs="$output_objdir/$libname.$libext"
7189 build_libtool_libs=module
7190 build_old_libs=yes
7191 else
7192 build_libtool_libs=no
7194 else
7195 echo "*** The inter-library dependencies that have been dropped here will be"
7196 echo "*** automatically added whenever a program is linked with this library"
7197 echo "*** or is declared to -dlopen it."
7199 if test "$allow_undefined" = no; then
7200 echo
7201 echo "*** Since this library must not contain undefined symbols,"
7202 echo "*** because either the platform does not support them or"
7203 echo "*** it was explicitly requested with -no-undefined,"
7204 echo "*** libtool will only create a static version of it."
7205 if test "$build_old_libs" = no; then
7206 oldlibs="$output_objdir/$libname.$libext"
7207 build_libtool_libs=module
7208 build_old_libs=yes
7209 else
7210 build_libtool_libs=no
7215 # Done checking deplibs!
7216 deplibs=$newdeplibs
7218 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7219 case $host in
7220 *-*-darwin*)
7221 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7222 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7223 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7225 esac
7227 # move library search paths that coincide with paths to not yet
7228 # installed libraries to the beginning of the library search list
7229 new_libs=
7230 for path in $notinst_path; do
7231 case " $new_libs " in
7232 *" -L$path/$objdir "*) ;;
7234 case " $deplibs " in
7235 *" -L$path/$objdir "*)
7236 new_libs="$new_libs -L$path/$objdir" ;;
7237 esac
7239 esac
7240 done
7241 for deplib in $deplibs; do
7242 case $deplib in
7243 -L*)
7244 case " $new_libs " in
7245 *" $deplib "*) ;;
7246 *) new_libs="$new_libs $deplib" ;;
7247 esac
7249 *) new_libs="$new_libs $deplib" ;;
7250 esac
7251 done
7252 deplibs="$new_libs"
7254 # All the library-specific variables (install_libdir is set above).
7255 library_names=
7256 old_library=
7257 dlname=
7259 # Test again, we may have decided not to build it any more
7260 if test "$build_libtool_libs" = yes; then
7261 if test "$hardcode_into_libs" = yes; then
7262 # Hardcode the library paths
7263 hardcode_libdirs=
7264 dep_rpath=
7265 rpath="$finalize_rpath"
7266 test "$mode" != relink && rpath="$compile_rpath$rpath"
7267 for libdir in $rpath; do
7268 if test -n "$hardcode_libdir_flag_spec"; then
7269 if test -n "$hardcode_libdir_separator"; then
7270 if test -z "$hardcode_libdirs"; then
7271 hardcode_libdirs="$libdir"
7272 else
7273 # Just accumulate the unique libdirs.
7274 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7275 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7278 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7280 esac
7282 else
7283 eval flag=\"$hardcode_libdir_flag_spec\"
7284 dep_rpath="$dep_rpath $flag"
7286 elif test -n "$runpath_var"; then
7287 case "$perm_rpath " in
7288 *" $libdir "*) ;;
7289 *) perm_rpath="$perm_rpath $libdir" ;;
7290 esac
7292 done
7293 # Substitute the hardcoded libdirs into the rpath.
7294 if test -n "$hardcode_libdir_separator" &&
7295 test -n "$hardcode_libdirs"; then
7296 libdir="$hardcode_libdirs"
7297 if test -n "$hardcode_libdir_flag_spec_ld"; then
7298 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
7299 else
7300 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
7303 if test -n "$runpath_var" && test -n "$perm_rpath"; then
7304 # We should set the runpath_var.
7305 rpath=
7306 for dir in $perm_rpath; do
7307 rpath="$rpath$dir:"
7308 done
7309 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
7311 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
7314 shlibpath="$finalize_shlibpath"
7315 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
7316 if test -n "$shlibpath"; then
7317 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
7320 # Get the real and link names of the library.
7321 eval shared_ext=\"$shrext_cmds\"
7322 eval library_names=\"$library_names_spec\"
7323 set dummy $library_names
7324 shift
7325 realname="$1"
7326 shift
7328 if test -n "$soname_spec"; then
7329 eval soname=\"$soname_spec\"
7330 else
7331 soname="$realname"
7333 if test -z "$dlname"; then
7334 dlname=$soname
7337 lib="$output_objdir/$realname"
7338 linknames=
7339 for link
7341 linknames="$linknames $link"
7342 done
7344 # Use standard objects if they are pic
7345 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
7346 test "X$libobjs" = "X " && libobjs=
7348 delfiles=
7349 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7350 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
7351 export_symbols="$output_objdir/$libname.uexp"
7352 delfiles="$delfiles $export_symbols"
7355 orig_export_symbols=
7356 case $host_os in
7357 cygwin* | mingw* | cegcc*)
7358 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
7359 # exporting using user supplied symfile
7360 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
7361 # and it's NOT already a .def file. Must figure out
7362 # which of the given symbols are data symbols and tag
7363 # them as such. So, trigger use of export_symbols_cmds.
7364 # export_symbols gets reassigned inside the "prepare
7365 # the list of exported symbols" if statement, so the
7366 # include_expsyms logic still works.
7367 orig_export_symbols="$export_symbols"
7368 export_symbols=
7369 always_export_symbols=yes
7373 esac
7375 # Prepare the list of exported symbols
7376 if test -z "$export_symbols"; then
7377 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7378 func_verbose "generating symbol list for \`$libname.la'"
7379 export_symbols="$output_objdir/$libname.exp"
7380 $opt_dry_run || $RM $export_symbols
7381 cmds=$export_symbols_cmds
7382 save_ifs="$IFS"; IFS='~'
7383 for cmd in $cmds; do
7384 IFS="$save_ifs"
7385 eval cmd=\"$cmd\"
7386 func_len " $cmd"
7387 len=$func_len_result
7388 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7389 func_show_eval "$cmd" 'exit $?'
7390 skipped_export=false
7391 else
7392 # The command line is too long to execute in one step.
7393 func_verbose "using reloadable object file for export list..."
7394 skipped_export=:
7395 # Break out early, otherwise skipped_export may be
7396 # set to false by a later but shorter cmd.
7397 break
7399 done
7400 IFS="$save_ifs"
7401 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7402 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7403 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7408 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7409 tmp_export_symbols="$export_symbols"
7410 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7411 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
7414 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7415 # The given exports_symbols file has to be filtered, so filter it.
7416 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7417 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7418 # 's' commands which not all seds can handle. GNU sed should be fine
7419 # though. Also, the filter scales superlinearly with the number of
7420 # global variables. join(1) would be nice here, but unfortunately
7421 # isn't a blessed tool.
7422 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7423 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7424 export_symbols=$output_objdir/$libname.def
7425 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7428 tmp_deplibs=
7429 for test_deplib in $deplibs; do
7430 case " $convenience " in
7431 *" $test_deplib "*) ;;
7433 tmp_deplibs="$tmp_deplibs $test_deplib"
7435 esac
7436 done
7437 deplibs="$tmp_deplibs"
7439 if test -n "$convenience"; then
7440 if test -n "$whole_archive_flag_spec" &&
7441 test "$compiler_needs_object" = yes &&
7442 test -z "$libobjs"; then
7443 # extract the archives, so we have objects to list.
7444 # TODO: could optimize this to just extract one archive.
7445 whole_archive_flag_spec=
7447 if test -n "$whole_archive_flag_spec"; then
7448 save_libobjs=$libobjs
7449 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7450 test "X$libobjs" = "X " && libobjs=
7451 else
7452 gentop="$output_objdir/${outputname}x"
7453 generated="$generated $gentop"
7455 func_extract_archives $gentop $convenience
7456 libobjs="$libobjs $func_extract_archives_result"
7457 test "X$libobjs" = "X " && libobjs=
7461 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7462 eval flag=\"$thread_safe_flag_spec\"
7463 linker_flags="$linker_flags $flag"
7466 # Make a backup of the uninstalled library when relinking
7467 if test "$mode" = relink; then
7468 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7471 # Do each of the archive commands.
7472 if test "$module" = yes && test -n "$module_cmds" ; then
7473 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7474 eval test_cmds=\"$module_expsym_cmds\"
7475 cmds=$module_expsym_cmds
7476 else
7477 eval test_cmds=\"$module_cmds\"
7478 cmds=$module_cmds
7480 else
7481 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7482 eval test_cmds=\"$archive_expsym_cmds\"
7483 cmds=$archive_expsym_cmds
7484 else
7485 eval test_cmds=\"$archive_cmds\"
7486 cmds=$archive_cmds
7490 if test "X$skipped_export" != "X:" &&
7491 func_len " $test_cmds" &&
7492 len=$func_len_result &&
7493 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7495 else
7496 # The command line is too long to link in one step, link piecewise
7497 # or, if using GNU ld and skipped_export is not :, use a linker
7498 # script.
7500 # Save the value of $output and $libobjs because we want to
7501 # use them later. If we have whole_archive_flag_spec, we
7502 # want to use save_libobjs as it was before
7503 # whole_archive_flag_spec was expanded, because we can't
7504 # assume the linker understands whole_archive_flag_spec.
7505 # This may have to be revisited, in case too many
7506 # convenience libraries get linked in and end up exceeding
7507 # the spec.
7508 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7509 save_libobjs=$libobjs
7511 save_output=$output
7512 func_basename "$output"
7513 output_la=$func_basename_result
7515 # Clear the reloadable object creation command queue and
7516 # initialize k to one.
7517 test_cmds=
7518 concat_cmds=
7519 objlist=
7520 last_robj=
7523 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7524 output=${output_objdir}/${output_la}.lnkscript
7525 func_verbose "creating GNU ld script: $output"
7526 echo 'INPUT (' > $output
7527 for obj in $save_libobjs
7529 $ECHO "$obj" >> $output
7530 done
7531 echo ')' >> $output
7532 delfiles="$delfiles $output"
7533 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7534 output=${output_objdir}/${output_la}.lnk
7535 func_verbose "creating linker input file list: $output"
7536 : > $output
7537 set x $save_libobjs
7538 shift
7539 firstobj=
7540 if test "$compiler_needs_object" = yes; then
7541 firstobj="$1 "
7542 shift
7544 for obj
7546 $ECHO "$obj" >> $output
7547 done
7548 delfiles="$delfiles $output"
7549 output=$firstobj\"$file_list_spec$output\"
7550 else
7551 if test -n "$save_libobjs"; then
7552 func_verbose "creating reloadable object files..."
7553 output=$output_objdir/$output_la-${k}.$objext
7554 eval test_cmds=\"$reload_cmds\"
7555 func_len " $test_cmds"
7556 len0=$func_len_result
7557 len=$len0
7559 # Loop over the list of objects to be linked.
7560 for obj in $save_libobjs
7562 func_len " $obj"
7563 func_arith $len + $func_len_result
7564 len=$func_arith_result
7565 if test "X$objlist" = X ||
7566 test "$len" -lt "$max_cmd_len"; then
7567 func_append objlist " $obj"
7568 else
7569 # The command $test_cmds is almost too long, add a
7570 # command to the queue.
7571 if test "$k" -eq 1 ; then
7572 # The first file doesn't have a previous command to add.
7573 reload_objs=$objlist
7574 eval concat_cmds=\"$reload_cmds\"
7575 else
7576 # All subsequent reloadable object files will link in
7577 # the last one created.
7578 reload_objs="$objlist $last_robj"
7579 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
7581 last_robj=$output_objdir/$output_la-${k}.$objext
7582 func_arith $k + 1
7583 k=$func_arith_result
7584 output=$output_objdir/$output_la-${k}.$objext
7585 objlist=" $obj"
7586 func_len " $last_robj"
7587 func_arith $len0 + $func_len_result
7588 len=$func_arith_result
7590 done
7591 # Handle the remaining objects by creating one last
7592 # reloadable object file. All subsequent reloadable object
7593 # files will link in the last one created.
7594 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7595 reload_objs="$objlist $last_robj"
7596 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
7597 if test -n "$last_robj"; then
7598 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7600 delfiles="$delfiles $output"
7602 else
7603 output=
7606 if ${skipped_export-false}; then
7607 func_verbose "generating symbol list for \`$libname.la'"
7608 export_symbols="$output_objdir/$libname.exp"
7609 $opt_dry_run || $RM $export_symbols
7610 libobjs=$output
7611 # Append the command to create the export file.
7612 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7613 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7614 if test -n "$last_robj"; then
7615 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7619 test -n "$save_libobjs" &&
7620 func_verbose "creating a temporary reloadable object file: $output"
7622 # Loop through the commands generated above and execute them.
7623 save_ifs="$IFS"; IFS='~'
7624 for cmd in $concat_cmds; do
7625 IFS="$save_ifs"
7626 $opt_silent || {
7627 func_quote_for_expand "$cmd"
7628 eval "func_echo $func_quote_for_expand_result"
7630 $opt_dry_run || eval "$cmd" || {
7631 lt_exit=$?
7633 # Restore the uninstalled library and exit
7634 if test "$mode" = relink; then
7635 ( cd "$output_objdir" && \
7636 $RM "${realname}T" && \
7637 $MV "${realname}U" "$realname" )
7640 exit $lt_exit
7642 done
7643 IFS="$save_ifs"
7645 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7646 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7647 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7651 if ${skipped_export-false}; then
7652 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7653 tmp_export_symbols="$export_symbols"
7654 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7655 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
7658 if test -n "$orig_export_symbols"; then
7659 # The given exports_symbols file has to be filtered, so filter it.
7660 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7661 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7662 # 's' commands which not all seds can handle. GNU sed should be fine
7663 # though. Also, the filter scales superlinearly with the number of
7664 # global variables. join(1) would be nice here, but unfortunately
7665 # isn't a blessed tool.
7666 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7667 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7668 export_symbols=$output_objdir/$libname.def
7669 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7673 libobjs=$output
7674 # Restore the value of output.
7675 output=$save_output
7677 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
7678 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7679 test "X$libobjs" = "X " && libobjs=
7681 # Expand the library linking commands again to reset the
7682 # value of $libobjs for piecewise linking.
7684 # Do each of the archive commands.
7685 if test "$module" = yes && test -n "$module_cmds" ; then
7686 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7687 cmds=$module_expsym_cmds
7688 else
7689 cmds=$module_cmds
7691 else
7692 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7693 cmds=$archive_expsym_cmds
7694 else
7695 cmds=$archive_cmds
7700 if test -n "$delfiles"; then
7701 # Append the command to remove temporary files to $cmds.
7702 eval cmds=\"\$cmds~\$RM $delfiles\"
7705 # Add any objects from preloaded convenience libraries
7706 if test -n "$dlprefiles"; then
7707 gentop="$output_objdir/${outputname}x"
7708 generated="$generated $gentop"
7710 func_extract_archives $gentop $dlprefiles
7711 libobjs="$libobjs $func_extract_archives_result"
7712 test "X$libobjs" = "X " && libobjs=
7715 save_ifs="$IFS"; IFS='~'
7716 for cmd in $cmds; do
7717 IFS="$save_ifs"
7718 eval cmd=\"$cmd\"
7719 $opt_silent || {
7720 func_quote_for_expand "$cmd"
7721 eval "func_echo $func_quote_for_expand_result"
7723 $opt_dry_run || eval "$cmd" || {
7724 lt_exit=$?
7726 # Restore the uninstalled library and exit
7727 if test "$mode" = relink; then
7728 ( cd "$output_objdir" && \
7729 $RM "${realname}T" && \
7730 $MV "${realname}U" "$realname" )
7733 exit $lt_exit
7735 done
7736 IFS="$save_ifs"
7738 # Restore the uninstalled library and exit
7739 if test "$mode" = relink; then
7740 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
7742 if test -n "$convenience"; then
7743 if test -z "$whole_archive_flag_spec"; then
7744 func_show_eval '${RM}r "$gentop"'
7748 exit $EXIT_SUCCESS
7751 # Create links to the real library.
7752 for linkname in $linknames; do
7753 if test "$realname" != "$linkname"; then
7754 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
7756 done
7758 # If -module or -export-dynamic was specified, set the dlname.
7759 if test "$module" = yes || test "$export_dynamic" = yes; then
7760 # On all known operating systems, these are identical.
7761 dlname="$soname"
7766 obj)
7767 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7768 func_warning "\`-dlopen' is ignored for objects"
7771 case " $deplibs" in
7772 *\ -l* | *\ -L*)
7773 func_warning "\`-l' and \`-L' are ignored for objects" ;;
7774 esac
7776 test -n "$rpath" && \
7777 func_warning "\`-rpath' is ignored for objects"
7779 test -n "$xrpath" && \
7780 func_warning "\`-R' is ignored for objects"
7782 test -n "$vinfo" && \
7783 func_warning "\`-version-info' is ignored for objects"
7785 test -n "$release" && \
7786 func_warning "\`-release' is ignored for objects"
7788 case $output in
7789 *.lo)
7790 test -n "$objs$old_deplibs" && \
7791 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
7793 libobj=$output
7794 func_lo2o "$libobj"
7795 obj=$func_lo2o_result
7798 libobj=
7799 obj="$output"
7801 esac
7803 # Delete the old objects.
7804 $opt_dry_run || $RM $obj $libobj
7806 # Objects from convenience libraries. This assumes
7807 # single-version convenience libraries. Whenever we create
7808 # different ones for PIC/non-PIC, this we'll have to duplicate
7809 # the extraction.
7810 reload_conv_objs=
7811 gentop=
7812 # reload_cmds runs $LD directly, so let us get rid of
7813 # -Wl from whole_archive_flag_spec and hope we can get by with
7814 # turning comma into space..
7817 if test -n "$convenience"; then
7818 if test -n "$whole_archive_flag_spec"; then
7819 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
7820 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
7821 else
7822 gentop="$output_objdir/${obj}x"
7823 generated="$generated $gentop"
7825 func_extract_archives $gentop $convenience
7826 reload_conv_objs="$reload_objs $func_extract_archives_result"
7830 # Create the old-style object.
7831 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
7833 output="$obj"
7834 func_execute_cmds "$reload_cmds" 'exit $?'
7836 # Exit if we aren't doing a library object file.
7837 if test -z "$libobj"; then
7838 if test -n "$gentop"; then
7839 func_show_eval '${RM}r "$gentop"'
7842 exit $EXIT_SUCCESS
7845 if test "$build_libtool_libs" != yes; then
7846 if test -n "$gentop"; then
7847 func_show_eval '${RM}r "$gentop"'
7850 # Create an invalid libtool object if no PIC, so that we don't
7851 # accidentally link it into a program.
7852 # $show "echo timestamp > $libobj"
7853 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
7854 exit $EXIT_SUCCESS
7857 if test -n "$pic_flag" || test "$pic_mode" != default; then
7858 # Only do commands if we really have different PIC objects.
7859 reload_objs="$libobjs $reload_conv_objs"
7860 output="$libobj"
7861 func_execute_cmds "$reload_cmds" 'exit $?'
7864 if test -n "$gentop"; then
7865 func_show_eval '${RM}r "$gentop"'
7868 exit $EXIT_SUCCESS
7871 prog)
7872 case $host in
7873 *cygwin*) func_stripname '' '.exe' "$output"
7874 output=$func_stripname_result.exe;;
7875 esac
7876 test -n "$vinfo" && \
7877 func_warning "\`-version-info' is ignored for programs"
7879 test -n "$release" && \
7880 func_warning "\`-release' is ignored for programs"
7882 test "$preload" = yes \
7883 && test "$dlopen_support" = unknown \
7884 && test "$dlopen_self" = unknown \
7885 && test "$dlopen_self_static" = unknown && \
7886 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
7888 case $host in
7889 *-*-rhapsody* | *-*-darwin1.[012])
7890 # On Rhapsody replace the C library is the System framework
7891 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
7892 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
7894 esac
7896 case $host in
7897 *-*-darwin*)
7898 # Don't allow lazy linking, it breaks C++ global constructors
7899 # But is supposedly fixed on 10.4 or later (yay!).
7900 if test "$tagname" = CXX ; then
7901 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
7902 10.[0123])
7903 compile_command="$compile_command ${wl}-bind_at_load"
7904 finalize_command="$finalize_command ${wl}-bind_at_load"
7906 esac
7908 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7909 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7910 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7912 esac
7915 # move library search paths that coincide with paths to not yet
7916 # installed libraries to the beginning of the library search list
7917 new_libs=
7918 for path in $notinst_path; do
7919 case " $new_libs " in
7920 *" -L$path/$objdir "*) ;;
7922 case " $compile_deplibs " in
7923 *" -L$path/$objdir "*)
7924 new_libs="$new_libs -L$path/$objdir" ;;
7925 esac
7927 esac
7928 done
7929 for deplib in $compile_deplibs; do
7930 case $deplib in
7931 -L*)
7932 case " $new_libs " in
7933 *" $deplib "*) ;;
7934 *) new_libs="$new_libs $deplib" ;;
7935 esac
7937 *) new_libs="$new_libs $deplib" ;;
7938 esac
7939 done
7940 compile_deplibs="$new_libs"
7943 compile_command="$compile_command $compile_deplibs"
7944 finalize_command="$finalize_command $finalize_deplibs"
7946 if test -n "$rpath$xrpath"; then
7947 # If the user specified any rpath flags, then add them.
7948 for libdir in $rpath $xrpath; do
7949 # This is the magic to use -rpath.
7950 case "$finalize_rpath " in
7951 *" $libdir "*) ;;
7952 *) finalize_rpath="$finalize_rpath $libdir" ;;
7953 esac
7954 done
7957 # Now hardcode the library paths
7958 rpath=
7959 hardcode_libdirs=
7960 for libdir in $compile_rpath $finalize_rpath; do
7961 if test -n "$hardcode_libdir_flag_spec"; then
7962 if test -n "$hardcode_libdir_separator"; then
7963 if test -z "$hardcode_libdirs"; then
7964 hardcode_libdirs="$libdir"
7965 else
7966 # Just accumulate the unique libdirs.
7967 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7968 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7971 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7973 esac
7975 else
7976 eval flag=\"$hardcode_libdir_flag_spec\"
7977 rpath="$rpath $flag"
7979 elif test -n "$runpath_var"; then
7980 case "$perm_rpath " in
7981 *" $libdir "*) ;;
7982 *) perm_rpath="$perm_rpath $libdir" ;;
7983 esac
7985 case $host in
7986 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7987 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
7988 case :$dllsearchpath: in
7989 *":$libdir:"*) ;;
7990 ::) dllsearchpath=$libdir;;
7991 *) dllsearchpath="$dllsearchpath:$libdir";;
7992 esac
7993 case :$dllsearchpath: in
7994 *":$testbindir:"*) ;;
7995 ::) dllsearchpath=$testbindir;;
7996 *) dllsearchpath="$dllsearchpath:$testbindir";;
7997 esac
7999 esac
8000 done
8001 # Substitute the hardcoded libdirs into the rpath.
8002 if test -n "$hardcode_libdir_separator" &&
8003 test -n "$hardcode_libdirs"; then
8004 libdir="$hardcode_libdirs"
8005 eval rpath=\" $hardcode_libdir_flag_spec\"
8007 compile_rpath="$rpath"
8009 rpath=
8010 hardcode_libdirs=
8011 for libdir in $finalize_rpath; do
8012 if test -n "$hardcode_libdir_flag_spec"; then
8013 if test -n "$hardcode_libdir_separator"; then
8014 if test -z "$hardcode_libdirs"; then
8015 hardcode_libdirs="$libdir"
8016 else
8017 # Just accumulate the unique libdirs.
8018 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8019 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8022 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8024 esac
8026 else
8027 eval flag=\"$hardcode_libdir_flag_spec\"
8028 rpath="$rpath $flag"
8030 elif test -n "$runpath_var"; then
8031 case "$finalize_perm_rpath " in
8032 *" $libdir "*) ;;
8033 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
8034 esac
8036 done
8037 # Substitute the hardcoded libdirs into the rpath.
8038 if test -n "$hardcode_libdir_separator" &&
8039 test -n "$hardcode_libdirs"; then
8040 libdir="$hardcode_libdirs"
8041 eval rpath=\" $hardcode_libdir_flag_spec\"
8043 finalize_rpath="$rpath"
8045 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8046 # Transform all the library objects into standard objects.
8047 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8048 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8051 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8053 # template prelinking step
8054 if test -n "$prelink_cmds"; then
8055 func_execute_cmds "$prelink_cmds" 'exit $?'
8058 wrappers_required=yes
8059 case $host in
8060 *cegcc* | *mingw32ce*)
8061 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8062 wrappers_required=no
8064 *cygwin* | *mingw* )
8065 if test "$build_libtool_libs" != yes; then
8066 wrappers_required=no
8070 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8071 wrappers_required=no
8074 esac
8075 if test "$wrappers_required" = no; then
8076 # Replace the output file specification.
8077 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8078 link_command="$compile_command$compile_rpath"
8080 # We have no uninstalled library dependencies, so finalize right now.
8081 exit_status=0
8082 func_show_eval "$link_command" 'exit_status=$?'
8084 # Delete the generated files.
8085 if test -f "$output_objdir/${outputname}S.${objext}"; then
8086 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8089 exit $exit_status
8092 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8093 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8095 if test -n "$finalize_shlibpath"; then
8096 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8099 compile_var=
8100 finalize_var=
8101 if test -n "$runpath_var"; then
8102 if test -n "$perm_rpath"; then
8103 # We should set the runpath_var.
8104 rpath=
8105 for dir in $perm_rpath; do
8106 rpath="$rpath$dir:"
8107 done
8108 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8110 if test -n "$finalize_perm_rpath"; then
8111 # We should set the runpath_var.
8112 rpath=
8113 for dir in $finalize_perm_rpath; do
8114 rpath="$rpath$dir:"
8115 done
8116 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8120 if test "$no_install" = yes; then
8121 # We don't need to create a wrapper script.
8122 link_command="$compile_var$compile_command$compile_rpath"
8123 # Replace the output file specification.
8124 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8125 # Delete the old output file.
8126 $opt_dry_run || $RM $output
8127 # Link the executable and exit
8128 func_show_eval "$link_command" 'exit $?'
8129 exit $EXIT_SUCCESS
8132 if test "$hardcode_action" = relink; then
8133 # Fast installation is not supported
8134 link_command="$compile_var$compile_command$compile_rpath"
8135 relink_command="$finalize_var$finalize_command$finalize_rpath"
8137 func_warning "this platform does not like uninstalled shared libraries"
8138 func_warning "\`$output' will be relinked during installation"
8139 else
8140 if test "$fast_install" != no; then
8141 link_command="$finalize_var$compile_command$finalize_rpath"
8142 if test "$fast_install" = yes; then
8143 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8144 else
8145 # fast_install is set to needless
8146 relink_command=
8148 else
8149 link_command="$compile_var$compile_command$compile_rpath"
8150 relink_command="$finalize_var$finalize_command$finalize_rpath"
8154 # Replace the output file specification.
8155 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8157 # Delete the old output files.
8158 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8160 func_show_eval "$link_command" 'exit $?'
8162 # Now create the wrapper script.
8163 func_verbose "creating $output"
8165 # Quote the relink command for shipping.
8166 if test -n "$relink_command"; then
8167 # Preserve any variables that may affect compiler behavior
8168 for var in $variables_saved_for_relink; do
8169 if eval test -z \"\${$var+set}\"; then
8170 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8171 elif eval var_value=\$$var; test -z "$var_value"; then
8172 relink_command="$var=; export $var; $relink_command"
8173 else
8174 func_quote_for_eval "$var_value"
8175 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8177 done
8178 relink_command="(cd `pwd`; $relink_command)"
8179 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8182 # Only actually do things if not in dry run mode.
8183 $opt_dry_run || {
8184 # win32 will think the script is a binary if it has
8185 # a .exe suffix, so we strip it off here.
8186 case $output in
8187 *.exe) func_stripname '' '.exe' "$output"
8188 output=$func_stripname_result ;;
8189 esac
8190 # test for cygwin because mv fails w/o .exe extensions
8191 case $host in
8192 *cygwin*)
8193 exeext=.exe
8194 func_stripname '' '.exe' "$outputname"
8195 outputname=$func_stripname_result ;;
8196 *) exeext= ;;
8197 esac
8198 case $host in
8199 *cygwin* | *mingw* )
8200 func_dirname_and_basename "$output" "" "."
8201 output_name=$func_basename_result
8202 output_path=$func_dirname_result
8203 cwrappersource="$output_path/$objdir/lt-$output_name.c"
8204 cwrapper="$output_path/$output_name.exe"
8205 $RM $cwrappersource $cwrapper
8206 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8208 func_emit_cwrapperexe_src > $cwrappersource
8210 # The wrapper executable is built using the $host compiler,
8211 # because it contains $host paths and files. If cross-
8212 # compiling, it, like the target executable, must be
8213 # executed on the $host or under an emulation environment.
8214 $opt_dry_run || {
8215 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8216 $STRIP $cwrapper
8219 # Now, create the wrapper script for func_source use:
8220 func_ltwrapper_scriptname $cwrapper
8221 $RM $func_ltwrapper_scriptname_result
8222 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8223 $opt_dry_run || {
8224 # note: this script will not be executed, so do not chmod.
8225 if test "x$build" = "x$host" ; then
8226 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8227 else
8228 func_emit_wrapper no > $func_ltwrapper_scriptname_result
8233 $RM $output
8234 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8236 func_emit_wrapper no > $output
8237 chmod +x $output
8239 esac
8241 exit $EXIT_SUCCESS
8243 esac
8245 # See if we need to build an old-fashioned archive.
8246 for oldlib in $oldlibs; do
8248 if test "$build_libtool_libs" = convenience; then
8249 oldobjs="$libobjs_save $symfileobj"
8250 addlibs="$convenience"
8251 build_libtool_libs=no
8252 else
8253 if test "$build_libtool_libs" = module; then
8254 oldobjs="$libobjs_save"
8255 build_libtool_libs=no
8256 else
8257 oldobjs="$old_deplibs $non_pic_objects"
8258 if test "$preload" = yes && test -f "$symfileobj"; then
8259 oldobjs="$oldobjs $symfileobj"
8262 addlibs="$old_convenience"
8265 if test -n "$addlibs"; then
8266 gentop="$output_objdir/${outputname}x"
8267 generated="$generated $gentop"
8269 func_extract_archives $gentop $addlibs
8270 oldobjs="$oldobjs $func_extract_archives_result"
8273 # Do each command in the archive commands.
8274 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
8275 cmds=$old_archive_from_new_cmds
8276 else
8278 # Add any objects from preloaded convenience libraries
8279 if test -n "$dlprefiles"; then
8280 gentop="$output_objdir/${outputname}x"
8281 generated="$generated $gentop"
8283 func_extract_archives $gentop $dlprefiles
8284 oldobjs="$oldobjs $func_extract_archives_result"
8287 # POSIX demands no paths to be encoded in archives. We have
8288 # to avoid creating archives with duplicate basenames if we
8289 # might have to extract them afterwards, e.g., when creating a
8290 # static archive out of a convenience library, or when linking
8291 # the entirety of a libtool archive into another (currently
8292 # not supported by libtool).
8293 if (for obj in $oldobjs
8295 func_basename "$obj"
8296 $ECHO "$func_basename_result"
8297 done | sort | sort -uc >/dev/null 2>&1); then
8299 else
8300 echo "copying selected object files to avoid basename conflicts..."
8301 gentop="$output_objdir/${outputname}x"
8302 generated="$generated $gentop"
8303 func_mkdir_p "$gentop"
8304 save_oldobjs=$oldobjs
8305 oldobjs=
8306 counter=1
8307 for obj in $save_oldobjs
8309 func_basename "$obj"
8310 objbase="$func_basename_result"
8311 case " $oldobjs " in
8312 " ") oldobjs=$obj ;;
8313 *[\ /]"$objbase "*)
8314 while :; do
8315 # Make sure we don't pick an alternate name that also
8316 # overlaps.
8317 newobj=lt$counter-$objbase
8318 func_arith $counter + 1
8319 counter=$func_arith_result
8320 case " $oldobjs " in
8321 *[\ /]"$newobj "*) ;;
8322 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
8323 esac
8324 done
8325 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8326 oldobjs="$oldobjs $gentop/$newobj"
8328 *) oldobjs="$oldobjs $obj" ;;
8329 esac
8330 done
8332 eval cmds=\"$old_archive_cmds\"
8334 func_len " $cmds"
8335 len=$func_len_result
8336 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8337 cmds=$old_archive_cmds
8338 else
8339 # the command line is too long to link in one step, link in parts
8340 func_verbose "using piecewise archive linking..."
8341 save_RANLIB=$RANLIB
8342 RANLIB=:
8343 objlist=
8344 concat_cmds=
8345 save_oldobjs=$oldobjs
8346 oldobjs=
8347 # Is there a better way of finding the last object in the list?
8348 for obj in $save_oldobjs
8350 last_oldobj=$obj
8351 done
8352 eval test_cmds=\"$old_archive_cmds\"
8353 func_len " $test_cmds"
8354 len0=$func_len_result
8355 len=$len0
8356 for obj in $save_oldobjs
8358 func_len " $obj"
8359 func_arith $len + $func_len_result
8360 len=$func_arith_result
8361 func_append objlist " $obj"
8362 if test "$len" -lt "$max_cmd_len"; then
8364 else
8365 # the above command should be used before it gets too long
8366 oldobjs=$objlist
8367 if test "$obj" = "$last_oldobj" ; then
8368 RANLIB=$save_RANLIB
8370 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8371 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8372 objlist=
8373 len=$len0
8375 done
8376 RANLIB=$save_RANLIB
8377 oldobjs=$objlist
8378 if test "X$oldobjs" = "X" ; then
8379 eval cmds=\"\$concat_cmds\"
8380 else
8381 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8385 func_execute_cmds "$cmds" 'exit $?'
8386 done
8388 test -n "$generated" && \
8389 func_show_eval "${RM}r$generated"
8391 # Now create the libtool archive.
8392 case $output in
8393 *.la)
8394 old_library=
8395 test "$build_old_libs" = yes && old_library="$libname.$libext"
8396 func_verbose "creating $output"
8398 # Preserve any variables that may affect compiler behavior
8399 for var in $variables_saved_for_relink; do
8400 if eval test -z \"\${$var+set}\"; then
8401 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8402 elif eval var_value=\$$var; test -z "$var_value"; then
8403 relink_command="$var=; export $var; $relink_command"
8404 else
8405 func_quote_for_eval "$var_value"
8406 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8408 done
8409 # Quote the link command for shipping.
8410 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8411 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8412 if test "$hardcode_automatic" = yes ; then
8413 relink_command=
8416 # Only create the output if not a dry run.
8417 $opt_dry_run || {
8418 for installed in no yes; do
8419 if test "$installed" = yes; then
8420 if test -z "$install_libdir"; then
8421 break
8423 output="$output_objdir/$outputname"i
8424 # Replace all uninstalled libtool libraries with the installed ones
8425 newdependency_libs=
8426 for deplib in $dependency_libs; do
8427 case $deplib in
8428 *.la)
8429 func_basename "$deplib"
8430 name="$func_basename_result"
8431 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8432 test -z "$libdir" && \
8433 func_fatal_error "\`$deplib' is not a valid libtool archive"
8434 newdependency_libs="$newdependency_libs $libdir/$name"
8436 *) newdependency_libs="$newdependency_libs $deplib" ;;
8437 esac
8438 done
8439 dependency_libs="$newdependency_libs"
8440 newdlfiles=
8442 for lib in $dlfiles; do
8443 case $lib in
8444 *.la)
8445 func_basename "$lib"
8446 name="$func_basename_result"
8447 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8448 test -z "$libdir" && \
8449 func_fatal_error "\`$lib' is not a valid libtool archive"
8450 newdlfiles="$newdlfiles $libdir/$name"
8452 *) newdlfiles="$newdlfiles $lib" ;;
8453 esac
8454 done
8455 dlfiles="$newdlfiles"
8456 newdlprefiles=
8457 for lib in $dlprefiles; do
8458 case $lib in
8459 *.la)
8460 # Only pass preopened files to the pseudo-archive (for
8461 # eventual linking with the app. that links it) if we
8462 # didn't already link the preopened objects directly into
8463 # the library:
8464 func_basename "$lib"
8465 name="$func_basename_result"
8466 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8467 test -z "$libdir" && \
8468 func_fatal_error "\`$lib' is not a valid libtool archive"
8469 newdlprefiles="$newdlprefiles $libdir/$name"
8471 esac
8472 done
8473 dlprefiles="$newdlprefiles"
8474 else
8475 newdlfiles=
8476 for lib in $dlfiles; do
8477 case $lib in
8478 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8479 *) abs=`pwd`"/$lib" ;;
8480 esac
8481 newdlfiles="$newdlfiles $abs"
8482 done
8483 dlfiles="$newdlfiles"
8484 newdlprefiles=
8485 for lib in $dlprefiles; do
8486 case $lib in
8487 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8488 *) abs=`pwd`"/$lib" ;;
8489 esac
8490 newdlprefiles="$newdlprefiles $abs"
8491 done
8492 dlprefiles="$newdlprefiles"
8494 $RM $output
8495 # place dlname in correct position for cygwin
8496 # In fact, it would be nice if we could use this code for all target
8497 # systems that can't hard-code library paths into their executables
8498 # and that have no shared library path variable independent of PATH,
8499 # but it turns out we can't easily determine that from inspecting
8500 # libtool variables, so we have to hard-code the OSs to which it
8501 # applies here; at the moment, that means platforms that use the PE
8502 # object format with DLL files. See the long comment at the top of
8503 # tests/bindir.at for full details.
8504 tdlname=$dlname
8505 case $host,$output,$installed,$module,$dlname in
8506 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
8507 # If a -bindir argument was supplied, place the dll there.
8508 if test "x$bindir" != x ;
8509 then
8510 func_relative_path "$install_libdir" "$bindir"
8511 tdlname=$func_relative_path_result$dlname
8512 else
8513 # Otherwise fall back on heuristic.
8514 tdlname=../bin/$dlname
8517 esac
8518 $ECHO > $output "\
8519 # $outputname - a libtool library file
8520 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8522 # Please DO NOT delete this file!
8523 # It is necessary for linking the library.
8525 # The name that we can dlopen(3).
8526 dlname='$tdlname'
8528 # Names of this library.
8529 library_names='$library_names'
8531 # The name of the static archive.
8532 old_library='$old_library'
8534 # Linker flags that can not go in dependency_libs.
8535 inherited_linker_flags='$new_inherited_linker_flags'
8537 # Libraries that this one depends upon.
8538 dependency_libs='$dependency_libs'
8540 # Names of additional weak libraries provided by this library
8541 weak_library_names='$weak_libs'
8543 # Version information for $libname.
8544 current=$current
8545 age=$age
8546 revision=$revision
8548 # Is this an already installed library?
8549 installed=$installed
8551 # Should we warn about portability when linking against -modules?
8552 shouldnotlink=$module
8554 # Files to dlopen/dlpreopen
8555 dlopen='$dlfiles'
8556 dlpreopen='$dlprefiles'
8558 # Directory that this library needs to be installed in:
8559 libdir='$install_libdir'"
8560 if test "$installed" = no && test "$need_relink" = yes; then
8561 $ECHO >> $output "\
8562 relink_command=\"$relink_command\""
8564 done
8567 # Do a symbolic link so that the libtool archive can be found in
8568 # LD_LIBRARY_PATH before the program is installed.
8569 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8571 esac
8572 exit $EXIT_SUCCESS
8575 { test "$mode" = link || test "$mode" = relink; } &&
8576 func_mode_link ${1+"$@"}
8579 # func_mode_uninstall arg...
8580 func_mode_uninstall ()
8582 $opt_debug
8583 RM="$nonopt"
8584 files=
8585 rmforce=
8586 exit_status=0
8588 # This variable tells wrapper scripts just to set variables rather
8589 # than running their programs.
8590 libtool_install_magic="$magic"
8592 for arg
8594 case $arg in
8595 -f) RM="$RM $arg"; rmforce=yes ;;
8596 -*) RM="$RM $arg" ;;
8597 *) files="$files $arg" ;;
8598 esac
8599 done
8601 test -z "$RM" && \
8602 func_fatal_help "you must specify an RM program"
8604 rmdirs=
8606 origobjdir="$objdir"
8607 for file in $files; do
8608 func_dirname "$file" "" "."
8609 dir="$func_dirname_result"
8610 if test "X$dir" = X.; then
8611 objdir="$origobjdir"
8612 else
8613 objdir="$dir/$origobjdir"
8615 func_basename "$file"
8616 name="$func_basename_result"
8617 test "$mode" = uninstall && objdir="$dir"
8619 # Remember objdir for removal later, being careful to avoid duplicates
8620 if test "$mode" = clean; then
8621 case " $rmdirs " in
8622 *" $objdir "*) ;;
8623 *) rmdirs="$rmdirs $objdir" ;;
8624 esac
8627 # Don't error if the file doesn't exist and rm -f was used.
8628 if { test -L "$file"; } >/dev/null 2>&1 ||
8629 { test -h "$file"; } >/dev/null 2>&1 ||
8630 test -f "$file"; then
8632 elif test -d "$file"; then
8633 exit_status=1
8634 continue
8635 elif test "$rmforce" = yes; then
8636 continue
8639 rmfiles="$file"
8641 case $name in
8642 *.la)
8643 # Possibly a libtool archive, so verify it.
8644 if func_lalib_p "$file"; then
8645 func_source $dir/$name
8647 # Delete the libtool libraries and symlinks.
8648 for n in $library_names; do
8649 rmfiles="$rmfiles $objdir/$n"
8650 done
8651 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
8653 case "$mode" in
8654 clean)
8655 case " $library_names " in
8656 # " " in the beginning catches empty $dlname
8657 *" $dlname "*) ;;
8658 *) rmfiles="$rmfiles $objdir/$dlname" ;;
8659 esac
8660 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
8662 uninstall)
8663 if test -n "$library_names"; then
8664 # Do each command in the postuninstall commands.
8665 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8668 if test -n "$old_library"; then
8669 # Do each command in the old_postuninstall commands.
8670 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8672 # FIXME: should reinstall the best remaining shared library.
8674 esac
8678 *.lo)
8679 # Possibly a libtool object, so verify it.
8680 if func_lalib_p "$file"; then
8682 # Read the .lo file
8683 func_source $dir/$name
8685 # Add PIC object to the list of files to remove.
8686 if test -n "$pic_object" &&
8687 test "$pic_object" != none; then
8688 rmfiles="$rmfiles $dir/$pic_object"
8691 # Add non-PIC object to the list of files to remove.
8692 if test -n "$non_pic_object" &&
8693 test "$non_pic_object" != none; then
8694 rmfiles="$rmfiles $dir/$non_pic_object"
8700 if test "$mode" = clean ; then
8701 noexename=$name
8702 case $file in
8703 *.exe)
8704 func_stripname '' '.exe' "$file"
8705 file=$func_stripname_result
8706 func_stripname '' '.exe' "$name"
8707 noexename=$func_stripname_result
8708 # $file with .exe has already been added to rmfiles,
8709 # add $file without .exe
8710 rmfiles="$rmfiles $file"
8712 esac
8713 # Do a test to see if this is a libtool program.
8714 if func_ltwrapper_p "$file"; then
8715 if func_ltwrapper_executable_p "$file"; then
8716 func_ltwrapper_scriptname "$file"
8717 relink_command=
8718 func_source $func_ltwrapper_scriptname_result
8719 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
8720 else
8721 relink_command=
8722 func_source $dir/$noexename
8725 # note $name still contains .exe if it was in $file originally
8726 # as does the version of $file that was added into $rmfiles
8727 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
8728 if test "$fast_install" = yes && test -n "$relink_command"; then
8729 rmfiles="$rmfiles $objdir/lt-$name"
8731 if test "X$noexename" != "X$name" ; then
8732 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
8737 esac
8738 func_show_eval "$RM $rmfiles" 'exit_status=1'
8739 done
8740 objdir="$origobjdir"
8742 # Try to remove the ${objdir}s in the directories where we deleted files
8743 for dir in $rmdirs; do
8744 if test -d "$dir"; then
8745 func_show_eval "rmdir $dir >/dev/null 2>&1"
8747 done
8749 exit $exit_status
8752 { test "$mode" = uninstall || test "$mode" = clean; } &&
8753 func_mode_uninstall ${1+"$@"}
8755 test -z "$mode" && {
8756 help="$generic_help"
8757 func_fatal_help "you must specify a MODE"
8760 test -z "$exec_cmd" && \
8761 func_fatal_help "invalid operation mode \`$mode'"
8763 if test -n "$exec_cmd"; then
8764 eval exec "$exec_cmd"
8765 exit $EXIT_FAILURE
8768 exit $exit_status
8771 # The TAGs below are defined such that we never get into a situation
8772 # in which we disable both kinds of libraries. Given conflicting
8773 # choices, we go for a static library, that is the most portable,
8774 # since we can't tell whether shared libraries were disabled because
8775 # the user asked for that or because the platform doesn't support
8776 # them. This is particularly important on AIX, because we don't
8777 # support having both static and shared libraries enabled at the same
8778 # time on that platform, so we default to a shared-only configuration.
8779 # If a disable-shared tag is given, we'll fallback to a static-only
8780 # configuration. But we'll never go from static-only to shared-only.
8782 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
8783 build_libtool_libs=no
8784 build_old_libs=yes
8785 # ### END LIBTOOL TAG CONFIG: disable-shared
8787 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
8788 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
8789 # ### END LIBTOOL TAG CONFIG: disable-static
8791 # Local Variables:
8792 # mode:shell-script
8793 # sh-indentation:2
8794 # End:
8795 # vi:sw=2