minidlna support now Samsung TV C550/C650 (thx amir909)
[tomato.git] / release / src / router / libexif / ltmain.sh
blobd23ed51a44c2df9bd662b215f391856884e3aa21
1 # Generated from ltmain.m4sh.
3 # ltmain.sh (GNU libtool) 2.2.6
4 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
7 # This is free software; see the source for copying conditions. There is NO
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # GNU Libtool is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # As a special exception to the GNU General Public License,
16 # if you distribute this file as part of a program or library that
17 # is built using GNU Libtool, you may include this file under the
18 # same distribution terms that you use for the rest of that program.
20 # GNU Libtool is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with GNU Libtool; see the file COPYING. If not, a copy
27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
28 # or obtained by writing to the Free Software Foundation, Inc.,
29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 # Usage: $progname [OPTION]... [MODE-ARG]...
33 # Provide generalized library-building support services.
35 # --config show all configuration variables
36 # --debug enable verbose shell tracing
37 # -n, --dry-run display commands without modifying any files
38 # --features display basic configuration information and exit
39 # --mode=MODE use operation mode MODE
40 # --preserve-dup-deps don't remove duplicate dependency libraries
41 # --quiet, --silent don't print informational messages
42 # --tag=TAG use configuration variables from tag TAG
43 # -v, --verbose print informational messages (default)
44 # --version print version information
45 # -h, --help print short or long help message
47 # MODE must be one of the following:
49 # clean remove files from the build directory
50 # compile compile a source file into a libtool object
51 # execute automatically set library path, then run a program
52 # finish complete the installation of libtool libraries
53 # install install libraries or executables
54 # link create a library or an executable
55 # uninstall remove libraries from an installed directory
57 # MODE-ARGS vary depending on the MODE.
58 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
60 # When reporting a bug, please describe a test case to reproduce it and
61 # include the following information:
63 # host-triplet: $host
64 # shell: $SHELL
65 # compiler: $LTCC
66 # compiler flags: $LTCFLAGS
67 # linker: $LD (gnu? $with_gnu_ld)
68 # $progname: (GNU libtool) 2.2.6
69 # automake: $automake_version
70 # autoconf: $autoconf_version
72 # Report bugs to <bug-libtool@gnu.org>.
74 PROGRAM=ltmain.sh
75 PACKAGE=libtool
76 VERSION=2.2.6
77 TIMESTAMP=""
78 package_revision=1.3012
80 # define SED for historic ltconfig's generated by Libtool 1.3
81 test -z "$SED" && SED=sed
83 # Be Bourne compatible
84 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
85 emulate sh
86 NULLCMD=:
87 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
88 # is contrary to our usage. Disable this feature.
89 alias -g '${1+"$@"}'='"$@"'
90 setopt NO_GLOB_SUBST
91 else
92 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
94 BIN_SH=xpg4; export BIN_SH # for Tru64
95 DUALCASE=1; export DUALCASE # for MKS sh
97 # NLS nuisances: We save the old values to restore during execute mode.
98 # Only set LANG and LC_ALL to C if already set.
99 # These must not be set unconditionally because not all systems understand
100 # e.g. LANG=C (notably SCO).
101 lt_user_locale=
102 lt_safe_locale=
103 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
105 eval "if test \"\${$lt_var+set}\" = set; then
106 save_$lt_var=\$$lt_var
107 $lt_var=C
108 export $lt_var
109 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
110 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
112 done
114 $lt_unset CDPATH
120 : ${CP="cp -f"}
121 : ${ECHO="echo"}
122 : ${EGREP="/bin/grep -E"}
123 : ${FGREP="/bin/grep -F"}
124 : ${GREP="/bin/grep"}
125 : ${LN_S="ln -s"}
126 : ${MAKE="make"}
127 : ${MKDIR="mkdir"}
128 : ${MV="mv -f"}
129 : ${RM="rm -f"}
130 : ${SED="/bin/sed"}
131 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
132 : ${Xsed="$SED -e 1s/^X//"}
134 # Global variables:
135 EXIT_SUCCESS=0
136 EXIT_FAILURE=1
137 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
138 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
140 exit_status=$EXIT_SUCCESS
142 # Make sure IFS has a sensible default
143 lt_nl='
145 IFS=" $lt_nl"
147 dirname="s,/[^/]*$,,"
148 basename="s,^.*/,,"
150 # func_dirname_and_basename file append nondir_replacement
151 # perform func_basename and func_dirname in a single function
152 # call:
153 # dirname: Compute the dirname of FILE. If nonempty,
154 # add APPEND to the result, otherwise set result
155 # to NONDIR_REPLACEMENT.
156 # value returned in "$func_dirname_result"
157 # basename: Compute filename of FILE.
158 # value retuned in "$func_basename_result"
159 # Implementation must be kept synchronized with func_dirname
160 # and func_basename. For efficiency, we do not delegate to
161 # those functions but instead duplicate the functionality here.
162 func_dirname_and_basename ()
164 # Extract subdirectory from the argument.
165 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
166 if test "X$func_dirname_result" = "X${1}"; then
167 func_dirname_result="${3}"
168 else
169 func_dirname_result="$func_dirname_result${2}"
171 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
174 # Generated shell functions inserted here.
176 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
177 # is ksh but when the shell is invoked as "sh" and the current value of
178 # the _XPG environment variable is not equal to 1 (one), the special
179 # positional parameter $0, within a function call, is the name of the
180 # function.
181 progpath="$0"
183 # The name of this program:
184 # In the unlikely event $progname began with a '-', it would play havoc with
185 # func_echo (imagine progname=-n), so we prepend ./ in that case:
186 func_dirname_and_basename "$progpath"
187 progname=$func_basename_result
188 case $progname in
189 -*) progname=./$progname ;;
190 esac
192 # Make sure we have an absolute path for reexecution:
193 case $progpath in
194 [\\/]*|[A-Za-z]:\\*) ;;
195 *[\\/]*)
196 progdir=$func_dirname_result
197 progdir=`cd "$progdir" && pwd`
198 progpath="$progdir/$progname"
201 save_IFS="$IFS"
202 IFS=:
203 for progdir in $PATH; do
204 IFS="$save_IFS"
205 test -x "$progdir/$progname" && break
206 done
207 IFS="$save_IFS"
208 test -n "$progdir" || progdir=`pwd`
209 progpath="$progdir/$progname"
211 esac
213 # Sed substitution that helps us do robust quoting. It backslashifies
214 # metacharacters that are still active within double-quoted strings.
215 Xsed="${SED}"' -e 1s/^X//'
216 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
218 # Same as above, but do not quote variable references.
219 double_quote_subst='s/\(["`\\]\)/\\\1/g'
221 # Re-`\' parameter expansions in output of double_quote_subst that were
222 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
223 # in input to double_quote_subst, that '$' was protected from expansion.
224 # Since each input `\' is now two `\'s, look for any number of runs of
225 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
226 bs='\\'
227 bs2='\\\\'
228 bs4='\\\\\\\\'
229 dollar='\$'
230 sed_double_backslash="\
231 s/$bs4/&\\
233 s/^$bs2$dollar/$bs&/
234 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
235 s/\n//g"
237 # Standard options:
238 opt_dry_run=false
239 opt_help=false
240 opt_quiet=false
241 opt_verbose=false
242 opt_warning=:
244 # func_echo arg...
245 # Echo program name prefixed message, along with the current mode
246 # name if it has been set yet.
247 func_echo ()
249 $ECHO "$progname${mode+: }$mode: $*"
252 # func_verbose arg...
253 # Echo program name prefixed message in verbose mode only.
254 func_verbose ()
256 $opt_verbose && func_echo ${1+"$@"}
258 # A bug in bash halts the script if the last line of a function
259 # fails when set -e is in force, so we need another command to
260 # work around that:
264 # func_error arg...
265 # Echo program name prefixed message to standard error.
266 func_error ()
268 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
271 # func_warning arg...
272 # Echo program name prefixed warning message to standard error.
273 func_warning ()
275 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
277 # bash bug again:
281 # func_fatal_error arg...
282 # Echo program name prefixed message to standard error, and exit.
283 func_fatal_error ()
285 func_error ${1+"$@"}
286 exit $EXIT_FAILURE
289 # func_fatal_help arg...
290 # Echo program name prefixed message to standard error, followed by
291 # a help hint, and exit.
292 func_fatal_help ()
294 func_error ${1+"$@"}
295 func_fatal_error "$help"
297 help="Try \`$progname --help' for more information." ## default
300 # func_grep expression filename
301 # Check whether EXPRESSION matches any line of FILENAME, without output.
302 func_grep ()
304 $GREP "$1" "$2" >/dev/null 2>&1
308 # func_mkdir_p directory-path
309 # Make sure the entire path to DIRECTORY-PATH is available.
310 func_mkdir_p ()
312 my_directory_path="$1"
313 my_dir_list=
315 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
317 # Protect directory names starting with `-'
318 case $my_directory_path in
319 -*) my_directory_path="./$my_directory_path" ;;
320 esac
322 # While some portion of DIR does not yet exist...
323 while test ! -d "$my_directory_path"; do
324 # ...make a list in topmost first order. Use a colon delimited
325 # list incase some portion of path contains whitespace.
326 my_dir_list="$my_directory_path:$my_dir_list"
328 # If the last portion added has no slash in it, the list is done
329 case $my_directory_path in */*) ;; *) break ;; esac
331 # ...otherwise throw away the child directory and loop
332 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
333 done
334 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
336 save_mkdir_p_IFS="$IFS"; IFS=':'
337 for my_dir in $my_dir_list; do
338 IFS="$save_mkdir_p_IFS"
339 # mkdir can fail with a `File exist' error if two processes
340 # try to create one of the directories concurrently. Don't
341 # stop in that case!
342 $MKDIR "$my_dir" 2>/dev/null || :
343 done
344 IFS="$save_mkdir_p_IFS"
346 # Bail out if we (or some other process) failed to create a directory.
347 test -d "$my_directory_path" || \
348 func_fatal_error "Failed to create \`$1'"
353 # func_mktempdir [string]
354 # Make a temporary directory that won't clash with other running
355 # libtool processes, and avoids race conditions if possible. If
356 # given, STRING is the basename for that directory.
357 func_mktempdir ()
359 my_template="${TMPDIR-/tmp}/${1-$progname}"
361 if test "$opt_dry_run" = ":"; then
362 # Return a directory name, but don't create it in dry-run mode
363 my_tmpdir="${my_template}-$$"
364 else
366 # If mktemp works, use that first and foremost
367 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
369 if test ! -d "$my_tmpdir"; then
370 # Failing that, at least try and use $RANDOM to avoid a race
371 my_tmpdir="${my_template}-${RANDOM-0}$$"
373 save_mktempdir_umask=`umask`
374 umask 0077
375 $MKDIR "$my_tmpdir"
376 umask $save_mktempdir_umask
379 # If we're not in dry-run mode, bomb out on failure
380 test -d "$my_tmpdir" || \
381 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
384 $ECHO "X$my_tmpdir" | $Xsed
388 # func_quote_for_eval arg
389 # Aesthetically quote ARG to be evaled later.
390 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
391 # is double-quoted, suitable for a subsequent eval, whereas
392 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
393 # which are still active within double quotes backslashified.
394 func_quote_for_eval ()
396 case $1 in
397 *[\\\`\"\$]*)
398 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
400 func_quote_for_eval_unquoted_result="$1" ;;
401 esac
403 case $func_quote_for_eval_unquoted_result in
404 # Double-quote args containing shell metacharacters to delay
405 # word splitting, command substitution and and variable
406 # expansion for a subsequent eval.
407 # Many Bourne shells cannot handle close brackets correctly
408 # in scan sets, so we specify it separately.
409 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
410 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
413 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
414 esac
418 # func_quote_for_expand arg
419 # Aesthetically quote ARG to be evaled later; same as above,
420 # but do not quote variable references.
421 func_quote_for_expand ()
423 case $1 in
424 *[\\\`\"]*)
425 my_arg=`$ECHO "X$1" | $Xsed \
426 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
428 my_arg="$1" ;;
429 esac
431 case $my_arg in
432 # Double-quote args containing shell metacharacters to delay
433 # word splitting and command substitution for a subsequent eval.
434 # Many Bourne shells cannot handle close brackets correctly
435 # in scan sets, so we specify it separately.
436 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
437 my_arg="\"$my_arg\""
439 esac
441 func_quote_for_expand_result="$my_arg"
445 # func_show_eval cmd [fail_exp]
446 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
447 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
448 # is given, then evaluate it.
449 func_show_eval ()
451 my_cmd="$1"
452 my_fail_exp="${2-:}"
454 ${opt_silent-false} || {
455 func_quote_for_expand "$my_cmd"
456 eval "func_echo $func_quote_for_expand_result"
459 if ${opt_dry_run-false}; then :; else
460 eval "$my_cmd"
461 my_status=$?
462 if test "$my_status" -eq 0; then :; else
463 eval "(exit $my_status); $my_fail_exp"
469 # func_show_eval_locale cmd [fail_exp]
470 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
471 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
472 # is given, then evaluate it. Use the saved locale for evaluation.
473 func_show_eval_locale ()
475 my_cmd="$1"
476 my_fail_exp="${2-:}"
478 ${opt_silent-false} || {
479 func_quote_for_expand "$my_cmd"
480 eval "func_echo $func_quote_for_expand_result"
483 if ${opt_dry_run-false}; then :; else
484 eval "$lt_user_locale
485 $my_cmd"
486 my_status=$?
487 eval "$lt_safe_locale"
488 if test "$my_status" -eq 0; then :; else
489 eval "(exit $my_status); $my_fail_exp"
498 # func_version
499 # Echo version message to standard output and exit.
500 func_version ()
502 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
503 s/^# //
504 s/^# *$//
505 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
507 }' < "$progpath"
508 exit $?
511 # func_usage
512 # Echo short help message to standard output and exit.
513 func_usage ()
515 $SED -n '/^# Usage:/,/# -h/ {
516 s/^# //
517 s/^# *$//
518 s/\$progname/'$progname'/
520 }' < "$progpath"
521 $ECHO
522 $ECHO "run \`$progname --help | more' for full usage"
523 exit $?
526 # func_help
527 # Echo long help message to standard output and exit.
528 func_help ()
530 $SED -n '/^# Usage:/,/# Report bugs to/ {
531 s/^# //
532 s/^# *$//
533 s*\$progname*'$progname'*
534 s*\$host*'"$host"'*
535 s*\$SHELL*'"$SHELL"'*
536 s*\$LTCC*'"$LTCC"'*
537 s*\$LTCFLAGS*'"$LTCFLAGS"'*
538 s*\$LD*'"$LD"'*
539 s/\$with_gnu_ld/'"$with_gnu_ld"'/
540 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
541 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
543 }' < "$progpath"
544 exit $?
547 # func_missing_arg argname
548 # Echo program name prefixed message to standard error and set global
549 # exit_cmd.
550 func_missing_arg ()
552 func_error "missing argument for $1"
553 exit_cmd=exit
556 exit_cmd=:
562 # Check that we have a working $ECHO.
563 if test "X$1" = X--no-reexec; then
564 # Discard the --no-reexec flag, and continue.
565 shift
566 elif test "X$1" = X--fallback-echo; then
567 # Avoid inline document here, it may be left over
569 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
570 # Yippee, $ECHO works!
572 else
573 # Restart under the correct shell, and then maybe $ECHO will work.
574 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
577 if test "X$1" = X--fallback-echo; then
578 # used as fallback echo
579 shift
580 cat <<EOF
583 exit $EXIT_SUCCESS
586 magic="%%%MAGIC variable%%%"
587 magic_exe="%%%MAGIC EXE variable%%%"
589 # Global variables.
590 # $mode is unset
591 nonopt=
592 execute_dlfiles=
593 preserve_args=
594 lo2o="s/\\.lo\$/.${objext}/"
595 o2lo="s/\\.${objext}\$/.lo/"
596 extracted_archives=
597 extracted_serial=0
599 opt_dry_run=false
600 opt_duplicate_deps=false
601 opt_silent=false
602 opt_debug=:
604 # If this variable is set in any of the actions, the command in it
605 # will be execed at the end. This prevents here-documents from being
606 # left over by shells.
607 exec_cmd=
609 # func_fatal_configuration arg...
610 # Echo program name prefixed message to standard error, followed by
611 # a configuration failure hint, and exit.
612 func_fatal_configuration ()
614 func_error ${1+"$@"}
615 func_error "See the $PACKAGE documentation for more information."
616 func_fatal_error "Fatal configuration error."
620 # func_config
621 # Display the configuration for all the tags in this script.
622 func_config ()
624 re_begincf='^# ### BEGIN LIBTOOL'
625 re_endcf='^# ### END LIBTOOL'
627 # Default configuration.
628 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
630 # Now print the configurations for the tags.
631 for tagname in $taglist; do
632 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
633 done
635 exit $?
638 # func_features
639 # Display the features supported by this script.
640 func_features ()
642 $ECHO "host: $host"
643 if test "$build_libtool_libs" = yes; then
644 $ECHO "enable shared libraries"
645 else
646 $ECHO "disable shared libraries"
648 if test "$build_old_libs" = yes; then
649 $ECHO "enable static libraries"
650 else
651 $ECHO "disable static libraries"
654 exit $?
657 # func_enable_tag tagname
658 # Verify that TAGNAME is valid, and either flag an error and exit, or
659 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
660 # variable here.
661 func_enable_tag ()
663 # Global variable:
664 tagname="$1"
666 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
667 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
668 sed_extractcf="/$re_begincf/,/$re_endcf/p"
670 # Validate tagname.
671 case $tagname in
672 *[!-_A-Za-z0-9,/]*)
673 func_fatal_error "invalid tag name: $tagname"
675 esac
677 # Don't test for the "default" C tag, as we know it's
678 # there but not specially marked.
679 case $tagname in
680 CC) ;;
682 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
683 taglist="$taglist $tagname"
685 # Evaluate the configuration. Be careful to quote the path
686 # and the sed script, to avoid splitting on whitespace, but
687 # also don't use non-portable quotes within backquotes within
688 # quotes we have to do it in 2 steps:
689 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
690 eval "$extractedcf"
691 else
692 func_error "ignoring unknown tag $tagname"
695 esac
698 # Parse options once, thoroughly. This comes as soon as possible in
699 # the script to make things like `libtool --version' happen quickly.
702 # Shorthand for --mode=foo, only valid as the first argument
703 case $1 in
704 clean|clea|cle|cl)
705 shift; set dummy --mode clean ${1+"$@"}; shift
707 compile|compil|compi|comp|com|co|c)
708 shift; set dummy --mode compile ${1+"$@"}; shift
710 execute|execut|execu|exec|exe|ex|e)
711 shift; set dummy --mode execute ${1+"$@"}; shift
713 finish|finis|fini|fin|fi|f)
714 shift; set dummy --mode finish ${1+"$@"}; shift
716 install|instal|insta|inst|ins|in|i)
717 shift; set dummy --mode install ${1+"$@"}; shift
719 link|lin|li|l)
720 shift; set dummy --mode link ${1+"$@"}; shift
722 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
723 shift; set dummy --mode uninstall ${1+"$@"}; shift
725 esac
727 # Parse non-mode specific arguments:
728 while test "$#" -gt 0; do
729 opt="$1"
730 shift
732 case $opt in
733 --config) func_config ;;
735 --debug) preserve_args="$preserve_args $opt"
736 func_echo "enabling shell trace mode"
737 opt_debug='set -x'
738 $opt_debug
741 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
742 execute_dlfiles="$execute_dlfiles $1"
743 shift
746 --dry-run | -n) opt_dry_run=: ;;
747 --features) func_features ;;
748 --finish) mode="finish" ;;
750 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
751 case $1 in
752 # Valid mode arguments:
753 clean) ;;
754 compile) ;;
755 execute) ;;
756 finish) ;;
757 install) ;;
758 link) ;;
759 relink) ;;
760 uninstall) ;;
762 # Catch anything else as an error
763 *) func_error "invalid argument for $opt"
764 exit_cmd=exit
765 break
767 esac
769 mode="$1"
770 shift
773 --preserve-dup-deps)
774 opt_duplicate_deps=: ;;
776 --quiet|--silent) preserve_args="$preserve_args $opt"
777 opt_silent=:
780 --verbose| -v) preserve_args="$preserve_args $opt"
781 opt_silent=false
784 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
785 preserve_args="$preserve_args $opt $1"
786 func_enable_tag "$1" # tagname is set here
787 shift
790 # Separate optargs to long options:
791 -dlopen=*|--mode=*|--tag=*)
792 func_opt_split "$opt"
793 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
794 shift
797 -\?|-h) func_usage ;;
798 --help) opt_help=: ;;
799 --version) func_version ;;
801 -*) func_fatal_help "unrecognized option \`$opt'" ;;
803 *) nonopt="$opt"
804 break
806 esac
807 done
810 case $host in
811 *cygwin* | *mingw* | *pw32* | *cegcc*)
812 # don't eliminate duplications in $postdeps and $predeps
813 opt_duplicate_compiler_generated_deps=:
816 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
818 esac
820 # Having warned about all mis-specified options, bail out if
821 # anything was wrong.
822 $exit_cmd $EXIT_FAILURE
825 # func_check_version_match
826 # Ensure that we are using m4 macros, and libtool script from the same
827 # release of libtool.
828 func_check_version_match ()
830 if test "$package_revision" != "$macro_revision"; then
831 if test "$VERSION" != "$macro_version"; then
832 if test -z "$macro_version"; then
833 cat >&2 <<_LT_EOF
834 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
835 $progname: definition of this LT_INIT comes from an older release.
836 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
837 $progname: and run autoconf again.
838 _LT_EOF
839 else
840 cat >&2 <<_LT_EOF
841 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
842 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
843 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
844 $progname: and run autoconf again.
845 _LT_EOF
847 else
848 cat >&2 <<_LT_EOF
849 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
850 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
851 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
852 $progname: of $PACKAGE $VERSION and run autoconf again.
853 _LT_EOF
856 exit $EXIT_MISMATCH
861 ## ----------- ##
862 ## Main. ##
863 ## ----------- ##
865 $opt_help || {
866 # Sanity checks first:
867 func_check_version_match
869 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
870 func_fatal_configuration "not configured to build any kind of library"
873 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
876 # Darwin sucks
877 eval std_shrext=\"$shrext_cmds\"
880 # Only execute mode is allowed to have -dlopen flags.
881 if test -n "$execute_dlfiles" && test "$mode" != execute; then
882 func_error "unrecognized option \`-dlopen'"
883 $ECHO "$help" 1>&2
884 exit $EXIT_FAILURE
887 # Change the help message to a mode-specific one.
888 generic_help="$help"
889 help="Try \`$progname --help --mode=$mode' for more information."
893 # func_lalib_p file
894 # True iff FILE is a libtool `.la' library or `.lo' object file.
895 # This function is only a basic sanity check; it will hardly flush out
896 # determined imposters.
897 func_lalib_p ()
899 test -f "$1" &&
900 $SED -e 4q "$1" 2>/dev/null \
901 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
904 # func_lalib_unsafe_p file
905 # True iff FILE is a libtool `.la' library or `.lo' object file.
906 # This function implements the same check as func_lalib_p without
907 # resorting to external programs. To this end, it redirects stdin and
908 # closes it afterwards, without saving the original file descriptor.
909 # As a safety measure, use it only where a negative result would be
910 # fatal anyway. Works if `file' does not exist.
911 func_lalib_unsafe_p ()
913 lalib_p=no
914 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
915 for lalib_p_l in 1 2 3 4
917 read lalib_p_line
918 case "$lalib_p_line" in
919 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
920 esac
921 done
922 exec 0<&5 5<&-
924 test "$lalib_p" = yes
927 # func_ltwrapper_script_p file
928 # True iff FILE is a libtool wrapper script
929 # This function is only a basic sanity check; it will hardly flush out
930 # determined imposters.
931 func_ltwrapper_script_p ()
933 func_lalib_p "$1"
936 # func_ltwrapper_executable_p file
937 # True iff FILE is a libtool wrapper executable
938 # This function is only a basic sanity check; it will hardly flush out
939 # determined imposters.
940 func_ltwrapper_executable_p ()
942 func_ltwrapper_exec_suffix=
943 case $1 in
944 *.exe) ;;
945 *) func_ltwrapper_exec_suffix=.exe ;;
946 esac
947 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
950 # func_ltwrapper_scriptname file
951 # Assumes file is an ltwrapper_executable
952 # uses $file to determine the appropriate filename for a
953 # temporary ltwrapper_script.
954 func_ltwrapper_scriptname ()
956 func_ltwrapper_scriptname_result=""
957 if func_ltwrapper_executable_p "$1"; then
958 func_dirname_and_basename "$1" "" "."
959 func_stripname '' '.exe' "$func_basename_result"
960 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
964 # func_ltwrapper_p file
965 # True iff FILE is a libtool wrapper script or wrapper executable
966 # This function is only a basic sanity check; it will hardly flush out
967 # determined imposters.
968 func_ltwrapper_p ()
970 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
974 # func_execute_cmds commands fail_cmd
975 # Execute tilde-delimited COMMANDS.
976 # If FAIL_CMD is given, eval that upon failure.
977 # FAIL_CMD may read-access the current command in variable CMD!
978 func_execute_cmds ()
980 $opt_debug
981 save_ifs=$IFS; IFS='~'
982 for cmd in $1; do
983 IFS=$save_ifs
984 eval cmd=\"$cmd\"
985 func_show_eval "$cmd" "${2-:}"
986 done
987 IFS=$save_ifs
991 # func_source file
992 # Source FILE, adding directory component if necessary.
993 # Note that it is not necessary on cygwin/mingw to append a dot to
994 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
995 # behavior happens only for exec(3), not for open(2)! Also, sourcing
996 # `FILE.' does not work on cygwin managed mounts.
997 func_source ()
999 $opt_debug
1000 case $1 in
1001 */* | *\\*) . "$1" ;;
1002 *) . "./$1" ;;
1003 esac
1007 # func_infer_tag arg
1008 # Infer tagged configuration to use if any are available and
1009 # if one wasn't chosen via the "--tag" command line option.
1010 # Only attempt this if the compiler in the base compile
1011 # command doesn't match the default compiler.
1012 # arg is usually of the form 'gcc ...'
1013 func_infer_tag ()
1015 $opt_debug
1016 if test -n "$available_tags" && test -z "$tagname"; then
1017 CC_quoted=
1018 for arg in $CC; do
1019 func_quote_for_eval "$arg"
1020 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1021 done
1022 case $@ in
1023 # Blanks in the command may have been stripped by the calling shell,
1024 # but not from the CC environment variable when configure was run.
1025 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1026 # Blanks at the start of $base_compile will cause this to fail
1027 # if we don't check for them as well.
1029 for z in $available_tags; do
1030 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1031 # Evaluate the configuration.
1032 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1033 CC_quoted=
1034 for arg in $CC; do
1035 # Double-quote args containing other shell metacharacters.
1036 func_quote_for_eval "$arg"
1037 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1038 done
1039 case "$@ " in
1040 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1041 # The compiler in the base compile command matches
1042 # the one in the tagged configuration.
1043 # Assume this is the tagged configuration we want.
1044 tagname=$z
1045 break
1047 esac
1049 done
1050 # If $tagname still isn't set, then no tagged configuration
1051 # was found and let the user know that the "--tag" command
1052 # line option must be used.
1053 if test -z "$tagname"; then
1054 func_echo "unable to infer tagged configuration"
1055 func_fatal_error "specify a tag with \`--tag'"
1056 # else
1057 # func_verbose "using $tagname tagged configuration"
1060 esac
1066 # func_write_libtool_object output_name pic_name nonpic_name
1067 # Create a libtool object file (analogous to a ".la" file),
1068 # but don't create it if we're doing a dry run.
1069 func_write_libtool_object ()
1071 write_libobj=${1}
1072 if test "$build_libtool_libs" = yes; then
1073 write_lobj=\'${2}\'
1074 else
1075 write_lobj=none
1078 if test "$build_old_libs" = yes; then
1079 write_oldobj=\'${3}\'
1080 else
1081 write_oldobj=none
1084 $opt_dry_run || {
1085 cat >${write_libobj}T <<EOF
1086 # $write_libobj - a libtool object file
1087 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1089 # Please DO NOT delete this file!
1090 # It is necessary for linking the library.
1092 # Name of the PIC object.
1093 pic_object=$write_lobj
1095 # Name of the non-PIC object
1096 non_pic_object=$write_oldobj
1099 $MV "${write_libobj}T" "${write_libobj}"
1103 # func_mode_compile arg...
1104 func_mode_compile ()
1106 $opt_debug
1107 # Get the compilation command and the source file.
1108 base_compile=
1109 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1110 suppress_opt=yes
1111 suppress_output=
1112 arg_mode=normal
1113 libobj=
1114 later=
1115 pie_flag=
1117 for arg
1119 case $arg_mode in
1120 arg )
1121 # do not "continue". Instead, add this to base_compile
1122 lastarg="$arg"
1123 arg_mode=normal
1126 target )
1127 libobj="$arg"
1128 arg_mode=normal
1129 continue
1132 normal )
1133 # Accept any command-line options.
1134 case $arg in
1136 test -n "$libobj" && \
1137 func_fatal_error "you cannot specify \`-o' more than once"
1138 arg_mode=target
1139 continue
1142 -pie | -fpie | -fPIE)
1143 pie_flag="$pie_flag $arg"
1144 continue
1147 -shared | -static | -prefer-pic | -prefer-non-pic)
1148 later="$later $arg"
1149 continue
1152 -no-suppress)
1153 suppress_opt=no
1154 continue
1157 -Xcompiler)
1158 arg_mode=arg # the next one goes into the "base_compile" arg list
1159 continue # The current "srcfile" will either be retained or
1160 ;; # replaced later. I would guess that would be a bug.
1162 -Wc,*)
1163 func_stripname '-Wc,' '' "$arg"
1164 args=$func_stripname_result
1165 lastarg=
1166 save_ifs="$IFS"; IFS=','
1167 for arg in $args; do
1168 IFS="$save_ifs"
1169 func_quote_for_eval "$arg"
1170 lastarg="$lastarg $func_quote_for_eval_result"
1171 done
1172 IFS="$save_ifs"
1173 func_stripname ' ' '' "$lastarg"
1174 lastarg=$func_stripname_result
1176 # Add the arguments to base_compile.
1177 base_compile="$base_compile $lastarg"
1178 continue
1182 # Accept the current argument as the source file.
1183 # The previous "srcfile" becomes the current argument.
1185 lastarg="$srcfile"
1186 srcfile="$arg"
1188 esac # case $arg
1190 esac # case $arg_mode
1192 # Aesthetically quote the previous argument.
1193 func_quote_for_eval "$lastarg"
1194 base_compile="$base_compile $func_quote_for_eval_result"
1195 done # for arg
1197 case $arg_mode in
1198 arg)
1199 func_fatal_error "you must specify an argument for -Xcompile"
1201 target)
1202 func_fatal_error "you must specify a target with \`-o'"
1205 # Get the name of the library object.
1206 test -z "$libobj" && {
1207 func_basename "$srcfile"
1208 libobj="$func_basename_result"
1211 esac
1213 # Recognize several different file suffixes.
1214 # If the user specifies -o file.o, it is replaced with file.lo
1215 case $libobj in
1216 *.[cCFSifmso] | \
1217 *.ada | *.adb | *.ads | *.asm | \
1218 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1219 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1220 func_xform "$libobj"
1221 libobj=$func_xform_result
1223 esac
1225 case $libobj in
1226 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1228 func_fatal_error "cannot determine name of library object from \`$libobj'"
1230 esac
1232 func_infer_tag $base_compile
1234 for arg in $later; do
1235 case $arg in
1236 -shared)
1237 test "$build_libtool_libs" != yes && \
1238 func_fatal_configuration "can not build a shared library"
1239 build_old_libs=no
1240 continue
1243 -static)
1244 build_libtool_libs=no
1245 build_old_libs=yes
1246 continue
1249 -prefer-pic)
1250 pic_mode=yes
1251 continue
1254 -prefer-non-pic)
1255 pic_mode=no
1256 continue
1258 esac
1259 done
1261 func_quote_for_eval "$libobj"
1262 test "X$libobj" != "X$func_quote_for_eval_result" \
1263 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1264 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1265 func_dirname_and_basename "$obj" "/" ""
1266 objname="$func_basename_result"
1267 xdir="$func_dirname_result"
1268 lobj=${xdir}$objdir/$objname
1270 test -z "$base_compile" && \
1271 func_fatal_help "you must specify a compilation command"
1273 # Delete any leftover library objects.
1274 if test "$build_old_libs" = yes; then
1275 removelist="$obj $lobj $libobj ${libobj}T"
1276 else
1277 removelist="$lobj $libobj ${libobj}T"
1280 # On Cygwin there's no "real" PIC flag so we must build both object types
1281 case $host_os in
1282 cygwin* | mingw* | pw32* | os2* | cegcc*)
1283 pic_mode=default
1285 esac
1286 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1287 # non-PIC code in shared libraries is not supported
1288 pic_mode=default
1291 # Calculate the filename of the output object if compiler does
1292 # not support -o with -c
1293 if test "$compiler_c_o" = no; then
1294 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1295 lockfile="$output_obj.lock"
1296 else
1297 output_obj=
1298 need_locks=no
1299 lockfile=
1302 # Lock this critical section if it is needed
1303 # We use this script file to make the link, it avoids creating a new file
1304 if test "$need_locks" = yes; then
1305 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1306 func_echo "Waiting for $lockfile to be removed"
1307 sleep 2
1308 done
1309 elif test "$need_locks" = warn; then
1310 if test -f "$lockfile"; then
1311 $ECHO "\
1312 *** ERROR, $lockfile exists and contains:
1313 `cat $lockfile 2>/dev/null`
1315 This indicates that another process is trying to use the same
1316 temporary object file, and libtool could not work around it because
1317 your compiler does not support \`-c' and \`-o' together. If you
1318 repeat this compilation, it may succeed, by chance, but you had better
1319 avoid parallel builds (make -j) in this platform, or get a better
1320 compiler."
1322 $opt_dry_run || $RM $removelist
1323 exit $EXIT_FAILURE
1325 removelist="$removelist $output_obj"
1326 $ECHO "$srcfile" > "$lockfile"
1329 $opt_dry_run || $RM $removelist
1330 removelist="$removelist $lockfile"
1331 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1333 if test -n "$fix_srcfile_path"; then
1334 eval srcfile=\"$fix_srcfile_path\"
1336 func_quote_for_eval "$srcfile"
1337 qsrcfile=$func_quote_for_eval_result
1339 # Only build a PIC object if we are building libtool libraries.
1340 if test "$build_libtool_libs" = yes; then
1341 # Without this assignment, base_compile gets emptied.
1342 fbsd_hideous_sh_bug=$base_compile
1344 if test "$pic_mode" != no; then
1345 command="$base_compile $qsrcfile $pic_flag"
1346 else
1347 # Don't build PIC code
1348 command="$base_compile $qsrcfile"
1351 func_mkdir_p "$xdir$objdir"
1353 if test -z "$output_obj"; then
1354 # Place PIC objects in $objdir
1355 command="$command -o $lobj"
1358 func_show_eval_locale "$command" \
1359 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1361 if test "$need_locks" = warn &&
1362 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1363 $ECHO "\
1364 *** ERROR, $lockfile contains:
1365 `cat $lockfile 2>/dev/null`
1367 but it should contain:
1368 $srcfile
1370 This indicates that another process is trying to use the same
1371 temporary object file, and libtool could not work around it because
1372 your compiler does not support \`-c' and \`-o' together. If you
1373 repeat this compilation, it may succeed, by chance, but you had better
1374 avoid parallel builds (make -j) in this platform, or get a better
1375 compiler."
1377 $opt_dry_run || $RM $removelist
1378 exit $EXIT_FAILURE
1381 # Just move the object if needed, then go on to compile the next one
1382 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1383 func_show_eval '$MV "$output_obj" "$lobj"' \
1384 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1387 # Allow error messages only from the first compilation.
1388 if test "$suppress_opt" = yes; then
1389 suppress_output=' >/dev/null 2>&1'
1393 # Only build a position-dependent object if we build old libraries.
1394 if test "$build_old_libs" = yes; then
1395 if test "$pic_mode" != yes; then
1396 # Don't build PIC code
1397 command="$base_compile $qsrcfile$pie_flag"
1398 else
1399 command="$base_compile $qsrcfile $pic_flag"
1401 if test "$compiler_c_o" = yes; then
1402 command="$command -o $obj"
1405 # Suppress compiler output if we already did a PIC compilation.
1406 command="$command$suppress_output"
1407 func_show_eval_locale "$command" \
1408 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1410 if test "$need_locks" = warn &&
1411 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1412 $ECHO "\
1413 *** ERROR, $lockfile contains:
1414 `cat $lockfile 2>/dev/null`
1416 but it should contain:
1417 $srcfile
1419 This indicates that another process is trying to use the same
1420 temporary object file, and libtool could not work around it because
1421 your compiler does not support \`-c' and \`-o' together. If you
1422 repeat this compilation, it may succeed, by chance, but you had better
1423 avoid parallel builds (make -j) in this platform, or get a better
1424 compiler."
1426 $opt_dry_run || $RM $removelist
1427 exit $EXIT_FAILURE
1430 # Just move the object if needed
1431 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1432 func_show_eval '$MV "$output_obj" "$obj"' \
1433 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1437 $opt_dry_run || {
1438 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1440 # Unlock the critical section if it was locked
1441 if test "$need_locks" != no; then
1442 removelist=$lockfile
1443 $RM "$lockfile"
1447 exit $EXIT_SUCCESS
1450 $opt_help || {
1451 test "$mode" = compile && func_mode_compile ${1+"$@"}
1454 func_mode_help ()
1456 # We need to display help for each of the modes.
1457 case $mode in
1459 # Generic help is extracted from the usage comments
1460 # at the start of this file.
1461 func_help
1464 clean)
1465 $ECHO \
1466 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1468 Remove files from the build directory.
1470 RM is the name of the program to use to delete files associated with each FILE
1471 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1472 to RM.
1474 If FILE is a libtool library, object or program, all the files associated
1475 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1478 compile)
1479 $ECHO \
1480 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1482 Compile a source file into a libtool library object.
1484 This mode accepts the following additional options:
1486 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1487 -no-suppress do not suppress compiler output for multiple passes
1488 -prefer-pic try to building PIC objects only
1489 -prefer-non-pic try to building non-PIC objects only
1490 -shared do not build a \`.o' file suitable for static linking
1491 -static only build a \`.o' file suitable for static linking
1493 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1494 from the given SOURCEFILE.
1496 The output file name is determined by removing the directory component from
1497 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1498 library object suffix, \`.lo'."
1501 execute)
1502 $ECHO \
1503 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1505 Automatically set library path, then run a program.
1507 This mode accepts the following additional options:
1509 -dlopen FILE add the directory containing FILE to the library path
1511 This mode sets the library path environment variable according to \`-dlopen'
1512 flags.
1514 If any of the ARGS are libtool executable wrappers, then they are translated
1515 into their corresponding uninstalled binary, and any of their required library
1516 directories are added to the library path.
1518 Then, COMMAND is executed, with ARGS as arguments."
1521 finish)
1522 $ECHO \
1523 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1525 Complete the installation of libtool libraries.
1527 Each LIBDIR is a directory that contains libtool libraries.
1529 The commands that this mode executes may require superuser privileges. Use
1530 the \`--dry-run' option if you just want to see what would be executed."
1533 install)
1534 $ECHO \
1535 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1537 Install executables or libraries.
1539 INSTALL-COMMAND is the installation command. The first component should be
1540 either the \`install' or \`cp' program.
1542 The following components of INSTALL-COMMAND are treated specially:
1544 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1546 The rest of the components are interpreted as arguments to that command (only
1547 BSD-compatible install options are recognized)."
1550 link)
1551 $ECHO \
1552 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1554 Link object files or libraries together to form another library, or to
1555 create an executable program.
1557 LINK-COMMAND is a command using the C compiler that you would use to create
1558 a program from several object files.
1560 The following components of LINK-COMMAND are treated specially:
1562 -all-static do not do any dynamic linking at all
1563 -avoid-version do not add a version suffix if possible
1564 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1565 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1566 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1567 -export-symbols SYMFILE
1568 try to export only the symbols listed in SYMFILE
1569 -export-symbols-regex REGEX
1570 try to export only the symbols matching REGEX
1571 -LLIBDIR search LIBDIR for required installed libraries
1572 -lNAME OUTPUT-FILE requires the installed library libNAME
1573 -module build a library that can dlopened
1574 -no-fast-install disable the fast-install mode
1575 -no-install link a not-installable executable
1576 -no-undefined declare that a library does not refer to external symbols
1577 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1578 -objectlist FILE Use a list of object files found in FILE to specify objects
1579 -precious-files-regex REGEX
1580 don't remove output files matching REGEX
1581 -release RELEASE specify package release information
1582 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1583 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1584 -shared only do dynamic linking of libtool libraries
1585 -shrext SUFFIX override the standard shared library file extension
1586 -static do not do any dynamic linking of uninstalled libtool libraries
1587 -static-libtool-libs
1588 do not do any dynamic linking of libtool libraries
1589 -version-info CURRENT[:REVISION[:AGE]]
1590 specify library version info [each variable defaults to 0]
1591 -weak LIBNAME declare that the target provides the LIBNAME interface
1593 All other options (arguments beginning with \`-') are ignored.
1595 Every other argument is treated as a filename. Files ending in \`.la' are
1596 treated as uninstalled libtool libraries, other files are standard or library
1597 object files.
1599 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1600 only library objects (\`.lo' files) may be specified, and \`-rpath' is
1601 required, except when creating a convenience library.
1603 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1604 using \`ar' and \`ranlib', or on Windows using \`lib'.
1606 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1607 is created, otherwise an executable program is created."
1610 uninstall)
1611 $ECHO \
1612 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1614 Remove libraries from an installation directory.
1616 RM is the name of the program to use to delete files associated with each FILE
1617 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1618 to RM.
1620 If FILE is a libtool library, all the files associated with it are deleted.
1621 Otherwise, only FILE itself is deleted using RM."
1625 func_fatal_help "invalid operation mode \`$mode'"
1627 esac
1629 $ECHO
1630 $ECHO "Try \`$progname --help' for more information about other modes."
1632 exit $?
1635 # Now that we've collected a possible --mode arg, show help if necessary
1636 $opt_help && func_mode_help
1639 # func_mode_execute arg...
1640 func_mode_execute ()
1642 $opt_debug
1643 # The first argument is the command name.
1644 cmd="$nonopt"
1645 test -z "$cmd" && \
1646 func_fatal_help "you must specify a COMMAND"
1648 # Handle -dlopen flags immediately.
1649 for file in $execute_dlfiles; do
1650 test -f "$file" \
1651 || func_fatal_help "\`$file' is not a file"
1653 dir=
1654 case $file in
1655 *.la)
1656 # Check to see that this really is a libtool archive.
1657 func_lalib_unsafe_p "$file" \
1658 || func_fatal_help "\`$lib' is not a valid libtool archive"
1660 # Read the libtool library.
1661 dlname=
1662 library_names=
1663 func_source "$file"
1665 # Skip this library if it cannot be dlopened.
1666 if test -z "$dlname"; then
1667 # Warn if it was a shared library.
1668 test -n "$library_names" && \
1669 func_warning "\`$file' was not linked with \`-export-dynamic'"
1670 continue
1673 func_dirname "$file" "" "."
1674 dir="$func_dirname_result"
1676 if test -f "$dir/$objdir/$dlname"; then
1677 dir="$dir/$objdir"
1678 else
1679 if test ! -f "$dir/$dlname"; then
1680 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1685 *.lo)
1686 # Just add the directory containing the .lo file.
1687 func_dirname "$file" "" "."
1688 dir="$func_dirname_result"
1692 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1693 continue
1695 esac
1697 # Get the absolute pathname.
1698 absdir=`cd "$dir" && pwd`
1699 test -n "$absdir" && dir="$absdir"
1701 # Now add the directory to shlibpath_var.
1702 if eval "test -z \"\$$shlibpath_var\""; then
1703 eval "$shlibpath_var=\"\$dir\""
1704 else
1705 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1707 done
1709 # This variable tells wrapper scripts just to set shlibpath_var
1710 # rather than running their programs.
1711 libtool_execute_magic="$magic"
1713 # Check if any of the arguments is a wrapper script.
1714 args=
1715 for file
1717 case $file in
1718 -*) ;;
1720 # Do a test to see if this is really a libtool program.
1721 if func_ltwrapper_script_p "$file"; then
1722 func_source "$file"
1723 # Transform arg to wrapped name.
1724 file="$progdir/$program"
1725 elif func_ltwrapper_executable_p "$file"; then
1726 func_ltwrapper_scriptname "$file"
1727 func_source "$func_ltwrapper_scriptname_result"
1728 # Transform arg to wrapped name.
1729 file="$progdir/$program"
1732 esac
1733 # Quote arguments (to preserve shell metacharacters).
1734 func_quote_for_eval "$file"
1735 args="$args $func_quote_for_eval_result"
1736 done
1738 if test "X$opt_dry_run" = Xfalse; then
1739 if test -n "$shlibpath_var"; then
1740 # Export the shlibpath_var.
1741 eval "export $shlibpath_var"
1744 # Restore saved environment variables
1745 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1747 eval "if test \"\${save_$lt_var+set}\" = set; then
1748 $lt_var=\$save_$lt_var; export $lt_var
1749 else
1750 $lt_unset $lt_var
1752 done
1754 # Now prepare to actually exec the command.
1755 exec_cmd="\$cmd$args"
1756 else
1757 # Display what would be done.
1758 if test -n "$shlibpath_var"; then
1759 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1760 $ECHO "export $shlibpath_var"
1762 $ECHO "$cmd$args"
1763 exit $EXIT_SUCCESS
1767 test "$mode" = execute && func_mode_execute ${1+"$@"}
1770 # func_mode_finish arg...
1771 func_mode_finish ()
1773 $opt_debug
1774 libdirs="$nonopt"
1775 admincmds=
1777 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1778 for dir
1780 libdirs="$libdirs $dir"
1781 done
1783 for libdir in $libdirs; do
1784 if test -n "$finish_cmds"; then
1785 # Do each command in the finish commands.
1786 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1787 '"$cmd"'"'
1789 if test -n "$finish_eval"; then
1790 # Do the single finish_eval.
1791 eval cmds=\"$finish_eval\"
1792 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
1793 $cmds"
1795 done
1798 # Exit here if they wanted silent mode.
1799 $opt_silent && exit $EXIT_SUCCESS
1801 $ECHO "X----------------------------------------------------------------------" | $Xsed
1802 $ECHO "Libraries have been installed in:"
1803 for libdir in $libdirs; do
1804 $ECHO " $libdir"
1805 done
1806 $ECHO
1807 $ECHO "If you ever happen to want to link against installed libraries"
1808 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1809 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1810 $ECHO "flag during linking and do at least one of the following:"
1811 if test -n "$shlibpath_var"; then
1812 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
1813 $ECHO " during execution"
1815 if test -n "$runpath_var"; then
1816 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
1817 $ECHO " during linking"
1819 if test -n "$hardcode_libdir_flag_spec"; then
1820 libdir=LIBDIR
1821 eval flag=\"$hardcode_libdir_flag_spec\"
1823 $ECHO " - use the \`$flag' linker flag"
1825 if test -n "$admincmds"; then
1826 $ECHO " - have your system administrator run these commands:$admincmds"
1828 if test -f /etc/ld.so.conf; then
1829 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1831 $ECHO
1833 $ECHO "See any operating system documentation about shared libraries for"
1834 case $host in
1835 solaris2.[6789]|solaris2.1[0-9])
1836 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1837 $ECHO "pages."
1840 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1842 esac
1843 $ECHO "X----------------------------------------------------------------------" | $Xsed
1844 exit $EXIT_SUCCESS
1847 test "$mode" = finish && func_mode_finish ${1+"$@"}
1850 # func_mode_install arg...
1851 func_mode_install ()
1853 $opt_debug
1854 # There may be an optional sh(1) argument at the beginning of
1855 # install_prog (especially on Windows NT).
1856 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1857 # Allow the use of GNU shtool's install command.
1858 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
1859 # Aesthetically quote it.
1860 func_quote_for_eval "$nonopt"
1861 install_prog="$func_quote_for_eval_result "
1862 arg=$1
1863 shift
1864 else
1865 install_prog=
1866 arg=$nonopt
1869 # The real first argument should be the name of the installation program.
1870 # Aesthetically quote it.
1871 func_quote_for_eval "$arg"
1872 install_prog="$install_prog$func_quote_for_eval_result"
1874 # We need to accept at least all the BSD install flags.
1875 dest=
1876 files=
1877 opts=
1878 prev=
1879 install_type=
1880 isdir=no
1881 stripme=
1882 for arg
1884 if test -n "$dest"; then
1885 files="$files $dest"
1886 dest=$arg
1887 continue
1890 case $arg in
1891 -d) isdir=yes ;;
1893 case " $install_prog " in
1894 *[\\\ /]cp\ *) ;;
1895 *) prev=$arg ;;
1896 esac
1898 -g | -m | -o)
1899 prev=$arg
1902 stripme=" -s"
1903 continue
1908 # If the previous option needed an argument, then skip it.
1909 if test -n "$prev"; then
1910 prev=
1911 else
1912 dest=$arg
1913 continue
1916 esac
1918 # Aesthetically quote the argument.
1919 func_quote_for_eval "$arg"
1920 install_prog="$install_prog $func_quote_for_eval_result"
1921 done
1923 test -z "$install_prog" && \
1924 func_fatal_help "you must specify an install program"
1926 test -n "$prev" && \
1927 func_fatal_help "the \`$prev' option requires an argument"
1929 if test -z "$files"; then
1930 if test -z "$dest"; then
1931 func_fatal_help "no file or destination specified"
1932 else
1933 func_fatal_help "you must specify a destination"
1937 # Strip any trailing slash from the destination.
1938 func_stripname '' '/' "$dest"
1939 dest=$func_stripname_result
1941 # Check to see that the destination is a directory.
1942 test -d "$dest" && isdir=yes
1943 if test "$isdir" = yes; then
1944 destdir="$dest"
1945 destname=
1946 else
1947 func_dirname_and_basename "$dest" "" "."
1948 destdir="$func_dirname_result"
1949 destname="$func_basename_result"
1951 # Not a directory, so check to see that there is only one file specified.
1952 set dummy $files; shift
1953 test "$#" -gt 1 && \
1954 func_fatal_help "\`$dest' is not a directory"
1956 case $destdir in
1957 [\\/]* | [A-Za-z]:[\\/]*) ;;
1959 for file in $files; do
1960 case $file in
1961 *.lo) ;;
1963 func_fatal_help "\`$destdir' must be an absolute directory name"
1965 esac
1966 done
1968 esac
1970 # This variable tells wrapper scripts just to set variables rather
1971 # than running their programs.
1972 libtool_install_magic="$magic"
1974 staticlibs=
1975 future_libdirs=
1976 current_libdirs=
1977 for file in $files; do
1979 # Do each installation.
1980 case $file in
1981 *.$libext)
1982 # Do the static libraries later.
1983 staticlibs="$staticlibs $file"
1986 *.la)
1987 # Check to see that this really is a libtool archive.
1988 func_lalib_unsafe_p "$file" \
1989 || func_fatal_help "\`$file' is not a valid libtool archive"
1991 library_names=
1992 old_library=
1993 relink_command=
1994 func_source "$file"
1996 # Add the libdir to current_libdirs if it is the destination.
1997 if test "X$destdir" = "X$libdir"; then
1998 case "$current_libdirs " in
1999 *" $libdir "*) ;;
2000 *) current_libdirs="$current_libdirs $libdir" ;;
2001 esac
2002 else
2003 # Note the libdir as a future libdir.
2004 case "$future_libdirs " in
2005 *" $libdir "*) ;;
2006 *) future_libdirs="$future_libdirs $libdir" ;;
2007 esac
2010 func_dirname "$file" "/" ""
2011 dir="$func_dirname_result"
2012 dir="$dir$objdir"
2014 if test -n "$relink_command"; then
2015 # Determine the prefix the user has applied to our future dir.
2016 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2018 # Don't allow the user to place us outside of our expected
2019 # location b/c this prevents finding dependent libraries that
2020 # are installed to the same prefix.
2021 # At present, this check doesn't affect windows .dll's that
2022 # are installed into $libdir/../bin (currently, that works fine)
2023 # but it's something to keep an eye on.
2024 test "$inst_prefix_dir" = "$destdir" && \
2025 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2027 if test -n "$inst_prefix_dir"; then
2028 # Stick the inst_prefix_dir data into the link command.
2029 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2030 else
2031 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2034 func_warning "relinking \`$file'"
2035 func_show_eval "$relink_command" \
2036 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2039 # See the names of the shared library.
2040 set dummy $library_names; shift
2041 if test -n "$1"; then
2042 realname="$1"
2043 shift
2045 srcname="$realname"
2046 test -n "$relink_command" && srcname="$realname"T
2048 # Install the shared library and build the symlinks.
2049 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2050 'exit $?'
2051 tstripme="$stripme"
2052 case $host_os in
2053 cygwin* | mingw* | pw32* | cegcc*)
2054 case $realname in
2055 *.dll.a)
2056 tstripme=""
2058 esac
2060 esac
2061 if test -n "$tstripme" && test -n "$striplib"; then
2062 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2065 if test "$#" -gt 0; then
2066 # Delete the old symlinks, and create new ones.
2067 # Try `ln -sf' first, because the `ln' binary might depend on
2068 # the symlink we replace! Solaris /bin/ln does not understand -f,
2069 # so we also need to try rm && ln -s.
2070 for linkname
2072 test "$linkname" != "$realname" \
2073 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2074 done
2077 # Do each command in the postinstall commands.
2078 lib="$destdir/$realname"
2079 func_execute_cmds "$postinstall_cmds" 'exit $?'
2082 # Install the pseudo-library for information purposes.
2083 func_basename "$file"
2084 name="$func_basename_result"
2085 instname="$dir/$name"i
2086 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2088 # Maybe install the static library, too.
2089 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2092 *.lo)
2093 # Install (i.e. copy) a libtool object.
2095 # Figure out destination file name, if it wasn't already specified.
2096 if test -n "$destname"; then
2097 destfile="$destdir/$destname"
2098 else
2099 func_basename "$file"
2100 destfile="$func_basename_result"
2101 destfile="$destdir/$destfile"
2104 # Deduce the name of the destination old-style object file.
2105 case $destfile in
2106 *.lo)
2107 func_lo2o "$destfile"
2108 staticdest=$func_lo2o_result
2110 *.$objext)
2111 staticdest="$destfile"
2112 destfile=
2115 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2117 esac
2119 # Install the libtool object if requested.
2120 test -n "$destfile" && \
2121 func_show_eval "$install_prog $file $destfile" 'exit $?'
2123 # Install the old object if enabled.
2124 if test "$build_old_libs" = yes; then
2125 # Deduce the name of the old-style object file.
2126 func_lo2o "$file"
2127 staticobj=$func_lo2o_result
2128 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2130 exit $EXIT_SUCCESS
2134 # Figure out destination file name, if it wasn't already specified.
2135 if test -n "$destname"; then
2136 destfile="$destdir/$destname"
2137 else
2138 func_basename "$file"
2139 destfile="$func_basename_result"
2140 destfile="$destdir/$destfile"
2143 # If the file is missing, and there is a .exe on the end, strip it
2144 # because it is most likely a libtool script we actually want to
2145 # install
2146 stripped_ext=""
2147 case $file in
2148 *.exe)
2149 if test ! -f "$file"; then
2150 func_stripname '' '.exe' "$file"
2151 file=$func_stripname_result
2152 stripped_ext=".exe"
2155 esac
2157 # Do a test to see if this is really a libtool program.
2158 case $host in
2159 *cygwin* | *mingw*)
2160 if func_ltwrapper_executable_p "$file"; then
2161 func_ltwrapper_scriptname "$file"
2162 wrapper=$func_ltwrapper_scriptname_result
2163 else
2164 func_stripname '' '.exe' "$file"
2165 wrapper=$func_stripname_result
2169 wrapper=$file
2171 esac
2172 if func_ltwrapper_script_p "$wrapper"; then
2173 notinst_deplibs=
2174 relink_command=
2176 func_source "$wrapper"
2178 # Check the variables that should have been set.
2179 test -z "$generated_by_libtool_version" && \
2180 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2182 finalize=yes
2183 for lib in $notinst_deplibs; do
2184 # Check to see that each library is installed.
2185 libdir=
2186 if test -f "$lib"; then
2187 func_source "$lib"
2189 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2190 if test -n "$libdir" && test ! -f "$libfile"; then
2191 func_warning "\`$lib' has not been installed in \`$libdir'"
2192 finalize=no
2194 done
2196 relink_command=
2197 func_source "$wrapper"
2199 outputname=
2200 if test "$fast_install" = no && test -n "$relink_command"; then
2201 $opt_dry_run || {
2202 if test "$finalize" = yes; then
2203 tmpdir=`func_mktempdir`
2204 func_basename "$file$stripped_ext"
2205 file="$func_basename_result"
2206 outputname="$tmpdir/$file"
2207 # Replace the output file specification.
2208 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2210 $opt_silent || {
2211 func_quote_for_expand "$relink_command"
2212 eval "func_echo $func_quote_for_expand_result"
2214 if eval "$relink_command"; then :
2215 else
2216 func_error "error: relink \`$file' with the above command before installing it"
2217 $opt_dry_run || ${RM}r "$tmpdir"
2218 continue
2220 file="$outputname"
2221 else
2222 func_warning "cannot relink \`$file'"
2225 else
2226 # Install the binary that we compiled earlier.
2227 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2231 # remove .exe since cygwin /usr/bin/install will append another
2232 # one anyway
2233 case $install_prog,$host in
2234 */usr/bin/install*,*cygwin*)
2235 case $file:$destfile in
2236 *.exe:*.exe)
2237 # this is ok
2239 *.exe:*)
2240 destfile=$destfile.exe
2242 *:*.exe)
2243 func_stripname '' '.exe' "$destfile"
2244 destfile=$func_stripname_result
2246 esac
2248 esac
2249 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2250 $opt_dry_run || if test -n "$outputname"; then
2251 ${RM}r "$tmpdir"
2254 esac
2255 done
2257 for file in $staticlibs; do
2258 func_basename "$file"
2259 name="$func_basename_result"
2261 # Set up the ranlib parameters.
2262 oldlib="$destdir/$name"
2264 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2266 if test -n "$stripme" && test -n "$old_striplib"; then
2267 func_show_eval "$old_striplib $oldlib" 'exit $?'
2270 # Do each command in the postinstall commands.
2271 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2272 done
2274 test -n "$future_libdirs" && \
2275 func_warning "remember to run \`$progname --finish$future_libdirs'"
2277 if test -n "$current_libdirs"; then
2278 # Maybe just do a dry run.
2279 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2280 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2281 else
2282 exit $EXIT_SUCCESS
2286 test "$mode" = install && func_mode_install ${1+"$@"}
2289 # func_generate_dlsyms outputname originator pic_p
2290 # Extract symbols from dlprefiles and create ${outputname}S.o with
2291 # a dlpreopen symbol table.
2292 func_generate_dlsyms ()
2294 $opt_debug
2295 my_outputname="$1"
2296 my_originator="$2"
2297 my_pic_p="${3-no}"
2298 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2299 my_dlsyms=
2301 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2302 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2303 my_dlsyms="${my_outputname}S.c"
2304 else
2305 func_error "not configured to extract global symbols from dlpreopened files"
2309 if test -n "$my_dlsyms"; then
2310 case $my_dlsyms in
2311 "") ;;
2312 *.c)
2313 # Discover the nlist of each of the dlfiles.
2314 nlist="$output_objdir/${my_outputname}.nm"
2316 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2318 # Parse the name list into a source file.
2319 func_verbose "creating $output_objdir/$my_dlsyms"
2321 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2322 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2323 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2325 #ifdef __cplusplus
2326 extern \"C\" {
2327 #endif
2329 /* External symbol declarations for the compiler. */\
2332 if test "$dlself" = yes; then
2333 func_verbose "generating symbol list for \`$output'"
2335 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2337 # Add our own program objects to the symbol list.
2338 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2339 for progfile in $progfiles; do
2340 func_verbose "extracting global C symbols from \`$progfile'"
2341 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2342 done
2344 if test -n "$exclude_expsyms"; then
2345 $opt_dry_run || {
2346 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2347 eval '$MV "$nlist"T "$nlist"'
2351 if test -n "$export_symbols_regex"; then
2352 $opt_dry_run || {
2353 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2354 eval '$MV "$nlist"T "$nlist"'
2358 # Prepare the list of exported symbols
2359 if test -z "$export_symbols"; then
2360 export_symbols="$output_objdir/$outputname.exp"
2361 $opt_dry_run || {
2362 $RM $export_symbols
2363 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2364 case $host in
2365 *cygwin* | *mingw* | *cegcc* )
2366 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2367 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2369 esac
2371 else
2372 $opt_dry_run || {
2373 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2374 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2375 eval '$MV "$nlist"T "$nlist"'
2376 case $host in
2377 *cygwin | *mingw* | *cegcc* )
2378 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2379 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2381 esac
2386 for dlprefile in $dlprefiles; do
2387 func_verbose "extracting global C symbols from \`$dlprefile'"
2388 func_basename "$dlprefile"
2389 name="$func_basename_result"
2390 $opt_dry_run || {
2391 eval '$ECHO ": $name " >> "$nlist"'
2392 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2394 done
2396 $opt_dry_run || {
2397 # Make sure we have at least an empty file.
2398 test -f "$nlist" || : > "$nlist"
2400 if test -n "$exclude_expsyms"; then
2401 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2402 $MV "$nlist"T "$nlist"
2405 # Try sorting and uniquifying the output.
2406 if $GREP -v "^: " < "$nlist" |
2407 if sort -k 3 </dev/null >/dev/null 2>&1; then
2408 sort -k 3
2409 else
2410 sort +2
2411 fi |
2412 uniq > "$nlist"S; then
2414 else
2415 $GREP -v "^: " < "$nlist" > "$nlist"S
2418 if test -f "$nlist"S; then
2419 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2420 else
2421 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2424 $ECHO >> "$output_objdir/$my_dlsyms" "\
2426 /* The mapping between symbol names and symbols. */
2427 typedef struct {
2428 const char *name;
2429 void *address;
2430 } lt_dlsymlist;
2432 case $host in
2433 *cygwin* | *mingw* | *cegcc* )
2434 $ECHO >> "$output_objdir/$my_dlsyms" "\
2435 /* DATA imports from DLLs on WIN32 con't be const, because
2436 runtime relocations are performed -- see ld's documentation
2437 on pseudo-relocs. */"
2438 lt_dlsym_const= ;;
2439 *osf5*)
2440 echo >> "$output_objdir/$my_dlsyms" "\
2441 /* This system does not cope well with relocations in const data */"
2442 lt_dlsym_const= ;;
2444 lt_dlsym_const=const ;;
2445 esac
2447 $ECHO >> "$output_objdir/$my_dlsyms" "\
2448 extern $lt_dlsym_const lt_dlsymlist
2449 lt_${my_prefix}_LTX_preloaded_symbols[];
2450 $lt_dlsym_const lt_dlsymlist
2451 lt_${my_prefix}_LTX_preloaded_symbols[] =
2453 { \"$my_originator\", (void *) 0 },"
2455 case $need_lib_prefix in
2457 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2460 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2462 esac
2463 $ECHO >> "$output_objdir/$my_dlsyms" "\
2464 {0, (void *) 0}
2467 /* This works around a problem in FreeBSD linker */
2468 #ifdef FREEBSD_WORKAROUND
2469 static const void *lt_preloaded_setup() {
2470 return lt_${my_prefix}_LTX_preloaded_symbols;
2472 #endif
2474 #ifdef __cplusplus
2476 #endif\
2478 } # !$opt_dry_run
2480 pic_flag_for_symtable=
2481 case "$compile_command " in
2482 *" -static "*) ;;
2484 case $host in
2485 # compiling the symbol table file with pic_flag works around
2486 # a FreeBSD bug that causes programs to crash when -lm is
2487 # linked before any other PIC object. But we must not use
2488 # pic_flag when linking with -static. The problem exists in
2489 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2490 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2491 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2492 *-*-hpux*)
2493 pic_flag_for_symtable=" $pic_flag" ;;
2495 if test "X$my_pic_p" != Xno; then
2496 pic_flag_for_symtable=" $pic_flag"
2499 esac
2501 esac
2502 symtab_cflags=
2503 for arg in $LTCFLAGS; do
2504 case $arg in
2505 -pie | -fpie | -fPIE) ;;
2506 *) symtab_cflags="$symtab_cflags $arg" ;;
2507 esac
2508 done
2510 # Now compile the dynamic symbol file.
2511 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2513 # Clean up the generated files.
2514 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2516 # Transform the symbol file into the correct name.
2517 symfileobj="$output_objdir/${my_outputname}S.$objext"
2518 case $host in
2519 *cygwin* | *mingw* | *cegcc* )
2520 if test -f "$output_objdir/$my_outputname.def"; then
2521 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2522 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2523 else
2524 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2525 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2529 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2530 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2532 esac
2535 func_fatal_error "unknown suffix for \`$my_dlsyms'"
2537 esac
2538 else
2539 # We keep going just in case the user didn't refer to
2540 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2541 # really was required.
2543 # Nullify the symbol file.
2544 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2545 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2549 # func_win32_libid arg
2550 # return the library type of file 'arg'
2552 # Need a lot of goo to handle *both* DLLs and import libs
2553 # Has to be a shell function in order to 'eat' the argument
2554 # that is supplied when $file_magic_command is called.
2555 func_win32_libid ()
2557 $opt_debug
2558 win32_libid_type="unknown"
2559 win32_fileres=`file -L $1 2>/dev/null`
2560 case $win32_fileres in
2561 *ar\ archive\ import\ library*) # definitely import
2562 win32_libid_type="x86 archive import"
2564 *ar\ archive*) # could be an import, or static
2565 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2566 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
2567 win32_nmres=`eval $NM -f posix -A $1 |
2568 $SED -n -e '
2569 1,100{
2570 / I /{
2571 s,.*,import,
2576 case $win32_nmres in
2577 import*) win32_libid_type="x86 archive import";;
2578 *) win32_libid_type="x86 archive static";;
2579 esac
2582 *DLL*)
2583 win32_libid_type="x86 DLL"
2585 *executable*) # but shell scripts are "executable" too...
2586 case $win32_fileres in
2587 *MS\ Windows\ PE\ Intel*)
2588 win32_libid_type="x86 DLL"
2590 esac
2592 esac
2593 $ECHO "$win32_libid_type"
2598 # func_extract_an_archive dir oldlib
2599 func_extract_an_archive ()
2601 $opt_debug
2602 f_ex_an_ar_dir="$1"; shift
2603 f_ex_an_ar_oldlib="$1"
2604 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
2605 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2607 else
2608 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2613 # func_extract_archives gentop oldlib ...
2614 func_extract_archives ()
2616 $opt_debug
2617 my_gentop="$1"; shift
2618 my_oldlibs=${1+"$@"}
2619 my_oldobjs=""
2620 my_xlib=""
2621 my_xabs=""
2622 my_xdir=""
2624 for my_xlib in $my_oldlibs; do
2625 # Extract the objects.
2626 case $my_xlib in
2627 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2628 *) my_xabs=`pwd`"/$my_xlib" ;;
2629 esac
2630 func_basename "$my_xlib"
2631 my_xlib="$func_basename_result"
2632 my_xlib_u=$my_xlib
2633 while :; do
2634 case " $extracted_archives " in
2635 *" $my_xlib_u "*)
2636 func_arith $extracted_serial + 1
2637 extracted_serial=$func_arith_result
2638 my_xlib_u=lt$extracted_serial-$my_xlib ;;
2639 *) break ;;
2640 esac
2641 done
2642 extracted_archives="$extracted_archives $my_xlib_u"
2643 my_xdir="$my_gentop/$my_xlib_u"
2645 func_mkdir_p "$my_xdir"
2647 case $host in
2648 *-darwin*)
2649 func_verbose "Extracting $my_xabs"
2650 # Do not bother doing anything if just a dry run
2651 $opt_dry_run || {
2652 darwin_orig_dir=`pwd`
2653 cd $my_xdir || exit $?
2654 darwin_archive=$my_xabs
2655 darwin_curdir=`pwd`
2656 darwin_base_archive=`basename "$darwin_archive"`
2657 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2658 if test -n "$darwin_arches"; then
2659 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2660 darwin_arch=
2661 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2662 for darwin_arch in $darwin_arches ; do
2663 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2664 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2665 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2666 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2667 cd "$darwin_curdir"
2668 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2669 done # $darwin_arches
2670 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
2671 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
2672 darwin_file=
2673 darwin_files=
2674 for darwin_file in $darwin_filelist; do
2675 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
2676 $LIPO -create -output "$darwin_file" $darwin_files
2677 done # $darwin_filelist
2678 $RM -rf unfat-$$
2679 cd "$darwin_orig_dir"
2680 else
2681 cd $darwin_orig_dir
2682 func_extract_an_archive "$my_xdir" "$my_xabs"
2683 fi # $darwin_arches
2684 } # !$opt_dry_run
2687 func_extract_an_archive "$my_xdir" "$my_xabs"
2689 esac
2690 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2691 done
2693 func_extract_archives_result="$my_oldobjs"
2698 # func_emit_wrapper_part1 [arg=no]
2700 # Emit the first part of a libtool wrapper script on stdout.
2701 # For more information, see the description associated with
2702 # func_emit_wrapper(), below.
2703 func_emit_wrapper_part1 ()
2705 func_emit_wrapper_part1_arg1=no
2706 if test -n "$1" ; then
2707 func_emit_wrapper_part1_arg1=$1
2710 $ECHO "\
2711 #! $SHELL
2713 # $output - temporary wrapper script for $objdir/$outputname
2714 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2716 # The $output program cannot be directly executed until all the libtool
2717 # libraries that it depends on are installed.
2719 # This wrapper script should never be moved out of the build directory.
2720 # If it is, it will not operate correctly.
2722 # Sed substitution that helps us do robust quoting. It backslashifies
2723 # metacharacters that are still active within double-quoted strings.
2724 Xsed='${SED} -e 1s/^X//'
2725 sed_quote_subst='$sed_quote_subst'
2727 # Be Bourne compatible
2728 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2729 emulate sh
2730 NULLCMD=:
2731 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2732 # is contrary to our usage. Disable this feature.
2733 alias -g '\${1+\"\$@\"}'='\"\$@\"'
2734 setopt NO_GLOB_SUBST
2735 else
2736 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2738 BIN_SH=xpg4; export BIN_SH # for Tru64
2739 DUALCASE=1; export DUALCASE # for MKS sh
2741 # The HP-UX ksh and POSIX shell print the target directory to stdout
2742 # if CDPATH is set.
2743 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2745 relink_command=\"$relink_command\"
2747 # This environment variable determines our operation mode.
2748 if test \"\$libtool_install_magic\" = \"$magic\"; then
2749 # install mode needs the following variables:
2750 generated_by_libtool_version='$macro_version'
2751 notinst_deplibs='$notinst_deplibs'
2752 else
2753 # When we are sourced in execute mode, \$file and \$ECHO are already set.
2754 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2755 ECHO=\"$qecho\"
2756 file=\"\$0\"
2757 # Make sure echo works.
2758 if test \"X\$1\" = X--no-reexec; then
2759 # Discard the --no-reexec flag, and continue.
2760 shift
2761 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2762 # Yippee, \$ECHO works!
2764 else
2765 # Restart under the correct shell, and then maybe \$ECHO will work.
2766 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2770 $ECHO "\
2772 # Find the directory that this script lives in.
2773 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2774 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2776 # Follow symbolic links until we get to the real thisdir.
2777 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2778 while test -n \"\$file\"; do
2779 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2781 # If there was a directory component, then change thisdir.
2782 if test \"x\$destdir\" != \"x\$file\"; then
2783 case \"\$destdir\" in
2784 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2785 *) thisdir=\"\$thisdir/\$destdir\" ;;
2786 esac
2789 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2790 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2791 done
2794 # end: func_emit_wrapper_part1
2796 # func_emit_wrapper_part2 [arg=no]
2798 # Emit the second part of a libtool wrapper script on stdout.
2799 # For more information, see the description associated with
2800 # func_emit_wrapper(), below.
2801 func_emit_wrapper_part2 ()
2803 func_emit_wrapper_part2_arg1=no
2804 if test -n "$1" ; then
2805 func_emit_wrapper_part2_arg1=$1
2808 $ECHO "\
2810 # Usually 'no', except on cygwin/mingw when embedded into
2811 # the cwrapper.
2812 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
2813 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2814 # special case for '.'
2815 if test \"\$thisdir\" = \".\"; then
2816 thisdir=\`pwd\`
2818 # remove .libs from thisdir
2819 case \"\$thisdir\" in
2820 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
2821 $objdir ) thisdir=. ;;
2822 esac
2825 # Try to get the absolute directory name.
2826 absdir=\`cd \"\$thisdir\" && pwd\`
2827 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2830 if test "$fast_install" = yes; then
2831 $ECHO "\
2832 program=lt-'$outputname'$exeext
2833 progdir=\"\$thisdir/$objdir\"
2835 if test ! -f \"\$progdir/\$program\" ||
2836 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2837 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2839 file=\"\$\$-\$program\"
2841 if test ! -d \"\$progdir\"; then
2842 $MKDIR \"\$progdir\"
2843 else
2844 $RM \"\$progdir/\$file\"
2847 $ECHO "\
2849 # relink executable if necessary
2850 if test -n \"\$relink_command\"; then
2851 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2852 else
2853 $ECHO \"\$relink_command_output\" >&2
2854 $RM \"\$progdir/\$file\"
2855 exit 1
2859 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2860 { $RM \"\$progdir/\$program\";
2861 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2862 $RM \"\$progdir/\$file\"
2864 else
2865 $ECHO "\
2866 program='$outputname'
2867 progdir=\"\$thisdir/$objdir\"
2871 $ECHO "\
2873 if test -f \"\$progdir/\$program\"; then"
2875 # Export our shlibpath_var if we have one.
2876 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2877 $ECHO "\
2878 # Add our own library path to $shlibpath_var
2879 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2881 # Some systems cannot cope with colon-terminated $shlibpath_var
2882 # The second colon is a workaround for a bug in BeOS R4 sed
2883 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2885 export $shlibpath_var
2889 # fixup the dll searchpath if we need to.
2890 if test -n "$dllsearchpath"; then
2891 $ECHO "\
2892 # Add the dll search path components to the executable PATH
2893 PATH=$dllsearchpath:\$PATH
2897 $ECHO "\
2898 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2899 # Run the actual program with our arguments.
2901 case $host in
2902 # Backslashes separate directories on plain windows
2903 *-*-mingw | *-*-os2* | *-cegcc*)
2904 $ECHO "\
2905 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
2910 $ECHO "\
2911 exec \"\$progdir/\$program\" \${1+\"\$@\"}
2914 esac
2915 $ECHO "\
2916 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
2917 exit 1
2919 else
2920 # The program doesn't exist.
2921 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
2922 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
2923 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
2924 exit 1
2929 # end: func_emit_wrapper_part2
2932 # func_emit_wrapper [arg=no]
2934 # Emit a libtool wrapper script on stdout.
2935 # Don't directly open a file because we may want to
2936 # incorporate the script contents within a cygwin/mingw
2937 # wrapper executable. Must ONLY be called from within
2938 # func_mode_link because it depends on a number of variables
2939 # set therein.
2941 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2942 # variable will take. If 'yes', then the emitted script
2943 # will assume that the directory in which it is stored is
2944 # the $objdir directory. This is a cygwin/mingw-specific
2945 # behavior.
2946 func_emit_wrapper ()
2948 func_emit_wrapper_arg1=no
2949 if test -n "$1" ; then
2950 func_emit_wrapper_arg1=$1
2953 # split this up so that func_emit_cwrapperexe_src
2954 # can call each part independently.
2955 func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
2956 func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
2960 # func_to_host_path arg
2962 # Convert paths to host format when used with build tools.
2963 # Intended for use with "native" mingw (where libtool itself
2964 # is running under the msys shell), or in the following cross-
2965 # build environments:
2966 # $build $host
2967 # mingw (msys) mingw [e.g. native]
2968 # cygwin mingw
2969 # *nix + wine mingw
2970 # where wine is equipped with the `winepath' executable.
2971 # In the native mingw case, the (msys) shell automatically
2972 # converts paths for any non-msys applications it launches,
2973 # but that facility isn't available from inside the cwrapper.
2974 # Similar accommodations are necessary for $host mingw and
2975 # $build cygwin. Calling this function does no harm for other
2976 # $host/$build combinations not listed above.
2978 # ARG is the path (on $build) that should be converted to
2979 # the proper representation for $host. The result is stored
2980 # in $func_to_host_path_result.
2981 func_to_host_path ()
2983 func_to_host_path_result="$1"
2984 if test -n "$1" ; then
2985 case $host in
2986 *mingw* )
2987 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
2988 case $build in
2989 *mingw* ) # actually, msys
2990 # awkward: cmd appends spaces to result
2991 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
2992 func_to_host_path_tmp1=`( cmd //c echo "$1" |\
2993 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
2994 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
2995 $SED -e "$lt_sed_naive_backslashify"`
2997 *cygwin* )
2998 func_to_host_path_tmp1=`cygpath -w "$1"`
2999 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3000 $SED -e "$lt_sed_naive_backslashify"`
3003 # Unfortunately, winepath does not exit with a non-zero
3004 # error code, so we are forced to check the contents of
3005 # stdout. On the other hand, if the command is not
3006 # found, the shell will set an exit code of 127 and print
3007 # *an error message* to stdout. So we must check for both
3008 # error code of zero AND non-empty stdout, which explains
3009 # the odd construction:
3010 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3011 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3012 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3013 $SED -e "$lt_sed_naive_backslashify"`
3014 else
3015 # Allow warning below.
3016 func_to_host_path_result=""
3019 esac
3020 if test -z "$func_to_host_path_result" ; then
3021 func_error "Could not determine host path corresponding to"
3022 func_error " '$1'"
3023 func_error "Continuing, but uninstalled executables may not work."
3024 # Fallback:
3025 func_to_host_path_result="$1"
3028 esac
3031 # end: func_to_host_path
3033 # func_to_host_pathlist arg
3035 # Convert pathlists to host format when used with build tools.
3036 # See func_to_host_path(), above. This function supports the
3037 # following $build/$host combinations (but does no harm for
3038 # combinations not listed here):
3039 # $build $host
3040 # mingw (msys) mingw [e.g. native]
3041 # cygwin mingw
3042 # *nix + wine mingw
3044 # Path separators are also converted from $build format to
3045 # $host format. If ARG begins or ends with a path separator
3046 # character, it is preserved (but converted to $host format)
3047 # on output.
3049 # ARG is a pathlist (on $build) that should be converted to
3050 # the proper representation on $host. The result is stored
3051 # in $func_to_host_pathlist_result.
3052 func_to_host_pathlist ()
3054 func_to_host_pathlist_result="$1"
3055 if test -n "$1" ; then
3056 case $host in
3057 *mingw* )
3058 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3059 # Remove leading and trailing path separator characters from
3060 # ARG. msys behavior is inconsistent here, cygpath turns them
3061 # into '.;' and ';.', and winepath ignores them completely.
3062 func_to_host_pathlist_tmp2="$1"
3063 # Once set for this call, this variable should not be
3064 # reassigned. It is used in tha fallback case.
3065 func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
3066 $SED -e 's|^:*||' -e 's|:*$||'`
3067 case $build in
3068 *mingw* ) # Actually, msys.
3069 # Awkward: cmd appends spaces to result.
3070 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3071 func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
3072 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3073 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3074 $SED -e "$lt_sed_naive_backslashify"`
3076 *cygwin* )
3077 func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
3078 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3079 $SED -e "$lt_sed_naive_backslashify"`
3082 # unfortunately, winepath doesn't convert pathlists
3083 func_to_host_pathlist_result=""
3084 func_to_host_pathlist_oldIFS=$IFS
3085 IFS=:
3086 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3087 IFS=$func_to_host_pathlist_oldIFS
3088 if test -n "$func_to_host_pathlist_f" ; then
3089 func_to_host_path "$func_to_host_pathlist_f"
3090 if test -n "$func_to_host_path_result" ; then
3091 if test -z "$func_to_host_pathlist_result" ; then
3092 func_to_host_pathlist_result="$func_to_host_path_result"
3093 else
3094 func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
3098 IFS=:
3099 done
3100 IFS=$func_to_host_pathlist_oldIFS
3102 esac
3103 if test -z "$func_to_host_pathlist_result" ; then
3104 func_error "Could not determine the host path(s) corresponding to"
3105 func_error " '$1'"
3106 func_error "Continuing, but uninstalled executables may not work."
3107 # Fallback. This may break if $1 contains DOS-style drive
3108 # specifications. The fix is not to complicate the expression
3109 # below, but for the user to provide a working wine installation
3110 # with winepath so that path translation in the cross-to-mingw
3111 # case works properly.
3112 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3113 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3114 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3116 # Now, add the leading and trailing path separators back
3117 case "$1" in
3118 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3120 esac
3121 case "$1" in
3122 *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
3124 esac
3126 esac
3129 # end: func_to_host_pathlist
3131 # func_emit_cwrapperexe_src
3132 # emit the source code for a wrapper executable on stdout
3133 # Must ONLY be called from within func_mode_link because
3134 # it depends on a number of variable set therein.
3135 func_emit_cwrapperexe_src ()
3137 cat <<EOF
3139 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3140 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3142 The $output program cannot be directly executed until all the libtool
3143 libraries that it depends on are installed.
3145 This wrapper executable should never be moved out of the build directory.
3146 If it is, it will not operate correctly.
3148 Currently, it simply execs the wrapper *script* "$SHELL $output",
3149 but could eventually absorb all of the scripts functionality and
3150 exec $objdir/$outputname directly.
3153 cat <<"EOF"
3154 #include <stdio.h>
3155 #include <stdlib.h>
3156 #ifdef _MSC_VER
3157 # include <direct.h>
3158 # include <process.h>
3159 # include <io.h>
3160 # define setmode _setmode
3161 #else
3162 # include <unistd.h>
3163 # include <stdint.h>
3164 # ifdef __CYGWIN__
3165 # include <io.h>
3166 # define HAVE_SETENV
3167 # ifdef __STRICT_ANSI__
3168 char *realpath (const char *, char *);
3169 int putenv (char *);
3170 int setenv (const char *, const char *, int);
3171 # endif
3172 # endif
3173 #endif
3174 #include <malloc.h>
3175 #include <stdarg.h>
3176 #include <assert.h>
3177 #include <string.h>
3178 #include <ctype.h>
3179 #include <errno.h>
3180 #include <fcntl.h>
3181 #include <sys/stat.h>
3183 #if defined(PATH_MAX)
3184 # define LT_PATHMAX PATH_MAX
3185 #elif defined(MAXPATHLEN)
3186 # define LT_PATHMAX MAXPATHLEN
3187 #else
3188 # define LT_PATHMAX 1024
3189 #endif
3191 #ifndef S_IXOTH
3192 # define S_IXOTH 0
3193 #endif
3194 #ifndef S_IXGRP
3195 # define S_IXGRP 0
3196 #endif
3198 #ifdef _MSC_VER
3199 # define S_IXUSR _S_IEXEC
3200 # define stat _stat
3201 # ifndef _INTPTR_T_DEFINED
3202 # define intptr_t int
3203 # endif
3204 #endif
3206 #ifndef DIR_SEPARATOR
3207 # define DIR_SEPARATOR '/'
3208 # define PATH_SEPARATOR ':'
3209 #endif
3211 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3212 defined (__OS2__)
3213 # define HAVE_DOS_BASED_FILE_SYSTEM
3214 # define FOPEN_WB "wb"
3215 # ifndef DIR_SEPARATOR_2
3216 # define DIR_SEPARATOR_2 '\\'
3217 # endif
3218 # ifndef PATH_SEPARATOR_2
3219 # define PATH_SEPARATOR_2 ';'
3220 # endif
3221 #endif
3223 #ifndef DIR_SEPARATOR_2
3224 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3225 #else /* DIR_SEPARATOR_2 */
3226 # define IS_DIR_SEPARATOR(ch) \
3227 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3228 #endif /* DIR_SEPARATOR_2 */
3230 #ifndef PATH_SEPARATOR_2
3231 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3232 #else /* PATH_SEPARATOR_2 */
3233 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3234 #endif /* PATH_SEPARATOR_2 */
3236 #ifdef __CYGWIN__
3237 # define FOPEN_WB "wb"
3238 #endif
3240 #ifndef FOPEN_WB
3241 # define FOPEN_WB "w"
3242 #endif
3243 #ifndef _O_BINARY
3244 # define _O_BINARY 0
3245 #endif
3247 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3248 #define XFREE(stale) do { \
3249 if (stale) { free ((void *) stale); stale = 0; } \
3250 } while (0)
3252 #undef LTWRAPPER_DEBUGPRINTF
3253 #if defined DEBUGWRAPPER
3254 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3255 static void
3256 ltwrapper_debugprintf (const char *fmt, ...)
3258 va_list args;
3259 va_start (args, fmt);
3260 (void) vfprintf (stderr, fmt, args);
3261 va_end (args);
3263 #else
3264 # define LTWRAPPER_DEBUGPRINTF(args)
3265 #endif
3267 const char *program_name = NULL;
3269 void *xmalloc (size_t num);
3270 char *xstrdup (const char *string);
3271 const char *base_name (const char *name);
3272 char *find_executable (const char *wrapper);
3273 char *chase_symlinks (const char *pathspec);
3274 int make_executable (const char *path);
3275 int check_executable (const char *path);
3276 char *strendzap (char *str, const char *pat);
3277 void lt_fatal (const char *message, ...);
3278 void lt_setenv (const char *name, const char *value);
3279 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3280 void lt_opt_process_env_set (const char *arg);
3281 void lt_opt_process_env_prepend (const char *arg);
3282 void lt_opt_process_env_append (const char *arg);
3283 int lt_split_name_value (const char *arg, char** name, char** value);
3284 void lt_update_exe_path (const char *name, const char *value);
3285 void lt_update_lib_path (const char *name, const char *value);
3287 static const char *script_text_part1 =
3290 func_emit_wrapper_part1 yes |
3291 $SED -e 's/\([\\"]\)/\\\1/g' \
3292 -e 's/^/ "/' -e 's/$/\\n"/'
3293 echo ";"
3294 cat <<EOF
3296 static const char *script_text_part2 =
3298 func_emit_wrapper_part2 yes |
3299 $SED -e 's/\([\\"]\)/\\\1/g' \
3300 -e 's/^/ "/' -e 's/$/\\n"/'
3301 echo ";"
3303 cat <<EOF
3304 const char * MAGIC_EXE = "$magic_exe";
3305 const char * LIB_PATH_VARNAME = "$shlibpath_var";
3308 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3309 func_to_host_pathlist "$temp_rpath"
3310 cat <<EOF
3311 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
3313 else
3314 cat <<"EOF"
3315 const char * LIB_PATH_VALUE = "";
3319 if test -n "$dllsearchpath"; then
3320 func_to_host_pathlist "$dllsearchpath:"
3321 cat <<EOF
3322 const char * EXE_PATH_VARNAME = "PATH";
3323 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
3325 else
3326 cat <<"EOF"
3327 const char * EXE_PATH_VARNAME = "";
3328 const char * EXE_PATH_VALUE = "";
3332 if test "$fast_install" = yes; then
3333 cat <<EOF
3334 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3336 else
3337 cat <<EOF
3338 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3343 cat <<"EOF"
3345 #define LTWRAPPER_OPTION_PREFIX "--lt-"
3346 #define LTWRAPPER_OPTION_PREFIX_LENGTH 5
3348 static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
3349 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3351 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
3353 static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
3354 static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
3355 /* argument is putenv-style "foo=bar", value of foo is set to bar */
3357 static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
3358 static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
3359 /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
3361 static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
3362 static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
3363 /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
3366 main (int argc, char *argv[])
3368 char **newargz;
3369 int newargc;
3370 char *tmp_pathspec;
3371 char *actual_cwrapper_path;
3372 char *actual_cwrapper_name;
3373 char *target_name;
3374 char *lt_argv_zero;
3375 intptr_t rval = 127;
3377 int i;
3379 program_name = (char *) xstrdup (base_name (argv[0]));
3380 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3381 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3383 /* very simple arg parsing; don't want to rely on getopt */
3384 for (i = 1; i < argc; i++)
3386 if (strcmp (argv[i], dumpscript_opt) == 0)
3389 case "$host" in
3390 *mingw* | *cygwin* )
3391 # make stdout use "unix" line endings
3392 echo " setmode(1,_O_BINARY);"
3394 esac
3396 cat <<"EOF"
3397 printf ("%s", script_text_part1);
3398 printf ("%s", script_text_part2);
3399 return 0;
3403 newargz = XMALLOC (char *, argc + 1);
3404 tmp_pathspec = find_executable (argv[0]);
3405 if (tmp_pathspec == NULL)
3406 lt_fatal ("Couldn't find %s", argv[0]);
3407 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3408 tmp_pathspec));
3410 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3411 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3412 actual_cwrapper_path));
3413 XFREE (tmp_pathspec);
3415 actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
3416 strendzap (actual_cwrapper_path, actual_cwrapper_name);
3418 /* wrapper name transforms */
3419 strendzap (actual_cwrapper_name, ".exe");
3420 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3421 XFREE (actual_cwrapper_name);
3422 actual_cwrapper_name = tmp_pathspec;
3423 tmp_pathspec = 0;
3425 /* target_name transforms -- use actual target program name; might have lt- prefix */
3426 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3427 strendzap (target_name, ".exe");
3428 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3429 XFREE (target_name);
3430 target_name = tmp_pathspec;
3431 tmp_pathspec = 0;
3433 LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
3434 target_name));
3437 cat <<EOF
3438 newargz[0] =
3439 XMALLOC (char, (strlen (actual_cwrapper_path) +
3440 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3441 strcpy (newargz[0], actual_cwrapper_path);
3442 strcat (newargz[0], "$objdir");
3443 strcat (newargz[0], "/");
3446 cat <<"EOF"
3447 /* stop here, and copy so we don't have to do this twice */
3448 tmp_pathspec = xstrdup (newargz[0]);
3450 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3451 strcat (newargz[0], actual_cwrapper_name);
3453 /* DO want the lt- prefix here if it exists, so use target_name */
3454 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3455 XFREE (tmp_pathspec);
3456 tmp_pathspec = NULL;
3459 case $host_os in
3460 mingw*)
3461 cat <<"EOF"
3463 char* p;
3464 while ((p = strchr (newargz[0], '\\')) != NULL)
3466 *p = '/';
3468 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
3470 *p = '/';
3475 esac
3477 cat <<"EOF"
3478 XFREE (target_name);
3479 XFREE (actual_cwrapper_path);
3480 XFREE (actual_cwrapper_name);
3482 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3483 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
3484 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3485 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3487 newargc=0;
3488 for (i = 1; i < argc; i++)
3490 if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
3492 if (argv[i][env_set_opt_len] == '=')
3494 const char *p = argv[i] + env_set_opt_len + 1;
3495 lt_opt_process_env_set (p);
3497 else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
3499 lt_opt_process_env_set (argv[++i]); /* don't copy */
3501 else
3502 lt_fatal ("%s missing required argument", env_set_opt);
3503 continue;
3505 if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
3507 if (argv[i][env_prepend_opt_len] == '=')
3509 const char *p = argv[i] + env_prepend_opt_len + 1;
3510 lt_opt_process_env_prepend (p);
3512 else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
3514 lt_opt_process_env_prepend (argv[++i]); /* don't copy */
3516 else
3517 lt_fatal ("%s missing required argument", env_prepend_opt);
3518 continue;
3520 if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
3522 if (argv[i][env_append_opt_len] == '=')
3524 const char *p = argv[i] + env_append_opt_len + 1;
3525 lt_opt_process_env_append (p);
3527 else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
3529 lt_opt_process_env_append (argv[++i]); /* don't copy */
3531 else
3532 lt_fatal ("%s missing required argument", env_append_opt);
3533 continue;
3535 if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
3537 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
3538 namespace, but it is not one of the ones we know about and
3539 have already dealt with, above (inluding dump-script), then
3540 report an error. Otherwise, targets might begin to believe
3541 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
3542 namespace. The first time any user complains about this, we'll
3543 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
3544 or a configure.ac-settable value.
3546 lt_fatal ("Unrecognized option in %s namespace: '%s'",
3547 ltwrapper_option_prefix, argv[i]);
3549 /* otherwise ... */
3550 newargz[++newargc] = xstrdup (argv[i]);
3552 newargz[++newargc] = NULL;
3554 LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
3555 for (i = 0; i < newargc; i++)
3557 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
3562 case $host_os in
3563 mingw*)
3564 cat <<"EOF"
3565 /* execv doesn't actually work on mingw as expected on unix */
3566 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
3567 if (rval == -1)
3569 /* failed to start process */
3570 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
3571 return 127;
3573 return rval;
3577 cat <<"EOF"
3578 execv (lt_argv_zero, newargz);
3579 return rval; /* =127, but avoids unused variable warning */
3582 esac
3584 cat <<"EOF"
3587 void *
3588 xmalloc (size_t num)
3590 void *p = (void *) malloc (num);
3591 if (!p)
3592 lt_fatal ("Memory exhausted");
3594 return p;
3597 char *
3598 xstrdup (const char *string)
3600 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3601 string) : NULL;
3604 const char *
3605 base_name (const char *name)
3607 const char *base;
3609 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3610 /* Skip over the disk name in MSDOS pathnames. */
3611 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3612 name += 2;
3613 #endif
3615 for (base = name; *name; name++)
3616 if (IS_DIR_SEPARATOR (*name))
3617 base = name + 1;
3618 return base;
3622 check_executable (const char *path)
3624 struct stat st;
3626 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
3627 path ? (*path ? path : "EMPTY!") : "NULL!"));
3628 if ((!path) || (!*path))
3629 return 0;
3631 if ((stat (path, &st) >= 0)
3632 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3633 return 1;
3634 else
3635 return 0;
3639 make_executable (const char *path)
3641 int rval = 0;
3642 struct stat st;
3644 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
3645 path ? (*path ? path : "EMPTY!") : "NULL!"));
3646 if ((!path) || (!*path))
3647 return 0;
3649 if (stat (path, &st) >= 0)
3651 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3653 return rval;
3656 /* Searches for the full path of the wrapper. Returns
3657 newly allocated full path name if found, NULL otherwise
3658 Does not chase symlinks, even on platforms that support them.
3660 char *
3661 find_executable (const char *wrapper)
3663 int has_slash = 0;
3664 const char *p;
3665 const char *p_next;
3666 /* static buffer for getcwd */
3667 char tmp[LT_PATHMAX + 1];
3668 int tmp_len;
3669 char *concat_name;
3671 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
3672 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3674 if ((wrapper == NULL) || (*wrapper == '\0'))
3675 return NULL;
3677 /* Absolute path? */
3678 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3679 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3681 concat_name = xstrdup (wrapper);
3682 if (check_executable (concat_name))
3683 return concat_name;
3684 XFREE (concat_name);
3686 else
3688 #endif
3689 if (IS_DIR_SEPARATOR (wrapper[0]))
3691 concat_name = xstrdup (wrapper);
3692 if (check_executable (concat_name))
3693 return concat_name;
3694 XFREE (concat_name);
3696 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3698 #endif
3700 for (p = wrapper; *p; p++)
3701 if (*p == '/')
3703 has_slash = 1;
3704 break;
3706 if (!has_slash)
3708 /* no slashes; search PATH */
3709 const char *path = getenv ("PATH");
3710 if (path != NULL)
3712 for (p = path; *p; p = p_next)
3714 const char *q;
3715 size_t p_len;
3716 for (q = p; *q; q++)
3717 if (IS_PATH_SEPARATOR (*q))
3718 break;
3719 p_len = q - p;
3720 p_next = (*q == '\0' ? q : q + 1);
3721 if (p_len == 0)
3723 /* empty path: current directory */
3724 if (getcwd (tmp, LT_PATHMAX) == NULL)
3725 lt_fatal ("getcwd failed");
3726 tmp_len = strlen (tmp);
3727 concat_name =
3728 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3729 memcpy (concat_name, tmp, tmp_len);
3730 concat_name[tmp_len] = '/';
3731 strcpy (concat_name + tmp_len + 1, wrapper);
3733 else
3735 concat_name =
3736 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3737 memcpy (concat_name, p, p_len);
3738 concat_name[p_len] = '/';
3739 strcpy (concat_name + p_len + 1, wrapper);
3741 if (check_executable (concat_name))
3742 return concat_name;
3743 XFREE (concat_name);
3746 /* not found in PATH; assume curdir */
3748 /* Relative path | not found in path: prepend cwd */
3749 if (getcwd (tmp, LT_PATHMAX) == NULL)
3750 lt_fatal ("getcwd failed");
3751 tmp_len = strlen (tmp);
3752 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3753 memcpy (concat_name, tmp, tmp_len);
3754 concat_name[tmp_len] = '/';
3755 strcpy (concat_name + tmp_len + 1, wrapper);
3757 if (check_executable (concat_name))
3758 return concat_name;
3759 XFREE (concat_name);
3760 return NULL;
3763 char *
3764 chase_symlinks (const char *pathspec)
3766 #ifndef S_ISLNK
3767 return xstrdup (pathspec);
3768 #else
3769 char buf[LT_PATHMAX];
3770 struct stat s;
3771 char *tmp_pathspec = xstrdup (pathspec);
3772 char *p;
3773 int has_symlinks = 0;
3774 while (strlen (tmp_pathspec) && !has_symlinks)
3776 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3777 tmp_pathspec));
3778 if (lstat (tmp_pathspec, &s) == 0)
3780 if (S_ISLNK (s.st_mode) != 0)
3782 has_symlinks = 1;
3783 break;
3786 /* search backwards for last DIR_SEPARATOR */
3787 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3788 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3789 p--;
3790 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3792 /* no more DIR_SEPARATORS left */
3793 break;
3795 *p = '\0';
3797 else
3799 char *errstr = strerror (errno);
3800 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3803 XFREE (tmp_pathspec);
3805 if (!has_symlinks)
3807 return xstrdup (pathspec);
3810 tmp_pathspec = realpath (pathspec, buf);
3811 if (tmp_pathspec == 0)
3813 lt_fatal ("Could not follow symlinks for %s", pathspec);
3815 return xstrdup (tmp_pathspec);
3816 #endif
3819 char *
3820 strendzap (char *str, const char *pat)
3822 size_t len, patlen;
3824 assert (str != NULL);
3825 assert (pat != NULL);
3827 len = strlen (str);
3828 patlen = strlen (pat);
3830 if (patlen <= len)
3832 str += len - patlen;
3833 if (strcmp (str, pat) == 0)
3834 *str = '\0';
3836 return str;
3839 static void
3840 lt_error_core (int exit_status, const char *mode,
3841 const char *message, va_list ap)
3843 fprintf (stderr, "%s: %s: ", program_name, mode);
3844 vfprintf (stderr, message, ap);
3845 fprintf (stderr, ".\n");
3847 if (exit_status >= 0)
3848 exit (exit_status);
3851 void
3852 lt_fatal (const char *message, ...)
3854 va_list ap;
3855 va_start (ap, message);
3856 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
3857 va_end (ap);
3860 void
3861 lt_setenv (const char *name, const char *value)
3863 LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
3864 (name ? name : "<NULL>"),
3865 (value ? value : "<NULL>")));
3867 #ifdef HAVE_SETENV
3868 /* always make a copy, for consistency with !HAVE_SETENV */
3869 char *str = xstrdup (value);
3870 setenv (name, str, 1);
3871 #else
3872 int len = strlen (name) + 1 + strlen (value) + 1;
3873 char *str = XMALLOC (char, len);
3874 sprintf (str, "%s=%s", name, value);
3875 if (putenv (str) != EXIT_SUCCESS)
3877 XFREE (str);
3879 #endif
3883 char *
3884 lt_extend_str (const char *orig_value, const char *add, int to_end)
3886 char *new_value;
3887 if (orig_value && *orig_value)
3889 int orig_value_len = strlen (orig_value);
3890 int add_len = strlen (add);
3891 new_value = XMALLOC (char, add_len + orig_value_len + 1);
3892 if (to_end)
3894 strcpy (new_value, orig_value);
3895 strcpy (new_value + orig_value_len, add);
3897 else
3899 strcpy (new_value, add);
3900 strcpy (new_value + add_len, orig_value);
3903 else
3905 new_value = xstrdup (add);
3907 return new_value;
3911 lt_split_name_value (const char *arg, char** name, char** value)
3913 const char *p;
3914 int len;
3915 if (!arg || !*arg)
3916 return 1;
3918 p = strchr (arg, (int)'=');
3920 if (!p)
3921 return 1;
3923 *value = xstrdup (++p);
3925 len = strlen (arg) - strlen (*value);
3926 *name = XMALLOC (char, len);
3927 strncpy (*name, arg, len-1);
3928 (*name)[len - 1] = '\0';
3930 return 0;
3933 void
3934 lt_opt_process_env_set (const char *arg)
3936 char *name = NULL;
3937 char *value = NULL;
3939 if (lt_split_name_value (arg, &name, &value) != 0)
3941 XFREE (name);
3942 XFREE (value);
3943 lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
3946 lt_setenv (name, value);
3947 XFREE (name);
3948 XFREE (value);
3951 void
3952 lt_opt_process_env_prepend (const char *arg)
3954 char *name = NULL;
3955 char *value = NULL;
3956 char *new_value = NULL;
3958 if (lt_split_name_value (arg, &name, &value) != 0)
3960 XFREE (name);
3961 XFREE (value);
3962 lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
3965 new_value = lt_extend_str (getenv (name), value, 0);
3966 lt_setenv (name, new_value);
3967 XFREE (new_value);
3968 XFREE (name);
3969 XFREE (value);
3972 void
3973 lt_opt_process_env_append (const char *arg)
3975 char *name = NULL;
3976 char *value = NULL;
3977 char *new_value = NULL;
3979 if (lt_split_name_value (arg, &name, &value) != 0)
3981 XFREE (name);
3982 XFREE (value);
3983 lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
3986 new_value = lt_extend_str (getenv (name), value, 1);
3987 lt_setenv (name, new_value);
3988 XFREE (new_value);
3989 XFREE (name);
3990 XFREE (value);
3993 void
3994 lt_update_exe_path (const char *name, const char *value)
3996 LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
3997 (name ? name : "<NULL>"),
3998 (value ? value : "<NULL>")));
4000 if (name && *name && value && *value)
4002 char *new_value = lt_extend_str (getenv (name), value, 0);
4003 /* some systems can't cope with a ':'-terminated path #' */
4004 int len = strlen (new_value);
4005 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4007 new_value[len-1] = '\0';
4009 lt_setenv (name, new_value);
4010 XFREE (new_value);
4014 void
4015 lt_update_lib_path (const char *name, const char *value)
4017 LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4018 (name ? name : "<NULL>"),
4019 (value ? value : "<NULL>")));
4021 if (name && *name && value && *value)
4023 char *new_value = lt_extend_str (getenv (name), value, 0);
4024 lt_setenv (name, new_value);
4025 XFREE (new_value);
4032 # end: func_emit_cwrapperexe_src
4034 # func_mode_link arg...
4035 func_mode_link ()
4037 $opt_debug
4038 case $host in
4039 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4040 # It is impossible to link a dll without this setting, and
4041 # we shouldn't force the makefile maintainer to figure out
4042 # which system we are compiling for in order to pass an extra
4043 # flag for every libtool invocation.
4044 # allow_undefined=no
4046 # FIXME: Unfortunately, there are problems with the above when trying
4047 # to make a dll which has undefined symbols, in which case not
4048 # even a static library is built. For now, we need to specify
4049 # -no-undefined on the libtool link line when we can be certain
4050 # that all symbols are satisfied, otherwise we get a static library.
4051 allow_undefined=yes
4054 allow_undefined=yes
4056 esac
4057 libtool_args=$nonopt
4058 base_compile="$nonopt $@"
4059 compile_command=$nonopt
4060 finalize_command=$nonopt
4062 compile_rpath=
4063 finalize_rpath=
4064 compile_shlibpath=
4065 finalize_shlibpath=
4066 convenience=
4067 old_convenience=
4068 deplibs=
4069 old_deplibs=
4070 compiler_flags=
4071 linker_flags=
4072 dllsearchpath=
4073 lib_search_path=`pwd`
4074 inst_prefix_dir=
4075 new_inherited_linker_flags=
4077 avoid_version=no
4078 dlfiles=
4079 dlprefiles=
4080 dlself=no
4081 export_dynamic=no
4082 export_symbols=
4083 export_symbols_regex=
4084 generated=
4085 libobjs=
4086 ltlibs=
4087 module=no
4088 no_install=no
4089 objs=
4090 non_pic_objects=
4091 precious_files_regex=
4092 prefer_static_libs=no
4093 preload=no
4094 prev=
4095 prevarg=
4096 release=
4097 rpath=
4098 xrpath=
4099 perm_rpath=
4100 temp_rpath=
4101 thread_safe=no
4102 vinfo=
4103 vinfo_number=no
4104 weak_libs=
4105 single_module="${wl}-single_module"
4106 func_infer_tag $base_compile
4108 # We need to know -static, to get the right output filenames.
4109 for arg
4111 case $arg in
4112 -shared)
4113 test "$build_libtool_libs" != yes && \
4114 func_fatal_configuration "can not build a shared library"
4115 build_old_libs=no
4116 break
4118 -all-static | -static | -static-libtool-libs)
4119 case $arg in
4120 -all-static)
4121 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4122 func_warning "complete static linking is impossible in this configuration"
4124 if test -n "$link_static_flag"; then
4125 dlopen_self=$dlopen_self_static
4127 prefer_static_libs=yes
4129 -static)
4130 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4131 dlopen_self=$dlopen_self_static
4133 prefer_static_libs=built
4135 -static-libtool-libs)
4136 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4137 dlopen_self=$dlopen_self_static
4139 prefer_static_libs=yes
4141 esac
4142 build_libtool_libs=no
4143 build_old_libs=yes
4144 break
4146 esac
4147 done
4149 # See if our shared archives depend on static archives.
4150 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4152 # Go through the arguments, transforming them on the way.
4153 while test "$#" -gt 0; do
4154 arg="$1"
4155 shift
4156 func_quote_for_eval "$arg"
4157 qarg=$func_quote_for_eval_unquoted_result
4158 func_append libtool_args " $func_quote_for_eval_result"
4160 # If the previous option needs an argument, assign it.
4161 if test -n "$prev"; then
4162 case $prev in
4163 output)
4164 func_append compile_command " @OUTPUT@"
4165 func_append finalize_command " @OUTPUT@"
4167 esac
4169 case $prev in
4170 dlfiles|dlprefiles)
4171 if test "$preload" = no; then
4172 # Add the symbol object into the linking commands.
4173 func_append compile_command " @SYMFILE@"
4174 func_append finalize_command " @SYMFILE@"
4175 preload=yes
4177 case $arg in
4178 *.la | *.lo) ;; # We handle these cases below.
4179 force)
4180 if test "$dlself" = no; then
4181 dlself=needless
4182 export_dynamic=yes
4184 prev=
4185 continue
4187 self)
4188 if test "$prev" = dlprefiles; then
4189 dlself=yes
4190 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4191 dlself=yes
4192 else
4193 dlself=needless
4194 export_dynamic=yes
4196 prev=
4197 continue
4200 if test "$prev" = dlfiles; then
4201 dlfiles="$dlfiles $arg"
4202 else
4203 dlprefiles="$dlprefiles $arg"
4205 prev=
4206 continue
4208 esac
4210 expsyms)
4211 export_symbols="$arg"
4212 test -f "$arg" \
4213 || func_fatal_error "symbol file \`$arg' does not exist"
4214 prev=
4215 continue
4217 expsyms_regex)
4218 export_symbols_regex="$arg"
4219 prev=
4220 continue
4222 framework)
4223 case $host in
4224 *-*-darwin*)
4225 case "$deplibs " in
4226 *" $qarg.ltframework "*) ;;
4227 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4229 esac
4231 esac
4232 prev=
4233 continue
4235 inst_prefix)
4236 inst_prefix_dir="$arg"
4237 prev=
4238 continue
4240 objectlist)
4241 if test -f "$arg"; then
4242 save_arg=$arg
4243 moreargs=
4244 for fil in `cat "$save_arg"`
4246 # moreargs="$moreargs $fil"
4247 arg=$fil
4248 # A libtool-controlled object.
4250 # Check to see that this really is a libtool object.
4251 if func_lalib_unsafe_p "$arg"; then
4252 pic_object=
4253 non_pic_object=
4255 # Read the .lo file
4256 func_source "$arg"
4258 if test -z "$pic_object" ||
4259 test -z "$non_pic_object" ||
4260 test "$pic_object" = none &&
4261 test "$non_pic_object" = none; then
4262 func_fatal_error "cannot find name of object for \`$arg'"
4265 # Extract subdirectory from the argument.
4266 func_dirname "$arg" "/" ""
4267 xdir="$func_dirname_result"
4269 if test "$pic_object" != none; then
4270 # Prepend the subdirectory the object is found in.
4271 pic_object="$xdir$pic_object"
4273 if test "$prev" = dlfiles; then
4274 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4275 dlfiles="$dlfiles $pic_object"
4276 prev=
4277 continue
4278 else
4279 # If libtool objects are unsupported, then we need to preload.
4280 prev=dlprefiles
4284 # CHECK ME: I think I busted this. -Ossama
4285 if test "$prev" = dlprefiles; then
4286 # Preload the old-style object.
4287 dlprefiles="$dlprefiles $pic_object"
4288 prev=
4291 # A PIC object.
4292 func_append libobjs " $pic_object"
4293 arg="$pic_object"
4296 # Non-PIC object.
4297 if test "$non_pic_object" != none; then
4298 # Prepend the subdirectory the object is found in.
4299 non_pic_object="$xdir$non_pic_object"
4301 # A standard non-PIC object
4302 func_append non_pic_objects " $non_pic_object"
4303 if test -z "$pic_object" || test "$pic_object" = none ; then
4304 arg="$non_pic_object"
4306 else
4307 # If the PIC object exists, use it instead.
4308 # $xdir was prepended to $pic_object above.
4309 non_pic_object="$pic_object"
4310 func_append non_pic_objects " $non_pic_object"
4312 else
4313 # Only an error if not doing a dry-run.
4314 if $opt_dry_run; then
4315 # Extract subdirectory from the argument.
4316 func_dirname "$arg" "/" ""
4317 xdir="$func_dirname_result"
4319 func_lo2o "$arg"
4320 pic_object=$xdir$objdir/$func_lo2o_result
4321 non_pic_object=$xdir$func_lo2o_result
4322 func_append libobjs " $pic_object"
4323 func_append non_pic_objects " $non_pic_object"
4324 else
4325 func_fatal_error "\`$arg' is not a valid libtool object"
4328 done
4329 else
4330 func_fatal_error "link input file \`$arg' does not exist"
4332 arg=$save_arg
4333 prev=
4334 continue
4336 precious_regex)
4337 precious_files_regex="$arg"
4338 prev=
4339 continue
4341 release)
4342 release="-$arg"
4343 prev=
4344 continue
4346 rpath | xrpath)
4347 # We need an absolute path.
4348 case $arg in
4349 [\\/]* | [A-Za-z]:[\\/]*) ;;
4351 func_fatal_error "only absolute run-paths are allowed"
4353 esac
4354 if test "$prev" = rpath; then
4355 case "$rpath " in
4356 *" $arg "*) ;;
4357 *) rpath="$rpath $arg" ;;
4358 esac
4359 else
4360 case "$xrpath " in
4361 *" $arg "*) ;;
4362 *) xrpath="$xrpath $arg" ;;
4363 esac
4365 prev=
4366 continue
4368 shrext)
4369 shrext_cmds="$arg"
4370 prev=
4371 continue
4373 weak)
4374 weak_libs="$weak_libs $arg"
4375 prev=
4376 continue
4378 xcclinker)
4379 linker_flags="$linker_flags $qarg"
4380 compiler_flags="$compiler_flags $qarg"
4381 prev=
4382 func_append compile_command " $qarg"
4383 func_append finalize_command " $qarg"
4384 continue
4386 xcompiler)
4387 compiler_flags="$compiler_flags $qarg"
4388 prev=
4389 func_append compile_command " $qarg"
4390 func_append finalize_command " $qarg"
4391 continue
4393 xlinker)
4394 linker_flags="$linker_flags $qarg"
4395 compiler_flags="$compiler_flags $wl$qarg"
4396 prev=
4397 func_append compile_command " $wl$qarg"
4398 func_append finalize_command " $wl$qarg"
4399 continue
4402 eval "$prev=\"\$arg\""
4403 prev=
4404 continue
4406 esac
4407 fi # test -n "$prev"
4409 prevarg="$arg"
4411 case $arg in
4412 -all-static)
4413 if test -n "$link_static_flag"; then
4414 # See comment for -static flag below, for more details.
4415 func_append compile_command " $link_static_flag"
4416 func_append finalize_command " $link_static_flag"
4418 continue
4421 -allow-undefined)
4422 # FIXME: remove this flag sometime in the future.
4423 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
4426 -avoid-version)
4427 avoid_version=yes
4428 continue
4431 -dlopen)
4432 prev=dlfiles
4433 continue
4436 -dlpreopen)
4437 prev=dlprefiles
4438 continue
4441 -export-dynamic)
4442 export_dynamic=yes
4443 continue
4446 -export-symbols | -export-symbols-regex)
4447 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
4448 func_fatal_error "more than one -exported-symbols argument is not allowed"
4450 if test "X$arg" = "X-export-symbols"; then
4451 prev=expsyms
4452 else
4453 prev=expsyms_regex
4455 continue
4458 -framework)
4459 prev=framework
4460 continue
4463 -inst-prefix-dir)
4464 prev=inst_prefix
4465 continue
4468 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
4469 # so, if we see these flags be careful not to treat them like -L
4470 -L[A-Z][A-Z]*:*)
4471 case $with_gcc/$host in
4472 no/*-*-irix* | /*-*-irix*)
4473 func_append compile_command " $arg"
4474 func_append finalize_command " $arg"
4476 esac
4477 continue
4480 -L*)
4481 func_stripname '-L' '' "$arg"
4482 dir=$func_stripname_result
4483 if test -z "$dir"; then
4484 if test "$#" -gt 0; then
4485 func_fatal_error "require no space between \`-L' and \`$1'"
4486 else
4487 func_fatal_error "need path for \`-L' option"
4490 # We need an absolute path.
4491 case $dir in
4492 [\\/]* | [A-Za-z]:[\\/]*) ;;
4494 absdir=`cd "$dir" && pwd`
4495 test -z "$absdir" && \
4496 func_fatal_error "cannot determine absolute directory name of \`$dir'"
4497 dir="$absdir"
4499 esac
4500 case "$deplibs " in
4501 *" -L$dir "*) ;;
4503 deplibs="$deplibs -L$dir"
4504 lib_search_path="$lib_search_path $dir"
4506 esac
4507 case $host in
4508 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4509 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
4510 case :$dllsearchpath: in
4511 *":$dir:"*) ;;
4512 ::) dllsearchpath=$dir;;
4513 *) dllsearchpath="$dllsearchpath:$dir";;
4514 esac
4515 case :$dllsearchpath: in
4516 *":$testbindir:"*) ;;
4517 ::) dllsearchpath=$testbindir;;
4518 *) dllsearchpath="$dllsearchpath:$testbindir";;
4519 esac
4521 esac
4522 continue
4525 -l*)
4526 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
4527 case $host in
4528 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
4529 # These systems don't actually have a C or math library (as such)
4530 continue
4532 *-*-os2*)
4533 # These systems don't actually have a C library (as such)
4534 test "X$arg" = "X-lc" && continue
4536 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4537 # Do not include libc due to us having libc/libc_r.
4538 test "X$arg" = "X-lc" && continue
4540 *-*-rhapsody* | *-*-darwin1.[012])
4541 # Rhapsody C and math libraries are in the System framework
4542 deplibs="$deplibs System.ltframework"
4543 continue
4545 *-*-sco3.2v5* | *-*-sco5v6*)
4546 # Causes problems with __ctype
4547 test "X$arg" = "X-lc" && continue
4549 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
4550 # Compiler inserts libc in the correct place for threads to work
4551 test "X$arg" = "X-lc" && continue
4553 esac
4554 elif test "X$arg" = "X-lc_r"; then
4555 case $host in
4556 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4557 # Do not include libc_r directly, use -pthread flag.
4558 continue
4560 esac
4562 deplibs="$deplibs $arg"
4563 continue
4566 -module)
4567 module=yes
4568 continue
4571 # Tru64 UNIX uses -model [arg] to determine the layout of C++
4572 # classes, name mangling, and exception handling.
4573 # Darwin uses the -arch flag to determine output architecture.
4574 -model|-arch|-isysroot)
4575 compiler_flags="$compiler_flags $arg"
4576 func_append compile_command " $arg"
4577 func_append finalize_command " $arg"
4578 prev=xcompiler
4579 continue
4582 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4583 compiler_flags="$compiler_flags $arg"
4584 func_append compile_command " $arg"
4585 func_append finalize_command " $arg"
4586 case "$new_inherited_linker_flags " in
4587 *" $arg "*) ;;
4588 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
4589 esac
4590 continue
4593 -multi_module)
4594 single_module="${wl}-multi_module"
4595 continue
4598 -no-fast-install)
4599 fast_install=no
4600 continue
4603 -no-install)
4604 case $host in
4605 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
4606 # The PATH hackery in wrapper scripts is required on Windows
4607 # and Darwin in order for the loader to find any dlls it needs.
4608 func_warning "\`-no-install' is ignored for $host"
4609 func_warning "assuming \`-no-fast-install' instead"
4610 fast_install=no
4612 *) no_install=yes ;;
4613 esac
4614 continue
4617 -no-undefined)
4618 allow_undefined=no
4619 continue
4622 -objectlist)
4623 prev=objectlist
4624 continue
4627 -o) prev=output ;;
4629 -precious-files-regex)
4630 prev=precious_regex
4631 continue
4634 -release)
4635 prev=release
4636 continue
4639 -rpath)
4640 prev=rpath
4641 continue
4645 prev=xrpath
4646 continue
4649 -R*)
4650 func_stripname '-R' '' "$arg"
4651 dir=$func_stripname_result
4652 # We need an absolute path.
4653 case $dir in
4654 [\\/]* | [A-Za-z]:[\\/]*) ;;
4656 func_fatal_error "only absolute run-paths are allowed"
4658 esac
4659 case "$xrpath " in
4660 *" $dir "*) ;;
4661 *) xrpath="$xrpath $dir" ;;
4662 esac
4663 continue
4666 -shared)
4667 # The effects of -shared are defined in a previous loop.
4668 continue
4671 -shrext)
4672 prev=shrext
4673 continue
4676 -static | -static-libtool-libs)
4677 # The effects of -static are defined in a previous loop.
4678 # We used to do the same as -all-static on platforms that
4679 # didn't have a PIC flag, but the assumption that the effects
4680 # would be equivalent was wrong. It would break on at least
4681 # Digital Unix and AIX.
4682 continue
4685 -thread-safe)
4686 thread_safe=yes
4687 continue
4690 -version-info)
4691 prev=vinfo
4692 continue
4695 -version-number)
4696 prev=vinfo
4697 vinfo_number=yes
4698 continue
4701 -weak)
4702 prev=weak
4703 continue
4706 -Wc,*)
4707 func_stripname '-Wc,' '' "$arg"
4708 args=$func_stripname_result
4709 arg=
4710 save_ifs="$IFS"; IFS=','
4711 for flag in $args; do
4712 IFS="$save_ifs"
4713 func_quote_for_eval "$flag"
4714 arg="$arg $wl$func_quote_for_eval_result"
4715 compiler_flags="$compiler_flags $func_quote_for_eval_result"
4716 done
4717 IFS="$save_ifs"
4718 func_stripname ' ' '' "$arg"
4719 arg=$func_stripname_result
4722 -Wl,*)
4723 func_stripname '-Wl,' '' "$arg"
4724 args=$func_stripname_result
4725 arg=
4726 save_ifs="$IFS"; IFS=','
4727 for flag in $args; do
4728 IFS="$save_ifs"
4729 func_quote_for_eval "$flag"
4730 arg="$arg $wl$func_quote_for_eval_result"
4731 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
4732 linker_flags="$linker_flags $func_quote_for_eval_result"
4733 done
4734 IFS="$save_ifs"
4735 func_stripname ' ' '' "$arg"
4736 arg=$func_stripname_result
4739 -Xcompiler)
4740 prev=xcompiler
4741 continue
4744 -Xlinker)
4745 prev=xlinker
4746 continue
4749 -XCClinker)
4750 prev=xcclinker
4751 continue
4754 # -msg_* for osf cc
4755 -msg_*)
4756 func_quote_for_eval "$arg"
4757 arg="$func_quote_for_eval_result"
4760 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
4761 # -r[0-9][0-9]* specifies the processor on the SGI compiler
4762 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
4763 # +DA*, +DD* enable 64-bit mode on the HP compiler
4764 # -q* pass through compiler args for the IBM compiler
4765 # -m*, -t[45]*, -txscale* pass through architecture-specific
4766 # compiler args for GCC
4767 # -F/path gives path to uninstalled frameworks, gcc on darwin
4768 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
4769 # @file GCC response files
4770 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
4771 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
4772 func_quote_for_eval "$arg"
4773 arg="$func_quote_for_eval_result"
4774 func_append compile_command " $arg"
4775 func_append finalize_command " $arg"
4776 compiler_flags="$compiler_flags $arg"
4777 continue
4780 # Some other compiler flag.
4781 -* | +*)
4782 func_quote_for_eval "$arg"
4783 arg="$func_quote_for_eval_result"
4786 *.$objext)
4787 # A standard object.
4788 objs="$objs $arg"
4791 *.lo)
4792 # A libtool-controlled object.
4794 # Check to see that this really is a libtool object.
4795 if func_lalib_unsafe_p "$arg"; then
4796 pic_object=
4797 non_pic_object=
4799 # Read the .lo file
4800 func_source "$arg"
4802 if test -z "$pic_object" ||
4803 test -z "$non_pic_object" ||
4804 test "$pic_object" = none &&
4805 test "$non_pic_object" = none; then
4806 func_fatal_error "cannot find name of object for \`$arg'"
4809 # Extract subdirectory from the argument.
4810 func_dirname "$arg" "/" ""
4811 xdir="$func_dirname_result"
4813 if test "$pic_object" != none; then
4814 # Prepend the subdirectory the object is found in.
4815 pic_object="$xdir$pic_object"
4817 if test "$prev" = dlfiles; then
4818 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4819 dlfiles="$dlfiles $pic_object"
4820 prev=
4821 continue
4822 else
4823 # If libtool objects are unsupported, then we need to preload.
4824 prev=dlprefiles
4828 # CHECK ME: I think I busted this. -Ossama
4829 if test "$prev" = dlprefiles; then
4830 # Preload the old-style object.
4831 dlprefiles="$dlprefiles $pic_object"
4832 prev=
4835 # A PIC object.
4836 func_append libobjs " $pic_object"
4837 arg="$pic_object"
4840 # Non-PIC object.
4841 if test "$non_pic_object" != none; then
4842 # Prepend the subdirectory the object is found in.
4843 non_pic_object="$xdir$non_pic_object"
4845 # A standard non-PIC object
4846 func_append non_pic_objects " $non_pic_object"
4847 if test -z "$pic_object" || test "$pic_object" = none ; then
4848 arg="$non_pic_object"
4850 else
4851 # If the PIC object exists, use it instead.
4852 # $xdir was prepended to $pic_object above.
4853 non_pic_object="$pic_object"
4854 func_append non_pic_objects " $non_pic_object"
4856 else
4857 # Only an error if not doing a dry-run.
4858 if $opt_dry_run; then
4859 # Extract subdirectory from the argument.
4860 func_dirname "$arg" "/" ""
4861 xdir="$func_dirname_result"
4863 func_lo2o "$arg"
4864 pic_object=$xdir$objdir/$func_lo2o_result
4865 non_pic_object=$xdir$func_lo2o_result
4866 func_append libobjs " $pic_object"
4867 func_append non_pic_objects " $non_pic_object"
4868 else
4869 func_fatal_error "\`$arg' is not a valid libtool object"
4874 *.$libext)
4875 # An archive.
4876 deplibs="$deplibs $arg"
4877 old_deplibs="$old_deplibs $arg"
4878 continue
4881 *.la)
4882 # A libtool-controlled library.
4884 if test "$prev" = dlfiles; then
4885 # This library was specified with -dlopen.
4886 dlfiles="$dlfiles $arg"
4887 prev=
4888 elif test "$prev" = dlprefiles; then
4889 # The library was specified with -dlpreopen.
4890 dlprefiles="$dlprefiles $arg"
4891 prev=
4892 else
4893 deplibs="$deplibs $arg"
4895 continue
4898 # Some other compiler argument.
4900 # Unknown arguments in both finalize_command and compile_command need
4901 # to be aesthetically quoted because they are evaled later.
4902 func_quote_for_eval "$arg"
4903 arg="$func_quote_for_eval_result"
4905 esac # arg
4907 # Now actually substitute the argument into the commands.
4908 if test -n "$arg"; then
4909 func_append compile_command " $arg"
4910 func_append finalize_command " $arg"
4912 done # argument parsing loop
4914 if test "$module" = yes ; then
4915 # [Mandriva] dropping ld option "--no-undefined" which is wrong for plugins
4916 linker_flags=`$ECHO "X $linker_flags" | $Xsed -e 's/ --no-undefined//'`
4917 compiler_flags=`$ECHO "X $compiler_flags" | $Xsed -e 's/ -Wl,--no-undefined//'`
4920 test -n "$prev" && \
4921 func_fatal_help "the \`$prevarg' option requires an argument"
4923 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
4924 eval arg=\"$export_dynamic_flag_spec\"
4925 func_append compile_command " $arg"
4926 func_append finalize_command " $arg"
4929 oldlibs=
4930 # calculate the name of the file, without its directory
4931 func_basename "$output"
4932 outputname="$func_basename_result"
4933 libobjs_save="$libobjs"
4935 if test -n "$shlibpath_var"; then
4936 # get the directories listed in $shlibpath_var
4937 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
4938 else
4939 shlib_search_path=
4941 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
4942 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
4944 func_dirname "$output" "/" ""
4945 output_objdir="$func_dirname_result$objdir"
4946 # Create the object directory.
4947 func_mkdir_p "$output_objdir"
4949 # Determine the type of output
4950 case $output in
4952 func_fatal_help "you must specify an output file"
4954 *.$libext) linkmode=oldlib ;;
4955 *.lo | *.$objext) linkmode=obj ;;
4956 *.la) linkmode=lib ;;
4957 *) linkmode=prog ;; # Anything else should be a program.
4958 esac
4960 specialdeplibs=
4962 libs=
4963 # Find all interdependent deplibs by searching for libraries
4964 # that are linked more than once (e.g. -la -lb -la)
4965 for deplib in $deplibs; do
4966 if $opt_duplicate_deps ; then
4967 case "$libs " in
4968 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4969 esac
4971 libs="$libs $deplib"
4972 done
4974 if test "$linkmode" = lib; then
4975 libs="$predeps $libs $compiler_lib_search_path $postdeps"
4977 # Compute libraries that are listed more than once in $predeps
4978 # $postdeps and mark them as special (i.e., whose duplicates are
4979 # not to be eliminated).
4980 pre_post_deps=
4981 if $opt_duplicate_compiler_generated_deps; then
4982 for pre_post_dep in $predeps $postdeps; do
4983 case "$pre_post_deps " in
4984 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
4985 esac
4986 pre_post_deps="$pre_post_deps $pre_post_dep"
4987 done
4989 pre_post_deps=
4992 deplibs=
4993 newdependency_libs=
4994 newlib_search_path=
4995 need_relink=no # whether we're linking any uninstalled libtool libraries
4996 notinst_deplibs= # not-installed libtool libraries
4997 notinst_path= # paths that contain not-installed libtool libraries
4999 case $linkmode in
5000 lib)
5001 passes="conv dlpreopen link"
5002 for file in $dlfiles $dlprefiles; do
5003 case $file in
5004 *.la) ;;
5006 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5008 esac
5009 done
5011 prog)
5012 compile_deplibs=
5013 finalize_deplibs=
5014 alldeplibs=no
5015 newdlfiles=
5016 newdlprefiles=
5017 passes="conv scan dlopen dlpreopen link"
5019 *) passes="conv"
5021 esac
5023 for pass in $passes; do
5024 # The preopen pass in lib mode reverses $deplibs; put it back here
5025 # so that -L comes before libs that need it for instance...
5026 if test "$linkmode,$pass" = "lib,link"; then
5027 ## FIXME: Find the place where the list is rebuilt in the wrong
5028 ## order, and fix it there properly
5029 tmp_deplibs=
5030 for deplib in $deplibs; do
5031 tmp_deplibs="$deplib $tmp_deplibs"
5032 done
5033 deplibs="$tmp_deplibs"
5036 if test "$linkmode,$pass" = "lib,link" ||
5037 test "$linkmode,$pass" = "prog,scan"; then
5038 libs="$deplibs"
5039 deplibs=
5041 if test "$linkmode" = prog; then
5042 case $pass in
5043 dlopen) libs="$dlfiles" ;;
5044 dlpreopen) libs="$dlprefiles" ;;
5045 link)
5046 libs="$deplibs %DEPLIBS%"
5047 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
5049 esac
5051 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5052 # Collect and forward deplibs of preopened libtool libs
5053 for lib in $dlprefiles; do
5054 # Ignore non-libtool-libs
5055 dependency_libs=
5056 case $lib in
5057 *.la) func_source "$lib" ;;
5058 esac
5060 # Collect preopened libtool deplibs, except any this library
5061 # has declared as weak libs
5062 for deplib in $dependency_libs; do
5063 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
5064 case " $weak_libs " in
5065 *" $deplib_base "*) ;;
5066 *) deplibs="$deplibs $deplib" ;;
5067 esac
5068 done
5069 done
5070 libs="$dlprefiles"
5072 if test "$pass" = dlopen; then
5073 # Collect dlpreopened libraries
5074 save_deplibs="$deplibs"
5075 deplibs=
5078 for deplib in $libs; do
5079 lib=
5080 found=no
5081 case $deplib in
5082 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5083 if test "$linkmode,$pass" = "prog,link"; then
5084 compile_deplibs="$deplib $compile_deplibs"
5085 finalize_deplibs="$deplib $finalize_deplibs"
5086 else
5087 compiler_flags="$compiler_flags $deplib"
5088 if test "$linkmode" = lib ; then
5089 case "$new_inherited_linker_flags " in
5090 *" $deplib "*) ;;
5091 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5092 esac
5095 continue
5097 -l*)
5098 if test "$linkmode" != lib && test "$linkmode" != prog; then
5099 func_warning "\`-l' is ignored for archives/objects"
5100 continue
5102 func_stripname '-l' '' "$deplib"
5103 name=$func_stripname_result
5104 if test "$linkmode" = lib; then
5105 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5106 else
5107 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5109 for searchdir in $searchdirs; do
5110 for search_ext in .la $std_shrext .so .a; do
5111 # Search the libtool library
5112 lib="$searchdir/lib${name}${search_ext}"
5113 if test -f "$lib"; then
5114 if test "$search_ext" = ".la"; then
5115 found=yes
5116 else
5117 found=no
5119 break 2
5121 done
5122 done
5123 if test "$found" != yes; then
5124 # deplib doesn't seem to be a libtool library
5125 if test "$linkmode,$pass" = "prog,link"; then
5126 compile_deplibs="$deplib $compile_deplibs"
5127 finalize_deplibs="$deplib $finalize_deplibs"
5128 else
5129 deplibs="$deplib $deplibs"
5130 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5132 continue
5133 else # deplib is a libtool library
5134 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5135 # We need to do some special things here, and not later.
5136 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5137 case " $predeps $postdeps " in
5138 *" $deplib "*)
5139 if func_lalib_p "$lib"; then
5140 library_names=
5141 old_library=
5142 func_source "$lib"
5143 for l in $old_library $library_names; do
5144 ll="$l"
5145 done
5146 if test "X$ll" = "X$old_library" ; then # only static version available
5147 found=no
5148 func_dirname "$lib" "" "."
5149 ladir="$func_dirname_result"
5150 lib=$ladir/$old_library
5151 if test "$linkmode,$pass" = "prog,link"; then
5152 compile_deplibs="$deplib $compile_deplibs"
5153 finalize_deplibs="$deplib $finalize_deplibs"
5154 else
5155 deplibs="$deplib $deplibs"
5156 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5158 continue
5162 *) ;;
5163 esac
5166 ;; # -l
5167 *.ltframework)
5168 if test "$linkmode,$pass" = "prog,link"; then
5169 compile_deplibs="$deplib $compile_deplibs"
5170 finalize_deplibs="$deplib $finalize_deplibs"
5171 else
5172 deplibs="$deplib $deplibs"
5173 if test "$linkmode" = lib ; then
5174 case "$new_inherited_linker_flags " in
5175 *" $deplib "*) ;;
5176 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5177 esac
5180 continue
5182 -L*)
5183 case $linkmode in
5184 lib)
5185 deplibs="$deplib $deplibs"
5186 test "$pass" = conv && continue
5187 newdependency_libs="$deplib $newdependency_libs"
5188 func_stripname '-L' '' "$deplib"
5189 newlib_search_path="$newlib_search_path $func_stripname_result"
5191 prog)
5192 if test "$pass" = conv; then
5193 deplibs="$deplib $deplibs"
5194 continue
5196 if test "$pass" = scan; then
5197 deplibs="$deplib $deplibs"
5198 else
5199 compile_deplibs="$deplib $compile_deplibs"
5200 finalize_deplibs="$deplib $finalize_deplibs"
5202 func_stripname '-L' '' "$deplib"
5203 newlib_search_path="$newlib_search_path $func_stripname_result"
5206 func_warning "\`-L' is ignored for archives/objects"
5208 esac # linkmode
5209 continue
5210 ;; # -L
5211 -R*)
5212 if test "$pass" = link; then
5213 func_stripname '-R' '' "$deplib"
5214 dir=$func_stripname_result
5215 # Make sure the xrpath contains only unique directories.
5216 case "$xrpath " in
5217 *" $dir "*) ;;
5218 *) xrpath="$xrpath $dir" ;;
5219 esac
5221 deplibs="$deplib $deplibs"
5222 continue
5224 *.la) lib="$deplib" ;;
5225 *.$libext)
5226 if test "$pass" = conv; then
5227 deplibs="$deplib $deplibs"
5228 continue
5230 case $linkmode in
5231 lib)
5232 # Linking convenience modules into shared libraries is allowed,
5233 # but linking other static libraries is non-portable.
5234 case " $dlpreconveniencelibs " in
5235 *" $deplib "*) ;;
5237 valid_a_lib=no
5238 case $deplibs_check_method in
5239 match_pattern*)
5240 set dummy $deplibs_check_method; shift
5241 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5242 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
5243 | $EGREP "$match_pattern_regex" > /dev/null; then
5244 valid_a_lib=yes
5247 pass_all)
5248 valid_a_lib=yes
5250 esac
5251 if test "$valid_a_lib" != yes; then
5252 $ECHO
5253 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5254 $ECHO "*** I have the capability to make that library automatically link in when"
5255 $ECHO "*** you link to this library. But I can only do this if you have a"
5256 $ECHO "*** shared version of the library, which you do not appear to have"
5257 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
5258 $ECHO "*** that it is just a static archive that I should not use here."
5259 else
5260 $ECHO
5261 $ECHO "*** Warning: Linking the shared library $output against the"
5262 $ECHO "*** static library $deplib is not portable!"
5263 deplibs="$deplib $deplibs"
5266 esac
5267 continue
5269 prog)
5270 if test "$pass" != link; then
5271 deplibs="$deplib $deplibs"
5272 else
5273 compile_deplibs="$deplib $compile_deplibs"
5274 finalize_deplibs="$deplib $finalize_deplibs"
5276 continue
5278 esac # linkmode
5279 ;; # *.$libext
5280 *.lo | *.$objext)
5281 if test "$pass" = conv; then
5282 deplibs="$deplib $deplibs"
5283 elif test "$linkmode" = prog; then
5284 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5285 # If there is no dlopen support or we're linking statically,
5286 # we need to preload.
5287 newdlprefiles="$newdlprefiles $deplib"
5288 compile_deplibs="$deplib $compile_deplibs"
5289 finalize_deplibs="$deplib $finalize_deplibs"
5290 else
5291 newdlfiles="$newdlfiles $deplib"
5294 continue
5296 %DEPLIBS%)
5297 alldeplibs=yes
5298 continue
5300 esac # case $deplib
5302 if test "$found" = yes || test -f "$lib"; then :
5303 else
5304 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
5307 # Check to see that this really is a libtool archive.
5308 func_lalib_unsafe_p "$lib" \
5309 || func_fatal_error "\`$lib' is not a valid libtool archive"
5311 func_dirname "$lib" "" "."
5312 ladir="$func_dirname_result"
5314 dlname=
5315 dlopen=
5316 dlpreopen=
5317 libdir=
5318 library_names=
5319 old_library=
5320 inherited_linker_flags=
5321 # If the library was installed with an old release of libtool,
5322 # it will not redefine variables installed, or shouldnotlink
5323 installed=yes
5324 shouldnotlink=no
5325 avoidtemprpath=
5328 # Read the .la file
5329 func_source "$lib"
5331 # Convert "-framework foo" to "foo.ltframework"
5332 if test -n "$inherited_linker_flags"; then
5333 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
5334 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5335 case " $new_inherited_linker_flags " in
5336 *" $tmp_inherited_linker_flag "*) ;;
5337 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
5338 esac
5339 done
5341 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5342 if test "$linkmode,$pass" = "lib,link" ||
5343 test "$linkmode,$pass" = "prog,scan" ||
5344 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
5345 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
5346 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
5349 if test "$pass" = conv; then
5350 # Only check for convenience libraries
5351 deplibs="$lib $deplibs"
5352 if test -z "$libdir"; then
5353 if test -z "$old_library"; then
5354 func_fatal_error "cannot find name of link library for \`$lib'"
5356 # It is a libtool convenience library, so add in its objects.
5357 convenience="$convenience $ladir/$objdir/$old_library"
5358 old_convenience="$old_convenience $ladir/$objdir/$old_library"
5359 elif test "$linkmode" != prog && test "$linkmode" != lib; then
5360 func_fatal_error "\`$lib' is not a convenience library"
5362 tmp_libs=
5363 for deplib in $dependency_libs; do
5364 deplibs="$deplib $deplibs"
5365 if $opt_duplicate_deps ; then
5366 case "$tmp_libs " in
5367 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5368 esac
5370 tmp_libs="$tmp_libs $deplib"
5371 done
5372 continue
5373 fi # $pass = conv
5376 # Get the name of the library we link against.
5377 linklib=
5378 for l in $old_library $library_names; do
5379 linklib="$l"
5380 done
5381 if test -z "$linklib"; then
5382 func_fatal_error "cannot find name of link library for \`$lib'"
5385 # This library was specified with -dlopen.
5386 if test "$pass" = dlopen; then
5387 if test -z "$libdir"; then
5388 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
5390 if test -z "$dlname" ||
5391 test "$dlopen_support" != yes ||
5392 test "$build_libtool_libs" = no; then
5393 # If there is no dlname, no dlopen support or we're linking
5394 # statically, we need to preload. We also need to preload any
5395 # dependent libraries so libltdl's deplib preloader doesn't
5396 # bomb out in the load deplibs phase.
5397 dlprefiles="$dlprefiles $lib $dependency_libs"
5398 else
5399 newdlfiles="$newdlfiles $lib"
5401 continue
5402 fi # $pass = dlopen
5404 # We need an absolute path.
5405 case $ladir in
5406 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
5408 abs_ladir=`cd "$ladir" && pwd`
5409 if test -z "$abs_ladir"; then
5410 func_warning "cannot determine absolute directory name of \`$ladir'"
5411 func_warning "passing it literally to the linker, although it might fail"
5412 abs_ladir="$ladir"
5415 esac
5416 func_basename "$lib"
5417 laname="$func_basename_result"
5419 # Find the relevant object directory and library name.
5420 if test "X$installed" = Xyes; then
5421 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5422 func_warning "library \`$lib' was moved."
5423 dir="$ladir"
5424 absdir="$abs_ladir"
5425 libdir="$abs_ladir"
5426 else
5427 dir="$libdir"
5428 absdir="$libdir"
5430 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
5431 else
5432 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5433 dir="$ladir"
5434 absdir="$abs_ladir"
5435 # Remove this search path later
5436 notinst_path="$notinst_path $abs_ladir"
5437 else
5438 dir="$ladir/$objdir"
5439 absdir="$abs_ladir/$objdir"
5440 # Remove this search path later
5441 notinst_path="$notinst_path $abs_ladir"
5443 fi # $installed = yes
5444 func_stripname 'lib' '.la' "$laname"
5445 name=$func_stripname_result
5447 # This library was specified with -dlpreopen.
5448 if test "$pass" = dlpreopen; then
5449 if test -z "$libdir" && test "$linkmode" = prog; then
5450 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
5452 # Prefer using a static library (so that no silly _DYNAMIC symbols
5453 # are required to link).
5454 if test -n "$old_library"; then
5455 newdlprefiles="$newdlprefiles $dir/$old_library"
5456 # Keep a list of preopened convenience libraries to check
5457 # that they are being used correctly in the link pass.
5458 test -z "$libdir" && \
5459 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
5460 # Otherwise, use the dlname, so that lt_dlopen finds it.
5461 elif test -n "$dlname"; then
5462 newdlprefiles="$newdlprefiles $dir/$dlname"
5463 else
5464 newdlprefiles="$newdlprefiles $dir/$linklib"
5466 fi # $pass = dlpreopen
5468 if test -z "$libdir"; then
5469 # Link the convenience library
5470 if test "$linkmode" = lib; then
5471 deplibs="$dir/$old_library $deplibs"
5472 elif test "$linkmode,$pass" = "prog,link"; then
5473 compile_deplibs="$dir/$old_library $compile_deplibs"
5474 finalize_deplibs="$dir/$old_library $finalize_deplibs"
5475 else
5476 deplibs="$lib $deplibs" # used for prog,scan pass
5478 continue
5482 if test "$linkmode" = prog && test "$pass" != link; then
5483 newlib_search_path="$newlib_search_path $ladir"
5484 deplibs="$lib $deplibs"
5486 linkalldeplibs=no
5487 if test "$link_all_deplibs" != no || test -z "$library_names" ||
5488 test "$build_libtool_libs" = no; then
5489 linkalldeplibs=yes
5492 tmp_libs=
5493 for deplib in $dependency_libs; do
5494 case $deplib in
5495 -L*) func_stripname '-L' '' "$deplib"
5496 newlib_search_path="$newlib_search_path $func_stripname_result"
5498 esac
5499 # Need to link against all dependency_libs?
5500 if test "$linkalldeplibs" = yes; then
5501 deplibs="$deplib $deplibs"
5502 else
5503 # Need to hardcode shared library paths
5504 # or/and link against static libraries
5505 newdependency_libs="$deplib $newdependency_libs"
5507 if $opt_duplicate_deps ; then
5508 case "$tmp_libs " in
5509 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5510 esac
5512 tmp_libs="$tmp_libs $deplib"
5513 done # for deplib
5514 continue
5515 fi # $linkmode = prog...
5517 if test "$linkmode,$pass" = "prog,link"; then
5518 if test -n "$library_names" &&
5519 { { test "$prefer_static_libs" = no ||
5520 test "$prefer_static_libs,$installed" = "built,yes"; } ||
5521 test -z "$old_library"; }; then
5522 # We need to hardcode the library path
5523 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
5524 # Make sure the rpath contains only unique directories.
5525 case "$temp_rpath:" in
5526 *"$absdir:"*) ;;
5527 *) temp_rpath="$temp_rpath$absdir:" ;;
5528 esac
5531 # Hardcode the library path.
5532 # Skip directories that are in the system default run-time
5533 # search path.
5534 case " $sys_lib_dlsearch_path " in
5535 *" $absdir "*) ;;
5537 case "$compile_rpath " in
5538 *" $absdir "*) ;;
5539 *) compile_rpath="$compile_rpath $absdir"
5540 esac
5542 esac
5543 case " $sys_lib_dlsearch_path " in
5544 *" $libdir "*) ;;
5546 case "$finalize_rpath " in
5547 *" $libdir "*) ;;
5548 *) finalize_rpath="$finalize_rpath $libdir"
5549 esac
5551 esac
5552 fi # $linkmode,$pass = prog,link...
5554 if test "$alldeplibs" = yes &&
5555 { test "$deplibs_check_method" = pass_all ||
5556 { test "$build_libtool_libs" = yes &&
5557 test -n "$library_names"; }; }; then
5558 # We only need to search for static libraries
5559 continue
5563 link_static=no # Whether the deplib will be linked statically
5564 use_static_libs=$prefer_static_libs
5565 if test "$use_static_libs" = built && test "$installed" = yes; then
5566 use_static_libs=no
5568 if test -n "$library_names" &&
5569 { test "$use_static_libs" = no || test -z "$old_library"; }; then
5570 case $host in
5571 *cygwin* | *mingw* | *cegcc*)
5572 # No point in relinking DLLs because paths are not encoded
5573 notinst_deplibs="$notinst_deplibs $lib"
5574 need_relink=no
5577 if test "$installed" = no; then
5578 notinst_deplibs="$notinst_deplibs $lib"
5579 need_relink=yes
5582 esac
5583 # This is a shared library
5585 # Warn about portability, can't link against -module's on some
5586 # systems (darwin). Don't bleat about dlopened modules though!
5587 dlopenmodule=""
5588 for dlpremoduletest in $dlprefiles; do
5589 if test "X$dlpremoduletest" = "X$lib"; then
5590 dlopenmodule="$dlpremoduletest"
5591 break
5593 done
5594 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
5595 $ECHO
5596 if test "$linkmode" = prog; then
5597 $ECHO "*** Warning: Linking the executable $output against the loadable module"
5598 else
5599 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
5601 $ECHO "*** $linklib is not portable!"
5603 if test "$linkmode" = lib &&
5604 test "$hardcode_into_libs" = yes; then
5605 # Hardcode the library path.
5606 # Skip directories that are in the system default run-time
5607 # search path.
5608 case " $sys_lib_dlsearch_path " in
5609 *" $absdir "*) ;;
5611 case "$compile_rpath " in
5612 *" $absdir "*) ;;
5613 *) compile_rpath="$compile_rpath $absdir"
5614 esac
5616 esac
5617 case " $sys_lib_dlsearch_path " in
5618 *" $libdir "*) ;;
5620 case "$finalize_rpath " in
5621 *" $libdir "*) ;;
5622 *) finalize_rpath="$finalize_rpath $libdir"
5623 esac
5625 esac
5628 if test -n "$old_archive_from_expsyms_cmds"; then
5629 # figure out the soname
5630 set dummy $library_names
5631 shift
5632 realname="$1"
5633 shift
5634 libname=`eval "\\$ECHO \"$libname_spec\""`
5635 # use dlname if we got it. it's perfectly good, no?
5636 if test -n "$dlname"; then
5637 soname="$dlname"
5638 elif test -n "$soname_spec"; then
5639 # bleh windows
5640 case $host in
5641 *cygwin* | mingw* | *cegcc*)
5642 func_arith $current - $age
5643 major=$func_arith_result
5644 versuffix="-$major"
5646 esac
5647 eval soname=\"$soname_spec\"
5648 else
5649 soname="$realname"
5652 # Make a new name for the extract_expsyms_cmds to use
5653 soroot="$soname"
5654 func_basename "$soroot"
5655 soname="$func_basename_result"
5656 func_stripname 'lib' '.dll' "$soname"
5657 newlib=libimp-$func_stripname_result.a
5659 # If the library has no export list, then create one now
5660 if test -f "$output_objdir/$soname-def"; then :
5661 else
5662 func_verbose "extracting exported symbol list from \`$soname'"
5663 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
5666 # Create $newlib
5667 if test -f "$output_objdir/$newlib"; then :; else
5668 func_verbose "generating import library for \`$soname'"
5669 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
5671 # make sure the library variables are pointing to the new library
5672 dir=$output_objdir
5673 linklib=$newlib
5674 fi # test -n "$old_archive_from_expsyms_cmds"
5676 if test "$linkmode" = prog || test "$mode" != relink; then
5677 add_shlibpath=
5678 add_dir=
5679 add=
5680 lib_linked=yes
5681 case $hardcode_action in
5682 immediate | unsupported)
5683 if test "$hardcode_direct" = no; then
5684 add="$dir/$linklib"
5685 case $host in
5686 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
5687 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
5688 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
5689 *-*-unixware7*) add_dir="-L$dir" ;;
5690 *-*-darwin* )
5691 # if the lib is a (non-dlopened) module then we can not
5692 # link against it, someone is ignoring the earlier warnings
5693 if /usr/bin/file -L $add 2> /dev/null |
5694 $GREP ": [^:]* bundle" >/dev/null ; then
5695 if test "X$dlopenmodule" != "X$lib"; then
5696 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
5697 if test -z "$old_library" ; then
5698 $ECHO
5699 $ECHO "*** And there doesn't seem to be a static archive available"
5700 $ECHO "*** The link will probably fail, sorry"
5701 else
5702 add="$dir/$old_library"
5704 elif test -n "$old_library"; then
5705 add="$dir/$old_library"
5708 esac
5709 elif test "$hardcode_minus_L" = no; then
5710 case $host in
5711 *-*-sunos*) add_shlibpath="$dir" ;;
5712 esac
5713 add_dir="-L$dir"
5714 add="-l$name"
5715 elif test "$hardcode_shlibpath_var" = no; then
5716 add_shlibpath="$dir"
5717 add="-l$name"
5718 else
5719 lib_linked=no
5722 relink)
5723 if test "$hardcode_direct" = yes &&
5724 test "$hardcode_direct_absolute" = no; then
5725 add="$dir/$linklib"
5726 elif test "$hardcode_minus_L" = yes; then
5727 add_dir="-L$dir"
5728 # Try looking first in the location we're being installed to.
5729 if test -n "$inst_prefix_dir"; then
5730 case $libdir in
5731 [\\/]*)
5732 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5734 esac
5736 add="-l$name"
5737 elif test "$hardcode_shlibpath_var" = yes; then
5738 add_shlibpath="$dir"
5739 add="-l$name"
5740 else
5741 lib_linked=no
5744 *) lib_linked=no ;;
5745 esac
5747 if test "$lib_linked" != yes; then
5748 func_fatal_configuration "unsupported hardcode properties"
5751 if test -n "$add_shlibpath"; then
5752 case :$compile_shlibpath: in
5753 *":$add_shlibpath:"*) ;;
5754 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
5755 esac
5757 if test "$linkmode" = prog; then
5758 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
5759 test -n "$add" && compile_deplibs="$add $compile_deplibs"
5760 else
5761 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5762 test -n "$add" && deplibs="$add $deplibs"
5763 if test "$hardcode_direct" != yes &&
5764 test "$hardcode_minus_L" != yes &&
5765 test "$hardcode_shlibpath_var" = yes; then
5766 case :$finalize_shlibpath: in
5767 *":$libdir:"*) ;;
5768 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5769 esac
5774 if test "$linkmode" = prog || test "$mode" = relink; then
5775 add_shlibpath=
5776 add_dir=
5777 add=
5778 # Finalize command for both is simple: just hardcode it.
5779 if test "$hardcode_direct" = yes &&
5780 test "$hardcode_direct_absolute" = no; then
5781 add="$libdir/$linklib"
5782 elif test "$hardcode_minus_L" = yes; then
5783 add_dir="-L$libdir"
5784 add="-l$name"
5785 elif test "$hardcode_shlibpath_var" = yes; then
5786 case :$finalize_shlibpath: in
5787 *":$libdir:"*) ;;
5788 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5789 esac
5790 add="-l$name"
5791 elif test "$hardcode_automatic" = yes; then
5792 if test -n "$inst_prefix_dir" &&
5793 test -f "$inst_prefix_dir$libdir/$linklib" ; then
5794 add="$inst_prefix_dir$libdir/$linklib"
5795 else
5796 add="$libdir/$linklib"
5798 else
5799 # We cannot seem to hardcode it, guess we'll fake it.
5800 add_dir="-L$libdir"
5801 # Try looking first in the location we're being installed to.
5802 if test -n "$inst_prefix_dir"; then
5803 case $libdir in
5804 [\\/]*)
5805 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5807 esac
5809 add="-l$name"
5812 if test "$linkmode" = prog; then
5813 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
5814 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
5815 else
5816 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5817 test -n "$add" && deplibs="$add $deplibs"
5820 elif test "$linkmode" = prog; then
5821 # Here we assume that one of hardcode_direct or hardcode_minus_L
5822 # is not unsupported. This is valid on all known static and
5823 # shared platforms.
5824 if test "$hardcode_direct" != unsupported; then
5825 test -n "$old_library" && linklib="$old_library"
5826 compile_deplibs="$dir/$linklib $compile_deplibs"
5827 finalize_deplibs="$dir/$linklib $finalize_deplibs"
5828 else
5829 compile_deplibs="-l$name -L$dir $compile_deplibs"
5830 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
5832 elif test "$build_libtool_libs" = yes; then
5833 # Not a shared library
5834 if test "$deplibs_check_method" != pass_all; then
5835 # We're trying link a shared library against a static one
5836 # but the system doesn't support it.
5838 # Just print a warning and add the library to dependency_libs so
5839 # that the program can be linked against the static library.
5840 $ECHO
5841 $ECHO "*** Warning: This system can not link to static lib archive $lib."
5842 $ECHO "*** I have the capability to make that library automatically link in when"
5843 $ECHO "*** you link to this library. But I can only do this if you have a"
5844 $ECHO "*** shared version of the library, which you do not appear to have."
5845 if test "$module" = yes; then
5846 $ECHO "*** But as you try to build a module library, libtool will still create "
5847 $ECHO "*** a static module, that should work as long as the dlopening application"
5848 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
5849 if test -z "$global_symbol_pipe"; then
5850 $ECHO
5851 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5852 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5853 $ECHO "*** not find such a program. So, this module is probably useless."
5854 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
5856 if test "$build_old_libs" = no; then
5857 build_libtool_libs=module
5858 build_old_libs=yes
5859 else
5860 build_libtool_libs=no
5863 else
5864 deplibs="$dir/$old_library $deplibs"
5865 link_static=yes
5867 fi # link shared/static library?
5869 if test "$linkmode" = lib; then
5870 if test -n "$dependency_libs" &&
5871 { test "$hardcode_into_libs" != yes ||
5872 test "$build_old_libs" = yes ||
5873 test "$link_static" = yes; }; then
5874 # Extract -R from dependency_libs
5875 temp_deplibs=
5876 for libdir in $dependency_libs; do
5877 case $libdir in
5878 -R*) func_stripname '-R' '' "$libdir"
5879 temp_xrpath=$func_stripname_result
5880 case " $xrpath " in
5881 *" $temp_xrpath "*) ;;
5882 *) xrpath="$xrpath $temp_xrpath";;
5883 esac;;
5884 *) temp_deplibs="$temp_deplibs $libdir";;
5885 esac
5886 done
5887 dependency_libs="$temp_deplibs"
5890 newlib_search_path="$newlib_search_path $absdir"
5891 # Link against this library
5892 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
5893 # ... and its dependency_libs
5894 tmp_libs=
5895 for deplib in $dependency_libs; do
5896 newdependency_libs="$deplib $newdependency_libs"
5897 if $opt_duplicate_deps ; then
5898 case "$tmp_libs " in
5899 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5900 esac
5902 tmp_libs="$tmp_libs $deplib"
5903 done
5905 if test "$link_all_deplibs" != no; then
5906 # Add the search paths of all dependency libraries
5907 for deplib in $dependency_libs; do
5908 case $deplib in
5909 -L*) path="$deplib" ;;
5910 *.la)
5911 func_dirname "$deplib" "" "."
5912 dir="$func_dirname_result"
5913 # We need an absolute path.
5914 case $dir in
5915 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
5917 absdir=`cd "$dir" && pwd`
5918 if test -z "$absdir"; then
5919 func_warning "cannot determine absolute directory name of \`$dir'"
5920 absdir="$dir"
5923 esac
5924 if $GREP "^installed=no" $deplib > /dev/null; then
5925 case $host in
5926 *-*-darwin*)
5927 depdepl=
5928 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
5929 if test -n "$deplibrary_names" ; then
5930 for tmp in $deplibrary_names ; do
5931 depdepl=$tmp
5932 done
5933 if test -f "$absdir/$objdir/$depdepl" ; then
5934 depdepl="$absdir/$objdir/$depdepl"
5935 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5936 if test -z "$darwin_install_name"; then
5937 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5939 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
5940 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
5941 path=
5946 path="-L$absdir/$objdir"
5948 esac
5949 else
5950 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5951 test -z "$libdir" && \
5952 func_fatal_error "\`$deplib' is not a valid libtool archive"
5953 test "$absdir" != "$libdir" && \
5954 func_warning "\`$deplib' seems to be moved"
5956 path="-L$absdir"
5959 esac
5960 case " $deplibs " in
5961 *" $path "*) ;;
5962 *) deplibs="$path $deplibs" ;;
5963 esac
5964 done
5965 fi # link_all_deplibs != no
5966 fi # linkmode = lib
5967 done # for deplib in $libs
5968 if test "$pass" = link; then
5969 if test "$linkmode" = "prog"; then
5970 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
5971 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
5972 else
5973 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5976 dependency_libs="$newdependency_libs"
5977 if test "$pass" = dlpreopen; then
5978 # Link the dlpreopened libraries before other libraries
5979 for deplib in $save_deplibs; do
5980 deplibs="$deplib $deplibs"
5981 done
5983 if test "$pass" != dlopen; then
5984 if test "$pass" != conv; then
5985 # Make sure lib_search_path contains only unique directories.
5986 lib_search_path=
5987 for dir in $newlib_search_path; do
5988 case "$lib_search_path " in
5989 *" $dir "*) ;;
5990 *) lib_search_path="$lib_search_path $dir" ;;
5991 esac
5992 done
5993 newlib_search_path=
5996 if test "$linkmode,$pass" != "prog,link"; then
5997 vars="deplibs"
5998 else
5999 vars="compile_deplibs finalize_deplibs"
6001 for var in $vars dependency_libs; do
6002 # Add libraries to $var in reverse order
6003 eval tmp_libs=\"\$$var\"
6004 new_libs=
6005 for deplib in $tmp_libs; do
6006 # FIXME: Pedantically, this is the right thing to do, so
6007 # that some nasty dependency loop isn't accidentally
6008 # broken:
6009 #new_libs="$deplib $new_libs"
6010 # Pragmatically, this seems to cause very few problems in
6011 # practice:
6012 case $deplib in
6013 -L*) new_libs="$deplib $new_libs" ;;
6014 -R*) ;;
6016 # And here is the reason: when a library appears more
6017 # than once as an explicit dependence of a library, or
6018 # is implicitly linked in more than once by the
6019 # compiler, it is considered special, and multiple
6020 # occurrences thereof are not removed. Compare this
6021 # with having the same library being listed as a
6022 # dependency of multiple other libraries: in this case,
6023 # we know (pedantically, we assume) the library does not
6024 # need to be listed more than once, so we keep only the
6025 # last copy. This is not always right, but it is rare
6026 # enough that we require users that really mean to play
6027 # such unportable linking tricks to link the library
6028 # using -Wl,-lname, so that libtool does not consider it
6029 # for duplicate removal.
6030 case " $specialdeplibs " in
6031 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6033 case " $new_libs " in
6034 *" $deplib "*) ;;
6035 *) new_libs="$deplib $new_libs" ;;
6036 esac
6038 esac
6040 esac
6041 done
6042 tmp_libs=
6043 for deplib in $new_libs; do
6044 case $deplib in
6045 -L*)
6046 case " $tmp_libs " in
6047 *" $deplib "*) ;;
6048 *) tmp_libs="$tmp_libs $deplib" ;;
6049 esac
6051 *) tmp_libs="$tmp_libs $deplib" ;;
6052 esac
6053 done
6054 eval $var=\"$tmp_libs\"
6055 done # for var
6057 # Last step: remove runtime libs from dependency_libs
6058 # (they stay in deplibs)
6059 tmp_libs=
6060 for i in $dependency_libs ; do
6061 case " $predeps $postdeps $compiler_lib_search_path " in
6062 *" $i "*)
6063 i=""
6065 esac
6066 if test -n "$i" ; then
6067 tmp_libs="$tmp_libs $i"
6069 done
6070 dependency_libs=$tmp_libs
6071 done # for pass
6072 if test "$linkmode" = prog; then
6073 dlfiles="$newdlfiles"
6075 if test "$linkmode" = prog || test "$linkmode" = lib; then
6076 dlprefiles="$newdlprefiles"
6079 case $linkmode in
6080 oldlib)
6081 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6082 func_warning "\`-dlopen' is ignored for archives"
6085 case " $deplibs" in
6086 *\ -l* | *\ -L*)
6087 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6088 esac
6090 test -n "$rpath" && \
6091 func_warning "\`-rpath' is ignored for archives"
6093 test -n "$xrpath" && \
6094 func_warning "\`-R' is ignored for archives"
6096 test -n "$vinfo" && \
6097 func_warning "\`-version-info/-version-number' is ignored for archives"
6099 test -n "$release" && \
6100 func_warning "\`-release' is ignored for archives"
6102 test -n "$export_symbols$export_symbols_regex" && \
6103 func_warning "\`-export-symbols' is ignored for archives"
6105 # Now set the variables for building old libraries.
6106 build_libtool_libs=no
6107 oldlibs="$output"
6108 objs="$objs$old_deplibs"
6111 lib)
6112 # Make sure we only generate libraries of the form `libNAME.la'.
6113 case $outputname in
6114 lib*)
6115 func_stripname 'lib' '.la' "$outputname"
6116 name=$func_stripname_result
6117 eval shared_ext=\"$shrext_cmds\"
6118 eval libname=\"$libname_spec\"
6121 test "$module" = no && \
6122 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6124 if test "$need_lib_prefix" != no; then
6125 # Add the "lib" prefix for modules if required
6126 func_stripname '' '.la' "$outputname"
6127 name=$func_stripname_result
6128 eval shared_ext=\"$shrext_cmds\"
6129 eval libname=\"$libname_spec\"
6130 else
6131 func_stripname '' '.la' "$outputname"
6132 libname=$func_stripname_result
6135 esac
6137 if test -n "$objs"; then
6138 if test "$deplibs_check_method" != pass_all; then
6139 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6140 else
6141 $ECHO
6142 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6143 $ECHO "*** objects $objs is not portable!"
6144 libobjs="$libobjs $objs"
6148 test "$dlself" != no && \
6149 func_warning "\`-dlopen self' is ignored for libtool libraries"
6151 set dummy $rpath
6152 shift
6153 test "$#" -gt 1 && \
6154 func_warning "ignoring multiple \`-rpath's for a libtool library"
6156 install_libdir="$1"
6158 oldlibs=
6159 if test -z "$rpath"; then
6160 if test "$build_libtool_libs" = yes; then
6161 # Building a libtool convenience library.
6162 # Some compilers have problems with a `.al' extension so
6163 # convenience libraries should have the same extension an
6164 # archive normally would.
6165 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6166 build_libtool_libs=convenience
6167 build_old_libs=yes
6170 test -n "$vinfo" && \
6171 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6173 test -n "$release" && \
6174 func_warning "\`-release' is ignored for convenience libraries"
6175 else
6177 # Parse the version information argument.
6178 save_ifs="$IFS"; IFS=':'
6179 set dummy $vinfo 0 0 0
6180 shift
6181 IFS="$save_ifs"
6183 test -n "$7" && \
6184 func_fatal_help "too many parameters to \`-version-info'"
6186 # convert absolute version numbers to libtool ages
6187 # this retains compatibility with .la files and attempts
6188 # to make the code below a bit more comprehensible
6190 case $vinfo_number in
6191 yes)
6192 number_major="$1"
6193 number_minor="$2"
6194 number_revision="$3"
6196 # There are really only two kinds -- those that
6197 # use the current revision as the major version
6198 # and those that subtract age and use age as
6199 # a minor version. But, then there is irix
6200 # which has an extra 1 added just for fun
6202 case $version_type in
6203 darwin|linux|osf|windows|none)
6204 func_arith $number_major + $number_minor
6205 current=$func_arith_result
6206 age="$number_minor"
6207 revision="$number_revision"
6209 freebsd-aout|freebsd-elf|sunos)
6210 current="$number_major"
6211 revision="$number_minor"
6212 age="0"
6214 irix|nonstopux)
6215 func_arith $number_major + $number_minor
6216 current=$func_arith_result
6217 age="$number_minor"
6218 revision="$number_minor"
6219 lt_irix_increment=no
6221 esac
6224 current="$1"
6225 revision="$2"
6226 age="$3"
6228 esac
6230 # Check that each of the things are valid numbers.
6231 case $current in
6232 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]) ;;
6234 func_error "CURRENT \`$current' must be a nonnegative integer"
6235 func_fatal_error "\`$vinfo' is not valid version information"
6237 esac
6239 case $revision in
6240 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]) ;;
6242 func_error "REVISION \`$revision' must be a nonnegative integer"
6243 func_fatal_error "\`$vinfo' is not valid version information"
6245 esac
6247 case $age in
6248 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]) ;;
6250 func_error "AGE \`$age' must be a nonnegative integer"
6251 func_fatal_error "\`$vinfo' is not valid version information"
6253 esac
6255 if test "$age" -gt "$current"; then
6256 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6257 func_fatal_error "\`$vinfo' is not valid version information"
6260 # Calculate the version variables.
6261 major=
6262 versuffix=
6263 verstring=
6264 case $version_type in
6265 none) ;;
6267 darwin)
6268 # Like Linux, but with the current version available in
6269 # verstring for coding it into the library header
6270 func_arith $current - $age
6271 major=.$func_arith_result
6272 versuffix="$major.$age.$revision"
6273 # Darwin ld doesn't like 0 for these options...
6274 func_arith $current + 1
6275 minor_current=$func_arith_result
6276 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6277 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6280 freebsd-aout)
6281 major=".$current"
6282 versuffix=".$current.$revision";
6285 freebsd-elf)
6286 major=".$current"
6287 versuffix=".$current"
6290 irix | nonstopux)
6291 if test "X$lt_irix_increment" = "Xno"; then
6292 func_arith $current - $age
6293 else
6294 func_arith $current - $age + 1
6296 major=$func_arith_result
6298 case $version_type in
6299 nonstopux) verstring_prefix=nonstopux ;;
6300 *) verstring_prefix=sgi ;;
6301 esac
6302 verstring="$verstring_prefix$major.$revision"
6304 # Add in all the interfaces that we are compatible with.
6305 loop=$revision
6306 while test "$loop" -ne 0; do
6307 func_arith $revision - $loop
6308 iface=$func_arith_result
6309 func_arith $loop - 1
6310 loop=$func_arith_result
6311 verstring="$verstring_prefix$major.$iface:$verstring"
6312 done
6314 # Before this point, $major must not contain `.'.
6315 major=.$major
6316 versuffix="$major.$revision"
6319 linux)
6320 func_arith $current - $age
6321 major=.$func_arith_result
6322 versuffix="$major.$age.$revision"
6325 osf)
6326 func_arith $current - $age
6327 major=.$func_arith_result
6328 versuffix=".$current.$age.$revision"
6329 verstring="$current.$age.$revision"
6331 # Add in all the interfaces that we are compatible with.
6332 loop=$age
6333 while test "$loop" -ne 0; do
6334 func_arith $current - $loop
6335 iface=$func_arith_result
6336 func_arith $loop - 1
6337 loop=$func_arith_result
6338 verstring="$verstring:${iface}.0"
6339 done
6341 # Make executables depend on our current version.
6342 verstring="$verstring:${current}.0"
6345 qnx)
6346 major=".$current"
6347 versuffix=".$current"
6350 sunos)
6351 major=".$current"
6352 versuffix=".$current.$revision"
6355 windows)
6356 # Use '-' rather than '.', since we only want one
6357 # extension on DOS 8.3 filesystems.
6358 func_arith $current - $age
6359 major=$func_arith_result
6360 versuffix="-$major"
6364 func_fatal_configuration "unknown library version type \`$version_type'"
6366 esac
6368 # Clear the version info if we defaulted, and they specified a release.
6369 if test -z "$vinfo" && test -n "$release"; then
6370 major=
6371 case $version_type in
6372 darwin)
6373 # we can't check for "0.0" in archive_cmds due to quoting
6374 # problems, so we reset it completely
6375 verstring=
6378 verstring="0.0"
6380 esac
6381 if test "$need_version" = no; then
6382 versuffix=
6383 else
6384 versuffix=".0.0"
6388 # Remove version info from name if versioning should be avoided
6389 if test "$avoid_version" = yes && test "$need_version" = no; then
6390 major=
6391 versuffix=
6392 verstring=""
6395 # Check to see if the archive will have undefined symbols.
6396 if test "$allow_undefined" = yes; then
6397 if test "$allow_undefined_flag" = unsupported; then
6398 func_warning "undefined symbols not allowed in $host shared libraries"
6399 build_libtool_libs=no
6400 build_old_libs=yes
6402 else
6403 # Don't allow undefined symbols.
6404 allow_undefined_flag="$no_undefined_flag"
6409 func_generate_dlsyms "$libname" "$libname" "yes"
6410 libobjs="$libobjs $symfileobj"
6411 test "X$libobjs" = "X " && libobjs=
6413 if test "$mode" != relink; then
6414 # Remove our outputs, but don't remove object files since they
6415 # may have been created when compiling PIC objects.
6416 removelist=
6417 tempremovelist=`$ECHO "$output_objdir/*"`
6418 for p in $tempremovelist; do
6419 case $p in
6420 *.$objext | *.gcno)
6422 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
6423 if test "X$precious_files_regex" != "X"; then
6424 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6425 then
6426 continue
6429 removelist="$removelist $p"
6431 *) ;;
6432 esac
6433 done
6434 test -n "$removelist" && \
6435 func_show_eval "${RM}r \$removelist"
6438 # Now set the variables for building old libraries.
6439 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
6440 oldlibs="$oldlibs $output_objdir/$libname.$libext"
6442 # Transform .lo files to .o files.
6443 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
6446 # Eliminate all temporary directories.
6447 #for path in $notinst_path; do
6448 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
6449 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
6450 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
6451 #done
6453 if test -n "$xrpath"; then
6454 # If the user specified any rpath flags, then add them.
6455 temp_xrpath=
6456 for libdir in $xrpath; do
6457 temp_xrpath="$temp_xrpath -R$libdir"
6458 case "$finalize_rpath " in
6459 *" $libdir "*) ;;
6460 *) finalize_rpath="$finalize_rpath $libdir" ;;
6461 esac
6462 done
6463 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
6464 dependency_libs="$temp_xrpath $dependency_libs"
6468 # Make sure dlfiles contains only unique files that won't be dlpreopened
6469 old_dlfiles="$dlfiles"
6470 dlfiles=
6471 for lib in $old_dlfiles; do
6472 case " $dlprefiles $dlfiles " in
6473 *" $lib "*) ;;
6474 *) dlfiles="$dlfiles $lib" ;;
6475 esac
6476 done
6478 # Make sure dlprefiles contains only unique files
6479 old_dlprefiles="$dlprefiles"
6480 dlprefiles=
6481 for lib in $old_dlprefiles; do
6482 case "$dlprefiles " in
6483 *" $lib "*) ;;
6484 *) dlprefiles="$dlprefiles $lib" ;;
6485 esac
6486 done
6488 if test "$build_libtool_libs" = yes; then
6489 if test -n "$rpath"; then
6490 case $host in
6491 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
6492 # these systems don't actually have a c library (as such)!
6494 *-*-rhapsody* | *-*-darwin1.[012])
6495 # Rhapsody C library is in the System framework
6496 deplibs="$deplibs System.ltframework"
6498 *-*-netbsd*)
6499 # Don't link with libc until the a.out ld.so is fixed.
6501 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6502 # Do not include libc due to us having libc/libc_r.
6504 *-*-sco3.2v5* | *-*-sco5v6*)
6505 # Causes problems with __ctype
6507 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6508 # Compiler inserts libc in the correct place for threads to work
6511 # Add libc to deplibs on all other systems if necessary.
6512 if test "$build_libtool_need_lc" = "yes"; then
6513 deplibs="$deplibs -lc"
6516 esac
6519 # Transform deplibs into only deplibs that can be linked in shared.
6520 name_save=$name
6521 libname_save=$libname
6522 release_save=$release
6523 versuffix_save=$versuffix
6524 major_save=$major
6525 # I'm not sure if I'm treating the release correctly. I think
6526 # release should show up in the -l (ie -lgmp5) so we don't want to
6527 # add it in twice. Is that correct?
6528 release=""
6529 versuffix=""
6530 major=""
6531 newdeplibs=
6532 droppeddeps=no
6533 case $deplibs_check_method in
6534 pass_all)
6535 # Don't check for shared/static. Everything works.
6536 # This might be a little naive. We might want to check
6537 # whether the library exists or not. But this is on
6538 # osf3 & osf4 and I'm not really sure... Just
6539 # implementing what was already the behavior.
6540 newdeplibs=$deplibs
6542 test_compile)
6543 # This code stresses the "libraries are programs" paradigm to its
6544 # limits. Maybe even breaks it. We compile a program, linking it
6545 # against the deplibs as a proxy for the library. Then we can check
6546 # whether they linked in statically or dynamically with ldd.
6547 $opt_dry_run || $RM conftest.c
6548 cat > conftest.c <<EOF
6549 int main() { return 0; }
6551 $opt_dry_run || $RM conftest
6552 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
6553 ldd_output=`ldd conftest`
6554 for i in $deplibs; do
6555 case $i in
6556 -l*)
6557 func_stripname -l '' "$i"
6558 name=$func_stripname_result
6559 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6560 case " $predeps $postdeps " in
6561 *" $i "*)
6562 newdeplibs="$newdeplibs $i"
6563 i=""
6565 esac
6567 if test -n "$i" ; then
6568 libname=`eval "\\$ECHO \"$libname_spec\""`
6569 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6570 set dummy $deplib_matches; shift
6571 deplib_match=$1
6572 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6573 newdeplibs="$newdeplibs $i"
6574 else
6575 droppeddeps=yes
6576 $ECHO
6577 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6578 $ECHO "*** I have the capability to make that library automatically link in when"
6579 $ECHO "*** you link to this library. But I can only do this if you have a"
6580 $ECHO "*** shared version of the library, which I believe you do not have"
6581 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
6582 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
6587 newdeplibs="$newdeplibs $i"
6589 esac
6590 done
6591 else
6592 # Error occurred in the first compile. Let's try to salvage
6593 # the situation: Compile a separate program for each library.
6594 for i in $deplibs; do
6595 case $i in
6596 -l*)
6597 func_stripname -l '' "$i"
6598 name=$func_stripname_result
6599 $opt_dry_run || $RM conftest
6600 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
6601 ldd_output=`ldd conftest`
6602 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6603 case " $predeps $postdeps " in
6604 *" $i "*)
6605 newdeplibs="$newdeplibs $i"
6606 i=""
6608 esac
6610 if test -n "$i" ; then
6611 libname=`eval "\\$ECHO \"$libname_spec\""`
6612 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6613 set dummy $deplib_matches; shift
6614 deplib_match=$1
6615 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6616 newdeplibs="$newdeplibs $i"
6617 else
6618 droppeddeps=yes
6619 $ECHO
6620 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6621 $ECHO "*** I have the capability to make that library automatically link in when"
6622 $ECHO "*** you link to this library. But I can only do this if you have a"
6623 $ECHO "*** shared version of the library, which you do not appear to have"
6624 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
6625 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
6628 else
6629 droppeddeps=yes
6630 $ECHO
6631 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
6632 $ECHO "*** make it link in! You will probably need to install it or some"
6633 $ECHO "*** library that it depends on before this library will be fully"
6634 $ECHO "*** functional. Installing it before continuing would be even better."
6638 newdeplibs="$newdeplibs $i"
6640 esac
6641 done
6644 file_magic*)
6645 set dummy $deplibs_check_method; shift
6646 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6647 for a_deplib in $deplibs; do
6648 case $a_deplib in
6649 -l*)
6650 func_stripname -l '' "$a_deplib"
6651 name=$func_stripname_result
6652 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6653 case " $predeps $postdeps " in
6654 *" $a_deplib "*)
6655 newdeplibs="$newdeplibs $a_deplib"
6656 a_deplib=""
6658 esac
6660 if test -n "$a_deplib" ; then
6661 libname=`eval "\\$ECHO \"$libname_spec\""`
6662 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6663 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6664 for potent_lib in $potential_libs; do
6665 # Follow soft links.
6666 if ls -lLd "$potent_lib" 2>/dev/null |
6667 $GREP " -> " >/dev/null; then
6668 continue
6670 # The statement above tries to avoid entering an
6671 # endless loop below, in case of cyclic links.
6672 # We might still enter an endless loop, since a link
6673 # loop can be closed while we follow links,
6674 # but so what?
6675 potlib="$potent_lib"
6676 while test -h "$potlib" 2>/dev/null; do
6677 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
6678 case $potliblink in
6679 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
6680 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
6681 esac
6682 done
6683 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
6684 $SED -e 10q |
6685 $EGREP "$file_magic_regex" > /dev/null; then
6686 newdeplibs="$newdeplibs $a_deplib"
6687 a_deplib=""
6688 break 2
6690 done
6691 done
6693 if test -n "$a_deplib" ; then
6694 droppeddeps=yes
6695 $ECHO
6696 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6697 $ECHO "*** I have the capability to make that library automatically link in when"
6698 $ECHO "*** you link to this library. But I can only do this if you have a"
6699 $ECHO "*** shared version of the library, which you do not appear to have"
6700 $ECHO "*** because I did check the linker path looking for a file starting"
6701 if test -z "$potlib" ; then
6702 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
6703 else
6704 $ECHO "*** with $libname and none of the candidates passed a file format test"
6705 $ECHO "*** using a file magic. Last file checked: $potlib"
6710 # Add a -L argument.
6711 newdeplibs="$newdeplibs $a_deplib"
6713 esac
6714 done # Gone through all deplibs.
6716 match_pattern*)
6717 set dummy $deplibs_check_method; shift
6718 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6719 for a_deplib in $deplibs; do
6720 case $a_deplib in
6721 -l*)
6722 func_stripname -l '' "$a_deplib"
6723 name=$func_stripname_result
6724 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6725 case " $predeps $postdeps " in
6726 *" $a_deplib "*)
6727 newdeplibs="$newdeplibs $a_deplib"
6728 a_deplib=""
6730 esac
6732 if test -n "$a_deplib" ; then
6733 libname=`eval "\\$ECHO \"$libname_spec\""`
6734 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6735 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6736 for potent_lib in $potential_libs; do
6737 potlib="$potent_lib" # see symlink-check above in file_magic test
6738 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
6739 $EGREP "$match_pattern_regex" > /dev/null; then
6740 newdeplibs="$newdeplibs $a_deplib"
6741 a_deplib=""
6742 break 2
6744 done
6745 done
6747 if test -n "$a_deplib" ; then
6748 droppeddeps=yes
6749 $ECHO
6750 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6751 $ECHO "*** I have the capability to make that library automatically link in when"
6752 $ECHO "*** you link to this library. But I can only do this if you have a"
6753 $ECHO "*** shared version of the library, which you do not appear to have"
6754 $ECHO "*** because I did check the linker path looking for a file starting"
6755 if test -z "$potlib" ; then
6756 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
6757 else
6758 $ECHO "*** with $libname and none of the candidates passed a file format test"
6759 $ECHO "*** using a regex pattern. Last file checked: $potlib"
6764 # Add a -L argument.
6765 newdeplibs="$newdeplibs $a_deplib"
6767 esac
6768 done # Gone through all deplibs.
6770 none | unknown | *)
6771 newdeplibs=""
6772 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
6773 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
6774 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6775 for i in $predeps $postdeps ; do
6776 # can't use Xsed below, because $i might contain '/'
6777 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
6778 done
6780 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
6781 $GREP . >/dev/null; then
6782 $ECHO
6783 if test "X$deplibs_check_method" = "Xnone"; then
6784 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
6785 else
6786 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
6788 $ECHO "*** All declared inter-library dependencies are being dropped."
6789 droppeddeps=yes
6792 esac
6793 versuffix=$versuffix_save
6794 major=$major_save
6795 release=$release_save
6796 libname=$libname_save
6797 name=$name_save
6799 case $host in
6800 *-*-rhapsody* | *-*-darwin1.[012])
6801 # On Rhapsody replace the C library with the System framework
6802 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6804 esac
6806 if test "$droppeddeps" = yes; then
6807 if test "$module" = yes; then
6808 $ECHO
6809 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
6810 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
6811 $ECHO "*** a static module, that should work as long as the dlopening"
6812 $ECHO "*** application is linked with the -dlopen flag."
6813 if test -z "$global_symbol_pipe"; then
6814 $ECHO
6815 $ECHO "*** However, this would only work if libtool was able to extract symbol"
6816 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6817 $ECHO "*** not find such a program. So, this module is probably useless."
6818 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6820 if test "$build_old_libs" = no; then
6821 oldlibs="$output_objdir/$libname.$libext"
6822 build_libtool_libs=module
6823 build_old_libs=yes
6824 else
6825 build_libtool_libs=no
6827 else
6828 $ECHO "*** The inter-library dependencies that have been dropped here will be"
6829 $ECHO "*** automatically added whenever a program is linked with this library"
6830 $ECHO "*** or is declared to -dlopen it."
6832 if test "$allow_undefined" = no; then
6833 $ECHO
6834 $ECHO "*** Since this library must not contain undefined symbols,"
6835 $ECHO "*** because either the platform does not support them or"
6836 $ECHO "*** it was explicitly requested with -no-undefined,"
6837 $ECHO "*** libtool will only create a static version of it."
6838 if test "$build_old_libs" = no; then
6839 oldlibs="$output_objdir/$libname.$libext"
6840 build_libtool_libs=module
6841 build_old_libs=yes
6842 else
6843 build_libtool_libs=no
6848 # Done checking deplibs!
6849 deplibs=$newdeplibs
6851 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6852 case $host in
6853 *-*-darwin*)
6854 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6855 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6856 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6858 esac
6860 # move library search paths that coincide with paths to not yet
6861 # installed libraries to the beginning of the library search list
6862 new_libs=
6863 for path in $notinst_path; do
6864 case " $new_libs " in
6865 *" -L$path/$objdir "*) ;;
6867 case " $deplibs " in
6868 *" -L$path/$objdir "*)
6869 new_libs="$new_libs -L$path/$objdir" ;;
6870 esac
6872 esac
6873 done
6874 for deplib in $deplibs; do
6875 case $deplib in
6876 -L*)
6877 case " $new_libs " in
6878 *" $deplib "*) ;;
6879 *) new_libs="$new_libs $deplib" ;;
6880 esac
6882 *) new_libs="$new_libs $deplib" ;;
6883 esac
6884 done
6885 deplibs="$new_libs"
6887 # All the library-specific variables (install_libdir is set above).
6888 library_names=
6889 old_library=
6890 dlname=
6892 # Test again, we may have decided not to build it any more
6893 if test "$build_libtool_libs" = yes; then
6894 if test "$hardcode_into_libs" = yes; then
6895 # Hardcode the library paths
6896 hardcode_libdirs=
6897 dep_rpath=
6898 rpath="$finalize_rpath"
6899 test "$mode" != relink && rpath="$compile_rpath$rpath"
6900 for libdir in $rpath; do
6901 if test -n "$hardcode_libdir_flag_spec"; then
6902 if test -n "$hardcode_libdir_separator"; then
6903 if test -z "$hardcode_libdirs"; then
6904 hardcode_libdirs="$libdir"
6905 else
6906 # Just accumulate the unique libdirs.
6907 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6908 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6911 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6913 esac
6915 else
6916 eval flag=\"$hardcode_libdir_flag_spec\"
6917 dep_rpath="$dep_rpath $flag"
6919 elif test -n "$runpath_var"; then
6920 case "$perm_rpath " in
6921 *" $libdir "*) ;;
6922 *) perm_rpath="$perm_rpath $libdir" ;;
6923 esac
6925 done
6926 # Substitute the hardcoded libdirs into the rpath.
6927 if test -n "$hardcode_libdir_separator" &&
6928 test -n "$hardcode_libdirs"; then
6929 libdir="$hardcode_libdirs"
6930 if test -n "$hardcode_libdir_flag_spec_ld"; then
6931 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
6932 else
6933 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
6936 if test -n "$runpath_var" && test -n "$perm_rpath"; then
6937 # We should set the runpath_var.
6938 rpath=
6939 for dir in $perm_rpath; do
6940 rpath="$rpath$dir:"
6941 done
6942 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
6944 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
6947 shlibpath="$finalize_shlibpath"
6948 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
6949 if test -n "$shlibpath"; then
6950 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
6953 # Get the real and link names of the library.
6954 eval shared_ext=\"$shrext_cmds\"
6955 eval library_names=\"$library_names_spec\"
6956 set dummy $library_names
6957 shift
6958 realname="$1"
6959 shift
6961 if test -n "$soname_spec"; then
6962 eval soname=\"$soname_spec\"
6963 else
6964 soname="$realname"
6966 if test -z "$dlname"; then
6967 dlname=$soname
6970 lib="$output_objdir/$realname"
6971 linknames=
6972 for link
6974 linknames="$linknames $link"
6975 done
6977 # Use standard objects if they are pic
6978 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6979 test "X$libobjs" = "X " && libobjs=
6981 delfiles=
6982 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6983 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
6984 export_symbols="$output_objdir/$libname.uexp"
6985 delfiles="$delfiles $export_symbols"
6988 orig_export_symbols=
6989 case $host_os in
6990 cygwin* | mingw* | cegcc*)
6991 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
6992 # exporting using user supplied symfile
6993 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
6994 # and it's NOT already a .def file. Must figure out
6995 # which of the given symbols are data symbols and tag
6996 # them as such. So, trigger use of export_symbols_cmds.
6997 # export_symbols gets reassigned inside the "prepare
6998 # the list of exported symbols" if statement, so the
6999 # include_expsyms logic still works.
7000 orig_export_symbols="$export_symbols"
7001 export_symbols=
7002 always_export_symbols=yes
7006 esac
7008 # Prepare the list of exported symbols
7009 if test -z "$export_symbols"; then
7010 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7011 func_verbose "generating symbol list for \`$libname.la'"
7012 export_symbols="$output_objdir/$libname.exp"
7013 $opt_dry_run || $RM $export_symbols
7014 cmds=$export_symbols_cmds
7015 save_ifs="$IFS"; IFS='~'
7016 for cmd in $cmds; do
7017 IFS="$save_ifs"
7018 eval cmd=\"$cmd\"
7019 func_len " $cmd"
7020 len=$func_len_result
7021 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7022 func_show_eval "$cmd" 'exit $?'
7023 skipped_export=false
7024 else
7025 # The command line is too long to execute in one step.
7026 func_verbose "using reloadable object file for export list..."
7027 skipped_export=:
7028 # Break out early, otherwise skipped_export may be
7029 # set to false by a later but shorter cmd.
7030 break
7032 done
7033 IFS="$save_ifs"
7034 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7035 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7036 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7041 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7042 tmp_export_symbols="$export_symbols"
7043 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7044 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7047 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7048 # The given exports_symbols file has to be filtered, so filter it.
7049 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7050 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7051 # 's' commands which not all seds can handle. GNU sed should be fine
7052 # though. Also, the filter scales superlinearly with the number of
7053 # global variables. join(1) would be nice here, but unfortunately
7054 # isn't a blessed tool.
7055 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7056 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7057 export_symbols=$output_objdir/$libname.def
7058 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7061 tmp_deplibs=
7062 inst_prefix_arg=
7063 for test_deplib in $deplibs; do
7064 case " $convenience " in
7065 *" $test_deplib "*) ;;
7067 if test -n "$inst_prefix_dir" && (echo "$test_deplib" | grep -- "$inst_prefix_dir" >/dev/null); then
7068 inst_prefix_arg="$inst_prefix_arg $test_deplib"
7069 else
7070 tmp_deplibs="$tmp_deplibs $test_deplib"
7073 esac
7074 done
7075 deplibs="$tmp_deplibs"
7076 if test -n "$inst_prefix_arg"; then
7077 deplibs="$inst_prefix_arg $deplibs"
7080 if test -n "$convenience"; then
7081 if test -n "$whole_archive_flag_spec" &&
7082 test "$compiler_needs_object" = yes &&
7083 test -z "$libobjs"; then
7084 # extract the archives, so we have objects to list.
7085 # TODO: could optimize this to just extract one archive.
7086 whole_archive_flag_spec=
7088 if test -n "$whole_archive_flag_spec"; then
7089 save_libobjs=$libobjs
7090 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7091 test "X$libobjs" = "X " && libobjs=
7092 else
7093 gentop="$output_objdir/${outputname}x"
7094 generated="$generated $gentop"
7096 func_extract_archives $gentop $convenience
7097 libobjs="$libobjs $func_extract_archives_result"
7098 test "X$libobjs" = "X " && libobjs=
7102 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7103 eval flag=\"$thread_safe_flag_spec\"
7104 linker_flags="$linker_flags $flag"
7107 # Make a backup of the uninstalled library when relinking
7108 if test "$mode" = relink; then
7109 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7112 # Do each of the archive commands.
7113 if test "$module" = yes && test -n "$module_cmds" ; then
7114 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7115 eval test_cmds=\"$module_expsym_cmds\"
7116 cmds=$module_expsym_cmds
7117 else
7118 eval test_cmds=\"$module_cmds\"
7119 cmds=$module_cmds
7121 else
7122 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7123 eval test_cmds=\"$archive_expsym_cmds\"
7124 cmds=$archive_expsym_cmds
7125 else
7126 eval test_cmds=\"$archive_cmds\"
7127 cmds=$archive_cmds
7131 if test "X$skipped_export" != "X:" &&
7132 func_len " $test_cmds" &&
7133 len=$func_len_result &&
7134 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7136 else
7137 # The command line is too long to link in one step, link piecewise
7138 # or, if using GNU ld and skipped_export is not :, use a linker
7139 # script.
7141 # Save the value of $output and $libobjs because we want to
7142 # use them later. If we have whole_archive_flag_spec, we
7143 # want to use save_libobjs as it was before
7144 # whole_archive_flag_spec was expanded, because we can't
7145 # assume the linker understands whole_archive_flag_spec.
7146 # This may have to be revisited, in case too many
7147 # convenience libraries get linked in and end up exceeding
7148 # the spec.
7149 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7150 save_libobjs=$libobjs
7152 save_output=$output
7153 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
7155 # Clear the reloadable object creation command queue and
7156 # initialize k to one.
7157 test_cmds=
7158 concat_cmds=
7159 objlist=
7160 last_robj=
7163 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7164 output=${output_objdir}/${output_la}.lnkscript
7165 func_verbose "creating GNU ld script: $output"
7166 $ECHO 'INPUT (' > $output
7167 for obj in $save_libobjs
7169 $ECHO "$obj" >> $output
7170 done
7171 $ECHO ')' >> $output
7172 delfiles="$delfiles $output"
7173 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7174 output=${output_objdir}/${output_la}.lnk
7175 func_verbose "creating linker input file list: $output"
7176 : > $output
7177 set x $save_libobjs
7178 shift
7179 firstobj=
7180 if test "$compiler_needs_object" = yes; then
7181 firstobj="$1 "
7182 shift
7184 for obj
7186 $ECHO "$obj" >> $output
7187 done
7188 delfiles="$delfiles $output"
7189 output=$firstobj\"$file_list_spec$output\"
7190 else
7191 if test -n "$save_libobjs"; then
7192 func_verbose "creating reloadable object files..."
7193 output=$output_objdir/$output_la-${k}.$objext
7194 eval test_cmds=\"$reload_cmds\"
7195 func_len " $test_cmds"
7196 len0=$func_len_result
7197 len=$len0
7199 # Loop over the list of objects to be linked.
7200 for obj in $save_libobjs
7202 func_len " $obj"
7203 func_arith $len + $func_len_result
7204 len=$func_arith_result
7205 if test "X$objlist" = X ||
7206 test "$len" -lt "$max_cmd_len"; then
7207 func_append objlist " $obj"
7208 else
7209 # The command $test_cmds is almost too long, add a
7210 # command to the queue.
7211 if test "$k" -eq 1 ; then
7212 # The first file doesn't have a previous command to add.
7213 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
7214 else
7215 # All subsequent reloadable object files will link in
7216 # the last one created.
7217 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
7219 last_robj=$output_objdir/$output_la-${k}.$objext
7220 func_arith $k + 1
7221 k=$func_arith_result
7222 output=$output_objdir/$output_la-${k}.$objext
7223 objlist=$obj
7224 func_len " $last_robj"
7225 func_arith $len0 + $func_len_result
7226 len=$func_arith_result
7228 done
7229 # Handle the remaining objects by creating one last
7230 # reloadable object file. All subsequent reloadable object
7231 # files will link in the last one created.
7232 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7233 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
7234 if test -n "$last_robj"; then
7235 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7237 delfiles="$delfiles $output"
7239 else
7240 output=
7243 if ${skipped_export-false}; then
7244 func_verbose "generating symbol list for \`$libname.la'"
7245 export_symbols="$output_objdir/$libname.exp"
7246 $opt_dry_run || $RM $export_symbols
7247 libobjs=$output
7248 # Append the command to create the export file.
7249 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7250 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7251 if test -n "$last_robj"; then
7252 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7256 test -n "$save_libobjs" &&
7257 func_verbose "creating a temporary reloadable object file: $output"
7259 # Loop through the commands generated above and execute them.
7260 save_ifs="$IFS"; IFS='~'
7261 for cmd in $concat_cmds; do
7262 IFS="$save_ifs"
7263 $opt_silent || {
7264 func_quote_for_expand "$cmd"
7265 eval "func_echo $func_quote_for_expand_result"
7267 $opt_dry_run || eval "$cmd" || {
7268 lt_exit=$?
7270 # Restore the uninstalled library and exit
7271 if test "$mode" = relink; then
7272 ( cd "$output_objdir" && \
7273 $RM "${realname}T" && \
7274 $MV "${realname}U" "$realname" )
7277 exit $lt_exit
7279 done
7280 IFS="$save_ifs"
7282 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7283 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7284 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7288 if ${skipped_export-false}; then
7289 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7290 tmp_export_symbols="$export_symbols"
7291 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7292 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7295 if test -n "$orig_export_symbols"; then
7296 # The given exports_symbols file has to be filtered, so filter it.
7297 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7298 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7299 # 's' commands which not all seds can handle. GNU sed should be fine
7300 # though. Also, the filter scales superlinearly with the number of
7301 # global variables. join(1) would be nice here, but unfortunately
7302 # isn't a blessed tool.
7303 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7304 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7305 export_symbols=$output_objdir/$libname.def
7306 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7310 libobjs=$output
7311 # Restore the value of output.
7312 output=$save_output
7314 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
7315 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7316 test "X$libobjs" = "X " && libobjs=
7318 # Expand the library linking commands again to reset the
7319 # value of $libobjs for piecewise linking.
7321 # Do each of the archive commands.
7322 if test "$module" = yes && test -n "$module_cmds" ; then
7323 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7324 cmds=$module_expsym_cmds
7325 else
7326 cmds=$module_cmds
7328 else
7329 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7330 cmds=$archive_expsym_cmds
7331 else
7332 cmds=$archive_cmds
7337 if test -n "$delfiles"; then
7338 # Append the command to remove temporary files to $cmds.
7339 eval cmds=\"\$cmds~\$RM $delfiles\"
7342 # Add any objects from preloaded convenience libraries
7343 if test -n "$dlprefiles"; then
7344 gentop="$output_objdir/${outputname}x"
7345 generated="$generated $gentop"
7347 func_extract_archives $gentop $dlprefiles
7348 libobjs="$libobjs $func_extract_archives_result"
7349 test "X$libobjs" = "X " && libobjs=
7352 save_ifs="$IFS"; IFS='~'
7353 for cmd in $cmds; do
7354 IFS="$save_ifs"
7355 eval cmd=\"$cmd\"
7356 $opt_silent || {
7357 func_quote_for_expand "$cmd"
7358 eval "func_echo $func_quote_for_expand_result"
7360 $opt_dry_run || eval "$cmd" || {
7361 lt_exit=$?
7363 # Restore the uninstalled library and exit
7364 if test "$mode" = relink; then
7365 ( cd "$output_objdir" && \
7366 $RM "${realname}T" && \
7367 $MV "${realname}U" "$realname" )
7370 exit $lt_exit
7372 done
7373 IFS="$save_ifs"
7375 # Restore the uninstalled library and exit
7376 if test "$mode" = relink; then
7377 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
7379 if test -n "$convenience"; then
7380 if test -z "$whole_archive_flag_spec"; then
7381 func_show_eval '${RM}r "$gentop"'
7385 exit $EXIT_SUCCESS
7388 # Create links to the real library.
7389 for linkname in $linknames; do
7390 if test "$realname" != "$linkname"; then
7391 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
7393 done
7395 # If -module or -export-dynamic was specified, set the dlname.
7396 if test "$module" = yes || test "$export_dynamic" = yes; then
7397 # On all known operating systems, these are identical.
7398 dlname="$soname"
7403 obj)
7404 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7405 func_warning "\`-dlopen' is ignored for objects"
7408 case " $deplibs" in
7409 *\ -l* | *\ -L*)
7410 func_warning "\`-l' and \`-L' are ignored for objects" ;;
7411 esac
7413 test -n "$rpath" && \
7414 func_warning "\`-rpath' is ignored for objects"
7416 test -n "$xrpath" && \
7417 func_warning "\`-R' is ignored for objects"
7419 test -n "$vinfo" && \
7420 func_warning "\`-version-info' is ignored for objects"
7422 test -n "$release" && \
7423 func_warning "\`-release' is ignored for objects"
7425 case $output in
7426 *.lo)
7427 test -n "$objs$old_deplibs" && \
7428 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
7430 libobj=$output
7431 func_lo2o "$libobj"
7432 obj=$func_lo2o_result
7435 libobj=
7436 obj="$output"
7438 esac
7440 # Delete the old objects.
7441 $opt_dry_run || $RM $obj $libobj
7443 # Objects from convenience libraries. This assumes
7444 # single-version convenience libraries. Whenever we create
7445 # different ones for PIC/non-PIC, this we'll have to duplicate
7446 # the extraction.
7447 reload_conv_objs=
7448 gentop=
7449 # reload_cmds runs $LD directly, so let us get rid of
7450 # -Wl from whole_archive_flag_spec and hope we can get by with
7451 # turning comma into space..
7454 if test -n "$convenience"; then
7455 if test -n "$whole_archive_flag_spec"; then
7456 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
7457 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
7458 else
7459 gentop="$output_objdir/${obj}x"
7460 generated="$generated $gentop"
7462 func_extract_archives $gentop $convenience
7463 reload_conv_objs="$reload_objs $func_extract_archives_result"
7467 # Create the old-style object.
7468 reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
7470 output="$obj"
7471 func_execute_cmds "$reload_cmds" 'exit $?'
7473 # Exit if we aren't doing a library object file.
7474 if test -z "$libobj"; then
7475 if test -n "$gentop"; then
7476 func_show_eval '${RM}r "$gentop"'
7479 exit $EXIT_SUCCESS
7482 if test "$build_libtool_libs" != yes; then
7483 if test -n "$gentop"; then
7484 func_show_eval '${RM}r "$gentop"'
7487 # Create an invalid libtool object if no PIC, so that we don't
7488 # accidentally link it into a program.
7489 # $show "echo timestamp > $libobj"
7490 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
7491 exit $EXIT_SUCCESS
7494 if test -n "$pic_flag" || test "$pic_mode" != default; then
7495 # Only do commands if we really have different PIC objects.
7496 reload_objs="$libobjs $reload_conv_objs"
7497 output="$libobj"
7498 func_execute_cmds "$reload_cmds" 'exit $?'
7501 if test -n "$gentop"; then
7502 func_show_eval '${RM}r "$gentop"'
7505 exit $EXIT_SUCCESS
7508 prog)
7509 case $host in
7510 *cygwin*) func_stripname '' '.exe' "$output"
7511 output=$func_stripname_result.exe;;
7512 esac
7513 test -n "$vinfo" && \
7514 func_warning "\`-version-info' is ignored for programs"
7516 test -n "$release" && \
7517 func_warning "\`-release' is ignored for programs"
7519 test "$preload" = yes \
7520 && test "$dlopen_support" = unknown \
7521 && test "$dlopen_self" = unknown \
7522 && test "$dlopen_self_static" = unknown && \
7523 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
7525 case $host in
7526 *-*-rhapsody* | *-*-darwin1.[012])
7527 # On Rhapsody replace the C library is the System framework
7528 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7529 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7531 esac
7533 case $host in
7534 *-*-darwin*)
7535 # Don't allow lazy linking, it breaks C++ global constructors
7536 # But is supposedly fixed on 10.4 or later (yay!).
7537 if test "$tagname" = CXX ; then
7538 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
7539 10.[0123])
7540 compile_command="$compile_command ${wl}-bind_at_load"
7541 finalize_command="$finalize_command ${wl}-bind_at_load"
7543 esac
7545 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7546 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7547 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7549 esac
7552 # move library search paths that coincide with paths to not yet
7553 # installed libraries to the beginning of the library search list
7554 new_libs=
7555 for path in $notinst_path; do
7556 case " $new_libs " in
7557 *" -L$path/$objdir "*) ;;
7559 case " $compile_deplibs " in
7560 *" -L$path/$objdir "*)
7561 new_libs="$new_libs -L$path/$objdir" ;;
7562 esac
7564 esac
7565 done
7566 for deplib in $compile_deplibs; do
7567 case $deplib in
7568 -L*)
7569 case " $new_libs " in
7570 *" $deplib "*) ;;
7571 *) new_libs="$new_libs $deplib" ;;
7572 esac
7574 *) new_libs="$new_libs $deplib" ;;
7575 esac
7576 done
7577 compile_deplibs="$new_libs"
7580 compile_command="$compile_command $compile_deplibs"
7581 finalize_command="$finalize_command $finalize_deplibs"
7583 if test -n "$rpath$xrpath"; then
7584 # If the user specified any rpath flags, then add them.
7585 for libdir in $rpath $xrpath; do
7586 # This is the magic to use -rpath.
7587 case "$finalize_rpath " in
7588 *" $libdir "*) ;;
7589 *) finalize_rpath="$finalize_rpath $libdir" ;;
7590 esac
7591 done
7594 # Now hardcode the library paths
7595 rpath=
7596 hardcode_libdirs=
7597 for libdir in $compile_rpath $finalize_rpath; do
7598 if test -n "$hardcode_libdir_flag_spec"; then
7599 if test -n "$hardcode_libdir_separator"; then
7600 if test -z "$hardcode_libdirs"; then
7601 hardcode_libdirs="$libdir"
7602 else
7603 # Just accumulate the unique libdirs.
7604 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7605 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7608 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7610 esac
7612 else
7613 eval flag=\"$hardcode_libdir_flag_spec\"
7614 rpath="$rpath $flag"
7616 elif test -n "$runpath_var"; then
7617 case "$perm_rpath " in
7618 *" $libdir "*) ;;
7619 *) perm_rpath="$perm_rpath $libdir" ;;
7620 esac
7622 case $host in
7623 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7624 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
7625 case :$dllsearchpath: in
7626 *":$libdir:"*) ;;
7627 ::) dllsearchpath=$libdir;;
7628 *) dllsearchpath="$dllsearchpath:$libdir";;
7629 esac
7630 case :$dllsearchpath: in
7631 *":$testbindir:"*) ;;
7632 ::) dllsearchpath=$testbindir;;
7633 *) dllsearchpath="$dllsearchpath:$testbindir";;
7634 esac
7636 esac
7637 done
7638 # Substitute the hardcoded libdirs into the rpath.
7639 if test -n "$hardcode_libdir_separator" &&
7640 test -n "$hardcode_libdirs"; then
7641 libdir="$hardcode_libdirs"
7642 eval rpath=\" $hardcode_libdir_flag_spec\"
7644 compile_rpath="$rpath"
7646 rpath=
7647 hardcode_libdirs=
7648 for libdir in $finalize_rpath; do
7649 if test -n "$hardcode_libdir_flag_spec"; then
7650 if test -n "$hardcode_libdir_separator"; then
7651 if test -z "$hardcode_libdirs"; then
7652 hardcode_libdirs="$libdir"
7653 else
7654 # Just accumulate the unique libdirs.
7655 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7656 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7659 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7661 esac
7663 else
7664 eval flag=\"$hardcode_libdir_flag_spec\"
7665 rpath="$rpath $flag"
7667 elif test -n "$runpath_var"; then
7668 case "$finalize_perm_rpath " in
7669 *" $libdir "*) ;;
7670 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
7671 esac
7673 done
7674 # Substitute the hardcoded libdirs into the rpath.
7675 if test -n "$hardcode_libdir_separator" &&
7676 test -n "$hardcode_libdirs"; then
7677 libdir="$hardcode_libdirs"
7678 eval rpath=\" $hardcode_libdir_flag_spec\"
7680 finalize_rpath="$rpath"
7682 if test -n "$libobjs" && test "$build_old_libs" = yes; then
7683 # Transform all the library objects into standard objects.
7684 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7685 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7688 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
7690 # template prelinking step
7691 if test -n "$prelink_cmds"; then
7692 func_execute_cmds "$prelink_cmds" 'exit $?'
7695 wrappers_required=yes
7696 case $host in
7697 *cygwin* | *mingw* )
7698 if test "$build_libtool_libs" != yes; then
7699 wrappers_required=no
7702 *cegcc)
7703 # Disable wrappers for cegcc, we are cross compiling anyway.
7704 wrappers_required=no
7707 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
7708 wrappers_required=no
7711 esac
7712 if test "$wrappers_required" = no; then
7713 # Replace the output file specification.
7714 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7715 link_command="$compile_command$compile_rpath"
7717 # We have no uninstalled library dependencies, so finalize right now.
7718 exit_status=0
7719 func_show_eval "$link_command" 'exit_status=$?'
7721 # Delete the generated files.
7722 if test -f "$output_objdir/${outputname}S.${objext}"; then
7723 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
7726 exit $exit_status
7729 if test -n "$compile_shlibpath$finalize_shlibpath"; then
7730 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
7732 if test -n "$finalize_shlibpath"; then
7733 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
7736 compile_var=
7737 finalize_var=
7738 if test -n "$runpath_var"; then
7739 if test -n "$perm_rpath"; then
7740 # We should set the runpath_var.
7741 rpath=
7742 for dir in $perm_rpath; do
7743 rpath="$rpath$dir:"
7744 done
7745 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
7747 if test -n "$finalize_perm_rpath"; then
7748 # We should set the runpath_var.
7749 rpath=
7750 for dir in $finalize_perm_rpath; do
7751 rpath="$rpath$dir:"
7752 done
7753 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
7757 if test "$no_install" = yes; then
7758 # We don't need to create a wrapper script.
7759 link_command="$compile_var$compile_command$compile_rpath"
7760 # Replace the output file specification.
7761 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7762 # Delete the old output file.
7763 $opt_dry_run || $RM $output
7764 # Link the executable and exit
7765 func_show_eval "$link_command" 'exit $?'
7766 exit $EXIT_SUCCESS
7769 if test "$hardcode_action" = relink; then
7770 # Fast installation is not supported
7771 link_command="$compile_var$compile_command$compile_rpath"
7772 relink_command="$finalize_var$finalize_command$finalize_rpath"
7774 func_warning "this platform does not like uninstalled shared libraries"
7775 func_warning "\`$output' will be relinked during installation"
7776 else
7777 if test "$fast_install" != no; then
7778 link_command="$finalize_var$compile_command$finalize_rpath"
7779 if test "$fast_install" = yes; then
7780 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
7781 else
7782 # fast_install is set to needless
7783 relink_command=
7785 else
7786 link_command="$compile_var$compile_command$compile_rpath"
7787 relink_command="$finalize_var$finalize_command$finalize_rpath"
7791 # Replace the output file specification.
7792 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7794 # Delete the old output files.
7795 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
7797 func_show_eval "$link_command" 'exit $?'
7799 # Now create the wrapper script.
7800 func_verbose "creating $output"
7802 # Quote the relink command for shipping.
7803 if test -n "$relink_command"; then
7804 # Preserve any variables that may affect compiler behavior
7805 for var in $variables_saved_for_relink; do
7806 if eval test -z \"\${$var+set}\"; then
7807 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7808 elif eval var_value=\$$var; test -z "$var_value"; then
7809 relink_command="$var=; export $var; $relink_command"
7810 else
7811 func_quote_for_eval "$var_value"
7812 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7814 done
7815 relink_command="(cd `pwd`; $relink_command)"
7816 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7819 # Quote $ECHO for shipping.
7820 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
7821 case $progpath in
7822 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
7823 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
7824 esac
7825 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
7826 else
7827 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
7830 # Only actually do things if not in dry run mode.
7831 $opt_dry_run || {
7832 # win32 will think the script is a binary if it has
7833 # a .exe suffix, so we strip it off here.
7834 case $output in
7835 *.exe) func_stripname '' '.exe' "$output"
7836 output=$func_stripname_result ;;
7837 esac
7838 # test for cygwin because mv fails w/o .exe extensions
7839 case $host in
7840 *cygwin*)
7841 exeext=.exe
7842 func_stripname '' '.exe' "$outputname"
7843 outputname=$func_stripname_result ;;
7844 *) exeext= ;;
7845 esac
7846 case $host in
7847 *cygwin* | *mingw* )
7848 func_dirname_and_basename "$output" "" "."
7849 output_name=$func_basename_result
7850 output_path=$func_dirname_result
7851 cwrappersource="$output_path/$objdir/lt-$output_name.c"
7852 cwrapper="$output_path/$output_name.exe"
7853 $RM $cwrappersource $cwrapper
7854 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7856 func_emit_cwrapperexe_src > $cwrappersource
7858 # The wrapper executable is built using the $host compiler,
7859 # because it contains $host paths and files. If cross-
7860 # compiling, it, like the target executable, must be
7861 # executed on the $host or under an emulation environment.
7862 $opt_dry_run || {
7863 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
7864 $STRIP $cwrapper
7867 # Now, create the wrapper script for func_source use:
7868 func_ltwrapper_scriptname $cwrapper
7869 $RM $func_ltwrapper_scriptname_result
7870 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
7871 $opt_dry_run || {
7872 # note: this script will not be executed, so do not chmod.
7873 if test "x$build" = "x$host" ; then
7874 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7875 else
7876 func_emit_wrapper no > $func_ltwrapper_scriptname_result
7881 $RM $output
7882 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
7884 func_emit_wrapper no > $output
7885 chmod +x $output
7887 esac
7889 exit $EXIT_SUCCESS
7891 esac
7893 # See if we need to build an old-fashioned archive.
7894 for oldlib in $oldlibs; do
7896 if test "$build_libtool_libs" = convenience; then
7897 oldobjs="$libobjs_save $symfileobj"
7898 addlibs="$convenience"
7899 build_libtool_libs=no
7900 else
7901 if test "$build_libtool_libs" = module; then
7902 oldobjs="$libobjs_save"
7903 build_libtool_libs=no
7904 else
7905 oldobjs="$old_deplibs $non_pic_objects"
7906 if test "$preload" = yes && test -f "$symfileobj"; then
7907 oldobjs="$oldobjs $symfileobj"
7910 addlibs="$old_convenience"
7913 if test -n "$addlibs"; then
7914 gentop="$output_objdir/${outputname}x"
7915 generated="$generated $gentop"
7917 func_extract_archives $gentop $addlibs
7918 oldobjs="$oldobjs $func_extract_archives_result"
7921 # Do each command in the archive commands.
7922 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
7923 cmds=$old_archive_from_new_cmds
7924 else
7926 # Add any objects from preloaded convenience libraries
7927 if test -n "$dlprefiles"; then
7928 gentop="$output_objdir/${outputname}x"
7929 generated="$generated $gentop"
7931 func_extract_archives $gentop $dlprefiles
7932 oldobjs="$oldobjs $func_extract_archives_result"
7935 # POSIX demands no paths to be encoded in archives. We have
7936 # to avoid creating archives with duplicate basenames if we
7937 # might have to extract them afterwards, e.g., when creating a
7938 # static archive out of a convenience library, or when linking
7939 # the entirety of a libtool archive into another (currently
7940 # not supported by libtool).
7941 if (for obj in $oldobjs
7943 func_basename "$obj"
7944 $ECHO "$func_basename_result"
7945 done | sort | sort -uc >/dev/null 2>&1); then
7947 else
7948 $ECHO "copying selected object files to avoid basename conflicts..."
7949 gentop="$output_objdir/${outputname}x"
7950 generated="$generated $gentop"
7951 func_mkdir_p "$gentop"
7952 save_oldobjs=$oldobjs
7953 oldobjs=
7954 counter=1
7955 for obj in $save_oldobjs
7957 func_basename "$obj"
7958 objbase="$func_basename_result"
7959 case " $oldobjs " in
7960 " ") oldobjs=$obj ;;
7961 *[\ /]"$objbase "*)
7962 while :; do
7963 # Make sure we don't pick an alternate name that also
7964 # overlaps.
7965 newobj=lt$counter-$objbase
7966 func_arith $counter + 1
7967 counter=$func_arith_result
7968 case " $oldobjs " in
7969 *[\ /]"$newobj "*) ;;
7970 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
7971 esac
7972 done
7973 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
7974 oldobjs="$oldobjs $gentop/$newobj"
7976 *) oldobjs="$oldobjs $obj" ;;
7977 esac
7978 done
7980 eval cmds=\"$old_archive_cmds\"
7982 func_len " $cmds"
7983 len=$func_len_result
7984 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7985 cmds=$old_archive_cmds
7986 else
7987 # the command line is too long to link in one step, link in parts
7988 func_verbose "using piecewise archive linking..."
7989 save_RANLIB=$RANLIB
7990 RANLIB=:
7991 objlist=
7992 concat_cmds=
7993 save_oldobjs=$oldobjs
7994 oldobjs=
7995 # Is there a better way of finding the last object in the list?
7996 for obj in $save_oldobjs
7998 last_oldobj=$obj
7999 done
8000 eval test_cmds=\"$old_archive_cmds\"
8001 func_len " $test_cmds"
8002 len0=$func_len_result
8003 len=$len0
8004 for obj in $save_oldobjs
8006 func_len " $obj"
8007 func_arith $len + $func_len_result
8008 len=$func_arith_result
8009 func_append objlist " $obj"
8010 if test "$len" -lt "$max_cmd_len"; then
8012 else
8013 # the above command should be used before it gets too long
8014 oldobjs=$objlist
8015 if test "$obj" = "$last_oldobj" ; then
8016 RANLIB=$save_RANLIB
8018 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8019 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8020 objlist=
8021 len=$len0
8023 done
8024 RANLIB=$save_RANLIB
8025 oldobjs=$objlist
8026 if test "X$oldobjs" = "X" ; then
8027 eval cmds=\"\$concat_cmds\"
8028 else
8029 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8033 func_execute_cmds "$cmds" 'exit $?'
8034 done
8036 test -n "$generated" && \
8037 func_show_eval "${RM}r$generated"
8039 # Now create the libtool archive.
8040 case $output in
8041 *.la)
8042 old_library=
8043 test "$build_old_libs" = yes && old_library="$libname.$libext"
8044 func_verbose "creating $output"
8046 # Preserve any variables that may affect compiler behavior
8047 for var in $variables_saved_for_relink; do
8048 if eval test -z \"\${$var+set}\"; then
8049 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8050 elif eval var_value=\$$var; test -z "$var_value"; then
8051 relink_command="$var=; export $var; $relink_command"
8052 else
8053 func_quote_for_eval "$var_value"
8054 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8056 done
8057 # Quote the link command for shipping.
8058 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8059 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
8060 if test "$hardcode_automatic" = yes ; then
8061 relink_command=
8064 # Only create the output if not a dry run.
8065 $opt_dry_run || {
8066 for installed in no yes; do
8067 if test "$installed" = yes; then
8068 if test -z "$install_libdir"; then
8069 break
8071 output="$output_objdir/$outputname"i
8072 # Replace all uninstalled libtool libraries with the installed ones
8073 newdependency_libs=
8074 for deplib in $dependency_libs; do
8075 case $deplib in
8076 *.la)
8077 func_basename "$deplib"
8078 name="$func_basename_result"
8079 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8080 test -z "$libdir" && \
8081 func_fatal_error "\`$deplib' is not a valid libtool archive"
8082 newdependency_libs="$newdependency_libs $libdir/$name"
8084 *) newdependency_libs="$newdependency_libs $deplib" ;;
8085 esac
8086 done
8087 dependency_libs="$newdependency_libs"
8088 newdlfiles=
8090 for lib in $dlfiles; do
8091 case $lib in
8092 *.la)
8093 func_basename "$lib"
8094 name="$func_basename_result"
8095 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8096 test -z "$libdir" && \
8097 func_fatal_error "\`$lib' is not a valid libtool archive"
8098 newdlfiles="$newdlfiles $libdir/$name"
8100 *) newdlfiles="$newdlfiles $lib" ;;
8101 esac
8102 done
8103 dlfiles="$newdlfiles"
8104 newdlprefiles=
8105 for lib in $dlprefiles; do
8106 case $lib in
8107 *.la)
8108 # Only pass preopened files to the pseudo-archive (for
8109 # eventual linking with the app. that links it) if we
8110 # didn't already link the preopened objects directly into
8111 # the library:
8112 func_basename "$lib"
8113 name="$func_basename_result"
8114 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8115 test -z "$libdir" && \
8116 func_fatal_error "\`$lib' is not a valid libtool archive"
8117 newdlprefiles="$newdlprefiles $libdir/$name"
8119 esac
8120 done
8121 dlprefiles="$newdlprefiles"
8122 else
8123 newdlfiles=
8124 for lib in $dlfiles; do
8125 case $lib in
8126 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8127 *) abs=`pwd`"/$lib" ;;
8128 esac
8129 newdlfiles="$newdlfiles $abs"
8130 done
8131 dlfiles="$newdlfiles"
8132 newdlprefiles=
8133 for lib in $dlprefiles; do
8134 case $lib in
8135 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8136 *) abs=`pwd`"/$lib" ;;
8137 esac
8138 newdlprefiles="$newdlprefiles $abs"
8139 done
8140 dlprefiles="$newdlprefiles"
8142 $RM $output
8143 # place dlname in correct position for cygwin
8144 tdlname=$dlname
8145 case $host,$output,$installed,$module,$dlname in
8146 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
8147 esac
8148 $ECHO > $output "\
8149 # $outputname - a libtool library file
8150 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8152 # Please DO NOT delete this file!
8153 # It is necessary for linking the library.
8155 # The name that we can dlopen(3).
8156 dlname='$tdlname'
8158 # Names of this library.
8159 library_names='$library_names'
8161 # The name of the static archive.
8162 old_library='$old_library'
8164 # Linker flags that can not go in dependency_libs.
8165 inherited_linker_flags='$new_inherited_linker_flags'
8167 # Libraries that this one depends upon.
8168 dependency_libs='$dependency_libs'
8170 # Names of additional weak libraries provided by this library
8171 weak_library_names='$weak_libs'
8173 # Version information for $libname.
8174 current=$current
8175 age=$age
8176 revision=$revision
8178 # Is this an already installed library?
8179 installed=$installed
8181 # Should we warn about portability when linking against -modules?
8182 shouldnotlink=$module
8184 # Files to dlopen/dlpreopen
8185 dlopen='$dlfiles'
8186 dlpreopen='$dlprefiles'
8188 # Directory that this library needs to be installed in:
8189 libdir='$install_libdir'"
8190 if test "$installed" = no && test "$need_relink" = yes; then
8191 $ECHO >> $output "\
8192 relink_command=\"$relink_command\""
8194 done
8197 # Do a symbolic link so that the libtool archive can be found in
8198 # LD_LIBRARY_PATH before the program is installed.
8199 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8201 esac
8202 exit $EXIT_SUCCESS
8205 { test "$mode" = link || test "$mode" = relink; } &&
8206 func_mode_link ${1+"$@"}
8209 # func_mode_uninstall arg...
8210 func_mode_uninstall ()
8212 $opt_debug
8213 RM="$nonopt"
8214 files=
8215 rmforce=
8216 exit_status=0
8218 # This variable tells wrapper scripts just to set variables rather
8219 # than running their programs.
8220 libtool_install_magic="$magic"
8222 for arg
8224 case $arg in
8225 -f) RM="$RM $arg"; rmforce=yes ;;
8226 -*) RM="$RM $arg" ;;
8227 *) files="$files $arg" ;;
8228 esac
8229 done
8231 test -z "$RM" && \
8232 func_fatal_help "you must specify an RM program"
8234 rmdirs=
8236 origobjdir="$objdir"
8237 for file in $files; do
8238 func_dirname "$file" "" "."
8239 dir="$func_dirname_result"
8240 if test "X$dir" = X.; then
8241 objdir="$origobjdir"
8242 else
8243 objdir="$dir/$origobjdir"
8245 func_basename "$file"
8246 name="$func_basename_result"
8247 test "$mode" = uninstall && objdir="$dir"
8249 # Remember objdir for removal later, being careful to avoid duplicates
8250 if test "$mode" = clean; then
8251 case " $rmdirs " in
8252 *" $objdir "*) ;;
8253 *) rmdirs="$rmdirs $objdir" ;;
8254 esac
8257 # Don't error if the file doesn't exist and rm -f was used.
8258 if { test -L "$file"; } >/dev/null 2>&1 ||
8259 { test -h "$file"; } >/dev/null 2>&1 ||
8260 test -f "$file"; then
8262 elif test -d "$file"; then
8263 exit_status=1
8264 continue
8265 elif test "$rmforce" = yes; then
8266 continue
8269 rmfiles="$file"
8271 case $name in
8272 *.la)
8273 # Possibly a libtool archive, so verify it.
8274 if func_lalib_p "$file"; then
8275 func_source $dir/$name
8277 # Delete the libtool libraries and symlinks.
8278 for n in $library_names; do
8279 rmfiles="$rmfiles $objdir/$n"
8280 done
8281 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
8283 case "$mode" in
8284 clean)
8285 case " $library_names " in
8286 # " " in the beginning catches empty $dlname
8287 *" $dlname "*) ;;
8288 *) rmfiles="$rmfiles $objdir/$dlname" ;;
8289 esac
8290 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
8292 uninstall)
8293 if test -n "$library_names"; then
8294 # Do each command in the postuninstall commands.
8295 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8298 if test -n "$old_library"; then
8299 # Do each command in the old_postuninstall commands.
8300 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8302 # FIXME: should reinstall the best remaining shared library.
8304 esac
8308 *.lo)
8309 # Possibly a libtool object, so verify it.
8310 if func_lalib_p "$file"; then
8312 # Read the .lo file
8313 func_source $dir/$name
8315 # Add PIC object to the list of files to remove.
8316 if test -n "$pic_object" &&
8317 test "$pic_object" != none; then
8318 rmfiles="$rmfiles $dir/$pic_object"
8321 # Add non-PIC object to the list of files to remove.
8322 if test -n "$non_pic_object" &&
8323 test "$non_pic_object" != none; then
8324 rmfiles="$rmfiles $dir/$non_pic_object"
8330 if test "$mode" = clean ; then
8331 noexename=$name
8332 case $file in
8333 *.exe)
8334 func_stripname '' '.exe' "$file"
8335 file=$func_stripname_result
8336 func_stripname '' '.exe' "$name"
8337 noexename=$func_stripname_result
8338 # $file with .exe has already been added to rmfiles,
8339 # add $file without .exe
8340 rmfiles="$rmfiles $file"
8342 esac
8343 # Do a test to see if this is a libtool program.
8344 if func_ltwrapper_p "$file"; then
8345 if func_ltwrapper_executable_p "$file"; then
8346 func_ltwrapper_scriptname "$file"
8347 relink_command=
8348 func_source $func_ltwrapper_scriptname_result
8349 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
8350 else
8351 relink_command=
8352 func_source $dir/$noexename
8355 # note $name still contains .exe if it was in $file originally
8356 # as does the version of $file that was added into $rmfiles
8357 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
8358 if test "$fast_install" = yes && test -n "$relink_command"; then
8359 rmfiles="$rmfiles $objdir/lt-$name"
8361 if test "X$noexename" != "X$name" ; then
8362 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
8367 esac
8368 func_show_eval "$RM $rmfiles" 'exit_status=1'
8369 done
8370 objdir="$origobjdir"
8372 # Try to remove the ${objdir}s in the directories where we deleted files
8373 for dir in $rmdirs; do
8374 if test -d "$dir"; then
8375 func_show_eval "rmdir $dir >/dev/null 2>&1"
8377 done
8379 exit $exit_status
8382 { test "$mode" = uninstall || test "$mode" = clean; } &&
8383 func_mode_uninstall ${1+"$@"}
8385 test -z "$mode" && {
8386 help="$generic_help"
8387 func_fatal_help "you must specify a MODE"
8390 test -z "$exec_cmd" && \
8391 func_fatal_help "invalid operation mode \`$mode'"
8393 if test -n "$exec_cmd"; then
8394 eval exec "$exec_cmd"
8395 exit $EXIT_FAILURE
8398 exit $exit_status
8401 # The TAGs below are defined such that we never get into a situation
8402 # in which we disable both kinds of libraries. Given conflicting
8403 # choices, we go for a static library, that is the most portable,
8404 # since we can't tell whether shared libraries were disabled because
8405 # the user asked for that or because the platform doesn't support
8406 # them. This is particularly important on AIX, because we don't
8407 # support having both static and shared libraries enabled at the same
8408 # time on that platform, so we default to a shared-only configuration.
8409 # If a disable-shared tag is given, we'll fallback to a static-only
8410 # configuration. But we'll never go from static-only to shared-only.
8412 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
8413 build_libtool_libs=no
8414 build_old_libs=yes
8415 # ### END LIBTOOL TAG CONFIG: disable-shared
8417 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
8418 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
8419 # ### END LIBTOOL TAG CONFIG: disable-static
8421 # Local Variables:
8422 # mode:shell-script
8423 # sh-indentation:2
8424 # End:
8425 # vi:sw=2