1 # Generated from ltmain.m4sh.
3 # ltmain.sh (GNU libtool) 2.2.6
4 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
7 # This is free software; see the source for copying conditions. There is NO
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # GNU Libtool is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # As a special exception to the GNU General Public License,
16 # if you distribute this file as part of a program or library that
17 # is built using GNU Libtool, you may include this file under the
18 # same distribution terms that you use for the rest of that program.
20 # GNU Libtool is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with GNU Libtool; see the file COPYING. If not, a copy
27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
28 # or obtained by writing to the Free Software Foundation, Inc.,
29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 # Usage: $progname [OPTION]... [MODE-ARG]...
33 # Provide generalized library-building support services.
35 # --config show all configuration variables
36 # --debug enable verbose shell tracing
37 # -n, --dry-run display commands without modifying any files
38 # --features display basic configuration information and exit
39 # --mode=MODE use operation mode MODE
40 # --preserve-dup-deps don't remove duplicate dependency libraries
41 # --quiet, --silent don't print informational messages
42 # --tag=TAG use configuration variables from tag TAG
43 # -v, --verbose print informational messages (default)
44 # --version print version information
45 # -h, --help print short or long help message
47 # MODE must be one of the following:
49 # clean remove files from the build directory
50 # compile compile a source file into a libtool object
51 # execute automatically set library path, then run a program
52 # finish complete the installation of libtool libraries
53 # install install libraries or executables
54 # link create a library or an executable
55 # uninstall remove libraries from an installed directory
57 # MODE-ARGS vary depending on the MODE.
58 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
60 # When reporting a bug, please describe a test case to reproduce it and
61 # include the following information:
66 # compiler flags: $LTCFLAGS
67 # linker: $LD (gnu? $with_gnu_ld)
68 # $progname: (GNU libtool) 2.2.6
69 # automake: $automake_version
70 # autoconf: $autoconf_version
72 # Report bugs to <bug-libtool@gnu.org>.
78 package_revision
=1.3012
80 # 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
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+"$@"}'='"$@"'
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).
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
109 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
110 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
122 : ${EGREP="/bin/grep -E"}
123 : ${FGREP="/bin/grep -F"}
124 : ${GREP="/bin/grep"}
131 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
132 : ${Xsed="$SED -e 1s/^X//"}
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
147 dirname="s,/[^/]*$,,"
150 # func_dirname_and_basename file append nondir_replacement
151 # perform func_basename and func_dirname in a single function
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}"
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
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
189 -*) progname
=.
/$progname ;;
192 # Make sure we have an absolute path for reexecution:
194 [\\/]*|
[A-Za-z
]:\\*) ;;
196 progdir
=$func_dirname_result
197 progdir
=`cd "$progdir" && pwd`
198 progpath
="$progdir/$progname"
203 for progdir
in $PATH; do
205 test -x "$progdir/$progname" && break
208 test -n "$progdir" || progdir
=`pwd`
209 progpath
="$progdir/$progname"
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 '$'.
230 sed_double_backslash
="\
234 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
245 # Echo program name prefixed message, along with the current mode
246 # name if it has been set yet.
249 $ECHO "$progname${mode+: }$mode: $*"
252 # func_verbose arg...
253 # Echo program name prefixed message in verbose mode only.
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
265 # Echo program name prefixed message to standard error.
268 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
271 # func_warning arg...
272 # Echo program name prefixed warning message to standard error.
275 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
281 # func_fatal_error arg...
282 # Echo program name prefixed message to standard error, and exit.
289 # func_fatal_help arg...
290 # Echo program name prefixed message to standard error, followed by
291 # a help hint, and exit.
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.
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.
312 my_directory_path
="$1"
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" ;;
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"`
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
342 $MKDIR "$my_dir" 2>/dev
/null ||
:
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.
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}-$$"
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`
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
()
398 func_quote_for_eval_unquoted_result=`$ECHO "X$1" |
$Xsed -e "$sed_quote_subst"` ;;
400 func_quote_for_eval_unquoted_result="$1" ;;
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"
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 ()
425 my_arg
=`$ECHO "X$1" | $Xsed \
426 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
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 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
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.
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
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
()
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
487 eval "$lt_safe_locale"
488 if test "$my_status" -eq 0; then :; else
489 eval "(exit $my_status); $my_fail_exp"
499 # Echo version message to standard output and exit.
502 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
505 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
512 # Echo short help message to standard output and exit.
515 $SED -n '/^# Usage:/,/# -h/ {
518 s/\$progname/'$progname'/
522 $ECHO "run \`$progname --help | more' for full usage"
527 # Echo long help message to standard output and exit.
530 $SED -n '/^# Usage:/,/# Report bugs to/ {
533 s*\$progname*'$progname'*
535 s*\$SHELL*'"$SHELL"'*
537 s*\$LTCFLAGS*'"$LTCFLAGS"'*
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`"'/
547 # func_missing_arg argname
548 # Echo program name prefixed message to standard error and set global
552 func_error
"missing argument for $1"
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.
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!
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
586 magic
="%%%MAGIC variable%%%"
587 magic_exe
="%%%MAGIC EXE variable%%%"
594 lo2o
="s/\\.lo\$/.${objext}/"
595 o2lo
="s/\\.${objext}\$/.lo/"
600 opt_duplicate_deps
=false
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.
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
()
615 func_error
"See the $PACKAGE documentation for more information."
616 func_fatal_error
"Fatal configuration error."
621 # Display the configuration for all the tags in this script.
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"
639 # Display the features supported by this script.
643 if test "$build_libtool_libs" = yes; then
644 $ECHO "enable shared libraries"
646 $ECHO "disable shared libraries"
648 if test "$build_old_libs" = yes; then
649 $ECHO "enable static libraries"
651 $ECHO "disable static libraries"
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
666 re_begincf
="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
667 re_endcf
="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
668 sed_extractcf
="/$re_begincf/,/$re_endcf/p"
673 func_fatal_error
"invalid tag name: $tagname"
677 # Don't test for the "default" C tag, as we know it's
678 # there but not specially marked.
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"`
692 func_error
"ignoring unknown tag $tagname"
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
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
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
727 # Parse non-mode specific arguments:
728 while test "$#" -gt 0; do
733 --config) func_config
;;
735 --debug) preserve_args
="$preserve_args $opt"
736 func_echo
"enabling shell trace mode"
741 -dlopen) test "$#" -eq 0 && func_missing_arg
"$opt" && break
742 execute_dlfiles
="$execute_dlfiles $1"
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
752 # Valid mode arguments:
762 # Catch anything else as an error
763 *) func_error
"invalid argument for $opt"
774 opt_duplicate_deps
=: ;;
776 --quiet|
--silent) preserve_args
="$preserve_args $opt"
780 --verbose|
-v) preserve_args
="$preserve_args $opt"
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
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+"$@"}
797 -\?|
-h) func_usage
;;
798 --help) opt_help
=: ;;
799 --version) func_version
;;
801 -*) func_fatal_help
"unrecognized option \`$opt'" ;;
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
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
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.
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.
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.
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."
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'"
887 # Change the help message to a mode-specific one.
889 help="Try \`$progname --help --mode=$mode' for more information."
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.
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
()
914 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
915 for lalib_p_l
in 1 2 3 4
918 case "$lalib_p_line" in
919 \
#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
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
()
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
=
945 *) func_ltwrapper_exec_suffix
=.exe
;;
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.
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!
981 save_ifs
=$IFS; IFS
='~'
985 func_show_eval
"$cmd" "${2-:}"
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.
1001 */* |
*\\*) .
"$1" ;;
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 ...'
1016 if test -n "$available_tags" && test -z "$tagname"; then
1019 func_quote_for_eval
"$arg"
1020 CC_quoted
="$CC_quoted $func_quote_for_eval_result"
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`"
1035 # Double-quote args containing other shell metacharacters.
1036 func_quote_for_eval
"$arg"
1037 CC_quoted
="$CC_quoted $func_quote_for_eval_result"
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.
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'"
1057 # func_verbose "using $tagname tagged configuration"
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
()
1072 if test "$build_libtool_libs" = yes; then
1078 if test "$build_old_libs" = yes; then
1079 write_oldobj
=\'${3}\'
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
()
1107 # Get the compilation command and the source file.
1109 srcfile
="$nonopt" # always keep a non-empty value in "srcfile"
1121 # do not "continue". Instead, add this to base_compile
1133 # Accept any command-line options.
1136 test -n "$libobj" && \
1137 func_fatal_error
"you cannot specify \`-o' more than once"
1142 -pie |
-fpie |
-fPIE)
1143 pie_flag
="$pie_flag $arg"
1147 -shared |
-static |
-prefer-pic |
-prefer-non-pic)
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.
1163 func_stripname
'-Wc,' '' "$arg"
1164 args
=$func_stripname_result
1166 save_ifs
="$IFS"; IFS
=','
1167 for arg
in $args; do
1169 func_quote_for_eval
"$arg"
1170 lastarg
="$lastarg $func_quote_for_eval_result"
1173 func_stripname
' ' '' "$lastarg"
1174 lastarg
=$func_stripname_result
1176 # Add the arguments to base_compile.
1177 base_compile
="$base_compile $lastarg"
1182 # Accept the current argument as the source file.
1183 # The previous "srcfile" becomes the current argument.
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"
1199 func_fatal_error
"you must specify an argument for -Xcompile"
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"
1213 # Recognize several different file suffixes.
1214 # If the user specifies -o file.o, it is replaced with file.lo
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
1226 *.lo
) func_lo2o
"$libobj"; obj
=$func_lo2o_result ;;
1228 func_fatal_error
"cannot determine name of library object from \`$libobj'"
1232 func_infer_tag
$base_compile
1234 for arg
in $later; do
1237 test "$build_libtool_libs" != yes && \
1238 func_fatal_configuration
"can not build a shared library"
1244 build_libtool_libs
=no
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"
1277 removelist
="$lobj $libobj ${libobj}T"
1280 # On Cygwin there's no "real" PIC flag so we must build both object types
1282 cygwin
* | mingw
* | pw32
* | os2
* | cegcc
*)
1286 if test "$pic_mode" = no
&& test "$deplibs_check_method" != pass_all
; then
1287 # non-PIC code in shared libraries is not supported
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"
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"
1309 elif test "$need_locks" = warn
; then
1310 if test -f "$lockfile"; then
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
1322 $opt_dry_run ||
$RM $removelist
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"
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
1364 *** ERROR, $lockfile contains:
1365 `cat $lockfile 2>/dev/null`
1367 but it should contain:
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
1377 $opt_dry_run ||
$RM $removelist
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"
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
1413 *** ERROR, $lockfile contains:
1414 `cat $lockfile 2>/dev/null`
1416 but it should contain:
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
1426 $opt_dry_run ||
$RM $removelist
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'
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
1451 test "$mode" = compile
&& func_mode_compile
${1+"$@"}
1456 # We need to display help for each of the modes.
1459 # Generic help is extracted from the usage comments
1460 # at the start of this file.
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
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."
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'."
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'
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."
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."
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)."
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
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."
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
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'"
1630 $ECHO "Try \`$progname --help' for more information about other modes."
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
()
1643 # The first argument is the command name.
1646 func_fatal_help
"you must specify a COMMAND"
1648 # Handle -dlopen flags immediately.
1649 for file in $execute_dlfiles; do
1651 || func_fatal_help
"\`$file' is not a file"
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.
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'"
1673 func_dirname
"$file" "" "."
1674 dir
="$func_dirname_result"
1676 if test -f "$dir/$objdir/$dlname"; then
1679 if test ! -f "$dir/$dlname"; then
1680 func_fatal_error
"cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
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"
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\""
1705 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
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.
1720 # Do a test to see if this is really a libtool program.
1721 if func_ltwrapper_script_p
"$file"; then
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"
1733 # Quote arguments (to preserve shell metacharacters).
1734 func_quote_for_eval
"$file"
1735 args
="$args $func_quote_for_eval_result"
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
1754 # Now prepare to actually exec the command.
1755 exec_cmd
="\$cmd$args"
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"
1767 test "$mode" = execute
&& func_mode_execute
${1+"$@"}
1770 # func_mode_finish arg...
1777 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1780 libdirs
="$libdirs $dir"
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
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
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
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
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'"
1833 $ECHO "See any operating system documentation about shared libraries for"
1835 solaris2.
[6789]|solaris2.1
[0-9])
1836 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1840 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1843 $ECHO "X----------------------------------------------------------------------" |
$Xsed
1847 test "$mode" = finish
&& func_mode_finish
${1+"$@"}
1850 # func_mode_install arg...
1851 func_mode_install
()
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 "
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.
1884 if test -n "$dest"; then
1885 files
="$files $dest"
1893 case " $install_prog " in
1908 # If the previous option needed an argument, then skip it.
1909 if test -n "$prev"; then
1918 # Aesthetically quote the argument.
1919 func_quote_for_eval
"$arg"
1920 install_prog
="$install_prog $func_quote_for_eval_result"
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"
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
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"
1957 [\\/]* |
[A-Za-z
]:[\\/]*) ;;
1959 for file in $files; do
1963 func_fatal_help
"\`$destdir' must be an absolute directory name"
1970 # This variable tells wrapper scripts just to set variables rather
1971 # than running their programs.
1972 libtool_install_magic
="$magic"
1977 for file in $files; do
1979 # Do each installation.
1982 # Do the static libraries later.
1983 staticlibs
="$staticlibs $file"
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"
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
2000 *) current_libdirs
="$current_libdirs $libdir" ;;
2003 # Note the libdir as a future libdir.
2004 case "$future_libdirs " in
2006 *) future_libdirs
="$future_libdirs $libdir" ;;
2010 func_dirname
"$file" "/" ""
2011 dir
="$func_dirname_result"
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%"`
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
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" \
2053 cygwin
* | mingw
* | pw32
* | cegcc
*)
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.
2072 test "$linkname" != "$realname" \
2073 && func_show_eval
"(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
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"
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"
2099 func_basename
"$file"
2100 destfile
="$func_basename_result"
2101 destfile
="$destdir/$destfile"
2104 # Deduce the name of the destination old-style object file.
2107 func_lo2o
"$destfile"
2108 staticdest
=$func_lo2o_result
2111 staticdest
="$destfile"
2115 func_fatal_help
"cannot copy a libtool object to \`$destfile'"
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.
2127 staticobj
=$func_lo2o_result
2128 func_show_eval
"$install_prog \$staticobj \$staticdest" 'exit $?'
2134 # Figure out destination file name, if it wasn't already specified.
2135 if test -n "$destname"; then
2136 destfile
="$destdir/$destname"
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
2149 if test ! -f "$file"; then
2150 func_stripname
'' '.exe' "$file"
2151 file=$func_stripname_result
2157 # Do a test to see if this is really a libtool program.
2160 if func_ltwrapper_executable_p
"$file"; then
2161 func_ltwrapper_scriptname
"$file"
2162 wrapper
=$func_ltwrapper_scriptname_result
2164 func_stripname
'' '.exe' "$file"
2165 wrapper
=$func_stripname_result
2172 if func_ltwrapper_script_p
"$wrapper"; then
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'"
2183 for lib
in $notinst_deplibs; do
2184 # Check to see that each library is installed.
2186 if test -f "$lib"; then
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'"
2197 func_source
"$wrapper"
2200 if test "$fast_install" = no
&& test -n "$relink_command"; then
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'`
2211 func_quote_for_expand
"$relink_command"
2212 eval "func_echo $func_quote_for_expand_result"
2214 if eval "$relink_command"; then :
2216 func_error
"error: relink \`$file' with the above command before installing it"
2217 $opt_dry_run ||
${RM}r
"$tmpdir"
2222 func_warning
"cannot relink \`$file'"
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
2233 case $install_prog,$host in
2234 */usr
/bin
/install*,*cygwin
*)
2235 case $file:$destfile in
2240 destfile
=$destfile.exe
2243 func_stripname
'' '.exe' "$destfile"
2244 destfile
=$func_stripname_result
2249 func_show_eval
"$install_prog\$stripme \$file \$destfile" 'exit $?'
2250 $opt_dry_run ||
if test -n "$outputname"; then
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 $?'
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'
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
()
2298 my_prefix
=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
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"
2305 func_error
"not configured to extract global symbols from dlpreopened files"
2309 if test -n "$my_dlsyms"; then
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 */
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'"
2344 if test -n "$exclude_expsyms"; then
2346 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2347 eval '$MV "$nlist"T "$nlist"'
2351 if test -n "$export_symbols_regex"; then
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"
2363 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2365 *cygwin
* |
*mingw
* |
*cegcc
* )
2366 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2367 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
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"'
2377 *cygwin |
*mingw
* |
*cegcc
* )
2378 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2379 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2386 for dlprefile
in $dlprefiles; do
2387 func_verbose
"extracting global C symbols from \`$dlprefile'"
2388 func_basename
"$dlprefile"
2389 name
="$func_basename_result"
2391 eval '$ECHO ": $name " >> "$nlist"'
2392 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
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
2412 uniq > "$nlist"S
; then
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"'
2421 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2424 $ECHO >> "$output_objdir/$my_dlsyms" "\
2426 /* The mapping between symbol names and symbols. */
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. */"
2440 echo >> "$output_objdir/$my_dlsyms" "\
2441 /* This system does not cope well with relocations in const data */"
2444 lt_dlsym_const
=const
;;
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"
2463 $ECHO >> "$output_objdir/$my_dlsyms" "\
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;
2480 pic_flag_for_symtable
=
2481 case "$compile_command " 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" ;;
2493 pic_flag_for_symtable
=" $pic_flag" ;;
2495 if test "X$my_pic_p" != Xno
; then
2496 pic_flag_for_symtable
=" $pic_flag"
2503 for arg
in $LTCFLAGS; do
2505 -pie |
-fpie |
-fPIE) ;;
2506 *) symtab_cflags
="$symtab_cflags $arg" ;;
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"
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%"`
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%"`
2535 func_fatal_error
"unknown suffix for \`$my_dlsyms'"
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.
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 |
2576 case $win32_nmres in
2577 import
*) win32_libid_type
="x86 archive import";;
2578 *) win32_libid_type
="x86 archive static";;
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"
2593 $ECHO "$win32_libid_type"
2598 # func_extract_an_archive dir oldlib
2599 func_extract_an_archive
()
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
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
()
2617 my_gentop
="$1"; shift
2618 my_oldlibs
=${1+"$@"}
2624 for my_xlib
in $my_oldlibs; do
2625 # Extract the objects.
2627 [\\/]* |
[A-Za-z
]:[\\/]*) my_xabs
="$my_xlib" ;;
2628 *) my_xabs
=`pwd`"/$my_xlib" ;;
2630 func_basename
"$my_xlib"
2631 my_xlib
="$func_basename_result"
2634 case " $extracted_archives " in
2636 func_arith
$extracted_serial + 1
2637 extracted_serial
=$func_arith_result
2638 my_xlib_u
=lt
$extracted_serial-$my_xlib ;;
2642 extracted_archives
="$extracted_archives $my_xlib_u"
2643 my_xdir
="$my_gentop/$my_xlib_u"
2645 func_mkdir_p
"$my_xdir"
2649 func_verbose
"Extracting $my_xabs"
2650 # Do not bother doing anything if just a dry run
2652 darwin_orig_dir
=`pwd`
2653 cd $my_xdir ||
exit $?
2654 darwin_archive
=$my_xabs
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://'`
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}"
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`
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
2679 cd "$darwin_orig_dir"
2682 func_extract_an_archive
"$my_xdir" "$my_xabs"
2687 func_extract_an_archive
"$my_xdir" "$my_xabs"
2690 my_oldobjs
="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
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
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
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
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
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'
2753 # When we are sourced in execute mode, \$file and \$ECHO are already set.
2754 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2757 # Make sure echo works.
2758 if test \"X\$1\" = X--no-reexec; then
2759 # Discard the --no-reexec flag, and continue.
2761 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2762 # Yippee, \$ECHO works!
2765 # Restart under the correct shell, and then maybe \$ECHO will work.
2766 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
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\" ;;
2789 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2790 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
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
2810 # Usually 'no', except on cygwin/mingw when embedded into
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
2818 # remove .libs from thisdir
2819 case \"\$thisdir\" in
2820 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
2821 $objdir ) thisdir=. ;;
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
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\"
2844 $RM \"\$progdir/\$file\"
2849 # relink executable if necessary
2850 if test -n \"\$relink_command\"; then
2851 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2853 $ECHO \"\$relink_command_output\" >&2
2854 $RM \"\$progdir/\$file\"
2859 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2860 { $RM \"\$progdir/\$program\";
2861 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2862 $RM \"\$progdir/\$file\"
2866 program='$outputname'
2867 progdir=\"\$thisdir/$objdir\"
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
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
2892 # Add the dll search path components to the executable PATH
2893 PATH=$dllsearchpath:\$PATH
2898 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2899 # Run the actual program with our arguments.
2902 # Backslashes separate directories on plain windows
2903 *-*-mingw |
*-*-os2* |
*-cegcc*)
2905 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
2911 exec \"\$progdir/\$program\" \${1+\"\$@\"}
2916 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
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
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
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
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:
2967 # mingw (msys) mingw [e.g. native]
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
2987 lt_sed_naive_backslashify
='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
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"`
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"`
3015 # Allow warning below.
3016 func_to_host_path_result
=""
3020 if test -z "$func_to_host_path_result" ; then
3021 func_error
"Could not determine host path corresponding to"
3023 func_error
"Continuing, but uninstalled executables may not work."
3025 func_to_host_path_result
="$1"
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):
3040 # mingw (msys) mingw [e.g. native]
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)
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
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|:*$||'`
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"`
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
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"
3094 func_to_host_pathlist_result
="$func_to_host_pathlist_result;$func_to_host_path_result"
3100 IFS
=$func_to_host_pathlist_oldIFS
3103 if test -z "$func_to_host_pathlist_result" ; then
3104 func_error
"Could not determine the host path(s) corresponding to"
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
3118 :* ) func_to_host_pathlist_result
=";$func_to_host_pathlist_result"
3122 *: ) func_to_host_pathlist_result
="$func_to_host_pathlist_result;"
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
()
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.
3157 # include <direct.h>
3158 # include <process.h>
3160 # define setmode _setmode
3162 # include <unistd.h>
3163 # include <stdint.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);
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
3188 # define LT_PATHMAX 1024
3199 # define S_IXUSR _S_IEXEC
3201 # ifndef _INTPTR_T_DEFINED
3202 # define intptr_t int
3206 #ifndef DIR_SEPARATOR
3207 # define DIR_SEPARATOR '/'
3208 # define PATH_SEPARATOR ':'
3211 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3213 # define HAVE_DOS_BASED_FILE_SYSTEM
3214 # define FOPEN_WB "wb"
3215 # ifndef DIR_SEPARATOR_2
3216 # define DIR_SEPARATOR_2 '\\'
3218 # ifndef PATH_SEPARATOR_2
3219 # define PATH_SEPARATOR_2 ';'
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 */
3237 # define FOPEN_WB "wb"
3241 # define FOPEN_WB "w"
3244 # define _O_BINARY 0
3247 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3248 #define XFREE(stale) do { \
3249 if (stale) { free ((void *) stale); stale = 0; } \
3252 #undef LTWRAPPER_DEBUGPRINTF
3253 #if defined DEBUGWRAPPER
3254 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3256 ltwrapper_debugprintf (const char *fmt, ...)
3259 va_start (args, fmt);
3260 (void) vfprintf (stderr, fmt, args);
3264 # define LTWRAPPER_DEBUGPRINTF(args)
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"/'
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"/'
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"
3311 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
3315 const char
* LIB_PATH_VALUE
= "";
3319 if test -n "$dllsearchpath"; then
3320 func_to_host_pathlist
"$dllsearchpath:"
3322 const char * EXE_PATH_VARNAME = "PATH";
3323 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
3327 const char * EXE_PATH_VARNAME = "";
3328 const char * EXE_PATH_VALUE = "";
3332 if test "$fast_install" = yes; then
3334 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3338 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
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
[])
3371 char
*actual_cwrapper_path
;
3372 char
*actual_cwrapper_name
;
3375 intptr_t rval
= 127;
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)
3390 *mingw* | *cygwin* )
3391 # make stdout use "unix" line endings
3392 echo " setmode(1,_O_BINARY);"
3397 printf ("%s", script_text_part1);
3398 printf ("%s", script_text_part2);
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",
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;
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;
3433 LTWRAPPER_DEBUGPRINTF (("(main
) libtool target name
: %s
\n",
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], "/");
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;
3464 while ((p = strchr (newargz[0], '\\')) != NULL)
3468 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
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);
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 */
3502 lt_fatal ("%s missing required argument
", env_set_opt);
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 */
3517 lt_fatal ("%s missing required argument
", env_prepend_opt);
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 */
3532 lt_fatal ("%s missing required argument
", env_append_opt);
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]);
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
>")));
3565 /* execv doesn't actually work on mingw as expected on unix */
3566 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
3569 /* failed to start process */
3570 LTWRAPPER_DEBUGPRINTF (("(main
) failed to launch target
\"%s
\": errno
= %d
\n", lt_argv_zero, errno));
3578 execv (lt_argv_zero, newargz);
3579 return rval; /* =127, but avoids unused variable warning */
3588 xmalloc (size_t num)
3590 void *p = (void *) malloc (num);
3592 lt_fatal ("Memory exhausted
");
3598 xstrdup (const char *string)
3600 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3605 base_name (const char *name)
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] == ':')
3615 for (base = name; *name; name++)
3616 if (IS_DIR_SEPARATOR (*name))
3622 check_executable (const char *path)
3626 LTWRAPPER_DEBUGPRINTF (("(check_executable
) : %s
\n",
3627 path ? (*path ? path : "EMPTY
!") : "NULL
!"));
3628 if ((!path) || (!*path))
3631 if ((stat (path, &st) >= 0)
3632 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3639 make_executable (const char *path)
3644 LTWRAPPER_DEBUGPRINTF (("(make_executable
) : %s
\n",
3645 path ? (*path ? path : "EMPTY
!") : "NULL
!"));
3646 if ((!path) || (!*path))
3649 if (stat (path, &st) >= 0)
3651 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
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.
3661 find_executable (const char *wrapper)
3666 /* static buffer for getcwd */
3667 char tmp[LT_PATHMAX + 1];
3671 LTWRAPPER_DEBUGPRINTF (("(find_executable
) : %s
\n",
3672 wrapper ? (*wrapper ? wrapper : "EMPTY
!") : "NULL
!"));
3674 if ((wrapper == NULL) || (*wrapper == '\0'))
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))
3684 XFREE (concat_name);
3689 if (IS_DIR_SEPARATOR (wrapper[0]))
3691 concat_name = xstrdup (wrapper);
3692 if (check_executable (concat_name))
3694 XFREE (concat_name);
3696 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3700 for (p = wrapper; *p; p++)
3708 /* no slashes; search PATH */
3709 const char *path = getenv ("PATH
");
3712 for (p = path; *p; p = p_next)
3716 for (q = p; *q; q++)
3717 if (IS_PATH_SEPARATOR (*q))
3720 p_next = (*q == '\0' ? q : q + 1);
3723 /* empty path: current directory */
3724 if (getcwd (tmp, LT_PATHMAX) == NULL)
3725 lt_fatal ("getcwd failed
");
3726 tmp_len = strlen (tmp);
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);
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))
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))
3759 XFREE (concat_name);
3764 chase_symlinks (const char *pathspec)
3767 return xstrdup (pathspec);
3769 char buf[LT_PATHMAX];
3771 char *tmp_pathspec = xstrdup (pathspec);
3773 int has_symlinks = 0;
3774 while (strlen (tmp_pathspec) && !has_symlinks)
3776 LTWRAPPER_DEBUGPRINTF (("checking path component
for symlinks
: %s
\n",
3778 if (lstat (tmp_pathspec, &s) == 0)
3780 if (S_ISLNK (s.st_mode) != 0)
3786 /* search backwards for last DIR_SEPARATOR */
3787 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3788 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3790 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3792 /* no more DIR_SEPARATORS left */
3799 char *errstr = strerror (errno);
3800 lt_fatal ("Error accessing
file %s
(%s
)", tmp_pathspec, errstr);
3803 XFREE (tmp_pathspec);
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);
3820 strendzap (char *str, const char *pat)
3824 assert (str != NULL);
3825 assert (pat != NULL);
3828 patlen = strlen (pat);
3832 str += len - patlen;
3833 if (strcmp (str, pat) == 0)
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)
3852 lt_fatal (const char *message, ...)
3855 va_start (ap, message);
3856 lt_error_core (EXIT_FAILURE, "FATAL
", message, ap);
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
>")));
3868 /* always make a copy, for consistency with !HAVE_SETENV */
3869 char *str = xstrdup (value);
3870 setenv (name, str, 1);
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)
3884 lt_extend_str (const char *orig_value, const char *add, int to_end)
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);
3894 strcpy (new_value, orig_value);
3895 strcpy (new_value + orig_value_len, add);
3899 strcpy (new_value, add);
3900 strcpy (new_value + add_len, orig_value);
3905 new_value = xstrdup (add);
3911 lt_split_name_value (const char *arg, char** name, char** value)
3918 p = strchr (arg, (int)'=');
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';
3934 lt_opt_process_env_set (const char *arg)
3939 if (lt_split_name_value (arg, &name, &value) != 0)
3943 lt_fatal ("bad argument
for %s
: '%s'", env_set_opt, arg);
3946 lt_setenv (name, value);
3952 lt_opt_process_env_prepend (const char *arg)
3956 char *new_value = NULL;
3958 if (lt_split_name_value (arg, &name, &value) != 0)
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);
3973 lt_opt_process_env_append (const char *arg)
3977 char *new_value = NULL;
3979 if (lt_split_name_value (arg, &name, &value) != 0)
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);
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);
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);
4032 # end: func_emit_cwrapperexe_src
4034 # func_mode_link arg...
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.
4057 libtool_args=$nonopt
4058 base_compile="$nonopt $@
"
4059 compile_command=$nonopt
4060 finalize_command=$nonopt
4073 lib_search_path=`pwd`
4075 new_inherited_linker_flags=
4083 export_symbols_regex=
4091 precious_files_regex=
4092 prefer_static_libs=no
4105 single_module="${wl}-single_module"
4106 func_infer_tag $base_compile
4108 # We need to know -static, to get the right output filenames.
4113 test "$build_libtool_libs" != yes && \
4114 func_fatal_configuration "can not build a shared library
"
4118 -all-static | -static | -static-libtool-libs)
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
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
4142 build_libtool_libs=no
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
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
4164 func_append compile_command " @OUTPUT@
"
4165 func_append finalize_command " @OUTPUT@
"
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@
"
4178 *.la | *.lo) ;; # We handle these cases below.
4180 if test "$dlself" = no; then
4188 if test "$prev" = dlprefiles; then
4190 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4200 if test "$prev" = dlfiles; then
4201 dlfiles="$dlfiles $arg"
4203 dlprefiles="$dlprefiles $arg"
4211 export_symbols="$arg"
4213 || func_fatal_error "symbol
file \
`$arg' does not exist"
4218 export_symbols_regex="$arg"
4226 *" $qarg.ltframework "*) ;;
4227 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4236 inst_prefix_dir="$arg"
4241 if test -f "$arg"; then
4244 for fil in `cat "$save_arg"`
4246 # moreargs="$moreargs $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
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"
4279 # If libtool objects are unsupported, then we need to preload.
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"
4292 func_append libobjs " $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"
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"
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"
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"
4325 func_fatal_error "\`$arg' is not a valid libtool object
"
4330 func_fatal_error "link input
file \
`$arg' does not exist"
4337 precious_files_regex="$arg"
4347 # We need an absolute path.
4349 [\\/]* | [A-Za-z]:[\\/]*) ;;
4351 func_fatal_error "only absolute run-paths are allowed"
4354 if test "$prev" = rpath; then
4357 *) rpath="$rpath $arg" ;;
4362 *) xrpath="$xrpath $arg" ;;
4374 weak_libs="$weak_libs $arg"
4379 linker_flags="$linker_flags $qarg"
4380 compiler_flags="$compiler_flags $qarg"
4382 func_append compile_command " $qarg"
4383 func_append finalize_command " $qarg"
4387 compiler_flags="$compiler_flags $qarg"
4389 func_append compile_command " $qarg"
4390 func_append finalize_command " $qarg"
4394 linker_flags="$linker_flags $qarg"
4395 compiler_flags="$compiler_flags $wl$qarg"
4397 func_append compile_command " $wl$qarg"
4398 func_append finalize_command " $wl$qarg"
4402 eval "$prev=\"\$arg\""
4407 fi # test -n "$prev"
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"
4422 # FIXME: remove this flag sometime in the future.
4423 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
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
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
4471 case $with_gcc/$host in
4472 no/*-*-irix* | /*-*-irix*)
4473 func_append compile_command " $arg"
4474 func_append finalize_command " $arg"
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'"
4487 func_fatal_error "need path for \`-L' option"
4490 # We need an absolute path.
4492 [\\/]* | [A-Za-z]:[\\/]*) ;;
4494 absdir=`cd "$dir" && pwd`
4495 test -z "$absdir" && \
4496 func_fatal_error "cannot determine absolute directory name of \`$dir'"
4503 deplibs="$deplibs -L$dir"
4504 lib_search_path="$lib_search_path $dir"
4508 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4509 testbindir=`$ECHO "X
$dir" | $Xsed -e 's*/lib$*/bin*'`
4510 case :$dllsearchpath: in
4512 ::) dllsearchpath=$dir;;
4513 *) dllsearchpath="$dllsearchpath:$dir";;
4515 case :$dllsearchpath: in
4516 *":$testbindir:"*) ;;
4517 ::) dllsearchpath=$testbindir;;
4518 *) dllsearchpath="$dllsearchpath:$testbindir";;
4526 if test "X
$arg" = "X-lc
" || test "X
$arg" = "X-lm
"; then
4528 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
4529 # These systems don't actually have a C or math library (as such)
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
"
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
4554 elif test "X
$arg" = "X-lc_r
"; then
4556 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4557 # Do not include libc_r directly, use -pthread flag.
4562 deplibs="$deplibs $arg"
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"
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
4588 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
4594 single_module="${wl}-multi_module"
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"
4612 *) no_install=yes ;;
4629 -precious-files-regex)
4650 func_stripname '-R' '' "$arg"
4651 dir=$func_stripname_result
4652 # We need an absolute path.
4654 [\\/]* | [A-Za-z]:[\\/]*) ;;
4656 func_fatal_error "only absolute run-paths are allowed"
4661 *) xrpath="$xrpath $dir" ;;
4667 # The effects of -shared are defined in a previous loop.
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.
4707 func_stripname
'-Wc,' '' "$arg"
4708 args
=$func_stripname_result
4710 save_ifs
="$IFS"; IFS
=','
4711 for flag
in $args; do
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"
4718 func_stripname
' ' '' "$arg"
4719 arg
=$func_stripname_result
4723 func_stripname
'-Wl,' '' "$arg"
4724 args
=$func_stripname_result
4726 save_ifs
="$IFS"; IFS
=','
4727 for flag
in $args; do
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"
4735 func_stripname
' ' '' "$arg"
4736 arg
=$func_stripname_result
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"
4780 # Some other compiler flag.
4782 func_quote_for_eval
"$arg"
4783 arg
="$func_quote_for_eval_result"
4787 # A standard object.
4792 # A libtool-controlled object.
4794 # Check to see that this really is a libtool object.
4795 if func_lalib_unsafe_p
"$arg"; then
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"
4823 # If libtool objects are unsupported, then we need to preload.
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"
4836 func_append libobjs
" $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"
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"
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"
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"
4869 func_fatal_error
"\`$arg' is not a valid libtool object"
4876 deplibs
="$deplibs $arg"
4877 old_deplibs
="$old_deplibs $arg"
4882 # A libtool-controlled library.
4884 if test "$prev" = dlfiles
; then
4885 # This library was specified with -dlopen.
4886 dlfiles
="$dlfiles $arg"
4888 elif test "$prev" = dlprefiles
; then
4889 # The library was specified with -dlpreopen.
4890 dlprefiles
="$dlprefiles $arg"
4893 deplibs
="$deplibs $arg"
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"
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"
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\'\`
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
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.
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
4968 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
4971 libs
="$libs $deplib"
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).
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" ;;
4986 pre_post_deps
="$pre_post_deps $pre_post_dep"
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
5001 passes
="conv dlpreopen link"
5002 for file in $dlfiles $dlprefiles; do
5006 func_fatal_help
"libraries can \`-dlopen' only libtool libraries: $file"
5017 passes
="conv scan dlopen dlpreopen link"
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
5030 for deplib
in $deplibs; do
5031 tmp_deplibs
="$deplib $tmp_deplibs"
5033 deplibs
="$tmp_deplibs"
5036 if test "$linkmode,$pass" = "lib,link" ||
5037 test "$linkmode,$pass" = "prog,scan"; then
5041 if test "$linkmode" = prog
; then
5043 dlopen
) libs
="$dlfiles" ;;
5044 dlpreopen
) libs
="$dlprefiles" ;;
5046 libs
="$deplibs %DEPLIBS%"
5047 test "X$link_all_deplibs" != Xno
&& libs
="$libs $dependency_libs"
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
5057 *.la
) func_source
"$lib" ;;
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" ;;
5072 if test "$pass" = dlopen
; then
5073 # Collect dlpreopened libraries
5074 save_deplibs
="$deplibs"
5078 for deplib
in $libs; do
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"
5087 compiler_flags
="$compiler_flags $deplib"
5088 if test "$linkmode" = lib
; then
5089 case "$new_inherited_linker_flags " in
5091 * ) new_inherited_linker_flags
="$new_inherited_linker_flags $deplib" ;;
5098 if test "$linkmode" != lib
&& test "$linkmode" != prog
; then
5099 func_warning
"\`-l' is ignored for archives/objects"
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"
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
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"
5129 deplibs
="$deplib $deplibs"
5130 test "$linkmode" = lib
&& newdependency_libs
="$deplib $newdependency_libs"
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
5139 if func_lalib_p
"$lib"; then
5143 for l
in $old_library $library_names; do
5146 if test "X$ll" = "X$old_library" ; then # only static version available
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"
5155 deplibs
="$deplib $deplibs"
5156 test "$linkmode" = lib
&& newdependency_libs
="$deplib $newdependency_libs"
5168 if test "$linkmode,$pass" = "prog,link"; then
5169 compile_deplibs
="$deplib $compile_deplibs"
5170 finalize_deplibs
="$deplib $finalize_deplibs"
5172 deplibs
="$deplib $deplibs"
5173 if test "$linkmode" = lib
; then
5174 case "$new_inherited_linker_flags " in
5176 * ) new_inherited_linker_flags
="$new_inherited_linker_flags $deplib" ;;
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"
5192 if test "$pass" = conv
; then
5193 deplibs
="$deplib $deplibs"
5196 if test "$pass" = scan
; then
5197 deplibs
="$deplib $deplibs"
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"
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.
5218 *) xrpath
="$xrpath $dir" ;;
5221 deplibs
="$deplib $deplibs"
5224 *.la
) lib
="$deplib" ;;
5226 if test "$pass" = conv
; then
5227 deplibs
="$deplib $deplibs"
5232 # Linking convenience modules into shared libraries is allowed,
5233 # but linking other static libraries is non-portable.
5234 case " $dlpreconveniencelibs " in
5238 case $deplibs_check_method in
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
5251 if test "$valid_a_lib" != yes; then
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."
5261 $ECHO "*** Warning: Linking the shared library $output against the"
5262 $ECHO "*** static library $deplib is not portable!"
5263 deplibs
="$deplib $deplibs"
5270 if test "$pass" != link
; then
5271 deplibs
="$deplib $deplibs"
5273 compile_deplibs
="$deplib $compile_deplibs"
5274 finalize_deplibs
="$deplib $finalize_deplibs"
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"
5291 newdlfiles
="$newdlfiles $deplib"
5302 if test "$found" = yes ||
test -f "$lib"; then :
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"
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
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";;
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"
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" ;;
5370 tmp_libs
="$tmp_libs $deplib"
5376 # Get the name of the library we link against.
5378 for l
in $old_library $library_names; do
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"
5399 newdlfiles
="$newdlfiles $lib"
5404 # We need an absolute path.
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"
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."
5430 test "X$hardcode_automatic" = Xyes
&& avoidtemprpath
=yes
5432 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5435 # Remove this search path later
5436 notinst_path
="$notinst_path $abs_ladir"
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"
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"
5476 deplibs
="$lib $deplibs" # used for prog,scan pass
5482 if test "$linkmode" = prog
&& test "$pass" != link
; then
5483 newlib_search_path
="$newlib_search_path $ladir"
5484 deplibs
="$lib $deplibs"
5487 if test "$link_all_deplibs" != no ||
test -z "$library_names" ||
5488 test "$build_libtool_libs" = no
; then
5493 for deplib
in $dependency_libs; do
5495 -L*) func_stripname
'-L' '' "$deplib"
5496 newlib_search_path
="$newlib_search_path $func_stripname_result"
5499 # Need to link against all dependency_libs?
5500 if test "$linkalldeplibs" = yes; then
5501 deplibs
="$deplib $deplibs"
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" ;;
5512 tmp_libs
="$tmp_libs $deplib"
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
5527 *) temp_rpath
="$temp_rpath$absdir:" ;;
5531 # Hardcode the library path.
5532 # Skip directories that are in the system default run-time
5534 case " $sys_lib_dlsearch_path " in
5537 case "$compile_rpath " in
5539 *) compile_rpath
="$compile_rpath $absdir"
5543 case " $sys_lib_dlsearch_path " in
5546 case "$finalize_rpath " in
5548 *) finalize_rpath
="$finalize_rpath $libdir"
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
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
5568 if test -n "$library_names" &&
5569 { test "$use_static_libs" = no ||
test -z "$old_library"; }; then
5571 *cygwin
* |
*mingw
* |
*cegcc
*)
5572 # No point in relinking DLLs because paths are not encoded
5573 notinst_deplibs
="$notinst_deplibs $lib"
5577 if test "$installed" = no
; then
5578 notinst_deplibs
="$notinst_deplibs $lib"
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!
5588 for dlpremoduletest
in $dlprefiles; do
5589 if test "X$dlpremoduletest" = "X$lib"; then
5590 dlopenmodule
="$dlpremoduletest"
5594 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link
; then
5596 if test "$linkmode" = prog
; then
5597 $ECHO "*** Warning: Linking the executable $output against the loadable module"
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
5608 case " $sys_lib_dlsearch_path " in
5611 case "$compile_rpath " in
5613 *) compile_rpath
="$compile_rpath $absdir"
5617 case " $sys_lib_dlsearch_path " in
5620 case "$finalize_rpath " in
5622 *) finalize_rpath
="$finalize_rpath $libdir"
5628 if test -n "$old_archive_from_expsyms_cmds"; then
5629 # figure out the soname
5630 set dummy
$library_names
5634 libname
=`eval "\\$ECHO \"$libname_spec\""`
5635 # use dlname if we got it. it's perfectly good, no?
5636 if test -n "$dlname"; then
5638 elif test -n "$soname_spec"; then
5641 *cygwin
* | mingw
* |
*cegcc
*)
5642 func_arith
$current - $age
5643 major
=$func_arith_result
5647 eval soname
=\"$soname_spec\"
5652 # Make a new name for the extract_expsyms_cmds to use
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 :
5662 func_verbose
"extracting exported symbol list from \`$soname'"
5663 func_execute_cmds
"$extract_expsyms_cmds" 'exit $?'
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
5674 fi # test -n "$old_archive_from_expsyms_cmds"
5676 if test "$linkmode" = prog ||
test "$mode" != relink
; then
5681 case $hardcode_action in
5682 immediate | unsupported
)
5683 if test "$hardcode_direct" = no
; then
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" ;;
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
5699 $ECHO "*** And there doesn't seem to be a static archive available"
5700 $ECHO "*** The link will probably fail, sorry"
5702 add
="$dir/$old_library"
5704 elif test -n "$old_library"; then
5705 add
="$dir/$old_library"
5709 elif test "$hardcode_minus_L" = no
; then
5711 *-*-sunos*) add_shlibpath
="$dir" ;;
5715 elif test "$hardcode_shlibpath_var" = no
; then
5716 add_shlibpath
="$dir"
5723 if test "$hardcode_direct" = yes &&
5724 test "$hardcode_direct_absolute" = no
; then
5726 elif test "$hardcode_minus_L" = yes; then
5728 # Try looking first in the location we're being installed to.
5729 if test -n "$inst_prefix_dir"; then
5732 add_dir
="$add_dir -L$inst_prefix_dir$libdir"
5737 elif test "$hardcode_shlibpath_var" = yes; then
5738 add_shlibpath
="$dir"
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:" ;;
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"
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
5768 *) finalize_shlibpath
="$finalize_shlibpath$libdir:" ;;
5774 if test "$linkmode" = prog ||
test "$mode" = relink
; then
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
5785 elif test "$hardcode_shlibpath_var" = yes; then
5786 case :$finalize_shlibpath: in
5788 *) finalize_shlibpath
="$finalize_shlibpath$libdir:" ;;
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"
5796 add
="$libdir/$linklib"
5799 # We cannot seem to hardcode it, guess we'll fake it.
5801 # Try looking first in the location we're being installed to.
5802 if test -n "$inst_prefix_dir"; then
5805 add_dir
="$add_dir -L$inst_prefix_dir$libdir"
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"
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
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"
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.
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
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
5860 build_libtool_libs
=no
5864 deplibs
="$dir/$old_library $deplibs"
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
5876 for libdir
in $dependency_libs; do
5878 -R*) func_stripname
'-R' '' "$libdir"
5879 temp_xrpath
=$func_stripname_result
5881 *" $temp_xrpath "*) ;;
5882 *) xrpath
="$xrpath $temp_xrpath";;
5884 *) temp_deplibs
="$temp_deplibs $libdir";;
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
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" ;;
5902 tmp_libs
="$tmp_libs $deplib"
5905 if test "$link_all_deplibs" != no
; then
5906 # Add the search paths of all dependency libraries
5907 for deplib
in $dependency_libs; do
5909 -L*) path
="$deplib" ;;
5911 func_dirname
"$deplib" "" "."
5912 dir
="$func_dirname_result"
5913 # We need an absolute path.
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'"
5924 if $GREP "^installed=no" $deplib > /dev
/null
; then
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
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}"
5946 path
="-L$absdir/$objdir"
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"
5960 case " $deplibs " in
5962 *) deplibs
="$path $deplibs" ;;
5965 fi # link_all_deplibs != no
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"
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"
5983 if test "$pass" != dlopen
; then
5984 if test "$pass" != conv
; then
5985 # Make sure lib_search_path contains only unique directories.
5987 for dir
in $newlib_search_path; do
5988 case "$lib_search_path " in
5990 *) lib_search_path
="$lib_search_path $dir" ;;
5996 if test "$linkmode,$pass" != "prog,link"; then
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\"
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
6009 #new_libs="$deplib $new_libs"
6010 # Pragmatically, this seems to cause very few problems in
6013 -L*) new_libs
="$deplib $new_libs" ;;
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
6035 *) new_libs
="$deplib $new_libs" ;;
6043 for deplib
in $new_libs; do
6046 case " $tmp_libs " in
6048 *) tmp_libs
="$tmp_libs $deplib" ;;
6051 *) tmp_libs
="$tmp_libs $deplib" ;;
6054 eval $var=\"$tmp_libs\"
6057 # Last step: remove runtime libs from dependency_libs
6058 # (they stay in deplibs)
6060 for i
in $dependency_libs ; do
6061 case " $predeps $postdeps $compiler_lib_search_path " in
6066 if test -n "$i" ; then
6067 tmp_libs
="$tmp_libs $i"
6070 dependency_libs
=$tmp_libs
6072 if test "$linkmode" = prog
; then
6073 dlfiles
="$newdlfiles"
6075 if test "$linkmode" = prog ||
test "$linkmode" = lib
; then
6076 dlprefiles
="$newdlprefiles"
6081 if test -n "$dlfiles$dlprefiles" ||
test "$dlself" != no
; then
6082 func_warning
"\`-dlopen' is ignored for archives"
6087 func_warning
"\`-l' and \`-L' are ignored for archives" ;;
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
6108 objs
="$objs$old_deplibs"
6112 # Make sure we only generate libraries of the form `libNAME.la'.
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\"
6131 func_stripname
'' '.la' "$outputname"
6132 libname
=$func_stripname_result
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"
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"
6153 test "$#" -gt 1 && \
6154 func_warning
"ignoring multiple \`-rpath's for a libtool library"
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
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"
6177 # Parse the version information argument.
6178 save_ifs
="$IFS"; IFS
=':'
6179 set dummy
$vinfo 0 0 0
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
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
6207 revision
="$number_revision"
6209 freebsd-aout|freebsd-elf|sunos
)
6210 current
="$number_major"
6211 revision
="$number_minor"
6215 func_arith
$number_major + $number_minor
6216 current
=$func_arith_result
6218 revision
="$number_minor"
6219 lt_irix_increment
=no
6230 # Check that each of the things are valid numbers.
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"
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"
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"
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.
6264 case $version_type in
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"
6282 versuffix
=".$current.$revision";
6287 versuffix
=".$current"
6291 if test "X$lt_irix_increment" = "Xno"; then
6292 func_arith
$current - $age
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
;;
6302 verstring
="$verstring_prefix$major.$revision"
6304 # Add in all the interfaces that we are compatible with.
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"
6314 # Before this point, $major must not contain `.'.
6316 versuffix
="$major.$revision"
6320 func_arith
$current - $age
6321 major
=.
$func_arith_result
6322 versuffix
="$major.$age.$revision"
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.
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"
6341 # Make executables depend on our current version.
6342 verstring
="$verstring:${current}.0"
6347 versuffix
=".$current"
6352 versuffix
=".$current.$revision"
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
6364 func_fatal_configuration
"unknown library version type \`$version_type'"
6368 # Clear the version info if we defaulted, and they specified a release.
6369 if test -z "$vinfo" && test -n "$release"; then
6371 case $version_type in
6373 # we can't check for "0.0" in archive_cmds due to quoting
6374 # problems, so we reset it completely
6381 if test "$need_version" = no
; then
6388 # Remove version info from name if versioning should be avoided
6389 if test "$avoid_version" = yes && test "$need_version" = no
; then
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
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.
6417 tempremovelist
=`$ECHO "$output_objdir/*"`
6418 for p
in $tempremovelist; do
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
6429 removelist
="$removelist $p"
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"`
6453 if test -n "$xrpath"; then
6454 # If the user specified any rpath flags, then add them.
6456 for libdir
in $xrpath; do
6457 temp_xrpath
="$temp_xrpath -R$libdir"
6458 case "$finalize_rpath " in
6460 *) finalize_rpath
="$finalize_rpath $libdir" ;;
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"
6471 for lib
in $old_dlfiles; do
6472 case " $dlprefiles $dlfiles " in
6474 *) dlfiles
="$dlfiles $lib" ;;
6478 # Make sure dlprefiles contains only unique files
6479 old_dlprefiles
="$dlprefiles"
6481 for lib
in $old_dlprefiles; do
6482 case "$dlprefiles " in
6484 *) dlprefiles
="$dlprefiles $lib" ;;
6488 if test "$build_libtool_libs" = yes; then
6489 if test -n "$rpath"; then
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"
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"
6519 # Transform deplibs into only deplibs that can be linked in shared.
6521 libname_save
=$libname
6522 release_save
=$release
6523 versuffix_save
=$versuffix
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?
6533 case $deplibs_check_method in
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.
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
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
6562 newdeplibs
="$newdeplibs $i"
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
6572 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6573 newdeplibs
="$newdeplibs $i"
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"
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
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
6605 newdeplibs
="$newdeplibs $i"
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
6615 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6616 newdeplibs
="$newdeplibs $i"
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."
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"
6645 set dummy
$deplibs_check_method; shift
6646 file_magic_regex
=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6647 for a_deplib
in $deplibs; do
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
6655 newdeplibs
="$newdeplibs $a_deplib"
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
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,
6675 potlib
="$potent_lib"
6676 while test -h "$potlib" 2>/dev
/null
; do
6677 potliblink
=`ls -ld $potlib | ${SED} 's/.* -> //'`
6679 [\\/]* |
[A-Za-z
]:[\\/]*) potlib
="$potliblink";;
6680 *) potlib
=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
6683 if eval $file_magic_cmd \"\
$potlib\" 2>/dev
/null |
6685 $EGREP "$file_magic_regex" > /dev
/null
; then
6686 newdeplibs
="$newdeplibs $a_deplib"
6693 if test -n "$a_deplib" ; then
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)"
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"
6714 done # Gone through all deplibs.
6717 set dummy
$deplibs_check_method; shift
6718 match_pattern_regex
=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6719 for a_deplib
in $deplibs; do
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
6727 newdeplibs
="$newdeplibs $a_deplib"
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"
6747 if test -n "$a_deplib" ; then
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)"
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"
6768 done # Gone through all deplibs.
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,,"`
6780 if $ECHO "X $tmp_deplibs" |
$Xsed -e 's/[ ]//g' |
6781 $GREP .
>/dev
/null
; then
6783 if test "X$deplibs_check_method" = "Xnone"; then
6784 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
6786 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
6788 $ECHO "*** All declared inter-library dependencies are being dropped."
6793 versuffix
=$versuffix_save
6795 release
=$release_save
6796 libname
=$libname_save
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 /'`
6806 if test "$droppeddeps" = yes; then
6807 if test "$module" = yes; then
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
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
6825 build_libtool_libs
=no
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
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
6843 build_libtool_libs
=no
6848 # Done checking deplibs!
6851 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
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'`
6860 # move library search paths that coincide with paths to not yet
6861 # installed libraries to the beginning of the library search list
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" ;;
6874 for deplib
in $deplibs; do
6877 case " $new_libs " in
6879 *) new_libs
="$new_libs $deplib" ;;
6882 *) new_libs
="$new_libs $deplib" ;;
6887 # All the library-specific variables (install_libdir is set above).
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
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"
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"
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
6922 *) perm_rpath
="$perm_rpath $libdir" ;;
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\"
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.
6939 for dir
in $perm_rpath; do
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
6961 if test -n "$soname_spec"; then
6962 eval soname
=\"$soname_spec\"
6966 if test -z "$dlname"; then
6970 lib
="$output_objdir/$realname"
6974 linknames
="$linknames $link"
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
=
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
=
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"
7002 always_export_symbols
=yes
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
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
7025 # The command line is too long to execute in one step.
7026 func_verbose
"using reloadable object file for export list..."
7028 # Break out early, otherwise skipped_export may be
7029 # set to false by a later but shorter cmd.
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
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"
7070 tmp_deplibs
="$tmp_deplibs $test_deplib"
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
=
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
7118 eval test_cmds
=\"$module_cmds\"
7122 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7123 eval test_cmds
=\"$archive_expsym_cmds\"
7124 cmds
=$archive_expsym_cmds
7126 eval test_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
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
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
7149 if test -z "$convenience" ||
test -z "$whole_archive_flag_spec"; then
7150 save_libobjs
=$libobjs
7153 output_la
=`$ECHO "X$output" | $Xsed -e "$basename"`
7155 # Clear the reloadable object creation command queue and
7156 # initialize k to one.
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
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"
7180 if test "$compiler_needs_object" = yes; then
7186 $ECHO "$obj" >> $output
7188 delfiles
="$delfiles $output"
7189 output
=$firstobj\"$file_list_spec$output\"
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
7199 # Loop over the list of objects to be linked.
7200 for obj
in $save_libobjs
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"
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\"
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
7221 k
=$func_arith_result
7222 output
=$output_objdir/$output_la-${k}.
$objext
7224 func_len
" $last_robj"
7225 func_arith
$len0 + $func_len_result
7226 len
=$func_arith_result
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"
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
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
7264 func_quote_for_expand
"$cmd"
7265 eval "func_echo $func_quote_for_expand_result"
7267 $opt_dry_run ||
eval "$cmd" ||
{
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" )
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
7311 # Restore the value of 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
7329 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7330 cmds
=$archive_expsym_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
7357 func_quote_for_expand
"$cmd"
7358 eval "func_echo $func_quote_for_expand_result"
7360 $opt_dry_run ||
eval "$cmd" ||
{
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" )
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"'
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 $?'
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.
7404 if test -n "$dlfiles$dlprefiles" ||
test "$dlself" != no
; then
7405 func_warning
"\`-dlopen' is ignored for objects"
7410 func_warning
"\`-l' and \`-L' are ignored for objects" ;;
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"
7427 test -n "$objs$old_deplibs" && \
7428 func_fatal_error
"cannot build library object \`$output' from non-libtool objects"
7432 obj
=$func_lo2o_result
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
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'`
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
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"'
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 $?
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"
7498 func_execute_cmds
"$reload_cmds" 'exit $?'
7501 if test -n "$gentop"; then
7502 func_show_eval
'${RM}r "$gentop"'
7510 *cygwin
*) func_stripname
'' '.exe' "$output"
7511 output
=$func_stripname_result.exe
;;
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."
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 /'`
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
7540 compile_command
="$compile_command ${wl}-bind_at_load"
7541 finalize_command
="$finalize_command ${wl}-bind_at_load"
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'`
7552 # move library search paths that coincide with paths to not yet
7553 # installed libraries to the beginning of the library search list
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" ;;
7566 for deplib
in $compile_deplibs; do
7569 case " $new_libs " in
7571 *) new_libs
="$new_libs $deplib" ;;
7574 *) new_libs
="$new_libs $deplib" ;;
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
7589 *) finalize_rpath
="$finalize_rpath $libdir" ;;
7594 # Now hardcode the library paths
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"
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"
7613 eval flag
=\"$hardcode_libdir_flag_spec\"
7614 rpath
="$rpath $flag"
7616 elif test -n "$runpath_var"; then
7617 case "$perm_rpath " in
7619 *) perm_rpath
="$perm_rpath $libdir" ;;
7623 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2* |
*-cegcc*)
7624 testbindir
=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
7625 case :$dllsearchpath: in
7627 ::) dllsearchpath
=$libdir;;
7628 *) dllsearchpath
="$dllsearchpath:$libdir";;
7630 case :$dllsearchpath: in
7631 *":$testbindir:"*) ;;
7632 ::) dllsearchpath
=$testbindir;;
7633 *) dllsearchpath
="$dllsearchpath:$testbindir";;
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"
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"
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"
7664 eval flag
=\"$hardcode_libdir_flag_spec\"
7665 rpath
="$rpath $flag"
7667 elif test -n "$runpath_var"; then
7668 case "$finalize_perm_rpath " in
7670 *) finalize_perm_rpath
="$finalize_perm_rpath $libdir" ;;
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
7697 *cygwin
* |
*mingw
* )
7698 if test "$build_libtool_libs" != yes; then
7699 wrappers_required
=no
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
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.
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}"'
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"
7738 if test -n "$runpath_var"; then
7739 if test -n "$perm_rpath"; then
7740 # We should set the runpath_var.
7742 for dir
in $perm_rpath; do
7745 compile_var
="$runpath_var=\"$rpath\$$runpath_var\" "
7747 if test -n "$finalize_perm_rpath"; then
7748 # We should set the runpath_var.
7750 for dir
in $finalize_perm_rpath; do
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 $?'
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"
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'`
7782 # fast_install is set to needless
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"
7811 func_quote_for_eval
"$var_value"
7812 relink_command
="$var=$func_quote_for_eval_result; export $var; $relink_command"
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
7822 [\\/]* |
[A-Za-z
]:[\\/]*) qecho
="$SHELL $progpath --fallback-echo";;
7823 *) qecho
="$SHELL `pwd`/$progpath --fallback-echo";;
7825 qecho
=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
7827 qecho
=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
7830 # Only actually do things if not in dry run mode.
7832 # win32 will think the script is a binary if it has
7833 # a .exe suffix, so we strip it off here.
7835 *.exe
) func_stripname
'' '.exe' "$output"
7836 output
=$func_stripname_result ;;
7838 # test for cygwin because mv fails w/o .exe extensions
7842 func_stripname
'' '.exe' "$outputname"
7843 outputname
=$func_stripname_result ;;
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.
7863 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
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
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
7876 func_emit_wrapper no
> $func_ltwrapper_scriptname_result
7882 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
7884 func_emit_wrapper no
> $output
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
7901 if test "$build_libtool_libs" = module
; then
7902 oldobjs
="$libobjs_save"
7903 build_libtool_libs
=no
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
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
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
7955 for obj
in $save_oldobjs
7957 func_basename
"$obj"
7958 objbase
="$func_basename_result"
7959 case " $oldobjs " in
7960 " ") oldobjs
=$obj ;;
7963 # Make sure we don't pick an alternate name that also
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 ;;
7973 func_show_eval
"ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
7974 oldobjs
="$oldobjs $gentop/$newobj"
7976 *) oldobjs
="$oldobjs $obj" ;;
7980 eval cmds
=\"$old_archive_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
7987 # the command line is too long to link in one step, link in parts
7988 func_verbose
"using piecewise archive linking..."
7993 save_oldobjs
=$oldobjs
7995 # Is there a better way of finding the last object in the list?
7996 for obj
in $save_oldobjs
8000 eval test_cmds
=\"$old_archive_cmds\"
8001 func_len
" $test_cmds"
8002 len0
=$func_len_result
8004 for obj
in $save_oldobjs
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
8013 # the above command should be used before it gets too long
8015 if test "$obj" = "$last_oldobj" ; then
8018 test -z "$concat_cmds" || concat_cmds
=$concat_cmds~
8019 eval concat_cmds
=\"\
${concat_cmds}$old_archive_cmds\"
8026 if test "X$oldobjs" = "X" ; then
8027 eval cmds
=\"\
$concat_cmds\"
8029 eval cmds
=\"\
$concat_cmds~\
$old_archive_cmds\"
8033 func_execute_cmds
"$cmds" 'exit $?'
8036 test -n "$generated" && \
8037 func_show_eval
"${RM}r$generated"
8039 # Now create the libtool archive.
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"
8053 func_quote_for_eval
"$var_value"
8054 relink_command
="$var=$func_quote_for_eval_result; export $var; $relink_command"
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
8064 # Only create the output if not a dry run.
8066 for installed
in no
yes; do
8067 if test "$installed" = yes; then
8068 if test -z "$install_libdir"; then
8071 output
="$output_objdir/$outputname"i
8072 # Replace all uninstalled libtool libraries with the installed ones
8074 for deplib
in $dependency_libs; do
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" ;;
8087 dependency_libs
="$newdependency_libs"
8090 for lib
in $dlfiles; do
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" ;;
8103 dlfiles
="$newdlfiles"
8105 for lib
in $dlprefiles; do
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
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"
8121 dlprefiles
="$newdlprefiles"
8124 for lib
in $dlfiles; do
8126 [\\/]* |
[A-Za-z
]:[\\/]*) abs
="$lib" ;;
8127 *) abs
=`pwd`"/$lib" ;;
8129 newdlfiles
="$newdlfiles $abs"
8131 dlfiles
="$newdlfiles"
8133 for lib
in $dlprefiles; do
8135 [\\/]* |
[A-Za-z
]:[\\/]*) abs
="$lib" ;;
8136 *) abs
=`pwd`"/$lib" ;;
8138 newdlprefiles
="$newdlprefiles $abs"
8140 dlprefiles
="$newdlprefiles"
8143 # place dlname in correct position for cygwin
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 ;;
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).
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.
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
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
8192 relink_command=\"$relink_command\""
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 $?'
8205 { test "$mode" = link ||
test "$mode" = relink
; } &&
8206 func_mode_link
${1+"$@"}
8209 # func_mode_uninstall arg...
8210 func_mode_uninstall
()
8218 # This variable tells wrapper scripts just to set variables rather
8219 # than running their programs.
8220 libtool_install_magic
="$magic"
8225 -f) RM
="$RM $arg"; rmforce
=yes ;;
8226 -*) RM
="$RM $arg" ;;
8227 *) files
="$files $arg" ;;
8232 func_fatal_help
"you must specify an RM program"
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"
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
8253 *) rmdirs
="$rmdirs $objdir" ;;
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
8265 elif test "$rmforce" = yes; then
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"
8281 test -n "$old_library" && rmfiles
="$rmfiles $objdir/$old_library"
8285 case " $library_names " in
8286 # " " in the beginning catches empty $dlname
8288 *) rmfiles
="$rmfiles $objdir/$dlname" ;;
8290 test -n "$libdir" && rmfiles
="$rmfiles $objdir/$name $objdir/${name}i"
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.
8309 # Possibly a libtool object, so verify it.
8310 if func_lalib_p
"$file"; then
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
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"
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"
8348 func_source
$func_ltwrapper_scriptname_result
8349 rmfiles
="$rmfiles $func_ltwrapper_scriptname_result"
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"
8368 func_show_eval
"$RM $rmfiles" 'exit_status=1'
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"
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"
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
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