1 # Generated from ltmain.m4sh.
3 # ltmain.sh (GNU libtool) 2.2.4
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.4
69 # automake: $automake_version
70 # autoconf: $autoconf_version
72 # Report bugs to <bug-libtool@gnu.org>.
78 package_revision=1.2976
80 # Be Bourne compatible
81 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
84 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
85 # is contrary to our usage. Disable this feature.
86 alias -g '${1+"$@"}'='"$@"'
89 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
91 BIN_SH=xpg4; export BIN_SH # for Tru64
92 DUALCASE=1; export DUALCASE # for MKS sh
94 # NLS nuisances: We save the old values to restore during execute mode.
95 # Only set LANG and LC_ALL to C if already set.
96 # These must not be set unconditionally because not all systems understand
97 # e.g. LANG=C (notably SCO).
100 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
102 eval "if test \"\${$lt_var+set}\" = set; then
103 save_$lt_var=\$$lt_var
106 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
107 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
119 : ${EGREP="/usr/bin/grep -E"}
120 : ${FGREP="/usr/bin/grep -F"}
121 : ${GREP="/usr/bin/grep"}
127 : ${SED="/opt/local/bin/gsed"}
128 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
129 : ${Xsed="$SED -e 1s/^X//"}
134 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
135 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
137 exit_status=$EXIT_SUCCESS
139 # Make sure IFS has a sensible default
144 dirname="s,/[^/]*$,,"
147 # func_dirname_and_basename file append nondir_replacement
148 # perform func_basename and func_dirname in a single function
150 # dirname: Compute the dirname of FILE. If nonempty,
151 # add APPEND to the result, otherwise set result
152 # to NONDIR_REPLACEMENT.
153 # value returned in "$func_dirname_result"
154 # basename: Compute filename of FILE.
155 # value retuned in "$func_basename_result"
156 # Implementation must be kept synchronized with func_dirname
157 # and func_basename. For efficiency, we do not delegate to
158 # those functions but instead duplicate the functionality here.
159 func_dirname_and_basename ()
161 # Extract subdirectory from the argument.
162 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
163 if test "X$func_dirname_result" = "X${1}"; then
164 func_dirname_result="${3}"
166 func_dirname_result="$func_dirname_result${2}"
168 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
171 # Generated shell functions inserted here.
173 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
174 # is ksh but when the shell is invoked as "sh" and the current value of
175 # the _XPG environment variable is not equal to 1 (one), the special
176 # positional parameter $0, within a function call, is the name of the
180 # The name of this program:
181 # In the unlikely event $progname began with a '-', it would play havoc with
182 # func_echo (imagine progname=-n), so we prepend ./ in that case:
183 func_dirname_and_basename "$progpath"
184 progname=$func_basename_result
186 -*) progname=./$progname ;;
189 # Make sure we have an absolute path for reexecution:
191 [\\/]*|[A-Za-z]:\\*) ;;
193 progdir=$func_dirname_result
194 progdir=`cd "$progdir" && pwd`
195 progpath="$progdir/$progname"
200 for progdir in $PATH; do
202 test -x "$progdir/$progname" && break
205 test -n "$progdir" || progdir=`pwd`
206 progpath="$progdir/$progname"
210 # Sed substitution that helps us do robust quoting. It backslashifies
211 # metacharacters that are still active within double-quoted strings.
212 Xsed="${SED}"' -e 1s/^X//'
213 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
215 # Same as above, but do not quote variable references.
216 double_quote_subst='s/\(["`\\]\)/\\\1/g'
218 # Re-`\' parameter expansions in output of double_quote_subst that were
219 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
220 # in input to double_quote_subst, that '$' was protected from expansion.
221 # Since each input `\' is now two `\'s, look for any number of runs of
222 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
227 sed_double_backslash="\
231 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
242 # Echo program name prefixed message, along with the current mode
243 # name if it has been set yet.
246 $ECHO "$progname${mode+: }$mode: $*"
249 # func_verbose arg...
250 # Echo program name prefixed message in verbose mode only.
253 $opt_verbose && func_echo ${1+"$@"}
255 # A bug in bash halts the script if the last line of a function
256 # fails when set -e is in force, so we need another command to
262 # Echo program name prefixed message to standard error.
265 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
268 # func_warning arg...
269 # Echo program name prefixed warning message to standard error.
272 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
278 # func_fatal_error arg...
279 # Echo program name prefixed message to standard error, and exit.
286 # func_fatal_help arg...
287 # Echo program name prefixed message to standard error, followed by
288 # a help hint, and exit.
292 func_fatal_error "$help"
294 help="Try \`$progname --help' for more information." ## default
297 # func_grep expression filename
298 # Check whether EXPRESSION matches any line of FILENAME, without output.
301 $GREP "$1" "$2" >/dev/null 2>&1
305 # func_mkdir_p directory-path
306 # Make sure the entire path to DIRECTORY-PATH is available.
309 my_directory_path="$1"
312 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
314 # Protect directory names starting with `-'
315 case $my_directory_path in
316 -*) my_directory_path="./$my_directory_path" ;;
319 # While some portion of DIR does not yet exist...
320 while test ! -d "$my_directory_path"; do
321 # ...make a list in topmost first order. Use a colon delimited
322 # list incase some portion of path contains whitespace.
323 my_dir_list="$my_directory_path:$my_dir_list"
325 # If the last portion added has no slash in it, the list is done
326 case $my_directory_path in */*) ;; *) break ;; esac
328 # ...otherwise throw away the child directory and loop
329 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
331 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
333 save_mkdir_p_IFS="$IFS"; IFS=':'
334 for my_dir in $my_dir_list; do
335 IFS="$save_mkdir_p_IFS"
336 # mkdir can fail with a `File exist' error if two processes
337 # try to create one of the directories concurrently. Don't
339 $MKDIR "$my_dir" 2>/dev/null || :
341 IFS="$save_mkdir_p_IFS"
343 # Bail out if we (or some other process) failed to create a directory.
344 test -d "$my_directory_path" || \
345 func_fatal_error "Failed to create \`$1'"
350 # func_mktempdir [string]
351 # Make a temporary directory that won't clash with other running
352 # libtool processes, and avoids race conditions if possible. If
353 # given, STRING is the basename for that directory.
356 my_template="${TMPDIR-/tmp}/${1-$progname}"
358 if test "$opt_dry_run" = ":"; then
359 # Return a directory name, but don't create it in dry-run mode
360 my_tmpdir="${my_template}-$$"
363 # If mktemp works, use that first and foremost
364 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
366 if test ! -d "$my_tmpdir"; then
367 # Failing that, at least try and use $RANDOM to avoid a race
368 my_tmpdir="${my_template}-${RANDOM-0}$$"
370 save_mktempdir_umask=`umask`
373 umask $save_mktempdir_umask
376 # If we're not in dry-run mode, bomb out on failure
377 test -d "$my_tmpdir" || \
378 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
381 $ECHO "X$my_tmpdir" | $Xsed
385 # func_quote_for_eval arg
386 # Aesthetically quote ARG to be evaled later.
387 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
388 # is double-quoted, suitable for a subsequent eval, whereas
389 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
390 # which are still active within double quotes backslashified.
391 func_quote_for_eval ()
395 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
397 func_quote_for_eval_unquoted_result="$1" ;;
400 case $func_quote_for_eval_unquoted_result in
401 # Double-quote args containing shell metacharacters to delay
402 # word splitting, command substitution and and variable
403 # expansion for a subsequent eval.
404 # Many Bourne shells cannot handle close brackets correctly
405 # in scan sets, so we specify it separately.
406 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
407 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
410 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
415 # func_quote_for_expand arg
416 # Aesthetically quote ARG to be evaled later; same as above,
417 # but do not quote variable references.
418 func_quote_for_expand ()
422 my_arg=`$ECHO "X$1" | $Xsed \
423 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
429 # Double-quote args containing shell metacharacters to delay
430 # word splitting and command substitution for a subsequent eval.
431 # Many Bourne shells cannot handle close brackets correctly
432 # in scan sets, so we specify it separately.
433 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
438 func_quote_for_expand_result="$my_arg"
442 # func_show_eval cmd [fail_exp]
443 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
444 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
445 # is given, then evaluate it.
451 ${opt_silent-false} || {
452 func_quote_for_expand "$my_cmd"
453 eval "func_echo $func_quote_for_expand_result"
456 if ${opt_dry_run-false}; then :; else
459 if test "$my_status" -eq 0; then :; else
460 eval "(exit $my_status); $my_fail_exp"
466 # func_show_eval_locale cmd [fail_exp]
467 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
468 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
469 # is given, then evaluate it. Use the saved locale for evaluation.
470 func_show_eval_locale ()
475 ${opt_silent-false} || {
476 func_quote_for_expand "$my_cmd"
477 eval "func_echo $func_quote_for_expand_result"
480 if ${opt_dry_run-false}; then :; else
481 eval "$lt_user_locale
484 eval "$lt_safe_locale"
485 if test "$my_status" -eq 0; then :; else
486 eval "(exit $my_status); $my_fail_exp"
496 # Echo version message to standard output and exit.
499 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
502 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
509 # Echo short help message to standard output and exit.
512 $SED -n '/^# Usage:/,/# -h/ {
515 s/\$progname/'$progname'/
519 $ECHO "run \`$progname --help | more' for full usage"
524 # Echo long help message to standard output and exit.
527 $SED -n '/^# Usage:/,/# Report bugs to/ {
530 s*\$progname*'$progname'*
532 s*\$SHELL*'"$SHELL"'*
534 s*\$LTCFLAGS*'"$LTCFLAGS"'*
536 s/\$with_gnu_ld/'"$with_gnu_ld"'/
537 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
538 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
544 # func_missing_arg argname
545 # Echo program name prefixed message to standard error and set global
549 func_error "missing argument for $1"
559 # Check that we have a working $ECHO.
560 if test "X$1" = X--no-reexec; then
561 # Discard the --no-reexec flag, and continue.
563 elif test "X$1" = X--fallback-echo; then
564 # Avoid inline document here, it may be left over
566 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
567 # Yippee, $ECHO works!
570 # Restart under the correct shell, and then maybe $ECHO will work.
571 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
574 if test "X$1" = X--fallback-echo; then
575 # used as fallback echo
583 magic="%%%MAGIC variable%%%"
584 magic_exe="%%%MAGIC EXE variable%%%"
591 lo2o="s/\\.lo\$/.${objext}/"
592 o2lo="s/\\.${objext}\$/.lo/"
597 opt_duplicate_deps=false
601 # If this variable is set in any of the actions, the command in it
602 # will be execed at the end. This prevents here-documents from being
603 # left over by shells.
606 # func_fatal_configuration arg...
607 # Echo program name prefixed message to standard error, followed by
608 # a configuration failure hint, and exit.
609 func_fatal_configuration ()
612 func_error "See the $PACKAGE documentation for more information."
613 func_fatal_error "Fatal configuration error."
618 # Display the configuration for all the tags in this script.
621 re_begincf='^# ### BEGIN LIBTOOL'
622 re_endcf='^# ### END LIBTOOL'
624 # Default configuration.
625 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
627 # Now print the configurations for the tags.
628 for tagname in $taglist; do
629 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
636 # Display the features supported by this script.
640 if test "$build_libtool_libs" = yes; then
641 $ECHO "enable shared libraries"
643 $ECHO "disable shared libraries"
645 if test "$build_old_libs" = yes; then
646 $ECHO "enable static libraries"
648 $ECHO "disable static libraries"
654 # func_enable_tag tagname
655 # Verify that TAGNAME is valid, and either flag an error and exit, or
656 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
663 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
664 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
665 sed_extractcf="/$re_begincf/,/$re_endcf/p"
670 func_fatal_error "invalid tag name: $tagname"
674 # Don't test for the "default" C tag, as we know it's
675 # there but not specially marked.
679 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
680 taglist="$taglist $tagname"
682 # Evaluate the configuration. Be careful to quote the path
683 # and the sed script, to avoid splitting on whitespace, but
684 # also don't use non-portable quotes within backquotes within
685 # quotes we have to do it in 2 steps:
686 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
689 func_error "ignoring unknown tag $tagname"
695 # Parse options once, thoroughly. This comes as soon as possible in
696 # the script to make things like `libtool --version' happen quickly.
699 # Shorthand for --mode=foo, only valid as the first argument
702 shift; set dummy --mode clean ${1+"$@"}; shift
704 compile|compil|compi|comp|com|co|c)
705 shift; set dummy --mode compile ${1+"$@"}; shift
707 execute|execut|execu|exec|exe|ex|e)
708 shift; set dummy --mode execute ${1+"$@"}; shift
710 finish|finis|fini|fin|fi|f)
711 shift; set dummy --mode finish ${1+"$@"}; shift
713 install|instal|insta|inst|ins|in|i)
714 shift; set dummy --mode install ${1+"$@"}; shift
717 shift; set dummy --mode link ${1+"$@"}; shift
719 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
720 shift; set dummy --mode uninstall ${1+"$@"}; shift
724 # Parse non-mode specific arguments:
725 while test "$#" -gt 0; do
730 --config) func_config ;;
732 --debug) preserve_args="$preserve_args $opt"
733 func_echo "enabling shell trace mode"
738 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
739 execute_dlfiles="$execute_dlfiles $1"
743 --dry-run | -n) opt_dry_run=: ;;
744 --features) func_features ;;
745 --finish) mode="finish" ;;
747 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
749 # Valid mode arguments:
759 # Catch anything else as an error
760 *) func_error "invalid argument for $opt"
771 opt_duplicate_deps=: ;;
773 --quiet|--silent) preserve_args="$preserve_args $opt"
777 --verbose| -v) preserve_args="$preserve_args $opt"
781 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
782 preserve_args="$preserve_args $opt $1"
783 func_enable_tag "$1" # tagname is set here
787 # Separate optargs to long options:
788 -dlopen=*|--mode=*|--tag=*)
789 func_opt_split "$opt"
790 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
794 -\?|-h) func_usage ;;
795 --help) opt_help=: ;;
796 --version) func_version ;;
798 -*) func_fatal_help "unrecognized option \`$opt'" ;;
808 *cygwin* | *mingw* | *pw32*)
809 # don't eliminate duplications in $postdeps and $predeps
810 opt_duplicate_compiler_generated_deps=:
813 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
817 # Having warned about all mis-specified options, bail out if
818 # anything was wrong.
819 $exit_cmd $EXIT_FAILURE
822 # func_check_version_match
823 # Ensure that we are using m4 macros, and libtool script from the same
824 # release of libtool.
825 func_check_version_match ()
827 if test "$package_revision" != "$macro_revision"; then
828 if test "$VERSION" != "$macro_version"; then
829 if test -z "$macro_version"; then
831 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
832 $progname: definition of this LT_INIT comes from an older release.
833 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
834 $progname: and run autoconf again.
838 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
839 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
840 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
841 $progname: and run autoconf again.
846 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
847 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
848 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
849 $progname: of $PACKAGE $VERSION and run autoconf again.
863 # Sanity checks first:
864 func_check_version_match
866 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
867 func_fatal_configuration "not configured to build any kind of library"
870 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
874 eval std_shrext=\"$shrext_cmds\"
877 # Only execute mode is allowed to have -dlopen flags.
878 if test -n "$execute_dlfiles" && test "$mode" != execute; then
879 func_error "unrecognized option \`-dlopen'"
884 # Change the help message to a mode-specific one.
886 help="Try \`$progname --help --mode=$mode' for more information."
891 # True iff FILE is a libtool `.la' library or `.lo' object file.
892 # This function is only a basic sanity check; it will hardly flush out
893 # determined imposters.
896 $SED -e 4q "$1" 2>/dev/null \
897 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
900 # func_lalib_unsafe_p file
901 # True iff FILE is a libtool `.la' library or `.lo' object file.
902 # This function implements the same check as func_lalib_p without
903 # resorting to external programs. To this end, it redirects stdin and
904 # closes it afterwards, without saving the original file descriptor.
905 # As a safety measure, use it only where a negative result would be
906 # fatal anyway. Works if `file' does not exist.
907 func_lalib_unsafe_p ()
910 if test -r "$1" && exec 5<&0 <"$1"; then
911 for lalib_p_l in 1 2 3 4
914 case "$lalib_p_line" in
915 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
920 test "$lalib_p" = yes
923 # func_ltwrapper_script_p file
924 # True iff FILE is a libtool wrapper script
925 # This function is only a basic sanity check; it will hardly flush out
926 # determined imposters.
927 func_ltwrapper_script_p ()
932 # func_ltwrapper_executable_p file
933 # True iff FILE is a libtool wrapper executable
934 # This function is only a basic sanity check; it will hardly flush out
935 # determined imposters.
936 func_ltwrapper_executable_p ()
938 func_ltwrapper_exec_suffix=
941 *) func_ltwrapper_exec_suffix=.exe ;;
943 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
946 # func_ltwrapper_scriptname file
947 # Assumes file is an ltwrapper_executable
948 # uses $file to determine the appropriate filename for a
949 # temporary ltwrapper_script.
950 func_ltwrapper_scriptname ()
952 func_ltwrapper_scriptname_result=""
953 if func_ltwrapper_executable_p "$1"; then
954 func_dirname_and_basename "$1" "" "."
955 func_stripname '' '.exe' "$func_basename_result"
956 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
960 # func_ltwrapper_p file
961 # True iff FILE is a libtool wrapper script or wrapper executable
962 # This function is only a basic sanity check; it will hardly flush out
963 # determined imposters.
966 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
970 # func_execute_cmds commands fail_cmd
971 # Execute tilde-delimited COMMANDS.
972 # If FAIL_CMD is given, eval that upon failure.
973 # FAIL_CMD may read-access the current command in variable CMD!
977 save_ifs=$IFS; IFS='~'
981 func_show_eval "$cmd" "${2-:}"
988 # Source FILE, adding directory component if necessary.
989 # Note that it is not necessary on cygwin/mingw to append a dot to
990 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
991 # behavior happens only for exec(3), not for open(2)! Also, sourcing
992 # `FILE.' does not work on cygwin managed mounts.
997 */* | *\\*) . "$1" ;;
1003 # func_infer_tag arg
1004 # Infer tagged configuration to use if any are available and
1005 # if one wasn't chosen via the "--tag" command line option.
1006 # Only attempt this if the compiler in the base compile
1007 # command doesn't match the default compiler.
1008 # arg is usually of the form 'gcc ...'
1012 if test -n "$available_tags" && test -z "$tagname"; then
1015 func_quote_for_eval "$arg"
1016 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1019 # Blanks in the command may have been stripped by the calling shell,
1020 # but not from the CC environment variable when configure was run.
1021 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1022 # Blanks at the start of $base_compile will cause this to fail
1023 # if we don't check for them as well.
1025 for z in $available_tags; do
1026 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1027 # Evaluate the configuration.
1028 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1031 # Double-quote args containing other shell metacharacters.
1032 func_quote_for_eval "$arg"
1033 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1036 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1037 # The compiler in the base compile command matches
1038 # the one in the tagged configuration.
1039 # Assume this is the tagged configuration we want.
1046 # If $tagname still isn't set, then no tagged configuration
1047 # was found and let the user know that the "--tag" command
1048 # line option must be used.
1049 if test -z "$tagname"; then
1050 func_echo "unable to infer tagged configuration"
1051 func_fatal_error "specify a tag with \`--tag'"
1053 # func_verbose "using $tagname tagged configuration"
1062 # func_write_libtool_object output_name pic_name nonpic_name
1063 # Create a libtool object file (analogous to a ".la" file),
1064 # but don't create it if we're doing a dry run.
1065 func_write_libtool_object ()
1068 if test "$build_libtool_libs" = yes; then
1074 if test "$build_old_libs" = yes; then
1075 write_oldobj=\'${3}\'
1081 cat >${write_libobj}T <<EOF
1082 # $write_libobj - a libtool object file
1083 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1085 # Please DO NOT delete this file!
1086 # It is necessary for linking the library.
1088 # Name of the PIC object.
1089 pic_object=$write_lobj
1091 # Name of the non-PIC object
1092 non_pic_object=$write_oldobj
1095 $MV "${write_libobj}T" "${write_libobj}"
1099 # func_mode_compile arg...
1100 func_mode_compile ()
1103 # Get the compilation command and the source file.
1105 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1117 # do not "continue". Instead, add this to base_compile
1129 # Accept any command-line options.
1132 test -n "$libobj" && \
1133 func_fatal_error "you cannot specify \`-o' more than once"
1138 -pie | -fpie | -fPIE)
1139 pie_flag="$pie_flag $arg"
1143 -shared | -static | -prefer-pic | -prefer-non-pic)
1154 arg_mode=arg # the next one goes into the "base_compile" arg list
1155 continue # The current "srcfile" will either be retained or
1156 ;; # replaced later. I would guess that would be a bug.
1159 func_stripname '-Wc,' '' "$arg"
1160 args=$func_stripname_result
1162 save_ifs="$IFS"; IFS=','
1163 for arg in $args; do
1165 func_quote_for_eval "$arg"
1166 lastarg="$lastarg $func_quote_for_eval_result"
1169 func_stripname ' ' '' "$lastarg"
1170 lastarg=$func_stripname_result
1172 # Add the arguments to base_compile.
1173 base_compile="$base_compile $lastarg"
1178 # Accept the current argument as the source file.
1179 # The previous "srcfile" becomes the current argument.
1186 esac # case $arg_mode
1188 # Aesthetically quote the previous argument.
1189 func_quote_for_eval "$lastarg"
1190 base_compile="$base_compile $func_quote_for_eval_result"
1195 func_fatal_error "you must specify an argument for -Xcompile"
1198 func_fatal_error "you must specify a target with \`-o'"
1201 # Get the name of the library object.
1202 test -z "$libobj" && {
1203 func_basename "$srcfile"
1204 libobj="$func_basename_result"
1209 # Recognize several different file suffixes.
1210 # If the user specifies -o file.o, it is replaced with file.lo
1213 *.ada | *.adb | *.ads | *.asm | \
1214 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1215 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1216 func_xform "$libobj"
1217 libobj=$func_xform_result
1222 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1224 func_fatal_error "cannot determine name of library object from \`$libobj'"
1228 func_infer_tag $base_compile
1230 for arg in $later; do
1233 test "$build_libtool_libs" != yes && \
1234 func_fatal_configuration "can not build a shared library"
1240 build_libtool_libs=no
1257 func_quote_for_eval "$libobj"
1258 test "X$libobj" != "X$func_quote_for_eval_result" \
1259 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1260 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1261 func_dirname_and_basename "$obj" "/" ""
1262 objname="$func_basename_result"
1263 xdir="$func_dirname_result"
1264 lobj=${xdir}$objdir/$objname
1266 test -z "$base_compile" && \
1267 func_fatal_help "you must specify a compilation command"
1269 # Delete any leftover library objects.
1270 if test "$build_old_libs" = yes; then
1271 removelist="$obj $lobj $libobj ${libobj}T"
1273 removelist="$lobj $libobj ${libobj}T"
1276 # On Cygwin there's no "real" PIC flag so we must build both object types
1278 cygwin* | mingw* | pw32* | os2*)
1282 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1283 # non-PIC code in shared libraries is not supported
1287 # Calculate the filename of the output object if compiler does
1288 # not support -o with -c
1289 if test "$compiler_c_o" = no; then
1290 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1291 lockfile="$output_obj.lock"
1298 # Lock this critical section if it is needed
1299 # We use this script file to make the link, it avoids creating a new file
1300 if test "$need_locks" = yes; then
1301 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1302 func_echo "Waiting for $lockfile to be removed"
1305 elif test "$need_locks" = warn; then
1306 if test -f "$lockfile"; then
1308 *** ERROR, $lockfile exists and contains:
1309 `cat $lockfile 2>/dev/null`
1311 This indicates that another process is trying to use the same
1312 temporary object file, and libtool could not work around it because
1313 your compiler does not support \`-c' and \`-o' together. If you
1314 repeat this compilation, it may succeed, by chance, but you had better
1315 avoid parallel builds (make -j) in this platform, or get a better
1318 $opt_dry_run || $RM $removelist
1321 removelist="$removelist $output_obj"
1322 $ECHO "$srcfile" > "$lockfile"
1325 $opt_dry_run || $RM $removelist
1326 removelist="$removelist $lockfile"
1327 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1329 if test -n "$fix_srcfile_path"; then
1330 eval srcfile=\"$fix_srcfile_path\"
1332 func_quote_for_eval "$srcfile"
1333 qsrcfile=$func_quote_for_eval_result
1335 # Only build a PIC object if we are building libtool libraries.
1336 if test "$build_libtool_libs" = yes; then
1337 # Without this assignment, base_compile gets emptied.
1338 fbsd_hideous_sh_bug=$base_compile
1340 if test "$pic_mode" != no; then
1341 command="$base_compile $qsrcfile $pic_flag"
1343 # Don't build PIC code
1344 command="$base_compile $qsrcfile"
1347 func_mkdir_p "$xdir$objdir"
1349 if test -z "$output_obj"; then
1350 # Place PIC objects in $objdir
1351 command="$command -o $lobj"
1354 func_show_eval_locale "$command" \
1355 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1357 if test "$need_locks" = warn &&
1358 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1360 *** ERROR, $lockfile contains:
1361 `cat $lockfile 2>/dev/null`
1363 but it should contain:
1366 This indicates that another process is trying to use the same
1367 temporary object file, and libtool could not work around it because
1368 your compiler does not support \`-c' and \`-o' together. If you
1369 repeat this compilation, it may succeed, by chance, but you had better
1370 avoid parallel builds (make -j) in this platform, or get a better
1373 $opt_dry_run || $RM $removelist
1377 # Just move the object if needed, then go on to compile the next one
1378 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1379 func_show_eval '$MV "$output_obj" "$lobj"' \
1380 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1383 # Allow error messages only from the first compilation.
1384 if test "$suppress_opt" = yes; then
1385 suppress_output=' >/dev/null 2>&1'
1389 # Only build a position-dependent object if we build old libraries.
1390 if test "$build_old_libs" = yes; then
1391 if test "$pic_mode" != yes; then
1392 # Don't build PIC code
1393 command="$base_compile $qsrcfile$pie_flag"
1395 command="$base_compile $qsrcfile $pic_flag"
1397 if test "$compiler_c_o" = yes; then
1398 command="$command -o $obj"
1401 # Suppress compiler output if we already did a PIC compilation.
1402 command="$command$suppress_output"
1403 func_show_eval_locale "$command" \
1404 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1406 if test "$need_locks" = warn &&
1407 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1409 *** ERROR, $lockfile contains:
1410 `cat $lockfile 2>/dev/null`
1412 but it should contain:
1415 This indicates that another process is trying to use the same
1416 temporary object file, and libtool could not work around it because
1417 your compiler does not support \`-c' and \`-o' together. If you
1418 repeat this compilation, it may succeed, by chance, but you had better
1419 avoid parallel builds (make -j) in this platform, or get a better
1422 $opt_dry_run || $RM $removelist
1426 # Just move the object if needed
1427 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1428 func_show_eval '$MV "$output_obj" "$obj"' \
1429 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1434 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1436 # Unlock the critical section if it was locked
1437 if test "$need_locks" != no; then
1438 removelist=$lockfile
1447 test "$mode" = compile && func_mode_compile ${1+"$@"}
1452 # We need to display help for each of the modes.
1455 # Generic help is extracted from the usage comments
1456 # at the start of this file.
1462 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1464 Remove files from the build directory.
1466 RM is the name of the program to use to delete files associated with each FILE
1467 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1470 If FILE is a libtool library, object or program, all the files associated
1471 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1476 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1478 Compile a source file into a libtool library object.
1480 This mode accepts the following additional options:
1482 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1483 -no-suppress do not suppress compiler output for multiple passes
1484 -prefer-pic try to building PIC objects only
1485 -prefer-non-pic try to building non-PIC objects only
1486 -shared do not build a \`.o' file suitable for static linking
1487 -static only build a \`.o' file suitable for static linking
1489 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1490 from the given SOURCEFILE.
1492 The output file name is determined by removing the directory component from
1493 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1494 library object suffix, \`.lo'."
1499 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1501 Automatically set library path, then run a program.
1503 This mode accepts the following additional options:
1505 -dlopen FILE add the directory containing FILE to the library path
1507 This mode sets the library path environment variable according to \`-dlopen'
1510 If any of the ARGS are libtool executable wrappers, then they are translated
1511 into their corresponding uninstalled binary, and any of their required library
1512 directories are added to the library path.
1514 Then, COMMAND is executed, with ARGS as arguments."
1519 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1521 Complete the installation of libtool libraries.
1523 Each LIBDIR is a directory that contains libtool libraries.
1525 The commands that this mode executes may require superuser privileges. Use
1526 the \`--dry-run' option if you just want to see what would be executed."
1531 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1533 Install executables or libraries.
1535 INSTALL-COMMAND is the installation command. The first component should be
1536 either the \`install' or \`cp' program.
1538 The following components of INSTALL-COMMAND are treated specially:
1540 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1542 The rest of the components are interpreted as arguments to that command (only
1543 BSD-compatible install options are recognized)."
1548 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1550 Link object files or libraries together to form another library, or to
1551 create an executable program.
1553 LINK-COMMAND is a command using the C compiler that you would use to create
1554 a program from several object files.
1556 The following components of LINK-COMMAND are treated specially:
1558 -all-static do not do any dynamic linking at all
1559 -avoid-version do not add a version suffix if possible
1560 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1561 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1562 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1563 -export-symbols SYMFILE
1564 try to export only the symbols listed in SYMFILE
1565 -export-symbols-regex REGEX
1566 try to export only the symbols matching REGEX
1567 -LLIBDIR search LIBDIR for required installed libraries
1568 -lNAME OUTPUT-FILE requires the installed library libNAME
1569 -module build a library that can dlopened
1570 -no-fast-install disable the fast-install mode
1571 -no-install link a not-installable executable
1572 -no-undefined declare that a library does not refer to external symbols
1573 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1574 -objectlist FILE Use a list of object files found in FILE to specify objects
1575 -precious-files-regex REGEX
1576 don't remove output files matching REGEX
1577 -release RELEASE specify package release information
1578 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1579 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1580 -shared only do dynamic linking of libtool libraries
1581 -shrext SUFFIX override the standard shared library file extension
1582 -static do not do any dynamic linking of uninstalled libtool libraries
1583 -static-libtool-libs
1584 do not do any dynamic linking of libtool libraries
1585 -version-info CURRENT[:REVISION[:AGE]]
1586 specify library version info [each variable defaults to 0]
1587 -weak LIBNAME declare that the target provides the LIBNAME interface
1589 All other options (arguments beginning with \`-') are ignored.
1591 Every other argument is treated as a filename. Files ending in \`.la' are
1592 treated as uninstalled libtool libraries, other files are standard or library
1595 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1596 only library objects (\`.lo' files) may be specified, and \`-rpath' is
1597 required, except when creating a convenience library.
1599 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1600 using \`ar' and \`ranlib', or on Windows using \`lib'.
1602 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1603 is created, otherwise an executable program is created."
1608 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1610 Remove libraries from an installation directory.
1612 RM is the name of the program to use to delete files associated with each FILE
1613 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1616 If FILE is a libtool library, all the files associated with it are deleted.
1617 Otherwise, only FILE itself is deleted using RM."
1621 func_fatal_help "invalid operation mode \`$mode'"
1626 $ECHO "Try \`$progname --help' for more information about other modes."
1631 # Now that we've collected a possible --mode arg, show help if necessary
1632 $opt_help && func_mode_help
1635 # func_mode_execute arg...
1636 func_mode_execute ()
1639 # The first argument is the command name.
1642 func_fatal_help "you must specify a COMMAND"
1644 # Handle -dlopen flags immediately.
1645 for file in $execute_dlfiles; do
1647 || func_fatal_help "\`$file' is not a file"
1652 # Check to see that this really is a libtool archive.
1653 func_lalib_unsafe_p "$file" \
1654 || func_fatal_help "\`$lib' is not a valid libtool archive"
1656 # Read the libtool library.
1661 # Skip this library if it cannot be dlopened.
1662 if test -z "$dlname"; then
1663 # Warn if it was a shared library.
1664 test -n "$library_names" && \
1665 func_warning "\`$file' was not linked with \`-export-dynamic'"
1669 func_dirname "$file" "" "."
1670 dir="$func_dirname_result"
1672 if test -f "$dir/$objdir/$dlname"; then
1675 if test ! -f "$dir/$dlname"; then
1676 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1682 # Just add the directory containing the .lo file.
1683 func_dirname "$file" "" "."
1684 dir="$func_dirname_result"
1688 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1693 # Get the absolute pathname.
1694 absdir=`cd "$dir" && pwd`
1695 test -n "$absdir" && dir="$absdir"
1697 # Now add the directory to shlibpath_var.
1698 if eval "test -z \"\$$shlibpath_var\""; then
1699 eval "$shlibpath_var=\"\$dir\""
1701 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1705 # This variable tells wrapper scripts just to set shlibpath_var
1706 # rather than running their programs.
1707 libtool_execute_magic="$magic"
1709 # Check if any of the arguments is a wrapper script.
1716 # Do a test to see if this is really a libtool program.
1717 if func_ltwrapper_script_p "$file"; then
1719 # Transform arg to wrapped name.
1720 file="$progdir/$program"
1721 elif func_ltwrapper_executable_p "$file"; then
1722 func_ltwrapper_scriptname "$file"
1723 func_source "$func_ltwrapper_scriptname_result"
1724 # Transform arg to wrapped name.
1725 file="$progdir/$program"
1729 # Quote arguments (to preserve shell metacharacters).
1730 func_quote_for_eval "$file"
1731 args="$args $func_quote_for_eval_result"
1734 if test "X$opt_dry_run" = Xfalse; then
1735 if test -n "$shlibpath_var"; then
1736 # Export the shlibpath_var.
1737 eval "export $shlibpath_var"
1740 # Restore saved environment variables
1741 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1743 eval "if test \"\${save_$lt_var+set}\" = set; then
1744 $lt_var=\$save_$lt_var; export $lt_var
1750 # Now prepare to actually exec the command.
1751 exec_cmd="\$cmd$args"
1753 # Display what would be done.
1754 if test -n "$shlibpath_var"; then
1755 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1756 $ECHO "export $shlibpath_var"
1763 test "$mode" = execute && func_mode_execute ${1+"$@"}
1766 # func_mode_finish arg...
1773 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1776 libdirs="$libdirs $dir"
1779 for libdir in $libdirs; do
1780 if test -n "$finish_cmds"; then
1781 # Do each command in the finish commands.
1782 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1785 if test -n "$finish_eval"; then
1786 # Do the single finish_eval.
1787 eval cmds=\"$finish_eval\"
1788 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
1794 # Exit here if they wanted silent mode.
1795 $opt_silent && exit $EXIT_SUCCESS
1797 $ECHO "X----------------------------------------------------------------------" | $Xsed
1798 $ECHO "Libraries have been installed in:"
1799 for libdir in $libdirs; do
1803 $ECHO "If you ever happen to want to link against installed libraries"
1804 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1805 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1806 $ECHO "flag during linking and do at least one of the following:"
1807 if test -n "$shlibpath_var"; then
1808 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
1809 $ECHO " during execution"
1811 if test -n "$runpath_var"; then
1812 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
1813 $ECHO " during linking"
1815 if test -n "$hardcode_libdir_flag_spec"; then
1817 eval flag=\"$hardcode_libdir_flag_spec\"
1819 $ECHO " - use the \`$flag' linker flag"
1821 if test -n "$admincmds"; then
1822 $ECHO " - have your system administrator run these commands:$admincmds"
1824 if test -f /etc/ld.so.conf; then
1825 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1829 $ECHO "See any operating system documentation about shared libraries for"
1831 solaris2.[6789]|solaris2.1[0-9])
1832 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1836 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1839 $ECHO "X----------------------------------------------------------------------" | $Xsed
1843 test "$mode" = finish && func_mode_finish ${1+"$@"}
1846 # func_mode_install arg...
1847 func_mode_install ()
1850 # There may be an optional sh(1) argument at the beginning of
1851 # install_prog (especially on Windows NT).
1852 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1853 # Allow the use of GNU shtool's install command.
1854 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
1855 # Aesthetically quote it.
1856 func_quote_for_eval "$nonopt"
1857 install_prog="$func_quote_for_eval_result "
1865 # The real first argument should be the name of the installation program.
1866 # Aesthetically quote it.
1867 func_quote_for_eval "$arg"
1868 install_prog="$install_prog$func_quote_for_eval_result"
1870 # We need to accept at least all the BSD install flags.
1880 if test -n "$dest"; then
1881 files="$files $dest"
1889 case " $install_prog " in
1904 # If the previous option needed an argument, then skip it.
1905 if test -n "$prev"; then
1914 # Aesthetically quote the argument.
1915 func_quote_for_eval "$arg"
1916 install_prog="$install_prog $func_quote_for_eval_result"
1919 test -z "$install_prog" && \
1920 func_fatal_help "you must specify an install program"
1922 test -n "$prev" && \
1923 func_fatal_help "the \`$prev' option requires an argument"
1925 if test -z "$files"; then
1926 if test -z "$dest"; then
1927 func_fatal_help "no file or destination specified"
1929 func_fatal_help "you must specify a destination"
1933 # Strip any trailing slash from the destination.
1934 func_stripname '' '/' "$dest"
1935 dest=$func_stripname_result
1937 # Check to see that the destination is a directory.
1938 test -d "$dest" && isdir=yes
1939 if test "$isdir" = yes; then
1943 func_dirname_and_basename "$dest" "" "."
1944 destdir="$func_dirname_result"
1945 destname="$func_basename_result"
1947 # Not a directory, so check to see that there is only one file specified.
1948 set dummy $files; shift
1949 test "$#" -gt 1 && \
1950 func_fatal_help "\`$dest' is not a directory"
1953 [\\/]* | [A-Za-z]:[\\/]*) ;;
1955 for file in $files; do
1959 func_fatal_help "\`$destdir' must be an absolute directory name"
1966 # This variable tells wrapper scripts just to set variables rather
1967 # than running their programs.
1968 libtool_install_magic="$magic"
1973 for file in $files; do
1975 # Do each installation.
1978 # Do the static libraries later.
1979 staticlibs="$staticlibs $file"
1983 # Check to see that this really is a libtool archive.
1984 func_lalib_unsafe_p "$file" \
1985 || func_fatal_help "\`$file' is not a valid libtool archive"
1992 # Add the libdir to current_libdirs if it is the destination.
1993 if test "X$destdir" = "X$libdir"; then
1994 case "$current_libdirs " in
1996 *) current_libdirs="$current_libdirs $libdir" ;;
1999 # Note the libdir as a future libdir.
2000 case "$future_libdirs " in
2002 *) future_libdirs="$future_libdirs $libdir" ;;
2006 func_dirname "$file" "/" ""
2007 dir="$func_dirname_result"
2010 if test -n "$relink_command"; then
2011 # Determine the prefix the user has applied to our future dir.
2012 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2014 # Don't allow the user to place us outside of our expected
2015 # location b/c this prevents finding dependent libraries that
2016 # are installed to the same prefix.
2017 # At present, this check doesn't affect windows .dll's that
2018 # are installed into $libdir/../bin (currently, that works fine)
2019 # but it's something to keep an eye on.
2020 test "$inst_prefix_dir" = "$destdir" && \
2021 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2023 if test -n "$inst_prefix_dir"; then
2024 # Stick the inst_prefix_dir data into the link command.
2025 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2027 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2030 func_warning "relinking \`$file'"
2031 func_show_eval "$relink_command" \
2032 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2035 # See the names of the shared library.
2036 set dummy $library_names; shift
2037 if test -n "$1"; then
2042 test -n "$relink_command" && srcname="$realname"T
2044 # Install the shared library and build the symlinks.
2045 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2049 cygwin* | mingw* | pw32*)
2057 if test -n "$tstripme" && test -n "$striplib"; then
2058 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2061 if test "$#" -gt 0; then
2062 # Delete the old symlinks, and create new ones.
2063 # Try `ln -sf' first, because the `ln' binary might depend on
2064 # the symlink we replace! Solaris /bin/ln does not understand -f,
2065 # so we also need to try rm && ln -s.
2068 test "$linkname" != "$realname" \
2069 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2073 # Do each command in the postinstall commands.
2074 lib="$destdir/$realname"
2075 func_execute_cmds "$postinstall_cmds" 'exit $?'
2078 # Install the pseudo-library for information purposes.
2079 func_basename "$file"
2080 name="$func_basename_result"
2081 instname="$dir/$name"i
2082 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2084 # Maybe install the static library, too.
2085 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2089 # Install (i.e. copy) a libtool object.
2091 # Figure out destination file name, if it wasn't already specified.
2092 if test -n "$destname"; then
2093 destfile="$destdir/$destname"
2095 func_basename "$file"
2096 destfile="$func_basename_result"
2097 destfile="$destdir/$destfile"
2100 # Deduce the name of the destination old-style object file.
2103 func_lo2o "$destfile"
2104 staticdest=$func_lo2o_result
2107 staticdest="$destfile"
2111 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2115 # Install the libtool object if requested.
2116 test -n "$destfile" && \
2117 func_show_eval "$install_prog $file $destfile" 'exit $?'
2119 # Install the old object if enabled.
2120 if test "$build_old_libs" = yes; then
2121 # Deduce the name of the old-style object file.
2123 staticobj=$func_lo2o_result
2124 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2130 # Figure out destination file name, if it wasn't already specified.
2131 if test -n "$destname"; then
2132 destfile="$destdir/$destname"
2134 func_basename "$file"
2135 destfile="$func_basename_result"
2136 destfile="$destdir/$destfile"
2139 # If the file is missing, and there is a .exe on the end, strip it
2140 # because it is most likely a libtool script we actually want to
2145 if test ! -f "$file"; then
2146 func_stripname '' '.exe' "$file"
2147 file=$func_stripname_result
2153 # Do a test to see if this is really a libtool program.
2156 if func_ltwrapper_executable_p "$file"; then
2157 func_ltwrapper_scriptname "$file"
2158 wrapper=$func_ltwrapper_scriptname_result
2160 func_stripname '' '.exe' "$file"
2161 wrapper=$func_stripname_result
2168 if func_ltwrapper_script_p "$wrapper"; then
2172 func_source "$wrapper"
2174 # Check the variables that should have been set.
2175 test -z "$generated_by_libtool_version" && \
2176 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2179 for lib in $notinst_deplibs; do
2180 # Check to see that each library is installed.
2182 if test -f "$lib"; then
2185 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2186 if test -n "$libdir" && test ! -f "$libfile"; then
2187 func_warning "\`$lib' has not been installed in \`$libdir'"
2193 func_source "$wrapper"
2196 if test "$fast_install" = no && test -n "$relink_command"; then
2198 if test "$finalize" = yes; then
2199 tmpdir=`func_mktempdir`
2200 func_basename "$file$stripped_ext"
2201 file="$func_basename_result"
2202 outputname="$tmpdir/$file"
2203 # Replace the output file specification.
2204 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2207 func_quote_for_expand "$relink_command"
2208 eval "func_echo $func_quote_for_expand_result"
2210 if eval "$relink_command"; then :
2212 func_error "error: relink \`$file' with the above command before installing it"
2213 $opt_dry_run || ${RM}r "$tmpdir"
2218 func_warning "cannot relink \`$file'"
2222 # Install the binary that we compiled earlier.
2223 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2227 # remove .exe since cygwin /usr/bin/install will append another
2229 case $install_prog,$host in
2230 */usr/bin/install*,*cygwin*)
2231 case $file:$destfile in
2236 destfile=$destfile.exe
2239 func_stripname '' '.exe' "$destfile"
2240 destfile=$func_stripname_result
2245 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2246 $opt_dry_run || if test -n "$outputname"; then
2253 for file in $staticlibs; do
2254 func_basename "$file"
2255 name="$func_basename_result"
2257 # Set up the ranlib parameters.
2258 oldlib="$destdir/$name"
2260 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2262 if test -n "$stripme" && test -n "$old_striplib"; then
2263 func_show_eval "$old_striplib $oldlib" 'exit $?'
2266 # Do each command in the postinstall commands.
2267 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2270 test -n "$future_libdirs" && \
2271 func_warning "remember to run \`$progname --finish$future_libdirs'"
2273 if test -n "$current_libdirs"; then
2274 # Maybe just do a dry run.
2275 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2276 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2282 test "$mode" = install && func_mode_install ${1+"$@"}
2285 # func_generate_dlsyms outputname originator pic_p
2286 # Extract symbols from dlprefiles and create ${outputname}S.o with
2287 # a dlpreopen symbol table.
2288 func_generate_dlsyms ()
2294 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2297 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2298 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2299 my_dlsyms="${my_outputname}S.c"
2301 func_error "not configured to extract global symbols from dlpreopened files"
2305 if test -n "$my_dlsyms"; then
2309 # Discover the nlist of each of the dlfiles.
2310 nlist="$output_objdir/${my_outputname}.nm"
2312 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2314 # Parse the name list into a source file.
2315 func_verbose "creating $output_objdir/$my_dlsyms"
2317 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2318 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2319 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2325 /* External symbol declarations for the compiler. */\
2328 if test "$dlself" = yes; then
2329 func_verbose "generating symbol list for \`$output'"
2331 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2333 # Add our own program objects to the symbol list.
2334 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2335 for progfile in $progfiles; do
2336 func_verbose "extracting global C symbols from \`$progfile'"
2337 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2340 if test -n "$exclude_expsyms"; then
2342 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2343 eval '$MV "$nlist"T "$nlist"'
2347 if test -n "$export_symbols_regex"; then
2349 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2350 eval '$MV "$nlist"T "$nlist"'
2354 # Prepare the list of exported symbols
2355 if test -z "$export_symbols"; then
2356 export_symbols="$output_objdir/$outputname.exp"
2359 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2361 *cygwin* | *mingw* )
2362 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2363 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2369 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2370 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2371 eval '$MV "$nlist"T "$nlist"'
2374 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2375 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2382 for dlprefile in $dlprefiles; do
2383 func_verbose "extracting global C symbols from \`$dlprefile'"
2384 func_basename "$dlprefile"
2385 name="$func_basename_result"
2387 eval '$ECHO ": $name " >> "$nlist"'
2388 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2393 # Make sure we have at least an empty file.
2394 test -f "$nlist" || : > "$nlist"
2396 if test -n "$exclude_expsyms"; then
2397 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2398 $MV "$nlist"T "$nlist"
2401 # Try sorting and uniquifying the output.
2402 if $GREP -v "^: " < "$nlist" |
2403 if sort -k 3 </dev/null >/dev/null 2>&1; then
2408 uniq > "$nlist"S; then
2411 $GREP -v "^: " < "$nlist" > "$nlist"S
2414 if test -f "$nlist"S; then
2415 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2417 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2420 $ECHO >> "$output_objdir/$my_dlsyms" "\
2422 /* The mapping between symbol names and symbols. */
2429 *cygwin* | *mingw* )
2430 $ECHO >> "$output_objdir/$my_dlsyms" "\
2431 /* DATA imports from DLLs on WIN32 con't be const, because
2432 runtime relocations are performed -- see ld's documentation
2433 on pseudo-relocs. */"
2436 echo >> "$output_objdir/$my_dlsyms" "\
2437 /* This system does not cope well with relocations in const data */"
2440 lt_dlsym_const=const ;;
2443 $ECHO >> "$output_objdir/$my_dlsyms" "\
2444 extern $lt_dlsym_const lt_dlsymlist
2445 lt_${my_prefix}_LTX_preloaded_symbols[];
2446 $lt_dlsym_const lt_dlsymlist
2447 lt_${my_prefix}_LTX_preloaded_symbols[] =
2449 { \"$my_originator\", (void *) 0 },"
2451 case $need_lib_prefix in
2453 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2456 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2459 $ECHO >> "$output_objdir/$my_dlsyms" "\
2463 /* This works around a problem in FreeBSD linker */
2464 #ifdef FREEBSD_WORKAROUND
2465 static const void *lt_preloaded_setup() {
2466 return lt_${my_prefix}_LTX_preloaded_symbols;
2476 pic_flag_for_symtable=
2477 case "$compile_command " in
2481 # compiling the symbol table file with pic_flag works around
2482 # a FreeBSD bug that causes programs to crash when -lm is
2483 # linked before any other PIC object. But we must not use
2484 # pic_flag when linking with -static. The problem exists in
2485 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2486 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2487 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2489 pic_flag_for_symtable=" $pic_flag" ;;
2491 if test "X$my_pic_p" != Xno; then
2492 pic_flag_for_symtable=" $pic_flag"
2499 for arg in $LTCFLAGS; do
2501 -pie | -fpie | -fPIE) ;;
2502 *) symtab_cflags="$symtab_cflags $arg" ;;
2506 # Now compile the dynamic symbol file.
2507 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2509 # Clean up the generated files.
2510 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2512 # Transform the symbol file into the correct name.
2513 symfileobj="$output_objdir/${my_outputname}S.$objext"
2515 *cygwin* | *mingw* )
2516 if test -f "$output_objdir/$my_outputname.def"; then
2517 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2518 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2520 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2521 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2525 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2526 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2531 func_fatal_error "unknown suffix for \`$my_dlsyms'"
2535 # We keep going just in case the user didn't refer to
2536 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2537 # really was required.
2539 # Nullify the symbol file.
2540 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2541 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2545 # func_win32_libid arg
2546 # return the library type of file 'arg'
2548 # Need a lot of goo to handle *both* DLLs and import libs
2549 # Has to be a shell function in order to 'eat' the argument
2550 # that is supplied when $file_magic_command is called.
2554 win32_libid_type="unknown"
2555 win32_fileres=`file -L $1 2>/dev/null`
2556 case $win32_fileres in
2557 *ar\ archive\ import\ library*) # definitely import
2558 win32_libid_type="x86 archive import"
2560 *ar\ archive*) # could be an import, or static
2561 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2562 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
2563 win32_nmres=`eval $NM -f posix -A $1 |
2572 case $win32_nmres in
2573 import*) win32_libid_type="x86 archive import";;
2574 *) win32_libid_type="x86 archive static";;
2579 win32_libid_type="x86 DLL"
2581 *executable*) # but shell scripts are "executable" too...
2582 case $win32_fileres in
2583 *MS\ Windows\ PE\ Intel*)
2584 win32_libid_type="x86 DLL"
2589 $ECHO "$win32_libid_type"
2594 # func_extract_an_archive dir oldlib
2595 func_extract_an_archive ()
2598 f_ex_an_ar_dir="$1"; shift
2599 f_ex_an_ar_oldlib="$1"
2600 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
2601 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2604 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2609 # func_extract_archives gentop oldlib ...
2610 func_extract_archives ()
2613 my_gentop="$1"; shift
2614 my_oldlibs=${1+"$@"}
2620 for my_xlib in $my_oldlibs; do
2621 # Extract the objects.
2623 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2624 *) my_xabs=`pwd`"/$my_xlib" ;;
2626 func_basename "$my_xlib"
2627 my_xlib="$func_basename_result"
2630 case " $extracted_archives " in
2632 func_arith $extracted_serial + 1
2633 extracted_serial=$func_arith_result
2634 my_xlib_u=lt$extracted_serial-$my_xlib ;;
2638 extracted_archives="$extracted_archives $my_xlib_u"
2639 my_xdir="$my_gentop/$my_xlib_u"
2641 func_mkdir_p "$my_xdir"
2645 func_verbose "Extracting $my_xabs"
2646 # Do not bother doing anything if just a dry run
2648 darwin_orig_dir=`pwd`
2649 cd $my_xdir || exit $?
2650 darwin_archive=$my_xabs
2652 darwin_base_archive=`basename "$darwin_archive"`
2653 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2654 if test -n "$darwin_arches"; then
2655 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2657 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2658 for darwin_arch in $darwin_arches ; do
2659 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2660 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2661 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2662 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2664 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2665 done # $darwin_arches
2666 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
2667 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
2670 for darwin_file in $darwin_filelist; do
2671 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
2672 $LIPO -create -output "$darwin_file" $darwin_files
2673 done # $darwin_filelist
2675 cd "$darwin_orig_dir"
2678 func_extract_an_archive "$my_xdir" "$my_xabs"
2683 func_extract_an_archive "$my_xdir" "$my_xabs"
2686 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2689 func_extract_archives_result="$my_oldobjs"
2694 # func_emit_wrapper arg
2696 # emit a libtool wrapper script on stdout
2697 # don't directly open a file because we may want to
2698 # incorporate the script contents within a cygwin/mingw
2699 # wrapper executable. Must ONLY be called from within
2700 # func_mode_link because it depends on a number of variable
2703 # arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2704 # variable will take. If 'yes', then the emitted script
2705 # will assume that the directory in which it is stored is
2706 # the '.lib' directory. This is a cygwin/mingw-specific
2708 func_emit_wrapper ()
2710 func_emit_wrapper_arg1=no
2711 if test -n "$1" ; then
2712 func_emit_wrapper_arg1=$1
2718 # $output - temporary wrapper script for $objdir/$outputname
2719 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2721 # The $output program cannot be directly executed until all the libtool
2722 # libraries that it depends on are installed.
2724 # This wrapper script should never be moved out of the build directory.
2725 # If it is, it will not operate correctly.
2727 # Sed substitution that helps us do robust quoting. It backslashifies
2728 # metacharacters that are still active within double-quoted strings.
2729 Xsed='${SED} -e 1s/^X//'
2730 sed_quote_subst='$sed_quote_subst'
2732 # Be Bourne compatible
2733 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2736 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2737 # is contrary to our usage. Disable this feature.
2738 alias -g '\${1+\"\$@\"}'='\"\$@\"'
2739 setopt NO_GLOB_SUBST
2741 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2743 BIN_SH=xpg4; export BIN_SH # for Tru64
2744 DUALCASE=1; export DUALCASE # for MKS sh
2746 # The HP-UX ksh and POSIX shell print the target directory to stdout
2748 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2750 relink_command=\"$relink_command\"
2752 # This environment variable determines our operation mode.
2753 if test \"\$libtool_install_magic\" = \"$magic\"; then
2754 # install mode needs the following variables:
2755 generated_by_libtool_version='$macro_version'
2756 notinst_deplibs='$notinst_deplibs'
2758 # When we are sourced in execute mode, \$file and \$ECHO are already set.
2759 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2762 # Make sure echo works.
2763 if test \"X\$1\" = X--no-reexec; then
2764 # Discard the --no-reexec flag, and continue.
2766 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2767 # Yippee, \$ECHO works!
2770 # Restart under the correct shell, and then maybe \$ECHO will work.
2771 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2777 # Find the directory that this script lives in.
2778 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2779 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2781 # Follow symbolic links until we get to the real thisdir.
2782 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2783 while test -n \"\$file\"; do
2784 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2786 # If there was a directory component, then change thisdir.
2787 if test \"x\$destdir\" != \"x\$file\"; then
2788 case \"\$destdir\" in
2789 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2790 *) thisdir=\"\$thisdir/\$destdir\" ;;
2794 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2795 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2798 # Usually 'no', except on cygwin/mingw when embedded into
2800 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
2801 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2802 # special case for '.'
2803 if test \"\$thisdir\" = \".\"; then
2806 # remove .libs from thisdir
2807 case \"\$thisdir\" in
2808 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
2809 $objdir ) thisdir=. ;;
2813 # Try to get the absolute directory name.
2814 absdir=\`cd \"\$thisdir\" && pwd\`
2815 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2818 if test "$fast_install" = yes; then
2820 program=lt-'$outputname'$exeext
2821 progdir=\"\$thisdir/$objdir\"
2823 if test ! -f \"\$progdir/\$program\" ||
2824 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2825 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2827 file=\"\$\$-\$program\"
2829 if test ! -d \"\$progdir\"; then
2830 $MKDIR \"\$progdir\"
2832 $RM \"\$progdir/\$file\"
2837 # relink executable if necessary
2838 if test -n \"\$relink_command\"; then
2839 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2841 $ECHO \"\$relink_command_output\" >&2
2842 $RM \"\$progdir/\$file\"
2847 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2848 { $RM \"\$progdir/\$program\";
2849 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2850 $RM \"\$progdir/\$file\"
2854 program='$outputname'
2855 progdir=\"\$thisdir/$objdir\"
2861 if test -f \"\$progdir/\$program\"; then"
2863 # Export our shlibpath_var if we have one.
2864 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2866 # Add our own library path to $shlibpath_var
2867 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2869 # Some systems cannot cope with colon-terminated $shlibpath_var
2870 # The second colon is a workaround for a bug in BeOS R4 sed
2871 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2873 export $shlibpath_var
2877 # fixup the dll searchpath if we need to.
2878 if test -n "$dllsearchpath"; then
2880 # Add the dll search path components to the executable PATH
2881 PATH=$dllsearchpath:\$PATH
2886 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2887 # Run the actual program with our arguments.
2890 # Backslashes separate directories on plain windows
2891 *-*-mingw | *-*-os2*)
2893 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
2899 exec \"\$progdir/\$program\" \${1+\"\$@\"}
2904 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
2908 # The program doesn't exist.
2909 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
2910 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
2911 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
2917 # end: func_emit_wrapper
2919 # func_emit_cwrapperexe_src
2920 # emit the source code for a wrapper executable on stdout
2921 # Must ONLY be called from within func_mode_link because
2922 # it depends on a number of variable set therein.
2923 func_emit_cwrapperexe_src ()
2927 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
2928 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2930 The $output program cannot be directly executed until all the libtool
2931 libraries that it depends on are installed.
2933 This wrapper executable should never be moved out of the build directory.
2934 If it is, it will not operate correctly.
2936 Currently, it simply execs the wrapper *script* "$SHELL $output",
2937 but could eventually absorb all of the scripts functionality and
2938 exec $objdir/$outputname directly.
2945 # include <direct.h>
2946 # include <process.h>
2948 # define setmode _setmode
2950 # include <unistd.h>
2951 # include <stdint.h>
2963 #include <sys/stat.h>
2965 #if defined(PATH_MAX)
2966 # define LT_PATHMAX PATH_MAX
2967 #elif defined(MAXPATHLEN)
2968 # define LT_PATHMAX MAXPATHLEN
2970 # define LT_PATHMAX 1024
2981 # define S_IXUSR _S_IEXEC
2983 # ifndef _INTPTR_T_DEFINED
2984 # define intptr_t int
2988 #ifndef DIR_SEPARATOR
2989 # define DIR_SEPARATOR '/'
2990 # define PATH_SEPARATOR ':'
2993 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
2995 # define HAVE_DOS_BASED_FILE_SYSTEM
2996 # define FOPEN_WB "wb"
2997 # ifndef DIR_SEPARATOR_2
2998 # define DIR_SEPARATOR_2 '\\'
3000 # ifndef PATH_SEPARATOR_2
3001 # define PATH_SEPARATOR_2 ';'
3005 #ifndef DIR_SEPARATOR_2
3006 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3007 #else /* DIR_SEPARATOR_2 */
3008 # define IS_DIR_SEPARATOR(ch) \
3009 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3010 #endif /* DIR_SEPARATOR_2 */
3012 #ifndef PATH_SEPARATOR_2
3013 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3014 #else /* PATH_SEPARATOR_2 */
3015 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3016 #endif /* PATH_SEPARATOR_2 */
3019 # define FOPEN_WB "wb"
3023 # define FOPEN_WB "w"
3026 # define _O_BINARY 0
3029 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3030 #define XFREE(stale) do { \
3031 if (stale) { free ((void *) stale); stale = 0; } \
3034 #undef LTWRAPPER_DEBUGPRINTF
3035 #if defined DEBUGWRAPPER
3036 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3038 ltwrapper_debugprintf (const char *fmt, ...)
3041 va_start (args, fmt);
3042 (void) vfprintf (stderr, fmt, args);
3046 # define LTWRAPPER_DEBUGPRINTF(args)
3049 const char *program_name = NULL;
3051 void *xmalloc (size_t num);
3052 char *xstrdup (const char *string);
3053 const char *base_name (const char *name);
3054 char *find_executable (const char *wrapper);
3055 char *chase_symlinks (const char *pathspec);
3056 int make_executable (const char *path);
3057 int check_executable (const char *path);
3058 char *strendzap (char *str, const char *pat);
3059 void lt_fatal (const char *message, ...);
3061 static const char *script_text =
3064 func_emit_wrapper yes |
3065 $SED -e 's/\([\\"]\)/\\\1/g' \
3066 -e 's/^/ "/' -e 's/$/\\n"/'
3070 const char * MAGIC_EXE = "$magic_exe";
3073 main (int argc, char *argv[])
3077 char *actual_cwrapper_path;
3078 char *shwrapper_name;
3079 intptr_t rval = 127;
3082 const char *dumpscript_opt = "--lt-dump-script";
3085 program_name = (char *) xstrdup (base_name (argv[0]));
3086 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3087 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3089 /* very simple arg parsing; don't want to rely on getopt */
3090 for (i = 1; i < argc; i++)
3092 if (strcmp (argv[i], dumpscript_opt) == 0)
3096 *mingw* | *cygwin* )
3097 # make stdout use "unix" line endings
3098 echo " setmode(1,_O_BINARY);"
3103 printf ("%s", script_text);
3108 newargz = XMALLOC (char *, argc + 2);
3111 if test -n "$TARGETSHELL" ; then
3112 # no path translation at all
3113 lt_newargv0=$TARGETSHELL
3117 # awkward: cmd appends spaces to result
3118 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3119 lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
3120 case $lt_newargv0 in
3122 *) lt_newargv0=$lt_newargv0.exe ;;
3125 * ) lt_newargv0=$SHELL ;;
3130 newargz[0] = (char *) xstrdup ("$lt_newargv0");
3134 tmp_pathspec = find_executable (argv[0]);
3135 if (tmp_pathspec == NULL)
3136 lt_fatal ("Couldn't find %s", argv[0]);
3137 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3140 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3141 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3142 actual_cwrapper_path));
3143 XFREE (tmp_pathspec);
3145 shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
3146 strendzap (actual_cwrapper_path, shwrapper_name);
3148 /* shwrapper_name transforms */
3149 strendzap (shwrapper_name, ".exe");
3150 tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
3151 strlen ("_ltshwrapperTMP") + 1));
3152 strcpy (tmp_pathspec, shwrapper_name);
3153 strcat (tmp_pathspec, "_ltshwrapperTMP");
3154 XFREE (shwrapper_name);
3155 shwrapper_name = tmp_pathspec;
3157 LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
3163 XMALLOC (char, (strlen (actual_cwrapper_path) +
3164 strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
3165 strcpy (newargz[1], actual_cwrapper_path);
3166 strcat (newargz[1], "$objdir");
3167 strcat (newargz[1], "/");
3168 strcat (newargz[1], shwrapper_name);
3177 while ((p = strchr (newargz[1], '\\')) != NULL)
3187 XFREE (shwrapper_name);
3188 XFREE (actual_cwrapper_path);
3190 /* always write in binary mode */
3191 if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0)
3193 lt_fatal ("Could not open %s for writing", newargz[1]);
3195 fprintf (shwrapper, "%s", script_text);
3198 make_executable (newargz[1]);
3200 for (i = 1; i < argc; i++)
3201 newargz[i + 1] = xstrdup (argv[i]);
3202 newargz[argc + 1] = NULL;
3204 for (i = 0; i < argc + 1; i++)
3206 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, newargz[i]));
3214 /* execv doesn't actually work on mingw as expected on unix */
3215 rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
3218 /* failed to start process */
3219 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
3228 execv ("$lt_newargv0", newargz);
3229 return rval; /* =127, but avoids unused variable warning */
3238 xmalloc (size_t num)
3240 void *p = (void *) malloc (num);
3242 lt_fatal ("Memory exhausted");
3248 xstrdup (const char *string)
3250 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3255 base_name (const char *name)
3259 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3260 /* Skip over the disk name in MSDOS pathnames. */
3261 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3265 for (base = name; *name; name++)
3266 if (IS_DIR_SEPARATOR (*name))
3272 check_executable (const char *path)
3276 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
3277 path ? (*path ? path : "EMPTY!") : "NULL!"));
3278 if ((!path) || (!*path))
3281 if ((stat (path, &st) >= 0)
3282 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3289 make_executable (const char *path)
3294 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
3295 path ? (*path ? path : "EMPTY!") : "NULL!"));
3296 if ((!path) || (!*path))
3299 if (stat (path, &st) >= 0)
3301 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3306 /* Searches for the full path of the wrapper. Returns
3307 newly allocated full path name if found, NULL otherwise
3308 Does not chase symlinks, even on platforms that support them.
3311 find_executable (const char *wrapper)
3316 /* static buffer for getcwd */
3317 char tmp[LT_PATHMAX + 1];
3321 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
3322 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3324 if ((wrapper == NULL) || (*wrapper == '\0'))
3327 /* Absolute path? */
3328 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3329 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3331 concat_name = xstrdup (wrapper);
3332 if (check_executable (concat_name))
3334 XFREE (concat_name);
3339 if (IS_DIR_SEPARATOR (wrapper[0]))
3341 concat_name = xstrdup (wrapper);
3342 if (check_executable (concat_name))
3344 XFREE (concat_name);
3346 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3350 for (p = wrapper; *p; p++)
3358 /* no slashes; search PATH */
3359 const char *path = getenv ("PATH");
3362 for (p = path; *p; p = p_next)
3366 for (q = p; *q; q++)
3367 if (IS_PATH_SEPARATOR (*q))
3370 p_next = (*q == '\0' ? q : q + 1);
3373 /* empty path: current directory */
3374 if (getcwd (tmp, LT_PATHMAX) == NULL)
3375 lt_fatal ("getcwd failed");
3376 tmp_len = strlen (tmp);
3378 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3379 memcpy (concat_name, tmp, tmp_len);
3380 concat_name[tmp_len] = '/';
3381 strcpy (concat_name + tmp_len + 1, wrapper);
3386 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3387 memcpy (concat_name, p, p_len);
3388 concat_name[p_len] = '/';
3389 strcpy (concat_name + p_len + 1, wrapper);
3391 if (check_executable (concat_name))
3393 XFREE (concat_name);
3396 /* not found in PATH; assume curdir */
3398 /* Relative path | not found in path: prepend cwd */
3399 if (getcwd (tmp, LT_PATHMAX) == NULL)
3400 lt_fatal ("getcwd failed");
3401 tmp_len = strlen (tmp);
3402 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3403 memcpy (concat_name, tmp, tmp_len);
3404 concat_name[tmp_len] = '/';
3405 strcpy (concat_name + tmp_len + 1, wrapper);
3407 if (check_executable (concat_name))
3409 XFREE (concat_name);
3414 chase_symlinks (const char *pathspec)
3417 return xstrdup (pathspec);
3419 char buf[LT_PATHMAX];
3421 char *tmp_pathspec = xstrdup (pathspec);
3423 int has_symlinks = 0;
3424 while (strlen (tmp_pathspec) && !has_symlinks)
3426 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3428 if (lstat (tmp_pathspec, &s) == 0)
3430 if (S_ISLNK (s.st_mode) != 0)
3436 /* search backwards for last DIR_SEPARATOR */
3437 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3438 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3440 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3442 /* no more DIR_SEPARATORS left */
3449 char *errstr = strerror (errno);
3450 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3453 XFREE (tmp_pathspec);
3457 return xstrdup (pathspec);
3460 tmp_pathspec = realpath (pathspec, buf);
3461 if (tmp_pathspec == 0)
3463 lt_fatal ("Could not follow symlinks for %s", pathspec);
3465 return xstrdup (tmp_pathspec);
3470 strendzap (char *str, const char *pat)
3474 assert (str != NULL);
3475 assert (pat != NULL);
3478 patlen = strlen (pat);
3482 str += len - patlen;
3483 if (strcmp (str, pat) == 0)
3490 lt_error_core (int exit_status, const char *mode,
3491 const char *message, va_list ap)
3493 fprintf (stderr, "%s: %s: ", program_name, mode);
3494 vfprintf (stderr, message, ap);
3495 fprintf (stderr, ".\n");
3497 if (exit_status >= 0)
3502 lt_fatal (const char *message, ...)
3505 va_start (ap, message);
3506 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
3511 # end: func_emit_cwrapperexe_src
3513 # func_mode_link arg...
3518 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3519 # It is impossible to link a dll without this setting, and
3520 # we shouldn't force the makefile maintainer to figure out
3521 # which system we are compiling for in order to pass an extra
3522 # flag for every libtool invocation.
3523 # allow_undefined=no
3525 # FIXME: Unfortunately, there are problems with the above when trying
3526 # to make a dll which has undefined symbols, in which case not
3527 # even a static library is built. For now, we need to specify
3528 # -no-undefined on the libtool link line when we can be certain
3529 # that all symbols are satisfied, otherwise we get a static library.
3536 libtool_args=$nonopt
3537 base_compile="$nonopt $@"
3538 compile_command=$nonopt
3539 finalize_command=$nonopt
3552 lib_search_path=`pwd`
3554 new_inherited_linker_flags=
3562 export_symbols_regex=
3570 precious_files_regex=
3571 prefer_static_libs=no
3584 single_module="${wl}-single_module"
3585 func_infer_tag $base_compile
3587 # We need to know -static, to get the right output filenames.
3592 test "$build_libtool_libs" != yes && \
3593 func_fatal_configuration "can not build a shared library"
3597 -all-static | -static | -static-libtool-libs)
3600 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
3601 func_warning "complete static linking is impossible in this configuration"
3603 if test -n "$link_static_flag"; then
3604 dlopen_self=$dlopen_self_static
3606 prefer_static_libs=yes
3609 if test -z "$pic_flag" && test -n "$link_static_flag"; then
3610 dlopen_self=$dlopen_self_static
3612 prefer_static_libs=built
3614 -static-libtool-libs)
3615 if test -z "$pic_flag" && test -n "$link_static_flag"; then
3616 dlopen_self=$dlopen_self_static
3618 prefer_static_libs=yes
3621 build_libtool_libs=no
3628 # See if our shared archives depend on static archives.
3629 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
3631 # Go through the arguments, transforming them on the way.
3632 while test "$#" -gt 0; do
3635 func_quote_for_eval "$arg"
3636 qarg=$func_quote_for_eval_unquoted_result
3637 func_append libtool_args " $func_quote_for_eval_result"
3639 # If the previous option needs an argument, assign it.
3640 if test -n "$prev"; then
3643 func_append compile_command " @OUTPUT@"
3644 func_append finalize_command " @OUTPUT@"
3650 if test "$preload" = no; then
3651 # Add the symbol object into the linking commands.
3652 func_append compile_command " @SYMFILE@"
3653 func_append finalize_command " @SYMFILE@"
3657 *.la | *.lo) ;; # We handle these cases below.
3659 if test "$dlself" = no; then
3667 if test "$prev" = dlprefiles; then
3669 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
3679 if test "$prev" = dlfiles; then
3680 dlfiles="$dlfiles $arg"
3682 dlprefiles="$dlprefiles $arg"
3690 export_symbols="$arg"
3692 || func_fatal_error "symbol file \`$arg' does not exist"
3697 export_symbols_regex="$arg"
3705 *" $qarg.ltframework "*) ;;
3706 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
3715 inst_prefix_dir="$arg"
3720 if test -f "$arg"; then
3723 for fil in `cat "$save_arg"`
3725 # moreargs="$moreargs $fil"
3727 # A libtool-controlled object.
3729 # Check to see that this really is a libtool object.
3730 if func_lalib_unsafe_p "$arg"; then
3737 if test -z "$pic_object" ||
3738 test -z "$non_pic_object" ||
3739 test "$pic_object" = none &&
3740 test "$non_pic_object" = none; then
3741 func_fatal_error "cannot find name of object for \`$arg'"
3744 # Extract subdirectory from the argument.
3745 func_dirname "$arg" "/" ""
3746 xdir="$func_dirname_result"
3748 if test "$pic_object" != none; then
3749 # Prepend the subdirectory the object is found in.
3750 pic_object="$xdir$pic_object"
3752 if test "$prev" = dlfiles; then
3753 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
3754 dlfiles="$dlfiles $pic_object"
3758 # If libtool objects are unsupported, then we need to preload.
3763 # CHECK ME: I think I busted this. -Ossama
3764 if test "$prev" = dlprefiles; then
3765 # Preload the old-style object.
3766 dlprefiles="$dlprefiles $pic_object"
3771 func_append libobjs " $pic_object"
3776 if test "$non_pic_object" != none; then
3777 # Prepend the subdirectory the object is found in.
3778 non_pic_object="$xdir$non_pic_object"
3780 # A standard non-PIC object
3781 func_append non_pic_objects " $non_pic_object"
3782 if test -z "$pic_object" || test "$pic_object" = none ; then
3783 arg="$non_pic_object"
3786 # If the PIC object exists, use it instead.
3787 # $xdir was prepended to $pic_object above.
3788 non_pic_object="$pic_object"
3789 func_append non_pic_objects " $non_pic_object"
3792 # Only an error if not doing a dry-run.
3793 if $opt_dry_run; then
3794 # Extract subdirectory from the argument.
3795 func_dirname "$arg" "/" ""
3796 xdir="$func_dirname_result"
3799 pic_object=$xdir$objdir/$func_lo2o_result
3800 non_pic_object=$xdir$func_lo2o_result
3801 func_append libobjs " $pic_object"
3802 func_append non_pic_objects " $non_pic_object"
3804 func_fatal_error "\`$arg' is not a valid libtool object"
3809 func_fatal_error "link input file \`$arg' does not exist"
3816 precious_files_regex="$arg"
3826 # We need an absolute path.
3828 [\\/]* | [A-Za-z]:[\\/]*) ;;
3830 func_fatal_error "only absolute run-paths are allowed"
3833 if test "$prev" = rpath; then
3836 *) rpath="$rpath $arg" ;;
3841 *) xrpath="$xrpath $arg" ;;
3853 weak_libs="$weak_libs $arg"
3858 linker_flags="$linker_flags $qarg"
3859 compiler_flags="$compiler_flags $qarg"
3861 func_append compile_command " $qarg"
3862 func_append finalize_command " $qarg"
3866 compiler_flags="$compiler_flags $qarg"
3868 func_append compile_command " $qarg"
3869 func_append finalize_command " $qarg"
3873 linker_flags="$linker_flags $qarg"
3874 compiler_flags="$compiler_flags $wl$qarg"
3876 func_append compile_command " $wl$qarg"
3877 func_append finalize_command " $wl$qarg"
3881 eval "$prev=\"\$arg\""
3886 fi # test -n "$prev"
3892 if test -n "$link_static_flag"; then
3893 # See comment for -static flag below, for more details.
3894 func_append compile_command " $link_static_flag"
3895 func_append finalize_command " $link_static_flag"
3901 # FIXME: remove this flag sometime in the future.
3902 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
3925 -export-symbols | -export-symbols-regex)
3926 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3927 func_fatal_error "more than one -exported-symbols argument is not allowed"
3929 if test "X$arg" = "X-export-symbols"; then
3947 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
3948 # so, if we see these flags be careful not to treat them like -L
3950 case $with_gcc/$host in
3951 no/*-*-irix* | /*-*-irix*)
3952 func_append compile_command " $arg"
3953 func_append finalize_command " $arg"
3960 func_stripname '-L' '' "$arg"
3961 dir=$func_stripname_result
3962 # We need an absolute path.
3964 [\\/]* | [A-Za-z]:[\\/]*) ;;
3966 absdir=`cd "$dir" && pwd`
3967 test -z "$absdir" && \
3968 func_fatal_error "cannot determine absolute directory name of \`$dir'"
3975 deplibs="$deplibs -L$dir"
3976 lib_search_path="$lib_search_path $dir"
3980 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3981 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
3982 case :$dllsearchpath: in
3984 *) dllsearchpath="$dllsearchpath:$dir";;
3986 case :$dllsearchpath: in
3987 *":$testbindir:"*) ;;
3988 *) dllsearchpath="$dllsearchpath:$testbindir";;
3996 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
3998 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
3999 # These systems don't actually have a C or math library (as such)
4003 # These systems don't actually have a C library (as such)
4004 test "X$arg" = "X-lc" && continue
4006 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4007 # Do not include libc due to us having libc/libc_r.
4008 test "X$arg" = "X-lc" && continue
4010 *-*-rhapsody* | *-*-darwin1.[012])
4011 # Rhapsody C and math libraries are in the System framework
4012 deplibs="$deplibs System.ltframework"
4015 *-*-sco3.2v5* | *-*-sco5v6*)
4016 # Causes problems with __ctype
4017 test "X$arg" = "X-lc" && continue
4019 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
4020 # Compiler inserts libc in the correct place for threads to work
4021 test "X$arg" = "X-lc" && continue
4024 elif test "X$arg" = "X-lc_r"; then
4026 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4027 # Do not include libc_r directly, use -pthread flag.
4032 deplibs="$deplibs $arg"
4041 # Tru64 UNIX uses -model [arg] to determine the layout of C++
4042 # classes, name mangling, and exception handling.
4043 # Darwin uses the -arch flag to determine output architecture.
4044 -model|-arch|-isysroot)
4045 compiler_flags="$compiler_flags $arg"
4046 func_append compile_command " $arg"
4047 func_append finalize_command " $arg"
4052 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4053 compiler_flags="$compiler_flags $arg"
4054 func_append compile_command " $arg"
4055 func_append finalize_command " $arg"
4056 case "$new_inherited_linker_flags " in
4058 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
4064 single_module="${wl}-multi_module"
4075 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
4076 # The PATH hackery in wrapper scripts is required on Windows
4077 # and Darwin in order for the loader to find any dlls it needs.
4078 func_warning "\`-no-install' is ignored for $host"
4079 func_warning "assuming \`-no-fast-install' instead"
4082 *) no_install=yes ;;
4099 -precious-files-regex)
4120 func_stripname '-R' '' "$arg"
4121 dir=$func_stripname_result
4122 # We need an absolute path.
4124 [\\/]* | [A-Za-z]:[\\/]*) ;;
4126 func_fatal_error "only absolute run-paths are allowed"
4131 *) xrpath="$xrpath $dir" ;;
4137 # The effects of -shared are defined in a previous loop.
4146 -static | -static-libtool-libs)
4147 # The effects of -static are defined in a previous loop.
4148 # We used to do the same as -all-static on platforms that
4149 # didn't have a PIC flag, but the assumption that the effects
4150 # would be equivalent was wrong. It would break on at least
4151 # Digital Unix and AIX.
4177 func_stripname '-Wc,' '' "$arg"
4178 args=$func_stripname_result
4180 save_ifs="$IFS"; IFS=','
4181 for flag in $args; do
4183 func_quote_for_eval "$flag"
4184 arg="$arg $wl$func_quote_for_eval_result"
4185 compiler_flags="$compiler_flags $func_quote_for_eval_result"
4188 func_stripname ' ' '' "$arg"
4189 arg=$func_stripname_result
4193 deplibs="$deplibs $arg"
4198 deplibs="$deplibs $arg"
4203 func_stripname '-Wl,' '' "$arg"
4204 args=$func_stripname_result
4206 save_ifs="$IFS"; IFS=','
4207 for flag in $args; do
4209 func_quote_for_eval "$flag"
4210 arg="$arg $wl$func_quote_for_eval_result"
4211 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
4212 linker_flags="$linker_flags $func_quote_for_eval_result"
4215 func_stripname ' ' '' "$arg"
4216 arg=$func_stripname_result
4236 func_quote_for_eval "$arg"
4237 arg="$func_quote_for_eval_result"
4240 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
4241 # -r[0-9][0-9]* specifies the processor on the SGI compiler
4242 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
4243 # +DA*, +DD* enable 64-bit mode on the HP compiler
4244 # -q* pass through compiler args for the IBM compiler
4245 # -m*, -t[45]*, -txscale* pass through architecture-specific
4246 # compiler args for GCC
4247 # -F/path gives path to uninstalled frameworks, gcc on darwin
4248 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
4249 # @file GCC response files
4250 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
4251 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
4252 func_quote_for_eval "$arg"
4253 arg="$func_quote_for_eval_result"
4254 func_append compile_command " $arg"
4255 func_append finalize_command " $arg"
4256 compiler_flags="$compiler_flags $arg"
4260 # Some other compiler flag.
4262 func_quote_for_eval "$arg"
4263 arg="$func_quote_for_eval_result"
4267 # A standard object.
4272 # A libtool-controlled object.
4274 # Check to see that this really is a libtool object.
4275 if func_lalib_unsafe_p "$arg"; then
4282 if test -z "$pic_object" ||
4283 test -z "$non_pic_object" ||
4284 test "$pic_object" = none &&
4285 test "$non_pic_object" = none; then
4286 func_fatal_error "cannot find name of object for \`$arg'"
4289 # Extract subdirectory from the argument.
4290 func_dirname "$arg" "/" ""
4291 xdir="$func_dirname_result"
4293 if test "$pic_object" != none; then
4294 # Prepend the subdirectory the object is found in.
4295 pic_object="$xdir$pic_object"
4297 if test "$prev" = dlfiles; then
4298 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4299 dlfiles="$dlfiles $pic_object"
4303 # If libtool objects are unsupported, then we need to preload.
4308 # CHECK ME: I think I busted this. -Ossama
4309 if test "$prev" = dlprefiles; then
4310 # Preload the old-style object.
4311 dlprefiles="$dlprefiles $pic_object"
4316 func_append libobjs " $pic_object"
4321 if test "$non_pic_object" != none; then
4322 # Prepend the subdirectory the object is found in.
4323 non_pic_object="$xdir$non_pic_object"
4325 # A standard non-PIC object
4326 func_append non_pic_objects " $non_pic_object"
4327 if test -z "$pic_object" || test "$pic_object" = none ; then
4328 arg="$non_pic_object"
4331 # If the PIC object exists, use it instead.
4332 # $xdir was prepended to $pic_object above.
4333 non_pic_object="$pic_object"
4334 func_append non_pic_objects " $non_pic_object"
4337 # Only an error if not doing a dry-run.
4338 if $opt_dry_run; then
4339 # Extract subdirectory from the argument.
4340 func_dirname "$arg" "/" ""
4341 xdir="$func_dirname_result"
4344 pic_object=$xdir$objdir/$func_lo2o_result
4345 non_pic_object=$xdir$func_lo2o_result
4346 func_append libobjs " $pic_object"
4347 func_append non_pic_objects " $non_pic_object"
4349 func_fatal_error "\`$arg' is not a valid libtool object"
4356 deplibs="$deplibs $arg"
4357 old_deplibs="$old_deplibs $arg"
4362 # A libtool-controlled library.
4364 if test "$prev" = dlfiles; then
4365 # This library was specified with -dlopen.
4366 dlfiles="$dlfiles $arg"
4368 elif test "$prev" = dlprefiles; then
4369 # The library was specified with -dlpreopen.
4370 dlprefiles="$dlprefiles $arg"
4373 deplibs="$deplibs $arg"
4378 # Some other compiler argument.
4380 # Unknown arguments in both finalize_command and compile_command need
4381 # to be aesthetically quoted because they are evaled later.
4382 func_quote_for_eval "$arg"
4383 arg="$func_quote_for_eval_result"
4387 # Now actually substitute the argument into the commands.
4388 if test -n "$arg"; then
4389 func_append compile_command " $arg"
4390 func_append finalize_command " $arg"
4392 done # argument parsing loop
4394 test -n "$prev" && \
4395 func_fatal_help "the \`$prevarg' option requires an argument"
4397 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
4398 eval arg=\"$export_dynamic_flag_spec\"
4399 func_append compile_command " $arg"
4400 func_append finalize_command " $arg"
4404 # calculate the name of the file, without its directory
4405 func_basename "$output"
4406 outputname="$func_basename_result"
4407 libobjs_save="$libobjs"
4409 if test -n "$shlibpath_var"; then
4410 # get the directories listed in $shlibpath_var
4411 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
4415 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
4416 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
4418 func_dirname "$output" "/" ""
4419 output_objdir="$func_dirname_result$objdir"
4420 # Create the object directory.
4421 func_mkdir_p "$output_objdir"
4423 # Determine the type of output
4426 func_fatal_help "you must specify an output file"
4428 *.$libext) linkmode=oldlib ;;
4429 *.lo | *.$objext) linkmode=obj ;;
4430 *.la) linkmode=lib ;;
4431 *) linkmode=prog ;; # Anything else should be a program.
4437 # Find all interdependent deplibs by searching for libraries
4438 # that are linked more than once (e.g. -la -lb -la)
4439 for deplib in $deplibs; do
4440 if $opt_duplicate_deps ; then
4442 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4445 libs="$libs $deplib"
4448 if test "$linkmode" = lib; then
4449 libs="$predeps $libs $compiler_lib_search_path $postdeps"
4451 # Compute libraries that are listed more than once in $predeps
4452 # $postdeps and mark them as special (i.e., whose duplicates are
4453 # not to be eliminated).
4455 if $opt_duplicate_compiler_generated_deps; then
4456 for pre_post_dep in $predeps $postdeps; do
4457 case "$pre_post_deps " in
4458 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
4460 pre_post_deps="$pre_post_deps $pre_post_dep"
4469 need_relink=no # whether we're linking any uninstalled libtool libraries
4470 notinst_deplibs= # not-installed libtool libraries
4471 notinst_path= # paths that contain not-installed libtool libraries
4475 passes="conv dlpreopen link"
4476 for file in $dlfiles $dlprefiles; do
4480 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
4491 passes="conv scan dlopen dlpreopen link"
4497 for pass in $passes; do
4498 # The preopen pass in lib mode reverses $deplibs; put it back here
4499 # so that -L comes before libs that need it for instance...
4500 if test "$linkmode,$pass" = "lib,link"; then
4501 ## FIXME: Find the place where the list is rebuilt in the wrong
4502 ## order, and fix it there properly
4504 for deplib in $deplibs; do
4505 tmp_deplibs="$deplib $tmp_deplibs"
4507 deplibs="$tmp_deplibs"
4510 if test "$linkmode,$pass" = "lib,link" ||
4511 test "$linkmode,$pass" = "prog,scan"; then
4515 if test "$linkmode" = prog; then
4517 dlopen) libs="$dlfiles" ;;
4518 dlpreopen) libs="$dlprefiles" ;;
4519 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
4522 if test "$linkmode,$pass" = "lib,dlpreopen"; then
4523 # Collect and forward deplibs of preopened libtool libs
4524 for lib in $dlprefiles; do
4525 # Ignore non-libtool-libs
4528 *.la) func_source "$lib" ;;
4531 # Collect preopened libtool deplibs, except any this library
4532 # has declared as weak libs
4533 for deplib in $dependency_libs; do
4534 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
4535 case " $weak_libs " in
4536 *" $deplib_base "*) ;;
4537 *) deplibs="$deplibs $deplib" ;;
4543 if test "$pass" = dlopen; then
4544 # Collect dlpreopened libraries
4545 save_deplibs="$deplibs"
4549 for deplib in $libs; do
4554 if test "$linkmode,$pass" = "prog,link"; then
4555 compile_deplibs="$deplib $compile_deplibs"
4556 finalize_deplibs="$deplib $finalize_deplibs"
4558 deplibs="$deplib $deplibs"
4562 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4563 if test "$linkmode,$pass" = "prog,link"; then
4564 compile_deplibs="$deplib $compile_deplibs"
4565 finalize_deplibs="$deplib $finalize_deplibs"
4567 compiler_flags="$compiler_flags $deplib"
4568 if test "$linkmode" = lib ; then
4569 case "$new_inherited_linker_flags " in
4571 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
4578 if test "$linkmode" != lib && test "$linkmode" != prog; then
4579 func_warning "\`-l' is ignored for archives/objects"
4582 func_stripname '-l' '' "$deplib"
4583 name=$func_stripname_result
4584 if test "$linkmode" = lib; then
4585 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
4587 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
4589 for searchdir in $searchdirs; do
4590 for search_ext in .la $std_shrext .so .a; do
4591 # Search the libtool library
4592 lib="$searchdir/lib${name}${search_ext}"
4593 if test -f "$lib"; then
4594 if test "$search_ext" = ".la"; then
4603 if test "$found" != yes; then
4604 # deplib doesn't seem to be a libtool library
4605 if test "$linkmode,$pass" = "prog,link"; then
4606 compile_deplibs="$deplib $compile_deplibs"
4607 finalize_deplibs="$deplib $finalize_deplibs"
4609 deplibs="$deplib $deplibs"
4610 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
4613 else # deplib is a libtool library
4614 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
4615 # We need to do some special things here, and not later.
4616 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
4617 case " $predeps $postdeps " in
4619 if func_lalib_p "$lib"; then
4623 for l in $old_library $library_names; do
4626 if test "X$ll" = "X$old_library" ; then # only static version available
4628 func_dirname "$lib" "" "."
4629 ladir="$func_dirname_result"
4630 lib=$ladir/$old_library
4631 if test "$linkmode,$pass" = "prog,link"; then
4632 compile_deplibs="$deplib $compile_deplibs"
4633 finalize_deplibs="$deplib $finalize_deplibs"
4635 deplibs="$deplib $deplibs"
4636 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
4648 if test "$linkmode,$pass" = "prog,link"; then
4649 compile_deplibs="$deplib $compile_deplibs"
4650 finalize_deplibs="$deplib $finalize_deplibs"
4652 deplibs="$deplib $deplibs"
4653 if test "$linkmode" = lib ; then
4654 case "$new_inherited_linker_flags " in
4656 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
4665 deplibs="$deplib $deplibs"
4666 test "$pass" = conv && continue
4667 newdependency_libs="$deplib $newdependency_libs"
4668 func_stripname '-L' '' "$deplib"
4669 newlib_search_path="$newlib_search_path $func_stripname_result"
4672 if test "$pass" = conv; then
4673 deplibs="$deplib $deplibs"
4676 if test "$pass" = scan; then
4677 deplibs="$deplib $deplibs"
4679 compile_deplibs="$deplib $compile_deplibs"
4680 finalize_deplibs="$deplib $finalize_deplibs"
4682 func_stripname '-L' '' "$deplib"
4683 newlib_search_path="$newlib_search_path $func_stripname_result"
4686 func_warning "\`-L' is ignored for archives/objects"
4692 if test "$pass" = link; then
4693 func_stripname '-R' '' "$deplib"
4694 dir=$func_stripname_result
4695 # Make sure the xrpath contains only unique directories.
4698 *) xrpath="$xrpath $dir" ;;
4701 deplibs="$deplib $deplibs"
4704 *.la) lib="$deplib" ;;
4706 if test "$pass" = conv; then
4707 deplibs="$deplib $deplibs"
4712 # Linking convenience modules into shared libraries is allowed,
4713 # but linking other static libraries is non-portable.
4714 case " $dlpreconveniencelibs " in
4718 case $deplibs_check_method in
4720 set dummy $deplibs_check_method; shift
4721 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
4722 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
4723 | $EGREP "$match_pattern_regex" > /dev/null; then
4731 if test "$valid_a_lib" != yes; then
4733 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
4734 $ECHO "*** I have the capability to make that library automatically link in when"
4735 $ECHO "*** you link to this library. But I can only do this if you have a"
4736 $ECHO "*** shared version of the library, which you do not appear to have"
4737 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
4738 $ECHO "*** that it is just a static archive that I should not use here."
4741 $ECHO "*** Warning: Linking the shared library $output against the"
4742 $ECHO "*** static library $deplib is not portable!"
4743 deplibs="$deplib $deplibs"
4750 if test "$pass" != link; then
4751 deplibs="$deplib $deplibs"
4753 compile_deplibs="$deplib $compile_deplibs"
4754 finalize_deplibs="$deplib $finalize_deplibs"
4761 if test "$pass" = conv; then
4762 deplibs="$deplib $deplibs"
4763 elif test "$linkmode" = prog; then
4764 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
4765 # If there is no dlopen support or we're linking statically,
4766 # we need to preload.
4767 newdlprefiles="$newdlprefiles $deplib"
4768 compile_deplibs="$deplib $compile_deplibs"
4769 finalize_deplibs="$deplib $finalize_deplibs"
4771 newdlfiles="$newdlfiles $deplib"
4782 if test "$found" = yes || test -f "$lib"; then :
4784 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
4787 # Check to see that this really is a libtool archive.
4788 func_lalib_unsafe_p "$lib" \
4789 || func_fatal_error "\`$lib' is not a valid libtool archive"
4791 func_dirname "$lib" "" "."
4792 ladir="$func_dirname_result"
4800 inherited_linker_flags=
4801 # If the library was installed with an old release of libtool,
4802 # it will not redefine variables installed, or shouldnotlink
4811 # Convert "-framework foo" to "foo.ltframework"
4812 if test -n "$inherited_linker_flags"; then
4813 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
4814 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
4815 case " $new_inherited_linker_flags " in
4816 *" $tmp_inherited_linker_flag "*) ;;
4817 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
4821 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
4822 if test "$linkmode,$pass" = "lib,link" ||
4823 test "$linkmode,$pass" = "prog,scan" ||
4824 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
4825 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
4826 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
4829 if test "$pass" = conv; then
4830 # Only check for convenience libraries
4831 deplibs="$lib $deplibs"
4832 if test -z "$libdir"; then
4833 if test -z "$old_library"; then
4834 func_fatal_error "cannot find name of link library for \`$lib'"
4836 # It is a libtool convenience library, so add in its objects.
4837 convenience="$convenience $ladir/$objdir/$old_library"
4838 old_convenience="$old_convenience $ladir/$objdir/$old_library"
4839 elif test "$linkmode" != prog && test "$linkmode" != lib; then
4840 func_fatal_error "\`$lib' is not a convenience library"
4843 for deplib in $dependency_libs; do
4844 deplibs="$deplib $deplibs"
4845 if $opt_duplicate_deps ; then
4846 case "$tmp_libs " in
4847 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4850 tmp_libs="$tmp_libs $deplib"
4856 # Get the name of the library we link against.
4858 for l in $old_library $library_names; do
4861 if test -z "$linklib"; then
4862 func_fatal_error "cannot find name of link library for \`$lib'"
4865 # This library was specified with -dlopen.
4866 if test "$pass" = dlopen; then
4867 if test -z "$libdir"; then
4868 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
4870 if test -z "$dlname" ||
4871 test "$dlopen_support" != yes ||
4872 test "$build_libtool_libs" = no; then
4873 # If there is no dlname, no dlopen support or we're linking
4874 # statically, we need to preload. We also need to preload any
4875 # dependent libraries so libltdl's deplib preloader doesn't
4876 # bomb out in the load deplibs phase.
4877 dlprefiles="$dlprefiles $lib $dependency_libs"
4879 newdlfiles="$newdlfiles $lib"
4884 # We need an absolute path.
4886 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
4888 abs_ladir=`cd "$ladir" && pwd`
4889 if test -z "$abs_ladir"; then
4890 func_warning "cannot determine absolute directory name of \`$ladir'"
4891 func_warning "passing it literally to the linker, although it might fail"
4896 func_basename "$lib"
4897 laname="$func_basename_result"
4899 # Find the relevant object directory and library name.
4900 if test "X$installed" = Xyes; then
4901 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
4902 func_warning "library \`$lib' was moved."
4910 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
4912 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
4915 # Remove this search path later
4916 notinst_path="$notinst_path $abs_ladir"
4918 dir="$ladir/$objdir"
4919 absdir="$abs_ladir/$objdir"
4920 # Remove this search path later
4921 notinst_path="$notinst_path $abs_ladir"
4923 fi # $installed = yes
4924 func_stripname 'lib' '.la' "$laname"
4925 name=$func_stripname_result
4927 # This library was specified with -dlpreopen.
4928 if test "$pass" = dlpreopen; then
4929 if test -z "$libdir" && test "$linkmode" = prog; then
4930 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
4932 # Prefer using a static library (so that no silly _DYNAMIC symbols
4933 # are required to link).
4934 if test -n "$old_library"; then
4935 newdlprefiles="$newdlprefiles $dir/$old_library"
4936 # Keep a list of preopened convenience libraries to check
4937 # that they are being used correctly in the link pass.
4938 test -z "$libdir" && \
4939 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
4940 # Otherwise, use the dlname, so that lt_dlopen finds it.
4941 elif test -n "$dlname"; then
4942 newdlprefiles="$newdlprefiles $dir/$dlname"
4944 newdlprefiles="$newdlprefiles $dir/$linklib"
4946 fi # $pass = dlpreopen
4948 if test -z "$libdir"; then
4949 # Link the convenience library
4950 if test "$linkmode" = lib; then
4951 deplibs="$dir/$old_library $deplibs"
4952 elif test "$linkmode,$pass" = "prog,link"; then
4953 compile_deplibs="$dir/$old_library $compile_deplibs"
4954 finalize_deplibs="$dir/$old_library $finalize_deplibs"
4956 deplibs="$lib $deplibs" # used for prog,scan pass
4962 if test "$linkmode" = prog && test "$pass" != link; then
4963 newlib_search_path="$newlib_search_path $ladir"
4964 deplibs="$lib $deplibs"
4967 if test "$link_all_deplibs" != no || test -z "$library_names" ||
4968 test "$build_libtool_libs" = no; then
4973 for deplib in $dependency_libs; do
4975 -L*) func_stripname '-L' '' "$deplib"
4976 newlib_search_path="$newlib_search_path $func_stripname_result"
4979 # Need to link against all dependency_libs?
4980 if test "$linkalldeplibs" = yes; then
4981 deplibs="$deplib $deplibs"
4983 # Need to hardcode shared library paths
4984 # or/and link against static libraries
4985 newdependency_libs="$deplib $newdependency_libs"
4987 if $opt_duplicate_deps ; then
4988 case "$tmp_libs " in
4989 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4992 tmp_libs="$tmp_libs $deplib"
4995 fi # $linkmode = prog...
4997 if test "$linkmode,$pass" = "prog,link"; then
4998 if test -n "$library_names" &&
4999 { { test "$prefer_static_libs" = no ||
5000 test "$prefer_static_libs,$installed" = "built,yes"; } ||
5001 test -z "$old_library"; }; then
5002 # We need to hardcode the library path
5003 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
5004 # Make sure the rpath contains only unique directories.
5005 case "$temp_rpath:" in
5007 *) temp_rpath="$temp_rpath$absdir:" ;;
5011 # Hardcode the library path.
5012 # Skip directories that are in the system default run-time
5014 case " $sys_lib_dlsearch_path " in
5017 case "$compile_rpath " in
5019 *) compile_rpath="$compile_rpath $absdir"
5023 case " $sys_lib_dlsearch_path " in
5026 case "$finalize_rpath " in
5028 *) finalize_rpath="$finalize_rpath $libdir"
5032 fi # $linkmode,$pass = prog,link...
5034 if test "$alldeplibs" = yes &&
5035 { test "$deplibs_check_method" = pass_all ||
5036 { test "$build_libtool_libs" = yes &&
5037 test -n "$library_names"; }; }; then
5038 # We only need to search for static libraries
5043 link_static=no # Whether the deplib will be linked statically
5044 use_static_libs=$prefer_static_libs
5045 if test "$use_static_libs" = built && test "$installed" = yes; then
5048 if test -n "$library_names" &&
5049 { test "$use_static_libs" = no || test -z "$old_library"; }; then
5052 # No point in relinking DLLs because paths are not encoded
5053 notinst_deplibs="$notinst_deplibs $lib"
5057 if test "$installed" = no; then
5058 notinst_deplibs="$notinst_deplibs $lib"
5063 # This is a shared library
5065 # Warn about portability, can't link against -module's on some
5066 # systems (darwin). Don't bleat about dlopened modules though!
5068 for dlpremoduletest in $dlprefiles; do
5069 if test "X$dlpremoduletest" = "X$lib"; then
5070 dlopenmodule="$dlpremoduletest"
5074 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
5076 if test "$linkmode" = prog; then
5077 $ECHO "*** Warning: Linking the executable $output against the loadable module"
5079 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
5081 $ECHO "*** $linklib is not portable!"
5083 if test "$linkmode" = lib &&
5084 test "$hardcode_into_libs" = yes; then
5085 # Hardcode the library path.
5086 # Skip directories that are in the system default run-time
5088 case " $sys_lib_dlsearch_path " in
5091 case "$compile_rpath " in
5093 *) compile_rpath="$compile_rpath $absdir"
5097 case " $sys_lib_dlsearch_path " in
5100 case "$finalize_rpath " in
5102 *) finalize_rpath="$finalize_rpath $libdir"
5108 if test -n "$old_archive_from_expsyms_cmds"; then
5109 # figure out the soname
5110 set dummy $library_names
5114 libname=`eval "\\$ECHO \"$libname_spec\""`
5115 # use dlname if we got it. it's perfectly good, no?
5116 if test -n "$dlname"; then
5118 elif test -n "$soname_spec"; then
5122 func_arith $current - $age
5123 major=$func_arith_result
5127 eval soname=\"$soname_spec\"
5132 # Make a new name for the extract_expsyms_cmds to use
5134 func_basename "$soroot"
5135 soname="$func_basename_result"
5136 func_stripname 'lib' '.dll' "$soname"
5137 newlib=libimp-$func_stripname_result.a
5139 # If the library has no export list, then create one now
5140 if test -f "$output_objdir/$soname-def"; then :
5142 func_verbose "extracting exported symbol list from \`$soname'"
5143 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
5147 if test -f "$output_objdir/$newlib"; then :; else
5148 func_verbose "generating import library for \`$soname'"
5149 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
5151 # make sure the library variables are pointing to the new library
5154 fi # test -n "$old_archive_from_expsyms_cmds"
5156 if test "$linkmode" = prog || test "$mode" != relink; then
5161 case $hardcode_action in
5162 immediate | unsupported)
5163 if test "$hardcode_direct" = no; then
5166 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
5167 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
5168 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
5169 *-*-unixware7*) add_dir="-L$dir" ;;
5171 # if the lib is a (non-dlopened) module then we can not
5172 # link against it, someone is ignoring the earlier warnings
5173 if /usr/bin/file -L $add 2> /dev/null |
5174 $GREP ": [^:]* bundle" >/dev/null ; then
5175 if test "X$dlopenmodule" != "X$lib"; then
5176 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
5177 if test -z "$old_library" ; then
5179 $ECHO "*** And there doesn't seem to be a static archive available"
5180 $ECHO "*** The link will probably fail, sorry"
5182 add="$dir/$old_library"
5184 elif test -n "$old_library"; then
5185 add="$dir/$old_library"
5189 elif test "$hardcode_minus_L" = no; then
5191 *-*-sunos*) add_shlibpath="$dir" ;;
5195 elif test "$hardcode_shlibpath_var" = no; then
5196 add_shlibpath="$dir"
5203 if test "$hardcode_direct" = yes &&
5204 test "$hardcode_direct_absolute" = no; then
5206 elif test "$hardcode_minus_L" = yes; then
5208 # Try looking first in the location we're being installed to.
5209 if test -n "$inst_prefix_dir"; then
5212 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5217 elif test "$hardcode_shlibpath_var" = yes; then
5218 add_shlibpath="$dir"
5227 if test "$lib_linked" != yes; then
5228 func_fatal_configuration "unsupported hardcode properties"
5231 if test -n "$add_shlibpath"; then
5232 case :$compile_shlibpath: in
5233 *":$add_shlibpath:"*) ;;
5234 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
5237 if test "$linkmode" = prog; then
5238 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
5239 test -n "$add" && compile_deplibs="$add $compile_deplibs"
5241 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5242 test -n "$add" && deplibs="$add $deplibs"
5243 if test "$hardcode_direct" != yes &&
5244 test "$hardcode_minus_L" != yes &&
5245 test "$hardcode_shlibpath_var" = yes; then
5246 case :$finalize_shlibpath: in
5248 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5254 if test "$linkmode" = prog || test "$mode" = relink; then
5258 # Finalize command for both is simple: just hardcode it.
5259 if test "$hardcode_direct" = yes &&
5260 test "$hardcode_direct_absolute" = no; then
5261 add="$libdir/$linklib"
5262 elif test "$hardcode_minus_L" = yes; then
5265 elif test "$hardcode_shlibpath_var" = yes; then
5266 case :$finalize_shlibpath: in
5268 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5271 elif test "$hardcode_automatic" = yes; then
5272 if test -n "$inst_prefix_dir" &&
5273 test -f "$inst_prefix_dir$libdir/$linklib" ; then
5274 add="$inst_prefix_dir$libdir/$linklib"
5276 add="$libdir/$linklib"
5279 # We cannot seem to hardcode it, guess we'll fake it.
5281 # Try looking first in the location we're being installed to.
5282 if test -n "$inst_prefix_dir"; then
5285 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5292 if test "$linkmode" = prog; then
5293 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
5294 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
5296 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5297 test -n "$add" && deplibs="$add $deplibs"
5300 elif test "$linkmode" = prog; then
5301 # Here we assume that one of hardcode_direct or hardcode_minus_L
5302 # is not unsupported. This is valid on all known static and
5304 if test "$hardcode_direct" != unsupported; then
5305 test -n "$old_library" && linklib="$old_library"
5306 compile_deplibs="$dir/$linklib $compile_deplibs"
5307 finalize_deplibs="$dir/$linklib $finalize_deplibs"
5309 compile_deplibs="-l$name -L$dir $compile_deplibs"
5310 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
5312 elif test "$build_libtool_libs" = yes; then
5313 # Not a shared library
5314 if test "$deplibs_check_method" != pass_all; then
5315 # We're trying link a shared library against a static one
5316 # but the system doesn't support it.
5318 # Just print a warning and add the library to dependency_libs so
5319 # that the program can be linked against the static library.
5321 $ECHO "*** Warning: This system can not link to static lib archive $lib."
5322 $ECHO "*** I have the capability to make that library automatically link in when"
5323 $ECHO "*** you link to this library. But I can only do this if you have a"
5324 $ECHO "*** shared version of the library, which you do not appear to have."
5325 if test "$module" = yes; then
5326 $ECHO "*** But as you try to build a module library, libtool will still create "
5327 $ECHO "*** a static module, that should work as long as the dlopening application"
5328 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
5329 if test -z "$global_symbol_pipe"; then
5331 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5332 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5333 $ECHO "*** not find such a program. So, this module is probably useless."
5334 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
5336 if test "$build_old_libs" = no; then
5337 build_libtool_libs=module
5340 build_libtool_libs=no
5344 deplibs="$dir/$old_library $deplibs"
5347 fi # link shared/static library?
5349 if test "$linkmode" = lib; then
5350 if test -n "$dependency_libs" &&
5351 { test "$hardcode_into_libs" != yes ||
5352 test "$build_old_libs" = yes ||
5353 test "$link_static" = yes; }; then
5354 # Extract -R from dependency_libs
5356 for libdir in $dependency_libs; do
5358 -R*) func_stripname '-R' '' "$libdir"
5359 temp_xrpath=$func_stripname_result
5361 *" $temp_xrpath "*) ;;
5362 *) xrpath="$xrpath $temp_xrpath";;
5364 *) temp_deplibs="$temp_deplibs $libdir";;
5367 dependency_libs="$temp_deplibs"
5370 newlib_search_path="$newlib_search_path $absdir"
5371 # Link against this library
5372 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
5373 # ... and its dependency_libs
5375 for deplib in $dependency_libs; do
5376 newdependency_libs="$deplib $newdependency_libs"
5377 if $opt_duplicate_deps ; then
5378 case "$tmp_libs " in
5379 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5382 tmp_libs="$tmp_libs $deplib"
5385 if test "$link_all_deplibs" != no; then
5386 # Add the search paths of all dependency libraries
5387 for deplib in $dependency_libs; do
5389 -L*) path="$deplib" ;;
5391 func_dirname "$deplib" "" "."
5392 dir="$func_dirname_result"
5393 # We need an absolute path.
5395 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
5397 absdir=`cd "$dir" && pwd`
5398 if test -z "$absdir"; then
5399 func_warning "cannot determine absolute directory name of \`$dir'"
5404 if $GREP "^installed=no" $deplib > /dev/null; then
5408 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
5409 if test -n "$deplibrary_names" ; then
5410 for tmp in $deplibrary_names ; do
5413 if test -f "$absdir/$objdir/$depdepl" ; then
5414 depdepl="$absdir/$objdir/$depdepl"
5415 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5416 if test -z "$darwin_install_name"; then
5417 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5419 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
5420 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
5426 path="-L$absdir/$objdir"
5430 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5431 test -z "$libdir" && \
5432 func_fatal_error "\`$deplib' is not a valid libtool archive"
5433 test "$absdir" != "$libdir" && \
5434 func_warning "\`$deplib' seems to be moved"
5440 case " $deplibs " in
5442 *) deplibs="$path $deplibs" ;;
5445 fi # link_all_deplibs != no
5447 done # for deplib in $libs
5448 if test "$pass" = link; then
5449 if test "$linkmode" = "prog"; then
5450 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
5451 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
5453 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5456 dependency_libs="$newdependency_libs"
5457 if test "$pass" = dlpreopen; then
5458 # Link the dlpreopened libraries before other libraries
5459 for deplib in $save_deplibs; do
5460 deplibs="$deplib $deplibs"
5463 if test "$pass" != dlopen; then
5464 if test "$pass" != conv; then
5465 # Make sure lib_search_path contains only unique directories.
5467 for dir in $newlib_search_path; do
5468 case "$lib_search_path " in
5470 *) lib_search_path="$lib_search_path $dir" ;;
5476 if test "$linkmode,$pass" != "prog,link"; then
5479 vars="compile_deplibs finalize_deplibs"
5481 for var in $vars dependency_libs; do
5482 # Add libraries to $var in reverse order
5483 eval tmp_libs=\"\$$var\"
5485 for deplib in $tmp_libs; do
5486 # FIXME: Pedantically, this is the right thing to do, so
5487 # that some nasty dependency loop isn't accidentally
5489 #new_libs="$deplib $new_libs"
5490 # Pragmatically, this seems to cause very few problems in
5493 -L*) new_libs="$deplib $new_libs" ;;
5496 # And here is the reason: when a library appears more
5497 # than once as an explicit dependence of a library, or
5498 # is implicitly linked in more than once by the
5499 # compiler, it is considered special, and multiple
5500 # occurrences thereof are not removed. Compare this
5501 # with having the same library being listed as a
5502 # dependency of multiple other libraries: in this case,
5503 # we know (pedantically, we assume) the library does not
5504 # need to be listed more than once, so we keep only the
5505 # last copy. This is not always right, but it is rare
5506 # enough that we require users that really mean to play
5507 # such unportable linking tricks to link the library
5508 # using -Wl,-lname, so that libtool does not consider it
5509 # for duplicate removal.
5510 case " $specialdeplibs " in
5511 *" $deplib "*) new_libs="$deplib $new_libs" ;;
5513 case " $new_libs " in
5515 *) new_libs="$deplib $new_libs" ;;
5523 for deplib in $new_libs; do
5526 case " $tmp_libs " in
5528 *) tmp_libs="$tmp_libs $deplib" ;;
5531 *) tmp_libs="$tmp_libs $deplib" ;;
5534 eval $var=\"$tmp_libs\"
5537 # Last step: remove runtime libs from dependency_libs
5538 # (they stay in deplibs)
5540 for i in $dependency_libs ; do
5541 case " $predeps $postdeps $compiler_lib_search_path " in
5546 if test -n "$i" ; then
5547 tmp_libs="$tmp_libs $i"
5550 dependency_libs=$tmp_libs
5552 if test "$linkmode" = prog; then
5553 dlfiles="$newdlfiles"
5555 if test "$linkmode" = prog || test "$linkmode" = lib; then
5556 dlprefiles="$newdlprefiles"
5561 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
5562 func_warning "\`-dlopen' is ignored for archives"
5567 func_warning "\`-l' and \`-L' are ignored for archives" ;;
5570 test -n "$rpath" && \
5571 func_warning "\`-rpath' is ignored for archives"
5573 test -n "$xrpath" && \
5574 func_warning "\`-R' is ignored for archives"
5576 test -n "$vinfo" && \
5577 func_warning "\`-version-info/-version-number' is ignored for archives"
5579 test -n "$release" && \
5580 func_warning "\`-release' is ignored for archives"
5582 test -n "$export_symbols$export_symbols_regex" && \
5583 func_warning "\`-export-symbols' is ignored for archives"
5585 # Now set the variables for building old libraries.
5586 build_libtool_libs=no
5588 objs="$objs$old_deplibs"
5592 # Make sure we only generate libraries of the form `libNAME.la'.
5595 func_stripname 'lib' '.la' "$outputname"
5596 name=$func_stripname_result
5597 eval shared_ext=\"$shrext_cmds\"
5598 eval libname=\"$libname_spec\"
5601 test "$module" = no && \
5602 func_fatal_help "libtool library \`$output' must begin with \`lib'"
5604 if test "$need_lib_prefix" != no; then
5605 # Add the "lib" prefix for modules if required
5606 func_stripname '' '.la' "$outputname"
5607 name=$func_stripname_result
5608 eval shared_ext=\"$shrext_cmds\"
5609 eval libname=\"$libname_spec\"
5611 func_stripname '' '.la' "$outputname"
5612 libname=$func_stripname_result
5617 if test -n "$objs"; then
5618 if test "$deplibs_check_method" != pass_all; then
5619 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
5622 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
5623 $ECHO "*** objects $objs is not portable!"
5624 libobjs="$libobjs $objs"
5628 test "$dlself" != no && \
5629 func_warning "\`-dlopen self' is ignored for libtool libraries"
5633 test "$#" -gt 1 && \
5634 func_warning "ignoring multiple \`-rpath's for a libtool library"
5639 if test -z "$rpath"; then
5640 if test "$build_libtool_libs" = yes; then
5641 # Building a libtool convenience library.
5642 # Some compilers have problems with a `.al' extension so
5643 # convenience libraries should have the same extension an
5644 # archive normally would.
5645 oldlibs="$output_objdir/$libname.$libext $oldlibs"
5646 build_libtool_libs=convenience
5650 test -n "$vinfo" && \
5651 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
5653 test -n "$release" && \
5654 func_warning "\`-release' is ignored for convenience libraries"
5657 # Parse the version information argument.
5658 save_ifs="$IFS"; IFS=':'
5659 set dummy $vinfo 0 0 0
5664 func_fatal_help "too many parameters to \`-version-info'"
5666 # convert absolute version numbers to libtool ages
5667 # this retains compatibility with .la files and attempts
5668 # to make the code below a bit more comprehensible
5670 case $vinfo_number in
5674 number_revision="$3"
5676 # There are really only two kinds -- those that
5677 # use the current revision as the major version
5678 # and those that subtract age and use age as
5679 # a minor version. But, then there is irix
5680 # which has an extra 1 added just for fun
5682 case $version_type in
5683 darwin|linux|osf|windows|none)
5684 func_arith $number_major + $number_minor
5685 current=$func_arith_result
5687 revision="$number_revision"
5689 freebsd-aout|freebsd-elf|sunos)
5690 current="$number_major"
5691 revision="$number_minor"
5695 func_arith $number_major + $number_minor
5696 current=$func_arith_result
5698 revision="$number_minor"
5699 lt_irix_increment=no
5710 # Check that each of the things are valid numbers.
5712 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]) ;;
5714 func_error "CURRENT \`$current' must be a nonnegative integer"
5715 func_fatal_error "\`$vinfo' is not valid version information"
5720 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]) ;;
5722 func_error "REVISION \`$revision' must be a nonnegative integer"
5723 func_fatal_error "\`$vinfo' is not valid version information"
5728 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]) ;;
5730 func_error "AGE \`$age' must be a nonnegative integer"
5731 func_fatal_error "\`$vinfo' is not valid version information"
5735 if test "$age" -gt "$current"; then
5736 func_error "AGE \`$age' is greater than the current interface number \`$current'"
5737 func_fatal_error "\`$vinfo' is not valid version information"
5740 # Calculate the version variables.
5744 case $version_type in
5748 # Like Linux, but with the current version available in
5749 # verstring for coding it into the library header
5750 func_arith $current - $age
5751 major=.$func_arith_result
5752 versuffix="$major.$age.$revision"
5753 # Darwin ld doesn't like 0 for these options...
5754 func_arith $current + 1
5755 minor_current=$func_arith_result
5756 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
5757 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
5762 versuffix=".$current.$revision";
5767 versuffix=".$current"
5771 if test "X$lt_irix_increment" = "Xno"; then
5772 func_arith $current - $age
5774 func_arith $current - $age + 1
5776 major=$func_arith_result
5778 case $version_type in
5779 nonstopux) verstring_prefix=nonstopux ;;
5780 *) verstring_prefix=sgi ;;
5782 verstring="$verstring_prefix$major.$revision"
5784 # Add in all the interfaces that we are compatible with.
5786 while test "$loop" -ne 0; do
5787 func_arith $revision - $loop
5788 iface=$func_arith_result
5789 func_arith $loop - 1
5790 loop=$func_arith_result
5791 verstring="$verstring_prefix$major.$iface:$verstring"
5794 # Before this point, $major must not contain `.'.
5796 versuffix="$major.$revision"
5800 func_arith $current - $age
5801 major=.$func_arith_result
5802 versuffix="$major.$age.$revision"
5806 func_arith $current - $age
5807 major=.$func_arith_result
5808 versuffix=".$current.$age.$revision"
5809 verstring="$current.$age.$revision"
5811 # Add in all the interfaces that we are compatible with.
5813 while test "$loop" -ne 0; do
5814 func_arith $current - $loop
5815 iface=$func_arith_result
5816 func_arith $loop - 1
5817 loop=$func_arith_result
5818 verstring="$verstring:${iface}.0"
5821 # Make executables depend on our current version.
5822 verstring="$verstring:${current}.0"
5827 versuffix=".$current"
5832 versuffix=".$current.$revision"
5836 # Use '-' rather than '.', since we only want one
5837 # extension on DOS 8.3 filesystems.
5838 func_arith $current - $age
5839 major=$func_arith_result
5844 func_fatal_configuration "unknown library version type \`$version_type'"
5848 # Clear the version info if we defaulted, and they specified a release.
5849 if test -z "$vinfo" && test -n "$release"; then
5851 case $version_type in
5853 # we can't check for "0.0" in archive_cmds due to quoting
5854 # problems, so we reset it completely
5861 if test "$need_version" = no; then
5868 # Remove version info from name if versioning should be avoided
5869 if test "$avoid_version" = yes && test "$need_version" = no; then
5875 # Check to see if the archive will have undefined symbols.
5876 if test "$allow_undefined" = yes; then
5877 if test "$allow_undefined_flag" = unsupported; then
5878 func_warning "undefined symbols not allowed in $host shared libraries"
5879 build_libtool_libs=no
5883 # Don't allow undefined symbols.
5884 allow_undefined_flag="$no_undefined_flag"
5889 func_generate_dlsyms "$libname" "$libname" "yes"
5890 libobjs="$libobjs $symfileobj"
5891 test "X$libobjs" = "X " && libobjs=
5893 if test "$mode" != relink; then
5894 # Remove our outputs, but don't remove object files since they
5895 # may have been created when compiling PIC objects.
5897 tempremovelist=`$ECHO "$output_objdir/*"`
5898 for p in $tempremovelist; do
5902 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
5903 if test "X$precious_files_regex" != "X"; then
5904 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
5909 removelist="$removelist $p"
5914 test -n "$removelist" && \
5915 func_show_eval "${RM}r \$removelist"
5918 # Now set the variables for building old libraries.
5919 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
5920 oldlibs="$oldlibs $output_objdir/$libname.$libext"
5922 # Transform .lo files to .o files.
5923 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
5926 # Eliminate all temporary directories.
5927 #for path in $notinst_path; do
5928 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
5929 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
5930 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
5933 if test -n "$xrpath"; then
5934 # If the user specified any rpath flags, then add them.
5936 for libdir in $xrpath; do
5937 temp_xrpath="$temp_xrpath -R$libdir"
5938 case "$finalize_rpath " in
5940 *) finalize_rpath="$finalize_rpath $libdir" ;;
5943 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
5944 dependency_libs="$temp_xrpath $dependency_libs"
5948 # Make sure dlfiles contains only unique files that won't be dlpreopened
5949 old_dlfiles="$dlfiles"
5951 for lib in $old_dlfiles; do
5952 case " $dlprefiles $dlfiles " in
5954 *) dlfiles="$dlfiles $lib" ;;
5958 # Make sure dlprefiles contains only unique files
5959 old_dlprefiles="$dlprefiles"
5961 for lib in $old_dlprefiles; do
5962 case "$dlprefiles " in
5964 *) dlprefiles="$dlprefiles $lib" ;;
5968 if test "$build_libtool_libs" = yes; then
5969 if test -n "$rpath"; then
5971 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
5972 # these systems don't actually have a c library (as such)!
5974 *-*-rhapsody* | *-*-darwin1.[012])
5975 # Rhapsody C library is in the System framework
5976 deplibs="$deplibs System.ltframework"
5979 # Don't link with libc until the a.out ld.so is fixed.
5981 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5982 # Do not include libc due to us having libc/libc_r.
5984 *-*-sco3.2v5* | *-*-sco5v6*)
5985 # Causes problems with __ctype
5987 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5988 # Compiler inserts libc in the correct place for threads to work
5991 # Add libc to deplibs on all other systems if necessary.
5992 if test "$build_libtool_need_lc" = "yes"; then
5993 deplibs="$deplibs -lc"
5999 # Transform deplibs into only deplibs that can be linked in shared.
6001 libname_save=$libname
6002 release_save=$release
6003 versuffix_save=$versuffix
6005 # I'm not sure if I'm treating the release correctly. I think
6006 # release should show up in the -l (ie -lgmp5) so we don't want to
6007 # add it in twice. Is that correct?
6013 case $deplibs_check_method in
6015 # Don't check for shared/static. Everything works.
6016 # This might be a little naive. We might want to check
6017 # whether the library exists or not. But this is on
6018 # osf3 & osf4 and I'm not really sure... Just
6019 # implementing what was already the behavior.
6023 # This code stresses the "libraries are programs" paradigm to its
6024 # limits. Maybe even breaks it. We compile a program, linking it
6025 # against the deplibs as a proxy for the library. Then we can check
6026 # whether they linked in statically or dynamically with ldd.
6027 $opt_dry_run || $RM conftest.c
6028 cat > conftest.c <<EOF
6029 int main() { return 0; }
6031 $opt_dry_run || $RM conftest
6032 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
6033 ldd_output=`ldd conftest`
6034 for i in $deplibs; do
6037 func_stripname -l '' "$i"
6038 name=$func_stripname_result
6039 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6040 case " $predeps $postdeps " in
6042 newdeplibs="$newdeplibs $i"
6047 if test -n "$i" ; then
6048 libname=`eval "\\$ECHO \"$libname_spec\""`
6049 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6050 set dummy $deplib_matches; shift
6052 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6053 newdeplibs="$newdeplibs $i"
6057 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6058 $ECHO "*** I have the capability to make that library automatically link in when"
6059 $ECHO "*** you link to this library. But I can only do this if you have a"
6060 $ECHO "*** shared version of the library, which I believe you do not have"
6061 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
6062 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
6067 newdeplibs="$newdeplibs $i"
6072 # Error occurred in the first compile. Let's try to salvage
6073 # the situation: Compile a separate program for each library.
6074 for i in $deplibs; do
6077 func_stripname -l '' "$i"
6078 name=$func_stripname_result
6079 $opt_dry_run || $RM conftest
6080 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
6081 ldd_output=`ldd conftest`
6082 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6083 case " $predeps $postdeps " in
6085 newdeplibs="$newdeplibs $i"
6090 if test -n "$i" ; then
6091 libname=`eval "\\$ECHO \"$libname_spec\""`
6092 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6093 set dummy $deplib_matches; shift
6095 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6096 newdeplibs="$newdeplibs $i"
6100 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6101 $ECHO "*** I have the capability to make that library automatically link in when"
6102 $ECHO "*** you link to this library. But I can only do this if you have a"
6103 $ECHO "*** shared version of the library, which you do not appear to have"
6104 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
6105 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
6111 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
6112 $ECHO "*** make it link in! You will probably need to install it or some"
6113 $ECHO "*** library that it depends on before this library will be fully"
6114 $ECHO "*** functional. Installing it before continuing would be even better."
6118 newdeplibs="$newdeplibs $i"
6125 set dummy $deplibs_check_method; shift
6126 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6127 for a_deplib in $deplibs; do
6130 func_stripname -l '' "$a_deplib"
6131 name=$func_stripname_result
6132 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6133 case " $predeps $postdeps " in
6135 newdeplibs="$newdeplibs $a_deplib"
6140 if test -n "$a_deplib" ; then
6141 libname=`eval "\\$ECHO \"$libname_spec\""`
6142 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6143 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6144 for potent_lib in $potential_libs; do
6145 # Follow soft links.
6146 if ls -lLd "$potent_lib" 2>/dev/null |
6147 $GREP " -> " >/dev/null; then
6150 # The statement above tries to avoid entering an
6151 # endless loop below, in case of cyclic links.
6152 # We might still enter an endless loop, since a link
6153 # loop can be closed while we follow links,
6155 potlib="$potent_lib"
6156 while test -h "$potlib" 2>/dev/null; do
6157 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
6159 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
6160 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
6163 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
6165 $EGREP "$file_magic_regex" > /dev/null; then
6166 newdeplibs="$newdeplibs $a_deplib"
6173 if test -n "$a_deplib" ; then
6176 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6177 $ECHO "*** I have the capability to make that library automatically link in when"
6178 $ECHO "*** you link to this library. But I can only do this if you have a"
6179 $ECHO "*** shared version of the library, which you do not appear to have"
6180 $ECHO "*** because I did check the linker path looking for a file starting"
6181 if test -z "$potlib" ; then
6182 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
6184 $ECHO "*** with $libname and none of the candidates passed a file format test"
6185 $ECHO "*** using a file magic. Last file checked: $potlib"
6190 # Add a -L argument.
6191 newdeplibs="$newdeplibs $a_deplib"
6194 done # Gone through all deplibs.
6197 set dummy $deplibs_check_method; shift
6198 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6199 for a_deplib in $deplibs; do
6202 func_stripname -l '' "$a_deplib"
6203 name=$func_stripname_result
6204 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6205 case " $predeps $postdeps " in
6207 newdeplibs="$newdeplibs $a_deplib"
6212 if test -n "$a_deplib" ; then
6213 libname=`eval "\\$ECHO \"$libname_spec\""`
6214 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6215 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6216 for potent_lib in $potential_libs; do
6217 potlib="$potent_lib" # see symlink-check above in file_magic test
6218 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
6219 $EGREP "$match_pattern_regex" > /dev/null; then
6220 newdeplibs="$newdeplibs $a_deplib"
6227 if test -n "$a_deplib" ; then
6230 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6231 $ECHO "*** I have the capability to make that library automatically link in when"
6232 $ECHO "*** you link to this library. But I can only do this if you have a"
6233 $ECHO "*** shared version of the library, which you do not appear to have"
6234 $ECHO "*** because I did check the linker path looking for a file starting"
6235 if test -z "$potlib" ; then
6236 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
6238 $ECHO "*** with $libname and none of the candidates passed a file format test"
6239 $ECHO "*** using a regex pattern. Last file checked: $potlib"
6244 # Add a -L argument.
6245 newdeplibs="$newdeplibs $a_deplib"
6248 done # Gone through all deplibs.
6252 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
6253 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
6254 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6255 for i in $predeps $postdeps ; do
6256 # can't use Xsed below, because $i might contain '/'
6257 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
6260 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
6261 $GREP . >/dev/null; then
6263 if test "X$deplibs_check_method" = "Xnone"; then
6264 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
6266 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
6268 $ECHO "*** All declared inter-library dependencies are being dropped."
6273 versuffix=$versuffix_save
6275 release=$release_save
6276 libname=$libname_save
6280 *-*-rhapsody* | *-*-darwin1.[012])
6281 # On Rhapsody replace the C library with the System framework
6282 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6286 if test "$droppeddeps" = yes; then
6287 if test "$module" = yes; then
6289 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
6290 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
6291 $ECHO "*** a static module, that should work as long as the dlopening"
6292 $ECHO "*** application is linked with the -dlopen flag."
6293 if test -z "$global_symbol_pipe"; then
6295 $ECHO "*** However, this would only work if libtool was able to extract symbol"
6296 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6297 $ECHO "*** not find such a program. So, this module is probably useless."
6298 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6300 if test "$build_old_libs" = no; then
6301 oldlibs="$output_objdir/$libname.$libext"
6302 build_libtool_libs=module
6305 build_libtool_libs=no
6308 $ECHO "*** The inter-library dependencies that have been dropped here will be"
6309 $ECHO "*** automatically added whenever a program is linked with this library"
6310 $ECHO "*** or is declared to -dlopen it."
6312 if test "$allow_undefined" = no; then
6314 $ECHO "*** Since this library must not contain undefined symbols,"
6315 $ECHO "*** because either the platform does not support them or"
6316 $ECHO "*** it was explicitly requested with -no-undefined,"
6317 $ECHO "*** libtool will only create a static version of it."
6318 if test "$build_old_libs" = no; then
6319 oldlibs="$output_objdir/$libname.$libext"
6320 build_libtool_libs=module
6323 build_libtool_libs=no
6328 # Done checking deplibs!
6331 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6334 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6335 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6336 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6340 # move library search paths that coincide with paths to not yet
6341 # installed libraries to the beginning of the library search list
6343 for path in $notinst_path; do
6344 case " $new_libs " in
6345 *" -L$path/$objdir "*) ;;
6347 case " $deplibs " in
6348 *" -L$path/$objdir "*)
6349 new_libs="$new_libs -L$path/$objdir" ;;
6354 for deplib in $deplibs; do
6357 case " $new_libs " in
6359 *) new_libs="$new_libs $deplib" ;;
6362 *) new_libs="$new_libs $deplib" ;;
6367 # All the library-specific variables (install_libdir is set above).
6372 # Test again, we may have decided not to build it any more
6373 if test "$build_libtool_libs" = yes; then
6374 if test "$hardcode_into_libs" = yes; then
6375 # Hardcode the library paths
6378 rpath="$finalize_rpath"
6379 test "$mode" != relink && rpath="$compile_rpath$rpath"
6380 for libdir in $rpath; do
6381 if test -n "$hardcode_libdir_flag_spec"; then
6382 if test -n "$hardcode_libdir_separator"; then
6383 if test -z "$hardcode_libdirs"; then
6384 hardcode_libdirs="$libdir"
6386 # Just accumulate the unique libdirs.
6387 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6388 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6391 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6396 eval flag=\"$hardcode_libdir_flag_spec\"
6397 dep_rpath="$dep_rpath $flag"
6399 elif test -n "$runpath_var"; then
6400 case "$perm_rpath " in
6402 *) perm_rpath="$perm_rpath $libdir" ;;
6406 # Substitute the hardcoded libdirs into the rpath.
6407 if test -n "$hardcode_libdir_separator" &&
6408 test -n "$hardcode_libdirs"; then
6409 libdir="$hardcode_libdirs"
6410 if test -n "$hardcode_libdir_flag_spec_ld"; then
6411 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
6413 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
6416 if test -n "$runpath_var" && test -n "$perm_rpath"; then
6417 # We should set the runpath_var.
6419 for dir in $perm_rpath; do
6422 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
6424 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
6427 shlibpath="$finalize_shlibpath"
6428 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
6429 if test -n "$shlibpath"; then
6430 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
6433 # Get the real and link names of the library.
6434 eval shared_ext=\"$shrext_cmds\"
6435 eval library_names=\"$library_names_spec\"
6436 set dummy $library_names
6441 if test -n "$soname_spec"; then
6442 eval soname=\"$soname_spec\"
6446 if test -z "$dlname"; then
6450 lib="$output_objdir/$realname"
6454 linknames="$linknames $link"
6457 # Use standard objects if they are pic
6458 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6459 test "X$libobjs" = "X " && libobjs=
6462 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6463 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
6464 export_symbols="$output_objdir/$libname.uexp"
6465 delfiles="$delfiles $export_symbols"
6468 orig_export_symbols=
6471 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
6472 # exporting using user supplied symfile
6473 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
6474 # and it's NOT already a .def file. Must figure out
6475 # which of the given symbols are data symbols and tag
6476 # them as such. So, trigger use of export_symbols_cmds.
6477 # export_symbols gets reassigned inside the "prepare
6478 # the list of exported symbols" if statement, so the
6479 # include_expsyms logic still works.
6480 orig_export_symbols="$export_symbols"
6482 always_export_symbols=yes
6488 # Prepare the list of exported symbols
6489 if test -z "$export_symbols"; then
6490 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
6491 func_verbose "generating symbol list for \`$libname.la'"
6492 export_symbols="$output_objdir/$libname.exp"
6493 $opt_dry_run || $RM $export_symbols
6494 cmds=$export_symbols_cmds
6495 save_ifs="$IFS"; IFS='~'
6496 for cmd in $cmds; do
6500 len=$func_len_result
6501 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6502 func_show_eval "$cmd" 'exit $?'
6503 skipped_export=false
6505 # The command line is too long to execute in one step.
6506 func_verbose "using reloadable object file for export list..."
6508 # Break out early, otherwise skipped_export may be
6509 # set to false by a later but shorter cmd.
6514 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
6515 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
6516 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
6521 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6522 tmp_export_symbols="$export_symbols"
6523 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
6524 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
6527 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
6528 # The given exports_symbols file has to be filtered, so filter it.
6529 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
6530 # FIXME: $output_objdir/$libname.filter potentially contains lots of
6531 # 's' commands which not all seds can handle. GNU sed should be fine
6532 # though. Also, the filter scales superlinearly with the number of
6533 # global variables. join(1) would be nice here, but unfortunately
6534 # isn't a blessed tool.
6535 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
6536 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
6537 export_symbols=$output_objdir/$libname.def
6538 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
6542 for test_deplib in $deplibs; do
6543 case " $convenience " in
6544 *" $test_deplib "*) ;;
6546 tmp_deplibs="$tmp_deplibs $test_deplib"
6550 deplibs="$tmp_deplibs"
6552 if test -n "$convenience"; then
6553 if test -n "$whole_archive_flag_spec" &&
6554 test "$compiler_needs_object" = yes &&
6555 test -z "$libobjs"; then
6556 # extract the archives, so we have objects to list.
6557 # TODO: could optimize this to just extract one archive.
6558 whole_archive_flag_spec=
6560 if test -n "$whole_archive_flag_spec"; then
6561 save_libobjs=$libobjs
6562 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
6563 test "X$libobjs" = "X " && libobjs=
6565 gentop="$output_objdir/${outputname}x"
6566 generated="$generated $gentop"
6568 func_extract_archives $gentop $convenience
6569 libobjs="$libobjs $func_extract_archives_result"
6570 test "X$libobjs" = "X " && libobjs=
6574 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
6575 eval flag=\"$thread_safe_flag_spec\"
6576 linker_flags="$linker_flags $flag"
6579 # Make a backup of the uninstalled library when relinking
6580 if test "$mode" = relink; then
6581 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
6584 # Do each of the archive commands.
6585 if test "$module" = yes && test -n "$module_cmds" ; then
6586 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
6587 eval test_cmds=\"$module_expsym_cmds\"
6588 cmds=$module_expsym_cmds
6590 eval test_cmds=\"$module_cmds\"
6594 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
6595 eval test_cmds=\"$archive_expsym_cmds\"
6596 cmds=$archive_expsym_cmds
6598 eval test_cmds=\"$archive_cmds\"
6603 if test "X$skipped_export" != "X:" &&
6604 func_len " $test_cmds" &&
6605 len=$func_len_result &&
6606 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6609 # The command line is too long to link in one step, link piecewise
6610 # or, if using GNU ld and skipped_export is not :, use a linker
6613 # Save the value of $output and $libobjs because we want to
6614 # use them later. If we have whole_archive_flag_spec, we
6615 # want to use save_libobjs as it was before
6616 # whole_archive_flag_spec was expanded, because we can't
6617 # assume the linker understands whole_archive_flag_spec.
6618 # This may have to be revisited, in case too many
6619 # convenience libraries get linked in and end up exceeding
6621 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
6622 save_libobjs=$libobjs
6625 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
6627 # Clear the reloadable object creation command queue and
6628 # initialize k to one.
6635 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
6636 output=${output_objdir}/${output_la}.lnkscript
6637 func_verbose "creating GNU ld script: $output"
6638 $ECHO 'INPUT (' > $output
6639 for obj in $save_libobjs
6641 $ECHO "$obj" >> $output
6643 $ECHO ')' >> $output
6644 delfiles="$delfiles $output"
6645 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
6646 output=${output_objdir}/${output_la}.lnk
6647 func_verbose "creating linker input file list: $output"
6652 if test "$compiler_needs_object" = yes; then
6658 $ECHO "$obj" >> $output
6660 delfiles="$delfiles $output"
6661 output=$firstobj\"$file_list_spec$output\"
6663 if test -n "$save_libobjs"; then
6664 func_verbose "creating reloadable object files..."
6665 output=$output_objdir/$output_la-${k}.$objext
6666 eval test_cmds=\"$reload_cmds\"
6667 func_len " $test_cmds"
6668 len0=$func_len_result
6671 # Loop over the list of objects to be linked.
6672 for obj in $save_libobjs
6675 func_arith $len + $func_len_result
6676 len=$func_arith_result
6677 if test "X$objlist" = X ||
6678 test "$len" -lt "$max_cmd_len"; then
6679 func_append objlist " $obj"
6681 # The command $test_cmds is almost too long, add a
6682 # command to the queue.
6683 if test "$k" -eq 1 ; then
6684 # The first file doesn't have a previous command to add.
6685 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
6687 # All subsequent reloadable object files will link in
6688 # the last one created.
6689 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
6691 last_robj=$output_objdir/$output_la-${k}.$objext
6693 k=$func_arith_result
6694 output=$output_objdir/$output_la-${k}.$objext
6696 func_len " $last_robj"
6697 func_arith $len0 + $func_len_result
6698 len=$func_arith_result
6701 # Handle the remaining objects by creating one last
6702 # reloadable object file. All subsequent reloadable object
6703 # files will link in the last one created.
6704 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6705 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
6706 if test -n "$last_robj"; then
6707 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
6709 delfiles="$delfiles $output"
6715 if ${skipped_export-false}; then
6716 func_verbose "generating symbol list for \`$libname.la'"
6717 export_symbols="$output_objdir/$libname.exp"
6718 $opt_dry_run || $RM $export_symbols
6720 # Append the command to create the export file.
6721 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6722 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
6723 if test -n "$last_robj"; then
6724 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
6728 test -n "$save_libobjs" &&
6729 func_verbose "creating a temporary reloadable object file: $output"
6731 # Loop through the commands generated above and execute them.
6732 save_ifs="$IFS"; IFS='~'
6733 for cmd in $concat_cmds; do
6736 func_quote_for_expand "$cmd"
6737 eval "func_echo $func_quote_for_expand_result"
6739 $opt_dry_run || eval "$cmd" || {
6742 # Restore the uninstalled library and exit
6743 if test "$mode" = relink; then
6744 ( cd "$output_objdir" && \
6745 $RM "${realname}T" && \
6746 $MV "${realname}U" "$realname" )
6754 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
6755 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
6756 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
6760 if ${skipped_export-false}; then
6761 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6762 tmp_export_symbols="$export_symbols"
6763 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
6764 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
6767 if test -n "$orig_export_symbols"; then
6768 # The given exports_symbols file has to be filtered, so filter it.
6769 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
6770 # FIXME: $output_objdir/$libname.filter potentially contains lots of
6771 # 's' commands which not all seds can handle. GNU sed should be fine
6772 # though. Also, the filter scales superlinearly with the number of
6773 # global variables. join(1) would be nice here, but unfortunately
6774 # isn't a blessed tool.
6775 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
6776 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
6777 export_symbols=$output_objdir/$libname.def
6778 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
6783 # Restore the value of output.
6786 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
6787 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
6788 test "X$libobjs" = "X " && libobjs=
6790 # Expand the library linking commands again to reset the
6791 # value of $libobjs for piecewise linking.
6793 # Do each of the archive commands.
6794 if test "$module" = yes && test -n "$module_cmds" ; then
6795 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
6796 cmds=$module_expsym_cmds
6801 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
6802 cmds=$archive_expsym_cmds
6809 if test -n "$delfiles"; then
6810 # Append the command to remove temporary files to $cmds.
6811 eval cmds=\"\$cmds~\$RM $delfiles\"
6814 # Add any objects from preloaded convenience libraries
6815 if test -n "$dlprefiles"; then
6816 gentop="$output_objdir/${outputname}x"
6817 generated="$generated $gentop"
6819 func_extract_archives $gentop $dlprefiles
6820 libobjs="$libobjs $func_extract_archives_result"
6821 test "X$libobjs" = "X " && libobjs=
6824 save_ifs="$IFS"; IFS='~'
6825 for cmd in $cmds; do
6829 func_quote_for_expand "$cmd"
6830 eval "func_echo $func_quote_for_expand_result"
6832 $opt_dry_run || eval "$cmd" || {
6835 # Restore the uninstalled library and exit
6836 if test "$mode" = relink; then
6837 ( cd "$output_objdir" && \
6838 $RM "${realname}T" && \
6839 $MV "${realname}U" "$realname" )
6847 # Restore the uninstalled library and exit
6848 if test "$mode" = relink; then
6849 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
6851 if test -n "$convenience"; then
6852 if test -z "$whole_archive_flag_spec"; then
6853 func_show_eval '${RM}r "$gentop"'
6860 # Create links to the real library.
6861 for linkname in $linknames; do
6862 if test "$realname" != "$linkname"; then
6863 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
6867 # If -module or -export-dynamic was specified, set the dlname.
6868 if test "$module" = yes || test "$export_dynamic" = yes; then
6869 # On all known operating systems, these are identical.
6876 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6877 func_warning "\`-dlopen' is ignored for objects"
6882 func_warning "\`-l' and \`-L' are ignored for objects" ;;
6885 test -n "$rpath" && \
6886 func_warning "\`-rpath' is ignored for objects"
6888 test -n "$xrpath" && \
6889 func_warning "\`-R' is ignored for objects"
6891 test -n "$vinfo" && \
6892 func_warning "\`-version-info' is ignored for objects"
6894 test -n "$release" && \
6895 func_warning "\`-release' is ignored for objects"
6899 test -n "$objs$old_deplibs" && \
6900 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
6904 obj=$func_lo2o_result
6912 # Delete the old objects.
6913 $opt_dry_run || $RM $obj $libobj
6915 # Objects from convenience libraries. This assumes
6916 # single-version convenience libraries. Whenever we create
6917 # different ones for PIC/non-PIC, this we'll have to duplicate
6921 # reload_cmds runs $LD directly, so let us get rid of
6922 # -Wl from whole_archive_flag_spec and hope we can get by with
6923 # turning comma into space..
6926 if test -n "$convenience"; then
6927 if test -n "$whole_archive_flag_spec"; then
6928 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
6929 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
6931 gentop="$output_objdir/${obj}x"
6932 generated="$generated $gentop"
6934 func_extract_archives $gentop $convenience
6935 reload_conv_objs="$reload_objs $func_extract_archives_result"
6939 # Create the old-style object.
6940 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
6943 func_execute_cmds "$reload_cmds" 'exit $?'
6945 # Exit if we aren't doing a library object file.
6946 if test -z "$libobj"; then
6947 if test -n "$gentop"; then
6948 func_show_eval '${RM}r "$gentop"'
6954 if test "$build_libtool_libs" != yes; then
6955 if test -n "$gentop"; then
6956 func_show_eval '${RM}r "$gentop"'
6959 # Create an invalid libtool object if no PIC, so that we don't
6960 # accidentally link it into a program.
6961 # $show "echo timestamp > $libobj"
6962 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
6966 if test -n "$pic_flag" || test "$pic_mode" != default; then
6967 # Only do commands if we really have different PIC objects.
6968 reload_objs="$libobjs $reload_conv_objs"
6970 func_execute_cmds "$reload_cmds" 'exit $?'
6973 if test -n "$gentop"; then
6974 func_show_eval '${RM}r "$gentop"'
6982 *cygwin*) func_stripname '' '.exe' "$output"
6983 output=$func_stripname_result.exe;;
6985 test -n "$vinfo" && \
6986 func_warning "\`-version-info' is ignored for programs"
6988 test -n "$release" && \
6989 func_warning "\`-release' is ignored for programs"
6991 test "$preload" = yes \
6992 && test "$dlopen_support" = unknown \
6993 && test "$dlopen_self" = unknown \
6994 && test "$dlopen_self_static" = unknown && \
6995 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
6998 *-*-rhapsody* | *-*-darwin1.[012])
6999 # On Rhapsody replace the C library is the System framework
7000 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7001 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7007 # Don't allow lazy linking, it breaks C++ global constructors
7008 # But is supposedly fixed on 10.4 or later (yay!).
7009 if test "$tagname" = CXX ; then
7010 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
7012 compile_command="$compile_command ${wl}-bind_at_load"
7013 finalize_command="$finalize_command ${wl}-bind_at_load"
7017 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7018 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7019 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7024 # move library search paths that coincide with paths to not yet
7025 # installed libraries to the beginning of the library search list
7027 for path in $notinst_path; do
7028 case " $new_libs " in
7029 *" -L$path/$objdir "*) ;;
7031 case " $compile_deplibs " in
7032 *" -L$path/$objdir "*)
7033 new_libs="$new_libs -L$path/$objdir" ;;
7038 for deplib in $compile_deplibs; do
7041 case " $new_libs " in
7043 *) new_libs="$new_libs $deplib" ;;
7046 *) new_libs="$new_libs $deplib" ;;
7049 compile_deplibs="$new_libs"
7052 compile_command="$compile_command $compile_deplibs"
7053 finalize_command="$finalize_command $finalize_deplibs"
7055 if test -n "$rpath$xrpath"; then
7056 # If the user specified any rpath flags, then add them.
7057 for libdir in $rpath $xrpath; do
7058 # This is the magic to use -rpath.
7059 case "$finalize_rpath " in
7061 *) finalize_rpath="$finalize_rpath $libdir" ;;
7066 # Now hardcode the library paths
7069 for libdir in $compile_rpath $finalize_rpath; do
7070 if test -n "$hardcode_libdir_flag_spec"; then
7071 if test -n "$hardcode_libdir_separator"; then
7072 if test -z "$hardcode_libdirs"; then
7073 hardcode_libdirs="$libdir"
7075 # Just accumulate the unique libdirs.
7076 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7077 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7080 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7085 eval flag=\"$hardcode_libdir_flag_spec\"
7086 rpath="$rpath $flag"
7088 elif test -n "$runpath_var"; then
7089 case "$perm_rpath " in
7091 *) perm_rpath="$perm_rpath $libdir" ;;
7095 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
7096 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
7097 case :$dllsearchpath: in
7099 *) dllsearchpath="$dllsearchpath:$libdir";;
7101 case :$dllsearchpath: in
7102 *":$testbindir:"*) ;;
7103 *) dllsearchpath="$dllsearchpath:$testbindir";;
7108 # Substitute the hardcoded libdirs into the rpath.
7109 if test -n "$hardcode_libdir_separator" &&
7110 test -n "$hardcode_libdirs"; then
7111 libdir="$hardcode_libdirs"
7112 eval rpath=\" $hardcode_libdir_flag_spec\"
7114 compile_rpath="$rpath"
7118 for libdir in $finalize_rpath; do
7119 if test -n "$hardcode_libdir_flag_spec"; then
7120 if test -n "$hardcode_libdir_separator"; then
7121 if test -z "$hardcode_libdirs"; then
7122 hardcode_libdirs="$libdir"
7124 # Just accumulate the unique libdirs.
7125 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7126 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7129 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7134 eval flag=\"$hardcode_libdir_flag_spec\"
7135 rpath="$rpath $flag"
7137 elif test -n "$runpath_var"; then
7138 case "$finalize_perm_rpath " in
7140 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
7144 # Substitute the hardcoded libdirs into the rpath.
7145 if test -n "$hardcode_libdir_separator" &&
7146 test -n "$hardcode_libdirs"; then
7147 libdir="$hardcode_libdirs"
7148 eval rpath=\" $hardcode_libdir_flag_spec\"
7150 finalize_rpath="$rpath"
7152 if test -n "$libobjs" && test "$build_old_libs" = yes; then
7153 # Transform all the library objects into standard objects.
7154 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7155 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7158 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
7160 # template prelinking step
7161 if test -n "$prelink_cmds"; then
7162 func_execute_cmds "$prelink_cmds" 'exit $?'
7165 wrappers_required=yes
7167 *cygwin* | *mingw* )
7168 if test "$build_libtool_libs" != yes; then
7169 wrappers_required=no
7173 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
7174 wrappers_required=no
7178 if test "$wrappers_required" = no; then
7179 # Replace the output file specification.
7180 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7181 link_command="$compile_command$compile_rpath"
7183 # We have no uninstalled library dependencies, so finalize right now.
7185 func_show_eval "$link_command" 'exit_status=$?'
7187 # Delete the generated files.
7188 if test -f "$output_objdir/${outputname}S.${objext}"; then
7189 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
7195 if test -n "$compile_shlibpath$finalize_shlibpath"; then
7196 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
7198 if test -n "$finalize_shlibpath"; then
7199 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
7204 if test -n "$runpath_var"; then
7205 if test -n "$perm_rpath"; then
7206 # We should set the runpath_var.
7208 for dir in $perm_rpath; do
7211 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
7213 if test -n "$finalize_perm_rpath"; then
7214 # We should set the runpath_var.
7216 for dir in $finalize_perm_rpath; do
7219 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
7223 if test "$no_install" = yes; then
7224 # We don't need to create a wrapper script.
7225 link_command="$compile_var$compile_command$compile_rpath"
7226 # Replace the output file specification.
7227 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7228 # Delete the old output file.
7229 $opt_dry_run || $RM $output
7230 # Link the executable and exit
7231 func_show_eval "$link_command" 'exit $?'
7235 if test "$hardcode_action" = relink; then
7236 # Fast installation is not supported
7237 link_command="$compile_var$compile_command$compile_rpath"
7238 relink_command="$finalize_var$finalize_command$finalize_rpath"
7240 func_warning "this platform does not like uninstalled shared libraries"
7241 func_warning "\`$output' will be relinked during installation"
7243 if test "$fast_install" != no; then
7244 link_command="$finalize_var$compile_command$finalize_rpath"
7245 if test "$fast_install" = yes; then
7246 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
7248 # fast_install is set to needless
7252 link_command="$compile_var$compile_command$compile_rpath"
7253 relink_command="$finalize_var$finalize_command$finalize_rpath"
7257 # Replace the output file specification.
7258 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7260 # Delete the old output files.
7261 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
7263 func_show_eval "$link_command" 'exit $?'
7265 # Now create the wrapper script.
7266 func_verbose "creating $output"
7268 # Quote the relink command for shipping.
7269 if test -n "$relink_command"; then
7270 # Preserve any variables that may affect compiler behavior
7271 for var in $variables_saved_for_relink; do
7272 if eval test -z \"\${$var+set}\"; then
7273 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7274 elif eval var_value=\$$var; test -z "$var_value"; then
7275 relink_command="$var=; export $var; $relink_command"
7277 func_quote_for_eval "$var_value"
7278 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7281 relink_command="(cd `pwd`; $relink_command)"
7282 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7285 # Quote $ECHO for shipping.
7286 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
7288 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
7289 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
7291 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
7293 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
7296 # Only actually do things if not in dry run mode.
7298 # win32 will think the script is a binary if it has
7299 # a .exe suffix, so we strip it off here.
7301 *.exe) func_stripname '' '.exe' "$output"
7302 output=$func_stripname_result ;;
7304 # test for cygwin because mv fails w/o .exe extensions
7308 func_stripname '' '.exe' "$outputname"
7309 outputname=$func_stripname_result ;;
7313 *cygwin* | *mingw* )
7314 func_dirname_and_basename "$output" "" "."
7315 output_name=$func_basename_result
7316 output_path=$func_dirname_result
7317 cwrappersource="$output_path/$objdir/lt-$output_name.c"
7318 cwrapper="$output_path/$output_name.exe"
7319 $RM $cwrappersource $cwrapper
7320 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7322 func_emit_cwrapperexe_src > $cwrappersource
7324 # we should really use a build-platform specific compiler
7325 # here, but OTOH, the wrappers (shell script and this C one)
7326 # are only useful if you want to execute the "real" binary.
7327 # Since the "real" binary is built for $host, then this
7328 # wrapper might as well be built for $host, too.
7330 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
7334 # Now, create the wrapper script for func_source use:
7335 func_ltwrapper_scriptname $cwrapper
7336 $RM $func_ltwrapper_scriptname_result
7337 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
7339 # note: this script will not be executed, so do not chmod.
7340 if test "x$build" = "x$host" ; then
7341 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7343 func_emit_wrapper no > $func_ltwrapper_scriptname_result
7349 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
7351 func_emit_wrapper no > $output
7360 # See if we need to build an old-fashioned archive.
7361 for oldlib in $oldlibs; do
7363 if test "$build_libtool_libs" = convenience; then
7364 oldobjs="$libobjs_save $symfileobj"
7365 addlibs="$convenience"
7366 build_libtool_libs=no
7368 if test "$build_libtool_libs" = module; then
7369 oldobjs="$libobjs_save"
7370 build_libtool_libs=no
7372 oldobjs="$old_deplibs $non_pic_objects"
7373 if test "$preload" = yes && test -f "$symfileobj"; then
7374 oldobjs="$oldobjs $symfileobj"
7377 addlibs="$old_convenience"
7380 if test -n "$addlibs"; then
7381 gentop="$output_objdir/${outputname}x"
7382 generated="$generated $gentop"
7384 func_extract_archives $gentop $addlibs
7385 oldobjs="$oldobjs $func_extract_archives_result"
7388 # Do each command in the archive commands.
7389 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
7390 cmds=$old_archive_from_new_cmds
7393 # Add any objects from preloaded convenience libraries
7394 if test -n "$dlprefiles"; then
7395 gentop="$output_objdir/${outputname}x"
7396 generated="$generated $gentop"
7398 func_extract_archives $gentop $dlprefiles
7399 oldobjs="$oldobjs $func_extract_archives_result"
7402 # POSIX demands no paths to be encoded in archives. We have
7403 # to avoid creating archives with duplicate basenames if we
7404 # might have to extract them afterwards, e.g., when creating a
7405 # static archive out of a convenience library, or when linking
7406 # the entirety of a libtool archive into another (currently
7407 # not supported by libtool).
7408 if (for obj in $oldobjs
7410 func_basename "$obj"
7411 $ECHO "$func_basename_result"
7412 done | sort | sort -uc >/dev/null 2>&1); then
7415 $ECHO "copying selected object files to avoid basename conflicts..."
7416 gentop="$output_objdir/${outputname}x"
7417 generated="$generated $gentop"
7418 func_mkdir_p "$gentop"
7419 save_oldobjs=$oldobjs
7422 for obj in $save_oldobjs
7424 func_basename "$obj"
7425 objbase="$func_basename_result"
7426 case " $oldobjs " in
7427 " ") oldobjs=$obj ;;
7430 # Make sure we don't pick an alternate name that also
7432 newobj=lt$counter-$objbase
7433 func_arith $counter + 1
7434 counter=$func_arith_result
7435 case " $oldobjs " in
7436 *[\ /]"$newobj "*) ;;
7437 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
7440 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
7441 oldobjs="$oldobjs $gentop/$newobj"
7443 *) oldobjs="$oldobjs $obj" ;;
7447 eval cmds=\"$old_archive_cmds\"
7450 len=$func_len_result
7451 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7452 cmds=$old_archive_cmds
7454 # the command line is too long to link in one step, link in parts
7455 func_verbose "using piecewise archive linking..."
7460 save_oldobjs=$oldobjs
7462 # Is there a better way of finding the last object in the list?
7463 for obj in $save_oldobjs
7467 eval test_cmds=\"$old_archive_cmds\"
7468 func_len " $test_cmds"
7469 len0=$func_len_result
7471 for obj in $save_oldobjs
7474 func_arith $len + $func_len_result
7475 len=$func_arith_result
7476 func_append objlist " $obj"
7477 if test "$len" -lt "$max_cmd_len"; then
7480 # the above command should be used before it gets too long
7482 if test "$obj" = "$last_oldobj" ; then
7485 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7486 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
7493 if test "X$oldobjs" = "X" ; then
7494 eval cmds=\"\$concat_cmds\"
7496 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
7500 func_execute_cmds "$cmds" 'exit $?'
7503 test -n "$generated" && \
7504 func_show_eval "${RM}r$generated"
7506 # Now create the libtool archive.
7510 test "$build_old_libs" = yes && old_library="$libname.$libext"
7511 func_verbose "creating $output"
7513 # Preserve any variables that may affect compiler behavior
7514 for var in $variables_saved_for_relink; do
7515 if eval test -z \"\${$var+set}\"; then
7516 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7517 elif eval var_value=\$$var; test -z "$var_value"; then
7518 relink_command="$var=; export $var; $relink_command"
7520 func_quote_for_eval "$var_value"
7521 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7524 # Quote the link command for shipping.
7525 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
7526 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7527 if test "$hardcode_automatic" = yes ; then
7531 # Only create the output if not a dry run.
7533 for installed in no yes; do
7534 if test "$installed" = yes; then
7535 if test -z "$install_libdir"; then
7538 output="$output_objdir/$outputname"i
7539 # Replace all uninstalled libtool libraries with the installed ones
7541 for deplib in $dependency_libs; do
7544 func_basename "$deplib"
7545 name="$func_basename_result"
7546 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7547 test -z "$libdir" && \
7548 func_fatal_error "\`$deplib' is not a valid libtool archive"
7549 newdependency_libs="$newdependency_libs $libdir/$name"
7551 *) newdependency_libs="$newdependency_libs $deplib" ;;
7554 dependency_libs="$newdependency_libs"
7557 for lib in $dlfiles; do
7560 func_basename "$lib"
7561 name="$func_basename_result"
7562 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7563 test -z "$libdir" && \
7564 func_fatal_error "\`$lib' is not a valid libtool archive"
7565 newdlfiles="$newdlfiles $libdir/$name"
7567 *) newdlfiles="$newdlfiles $lib" ;;
7570 dlfiles="$newdlfiles"
7572 for lib in $dlprefiles; do
7575 # Only pass preopened files to the pseudo-archive (for
7576 # eventual linking with the app. that links it) if we
7577 # didn't already link the preopened objects directly into
7579 func_basename "$lib"
7580 name="$func_basename_result"
7581 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7582 test -z "$libdir" && \
7583 func_fatal_error "\`$lib' is not a valid libtool archive"
7584 newdlprefiles="$newdlprefiles $libdir/$name"
7588 dlprefiles="$newdlprefiles"
7591 for lib in $dlfiles; do
7593 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7594 *) abs=`pwd`"/$lib" ;;
7596 newdlfiles="$newdlfiles $abs"
7598 dlfiles="$newdlfiles"
7600 for lib in $dlprefiles; do
7602 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7603 *) abs=`pwd`"/$lib" ;;
7605 newdlprefiles="$newdlprefiles $abs"
7607 dlprefiles="$newdlprefiles"
7610 # place dlname in correct position for cygwin
7612 case $host,$output,$installed,$module,$dlname in
7613 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
7616 # $outputname - a libtool library file
7617 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
7619 # Please DO NOT delete this file!
7620 # It is necessary for linking the library.
7622 # The name that we can dlopen(3).
7625 # Names of this library.
7626 library_names='$library_names'
7628 # The name of the static archive.
7629 old_library='$old_library'
7631 # Linker flags that can not go in dependency_libs.
7632 inherited_linker_flags='$new_inherited_linker_flags'
7634 # Libraries that this one depends upon.
7635 dependency_libs='$dependency_libs'
7637 # Names of additional weak libraries provided by this library
7638 weak_library_names='$weak_libs'
7640 # Version information for $libname.
7645 # Is this an already installed library?
7646 installed=$installed
7648 # Should we warn about portability when linking against -modules?
7649 shouldnotlink=$module
7651 # Files to dlopen/dlpreopen
7653 dlpreopen='$dlprefiles'
7655 # Directory that this library needs to be installed in:
7656 libdir='$install_libdir'"
7657 if test "$installed" = no && test "$need_relink" = yes; then
7659 relink_command=\"$relink_command\""
7664 # Do a symbolic link so that the libtool archive can be found in
7665 # LD_LIBRARY_PATH before the program is installed.
7666 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
7672 { test "$mode" = link || test "$mode" = relink; } &&
7673 func_mode_link ${1+"$@"}
7676 # func_mode_uninstall arg...
7677 func_mode_uninstall ()
7685 # This variable tells wrapper scripts just to set variables rather
7686 # than running their programs.
7687 libtool_install_magic="$magic"
7692 -f) RM="$RM $arg"; rmforce=yes ;;
7693 -*) RM="$RM $arg" ;;
7694 *) files="$files $arg" ;;
7699 func_fatal_help "you must specify an RM program"
7703 origobjdir="$objdir"
7704 for file in $files; do
7705 func_dirname "$file" "" "."
7706 dir="$func_dirname_result"
7707 if test "X$dir" = X.; then
7708 objdir="$origobjdir"
7710 objdir="$dir/$origobjdir"
7712 func_basename "$file"
7713 name="$func_basename_result"
7714 test "$mode" = uninstall && objdir="$dir"
7716 # Remember objdir for removal later, being careful to avoid duplicates
7717 if test "$mode" = clean; then
7720 *) rmdirs="$rmdirs $objdir" ;;
7724 # Don't error if the file doesn't exist and rm -f was used.
7725 if { test -L "$file"; } >/dev/null 2>&1 ||
7726 { test -h "$file"; } >/dev/null 2>&1 ||
7727 test -f "$file"; then
7729 elif test -d "$file"; then
7732 elif test "$rmforce" = yes; then
7740 # Possibly a libtool archive, so verify it.
7741 if func_lalib_p "$file"; then
7742 func_source $dir/$name
7744 # Delete the libtool libraries and symlinks.
7745 for n in $library_names; do
7746 rmfiles="$rmfiles $objdir/$n"
7748 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
7752 case " $library_names " in
7753 # " " in the beginning catches empty $dlname
7755 *) rmfiles="$rmfiles $objdir/$dlname" ;;
7757 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
7760 if test -n "$library_names"; then
7761 # Do each command in the postuninstall commands.
7762 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
7765 if test -n "$old_library"; then
7766 # Do each command in the old_postuninstall commands.
7767 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
7769 # FIXME: should reinstall the best remaining shared library.
7776 # Possibly a libtool object, so verify it.
7777 if func_lalib_p "$file"; then
7780 func_source $dir/$name
7782 # Add PIC object to the list of files to remove.
7783 if test -n "$pic_object" &&
7784 test "$pic_object" != none; then
7785 rmfiles="$rmfiles $dir/$pic_object"
7788 # Add non-PIC object to the list of files to remove.
7789 if test -n "$non_pic_object" &&
7790 test "$non_pic_object" != none; then
7791 rmfiles="$rmfiles $dir/$non_pic_object"
7797 if test "$mode" = clean ; then
7801 func_stripname '' '.exe' "$file"
7802 file=$func_stripname_result
7803 func_stripname '' '.exe' "$name"
7804 noexename=$func_stripname_result
7805 # $file with .exe has already been added to rmfiles,
7806 # add $file without .exe
7807 rmfiles="$rmfiles $file"
7810 # Do a test to see if this is a libtool program.
7811 if func_ltwrapper_p "$file"; then
7812 if func_ltwrapper_executable_p "$file"; then
7813 func_ltwrapper_scriptname "$file"
7815 func_source $func_ltwrapper_scriptname_result
7816 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
7819 func_source $dir/$noexename
7822 # note $name still contains .exe if it was in $file originally
7823 # as does the version of $file that was added into $rmfiles
7824 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
7825 if test "$fast_install" = yes && test -n "$relink_command"; then
7826 rmfiles="$rmfiles $objdir/lt-$name"
7828 if test "X$noexename" != "X$name" ; then
7829 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
7835 func_show_eval "$RM $rmfiles" 'exit_status=1'
7837 objdir="$origobjdir"
7839 # Try to remove the ${objdir}s in the directories where we deleted files
7840 for dir in $rmdirs; do
7841 if test -d "$dir"; then
7842 func_show_eval "rmdir $dir >/dev/null 2>&1"
7849 { test "$mode" = uninstall || test "$mode" = clean; } &&
7850 func_mode_uninstall ${1+"$@"}
7852 test -z "$mode" && {
7853 help="$generic_help"
7854 func_fatal_help "you must specify a MODE"
7857 test -z "$exec_cmd" && \
7858 func_fatal_help "invalid operation mode \`$mode'"
7860 if test -n "$exec_cmd"; then
7861 eval exec "$exec_cmd"
7868 # The TAGs below are defined such that we never get into a situation
7869 # in which we disable both kinds of libraries. Given conflicting
7870 # choices, we go for a static library, that is the most portable,
7871 # since we can't tell whether shared libraries were disabled because
7872 # the user asked for that or because the platform doesn't support
7873 # them. This is particularly important on AIX, because we don't
7874 # support having both static and shared libraries enabled at the same
7875 # time on that platform, so we default to a shared-only configuration.
7876 # If a disable-shared tag is given, we'll fallback to a static-only
7877 # configuration. But we'll never go from static-only to shared-only.
7879 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
7880 build_libtool_libs=no
7882 # ### END LIBTOOL TAG CONFIG: disable-shared
7884 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
7885 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
7886 # ### END LIBTOOL TAG CONFIG: disable-static