1 # Generated from ltmain.m4sh.
3 # ltmain.sh (GNU libtool) 2.2.2
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.2
69 # automake: $automake_version
70 # autoconf: $autoconf_version
72 # Report bugs to <bug-libtool@gnu.org>.
78 package_revision=1.2627
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 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
148 # is ksh but when the shell is invoked as "sh" and the current value of
149 # the _XPG environment variable is not equal to 1 (one), the special
150 # positional parameter $0, within a function call, is the name of the
154 # The name of this program:
155 # In the unlikely event $progname began with a '-', it would play havoc with
156 # func_echo (imagine progname=-n), so we prepend ./ in that case:
157 progname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'`
159 # Make sure we have an absolute path for reexecution:
161 [\\/]*|[A-Za-z]:\\*) ;;
163 progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"`
164 progdir=`cd "$progdir" && pwd`
165 progpath="$progdir/$progname"
170 for progdir in $PATH; do
172 test -x "$progdir/$progname" && break
175 test -n "$progdir" || progdir=`pwd`
176 progpath="$progdir/$progname"
180 # Sed substitution that helps us do robust quoting. It backslashifies
181 # metacharacters that are still active within double-quoted strings.
182 Xsed="${SED}"' -e 1s/^X//'
183 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
185 # Same as above, but do not quote variable references.
186 double_quote_subst='s/\(["`\\]\)/\\\1/g'
188 # Re-`\' parameter expansions in output of double_quote_subst that were
189 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
190 # in input to double_quote_subst, that '$' was protected from expansion.
191 # Since each input `\' is now two `\'s, look for any number of runs of
192 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
197 sed_double_backslash="\
201 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
211 # Echo program name prefixed message, along with the current mode
212 # name if it has been set yet.
215 $ECHO "$progname${mode+: }$mode: $*"
218 # func_verbose arg...
219 # Echo program name prefixed message in verbose mode only.
222 $opt_verbose && func_echo ${1+"$@"}
224 # A bug in bash halts the script if the last line of a function
225 # fails when set -e is in force, so we need another command to
231 # Echo program name prefixed message to standard error.
234 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
237 # func_warning arg...
238 # Echo program name prefixed warning message to standard error.
241 $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
244 # func_fatal_error arg...
245 # Echo program name prefixed message to standard error, and exit.
252 # func_fatal_help arg...
253 # Echo program name prefixed message to standard error, followed by
254 # a help hint, and exit.
258 func_fatal_error "$help"
260 help="Try \`$progname --help' for more information." ## default
263 # func_grep expression filename
264 # Check whether EXPRESSION matches any line of FILENAME, without output.
267 $GREP "$1" "$2" >/dev/null 2>&1
271 # func_mkdir_p directory-path
272 # Make sure the entire path to DIRECTORY-PATH is available.
275 my_directory_path="$1"
278 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
280 # Protect directory names starting with `-'
281 case $my_directory_path in
282 -*) my_directory_path="./$my_directory_path" ;;
285 # While some portion of DIR does not yet exist...
286 while test ! -d "$my_directory_path"; do
287 # ...make a list in topmost first order. Use a colon delimited
288 # list incase some portion of path contains whitespace.
289 my_dir_list="$my_directory_path:$my_dir_list"
291 # If the last portion added has no slash in it, the list is done
292 case $my_directory_path in */*) ;; *) break ;; esac
294 # ...otherwise throw away the child directory and loop
295 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
297 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
299 save_mkdir_p_IFS="$IFS"; IFS=':'
300 for my_dir in $my_dir_list; do
301 IFS="$save_mkdir_p_IFS"
302 # mkdir can fail with a `File exist' error if two processes
303 # try to create one of the directories concurrently. Don't
305 $MKDIR "$my_dir" 2>/dev/null || :
307 IFS="$save_mkdir_p_IFS"
309 # Bail out if we (or some other process) failed to create a directory.
310 test -d "$my_directory_path" || \
311 func_fatal_error "Failed to create \`$1'"
316 # func_mktempdir [string]
317 # Make a temporary directory that won't clash with other running
318 # libtool processes, and avoids race conditions if possible. If
319 # given, STRING is the basename for that directory.
322 my_template="${TMPDIR-/tmp}/${1-$progname}"
324 if test "$opt_dry_run" = ":"; then
325 # Return a directory name, but don't create it in dry-run mode
326 my_tmpdir="${my_template}-$$"
329 # If mktemp works, use that first and foremost
330 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
332 if test ! -d "$my_tmpdir"; then
333 # Failing that, at least try and use $RANDOM to avoid a race
334 my_tmpdir="${my_template}-${RANDOM-0}$$"
336 save_mktempdir_umask=`umask`
339 umask $save_mktempdir_umask
342 # If we're not in dry-run mode, bomb out on failure
343 test -d "$my_tmpdir" || \
344 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
347 $ECHO "X$my_tmpdir" | $Xsed
351 # func_quote_for_eval arg
352 # Aesthetically quote ARG to be evaled later.
353 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
354 # is double-quoted, suitable for a subsequent eval, whereas
355 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
356 # which are still active within double quotes backslashified.
357 func_quote_for_eval ()
361 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
363 func_quote_for_eval_unquoted_result="$1" ;;
366 case $func_quote_for_eval_unquoted_result in
367 # Double-quote args containing shell metacharacters to delay
368 # word splitting, command substitution and and variable
369 # expansion for a subsequent eval.
370 # Many Bourne shells cannot handle close brackets correctly
371 # in scan sets, so we specify it separately.
372 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
373 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
376 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
381 # func_quote_for_expand arg
382 # Aesthetically quote ARG to be evaled later; same as above,
383 # but do not quote variable references.
384 func_quote_for_expand ()
388 my_arg=`$ECHO "X$1" | $Xsed \
389 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
395 # Double-quote args containing shell metacharacters to delay
396 # word splitting and command substitution for a subsequent eval.
397 # Many Bourne shells cannot handle close brackets correctly
398 # in scan sets, so we specify it separately.
399 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
404 func_quote_for_expand_result="$my_arg"
408 # func_show_eval cmd [fail_exp]
409 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
410 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
411 # is given, then evaluate it.
417 ${opt_silent-false} || {
418 func_quote_for_expand "$my_cmd"
419 eval "func_echo $func_quote_for_expand_result"
422 if ${opt_dry_run-false}; then :; else
425 if test "$my_status" -eq 0; then :; else
426 eval "(exit $my_status); $my_fail_exp"
432 # func_show_eval_locale cmd [fail_exp]
433 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
434 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
435 # is given, then evaluate it. Use the saved locale for evaluation.
436 func_show_eval_locale ()
441 ${opt_silent-false} || {
442 func_quote_for_expand "$my_cmd"
443 eval "func_echo $func_quote_for_expand_result"
446 if ${opt_dry_run-false}; then :; else
447 eval "$lt_user_locale
450 eval "$lt_safe_locale"
451 if test "$my_status" -eq 0; then :; else
452 eval "(exit $my_status); $my_fail_exp"
462 # Echo version message to standard output and exit.
465 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
468 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
475 # Echo short help message to standard output and exit.
478 $SED -n '/^# Usage:/,/# -h/ {
481 s/\$progname/'$progname'/
485 $ECHO "run \`$progname --help | more' for full usage"
490 # Echo long help message to standard output and exit.
493 $SED -n '/^# Usage:/,/# Report bugs to/ {
496 s*\$progname*'$progname'*
498 s*\$SHELL*'"$SHELL"'*
500 s*\$LTCFLAGS*'"$LTCFLAGS"'*
502 s/\$with_gnu_ld/'"$with_gnu_ld"'/
503 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
504 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
510 # func_missing_arg argname
511 # Echo program name prefixed message to standard error and set global
515 func_error "missing argument for $1"
525 # Check that we have a working $ECHO.
526 if test "X$1" = X--no-reexec; then
527 # Discard the --no-reexec flag, and continue.
529 elif test "X$1" = X--fallback-echo; then
530 # Avoid inline document here, it may be left over
532 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
533 # Yippee, $ECHO works!
536 # Restart under the correct shell, and then maybe $ECHO will work.
537 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
540 if test "X$1" = X--fallback-echo; then
541 # used as fallback echo
549 magic="%%%MAGIC variable%%%"
550 magic_exe="%%%MAGIC EXE variable%%%"
557 lo2o="s/\\.lo\$/.${objext}/"
558 o2lo="s/\\.${objext}\$/.lo/"
563 opt_duplicate_deps=false
567 # If this variable is set in any of the actions, the command in it
568 # will be execed at the end. This prevents here-documents from being
569 # left over by shells.
572 # func_fatal_configuration arg...
573 # Echo program name prefixed message to standard error, followed by
574 # a configuration failure hint, and exit.
575 func_fatal_configuration ()
578 func_error "See the $PACKAGE documentation for more information."
579 func_fatal_error "Fatal configuration error."
584 # Display the configuration for all the tags in this script.
587 re_begincf='^# ### BEGIN LIBTOOL'
588 re_endcf='^# ### END LIBTOOL'
590 # Default configuration.
591 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
593 # Now print the configurations for the tags.
594 for tagname in $taglist; do
595 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
602 # Display the features supported by this script.
606 if test "$build_libtool_libs" = yes; then
607 $ECHO "enable shared libraries"
609 $ECHO "disable shared libraries"
611 if test "$build_old_libs" = yes; then
612 $ECHO "enable static libraries"
614 $ECHO "disable static libraries"
620 # func_enable_tag tagname
621 # Verify that TAGNAME is valid, and either flag an error and exit, or
622 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
629 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
630 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
631 sed_extractcf="/$re_begincf/,/$re_endcf/p"
636 func_fatal_error "invalid tag name: $tagname"
640 # Don't test for the "default" C tag, as we know it's
641 # there but not specially marked.
645 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
646 taglist="$taglist $tagname"
648 # Evaluate the configuration. Be careful to quote the path
649 # and the sed script, to avoid splitting on whitespace, but
650 # also don't use non-portable quotes within backquotes within
651 # quotes we have to do it in 2 steps:
652 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
655 func_error "ignoring unknown tag $tagname"
664 # We need to display help for each of the modes.
667 # Generic help is extracted from the usage comments
668 # at the start of this file.
674 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
676 Remove files from the build directory.
678 RM is the name of the program to use to delete files associated with each FILE
679 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
682 If FILE is a libtool library, object or program, all the files associated
683 with it are deleted. Otherwise, only FILE itself is deleted using RM."
688 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
690 Compile a source file into a libtool library object.
692 This mode accepts the following additional options:
694 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
695 -no-suppress do not suppress compiler output for multiple passes
696 -prefer-pic try to building PIC objects only
697 -prefer-non-pic try to building non-PIC objects only
698 -shared do not build a \`.o' file suitable for static linking
699 -static only build a \`.o' file suitable for static linking
701 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
702 from the given SOURCEFILE.
704 The output file name is determined by removing the directory component from
705 SOURCEFILE, then substituting the C source code suffix \`.c' with the
706 library object suffix, \`.lo'."
711 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
713 Automatically set library path, then run a program.
715 This mode accepts the following additional options:
717 -dlopen FILE add the directory containing FILE to the library path
719 This mode sets the library path environment variable according to \`-dlopen'
722 If any of the ARGS are libtool executable wrappers, then they are translated
723 into their corresponding uninstalled binary, and any of their required library
724 directories are added to the library path.
726 Then, COMMAND is executed, with ARGS as arguments."
731 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
733 Complete the installation of libtool libraries.
735 Each LIBDIR is a directory that contains libtool libraries.
737 The commands that this mode executes may require superuser privileges. Use
738 the \`--dry-run' option if you just want to see what would be executed."
743 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
745 Install executables or libraries.
747 INSTALL-COMMAND is the installation command. The first component should be
748 either the \`install' or \`cp' program.
750 The following components of INSTALL-COMMAND are treated specially:
752 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
754 The rest of the components are interpreted as arguments to that command (only
755 BSD-compatible install options are recognized)."
760 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
762 Link object files or libraries together to form another library, or to
763 create an executable program.
765 LINK-COMMAND is a command using the C compiler that you would use to create
766 a program from several object files.
768 The following components of LINK-COMMAND are treated specially:
770 -all-static do not do any dynamic linking at all
771 -avoid-version do not add a version suffix if possible
772 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
773 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
774 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
775 -export-symbols SYMFILE
776 try to export only the symbols listed in SYMFILE
777 -export-symbols-regex REGEX
778 try to export only the symbols matching REGEX
779 -LLIBDIR search LIBDIR for required installed libraries
780 -lNAME OUTPUT-FILE requires the installed library libNAME
781 -module build a library that can dlopened
782 -no-fast-install disable the fast-install mode
783 -no-install link a not-installable executable
784 -no-undefined declare that a library does not refer to external symbols
785 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
786 -objectlist FILE Use a list of object files found in FILE to specify objects
787 -precious-files-regex REGEX
788 don't remove output files matching REGEX
789 -release RELEASE specify package release information
790 -rpath LIBDIR the created library will eventually be installed in LIBDIR
791 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
792 -shared only do dynamic linking of libtool libraries
793 -shrext SUFFIX override the standard shared library file extension
794 -static do not do any dynamic linking of uninstalled libtool libraries
796 do not do any dynamic linking of libtool libraries
797 -version-info CURRENT[:REVISION[:AGE]]
798 specify library version info [each variable defaults to 0]
799 -weak LIBNAME declare that the target provides the LIBNAME interface
801 All other options (arguments beginning with \`-') are ignored.
803 Every other argument is treated as a filename. Files ending in \`.la' are
804 treated as uninstalled libtool libraries, other files are standard or library
807 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
808 only library objects (\`.lo' files) may be specified, and \`-rpath' is
809 required, except when creating a convenience library.
811 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
812 using \`ar' and \`ranlib', or on Windows using \`lib'.
814 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
815 is created, otherwise an executable program is created."
820 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
822 Remove libraries from an installation directory.
824 RM is the name of the program to use to delete files associated with each FILE
825 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
828 If FILE is a libtool library, all the files associated with it are deleted.
829 Otherwise, only FILE itself is deleted using RM."
833 func_fatal_help "invalid operation mode \`$mode'"
838 $ECHO "Try \`$progname --help' for more information about other modes."
843 # Generated shell functions inserted here.
846 # Parse options once, thoroughly. This comes as soon as possible in
847 # the script to make things like `libtool --version' happen quickly.
850 # Shorthand for --mode=foo, only valid as the first argument
853 shift; set dummy --mode clean ${1+"$@"}; shift
855 compile|compil|compi|comp|com|co|c)
856 shift; set dummy --mode compile ${1+"$@"}; shift
858 execute|execut|execu|exec|exe|ex|e)
859 shift; set dummy --mode execute ${1+"$@"}; shift
861 finish|finis|fini|fin|fi|f)
862 shift; set dummy --mode finish ${1+"$@"}; shift
864 install|instal|insta|inst|ins|in|i)
865 shift; set dummy --mode install ${1+"$@"}; shift
868 shift; set dummy --mode link ${1+"$@"}; shift
870 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
871 shift; set dummy --mode uninstall ${1+"$@"}; shift
875 # Parse non-mode specific arguments:
876 while test "$#" -gt 0; do
881 --config) func_config ;;
883 --debug) preserve_args="$preserve_args $opt"
884 func_echo "enabling shell trace mode"
889 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
890 execute_dlfiles="$execute_dlfiles $1"
894 --dry-run | -n) opt_dry_run=: ;;
895 --features) func_features ;;
896 --finish) mode="finish" ;;
898 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
900 # Valid mode arguments:
910 # Catch anything else as an error
911 *) func_error "invalid argument for $opt"
922 opt_duplicate_deps=: ;;
924 --quiet|--silent) preserve_args="$preserve_args $opt"
928 --verbose| -v) preserve_args="$preserve_args $opt"
932 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
933 preserve_args="$preserve_args $opt $1"
934 func_enable_tag "$1" # tagname is set here
938 # Separate optargs to long options:
939 -dlopen=*|--mode=*|--tag=*)
940 func_opt_split "$opt"
941 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
945 -\?|-h) func_usage ;;
946 --help) opt_help=: ;;
947 --version) func_version ;;
949 -*) func_fatal_help "unrecognized option \`$opt'" ;;
957 # Now that we've collected a possible --mode arg, show help if necessary
958 $opt_help && func_mode_help
961 *cygwin* | *mingw* | *pw32*)
962 # don't eliminate duplications in $postdeps and $predeps
963 opt_duplicate_compiler_generated_deps=:
966 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
970 # Having warned about all mis-specified options, bail out if
971 # anything was wrong.
972 $exit_cmd $EXIT_FAILURE
975 # func_check_version_match
976 # Ensure that we are using m4 macros, and libtool script from the same
977 # release of libtool.
978 func_check_version_match ()
980 if test "$package_revision" != "$macro_revision"; then
981 if test "$VERSION" != "$macro_version"; then
982 if test -z "$macro_version"; then
984 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
985 $progname: definition of this LT_INIT comes from an older release.
986 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
987 $progname: and run autoconf again.
991 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
992 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
993 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
994 $progname: and run autoconf again.
999 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1000 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1001 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1002 $progname: of $PACKAGE $VERSION and run autoconf again.
1016 # Sanity checks first:
1017 func_check_version_match
1019 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1020 func_fatal_configuration "not configured to build any kind of library"
1023 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1027 eval std_shrext=\"$shrext_cmds\"
1030 # Only execute mode is allowed to have -dlopen flags.
1031 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1032 func_error "unrecognized option \`-dlopen'"
1037 # Change the help message to a mode-specific one.
1038 generic_help="$help"
1039 help="Try \`$progname --help --mode=$mode' for more information."
1044 # True iff FILE is a libtool `.la' library or `.lo' object file.
1045 # This function is only a basic sanity check; it will hardly flush out
1046 # determined imposters.
1049 $SED -e 4q "$1" 2>/dev/null \
1050 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1053 # func_lalib_unsafe_p file
1054 # True iff FILE is a libtool `.la' library or `.lo' object file.
1055 # This function implements the same check as func_lalib_p without
1056 # resorting to external programs. To this end, it redirects stdin and
1057 # closes it afterwards, without saving the original file descriptor.
1058 # As a safety measure, use it only where a negative result would be
1059 # fatal anyway. Works if `file' does not exist.
1060 func_lalib_unsafe_p ()
1063 if test -r "$1" && exec 5<&0 <"$1"; then
1064 for lalib_p_l in 1 2 3 4
1067 case "$lalib_p_line" in
1068 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1073 test "$lalib_p" = yes
1076 # func_ltwrapper_script_p file
1077 # True iff FILE is a libtool wrapper script
1078 # This function is only a basic sanity check; it will hardly flush out
1079 # determined imposters.
1080 func_ltwrapper_script_p ()
1085 # func_ltwrapper_executable_p file
1086 # True iff FILE is a libtool wrapper executable
1087 # This function is only a basic sanity check; it will hardly flush out
1088 # determined imposters.
1089 func_ltwrapper_executable_p ()
1091 func_ltwrapper_exec_suffix=
1094 *) func_ltwrapper_exec_suffix=.exe ;;
1096 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1099 # func_ltwrapper_scriptname file
1100 # Assumes file is an ltwrapper_executable
1101 # uses $file to determine the appropriate filename for a
1102 # temporary ltwrapper_script.
1103 func_ltwrapper_scriptname ()
1105 func_ltwrapper_scriptname_result=""
1106 if func_ltwrapper_executable_p "$1"; then
1107 func_dirname_and_basename "$1" "" "."
1108 func_stripname '' '.exe' "$func_basename_result"
1109 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1113 # func_ltwrapper_p file
1114 # True iff FILE is a libtool wrapper script or wrapper executable
1115 # This function is only a basic sanity check; it will hardly flush out
1116 # determined imposters.
1119 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1123 # func_execute_cmds commands fail_cmd
1124 # Execute tilde-delimited COMMANDS.
1125 # If FAIL_CMD is given, eval that upon failure.
1126 # FAIL_CMD may read-access the current command in variable CMD!
1127 func_execute_cmds ()
1130 save_ifs=$IFS; IFS='~'
1134 func_show_eval "$cmd" "${2-:}"
1141 # Source FILE, adding directory component if necessary.
1142 # Note that it is not necessary on cygwin/mingw to append a dot to
1143 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1144 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1145 # `FILE.' does not work on cygwin managed mounts.
1150 */* | *\\*) . "$1" ;;
1156 # func_win32_libid arg
1157 # return the library type of file 'arg'
1159 # Need a lot of goo to handle *both* DLLs and import libs
1160 # Has to be a shell function in order to 'eat' the argument
1161 # that is supplied when $file_magic_command is called.
1165 win32_libid_type="unknown"
1166 win32_fileres=`file -L $1 2>/dev/null`
1167 case $win32_fileres in
1168 *ar\ archive\ import\ library*) # definitely import
1169 win32_libid_type="x86 archive import"
1171 *ar\ archive*) # could be an import, or static
1172 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
1173 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1174 win32_nmres=`eval $NM -f posix -A $1 |
1183 case $win32_nmres in
1184 import*) win32_libid_type="x86 archive import";;
1185 *) win32_libid_type="x86 archive static";;
1190 win32_libid_type="x86 DLL"
1192 *executable*) # but shell scripts are "executable" too...
1193 case $win32_fileres in
1194 *MS\ Windows\ PE\ Intel*)
1195 win32_libid_type="x86 DLL"
1200 $ECHO "$win32_libid_type"
1205 # func_infer_tag arg
1206 # Infer tagged configuration to use if any are available and
1207 # if one wasn't chosen via the "--tag" command line option.
1208 # Only attempt this if the compiler in the base compile
1209 # command doesn't match the default compiler.
1210 # arg is usually of the form 'gcc ...'
1214 if test -n "$available_tags" && test -z "$tagname"; then
1217 func_quote_for_eval "$arg"
1218 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1221 # Blanks in the command may have been stripped by the calling shell,
1222 # but not from the CC environment variable when configure was run.
1223 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1224 # Blanks at the start of $base_compile will cause this to fail
1225 # if we don't check for them as well.
1227 for z in $available_tags; do
1228 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1229 # Evaluate the configuration.
1230 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1233 # Double-quote args containing other shell metacharacters.
1234 func_quote_for_eval "$arg"
1235 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1238 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1239 # The compiler in the base compile command matches
1240 # the one in the tagged configuration.
1241 # Assume this is the tagged configuration we want.
1248 # If $tagname still isn't set, then no tagged configuration
1249 # was found and let the user know that the "--tag" command
1250 # line option must be used.
1251 if test -z "$tagname"; then
1252 func_echo "unable to infer tagged configuration"
1253 func_fatal_error "specify a tag with \`--tag'"
1255 # func_verbose "using $tagname tagged configuration"
1264 # func_generate_dlsyms outputname originator pic_p
1265 # Extract symbols from dlprefiles and create ${outputname}S.o with
1266 # a dlpreopen symbol table.
1267 func_generate_dlsyms ()
1273 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
1276 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1277 if test -n "$NM" && test -n "$global_symbol_pipe"; then
1278 my_dlsyms="${my_outputname}S.c"
1280 func_error "not configured to extract global symbols from dlpreopened files"
1284 if test -n "$my_dlsyms"; then
1288 # Discover the nlist of each of the dlfiles.
1289 nlist="$output_objdir/${my_outputname}.nm"
1291 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
1293 # Parse the name list into a source file.
1294 func_verbose "creating $output_objdir/$my_dlsyms"
1296 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
1297 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
1298 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
1304 /* External symbol declarations for the compiler. */\
1307 if test "$dlself" = yes; then
1308 func_verbose "generating symbol list for \`$output'"
1310 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
1312 # Add our own program objects to the symbol list.
1313 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1314 for progfile in $progfiles; do
1315 func_verbose "extracting global C symbols from \`$progfile'"
1316 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
1319 if test -n "$exclude_expsyms"; then
1321 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
1322 eval '$MV "$nlist"T "$nlist"'
1326 if test -n "$export_symbols_regex"; then
1328 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
1329 eval '$MV "$nlist"T "$nlist"'
1333 # Prepare the list of exported symbols
1334 if test -z "$export_symbols"; then
1335 export_symbols="$output_objdir/$outputname.exp"
1338 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
1340 *cygwin* | *mingw* )
1341 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1342 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
1348 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
1349 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
1350 eval '$MV "$nlist"T "$nlist"'
1353 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1354 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
1361 for dlprefile in $dlprefiles; do
1362 func_verbose "extracting global C symbols from \`$dlprefile'"
1363 func_basename "$dlprefile"
1364 name="$func_basename_result"
1366 eval '$ECHO ": $name " >> "$nlist"'
1367 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
1372 # Make sure we have at least an empty file.
1373 test -f "$nlist" || : > "$nlist"
1375 if test -n "$exclude_expsyms"; then
1376 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
1377 $MV "$nlist"T "$nlist"
1380 # Try sorting and uniquifying the output.
1381 if $GREP -v "^: " < "$nlist" |
1382 if sort -k 3 </dev/null >/dev/null 2>&1; then
1387 uniq > "$nlist"S; then
1390 $GREP -v "^: " < "$nlist" > "$nlist"S
1393 if test -f "$nlist"S; then
1394 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
1396 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
1399 $ECHO >> "$output_objdir/$my_dlsyms" "\
1401 /* The mapping between symbol names and symbols. */
1408 *cygwin* | *mingw* )
1409 $ECHO >> "$output_objdir/$my_dlsyms" "\
1410 /* DATA imports from DLLs on WIN32 con't be const, because
1411 runtime relocations are performed -- see ld's documentation
1412 on pseudo-relocs. */"
1415 echo >> "$output_objdir/$my_dlsyms" "\
1416 /* This system does not cope well with relocations in const data */"
1419 lt_dlsym_const=const ;;
1422 $ECHO >> "$output_objdir/$my_dlsyms" "\
1423 extern $lt_dlsym_const lt_dlsymlist
1424 lt_${my_prefix}_LTX_preloaded_symbols[];
1425 $lt_dlsym_const lt_dlsymlist
1426 lt_${my_prefix}_LTX_preloaded_symbols[] =
1428 { \"$my_originator\", (void *) 0 },"
1430 case $need_lib_prefix in
1432 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
1435 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
1438 $ECHO >> "$output_objdir/$my_dlsyms" "\
1442 /* This works around a problem in FreeBSD linker */
1443 #ifdef FREEBSD_WORKAROUND
1444 static const void *lt_preloaded_setup() {
1445 return lt_${my_prefix}_LTX_preloaded_symbols;
1455 pic_flag_for_symtable=
1456 case "$compile_command " in
1460 # compiling the symbol table file with pic_flag works around
1461 # a FreeBSD bug that causes programs to crash when -lm is
1462 # linked before any other PIC object. But we must not use
1463 # pic_flag when linking with -static. The problem exists in
1464 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
1465 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
1466 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
1468 pic_flag_for_symtable=" $pic_flag" ;;
1470 if test "X$my_pic_p" != Xno; then
1471 pic_flag_for_symtable=" $pic_flag"
1478 for arg in $LTCFLAGS; do
1480 -pie | -fpie | -fPIE) ;;
1481 *) symtab_cflags="$symtab_cflags $arg" ;;
1485 # Now compile the dynamic symbol file.
1486 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
1488 # Clean up the generated files.
1489 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
1491 # Transform the symbol file into the correct name.
1492 symfileobj="$output_objdir/${my_outputname}S.$objext"
1494 *cygwin* | *mingw* )
1495 if test -f "$output_objdir/$my_outputname.def"; then
1496 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1497 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1499 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1500 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1504 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1505 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1510 func_fatal_error "unknown suffix for \`$my_dlsyms'"
1514 # We keep going just in case the user didn't refer to
1515 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
1516 # really was required.
1518 # Nullify the symbol file.
1519 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1520 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1524 # func_extract_an_archive dir oldlib
1525 func_extract_an_archive ()
1528 f_ex_an_ar_dir="$1"; shift
1529 f_ex_an_ar_oldlib="$1"
1530 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
1531 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
1534 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
1539 # func_extract_archives gentop oldlib ...
1540 func_extract_archives ()
1543 my_gentop="$1"; shift
1544 my_oldlibs=${1+"$@"}
1550 for my_xlib in $my_oldlibs; do
1551 # Extract the objects.
1553 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
1554 *) my_xabs=`pwd`"/$my_xlib" ;;
1556 func_basename "$my_xlib"
1557 my_xlib="$func_basename_result"
1560 case " $extracted_archives " in
1562 extracted_serial=`expr $extracted_serial + 1`
1563 my_xlib_u=lt$extracted_serial-$my_xlib ;;
1567 extracted_archives="$extracted_archives $my_xlib_u"
1568 my_xdir="$my_gentop/$my_xlib_u"
1570 func_mkdir_p "$my_xdir"
1574 func_verbose "Extracting $my_xabs"
1575 # Do not bother doing anything if just a dry run
1577 darwin_orig_dir=`pwd`
1578 cd $my_xdir || exit $?
1579 darwin_archive=$my_xabs
1581 darwin_base_archive=`basename "$darwin_archive"`
1582 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
1583 if test -n "$darwin_arches"; then
1584 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
1586 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
1587 for darwin_arch in $darwin_arches ; do
1588 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1589 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
1590 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1591 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
1593 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
1594 done # $darwin_arches
1595 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
1596 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
1599 for darwin_file in $darwin_filelist; do
1600 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
1601 lipo -create -output "$darwin_file" $darwin_files
1602 done # $darwin_filelist
1604 cd "$darwin_orig_dir"
1607 func_extract_an_archive "$my_xdir" "$my_xabs"
1612 func_extract_an_archive "$my_xdir" "$my_xabs"
1615 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
1618 func_extract_archives_result="$my_oldobjs"
1623 # func_write_libtool_object output_name pic_name nonpic_name
1624 # Create a libtool object file (analogous to a ".la" file),
1625 # but don't create it if we're doing a dry run.
1626 func_write_libtool_object ()
1629 if test "$build_libtool_libs" = yes; then
1635 if test "$build_old_libs" = yes; then
1636 write_oldobj=\'${3}\'
1642 cat >${write_libobj}T <<EOF
1643 # $write_libobj - a libtool object file
1644 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1646 # Please DO NOT delete this file!
1647 # It is necessary for linking the library.
1649 # Name of the PIC object.
1650 pic_object=$write_lobj
1652 # Name of the non-PIC object
1653 non_pic_object=$write_oldobj
1656 mv -f "${write_libobj}T" "${write_libobj}"
1660 # func_mode_compile arg...
1661 func_mode_compile ()
1664 # Get the compilation command and the source file.
1666 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1678 # do not "continue". Instead, add this to base_compile
1690 # Accept any command-line options.
1693 test -n "$libobj" && \
1694 func_fatal_error "you cannot specify \`-o' more than once"
1699 -pie | -fpie | -fPIE)
1700 pie_flag="$pie_flag $arg"
1704 -shared | -static | -prefer-pic | -prefer-non-pic)
1715 arg_mode=arg # the next one goes into the "base_compile" arg list
1716 continue # The current "srcfile" will either be retained or
1717 ;; # replaced later. I would guess that would be a bug.
1720 func_stripname '-Wc,' '' "$arg"
1721 args=$func_stripname_result
1723 save_ifs="$IFS"; IFS=','
1724 for arg in $args; do
1726 func_quote_for_eval "$arg"
1727 lastarg="$lastarg $func_quote_for_eval_result"
1730 func_stripname ' ' '' "$lastarg"
1731 lastarg=$func_stripname_result
1733 # Add the arguments to base_compile.
1734 base_compile="$base_compile $lastarg"
1739 # Accept the current argument as the source file.
1740 # The previous "srcfile" becomes the current argument.
1747 esac # case $arg_mode
1749 # Aesthetically quote the previous argument.
1750 func_quote_for_eval "$lastarg"
1751 base_compile="$base_compile $func_quote_for_eval_result"
1756 func_fatal_error "you must specify an argument for -Xcompile"
1759 func_fatal_error "you must specify a target with \`-o'"
1762 # Get the name of the library object.
1763 test -z "$libobj" && {
1764 func_basename "$srcfile"
1765 libobj="$func_basename_result"
1770 # Recognize several different file suffixes.
1771 # If the user specifies -o file.o, it is replaced with file.lo
1781 *.class) xform=class ;;
1784 *.[fF][09]?) xform='[fF][09].' ;;
1786 *.java) xform=java ;;
1791 libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
1794 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1796 func_fatal_error "cannot determine name of library object from \`$libobj'"
1800 func_infer_tag $base_compile
1802 for arg in $later; do
1805 test "$build_libtool_libs" != yes && \
1806 func_fatal_configuration "can not build a shared library"
1812 build_libtool_libs=no
1829 func_quote_for_eval "$libobj"
1830 test "X$libobj" != "X$func_quote_for_eval_result" \
1831 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1832 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1833 func_dirname_and_basename "$obj" "/" ""
1834 objname="$func_basename_result"
1835 xdir="$func_dirname_result"
1836 lobj=${xdir}$objdir/$objname
1838 test -z "$base_compile" && \
1839 func_fatal_help "you must specify a compilation command"
1841 # Delete any leftover library objects.
1842 if test "$build_old_libs" = yes; then
1843 removelist="$obj $lobj $libobj ${libobj}T"
1845 removelist="$lobj $libobj ${libobj}T"
1848 $opt_dry_run || $RM $removelist
1849 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1851 # On Cygwin there's no "real" PIC flag so we must build both object types
1853 cygwin* | mingw* | pw32* | os2*)
1857 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1858 # non-PIC code in shared libraries is not supported
1862 # Calculate the filename of the output object if compiler does
1863 # not support -o with -c
1864 if test "$compiler_c_o" = no; then
1865 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1866 lockfile="$output_obj.lock"
1867 removelist="$removelist $output_obj $lockfile"
1868 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1875 # Lock this critical section if it is needed
1876 # We use this script file to make the link, it avoids creating a new file
1877 if test "$need_locks" = yes; then
1878 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1879 func_echo "Waiting for $lockfile to be removed"
1882 elif test "$need_locks" = warn; then
1883 if test -f "$lockfile"; then
1885 *** ERROR, $lockfile exists and contains:
1886 `cat $lockfile 2>/dev/null`
1888 This indicates that another process is trying to use the same
1889 temporary object file, and libtool could not work around it because
1890 your compiler does not support \`-c' and \`-o' together. If you
1891 repeat this compilation, it may succeed, by chance, but you had better
1892 avoid parallel builds (make -j) in this platform, or get a better
1895 $opt_dry_run || $RM $removelist
1898 $ECHO "$srcfile" > "$lockfile"
1901 if test -n "$fix_srcfile_path"; then
1902 eval srcfile=\"$fix_srcfile_path\"
1904 func_quote_for_eval "$srcfile"
1905 qsrcfile=$func_quote_for_eval_result
1907 $opt_dry_run || $RM "$libobj" "${libobj}T"
1909 # Only build a PIC object if we are building libtool libraries.
1910 if test "$build_libtool_libs" = yes; then
1911 # Without this assignment, base_compile gets emptied.
1912 fbsd_hideous_sh_bug=$base_compile
1914 if test "$pic_mode" != no; then
1915 command="$base_compile $qsrcfile $pic_flag"
1917 # Don't build PIC code
1918 command="$base_compile $qsrcfile"
1921 func_mkdir_p "$xdir$objdir"
1923 if test -z "$output_obj"; then
1924 # Place PIC objects in $objdir
1925 command="$command -o $lobj"
1928 $opt_dry_run || $RM "$lobj" "$output_obj"
1930 func_show_eval_locale "$command" \
1931 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1933 if test "$need_locks" = warn &&
1934 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1936 *** ERROR, $lockfile contains:
1937 `cat $lockfile 2>/dev/null`
1939 but it should contain:
1942 This indicates that another process is trying to use the same
1943 temporary object file, and libtool could not work around it because
1944 your compiler does not support \`-c' and \`-o' together. If you
1945 repeat this compilation, it may succeed, by chance, but you had better
1946 avoid parallel builds (make -j) in this platform, or get a better
1949 $opt_dry_run || $RM $removelist
1953 # Just move the object if needed, then go on to compile the next one
1954 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1955 func_show_eval '$MV "$output_obj" "$lobj"' \
1956 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1959 # Allow error messages only from the first compilation.
1960 if test "$suppress_opt" = yes; then
1961 suppress_output=' >/dev/null 2>&1'
1965 # Only build a position-dependent object if we build old libraries.
1966 if test "$build_old_libs" = yes; then
1967 if test "$pic_mode" != yes; then
1968 # Don't build PIC code
1969 command="$base_compile $qsrcfile$pie_flag"
1971 command="$base_compile $qsrcfile $pic_flag"
1973 if test "$compiler_c_o" = yes; then
1974 command="$command -o $obj"
1977 # Suppress compiler output if we already did a PIC compilation.
1978 command="$command$suppress_output"
1979 $opt_dry_run || $RM "$obj" "$output_obj"
1980 func_show_eval_locale "$command" \
1981 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1983 if test "$need_locks" = warn &&
1984 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1986 *** ERROR, $lockfile contains:
1987 `cat $lockfile 2>/dev/null`
1989 but it should contain:
1992 This indicates that another process is trying to use the same
1993 temporary object file, and libtool could not work around it because
1994 your compiler does not support \`-c' and \`-o' together. If you
1995 repeat this compilation, it may succeed, by chance, but you had better
1996 avoid parallel builds (make -j) in this platform, or get a better
1999 $opt_dry_run || $RM $removelist
2003 # Just move the object if needed
2004 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2005 func_show_eval '$MV "$output_obj" "$obj"' \
2006 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2011 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2013 # Unlock the critical section if it was locked
2014 if test "$need_locks" != no; then
2022 test "$mode" = compile && func_mode_compile ${1+"$@"}
2025 # func_mode_execute arg...
2026 func_mode_execute ()
2029 # The first argument is the command name.
2032 func_fatal_help "you must specify a COMMAND"
2034 # Handle -dlopen flags immediately.
2035 for file in $execute_dlfiles; do
2037 || func_fatal_help "\`$file' is not a file"
2042 # Check to see that this really is a libtool archive.
2043 func_lalib_unsafe_p "$file" \
2044 || func_fatal_help "\`$lib' is not a valid libtool archive"
2046 # Read the libtool library.
2051 # Skip this library if it cannot be dlopened.
2052 if test -z "$dlname"; then
2053 # Warn if it was a shared library.
2054 test -n "$library_names" && \
2055 func_warning "\`$file' was not linked with \`-export-dynamic'"
2059 func_dirname "$file" "" "."
2060 dir="$func_dirname_result"
2062 if test -f "$dir/$objdir/$dlname"; then
2065 if test ! -f "$dir/$dlname"; then
2066 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2072 # Just add the directory containing the .lo file.
2073 func_dirname "$file" "" "."
2074 dir="$func_dirname_result"
2078 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2083 # Get the absolute pathname.
2084 absdir=`cd "$dir" && pwd`
2085 test -n "$absdir" && dir="$absdir"
2087 # Now add the directory to shlibpath_var.
2088 if eval "test -z \"\$$shlibpath_var\""; then
2089 eval "$shlibpath_var=\"\$dir\""
2091 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2095 # This variable tells wrapper scripts just to set shlibpath_var
2096 # rather than running their programs.
2097 libtool_execute_magic="$magic"
2099 # Check if any of the arguments is a wrapper script.
2106 # Do a test to see if this is really a libtool program.
2107 if func_ltwrapper_script_p "$file"; then
2109 # Transform arg to wrapped name.
2110 file="$progdir/$program"
2111 elif func_ltwrapper_executable_p "$file"; then
2112 func_ltwrapper_scriptname "$file"
2113 func_source "$func_ltwrapper_scriptname_result"
2114 # Transform arg to wrapped name.
2115 file="$progdir/$program"
2119 # Quote arguments (to preserve shell metacharacters).
2120 func_quote_for_eval "$file"
2121 args="$args $func_quote_for_eval_result"
2124 if test "X$opt_dry_run" = Xfalse; then
2125 if test -n "$shlibpath_var"; then
2126 # Export the shlibpath_var.
2127 eval "export $shlibpath_var"
2130 # Restore saved environment variables
2131 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2133 eval "if test \"\${save_$lt_var+set}\" = set; then
2134 $lt_var=\$save_$lt_var; export $lt_var
2140 # Now prepare to actually exec the command.
2141 exec_cmd="\$cmd$args"
2143 # Display what would be done.
2144 if test -n "$shlibpath_var"; then
2145 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2146 $ECHO "export $shlibpath_var"
2153 test "$mode" = execute && func_mode_execute ${1+"$@"}
2156 # func_mode_finish arg...
2163 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2166 libdirs="$libdirs $dir"
2169 for libdir in $libdirs; do
2170 if test -n "$finish_cmds"; then
2171 # Do each command in the finish commands.
2172 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2175 if test -n "$finish_eval"; then
2176 # Do the single finish_eval.
2177 eval cmds=\"$finish_eval\"
2178 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2184 # Exit here if they wanted silent mode.
2185 $opt_silent && exit $EXIT_SUCCESS
2187 $ECHO "X----------------------------------------------------------------------" | $Xsed
2188 $ECHO "Libraries have been installed in:"
2189 for libdir in $libdirs; do
2193 $ECHO "If you ever happen to want to link against installed libraries"
2194 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2195 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2196 $ECHO "flag during linking and do at least one of the following:"
2197 if test -n "$shlibpath_var"; then
2198 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2199 $ECHO " during execution"
2201 if test -n "$runpath_var"; then
2202 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2203 $ECHO " during linking"
2205 if test -n "$hardcode_libdir_flag_spec"; then
2207 eval flag=\"$hardcode_libdir_flag_spec\"
2209 $ECHO " - use the \`$flag' linker flag"
2211 if test -n "$admincmds"; then
2212 $ECHO " - have your system administrator run these commands:$admincmds"
2214 if test -f /etc/ld.so.conf; then
2215 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2219 $ECHO "See any operating system documentation about shared libraries for"
2221 solaris2.[6789]|solaris2.1[0-9])
2222 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2226 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2229 $ECHO "X----------------------------------------------------------------------" | $Xsed
2233 test "$mode" = finish && func_mode_finish ${1+"$@"}
2236 # func_mode_install arg...
2237 func_mode_install ()
2240 # There may be an optional sh(1) argument at the beginning of
2241 # install_prog (especially on Windows NT).
2242 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2243 # Allow the use of GNU shtool's install command.
2244 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2245 # Aesthetically quote it.
2246 func_quote_for_eval "$nonopt"
2247 install_prog="$func_quote_for_eval_result "
2255 # The real first argument should be the name of the installation program.
2256 # Aesthetically quote it.
2257 func_quote_for_eval "$arg"
2258 install_prog="$install_prog$func_quote_for_eval_result"
2260 # We need to accept at least all the BSD install flags.
2270 if test -n "$dest"; then
2271 files="$files $dest"
2279 case " $install_prog " in
2294 # If the previous option needed an argument, then skip it.
2295 if test -n "$prev"; then
2304 # Aesthetically quote the argument.
2305 func_quote_for_eval "$arg"
2306 install_prog="$install_prog $func_quote_for_eval_result"
2309 test -z "$install_prog" && \
2310 func_fatal_help "you must specify an install program"
2312 test -n "$prev" && \
2313 func_fatal_help "the \`$prev' option requires an argument"
2315 if test -z "$files"; then
2316 if test -z "$dest"; then
2317 func_fatal_help "no file or destination specified"
2319 func_fatal_help "you must specify a destination"
2323 # Strip any trailing slash from the destination.
2324 func_stripname '' '/' "$dest"
2325 dest=$func_stripname_result
2327 # Check to see that the destination is a directory.
2328 test -d "$dest" && isdir=yes
2329 if test "$isdir" = yes; then
2333 func_dirname_and_basename "$dest" "" "."
2334 destdir="$func_dirname_result"
2335 destname="$func_basename_result"
2337 # Not a directory, so check to see that there is only one file specified.
2338 set dummy $files; shift
2339 test "$#" -gt 1 && \
2340 func_fatal_help "\`$dest' is not a directory"
2343 [\\/]* | [A-Za-z]:[\\/]*) ;;
2345 for file in $files; do
2349 func_fatal_help "\`$destdir' must be an absolute directory name"
2356 # This variable tells wrapper scripts just to set variables rather
2357 # than running their programs.
2358 libtool_install_magic="$magic"
2363 for file in $files; do
2365 # Do each installation.
2368 # Do the static libraries later.
2369 staticlibs="$staticlibs $file"
2373 # Check to see that this really is a libtool archive.
2374 func_lalib_unsafe_p "$file" \
2375 || func_fatal_help "\`$file' is not a valid libtool archive"
2382 # Add the libdir to current_libdirs if it is the destination.
2383 if test "X$destdir" = "X$libdir"; then
2384 case "$current_libdirs " in
2386 *) current_libdirs="$current_libdirs $libdir" ;;
2389 # Note the libdir as a future libdir.
2390 case "$future_libdirs " in
2392 *) future_libdirs="$future_libdirs $libdir" ;;
2396 func_dirname "$file" "/" ""
2397 dir="$func_dirname_result"
2400 if test -n "$relink_command"; then
2401 # Determine the prefix the user has applied to our future dir.
2402 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2404 # Don't allow the user to place us outside of our expected
2405 # location b/c this prevents finding dependent libraries that
2406 # are installed to the same prefix.
2407 # At present, this check doesn't affect windows .dll's that
2408 # are installed into $libdir/../bin (currently, that works fine)
2409 # but it's something to keep an eye on.
2410 test "$inst_prefix_dir" = "$destdir" && \
2411 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2413 if test -n "$inst_prefix_dir"; then
2414 # Stick the inst_prefix_dir data into the link command.
2415 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2417 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2420 func_warning "relinking \`$file'"
2421 func_show_eval "$relink_command" \
2422 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2425 # See the names of the shared library.
2426 set dummy $library_names; shift
2427 if test -n "$1"; then
2432 test -n "$relink_command" && srcname="$realname"T
2434 # Install the shared library and build the symlinks.
2435 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2439 cygwin* | mingw* | pw32*)
2447 if test -n "$tstripme" && test -n "$striplib"; then
2448 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2451 if test "$#" -gt 0; then
2452 # Delete the old symlinks, and create new ones.
2453 # Try `ln -sf' first, because the `ln' binary might depend on
2454 # the symlink we replace! Solaris /bin/ln does not understand -f,
2455 # so we also need to try rm && ln -s.
2458 test "$linkname" != "$realname" \
2459 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2463 # Do each command in the postinstall commands.
2464 lib="$destdir/$realname"
2465 func_execute_cmds "$postinstall_cmds" 'exit $?'
2468 # Install the pseudo-library for information purposes.
2469 func_basename "$file"
2470 name="$func_basename_result"
2471 instname="$dir/$name"i
2472 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2474 # Maybe install the static library, too.
2475 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2479 # Install (i.e. copy) a libtool object.
2481 # Figure out destination file name, if it wasn't already specified.
2482 if test -n "$destname"; then
2483 destfile="$destdir/$destname"
2485 func_basename "$file"
2486 destfile="$func_basename_result"
2487 destfile="$destdir/$destfile"
2490 # Deduce the name of the destination old-style object file.
2493 func_lo2o "$destfile"
2494 staticdest=$func_lo2o_result
2497 staticdest="$destfile"
2501 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2505 # Install the libtool object if requested.
2506 test -n "$destfile" && \
2507 func_show_eval "$install_prog $file $destfile" 'exit $?'
2509 # Install the old object if enabled.
2510 if test "$build_old_libs" = yes; then
2511 # Deduce the name of the old-style object file.
2513 staticobj=$func_lo2o_result
2514 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2520 # Figure out destination file name, if it wasn't already specified.
2521 if test -n "$destname"; then
2522 destfile="$destdir/$destname"
2524 func_basename "$file"
2525 destfile="$func_basename_result"
2526 destfile="$destdir/$destfile"
2529 # If the file is missing, and there is a .exe on the end, strip it
2530 # because it is most likely a libtool script we actually want to
2535 if test ! -f "$file"; then
2536 func_stripname '' '.exe' "$file"
2537 file=$func_stripname_result
2543 # Do a test to see if this is really a libtool program.
2546 if func_ltwrapper_executable_p "$file"; then
2547 func_ltwrapper_scriptname "$file"
2548 wrapper=$func_ltwrapper_scriptname_result
2550 func_stripname '' '.exe' "$file"
2551 wrapper=$func_stripname_result
2558 if func_ltwrapper_script_p "$wrapper"; then
2562 func_source "$wrapper"
2564 # Check the variables that should have been set.
2565 test -z "$generated_by_libtool_version" && \
2566 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2569 for lib in $notinst_deplibs; do
2570 # Check to see that each library is installed.
2572 if test -f "$lib"; then
2575 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2576 if test -n "$libdir" && test ! -f "$libfile"; then
2577 func_warning "\`$lib' has not been installed in \`$libdir'"
2583 func_source "$wrapper"
2586 if test "$fast_install" = no && test -n "$relink_command"; then
2588 if test "$finalize" = yes; then
2589 tmpdir=`func_mktempdir`
2590 func_basename "$file$stripped_ext"
2591 file="$func_basename_result"
2592 outputname="$tmpdir/$file"
2593 # Replace the output file specification.
2594 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2597 func_quote_for_expand "$relink_command"
2598 eval "func_echo $func_quote_for_expand_result"
2600 if eval "$relink_command"; then :
2602 func_error "error: relink \`$file' with the above command before installing it"
2603 $opt_dry_run || ${RM}r "$tmpdir"
2608 func_warning "cannot relink \`$file'"
2612 # Install the binary that we compiled earlier.
2613 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2617 # remove .exe since cygwin /usr/bin/install will append another
2619 case $install_prog,$host in
2620 */usr/bin/install*,*cygwin*)
2621 case $file:$destfile in
2626 destfile=$destfile.exe
2629 func_stripname '' '.exe' "$destfile"
2630 destfile=$func_stripname_result
2635 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2636 $opt_dry_run || if test -n "$outputname"; then
2643 for file in $staticlibs; do
2644 func_basename "$file"
2645 name="$func_basename_result"
2647 # Set up the ranlib parameters.
2648 oldlib="$destdir/$name"
2650 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2652 if test -n "$stripme" && test -n "$old_striplib"; then
2653 func_show_eval "$old_striplib $oldlib" 'exit $?'
2656 # Do each command in the postinstall commands.
2657 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2660 test -n "$future_libdirs" && \
2661 func_warning "remember to run \`$progname --finish$future_libdirs'"
2663 if test -n "$current_libdirs"; then
2664 # Maybe just do a dry run.
2665 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2666 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2672 test "$mode" = install && func_mode_install ${1+"$@"}
2675 # func_emit_wrapper arg
2677 # emit a libtool wrapper script on stdout
2678 # don't directly open a file because we may want to
2679 # incorporate the script contents within a cygwin/mingw
2680 # wrapper executable. Must ONLY be called from within
2681 # func_mode_link because it depends on a number of variable
2684 # arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2685 # variable will take. If 'yes', then the emitted script
2686 # will assume that the directory in which it is stored is
2687 # the '.lib' directory. This is a cygwin/mingw-specific
2689 func_emit_wrapper ()
2691 func_emit_wrapper_arg1=no
2692 if test -n "$1" ; then
2693 func_emit_wrapper_arg1=$1
2699 # $output - temporary wrapper script for $objdir/$outputname
2700 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2702 # The $output program cannot be directly executed until all the libtool
2703 # libraries that it depends on are installed.
2705 # This wrapper script should never be moved out of the build directory.
2706 # If it is, it will not operate correctly.
2708 # Sed substitution that helps us do robust quoting. It backslashifies
2709 # metacharacters that are still active within double-quoted strings.
2710 Xsed='${SED} -e 1s/^X//'
2711 sed_quote_subst='$sed_quote_subst'
2713 # Be Bourne compatible
2714 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2717 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2718 # is contrary to our usage. Disable this feature.
2719 alias -g '\${1+\"\$@\"}'='\"\$@\"'
2720 setopt NO_GLOB_SUBST
2722 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2724 BIN_SH=xpg4; export BIN_SH # for Tru64
2725 DUALCASE=1; export DUALCASE # for MKS sh
2727 # The HP-UX ksh and POSIX shell print the target directory to stdout
2729 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2731 relink_command=\"$relink_command\"
2733 # This environment variable determines our operation mode.
2734 if test \"\$libtool_install_magic\" = \"$magic\"; then
2735 # install mode needs the following variables:
2736 generated_by_libtool_version='$macro_version'
2737 notinst_deplibs='$notinst_deplibs'
2739 # When we are sourced in execute mode, \$file and \$ECHO are already set.
2740 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2743 # Make sure echo works.
2744 if test \"X\$1\" = X--no-reexec; then
2745 # Discard the --no-reexec flag, and continue.
2747 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2748 # Yippee, \$ECHO works!
2751 # Restart under the correct shell, and then maybe \$ECHO will work.
2752 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2758 # Find the directory that this script lives in.
2759 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2760 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2762 # Follow symbolic links until we get to the real thisdir.
2763 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2764 while test -n \"\$file\"; do
2765 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2767 # If there was a directory component, then change thisdir.
2768 if test \"x\$destdir\" != \"x\$file\"; then
2769 case \"\$destdir\" in
2770 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2771 *) thisdir=\"\$thisdir/\$destdir\" ;;
2775 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2776 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2779 # Usually 'no', except on cygwin/mingw when embedded into
2781 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
2782 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2783 # special case for '.'
2784 if test \"\$thisdir\" = \".\"; then
2787 # remove .libs from thisdir
2788 case \"\$thisdir\" in
2789 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
2790 $objdir ) thisdir=. ;;
2794 # Try to get the absolute directory name.
2795 absdir=\`cd \"\$thisdir\" && pwd\`
2796 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2799 if test "$fast_install" = yes; then
2801 program=lt-'$outputname'$exeext
2802 progdir=\"\$thisdir/$objdir\"
2804 if test ! -f \"\$progdir/\$program\" ||
2805 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2806 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2808 file=\"\$\$-\$program\"
2810 if test ! -d \"\$progdir\"; then
2811 $MKDIR \"\$progdir\"
2813 $RM \"\$progdir/\$file\"
2818 # relink executable if necessary
2819 if test -n \"\$relink_command\"; then
2820 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2822 $ECHO \"\$relink_command_output\" >&2
2823 $RM \"\$progdir/\$file\"
2828 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2829 { $RM \"\$progdir/\$program\";
2830 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2831 $RM \"\$progdir/\$file\"
2835 program='$outputname'
2836 progdir=\"\$thisdir/$objdir\"
2842 if test -f \"\$progdir/\$program\"; then"
2844 # Export our shlibpath_var if we have one.
2845 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2847 # Add our own library path to $shlibpath_var
2848 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2850 # Some systems cannot cope with colon-terminated $shlibpath_var
2851 # The second colon is a workaround for a bug in BeOS R4 sed
2852 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2854 export $shlibpath_var
2858 # fixup the dll searchpath if we need to.
2859 if test -n "$dllsearchpath"; then
2861 # Add the dll search path components to the executable PATH
2862 PATH=$dllsearchpath:\$PATH
2867 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2868 # Run the actual program with our arguments.
2871 # Backslashes separate directories on plain windows
2872 *-*-mingw | *-*-os2*)
2874 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
2880 exec \"\$progdir/\$program\" \${1+\"\$@\"}
2885 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
2889 # The program doesn't exist.
2890 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
2891 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
2892 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
2898 # end: func_emit_wrapper
2900 # func_emit_cwrapperexe_src
2901 # emit the source code for a wrapper executable on stdout
2902 # Must ONLY be called from within func_mode_link because
2903 # it depends on a number of variable set therein.
2904 func_emit_cwrapperexe_src ()
2908 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
2909 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2911 The $output program cannot be directly executed until all the libtool
2912 libraries that it depends on are installed.
2914 This wrapper executable should never be moved out of the build directory.
2915 If it is, it will not operate correctly.
2917 Currently, it simply execs the wrapper *script* "$SHELL $output",
2918 but could eventually absorb all of the scripts functionality and
2919 exec $objdir/$outputname directly.
2926 # include <direct.h>
2927 # include <process.h>
2930 # include <unistd.h>
2931 # include <stdint.h>
2940 #include <sys/stat.h>
2942 #if defined(PATH_MAX)
2943 # define LT_PATHMAX PATH_MAX
2944 #elif defined(MAXPATHLEN)
2945 # define LT_PATHMAX MAXPATHLEN
2947 # define LT_PATHMAX 1024
2958 # define S_IXUSR _S_IEXEC
2960 # ifndef _INTPTR_T_DEFINED
2961 # define intptr_t int
2965 #ifndef DIR_SEPARATOR
2966 # define DIR_SEPARATOR '/'
2967 # define PATH_SEPARATOR ':'
2970 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
2972 # define HAVE_DOS_BASED_FILE_SYSTEM
2973 # define FOPEN_WB "wb"
2974 # ifndef DIR_SEPARATOR_2
2975 # define DIR_SEPARATOR_2 '\\'
2977 # ifndef PATH_SEPARATOR_2
2978 # define PATH_SEPARATOR_2 ';'
2982 #ifndef DIR_SEPARATOR_2
2983 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
2984 #else /* DIR_SEPARATOR_2 */
2985 # define IS_DIR_SEPARATOR(ch) \
2986 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
2987 #endif /* DIR_SEPARATOR_2 */
2989 #ifndef PATH_SEPARATOR_2
2990 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
2991 #else /* PATH_SEPARATOR_2 */
2992 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
2993 #endif /* PATH_SEPARATOR_2 */
2996 # define FOPEN_WB "wb"
3000 # define FOPEN_WB "w"
3003 # define _O_BINARY 0
3006 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3007 #define XFREE(stale) do { \
3008 if (stale) { free ((void *) stale); stale = 0; } \
3011 #undef LTWRAPPER_DEBUGPRINTF
3012 #if defined DEBUGWRAPPER
3013 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3015 ltwrapper_debugprintf (const char *fmt, ...)
3018 va_start (args, fmt);
3019 (void) vfprintf (stderr, fmt, args);
3023 # define LTWRAPPER_DEBUGPRINTF(args)
3026 const char *program_name = NULL;
3028 void *xmalloc (size_t num);
3029 char *xstrdup (const char *string);
3030 const char *base_name (const char *name);
3031 char *find_executable (const char *wrapper);
3032 char *chase_symlinks (const char *pathspec);
3033 int make_executable (const char *path);
3034 int check_executable (const char *path);
3035 char *strendzap (char *str, const char *pat);
3036 void lt_fatal (const char *message, ...);
3038 static const char *script_text =
3041 func_emit_wrapper yes |
3042 $SED -e 's/\([\\"]\)/\\\1/g' \
3043 -e 's/^/ "/' -e 's/$/\\n"/'
3047 const char * MAGIC_EXE = "$magic_exe";
3050 main (int argc, char *argv[])
3054 char *actual_cwrapper_path;
3055 char *shwrapper_name;
3056 intptr_t rval = 127;
3059 const char *dumpscript_opt = "--lt-dump-script";
3062 program_name = (char *) xstrdup (base_name (argv[0]));
3063 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3064 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3066 /* very simple arg parsing; don't want to rely on getopt */
3067 for (i = 1; i < argc; i++)
3069 if (strcmp (argv[i], dumpscript_opt) == 0)
3073 *mingw* | *cygwin* )
3074 # make stdout use "unix" line endings
3075 echo " _setmode(1,_O_BINARY);"
3080 printf ("%s", script_text);
3085 newargz = XMALLOC (char *, argc + 2);
3088 if test -n "$TARGETSHELL" ; then
3089 # no path translation at all
3090 lt_newargv0=$TARGETSHELL
3094 # awkward: cmd appends spaces to result
3095 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3096 lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
3097 case $lt_newargv0 in
3099 *) lt_newargv0=$lt_newargv0.exe ;;
3102 * ) lt_newargv0=$SHELL ;;
3107 newargz[0] = (char *) xstrdup ("$lt_newargv0");
3111 tmp_pathspec = find_executable (argv[0]);
3112 if (tmp_pathspec == NULL)
3113 lt_fatal ("Couldn't find %s", argv[0]);
3114 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3117 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3118 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3119 actual_cwrapper_path));
3120 XFREE (tmp_pathspec);
3122 shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
3123 strendzap (actual_cwrapper_path, shwrapper_name);
3125 /* shwrapper_name transforms */
3126 strendzap (shwrapper_name, ".exe");
3127 tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
3128 strlen ("_ltshwrapperTMP") + 1));
3129 strcpy (tmp_pathspec, shwrapper_name);
3130 strcat (tmp_pathspec, "_ltshwrapperTMP");
3131 XFREE (shwrapper_name);
3132 shwrapper_name = tmp_pathspec;
3134 LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
3140 XMALLOC (char, (strlen (actual_cwrapper_path) +
3141 strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
3142 strcpy (newargz[1], actual_cwrapper_path);
3143 strcat (newargz[1], "$objdir");
3144 strcat (newargz[1], "/");
3145 strcat (newargz[1], shwrapper_name);
3154 while ((p = strchr (newargz[1], '\\')) != NULL)
3164 XFREE (shwrapper_name);
3165 XFREE (actual_cwrapper_path);
3167 /* always write in binary mode */
3168 if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0)
3170 lt_fatal ("Could not open %s for writing", newargz[1]);
3172 fprintf (shwrapper, "%s", script_text);
3175 make_executable (newargz[1]);
3177 for (i = 1; i < argc; i++)
3178 newargz[i + 1] = xstrdup (argv[i]);
3179 newargz[argc + 1] = NULL;
3181 for (i = 0; i < argc + 1; i++)
3183 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, newargz[i]));
3191 /* execv doesn't actually work on mingw as expected on unix */
3192 rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
3195 /* failed to start process */
3196 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
3205 execv ("$lt_newargv0", newargz);
3206 return rval; /* =127, but avoids unused variable warning */
3215 xmalloc (size_t num)
3217 void *p = (void *) malloc (num);
3219 lt_fatal ("Memory exhausted");
3225 xstrdup (const char *string)
3227 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3232 base_name (const char *name)
3236 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3237 /* Skip over the disk name in MSDOS pathnames. */
3238 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3242 for (base = name; *name; name++)
3243 if (IS_DIR_SEPARATOR (*name))
3249 check_executable (const char *path)
3253 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
3254 path ? (*path ? path : "EMPTY!") : "NULL!"));
3255 if ((!path) || (!*path))
3258 if ((stat (path, &st) >= 0)
3259 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3266 make_executable (const char *path)
3271 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
3272 path ? (*path ? path : "EMPTY!") : "NULL!"));
3273 if ((!path) || (!*path))
3276 if (stat (path, &st) >= 0)
3278 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3283 /* Searches for the full path of the wrapper. Returns
3284 newly allocated full path name if found, NULL otherwise
3285 Does not chase symlinks, even on platforms that support them.
3288 find_executable (const char *wrapper)
3293 /* static buffer for getcwd */
3294 char tmp[LT_PATHMAX + 1];
3298 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
3299 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3301 if ((wrapper == NULL) || (*wrapper == '\0'))
3304 /* Absolute path? */
3305 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3306 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3308 concat_name = xstrdup (wrapper);
3309 if (check_executable (concat_name))
3311 XFREE (concat_name);
3316 if (IS_DIR_SEPARATOR (wrapper[0]))
3318 concat_name = xstrdup (wrapper);
3319 if (check_executable (concat_name))
3321 XFREE (concat_name);
3323 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3327 for (p = wrapper; *p; p++)
3335 /* no slashes; search PATH */
3336 const char *path = getenv ("PATH");
3339 for (p = path; *p; p = p_next)
3343 for (q = p; *q; q++)
3344 if (IS_PATH_SEPARATOR (*q))
3347 p_next = (*q == '\0' ? q : q + 1);
3350 /* empty path: current directory */
3351 if (getcwd (tmp, LT_PATHMAX) == NULL)
3352 lt_fatal ("getcwd failed");
3353 tmp_len = strlen (tmp);
3355 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3356 memcpy (concat_name, tmp, tmp_len);
3357 concat_name[tmp_len] = '/';
3358 strcpy (concat_name + tmp_len + 1, wrapper);
3363 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3364 memcpy (concat_name, p, p_len);
3365 concat_name[p_len] = '/';
3366 strcpy (concat_name + p_len + 1, wrapper);
3368 if (check_executable (concat_name))
3370 XFREE (concat_name);
3373 /* not found in PATH; assume curdir */
3375 /* Relative path | not found in path: prepend cwd */
3376 if (getcwd (tmp, LT_PATHMAX) == NULL)
3377 lt_fatal ("getcwd failed");
3378 tmp_len = strlen (tmp);
3379 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3380 memcpy (concat_name, tmp, tmp_len);
3381 concat_name[tmp_len] = '/';
3382 strcpy (concat_name + tmp_len + 1, wrapper);
3384 if (check_executable (concat_name))
3386 XFREE (concat_name);
3391 chase_symlinks (const char *pathspec)
3394 return xstrdup (pathspec);
3396 char buf[LT_PATHMAX];
3398 char *tmp_pathspec = xstrdup (pathspec);
3400 int has_symlinks = 0;
3401 while (strlen (tmp_pathspec) && !has_symlinks)
3403 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3405 if (lstat (tmp_pathspec, &s) == 0)
3407 if (S_ISLNK (s.st_mode) != 0)
3413 /* search backwards for last DIR_SEPARATOR */
3414 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3415 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3417 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3419 /* no more DIR_SEPARATORS left */
3426 char *errstr = strerror (errno);
3427 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3430 XFREE (tmp_pathspec);
3434 return xstrdup (pathspec);
3437 tmp_pathspec = realpath (pathspec, buf);
3438 if (tmp_pathspec == 0)
3440 lt_fatal ("Could not follow symlinks for %s", pathspec);
3442 return xstrdup (tmp_pathspec);
3447 strendzap (char *str, const char *pat)
3451 assert (str != NULL);
3452 assert (pat != NULL);
3455 patlen = strlen (pat);
3459 str += len - patlen;
3460 if (strcmp (str, pat) == 0)
3467 lt_error_core (int exit_status, const char *mode,
3468 const char *message, va_list ap)
3470 fprintf (stderr, "%s: %s: ", program_name, mode);
3471 vfprintf (stderr, message, ap);
3472 fprintf (stderr, ".\n");
3474 if (exit_status >= 0)
3479 lt_fatal (const char *message, ...)
3482 va_start (ap, message);
3483 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
3488 # end: func_emit_cwrapperexe_src
3490 # func_mode_link arg...
3495 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3496 # It is impossible to link a dll without this setting, and
3497 # we shouldn't force the makefile maintainer to figure out
3498 # which system we are compiling for in order to pass an extra
3499 # flag for every libtool invocation.
3500 # allow_undefined=no
3502 # FIXME: Unfortunately, there are problems with the above when trying
3503 # to make a dll which has undefined symbols, in which case not
3504 # even a static library is built. For now, we need to specify
3505 # -no-undefined on the libtool link line when we can be certain
3506 # that all symbols are satisfied, otherwise we get a static library.
3513 libtool_args=$nonopt
3514 base_compile="$nonopt $@"
3515 compile_command=$nonopt
3516 finalize_command=$nonopt
3529 lib_search_path=`pwd`
3531 new_inherited_linker_flags=
3539 export_symbols_regex=
3547 precious_files_regex=
3548 prefer_static_libs=no
3561 single_module="${wl}-single_module"
3562 func_infer_tag $base_compile
3564 # We need to know -static, to get the right output filenames.
3569 test "$build_libtool_libs" != yes && \
3570 func_fatal_configuration "can not build a shared library"
3574 -all-static | -static | -static-libtool-libs)
3577 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
3578 func_warning "complete static linking is impossible in this configuration"
3580 if test -n "$link_static_flag"; then
3581 dlopen_self=$dlopen_self_static
3582 # See comment for -static flag below, for more details.
3583 func_append compile_command " $link_static_flag"
3584 func_append finalize_command " $link_static_flag"
3586 prefer_static_libs=yes
3589 if test -z "$pic_flag" && test -n "$link_static_flag"; then
3590 dlopen_self=$dlopen_self_static
3592 prefer_static_libs=built
3594 -static-libtool-libs)
3595 if test -z "$pic_flag" && test -n "$link_static_flag"; then
3596 dlopen_self=$dlopen_self_static
3598 prefer_static_libs=yes
3601 build_libtool_libs=no
3608 # See if our shared archives depend on static archives.
3609 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
3611 # Go through the arguments, transforming them on the way.
3612 while test "$#" -gt 0; do
3615 func_quote_for_eval "$arg"
3616 qarg=$func_quote_for_eval_unquoted_result
3617 func_append libtool_args " $func_quote_for_eval_result"
3619 # If the previous option needs an argument, assign it.
3620 if test -n "$prev"; then
3623 func_append compile_command " @OUTPUT@"
3624 func_append finalize_command " @OUTPUT@"
3630 if test "$preload" = no; then
3631 # Add the symbol object into the linking commands.
3632 func_append compile_command " @SYMFILE@"
3633 func_append finalize_command " @SYMFILE@"
3637 *.la | *.lo) ;; # We handle these cases below.
3639 if test "$dlself" = no; then
3647 if test "$prev" = dlprefiles; then
3649 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
3659 if test "$prev" = dlfiles; then
3660 dlfiles="$dlfiles $arg"
3662 dlprefiles="$dlprefiles $arg"
3670 export_symbols="$arg"
3672 || func_fatal_error "symbol file \`$arg' does not exist"
3677 export_symbols_regex="$arg"
3685 *" $qarg.ltframework "*) ;;
3686 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
3695 inst_prefix_dir="$arg"
3700 if test -f "$arg"; then
3703 for fil in `cat "$save_arg"`
3705 # moreargs="$moreargs $fil"
3707 # A libtool-controlled object.
3709 # Check to see that this really is a libtool object.
3710 if func_lalib_unsafe_p "$arg"; then
3717 if test -z "$pic_object" ||
3718 test -z "$non_pic_object" ||
3719 test "$pic_object" = none &&
3720 test "$non_pic_object" = none; then
3721 func_fatal_error "cannot find name of object for \`$arg'"
3724 # Extract subdirectory from the argument.
3725 func_dirname "$arg" "/" ""
3726 xdir="$func_dirname_result"
3728 if test "$pic_object" != none; then
3729 # Prepend the subdirectory the object is found in.
3730 pic_object="$xdir$pic_object"
3732 if test "$prev" = dlfiles; then
3733 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
3734 dlfiles="$dlfiles $pic_object"
3738 # If libtool objects are unsupported, then we need to preload.
3743 # CHECK ME: I think I busted this. -Ossama
3744 if test "$prev" = dlprefiles; then
3745 # Preload the old-style object.
3746 dlprefiles="$dlprefiles $pic_object"
3751 func_append libobjs " $pic_object"
3756 if test "$non_pic_object" != none; then
3757 # Prepend the subdirectory the object is found in.
3758 non_pic_object="$xdir$non_pic_object"
3760 # A standard non-PIC object
3761 func_append non_pic_objects " $non_pic_object"
3762 if test -z "$pic_object" || test "$pic_object" = none ; then
3763 arg="$non_pic_object"
3766 # If the PIC object exists, use it instead.
3767 # $xdir was prepended to $pic_object above.
3768 non_pic_object="$pic_object"
3769 func_append non_pic_objects " $non_pic_object"
3772 # Only an error if not doing a dry-run.
3773 if $opt_dry_run; then
3774 # Extract subdirectory from the argument.
3775 func_dirname "$arg" "/" ""
3776 xdir="$func_dirname_result"
3779 pic_object=$xdir$objdir/$func_lo2o_result
3780 non_pic_object=$xdir$func_lo2o_result
3781 func_append libobjs " $pic_object"
3782 func_append non_pic_objects " $non_pic_object"
3784 func_fatal_error "\`$arg' is not a valid libtool object"
3789 func_fatal_error "link input file \`$arg' does not exist"
3796 precious_files_regex="$arg"
3806 # We need an absolute path.
3808 [\\/]* | [A-Za-z]:[\\/]*) ;;
3810 func_fatal_error "only absolute run-paths are allowed"
3813 if test "$prev" = rpath; then
3816 *) rpath="$rpath $arg" ;;
3821 *) xrpath="$xrpath $arg" ;;
3833 weak_libs="$weak_libs $arg"
3838 linker_flags="$linker_flags $qarg"
3839 compiler_flags="$compiler_flags $qarg"
3841 func_append compile_command " $qarg"
3842 func_append finalize_command " $qarg"
3846 compiler_flags="$compiler_flags $qarg"
3848 func_append compile_command " $qarg"
3849 func_append finalize_command " $qarg"
3853 linker_flags="$linker_flags $qarg"
3854 compiler_flags="$compiler_flags $wl$qarg"
3856 func_append compile_command " $wl$qarg"
3857 func_append finalize_command " $wl$qarg"
3861 eval "$prev=\"\$arg\""
3866 fi # test -n "$prev"
3872 # The effects of -all-static are defined in a previous loop.
3877 # FIXME: remove this flag sometime in the future.
3878 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
3901 -export-symbols | -export-symbols-regex)
3902 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3903 func_fatal_error "more than one -exported-symbols argument is not allowed"
3905 if test "X$arg" = "X-export-symbols"; then
3923 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
3924 # so, if we see these flags be careful not to treat them like -L
3926 case $with_gcc/$host in
3927 no/*-*-irix* | /*-*-irix*)
3928 func_append compile_command " $arg"
3929 func_append finalize_command " $arg"
3936 func_stripname '-L' '' "$arg"
3937 dir=$func_stripname_result
3938 # We need an absolute path.
3940 [\\/]* | [A-Za-z]:[\\/]*) ;;
3942 absdir=`cd "$dir" && pwd`
3943 test -z "$absdir" && \
3944 func_fatal_error "cannot determine absolute directory name of \`$dir'"
3951 deplibs="$deplibs -L$dir"
3952 lib_search_path="$lib_search_path $dir"
3956 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3957 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
3958 case :$dllsearchpath: in
3960 *) dllsearchpath="$dllsearchpath:$dir";;
3962 case :$dllsearchpath: in
3963 *":$testbindir:"*) ;;
3964 *) dllsearchpath="$dllsearchpath:$testbindir";;
3972 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
3974 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
3975 # These systems don't actually have a C or math library (as such)
3979 # These systems don't actually have a C library (as such)
3980 test "X$arg" = "X-lc" && continue
3982 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3983 # Do not include libc due to us having libc/libc_r.
3984 test "X$arg" = "X-lc" && continue
3986 *-*-rhapsody* | *-*-darwin1.[012])
3987 # Rhapsody C and math libraries are in the System framework
3988 deplibs="$deplibs System.ltframework"
3991 *-*-sco3.2v5* | *-*-sco5v6*)
3992 # Causes problems with __ctype
3993 test "X$arg" = "X-lc" && continue
3995 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3996 # Compiler inserts libc in the correct place for threads to work
3997 test "X$arg" = "X-lc" && continue
4000 elif test "X$arg" = "X-lc_r"; then
4002 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4003 # Do not include libc_r directly, use -pthread flag.
4008 deplibs="$deplibs $arg"
4017 # Tru64 UNIX uses -model [arg] to determine the layout of C++
4018 # classes, name mangling, and exception handling.
4019 # Darwin uses the -arch flag to determine output architecture.
4020 -model|-arch|-isysroot)
4021 compiler_flags="$compiler_flags $arg"
4022 func_append compile_command " $arg"
4023 func_append finalize_command " $arg"
4028 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4029 compiler_flags="$compiler_flags $arg"
4030 func_append compile_command " $arg"
4031 func_append finalize_command " $arg"
4032 case "$new_inherited_linker_flags " in
4034 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
4040 single_module="${wl}-multi_module"
4051 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
4052 # The PATH hackery in wrapper scripts is required on Windows
4053 # and Darwin in order for the loader to find any dlls it needs.
4054 func_warning "\`-no-install' is ignored for $host"
4055 func_warning "assuming \`-no-fast-install' instead"
4058 *) no_install=yes ;;
4075 -precious-files-regex)
4096 func_stripname '-R' '' "$arg"
4097 dir=$func_stripname_result
4098 # We need an absolute path.
4100 [\\/]* | [A-Za-z]:[\\/]*) ;;
4102 func_fatal_error "only absolute run-paths are allowed"
4107 *) xrpath="$xrpath $dir" ;;
4113 # The effects of -shared are defined in a previous loop.
4122 -static | -static-libtool-libs)
4123 # The effects of -static are defined in a previous loop.
4124 # We used to do the same as -all-static on platforms that
4125 # didn't have a PIC flag, but the assumption that the effects
4126 # would be equivalent was wrong. It would break on at least
4127 # Digital Unix and AIX.
4153 func_stripname '-Wc,' '' "$arg"
4154 args=$func_stripname_result
4156 save_ifs="$IFS"; IFS=','
4157 for flag in $args; do
4159 func_quote_for_eval "$flag"
4160 arg="$arg $wl$func_quote_for_eval_result"
4161 compiler_flags="$compiler_flags $func_quote_for_eval_result"
4164 func_stripname ' ' '' "$arg"
4165 arg=$func_stripname_result
4169 func_stripname '-Wl,' '' "$arg"
4170 args=$func_stripname_result
4172 save_ifs="$IFS"; IFS=','
4173 for flag in $args; do
4175 func_quote_for_eval "$flag"
4176 arg="$arg $wl$func_quote_for_eval_result"
4177 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
4178 linker_flags="$linker_flags $func_quote_for_eval_result"
4181 func_stripname ' ' '' "$arg"
4182 arg=$func_stripname_result
4202 func_quote_for_eval "$arg"
4203 arg="$func_quote_for_eval_result"
4206 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
4207 # -r[0-9][0-9]* specifies the processor on the SGI compiler
4208 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
4209 # +DA*, +DD* enable 64-bit mode on the HP compiler
4210 # -q* pass through compiler args for the IBM compiler
4211 # -m*, -t[45]*, -txscale* pass through architecture-specific
4212 # compiler args for GCC
4213 # -F/path gives path to uninstalled frameworks, gcc on darwin
4214 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
4215 # @file GCC response files
4216 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
4217 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
4218 func_quote_for_eval "$arg"
4219 arg="$func_quote_for_eval_result"
4220 func_append compile_command " $arg"
4221 func_append finalize_command " $arg"
4222 compiler_flags="$compiler_flags $arg"
4226 # Some other compiler flag.
4228 func_quote_for_eval "$arg"
4229 arg="$func_quote_for_eval_result"
4233 # A standard object.
4238 # A libtool-controlled object.
4240 # Check to see that this really is a libtool object.
4241 if func_lalib_unsafe_p "$arg"; then
4248 if test -z "$pic_object" ||
4249 test -z "$non_pic_object" ||
4250 test "$pic_object" = none &&
4251 test "$non_pic_object" = none; then
4252 func_fatal_error "cannot find name of object for \`$arg'"
4255 # Extract subdirectory from the argument.
4256 func_dirname "$arg" "/" ""
4257 xdir="$func_dirname_result"
4259 if test "$pic_object" != none; then
4260 # Prepend the subdirectory the object is found in.
4261 pic_object="$xdir$pic_object"
4263 if test "$prev" = dlfiles; then
4264 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4265 dlfiles="$dlfiles $pic_object"
4269 # If libtool objects are unsupported, then we need to preload.
4274 # CHECK ME: I think I busted this. -Ossama
4275 if test "$prev" = dlprefiles; then
4276 # Preload the old-style object.
4277 dlprefiles="$dlprefiles $pic_object"
4282 func_append libobjs " $pic_object"
4287 if test "$non_pic_object" != none; then
4288 # Prepend the subdirectory the object is found in.
4289 non_pic_object="$xdir$non_pic_object"
4291 # A standard non-PIC object
4292 func_append non_pic_objects " $non_pic_object"
4293 if test -z "$pic_object" || test "$pic_object" = none ; then
4294 arg="$non_pic_object"
4297 # If the PIC object exists, use it instead.
4298 # $xdir was prepended to $pic_object above.
4299 non_pic_object="$pic_object"
4300 func_append non_pic_objects " $non_pic_object"
4303 # Only an error if not doing a dry-run.
4304 if $opt_dry_run; then
4305 # Extract subdirectory from the argument.
4306 func_dirname "$arg" "/" ""
4307 xdir="$func_dirname_result"
4310 pic_object=$xdir$objdir/$func_lo2o_result
4311 non_pic_object=$xdir$func_lo2o_result
4312 func_append libobjs " $pic_object"
4313 func_append non_pic_objects " $non_pic_object"
4315 func_fatal_error "\`$arg' is not a valid libtool object"
4322 deplibs="$deplibs $arg"
4323 old_deplibs="$old_deplibs $arg"
4328 # A libtool-controlled library.
4330 if test "$prev" = dlfiles; then
4331 # This library was specified with -dlopen.
4332 dlfiles="$dlfiles $arg"
4334 elif test "$prev" = dlprefiles; then
4335 # The library was specified with -dlpreopen.
4336 dlprefiles="$dlprefiles $arg"
4339 deplibs="$deplibs $arg"
4344 # Some other compiler argument.
4346 # Unknown arguments in both finalize_command and compile_command need
4347 # to be aesthetically quoted because they are evaled later.
4348 func_quote_for_eval "$arg"
4349 arg="$func_quote_for_eval_result"
4353 # Now actually substitute the argument into the commands.
4354 if test -n "$arg"; then
4355 func_append compile_command " $arg"
4356 func_append finalize_command " $arg"
4358 done # argument parsing loop
4360 test -n "$prev" && \
4361 func_fatal_help "the \`$prevarg' option requires an argument"
4363 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
4364 eval arg=\"$export_dynamic_flag_spec\"
4365 func_append compile_command " $arg"
4366 func_append finalize_command " $arg"
4370 # calculate the name of the file, without its directory
4371 func_basename "$output"
4372 outputname="$func_basename_result"
4373 libobjs_save="$libobjs"
4375 if test -n "$shlibpath_var"; then
4376 # get the directories listed in $shlibpath_var
4377 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
4381 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
4382 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
4384 func_dirname "$output" "/" ""
4385 output_objdir="$func_dirname_result$objdir"
4386 # Create the object directory.
4387 func_mkdir_p "$output_objdir"
4389 # Determine the type of output
4392 func_fatal_help "you must specify an output file"
4394 *.$libext) linkmode=oldlib ;;
4395 *.lo | *.$objext) linkmode=obj ;;
4396 *.la) linkmode=lib ;;
4397 *) linkmode=prog ;; # Anything else should be a program.
4403 # Find all interdependent deplibs by searching for libraries
4404 # that are linked more than once (e.g. -la -lb -la)
4405 for deplib in $deplibs; do
4406 if $opt_duplicate_deps ; then
4408 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4411 libs="$libs $deplib"
4414 if test "$linkmode" = lib; then
4415 libs="$predeps $libs $compiler_lib_search_path $postdeps"
4417 # Compute libraries that are listed more than once in $predeps
4418 # $postdeps and mark them as special (i.e., whose duplicates are
4419 # not to be eliminated).
4421 if $opt_duplicate_compiler_generated_deps; then
4422 for pre_post_dep in $predeps $postdeps; do
4423 case "$pre_post_deps " in
4424 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
4426 pre_post_deps="$pre_post_deps $pre_post_dep"
4435 need_relink=no # whether we're linking any uninstalled libtool libraries
4436 notinst_deplibs= # not-installed libtool libraries
4437 notinst_path= # paths that contain not-installed libtool libraries
4441 passes="conv dlpreopen link"
4442 for file in $dlfiles $dlprefiles; do
4446 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
4457 passes="conv scan dlopen dlpreopen link"
4463 for pass in $passes; do
4464 # The preopen pass in lib mode reverses $deplibs; put it back here
4465 # so that -L comes before libs that need it for instance...
4466 if test "$linkmode,$pass" = "lib,link"; then
4467 ## FIXME: Find the place where the list is rebuilt in the wrong
4468 ## order, and fix it there properly
4470 for deplib in $deplibs; do
4471 tmp_deplibs="$deplib $tmp_deplibs"
4473 deplibs="$tmp_deplibs"
4476 if test "$linkmode,$pass" = "lib,link" ||
4477 test "$linkmode,$pass" = "prog,scan"; then
4481 if test "$linkmode" = prog; then
4483 dlopen) libs="$dlfiles" ;;
4484 dlpreopen) libs="$dlprefiles" ;;
4485 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
4488 if test "$linkmode,$pass" = "lib,dlpreopen"; then
4489 # Collect and forward deplibs of preopened libtool libs
4490 for lib in $dlprefiles; do
4491 # Ignore non-libtool-libs
4494 *.la) func_source "$lib" ;;
4497 # Collect preopened libtool deplibs, except any this library
4498 # has declared as weak libs
4499 for deplib in $dependency_libs; do
4500 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
4501 case " $weak_libs " in
4502 *" $deplib_base "*) ;;
4503 *) deplibs="$deplibs $deplib" ;;
4509 if test "$pass" = dlopen; then
4510 # Collect dlpreopened libraries
4511 save_deplibs="$deplibs"
4515 for deplib in $libs; do
4519 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4520 if test "$linkmode,$pass" = "prog,link"; then
4521 compile_deplibs="$deplib $compile_deplibs"
4522 finalize_deplibs="$deplib $finalize_deplibs"
4524 compiler_flags="$compiler_flags $deplib"
4525 if test "$linkmode" = lib ; then
4526 case "$new_inherited_linker_flags " in
4528 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
4535 if test "$linkmode" != lib && test "$linkmode" != prog; then
4536 func_warning "\`-l' is ignored for archives/objects"
4539 func_stripname '-l' '' "$deplib"
4540 name=$func_stripname_result
4541 if test "$linkmode" = lib; then
4542 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
4544 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
4546 for searchdir in $searchdirs; do
4547 for search_ext in .la $std_shrext .so .a; do
4548 # Search the libtool library
4549 lib="$searchdir/lib${name}${search_ext}"
4550 if test -f "$lib"; then
4551 if test "$search_ext" = ".la"; then
4560 if test "$found" != yes; then
4561 # deplib doesn't seem to be a libtool library
4562 if test "$linkmode,$pass" = "prog,link"; then
4563 compile_deplibs="$deplib $compile_deplibs"
4564 finalize_deplibs="$deplib $finalize_deplibs"
4566 deplibs="$deplib $deplibs"
4567 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
4570 else # deplib is a libtool library
4571 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
4572 # We need to do some special things here, and not later.
4573 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
4574 case " $predeps $postdeps " in
4576 if func_lalib_p "$lib"; then
4580 for l in $old_library $library_names; do
4583 if test "X$ll" = "X$old_library" ; then # only static version available
4585 func_dirname "$lib" "" "."
4586 ladir="$func_dirname_result"
4587 lib=$ladir/$old_library
4588 if test "$linkmode,$pass" = "prog,link"; then
4589 compile_deplibs="$deplib $compile_deplibs"
4590 finalize_deplibs="$deplib $finalize_deplibs"
4592 deplibs="$deplib $deplibs"
4593 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
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 if test "$linkmode" = lib ; then
4611 case "$new_inherited_linker_flags " in
4613 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
4622 deplibs="$deplib $deplibs"
4623 test "$pass" = conv && continue
4624 newdependency_libs="$deplib $newdependency_libs"
4625 func_stripname '-L' '' "$deplib"
4626 newlib_search_path="$newlib_search_path $func_stripname_result"
4629 if test "$pass" = conv; then
4630 deplibs="$deplib $deplibs"
4633 if test "$pass" = scan; then
4634 deplibs="$deplib $deplibs"
4636 compile_deplibs="$deplib $compile_deplibs"
4637 finalize_deplibs="$deplib $finalize_deplibs"
4639 func_stripname '-L' '' "$deplib"
4640 newlib_search_path="$newlib_search_path $func_stripname_result"
4643 func_warning "\`-L' is ignored for archives/objects"
4649 if test "$pass" = link; then
4650 func_stripname '-R' '' "$deplib"
4651 dir=$func_stripname_result
4652 # Make sure the xrpath contains only unique directories.
4655 *) xrpath="$xrpath $dir" ;;
4658 deplibs="$deplib $deplibs"
4661 *.la) lib="$deplib" ;;
4663 if test "$pass" = conv; then
4664 deplibs="$deplib $deplibs"
4669 # Linking convenience modules into shared libraries is allowed,
4670 # but linking other static libraries is non-portable.
4671 case " $dlpreconveniencelibs " in
4675 case $deplibs_check_method in
4677 set dummy $deplibs_check_method; shift
4678 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
4679 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
4680 | $EGREP "$match_pattern_regex" > /dev/null; then
4688 if test "$valid_a_lib" != yes; then
4690 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
4691 $ECHO "*** I have the capability to make that library automatically link in when"
4692 $ECHO "*** you link to this library. But I can only do this if you have a"
4693 $ECHO "*** shared version of the library, which you do not appear to have"
4694 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
4695 $ECHO "*** that it is just a static archive that I should not use here."
4698 $ECHO "*** Warning: Linking the shared library $output against the"
4699 $ECHO "*** static library $deplib is not portable!"
4700 deplibs="$deplib $deplibs"
4707 if test "$pass" != link; then
4708 deplibs="$deplib $deplibs"
4710 compile_deplibs="$deplib $compile_deplibs"
4711 finalize_deplibs="$deplib $finalize_deplibs"
4718 if test "$pass" = conv; then
4719 deplibs="$deplib $deplibs"
4720 elif test "$linkmode" = prog; then
4721 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
4722 # If there is no dlopen support or we're linking statically,
4723 # we need to preload.
4724 newdlprefiles="$newdlprefiles $deplib"
4725 compile_deplibs="$deplib $compile_deplibs"
4726 finalize_deplibs="$deplib $finalize_deplibs"
4728 newdlfiles="$newdlfiles $deplib"
4739 if test "$found" = yes || test -f "$lib"; then :
4741 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
4744 # Check to see that this really is a libtool archive.
4745 func_lalib_unsafe_p "$lib" \
4746 || func_fatal_error "\`$lib' is not a valid libtool archive"
4748 func_dirname "$lib" "" "."
4749 ladir="$func_dirname_result"
4757 inherited_linker_flags=
4758 # If the library was installed with an old release of libtool,
4759 # it will not redefine variables installed, or shouldnotlink
4768 # Convert "-framework foo" to "foo.ltframework"
4769 if test -n "$inherited_linker_flags"; then
4770 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
4771 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
4772 case " $new_inherited_linker_flags " in
4773 *" $tmp_inherited_linker_flag "*) ;;
4774 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
4778 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
4779 if test "$linkmode,$pass" = "lib,link" ||
4780 test "$linkmode,$pass" = "prog,scan" ||
4781 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
4782 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
4783 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
4786 if test "$pass" = conv; then
4787 # Only check for convenience libraries
4788 deplibs="$lib $deplibs"
4789 if test -z "$libdir"; then
4790 if test -z "$old_library"; then
4791 func_fatal_error "cannot find name of link library for \`$lib'"
4793 # It is a libtool convenience library, so add in its objects.
4794 convenience="$convenience $ladir/$objdir/$old_library"
4795 old_convenience="$old_convenience $ladir/$objdir/$old_library"
4796 elif test "$linkmode" != prog && test "$linkmode" != lib; then
4797 func_fatal_error "\`$lib' is not a convenience library"
4800 for deplib in $dependency_libs; do
4801 deplibs="$deplib $deplibs"
4802 if $opt_duplicate_deps ; then
4803 case "$tmp_libs " in
4804 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4807 tmp_libs="$tmp_libs $deplib"
4813 # Get the name of the library we link against.
4815 for l in $old_library $library_names; do
4818 if test -z "$linklib"; then
4819 func_fatal_error "cannot find name of link library for \`$lib'"
4822 # This library was specified with -dlopen.
4823 if test "$pass" = dlopen; then
4824 if test -z "$libdir"; then
4825 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
4827 if test -z "$dlname" ||
4828 test "$dlopen_support" != yes ||
4829 test "$build_libtool_libs" = no; then
4830 # If there is no dlname, no dlopen support or we're linking
4831 # statically, we need to preload. We also need to preload any
4832 # dependent libraries so libltdl's deplib preloader doesn't
4833 # bomb out in the load deplibs phase.
4834 dlprefiles="$dlprefiles $lib $dependency_libs"
4836 newdlfiles="$newdlfiles $lib"
4841 # We need an absolute path.
4843 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
4845 abs_ladir=`cd "$ladir" && pwd`
4846 if test -z "$abs_ladir"; then
4847 func_warning "cannot determine absolute directory name of \`$ladir'"
4848 func_warning "passing it literally to the linker, although it might fail"
4853 func_basename "$lib"
4854 laname="$func_basename_result"
4856 # Find the relevant object directory and library name.
4857 if test "X$installed" = Xyes; then
4858 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
4859 func_warning "library \`$lib' was moved."
4867 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
4869 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
4872 # Remove this search path later
4873 notinst_path="$notinst_path $abs_ladir"
4875 dir="$ladir/$objdir"
4876 absdir="$abs_ladir/$objdir"
4877 # Remove this search path later
4878 notinst_path="$notinst_path $abs_ladir"
4880 fi # $installed = yes
4881 func_stripname 'lib' '.la' "$laname"
4882 name=$func_stripname_result
4884 # This library was specified with -dlpreopen.
4885 if test "$pass" = dlpreopen; then
4886 if test -z "$libdir" && test "$linkmode" = prog; then
4887 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
4889 # Prefer using a static library (so that no silly _DYNAMIC symbols
4890 # are required to link).
4891 if test -n "$old_library"; then
4892 newdlprefiles="$newdlprefiles $dir/$old_library"
4893 # Keep a list of preopened convenience libraries to check
4894 # that they are being used correctly in the link pass.
4895 test -z "$libdir" && \
4896 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
4897 # Otherwise, use the dlname, so that lt_dlopen finds it.
4898 elif test -n "$dlname"; then
4899 newdlprefiles="$newdlprefiles $dir/$dlname"
4901 newdlprefiles="$newdlprefiles $dir/$linklib"
4903 fi # $pass = dlpreopen
4905 if test -z "$libdir"; then
4906 # Link the convenience library
4907 if test "$linkmode" = lib; then
4908 deplibs="$dir/$old_library $deplibs"
4909 elif test "$linkmode,$pass" = "prog,link"; then
4910 compile_deplibs="$dir/$old_library $compile_deplibs"
4911 finalize_deplibs="$dir/$old_library $finalize_deplibs"
4913 deplibs="$lib $deplibs" # used for prog,scan pass
4919 if test "$linkmode" = prog && test "$pass" != link; then
4920 newlib_search_path="$newlib_search_path $ladir"
4921 deplibs="$lib $deplibs"
4924 if test "$link_all_deplibs" != no || test -z "$library_names" ||
4925 test "$build_libtool_libs" = no; then
4930 for deplib in $dependency_libs; do
4932 -L*) func_stripname '-L' '' "$deplib"
4933 newlib_search_path="$newlib_search_path $func_stripname_result"
4936 # Need to link against all dependency_libs?
4937 if test "$linkalldeplibs" = yes; then
4938 deplibs="$deplib $deplibs"
4940 # Need to hardcode shared library paths
4941 # or/and link against static libraries
4942 newdependency_libs="$deplib $newdependency_libs"
4944 if $opt_duplicate_deps ; then
4945 case "$tmp_libs " in
4946 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4949 tmp_libs="$tmp_libs $deplib"
4952 fi # $linkmode = prog...
4954 if test "$linkmode,$pass" = "prog,link"; then
4955 if test -n "$library_names" &&
4956 { { test "$prefer_static_libs" = no ||
4957 test "$prefer_static_libs,$installed" = "built,yes"; } ||
4958 test -z "$old_library"; }; then
4959 # We need to hardcode the library path
4960 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
4961 # Make sure the rpath contains only unique directories.
4962 case "$temp_rpath:" in
4964 *) temp_rpath="$temp_rpath$absdir:" ;;
4968 # Hardcode the library path.
4969 # Skip directories that are in the system default run-time
4971 case " $sys_lib_dlsearch_path " in
4974 case "$compile_rpath " in
4976 *) compile_rpath="$compile_rpath $absdir"
4980 case " $sys_lib_dlsearch_path " in
4983 case "$finalize_rpath " in
4985 *) finalize_rpath="$finalize_rpath $libdir"
4989 fi # $linkmode,$pass = prog,link...
4991 if test "$alldeplibs" = yes &&
4992 { test "$deplibs_check_method" = pass_all ||
4993 { test "$build_libtool_libs" = yes &&
4994 test -n "$library_names"; }; }; then
4995 # We only need to search for static libraries
5000 link_static=no # Whether the deplib will be linked statically
5001 use_static_libs=$prefer_static_libs
5002 if test "$use_static_libs" = built && test "$installed" = yes; then
5005 if test -n "$library_names" &&
5006 { test "$use_static_libs" = no || test -z "$old_library"; }; then
5009 # No point in relinking DLLs because paths are not encoded
5010 notinst_deplibs="$notinst_deplibs $lib"
5014 if test "$installed" = no; then
5015 notinst_deplibs="$notinst_deplibs $lib"
5020 # This is a shared library
5022 # Warn about portability, can't link against -module's on some
5023 # systems (darwin). Don't bleat about dlopened modules though!
5025 for dlpremoduletest in $dlprefiles; do
5026 if test "X$dlpremoduletest" = "X$lib"; then
5027 dlopenmodule="$dlpremoduletest"
5031 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
5033 if test "$linkmode" = prog; then
5034 $ECHO "*** Warning: Linking the executable $output against the loadable module"
5036 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
5038 $ECHO "*** $linklib is not portable!"
5040 if test "$linkmode" = lib &&
5041 test "$hardcode_into_libs" = yes; then
5042 # Hardcode the library path.
5043 # Skip directories that are in the system default run-time
5045 case " $sys_lib_dlsearch_path " in
5048 case "$compile_rpath " in
5050 *) compile_rpath="$compile_rpath $absdir"
5054 case " $sys_lib_dlsearch_path " in
5057 case "$finalize_rpath " in
5059 *) finalize_rpath="$finalize_rpath $libdir"
5065 if test -n "$old_archive_from_expsyms_cmds"; then
5066 # figure out the soname
5067 set dummy $library_names
5071 libname=`eval "\\$ECHO \"$libname_spec\""`
5072 # use dlname if we got it. it's perfectly good, no?
5073 if test -n "$dlname"; then
5075 elif test -n "$soname_spec"; then
5079 major=`expr $current - $age`
5083 eval soname=\"$soname_spec\"
5088 # Make a new name for the extract_expsyms_cmds to use
5090 func_basename "$soroot"
5091 soname="$func_basename_result"
5092 func_stripname 'lib' '.dll' "$soname"
5093 newlib=libimp-$func_stripname_result.a
5095 # If the library has no export list, then create one now
5096 if test -f "$output_objdir/$soname-def"; then :
5098 func_verbose "extracting exported symbol list from \`$soname'"
5099 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
5103 if test -f "$output_objdir/$newlib"; then :; else
5104 func_verbose "generating import library for \`$soname'"
5105 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
5107 # make sure the library variables are pointing to the new library
5110 fi # test -n "$old_archive_from_expsyms_cmds"
5112 if test "$linkmode" = prog || test "$mode" != relink; then
5117 case $hardcode_action in
5118 immediate | unsupported)
5119 if test "$hardcode_direct" = no; then
5122 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
5123 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
5124 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
5125 *-*-unixware7*) add_dir="-L$dir" ;;
5127 # if the lib is a (non-dlopened) module then we can not
5128 # link against it, someone is ignoring the earlier warnings
5129 if /usr/bin/file -L $add 2> /dev/null |
5130 $GREP ": [^:]* bundle" >/dev/null ; then
5131 if test "X$dlopenmodule" != "X$lib"; then
5132 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
5133 if test -z "$old_library" ; then
5135 $ECHO "*** And there doesn't seem to be a static archive available"
5136 $ECHO "*** The link will probably fail, sorry"
5138 add="$dir/$old_library"
5140 elif test -n "$old_library"; then
5141 add="$dir/$old_library"
5145 elif test "$hardcode_minus_L" = no; then
5147 *-*-sunos*) add_shlibpath="$dir" ;;
5151 elif test "$hardcode_shlibpath_var" = no; then
5152 add_shlibpath="$dir"
5159 if test "$hardcode_direct" = yes &&
5160 test "$hardcode_direct_absolute" = no; then
5162 elif test "$hardcode_minus_L" = yes; then
5164 # Try looking first in the location we're being installed to.
5165 if test -n "$inst_prefix_dir"; then
5168 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5173 elif test "$hardcode_shlibpath_var" = yes; then
5174 add_shlibpath="$dir"
5183 if test "$lib_linked" != yes; then
5184 func_fatal_configuration "unsupported hardcode properties"
5187 if test -n "$add_shlibpath"; then
5188 case :$compile_shlibpath: in
5189 *":$add_shlibpath:"*) ;;
5190 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
5193 if test "$linkmode" = prog; then
5194 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
5195 test -n "$add" && compile_deplibs="$add $compile_deplibs"
5197 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5198 test -n "$add" && deplibs="$add $deplibs"
5199 if test "$hardcode_direct" != yes &&
5200 test "$hardcode_minus_L" != yes &&
5201 test "$hardcode_shlibpath_var" = yes; then
5202 case :$finalize_shlibpath: in
5204 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5210 if test "$linkmode" = prog || test "$mode" = relink; then
5214 # Finalize command for both is simple: just hardcode it.
5215 if test "$hardcode_direct" = yes &&
5216 test "$hardcode_direct_absolute" = no; then
5217 add="$libdir/$linklib"
5218 elif test "$hardcode_minus_L" = yes; then
5221 elif test "$hardcode_shlibpath_var" = yes; then
5222 case :$finalize_shlibpath: in
5224 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5227 elif test "$hardcode_automatic" = yes; then
5228 if test -n "$inst_prefix_dir" &&
5229 test -f "$inst_prefix_dir$libdir/$linklib" ; then
5230 add="$inst_prefix_dir$libdir/$linklib"
5232 add="$libdir/$linklib"
5235 # We cannot seem to hardcode it, guess we'll fake it.
5237 # Try looking first in the location we're being installed to.
5238 if test -n "$inst_prefix_dir"; then
5241 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5248 if test "$linkmode" = prog; then
5249 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
5250 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
5252 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5253 test -n "$add" && deplibs="$add $deplibs"
5256 elif test "$linkmode" = prog; then
5257 # Here we assume that one of hardcode_direct or hardcode_minus_L
5258 # is not unsupported. This is valid on all known static and
5260 if test "$hardcode_direct" != unsupported; then
5261 test -n "$old_library" && linklib="$old_library"
5262 compile_deplibs="$dir/$linklib $compile_deplibs"
5263 finalize_deplibs="$dir/$linklib $finalize_deplibs"
5265 compile_deplibs="-l$name -L$dir $compile_deplibs"
5266 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
5268 elif test "$build_libtool_libs" = yes; then
5269 # Not a shared library
5270 if test "$deplibs_check_method" != pass_all; then
5271 # We're trying link a shared library against a static one
5272 # but the system doesn't support it.
5274 # Just print a warning and add the library to dependency_libs so
5275 # that the program can be linked against the static library.
5277 $ECHO "*** Warning: This system can not link to static lib archive $lib."
5278 $ECHO "*** I have the capability to make that library automatically link in when"
5279 $ECHO "*** you link to this library. But I can only do this if you have a"
5280 $ECHO "*** shared version of the library, which you do not appear to have."
5281 if test "$module" = yes; then
5282 $ECHO "*** But as you try to build a module library, libtool will still create "
5283 $ECHO "*** a static module, that should work as long as the dlopening application"
5284 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
5285 if test -z "$global_symbol_pipe"; then
5287 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5288 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5289 $ECHO "*** not find such a program. So, this module is probably useless."
5290 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
5292 if test "$build_old_libs" = no; then
5293 build_libtool_libs=module
5296 build_libtool_libs=no
5300 deplibs="$dir/$old_library $deplibs"
5303 fi # link shared/static library?
5305 if test "$linkmode" = lib; then
5306 if test -n "$dependency_libs" &&
5307 { test "$hardcode_into_libs" != yes ||
5308 test "$build_old_libs" = yes ||
5309 test "$link_static" = yes; }; then
5310 # Extract -R from dependency_libs
5312 for libdir in $dependency_libs; do
5314 -R*) func_stripname '-R' '' "$libdir"
5315 temp_xrpath=$func_stripname_result
5317 *" $temp_xrpath "*) ;;
5318 *) xrpath="$xrpath $temp_xrpath";;
5320 *) temp_deplibs="$temp_deplibs $libdir";;
5323 dependency_libs="$temp_deplibs"
5326 newlib_search_path="$newlib_search_path $absdir"
5327 # Link against this library
5328 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
5329 # ... and its dependency_libs
5331 for deplib in $dependency_libs; do
5332 newdependency_libs="$deplib $newdependency_libs"
5333 if $opt_duplicate_deps ; then
5334 case "$tmp_libs " in
5335 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5338 tmp_libs="$tmp_libs $deplib"
5341 if test "$link_all_deplibs" != no; then
5342 # Add the search paths of all dependency libraries
5343 for deplib in $dependency_libs; do
5345 -L*) path="$deplib" ;;
5347 func_dirname "$deplib" "" "."
5348 dir="$func_dirname_result"
5349 # We need an absolute path.
5351 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
5353 absdir=`cd "$dir" && pwd`
5354 if test -z "$absdir"; then
5355 func_warning "cannot determine absolute directory name of \`$dir'"
5360 if $GREP "^installed=no" $deplib > /dev/null; then
5364 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
5365 if test -n "$deplibrary_names" ; then
5366 for tmp in $deplibrary_names ; do
5369 if test -f "$absdir/$objdir/$depdepl" ; then
5370 depdepl="$absdir/$objdir/$depdepl"
5371 darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
5372 darwin_install_name=`$ECHO $darwin_install_name`
5373 if test -z "$darwin_install_name"; then
5374 darwin_install_name=`otool64 -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
5375 darwin_install_name=`$ECHO $darwin_install_name`
5377 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
5378 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
5384 path="-L$absdir/$objdir"
5388 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5389 test -z "$libdir" && \
5390 func_fatal_error "\`$deplib' is not a valid libtool archive"
5391 test "$absdir" != "$libdir" && \
5392 func_warning "\`$deplib' seems to be moved"
5398 case " $deplibs " in
5400 *) deplibs="$path $deplibs" ;;
5403 fi # link_all_deplibs != no
5405 done # for deplib in $libs
5406 if test "$pass" = link; then
5407 if test "$linkmode" = "prog"; then
5408 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
5409 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
5411 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5414 dependency_libs="$newdependency_libs"
5415 if test "$pass" = dlpreopen; then
5416 # Link the dlpreopened libraries before other libraries
5417 for deplib in $save_deplibs; do
5418 deplibs="$deplib $deplibs"
5421 if test "$pass" != dlopen; then
5422 if test "$pass" != conv; then
5423 # Make sure lib_search_path contains only unique directories.
5425 for dir in $newlib_search_path; do
5426 case "$lib_search_path " in
5428 *) lib_search_path="$lib_search_path $dir" ;;
5434 if test "$linkmode,$pass" != "prog,link"; then
5437 vars="compile_deplibs finalize_deplibs"
5439 for var in $vars dependency_libs; do
5440 # Add libraries to $var in reverse order
5441 eval tmp_libs=\"\$$var\"
5443 for deplib in $tmp_libs; do
5444 # FIXME: Pedantically, this is the right thing to do, so
5445 # that some nasty dependency loop isn't accidentally
5447 #new_libs="$deplib $new_libs"
5448 # Pragmatically, this seems to cause very few problems in
5451 -L*) new_libs="$deplib $new_libs" ;;
5454 # And here is the reason: when a library appears more
5455 # than once as an explicit dependence of a library, or
5456 # is implicitly linked in more than once by the
5457 # compiler, it is considered special, and multiple
5458 # occurrences thereof are not removed. Compare this
5459 # with having the same library being listed as a
5460 # dependency of multiple other libraries: in this case,
5461 # we know (pedantically, we assume) the library does not
5462 # need to be listed more than once, so we keep only the
5463 # last copy. This is not always right, but it is rare
5464 # enough that we require users that really mean to play
5465 # such unportable linking tricks to link the library
5466 # using -Wl,-lname, so that libtool does not consider it
5467 # for duplicate removal.
5468 case " $specialdeplibs " in
5469 *" $deplib "*) new_libs="$deplib $new_libs" ;;
5471 case " $new_libs " in
5473 *) new_libs="$deplib $new_libs" ;;
5481 for deplib in $new_libs; do
5484 case " $tmp_libs " in
5486 *) tmp_libs="$tmp_libs $deplib" ;;
5489 *) tmp_libs="$tmp_libs $deplib" ;;
5492 eval $var=\"$tmp_libs\"
5495 # Last step: remove runtime libs from dependency_libs
5496 # (they stay in deplibs)
5498 for i in $dependency_libs ; do
5499 case " $predeps $postdeps $compiler_lib_search_path " in
5504 if test -n "$i" ; then
5505 tmp_libs="$tmp_libs $i"
5508 dependency_libs=$tmp_libs
5510 if test "$linkmode" = prog; then
5511 dlfiles="$newdlfiles"
5513 if test "$linkmode" = prog || test "$linkmode" = lib; then
5514 dlprefiles="$newdlprefiles"
5519 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
5520 func_warning "\`-dlopen' is ignored for archives"
5525 func_warning "\`-l' and \`-L' are ignored for archives" ;;
5528 test -n "$rpath" && \
5529 func_warning "\`-rpath' is ignored for archives"
5531 test -n "$xrpath" && \
5532 func_warning "\`-R' is ignored for archives"
5534 test -n "$vinfo" && \
5535 func_warning "\`-version-info/-version-number' is ignored for archives"
5537 test -n "$release" && \
5538 func_warning "\`-release' is ignored for archives"
5540 test -n "$export_symbols$export_symbols_regex" && \
5541 func_warning "\`-export-symbols' is ignored for archives"
5543 # Now set the variables for building old libraries.
5544 build_libtool_libs=no
5546 objs="$objs$old_deplibs"
5550 # Make sure we only generate libraries of the form `libNAME.la'.
5553 func_stripname 'lib' '.la' "$outputname"
5554 name=$func_stripname_result
5555 eval shared_ext=\"$shrext_cmds\"
5556 eval libname=\"$libname_spec\"
5559 test "$module" = no && \
5560 func_fatal_help "libtool library \`$output' must begin with \`lib'"
5562 if test "$need_lib_prefix" != no; then
5563 # Add the "lib" prefix for modules if required
5564 func_stripname '' '.la' "$outputname"
5565 name=$func_stripname_result
5566 eval shared_ext=\"$shrext_cmds\"
5567 eval libname=\"$libname_spec\"
5569 func_stripname '' '.la' "$outputname"
5570 libname=$func_stripname_result
5575 if test -n "$objs"; then
5576 if test "$deplibs_check_method" != pass_all; then
5577 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
5580 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
5581 $ECHO "*** objects $objs is not portable!"
5582 libobjs="$libobjs $objs"
5586 test "$dlself" != no && \
5587 func_warning "\`-dlopen self' is ignored for libtool libraries"
5591 test "$#" -gt 1 && \
5592 func_warning "ignoring multiple \`-rpath's for a libtool library"
5597 if test -z "$rpath"; then
5598 if test "$build_libtool_libs" = yes; then
5599 # Building a libtool convenience library.
5600 # Some compilers have problems with a `.al' extension so
5601 # convenience libraries should have the same extension an
5602 # archive normally would.
5603 oldlibs="$output_objdir/$libname.$libext $oldlibs"
5604 build_libtool_libs=convenience
5608 test -n "$vinfo" && \
5609 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
5611 test -n "$release" && \
5612 func_warning "\`-release' is ignored for convenience libraries"
5615 # Parse the version information argument.
5616 save_ifs="$IFS"; IFS=':'
5617 set dummy $vinfo 0 0 0
5622 func_fatal_help "too many parameters to \`-version-info'"
5624 # convert absolute version numbers to libtool ages
5625 # this retains compatibility with .la files and attempts
5626 # to make the code below a bit more comprehensible
5628 case $vinfo_number in
5632 number_revision="$3"
5634 # There are really only two kinds -- those that
5635 # use the current revision as the major version
5636 # and those that subtract age and use age as
5637 # a minor version. But, then there is irix
5638 # which has an extra 1 added just for fun
5640 case $version_type in
5641 darwin|linux|osf|windows|none)
5642 current=`expr $number_major + $number_minor`
5644 revision="$number_revision"
5646 freebsd-aout|freebsd-elf|sunos)
5647 current="$number_major"
5648 revision="$number_minor"
5652 current=`expr $number_major + $number_minor`
5654 revision="$number_minor"
5655 lt_irix_increment=no
5666 # Check that each of the things are valid numbers.
5668 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]) ;;
5670 func_error "CURRENT \`$current' must be a nonnegative integer"
5671 func_fatal_error "\`$vinfo' is not valid version information"
5676 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]) ;;
5678 func_error "REVISION \`$revision' must be a nonnegative integer"
5679 func_fatal_error "\`$vinfo' is not valid version information"
5684 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]) ;;
5686 func_error "AGE \`$age' must be a nonnegative integer"
5687 func_fatal_error "\`$vinfo' is not valid version information"
5691 if test "$age" -gt "$current"; then
5692 func_error "AGE \`$age' is greater than the current interface number \`$current'"
5693 func_fatal_error "\`$vinfo' is not valid version information"
5696 # Calculate the version variables.
5700 case $version_type in
5704 # Like Linux, but with the current version available in
5705 # verstring for coding it into the library header
5706 major=.`expr $current - $age`
5707 versuffix="$major.$age.$revision"
5708 # Darwin ld doesn't like 0 for these options...
5709 minor_current=`expr $current + 1`
5710 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
5711 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
5716 versuffix=".$current.$revision";
5721 versuffix=".$current"
5725 if test "X$lt_irix_increment" = "Xno"; then
5726 major=`expr $current - $age`
5728 major=`expr $current - $age + 1`
5731 case $version_type in
5732 nonstopux) verstring_prefix=nonstopux ;;
5733 *) verstring_prefix=sgi ;;
5735 verstring="$verstring_prefix$major.$revision"
5737 # Add in all the interfaces that we are compatible with.
5739 while test "$loop" -ne 0; do
5740 iface=`expr $revision - $loop`
5741 loop=`expr $loop - 1`
5742 verstring="$verstring_prefix$major.$iface:$verstring"
5745 # Before this point, $major must not contain `.'.
5747 versuffix="$major.$revision"
5751 major=.`expr $current - $age`
5752 versuffix="$major.$age.$revision"
5756 major=.`expr $current - $age`
5757 versuffix=".$current.$age.$revision"
5758 verstring="$current.$age.$revision"
5760 # Add in all the interfaces that we are compatible with.
5762 while test "$loop" -ne 0; do
5763 iface=`expr $current - $loop`
5764 loop=`expr $loop - 1`
5765 verstring="$verstring:${iface}.0"
5768 # Make executables depend on our current version.
5769 verstring="$verstring:${current}.0"
5774 versuffix=".$current"
5779 versuffix=".$current.$revision"
5783 # Use '-' rather than '.', since we only want one
5784 # extension on DOS 8.3 filesystems.
5785 major=`expr $current - $age`
5790 func_fatal_configuration "unknown library version type \`$version_type'"
5794 # Clear the version info if we defaulted, and they specified a release.
5795 if test -z "$vinfo" && test -n "$release"; then
5797 case $version_type in
5799 # we can't check for "0.0" in archive_cmds due to quoting
5800 # problems, so we reset it completely
5807 if test "$need_version" = no; then
5814 # Remove version info from name if versioning should be avoided
5815 if test "$avoid_version" = yes && test "$need_version" = no; then
5821 # Check to see if the archive will have undefined symbols.
5822 if test "$allow_undefined" = yes; then
5823 if test "$allow_undefined_flag" = unsupported; then
5824 func_warning "undefined symbols not allowed in $host shared libraries"
5825 build_libtool_libs=no
5829 # Don't allow undefined symbols.
5830 allow_undefined_flag="$no_undefined_flag"
5835 func_generate_dlsyms "$libname" "$libname" "yes"
5836 libobjs="$libobjs $symfileobj"
5837 test "X$libobjs" = "X " && libobjs=
5839 if test "$mode" != relink; then
5840 # Remove our outputs, but don't remove object files since they
5841 # may have been created when compiling PIC objects.
5843 tempremovelist=`$ECHO "$output_objdir/*"`
5844 for p in $tempremovelist; do
5848 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
5849 if test "X$precious_files_regex" != "X"; then
5850 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
5855 removelist="$removelist $p"
5860 test -n "$removelist" && \
5861 func_show_eval "${RM}r \$removelist"
5864 # Now set the variables for building old libraries.
5865 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
5866 oldlibs="$oldlibs $output_objdir/$libname.$libext"
5868 # Transform .lo files to .o files.
5869 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
5872 # Eliminate all temporary directories.
5873 #for path in $notinst_path; do
5874 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
5875 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
5876 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
5879 if test -n "$xrpath"; then
5880 # If the user specified any rpath flags, then add them.
5882 for libdir in $xrpath; do
5883 temp_xrpath="$temp_xrpath -R$libdir"
5884 case "$finalize_rpath " in
5886 *) finalize_rpath="$finalize_rpath $libdir" ;;
5889 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
5890 dependency_libs="$temp_xrpath $dependency_libs"
5894 # Make sure dlfiles contains only unique files that won't be dlpreopened
5895 old_dlfiles="$dlfiles"
5897 for lib in $old_dlfiles; do
5898 case " $dlprefiles $dlfiles " in
5900 *) dlfiles="$dlfiles $lib" ;;
5904 # Make sure dlprefiles contains only unique files
5905 old_dlprefiles="$dlprefiles"
5907 for lib in $old_dlprefiles; do
5908 case "$dlprefiles " in
5910 *) dlprefiles="$dlprefiles $lib" ;;
5914 if test "$build_libtool_libs" = yes; then
5915 if test -n "$rpath"; then
5917 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
5918 # these systems don't actually have a c library (as such)!
5920 *-*-rhapsody* | *-*-darwin1.[012])
5921 # Rhapsody C library is in the System framework
5922 deplibs="$deplibs System.ltframework"
5925 # Don't link with libc until the a.out ld.so is fixed.
5927 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5928 # Do not include libc due to us having libc/libc_r.
5930 *-*-sco3.2v5* | *-*-sco5v6*)
5931 # Causes problems with __ctype
5933 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5934 # Compiler inserts libc in the correct place for threads to work
5937 # Add libc to deplibs on all other systems if necessary.
5938 if test "$build_libtool_need_lc" = "yes"; then
5939 deplibs="$deplibs -lc"
5945 # Transform deplibs into only deplibs that can be linked in shared.
5947 libname_save=$libname
5948 release_save=$release
5949 versuffix_save=$versuffix
5951 # I'm not sure if I'm treating the release correctly. I think
5952 # release should show up in the -l (ie -lgmp5) so we don't want to
5953 # add it in twice. Is that correct?
5959 case $deplibs_check_method in
5961 # Don't check for shared/static. Everything works.
5962 # This might be a little naive. We might want to check
5963 # whether the library exists or not. But this is on
5964 # osf3 & osf4 and I'm not really sure... Just
5965 # implementing what was already the behavior.
5969 # This code stresses the "libraries are programs" paradigm to its
5970 # limits. Maybe even breaks it. We compile a program, linking it
5971 # against the deplibs as a proxy for the library. Then we can check
5972 # whether they linked in statically or dynamically with ldd.
5973 $opt_dry_run || $RM conftest.c
5974 cat > conftest.c <<EOF
5975 int main() { return 0; }
5977 $opt_dry_run || $RM conftest
5978 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
5979 ldd_output=`ldd conftest`
5980 for i in $deplibs; do
5981 name=`expr $i : '-l\(.*\)'`
5982 # If $name is empty we are operating on a -L argument.
5983 if test "$name" != "" && test "$name" != "0"; then
5984 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5985 case " $predeps $postdeps " in
5987 newdeplibs="$newdeplibs $i"
5992 if test -n "$i" ; then
5993 libname=`eval "\\$ECHO \"$libname_spec\""`
5994 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5995 set dummy $deplib_matches; shift
5997 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5998 newdeplibs="$newdeplibs $i"
6002 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6003 $ECHO "*** I have the capability to make that library automatically link in when"
6004 $ECHO "*** you link to this library. But I can only do this if you have a"
6005 $ECHO "*** shared version of the library, which I believe you do not have"
6006 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
6007 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
6011 newdeplibs="$newdeplibs $i"
6015 # Error occurred in the first compile. Let's try to salvage
6016 # the situation: Compile a separate program for each library.
6017 for i in $deplibs; do
6018 name=`expr $i : '-l\(.*\)'`
6019 # If $name is empty we are operating on a -L argument.
6020 if test "$name" != "" && test "$name" != "0"; then
6021 $opt_dry_run || $RM conftest
6022 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
6023 ldd_output=`ldd conftest`
6024 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6025 case " $predeps $postdeps " in
6027 newdeplibs="$newdeplibs $i"
6032 if test -n "$i" ; then
6033 libname=`eval "\\$ECHO \"$libname_spec\""`
6034 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6035 set dummy $deplib_matches; shift
6037 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6038 newdeplibs="$newdeplibs $i"
6042 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6043 $ECHO "*** I have the capability to make that library automatically link in when"
6044 $ECHO "*** you link to this library. But I can only do this if you have a"
6045 $ECHO "*** shared version of the library, which you do not appear to have"
6046 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
6047 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
6053 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
6054 $ECHO "*** make it link in! You will probably need to install it or some"
6055 $ECHO "*** library that it depends on before this library will be fully"
6056 $ECHO "*** functional. Installing it before continuing would be even better."
6059 newdeplibs="$newdeplibs $i"
6065 set dummy $deplibs_check_method; shift
6066 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6067 for a_deplib in $deplibs; do
6068 name=`expr $a_deplib : '-l\(.*\)'`
6069 # If $name is empty we are operating on a -L argument.
6070 if test "$name" != "" && test "$name" != "0"; then
6071 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6072 case " $predeps $postdeps " in
6074 newdeplibs="$newdeplibs $a_deplib"
6079 if test -n "$a_deplib" ; then
6080 libname=`eval "\\$ECHO \"$libname_spec\""`
6081 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6082 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6083 for potent_lib in $potential_libs; do
6084 # Follow soft links.
6085 if ls -lLd "$potent_lib" 2>/dev/null |
6086 $GREP " -> " >/dev/null; then
6089 # The statement above tries to avoid entering an
6090 # endless loop below, in case of cyclic links.
6091 # We might still enter an endless loop, since a link
6092 # loop can be closed while we follow links,
6094 potlib="$potent_lib"
6095 while test -h "$potlib" 2>/dev/null; do
6096 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
6098 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
6099 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
6102 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
6104 $EGREP "$file_magic_regex" > /dev/null; then
6105 newdeplibs="$newdeplibs $a_deplib"
6112 if test -n "$a_deplib" ; then
6115 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6116 $ECHO "*** I have the capability to make that library automatically link in when"
6117 $ECHO "*** you link to this library. But I can only do this if you have a"
6118 $ECHO "*** shared version of the library, which you do not appear to have"
6119 $ECHO "*** because I did check the linker path looking for a file starting"
6120 if test -z "$potlib" ; then
6121 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
6123 $ECHO "*** with $libname and none of the candidates passed a file format test"
6124 $ECHO "*** using a file magic. Last file checked: $potlib"
6128 # Add a -L argument.
6129 newdeplibs="$newdeplibs $a_deplib"
6131 done # Gone through all deplibs.
6134 set dummy $deplibs_check_method; shift
6135 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6136 for a_deplib in $deplibs; do
6137 name=`expr $a_deplib : '-l\(.*\)'`
6138 # If $name is empty we are operating on a -L argument.
6139 if test -n "$name" && test "$name" != "0"; then
6140 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6141 case " $predeps $postdeps " in
6143 newdeplibs="$newdeplibs $a_deplib"
6148 if test -n "$a_deplib" ; then
6149 libname=`eval "\\$ECHO \"$libname_spec\""`
6150 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6151 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6152 for potent_lib in $potential_libs; do
6153 potlib="$potent_lib" # see symlink-check above in file_magic test
6154 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
6155 $EGREP "$match_pattern_regex" > /dev/null; then
6156 newdeplibs="$newdeplibs $a_deplib"
6163 if test -n "$a_deplib" ; then
6166 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6167 $ECHO "*** I have the capability to make that library automatically link in when"
6168 $ECHO "*** you link to this library. But I can only do this if you have a"
6169 $ECHO "*** shared version of the library, which you do not appear to have"
6170 $ECHO "*** because I did check the linker path looking for a file starting"
6171 if test -z "$potlib" ; then
6172 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
6174 $ECHO "*** with $libname and none of the candidates passed a file format test"
6175 $ECHO "*** using a regex pattern. Last file checked: $potlib"
6179 # Add a -L argument.
6180 newdeplibs="$newdeplibs $a_deplib"
6182 done # Gone through all deplibs.
6186 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
6187 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
6188 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6189 for i in $predeps $postdeps ; do
6190 # can't use Xsed below, because $i might contain '/'
6191 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
6194 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
6195 $GREP . >/dev/null; then
6197 if test "X$deplibs_check_method" = "Xnone"; then
6198 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
6200 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
6202 $ECHO "*** All declared inter-library dependencies are being dropped."
6207 versuffix=$versuffix_save
6209 release=$release_save
6210 libname=$libname_save
6214 *-*-rhapsody* | *-*-darwin1.[012])
6215 # On Rhapsody replace the C library with the System framework
6216 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6220 if test "$droppeddeps" = yes; then
6221 if test "$module" = yes; then
6223 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
6224 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
6225 $ECHO "*** a static module, that should work as long as the dlopening"
6226 $ECHO "*** application is linked with the -dlopen flag."
6227 if test -z "$global_symbol_pipe"; then
6229 $ECHO "*** However, this would only work if libtool was able to extract symbol"
6230 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6231 $ECHO "*** not find such a program. So, this module is probably useless."
6232 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6234 if test "$build_old_libs" = no; then
6235 oldlibs="$output_objdir/$libname.$libext"
6236 build_libtool_libs=module
6239 build_libtool_libs=no
6242 $ECHO "*** The inter-library dependencies that have been dropped here will be"
6243 $ECHO "*** automatically added whenever a program is linked with this library"
6244 $ECHO "*** or is declared to -dlopen it."
6246 if test "$allow_undefined" = no; then
6248 $ECHO "*** Since this library must not contain undefined symbols,"
6249 $ECHO "*** because either the platform does not support them or"
6250 $ECHO "*** it was explicitly requested with -no-undefined,"
6251 $ECHO "*** libtool will only create a static version of it."
6252 if test "$build_old_libs" = no; then
6253 oldlibs="$output_objdir/$libname.$libext"
6254 build_libtool_libs=module
6257 build_libtool_libs=no
6262 # Done checking deplibs!
6265 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6268 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6269 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6270 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6274 # move library search paths that coincide with paths to not yet
6275 # installed libraries to the beginning of the library search list
6277 for path in $notinst_path; do
6278 case " $new_libs " in
6279 *" -L$path/$objdir "*) ;;
6281 case " $deplibs " in
6282 *" -L$path/$objdir "*)
6283 new_libs="$new_libs -L$path/$objdir" ;;
6288 for deplib in $deplibs; do
6291 case " $new_libs " in
6293 *) new_libs="$new_libs $deplib" ;;
6296 *) new_libs="$new_libs $deplib" ;;
6301 # All the library-specific variables (install_libdir is set above).
6306 # Test again, we may have decided not to build it any more
6307 if test "$build_libtool_libs" = yes; then
6308 if test "$hardcode_into_libs" = yes; then
6309 # Hardcode the library paths
6312 rpath="$finalize_rpath"
6313 test "$mode" != relink && rpath="$compile_rpath$rpath"
6314 for libdir in $rpath; do
6315 if test -n "$hardcode_libdir_flag_spec"; then
6316 if test -n "$hardcode_libdir_separator"; then
6317 if test -z "$hardcode_libdirs"; then
6318 hardcode_libdirs="$libdir"
6320 # Just accumulate the unique libdirs.
6321 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6322 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6325 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6330 eval flag=\"$hardcode_libdir_flag_spec\"
6331 dep_rpath="$dep_rpath $flag"
6333 elif test -n "$runpath_var"; then
6334 case "$perm_rpath " in
6336 *) perm_rpath="$perm_rpath $libdir" ;;
6340 # Substitute the hardcoded libdirs into the rpath.
6341 if test -n "$hardcode_libdir_separator" &&
6342 test -n "$hardcode_libdirs"; then
6343 libdir="$hardcode_libdirs"
6344 if test -n "$hardcode_libdir_flag_spec_ld"; then
6345 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
6347 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
6350 if test -n "$runpath_var" && test -n "$perm_rpath"; then
6351 # We should set the runpath_var.
6353 for dir in $perm_rpath; do
6356 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
6358 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
6361 shlibpath="$finalize_shlibpath"
6362 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
6363 if test -n "$shlibpath"; then
6364 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
6367 # Get the real and link names of the library.
6368 eval shared_ext=\"$shrext_cmds\"
6369 eval library_names=\"$library_names_spec\"
6370 set dummy $library_names
6375 if test -n "$soname_spec"; then
6376 eval soname=\"$soname_spec\"
6380 if test -z "$dlname"; then
6384 lib="$output_objdir/$realname"
6388 linknames="$linknames $link"
6391 # Use standard objects if they are pic
6392 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6393 test "X$libobjs" = "X " && libobjs=
6396 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6397 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
6398 export_symbols="$output_objdir/$libname.uexp"
6399 delfiles="$delfiles $export_symbols"
6402 orig_export_symbols=
6405 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
6406 # exporting using user supplied symfile
6407 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
6408 # and it's NOT already a .def file. Must figure out
6409 # which of the given symbols are data symbols and tag
6410 # them as such. So, trigger use of export_symbols_cmds.
6411 # export_symbols gets reassigned inside the "prepare
6412 # the list of exported symbols" if statement, so the
6413 # include_expsyms logic still works.
6414 orig_export_symbols="$export_symbols"
6416 always_export_symbols=yes
6422 # Prepare the list of exported symbols
6423 if test -z "$export_symbols"; then
6424 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
6425 func_verbose "generating symbol list for \`$libname.la'"
6426 export_symbols="$output_objdir/$libname.exp"
6427 $opt_dry_run || $RM $export_symbols
6428 cmds=$export_symbols_cmds
6429 save_ifs="$IFS"; IFS='~'
6430 for cmd in $cmds; do
6433 if len=`expr "X$cmd" : ".*"` &&
6434 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6435 func_show_eval "$cmd" 'exit $?'
6436 skipped_export=false
6438 # The command line is too long to execute in one step.
6439 func_verbose "using reloadable object file for export list..."
6441 # Break out early, otherwise skipped_export may be
6442 # set to false by a later but shorter cmd.
6447 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
6448 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
6449 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
6454 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6455 tmp_export_symbols="$export_symbols"
6456 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
6457 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
6460 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
6461 # The given exports_symbols file has to be filtered, so filter it.
6462 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
6463 # FIXME: $output_objdir/$libname.filter potentially contains lots of
6464 # 's' commands which not all seds can handle. GNU sed should be fine
6465 # though. Also, the filter scales superlinearly with the number of
6466 # global variables. join(1) would be nice here, but unfortunately
6467 # isn't a blessed tool.
6468 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
6469 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
6470 export_symbols=$output_objdir/$libname.def
6471 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
6475 for test_deplib in $deplibs; do
6476 case " $convenience " in
6477 *" $test_deplib "*) ;;
6479 tmp_deplibs="$tmp_deplibs $test_deplib"
6483 deplibs="$tmp_deplibs"
6485 if test -n "$convenience"; then
6486 if test -n "$whole_archive_flag_spec" &&
6487 test "$compiler_needs_object" = yes &&
6488 test -z "$libobjs"; then
6489 # extract the archives, so we have objects to list.
6490 # TODO: could optimize this to just extract one archive.
6491 whole_archive_flag_spec=
6493 if test -n "$whole_archive_flag_spec"; then
6494 save_libobjs=$libobjs
6495 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
6496 test "X$libobjs" = "X " && libobjs=
6498 gentop="$output_objdir/${outputname}x"
6499 generated="$generated $gentop"
6501 func_extract_archives $gentop $convenience
6502 libobjs="$libobjs $func_extract_archives_result"
6503 test "X$libobjs" = "X " && libobjs=
6507 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
6508 eval flag=\"$thread_safe_flag_spec\"
6509 linker_flags="$linker_flags $flag"
6512 # Make a backup of the uninstalled library when relinking
6513 if test "$mode" = relink; then
6514 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
6517 # Do each of the archive commands.
6518 if test "$module" = yes && test -n "$module_cmds" ; then
6519 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
6520 eval test_cmds=\"$module_expsym_cmds\"
6521 cmds=$module_expsym_cmds
6523 eval test_cmds=\"$module_cmds\"
6527 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
6528 eval test_cmds=\"$archive_expsym_cmds\"
6529 cmds=$archive_expsym_cmds
6531 eval test_cmds=\"$archive_cmds\"
6536 if test "X$skipped_export" != "X:" &&
6537 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
6538 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6541 # The command line is too long to link in one step, link piecewise
6542 # or, if using GNU ld and skipped_export is not :, use a linker
6545 # Save the value of $output and $libobjs because we want to
6546 # use them later. If we have whole_archive_flag_spec, we
6547 # want to use save_libobjs as it was before
6548 # whole_archive_flag_spec was expanded, because we can't
6549 # assume the linker understands whole_archive_flag_spec.
6550 # This may have to be revisited, in case too many
6551 # convenience libraries get linked in and end up exceeding
6553 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
6554 save_libobjs=$libobjs
6557 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
6559 # Clear the reloadable object creation command queue and
6560 # initialize k to one.
6567 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
6568 output=${output_objdir}/${output_la}.lnkscript
6569 func_verbose "creating GNU ld script: $output"
6570 $ECHO 'INPUT (' > $output
6571 for obj in $save_libobjs
6573 $ECHO "$obj" >> $output
6575 $ECHO ')' >> $output
6576 delfiles="$delfiles $output"
6577 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
6578 output=${output_objdir}/${output_la}.lnk
6579 func_verbose "creating linker input file list: $output"
6584 if test "$compiler_needs_object" = yes; then
6590 $ECHO "$obj" >> $output
6592 delfiles="$delfiles $output"
6593 output=$firstobj\"$file_list_spec$output\"
6595 if test -n "$save_libobjs"; then
6596 func_verbose "creating reloadable object files..."
6597 output=$output_objdir/$output_la-${k}.$objext
6598 # Loop over the list of objects to be linked.
6599 for obj in $save_libobjs
6601 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
6602 if test "X$objlist" = X ||
6603 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
6604 test "$len" -le "$max_cmd_len"; }; then
6605 objlist="$objlist $obj"
6607 # The command $test_cmds is almost too long, add a
6608 # command to the queue.
6609 if test "$k" -eq 1 ; then
6610 # The first file doesn't have a previous command to add.
6611 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
6613 # All subsequent reloadable object files will link in
6614 # the last one created.
6615 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
6617 last_robj=$output_objdir/$output_la-${k}.$objext
6619 output=$output_objdir/$output_la-${k}.$objext
6624 # Handle the remaining objects by creating one last
6625 # reloadable object file. All subsequent reloadable object
6626 # files will link in the last one created.
6627 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6628 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
6629 if test -n "$last_robj"; then
6630 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
6632 delfiles="$delfiles $output"
6638 if ${skipped_export-false}; then
6639 func_verbose "generating symbol list for \`$libname.la'"
6640 export_symbols="$output_objdir/$libname.exp"
6641 $opt_dry_run || $RM $export_symbols
6643 # Append the command to create the export file.
6644 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6645 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
6646 if test -n "$last_robj"; then
6647 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
6651 test -n "$save_libobjs" &&
6652 func_verbose "creating a temporary reloadable object file: $output"
6654 # Loop through the commands generated above and execute them.
6655 save_ifs="$IFS"; IFS='~'
6656 for cmd in $concat_cmds; do
6659 func_quote_for_expand "$cmd"
6660 eval "func_echo $func_quote_for_expand_result"
6662 $opt_dry_run || eval "$cmd" || {
6665 # Restore the uninstalled library and exit
6666 if test "$mode" = relink; then
6667 ( cd "$output_objdir" && \
6668 $RM "${realname}T" && \
6669 $MV "${realname}U" "$realname" )
6677 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
6678 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
6679 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
6683 if ${skipped_export-false}; then
6684 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6685 tmp_export_symbols="$export_symbols"
6686 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
6687 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
6690 if test -n "$orig_export_symbols"; then
6691 # The given exports_symbols file has to be filtered, so filter it.
6692 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
6693 # FIXME: $output_objdir/$libname.filter potentially contains lots of
6694 # 's' commands which not all seds can handle. GNU sed should be fine
6695 # though. Also, the filter scales superlinearly with the number of
6696 # global variables. join(1) would be nice here, but unfortunately
6697 # isn't a blessed tool.
6698 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
6699 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
6700 export_symbols=$output_objdir/$libname.def
6701 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
6706 # Restore the value of output.
6709 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
6710 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
6711 test "X$libobjs" = "X " && libobjs=
6713 # Expand the library linking commands again to reset the
6714 # value of $libobjs for piecewise linking.
6716 # Do each of the archive commands.
6717 if test "$module" = yes && test -n "$module_cmds" ; then
6718 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
6719 cmds=$module_expsym_cmds
6724 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
6725 cmds=$archive_expsym_cmds
6732 if test -n "$delfiles"; then
6733 # Append the command to remove temporary files to $cmds.
6734 eval cmds=\"\$cmds~\$RM $delfiles\"
6737 # Add any objects from preloaded convenience libraries
6738 if test -n "$dlprefiles"; then
6739 gentop="$output_objdir/${outputname}x"
6740 generated="$generated $gentop"
6742 func_extract_archives $gentop $dlprefiles
6743 libobjs="$libobjs $func_extract_archives_result"
6744 test "X$libobjs" = "X " && libobjs=
6747 save_ifs="$IFS"; IFS='~'
6748 for cmd in $cmds; do
6752 func_quote_for_expand "$cmd"
6753 eval "func_echo $func_quote_for_expand_result"
6755 $opt_dry_run || eval "$cmd" || {
6758 # Restore the uninstalled library and exit
6759 if test "$mode" = relink; then
6760 ( cd "$output_objdir" && \
6761 $RM "${realname}T" && \
6762 $MV "${realname}U" "$realname" )
6770 # Restore the uninstalled library and exit
6771 if test "$mode" = relink; then
6772 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
6774 if test -n "$convenience"; then
6775 if test -z "$whole_archive_flag_spec"; then
6776 func_show_eval '${RM}r "$gentop"'
6783 # Create links to the real library.
6784 for linkname in $linknames; do
6785 if test "$realname" != "$linkname"; then
6786 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
6790 # If -module or -export-dynamic was specified, set the dlname.
6791 if test "$module" = yes || test "$export_dynamic" = yes; then
6792 # On all known operating systems, these are identical.
6799 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6800 func_warning "\`-dlopen' is ignored for objects"
6805 func_warning "\`-l' and \`-L' are ignored for objects" ;;
6808 test -n "$rpath" && \
6809 func_warning "\`-rpath' is ignored for objects"
6811 test -n "$xrpath" && \
6812 func_warning "\`-R' is ignored for objects"
6814 test -n "$vinfo" && \
6815 func_warning "\`-version-info' is ignored for objects"
6817 test -n "$release" && \
6818 func_warning "\`-release' is ignored for objects"
6822 test -n "$objs$old_deplibs" && \
6823 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
6827 obj=$func_lo2o_result
6835 # Delete the old objects.
6836 $opt_dry_run || $RM $obj $libobj
6838 # Objects from convenience libraries. This assumes
6839 # single-version convenience libraries. Whenever we create
6840 # different ones for PIC/non-PIC, this we'll have to duplicate
6844 # reload_cmds runs $LD directly, so let us get rid of
6845 # -Wl from whole_archive_flag_spec and hope we can get by with
6846 # turning comma into space..
6849 if test -n "$convenience"; then
6850 if test -n "$whole_archive_flag_spec"; then
6851 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
6852 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
6854 gentop="$output_objdir/${obj}x"
6855 generated="$generated $gentop"
6857 func_extract_archives $gentop $convenience
6858 reload_conv_objs="$reload_objs $func_extract_archives_result"
6862 # Create the old-style object.
6863 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
6866 func_execute_cmds "$reload_cmds" 'exit $?'
6868 # Exit if we aren't doing a library object file.
6869 if test -z "$libobj"; then
6870 if test -n "$gentop"; then
6871 func_show_eval '${RM}r "$gentop"'
6877 if test "$build_libtool_libs" != yes; then
6878 if test -n "$gentop"; then
6879 func_show_eval '${RM}r "$gentop"'
6882 # Create an invalid libtool object if no PIC, so that we don't
6883 # accidentally link it into a program.
6884 # $show "echo timestamp > $libobj"
6885 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
6889 if test -n "$pic_flag" || test "$pic_mode" != default; then
6890 # Only do commands if we really have different PIC objects.
6891 reload_objs="$libobjs $reload_conv_objs"
6893 func_execute_cmds "$reload_cmds" 'exit $?'
6896 if test -n "$gentop"; then
6897 func_show_eval '${RM}r "$gentop"'
6905 *cygwin*) func_stripname '' '.exe' "$output"
6906 output=$func_stripname_result.exe;;
6908 test -n "$vinfo" && \
6909 func_warning "\`-version-info' is ignored for programs"
6911 test -n "$release" && \
6912 func_warning "\`-release' is ignored for programs"
6914 test "$preload" = yes \
6915 && test "$dlopen_support" = unknown \
6916 && test "$dlopen_self" = unknown \
6917 && test "$dlopen_self_static" = unknown && \
6918 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
6921 *-*-rhapsody* | *-*-darwin1.[012])
6922 # On Rhapsody replace the C library is the System framework
6923 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6924 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6930 # Don't allow lazy linking, it breaks C++ global constructors
6931 # But is supposedly fixed on 10.4 or later (yay!).
6932 if test "$tagname" = CXX ; then
6933 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
6935 compile_command="$compile_command ${wl}-bind_at_load"
6936 finalize_command="$finalize_command ${wl}-bind_at_load"
6940 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6941 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6942 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6947 # move library search paths that coincide with paths to not yet
6948 # installed libraries to the beginning of the library search list
6950 for path in $notinst_path; do
6951 case " $new_libs " in
6952 *" -L$path/$objdir "*) ;;
6954 case " $compile_deplibs " in
6955 *" -L$path/$objdir "*)
6956 new_libs="$new_libs -L$path/$objdir" ;;
6961 for deplib in $compile_deplibs; do
6964 case " $new_libs " in
6966 *) new_libs="$new_libs $deplib" ;;
6969 *) new_libs="$new_libs $deplib" ;;
6972 compile_deplibs="$new_libs"
6975 compile_command="$compile_command $compile_deplibs"
6976 finalize_command="$finalize_command $finalize_deplibs"
6978 if test -n "$rpath$xrpath"; then
6979 # If the user specified any rpath flags, then add them.
6980 for libdir in $rpath $xrpath; do
6981 # This is the magic to use -rpath.
6982 case "$finalize_rpath " in
6984 *) finalize_rpath="$finalize_rpath $libdir" ;;
6989 # Now hardcode the library paths
6992 for libdir in $compile_rpath $finalize_rpath; do
6993 if test -n "$hardcode_libdir_flag_spec"; then
6994 if test -n "$hardcode_libdir_separator"; then
6995 if test -z "$hardcode_libdirs"; then
6996 hardcode_libdirs="$libdir"
6998 # Just accumulate the unique libdirs.
6999 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7000 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7003 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7008 eval flag=\"$hardcode_libdir_flag_spec\"
7009 rpath="$rpath $flag"
7011 elif test -n "$runpath_var"; then
7012 case "$perm_rpath " in
7014 *) perm_rpath="$perm_rpath $libdir" ;;
7018 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
7019 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
7020 case :$dllsearchpath: in
7022 *) dllsearchpath="$dllsearchpath:$libdir";;
7024 case :$dllsearchpath: in
7025 *":$testbindir:"*) ;;
7026 *) dllsearchpath="$dllsearchpath:$testbindir";;
7031 # Substitute the hardcoded libdirs into the rpath.
7032 if test -n "$hardcode_libdir_separator" &&
7033 test -n "$hardcode_libdirs"; then
7034 libdir="$hardcode_libdirs"
7035 eval rpath=\" $hardcode_libdir_flag_spec\"
7037 compile_rpath="$rpath"
7041 for libdir in $finalize_rpath; do
7042 if test -n "$hardcode_libdir_flag_spec"; then
7043 if test -n "$hardcode_libdir_separator"; then
7044 if test -z "$hardcode_libdirs"; then
7045 hardcode_libdirs="$libdir"
7047 # Just accumulate the unique libdirs.
7048 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7049 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7052 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7057 eval flag=\"$hardcode_libdir_flag_spec\"
7058 rpath="$rpath $flag"
7060 elif test -n "$runpath_var"; then
7061 case "$finalize_perm_rpath " in
7063 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
7067 # Substitute the hardcoded libdirs into the rpath.
7068 if test -n "$hardcode_libdir_separator" &&
7069 test -n "$hardcode_libdirs"; then
7070 libdir="$hardcode_libdirs"
7071 eval rpath=\" $hardcode_libdir_flag_spec\"
7073 finalize_rpath="$rpath"
7075 if test -n "$libobjs" && test "$build_old_libs" = yes; then
7076 # Transform all the library objects into standard objects.
7077 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7078 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7081 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
7083 # template prelinking step
7084 if test -n "$prelink_cmds"; then
7085 func_execute_cmds "$prelink_cmds" 'exit $?'
7088 wrappers_required=yes
7090 *cygwin* | *mingw* )
7091 if test "$build_libtool_libs" != yes; then
7092 wrappers_required=no
7096 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
7097 wrappers_required=no
7101 if test "$wrappers_required" = no; then
7102 # Replace the output file specification.
7103 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7104 link_command="$compile_command$compile_rpath"
7106 # We have no uninstalled library dependencies, so finalize right now.
7108 func_show_eval "$link_command" 'exit_status=$?'
7110 # Delete the generated files.
7111 if test -f "$output_objdir/${outputname}S.${objext}"; then
7112 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
7118 if test -n "$compile_shlibpath$finalize_shlibpath"; then
7119 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
7121 if test -n "$finalize_shlibpath"; then
7122 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
7127 if test -n "$runpath_var"; then
7128 if test -n "$perm_rpath"; then
7129 # We should set the runpath_var.
7131 for dir in $perm_rpath; do
7134 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
7136 if test -n "$finalize_perm_rpath"; then
7137 # We should set the runpath_var.
7139 for dir in $finalize_perm_rpath; do
7142 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
7146 if test "$no_install" = yes; then
7147 # We don't need to create a wrapper script.
7148 link_command="$compile_var$compile_command$compile_rpath"
7149 # Replace the output file specification.
7150 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7151 # Delete the old output file.
7152 $opt_dry_run || $RM $output
7153 # Link the executable and exit
7154 func_show_eval "$link_command" 'exit $?'
7158 if test "$hardcode_action" = relink; then
7159 # Fast installation is not supported
7160 link_command="$compile_var$compile_command$compile_rpath"
7161 relink_command="$finalize_var$finalize_command$finalize_rpath"
7163 func_warning "this platform does not like uninstalled shared libraries"
7164 func_warning "\`$output' will be relinked during installation"
7166 if test "$fast_install" != no; then
7167 link_command="$finalize_var$compile_command$finalize_rpath"
7168 if test "$fast_install" = yes; then
7169 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
7171 # fast_install is set to needless
7175 link_command="$compile_var$compile_command$compile_rpath"
7176 relink_command="$finalize_var$finalize_command$finalize_rpath"
7180 # Replace the output file specification.
7181 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7183 # Delete the old output files.
7184 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
7186 func_show_eval "$link_command" 'exit $?'
7188 # Now create the wrapper script.
7189 func_verbose "creating $output"
7191 # Quote the relink command for shipping.
7192 if test -n "$relink_command"; then
7193 # Preserve any variables that may affect compiler behavior
7194 for var in $variables_saved_for_relink; do
7195 if eval test -z \"\${$var+set}\"; then
7196 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7197 elif eval var_value=\$$var; test -z "$var_value"; then
7198 relink_command="$var=; export $var; $relink_command"
7200 func_quote_for_eval "$var_value"
7201 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7204 relink_command="(cd `pwd`; $relink_command)"
7205 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7208 # Quote $ECHO for shipping.
7209 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
7211 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
7212 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
7214 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
7216 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
7219 # Only actually do things if not in dry run mode.
7221 # win32 will think the script is a binary if it has
7222 # a .exe suffix, so we strip it off here.
7224 *.exe) func_stripname '' '.exe' "$output"
7225 output=$func_stripname_result ;;
7227 # test for cygwin because mv fails w/o .exe extensions
7231 func_stripname '' '.exe' "$outputname"
7232 outputname=$func_stripname_result ;;
7236 *cygwin* | *mingw* )
7237 func_dirname_and_basename "$output" "" "."
7238 output_name=$func_basename_result
7239 output_path=$func_dirname_result
7240 cwrappersource="$output_path/$objdir/lt-$output_name.c"
7241 cwrapper="$output_path/$output_name.exe"
7242 $RM $cwrappersource $cwrapper
7243 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7245 func_emit_cwrapperexe_src > $cwrappersource
7247 # we should really use a build-platform specific compiler
7248 # here, but OTOH, the wrappers (shell script and this C one)
7249 # are only useful if you want to execute the "real" binary.
7250 # Since the "real" binary is built for $host, then this
7251 # wrapper might as well be built for $host, too.
7253 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
7257 # Now, create the wrapper script for func_source use:
7258 func_ltwrapper_scriptname $cwrapper
7259 $RM $func_ltwrapper_scriptname_result
7260 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
7262 # note: this script will not be executed, so do not chmod.
7263 if test "x$build" = "x$host" ; then
7264 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7266 func_emit_wrapper no > $func_ltwrapper_scriptname_result
7272 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
7274 func_emit_wrapper no > $output
7283 # See if we need to build an old-fashioned archive.
7284 for oldlib in $oldlibs; do
7286 if test "$build_libtool_libs" = convenience; then
7287 oldobjs="$libobjs_save $symfileobj"
7288 addlibs="$convenience"
7289 build_libtool_libs=no
7291 if test "$build_libtool_libs" = module; then
7292 oldobjs="$libobjs_save"
7293 build_libtool_libs=no
7295 oldobjs="$old_deplibs $non_pic_objects"
7296 if test "$preload" = yes && test -f "$symfileobj"; then
7297 oldobjs="$oldobjs $symfileobj"
7300 addlibs="$old_convenience"
7303 if test -n "$addlibs"; then
7304 gentop="$output_objdir/${outputname}x"
7305 generated="$generated $gentop"
7307 func_extract_archives $gentop $addlibs
7308 oldobjs="$oldobjs $func_extract_archives_result"
7311 # Do each command in the archive commands.
7312 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
7313 cmds=$old_archive_from_new_cmds
7316 # Add any objects from preloaded convenience libraries
7317 if test -n "$dlprefiles"; then
7318 gentop="$output_objdir/${outputname}x"
7319 generated="$generated $gentop"
7321 func_extract_archives $gentop $dlprefiles
7322 oldobjs="$oldobjs $func_extract_archives_result"
7325 # POSIX demands no paths to be encoded in archives. We have
7326 # to avoid creating archives with duplicate basenames if we
7327 # might have to extract them afterwards, e.g., when creating a
7328 # static archive out of a convenience library, or when linking
7329 # the entirety of a libtool archive into another (currently
7330 # not supported by libtool).
7331 if (for obj in $oldobjs
7333 func_basename "$obj"
7334 $ECHO "$func_basename_result"
7335 done | sort | sort -uc >/dev/null 2>&1); then
7338 $ECHO "copying selected object files to avoid basename conflicts..."
7339 gentop="$output_objdir/${outputname}x"
7340 generated="$generated $gentop"
7341 func_mkdir_p "$gentop"
7342 save_oldobjs=$oldobjs
7345 for obj in $save_oldobjs
7347 func_basename "$obj"
7348 objbase="$func_basename_result"
7349 case " $oldobjs " in
7350 " ") oldobjs=$obj ;;
7353 # Make sure we don't pick an alternate name that also
7355 newobj=lt$counter-$objbase
7356 counter=`expr $counter + 1`
7357 case " $oldobjs " in
7358 *[\ /]"$newobj "*) ;;
7359 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
7362 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
7363 oldobjs="$oldobjs $gentop/$newobj"
7365 *) oldobjs="$oldobjs $obj" ;;
7369 eval cmds=\"$old_archive_cmds\"
7371 if len=`expr "X$cmds" : ".*" 2>/dev/null` &&
7372 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7373 cmds=$old_archive_cmds
7375 # the command line is too long to link in one step, link in parts
7376 func_verbose "using piecewise archive linking..."
7381 save_oldobjs=$oldobjs
7382 # Is there a better way of finding the last object in the list?
7383 for obj in $save_oldobjs
7387 for obj in $save_oldobjs
7389 oldobjs="$objlist $obj"
7390 objlist="$objlist $obj"
7391 eval test_cmds=\"$old_archive_cmds\"
7392 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
7393 test "$len" -le "$max_cmd_len"; then
7396 # the above command should be used before it gets too long
7398 if test "$obj" = "$last_oldobj" ; then
7401 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7402 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
7408 if test "X$oldobjs" = "X" ; then
7409 eval cmds=\"\$concat_cmds\"
7411 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
7415 func_execute_cmds "$cmds" 'exit $?'
7418 test -n "$generated" && \
7419 func_show_eval "${RM}r$generated"
7421 # Now create the libtool archive.
7425 test "$build_old_libs" = yes && old_library="$libname.$libext"
7426 func_verbose "creating $output"
7428 # Preserve any variables that may affect compiler behavior
7429 for var in $variables_saved_for_relink; do
7430 if eval test -z \"\${$var+set}\"; then
7431 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7432 elif eval var_value=\$$var; test -z "$var_value"; then
7433 relink_command="$var=; export $var; $relink_command"
7435 func_quote_for_eval "$var_value"
7436 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7439 # Quote the link command for shipping.
7440 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
7441 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7442 if test "$hardcode_automatic" = yes ; then
7446 # Only create the output if not a dry run.
7448 for installed in no yes; do
7449 if test "$installed" = yes; then
7450 if test -z "$install_libdir"; then
7453 output="$output_objdir/$outputname"i
7454 # Replace all uninstalled libtool libraries with the installed ones
7456 for deplib in $dependency_libs; do
7459 func_basename "$deplib"
7460 name="$func_basename_result"
7461 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7462 test -z "$libdir" && \
7463 func_fatal_error "\`$deplib' is not a valid libtool archive"
7464 newdependency_libs="$newdependency_libs $libdir/$name"
7466 *) newdependency_libs="$newdependency_libs $deplib" ;;
7469 dependency_libs="$newdependency_libs"
7472 for lib in $dlfiles; do
7475 func_basename "$lib"
7476 name="$func_basename_result"
7477 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7478 test -z "$libdir" && \
7479 func_fatal_error "\`$lib' is not a valid libtool archive"
7480 newdlfiles="$newdlfiles $libdir/$name"
7482 *) newdlfiles="$newdlfiles $lib" ;;
7485 dlfiles="$newdlfiles"
7487 for lib in $dlprefiles; do
7490 # Only pass preopened files to the pseudo-archive (for
7491 # eventual linking with the app. that links it) if we
7492 # didn't already link the preopened objects directly into
7494 func_basename "$lib"
7495 name="$func_basename_result"
7496 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7497 test -z "$libdir" && \
7498 func_fatal_error "\`$lib' is not a valid libtool archive"
7499 newdlprefiles="$newdlprefiles $libdir/$name"
7503 dlprefiles="$newdlprefiles"
7506 for lib in $dlfiles; do
7508 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7509 *) abs=`pwd`"/$lib" ;;
7511 newdlfiles="$newdlfiles $abs"
7513 dlfiles="$newdlfiles"
7515 for lib in $dlprefiles; do
7517 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7518 *) abs=`pwd`"/$lib" ;;
7520 newdlprefiles="$newdlprefiles $abs"
7522 dlprefiles="$newdlprefiles"
7525 # place dlname in correct position for cygwin
7527 case $host,$output,$installed,$module,$dlname in
7528 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
7531 # $outputname - a libtool library file
7532 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
7534 # Please DO NOT delete this file!
7535 # It is necessary for linking the library.
7537 # The name that we can dlopen(3).
7540 # Names of this library.
7541 library_names='$library_names'
7543 # The name of the static archive.
7544 old_library='$old_library'
7546 # Linker flags that can not go in dependency_libs.
7547 inherited_linker_flags='$new_inherited_linker_flags'
7549 # Libraries that this one depends upon.
7550 dependency_libs='$dependency_libs'
7552 # Names of additional weak libraries provided by this library
7553 weak_library_names='$weak_libs'
7555 # Version information for $libname.
7560 # Is this an already installed library?
7561 installed=$installed
7563 # Should we warn about portability when linking against -modules?
7564 shouldnotlink=$module
7566 # Files to dlopen/dlpreopen
7568 dlpreopen='$dlprefiles'
7570 # Directory that this library needs to be installed in:
7571 libdir='$install_libdir'"
7572 if test "$installed" = no && test "$need_relink" = yes; then
7574 relink_command=\"$relink_command\""
7579 # Do a symbolic link so that the libtool archive can be found in
7580 # LD_LIBRARY_PATH before the program is installed.
7581 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
7587 { test "$mode" = link || test "$mode" = relink; } &&
7588 func_mode_link ${1+"$@"}
7591 # func_mode_uninstall arg...
7592 func_mode_uninstall ()
7600 # This variable tells wrapper scripts just to set variables rather
7601 # than running their programs.
7602 libtool_install_magic="$magic"
7607 -f) RM="$RM $arg"; rmforce=yes ;;
7608 -*) RM="$RM $arg" ;;
7609 *) files="$files $arg" ;;
7614 func_fatal_help "you must specify an RM program"
7618 origobjdir="$objdir"
7619 for file in $files; do
7620 func_dirname "$file" "" "."
7621 dir="$func_dirname_result"
7622 if test "X$dir" = X.; then
7623 objdir="$origobjdir"
7625 objdir="$dir/$origobjdir"
7627 func_basename "$file"
7628 name="$func_basename_result"
7629 test "$mode" = uninstall && objdir="$dir"
7631 # Remember objdir for removal later, being careful to avoid duplicates
7632 if test "$mode" = clean; then
7635 *) rmdirs="$rmdirs $objdir" ;;
7639 # Don't error if the file doesn't exist and rm -f was used.
7640 if { test -L "$file"; } >/dev/null 2>&1 ||
7641 { test -h "$file"; } >/dev/null 2>&1 ||
7642 test -f "$file"; then
7644 elif test -d "$file"; then
7647 elif test "$rmforce" = yes; then
7655 # Possibly a libtool archive, so verify it.
7656 if func_lalib_p "$file"; then
7657 func_source $dir/$name
7659 # Delete the libtool libraries and symlinks.
7660 for n in $library_names; do
7661 rmfiles="$rmfiles $objdir/$n"
7663 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
7667 case " $library_names " in
7668 # " " in the beginning catches empty $dlname
7670 *) rmfiles="$rmfiles $objdir/$dlname" ;;
7672 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
7675 if test -n "$library_names"; then
7676 # Do each command in the postuninstall commands.
7677 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
7680 if test -n "$old_library"; then
7681 # Do each command in the old_postuninstall commands.
7682 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
7684 # FIXME: should reinstall the best remaining shared library.
7691 # Possibly a libtool object, so verify it.
7692 if func_lalib_p "$file"; then
7695 func_source $dir/$name
7697 # Add PIC object to the list of files to remove.
7698 if test -n "$pic_object" &&
7699 test "$pic_object" != none; then
7700 rmfiles="$rmfiles $dir/$pic_object"
7703 # Add non-PIC object to the list of files to remove.
7704 if test -n "$non_pic_object" &&
7705 test "$non_pic_object" != none; then
7706 rmfiles="$rmfiles $dir/$non_pic_object"
7712 if test "$mode" = clean ; then
7716 func_stripname '' '.exe' "$file"
7717 file=$func_stripname_result
7718 func_stripname '' '.exe' "$name"
7719 noexename=$func_stripname_result
7720 # $file with .exe has already been added to rmfiles,
7721 # add $file without .exe
7722 rmfiles="$rmfiles $file"
7725 # Do a test to see if this is a libtool program.
7726 if func_ltwrapper_p "$file"; then
7727 if func_ltwrapper_executable_p "$file"; then
7728 func_ltwrapper_scriptname "$file"
7730 func_source $func_ltwrapper_scriptname_result
7731 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
7734 func_source $dir/$noexename
7737 # note $name still contains .exe if it was in $file originally
7738 # as does the version of $file that was added into $rmfiles
7739 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
7740 if test "$fast_install" = yes && test -n "$relink_command"; then
7741 rmfiles="$rmfiles $objdir/lt-$name"
7743 if test "X$noexename" != "X$name" ; then
7744 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
7750 func_show_eval "$RM $rmfiles" 'exit_status=1'
7752 objdir="$origobjdir"
7754 # Try to remove the ${objdir}s in the directories where we deleted files
7755 for dir in $rmdirs; do
7756 if test -d "$dir"; then
7757 func_show_eval "rmdir $dir >/dev/null 2>&1"
7764 { test "$mode" = uninstall || test "$mode" = clean; } &&
7765 func_mode_uninstall ${1+"$@"}
7767 test -z "$mode" && {
7768 help="$generic_help"
7769 func_fatal_help "you must specify a MODE"
7772 test -z "$exec_cmd" && \
7773 func_fatal_help "invalid operation mode \`$mode'"
7775 if test -n "$exec_cmd"; then
7776 eval exec "$exec_cmd"
7783 # The TAGs below are defined such that we never get into a situation
7784 # in which we disable both kinds of libraries. Given conflicting
7785 # choices, we go for a static library, that is the most portable,
7786 # since we can't tell whether shared libraries were disabled because
7787 # the user asked for that or because the platform doesn't support
7788 # them. This is particularly important on AIX, because we don't
7789 # support having both static and shared libraries enabled at the same
7790 # time on that platform, so we default to a shared-only configuration.
7791 # If a disable-shared tag is given, we'll fallback to a static-only
7792 # configuration. But we'll never go from static-only to shared-only.
7794 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
7795 build_libtool_libs=no
7797 # ### END LIBTOOL TAG CONFIG: disable-shared
7799 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
7800 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
7801 # ### END LIBTOOL TAG CONFIG: disable-static