1 # Generated from ltmain.m4sh; do not edit by hand
3 # ltmain.sh (GNU libtool 1.2435 2007/03/18 18:44:42) 2.1a
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 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 # This program 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 # This program is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 # As a special exception to the GNU General Public License, if you
25 # distribute this file as part of a program that contains a
26 # configuration script generated by Autoconf, you may include it under
27 # the same distribution terms that you use for the rest of that program.
29 # Usage: $progname [OPTION]... [MODE-ARG]...
31 # Provide generalized library-building support services.
33 # --config show all configuration variables
34 # --debug enable verbose shell tracing
35 # -n, --dry-run display commands without modifying any files
36 # --features display basic configuration information and exit
37 # --mode=MODE use operation mode MODE
38 # --preserve-dup-deps don't remove duplicate dependency libraries
39 # --quiet, --silent don't print informational messages
40 # --tag=TAG use configuration variables from tag TAG
41 # -v, --verbose print informational messages (default)
42 # --version print version information
43 # -h, --help print short or long help message
45 # MODE must be one of the following:
47 # clean remove files from the build directory
48 # compile compile a source file into a libtool object
49 # execute automatically set library path, then run a program
50 # finish complete the installation of libtool libraries
51 # install install libraries or executables
52 # link create a library or an executable
53 # uninstall remove libraries from an installed directory
55 # MODE-ARGS vary depending on the MODE.
56 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
58 # When reporting a bug, please describe a test case to reproduce it and
59 # include the following information:
64 # compiler flags: $LTCFLAGS
65 # linker: $LD (gnu? $with_gnu_ld)
66 # $progname: (GNU libtool 1.2435 2007/03/18 18:44:42) 2.1a
67 # automake: $automake_version
68 # autoconf: $autoconf_version
70 # Report bugs to <bug-libtool@gnu.org>.
75 TIMESTAMP=" 1.2435 2007/03/18 18:44:42"
76 package_revision=1.2435
78 # Be Bourne compatible
79 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
82 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
83 # is contrary to our usage. Disable this feature.
84 alias -g '${1+"$@"}'='"$@"'
87 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
89 BIN_SH=xpg4; export BIN_SH # for Tru64
90 DUALCASE=1; export DUALCASE # for MKS sh
92 # NLS nuisances: We save the old values to restore during execute mode.
93 # Only set LANG and LC_ALL to C if already set.
94 # These must not be set unconditionally because not all systems understand
95 # e.g. LANG=C (notably SCO).
96 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
98 eval "if test \"\${$lt_var+set}\" = set; then
99 save_$lt_var=\$$lt_var
113 : ${EGREP="/bin/grep -E"}
114 : ${FGREP="/bin/grep -F"}
115 : ${GREP="/bin/grep"}
122 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
123 : ${Xsed="$SED -e 1s/^X//"}
128 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
129 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
131 exit_status=$EXIT_SUCCESS
133 # Make sure IFS has a sensible default
138 dirname="s,/[^/]*$,,"
141 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
142 # is ksh but when the shell is invoked as "sh" and the current value of
143 # the _XPG environment variable is not equal to 1 (one), the special
144 # positional parameter $0, within a function call, is the name of the
148 # The name of this program:
149 # In the unlikely event $progname began with a '-', it would play havoc with
150 # func_echo (imagine progname=-n), so we prepend ./ in that case:
151 progname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'`
153 # Make sure we have an absolute path for reexecution:
155 [\\/]*|[A-Za-z]:\\*) ;;
157 progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"`
158 progdir=`cd "$progdir" && pwd`
159 progpath="$progdir/$progname"
164 for progdir in $PATH; do
166 test -x "$progdir/$progname" && break
169 test -n "$progdir" || progdir=`pwd`
170 progpath="$progdir/$progname"
174 # Sed substitution that helps us do robust quoting. It backslashifies
175 # metacharacters that are still active within double-quoted strings.
176 Xsed="${SED}"' -e 1s/^X//'
177 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
179 # Same as above, but do not quote variable references.
180 double_quote_subst='s/\(["`\\]\)/\\\1/g'
182 # Re-`\' parameter expansions in output of double_quote_subst that were
183 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
184 # in input to double_quote_subst, that '$' was protected from expansion.
185 # Since each input `\' is now two `\'s, look for any number of runs of
186 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
191 sed_double_backslash="\
195 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
205 # Echo program name prefixed message, along with the current mode
206 # name if it has been set yet.
209 $ECHO "$progname${mode+: }$mode: "${1+"$@"}
212 # func_verbose arg...
213 # Echo program name prefixed message in verbose mode only.
216 $opt_verbose && func_echo ${1+"$@"}
218 # A bug in bash halts the script if the last line of a function
219 # fails when set -e is in force, so we need another command to
225 # Echo program name prefixed message to standard error.
228 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
231 # func_warning arg...
232 # Echo program name prefixed warning message to standard error.
235 $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
238 # func_fatal_error arg...
239 # Echo program name prefixed message to standard error, and exit.
246 # func_fatal_help arg...
247 # Echo program name prefixed message to standard error, followed by
248 # a help hint, and exit.
252 func_fatal_error "$help"
254 help="Try \`$progname --help' for more information." ## default
257 # func_grep expression filename
258 # Check whether EXPRESSION matches any line of FILENAME, without output.
261 $GREP "$1" "$2" >/dev/null 2>&1
265 # func_mkdir_p directory-path
266 # Make sure the entire path to DIRECTORY-PATH is available.
269 my_directory_path="$1"
272 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
274 # Protect directory names starting with `-'
275 case $my_directory_path in
276 -*) my_directory_path="./$my_directory_path" ;;
279 # While some portion of DIR does not yet exist...
280 while test ! -d "$my_directory_path"; do
281 # ...make a list in topmost first order. Use a colon delimited
282 # list incase some portion of path contains whitespace.
283 my_dir_list="$my_directory_path:$my_dir_list"
285 # If the last portion added has no slash in it, the list is done
286 case $my_directory_path in */*) ;; *) break ;; esac
288 # ...otherwise throw away the child directory and loop
289 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
291 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
293 save_mkdir_p_IFS="$IFS"; IFS=':'
294 for my_dir in $my_dir_list; do
295 IFS="$save_mkdir_p_IFS"
296 # mkdir can fail with a `File exist' error if two processes
297 # try to create one of the directories concurrently. Don't
299 $MKDIR "$my_dir" 2>/dev/null || :
301 IFS="$save_mkdir_p_IFS"
303 # Bail out if we (or some other process) failed to create a directory.
304 test -d "$my_directory_path" || \
305 func_fatal_error "Failed to create \`$1'"
310 # func_mktempdir [string]
311 # Make a temporary directory that won't clash with other running
312 # libtool processes, and avoids race conditions if possible. If
313 # given, STRING is the basename for that directory.
316 my_template="${TMPDIR-/tmp}/${1-$progname}"
318 if test "$opt_dry_run" = ":"; then
319 # Return a directory name, but don't create it in dry-run mode
320 my_tmpdir="${my_template}-$$"
323 # If mktemp works, use that first and foremost
324 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
326 if test ! -d "$my_tmpdir"; then
327 # Failing that, at least try and use $RANDOM to avoid a race
328 my_tmpdir="${my_template}-${RANDOM-0}$$"
330 save_mktempdir_umask=`umask`
333 umask $save_mktempdir_umask
336 # If we're not in dry-run mode, bomb out on failure
337 test -d "$my_tmpdir" || \
338 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
341 $ECHO "X$my_tmpdir" | $Xsed
345 # func_quote_for_eval arg
346 # Aesthetically quote ARG to be evaled later.
347 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
348 # is double-quoted, suitable for a subsequent eval, whereas
349 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
350 # which are still active within double quotes backslashified.
351 func_quote_for_eval ()
355 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
357 func_quote_for_eval_unquoted_result="$1" ;;
360 case $func_quote_for_eval_unquoted_result in
361 # Double-quote args containing shell metacharacters to delay
362 # word splitting, command substitution and and variable
363 # expansion for a subsequent eval.
364 # Many Bourne shells cannot handle close brackets correctly
365 # in scan sets, so we specify it separately.
366 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
367 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
370 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
375 # func_quote_for_expand arg
376 # Aesthetically quote ARG to be evaled later; same as above,
377 # but do not quote variable references.
378 func_quote_for_expand ()
382 my_arg=`$ECHO "X$1" | $Xsed \
383 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
389 # Double-quote args containing shell metacharacters to delay
390 # word splitting and command substitution for a subsequent eval.
391 # Many Bourne shells cannot handle close brackets correctly
392 # in scan sets, so we specify it separately.
393 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
398 func_quote_for_expand_result="$my_arg"
402 # func_show_eval cmd [fail_exp]
403 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
404 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
405 # is given, then evaluate it.
411 ${opt_silent-false} || {
412 func_quote_for_expand "$my_cmd"
413 eval "func_echo $func_quote_for_expand_result"
416 if ${opt_dry_run-false}; then :; else
419 if test "$my_status" -eq 0; then :; else
420 eval "(exit $my_status); $my_fail_exp"
430 # Echo version message to standard output and exit.
433 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
436 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
443 # Echo short help message to standard output and exit.
446 $SED -n '/^# Usage:/,/# -h/ {
449 s/\$progname/'$progname'/
453 $ECHO "run \`$progname --help | more' for full usage"
458 # Echo long help message to standard output and exit.
461 $SED -n '/^# Usage:/,/# Report bugs to/ {
464 s*\$progname*'$progname'*
466 s*\$SHELL*'"$SHELL"'*
468 s*\$LTCFLAGS*'"$LTCFLAGS"'*
470 s/\$with_gnu_ld/'"$with_gnu_ld"'/
471 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
472 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
478 # func_missing_arg argname
479 # Echo program name prefixed message to standard error and set global
483 func_error "missing argument for $1"
493 # Check that we have a working $ECHO.
494 if test "X$1" = X--no-reexec; then
495 # Discard the --no-reexec flag, and continue.
497 elif test "X$1" = X--fallback-echo; then
498 # Avoid inline document here, it may be left over
500 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
501 # Yippee, $ECHO works!
504 # Restart under the correct shell, and then maybe $ECHO will work.
505 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
508 if test "X$1" = X--fallback-echo; then
509 # used as fallback echo
517 magic="%%%MAGIC variable%%%"
525 lo2o="s/\\.lo\$/.${objext}/"
526 o2lo="s/\\.${objext}\$/.lo/"
531 opt_duplicate_deps=false
535 # If this variable is set in any of the actions, the command in it
536 # will be execed at the end. This prevents here-documents from being
537 # left over by shells.
540 # func_fatal_configuration arg...
541 # Echo program name prefixed message to standard error, followed by
542 # a configuration failure hint, and exit.
543 func_fatal_configuration ()
546 func_error "See the $PACKAGE documentation for more information."
547 func_fatal_error "Fatal configuration error."
552 # Display the configuration for all the tags in this script.
555 re_begincf='^# ### BEGIN LIBTOOL'
556 re_endcf='^# ### END LIBTOOL'
558 # Default configuration.
559 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
561 # Now print the configurations for the tags.
562 for tagname in $taglist; do
563 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
570 # Display the features supported by this script.
574 if test "$build_libtool_libs" = yes; then
575 $ECHO "enable shared libraries"
577 $ECHO "disable shared libraries"
579 if test "$build_old_libs" = yes; then
580 $ECHO "enable static libraries"
582 $ECHO "disable static libraries"
588 # func_enable_tag tagname
589 # Verify that TAGNAME is valid, and either flag an error and exit, or
590 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
597 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
598 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
599 sed_extractcf="/$re_begincf/,/$re_endcf/p"
604 func_fatal_error "invalid tag name: $tagname"
608 # Don't test for the "default" C tag, as we know it's
609 # there but not specially marked.
613 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
614 taglist="$taglist $tagname"
616 # Evaluate the configuration. Be careful to quote the path
617 # and the sed script, to avoid splitting on whitespace, but
618 # also don't use non-portable quotes within backquotes within
619 # quotes we have to do it in 2 steps:
620 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
623 func_error "ignoring unknown tag $tagname"
632 # We need to display help for each of the modes.
635 # Generic help is extracted from the usage comments
636 # at the start of this file.
642 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
644 Remove files from the build directory.
646 RM is the name of the program to use to delete files associated with each FILE
647 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
650 If FILE is a libtool library, object or program, all the files associated
651 with it are deleted. Otherwise, only FILE itself is deleted using RM."
656 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
658 Compile a source file into a libtool library object.
660 This mode accepts the following additional options:
662 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
663 -no-suppress do not suppress compiler output for multiple passes
664 -prefer-pic try to building PIC objects only
665 -prefer-non-pic try to building non-PIC objects only
666 -shared do not build a \`.o' file suitable for static linking
667 -static only build a \`.o' file suitable for static linking
669 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
670 from the given SOURCEFILE.
672 The output file name is determined by removing the directory component from
673 SOURCEFILE, then substituting the C source code suffix \`.c' with the
674 library object suffix, \`.lo'."
679 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
681 Automatically set library path, then run a program.
683 This mode accepts the following additional options:
685 -dlopen FILE add the directory containing FILE to the library path
687 This mode sets the library path environment variable according to \`-dlopen'
690 If any of the ARGS are libtool executable wrappers, then they are translated
691 into their corresponding uninstalled binary, and any of their required library
692 directories are added to the library path.
694 Then, COMMAND is executed, with ARGS as arguments."
699 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
701 Complete the installation of libtool libraries.
703 Each LIBDIR is a directory that contains libtool libraries.
705 The commands that this mode executes may require superuser privileges. Use
706 the \`--dry-run' option if you just want to see what would be executed."
711 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
713 Install executables or libraries.
715 INSTALL-COMMAND is the installation command. The first component should be
716 either the \`install' or \`cp' program.
718 The following components of INSTALL-COMMAND are treated specially:
720 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
722 The rest of the components are interpreted as arguments to that command (only
723 BSD-compatible install options are recognized)."
728 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
730 Link object files or libraries together to form another library, or to
731 create an executable program.
733 LINK-COMMAND is a command using the C compiler that you would use to create
734 a program from several object files.
736 The following components of LINK-COMMAND are treated specially:
738 -all-static do not do any dynamic linking at all
739 -avoid-version do not add a version suffix if possible
740 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
741 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
742 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
743 -export-symbols SYMFILE
744 try to export only the symbols listed in SYMFILE
745 -export-symbols-regex REGEX
746 try to export only the symbols matching REGEX
747 -LLIBDIR search LIBDIR for required installed libraries
748 -lNAME OUTPUT-FILE requires the installed library libNAME
749 -module build a library that can dlopened
750 -no-fast-install disable the fast-install mode
751 -no-install link a not-installable executable
752 -no-undefined declare that a library does not refer to external symbols
753 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
754 -objectlist FILE Use a list of object files found in FILE to specify objects
755 -precious-files-regex REGEX
756 don't remove output files matching REGEX
757 -release RELEASE specify package release information
758 -rpath LIBDIR the created library will eventually be installed in LIBDIR
759 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
760 -shared only do dynamic linking of libtool libraries
761 -shrext SUFFIX override the standard shared library file extension
762 -static do not do any dynamic linking of uninstalled libtool libraries
764 do not do any dynamic linking of libtool libraries
765 -version-info CURRENT[:REVISION[:AGE]]
766 specify library version info [each variable defaults to 0]
767 -weak LIBNAME declare that the target provides the LIBNAME interface
769 All other options (arguments beginning with \`-') are ignored.
771 Every other argument is treated as a filename. Files ending in \`.la' are
772 treated as uninstalled libtool libraries, other files are standard or library
775 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
776 only library objects (\`.lo' files) may be specified, and \`-rpath' is
777 required, except when creating a convenience library.
779 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
780 using \`ar' and \`ranlib', or on Windows using \`lib'.
782 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
783 is created, otherwise an executable program is created."
788 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
790 Remove libraries from an installation directory.
792 RM is the name of the program to use to delete files associated with each FILE
793 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
796 If FILE is a libtool library, all the files associated with it are deleted.
797 Otherwise, only FILE itself is deleted using RM."
801 func_fatal_help "invalid operation mode \`$mode'"
806 $ECHO "Try \`$progname --help' for more information about other modes."
811 # Generated shell functions inserted here.
814 # Parse options once, thoroughly. This comes as soon as possible in
815 # the script to make things like `libtool --version' happen quickly.
818 # Shorthand for --mode=foo, only valid as the first argument
821 shift; set dummy --mode clean ${1+"$@"}; shift
823 compile|compil|compi|comp|com|co|c)
824 shift; set dummy --mode compile ${1+"$@"}; shift
826 execute|execut|execu|exec|exe|ex|e)
827 shift; set dummy --mode execute ${1+"$@"}; shift
829 finish|finis|fini|fin|fi|f)
830 shift; set dummy --mode finish ${1+"$@"}; shift
832 install|instal|insta|inst|ins|in|i)
833 shift; set dummy --mode install ${1+"$@"}; shift
836 shift; set dummy --mode link ${1+"$@"}; shift
838 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
839 shift; set dummy --mode uninstall ${1+"$@"}; shift
843 # Parse non-mode specific arguments:
844 while test "$#" -gt 0; do
849 --config) func_config ;;
851 --debug) preserve_args="$preserve_args $opt"
852 func_echo "enabling shell trace mode"
857 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
858 execute_dlfiles="$execute_dlfiles $1"
862 --dry-run | -n) opt_dry_run=: ;;
863 --features) func_features ;;
864 --finish) mode="finish" ;;
866 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
868 # Valid mode arguments:
878 # Catch anything else as an error
879 *) func_error "invalid argument for $opt"
890 opt_duplicate_deps=: ;;
892 --quiet|--silent) preserve_args="$preserve_args $opt"
896 --verbose| -v) preserve_args="$preserve_args $opt"
900 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
901 preserve_args="$preserve_args $opt $1"
902 func_enable_tag "$1" # tagname is set here
906 # Separate optargs to long options:
907 -dlopen=*|--mode=*|--tag=*)
908 func_opt_split "$opt"
909 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
913 -\?|-h) func_usage ;;
914 --help) opt_help=: ;;
915 --version) func_version ;;
917 -*) func_fatal_help "unrecognized option \`$opt'" ;;
925 # Now that we've collected a possible --mode arg, show help if necessary
926 $opt_help && func_mode_help
929 *cygwin* | *mingw* | *pw32*)
930 # don't eliminate duplications in $postdeps and $predeps
931 opt_duplicate_compiler_generated_deps=:
934 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
938 # Having warned about all mis-specified options, bail out if
939 # anything was wrong.
940 $exit_cmd $EXIT_FAILURE
943 # func_check_version_match
944 # Ensure that we are using m4 macros, and libtool script from the same
945 # release of libtool.
946 func_check_version_match ()
948 if test "$package_revision" != "$macro_revision"; then
949 if test "$VERSION" != "$macro_version"; then
950 if test -z "$macro_version"; then
952 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
953 $progname: definition of this LT_INIT comes from an older release.
954 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
955 $progname: and run autoconf again.
959 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
960 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
961 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
962 $progname: and run autoconf again.
967 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
968 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
969 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
970 $progname: of $PACKAGE $VERSION and run autoconf again.
984 # Sanity checks first:
985 func_check_version_match
987 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
988 func_fatal_configuration "not configured to build any kind of library"
991 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
995 eval std_shrext=\"$shrext_cmds\"
998 # Only execute mode is allowed to have -dlopen flags.
999 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1000 func_error "unrecognized option \`-dlopen'"
1005 # Change the help message to a mode-specific one.
1006 generic_help="$help"
1007 help="Try \`$progname --help --mode=$mode' for more information."
1012 # True iff FILE is a libtool `.la' library or `.lo' object file.
1013 # This function is only a basic sanity check; it will hardly flush out
1014 # determined imposters.
1017 $SED -e 4q "$1" 2>/dev/null \
1018 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1021 # func_lalib_unsafe_p file
1022 # True iff FILE is a libtool `.la' library or `.lo' object file.
1023 # This function implements the same check as func_lalib_p without
1024 # resorting to external programs. To this end, it redirects stdin and
1025 # closes it afterwards, without saving the original file descriptor.
1026 # As a safety measure, use it only where a negative result would be
1027 # fatal anyway. Works if `file' does not exist.
1028 func_lalib_unsafe_p ()
1031 if test -r "$1" && exec 5<&1 <"$1"; then
1032 for lalib_p_l in 1 2 3 4
1035 case "$lalib_p_line" in
1036 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1041 test "$lalib_p" = yes
1044 # func_ltwrapper_p file
1045 # True iff FILE is a libtool wrapper script.
1046 # This function is only a basic sanity check; it will hardly flush out
1047 # determined imposters.
1054 # func_execute_cmds commands fail_cmd
1055 # Execute tilde-delimited COMMANDS.
1056 # If FAIL_CMD is given, eval that upon failure.
1057 # FAIL_CMD may read-access the current command in variable CMD!
1058 func_execute_cmds ()
1061 save_ifs=$IFS; IFS='~'
1065 func_show_eval "$cmd" "${2-:}"
1072 # Source FILE, adding directory component if necessary.
1073 # Note that it is not necessary on cygwin/mingw to append a dot to
1074 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1075 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1076 # `FILE.' does not work on cygwin managed mounts.
1081 */* | *\\*) . "$1" ;;
1087 # func_win32_libid arg
1088 # return the library type of file 'arg'
1090 # Need a lot of goo to handle *both* DLLs and import libs
1091 # Has to be a shell function in order to 'eat' the argument
1092 # that is supplied when $file_magic_command is called.
1096 win32_libid_type="unknown"
1097 win32_fileres=`file -L $1 2>/dev/null`
1098 case $win32_fileres in
1099 *ar\ archive\ import\ library*) # definitely import
1100 win32_libid_type="x86 archive import"
1102 *ar\ archive*) # could be an import, or static
1103 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
1104 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1105 win32_nmres=`eval $NM -f posix -A $1 |
1114 case $win32_nmres in
1115 import*) win32_libid_type="x86 archive import";;
1116 *) win32_libid_type="x86 archive static";;
1121 win32_libid_type="x86 DLL"
1123 *executable*) # but shell scripts are "executable" too...
1124 case $win32_fileres in
1125 *MS\ Windows\ PE\ Intel*)
1126 win32_libid_type="x86 DLL"
1131 $ECHO "$win32_libid_type"
1136 # func_infer_tag arg
1137 # Infer tagged configuration to use if any are available and
1138 # if one wasn't chosen via the "--tag" command line option.
1139 # Only attempt this if the compiler in the base compile
1140 # command doesn't match the default compiler.
1141 # arg is usually of the form 'gcc ...'
1145 if test -n "$available_tags" && test -z "$tagname"; then
1148 func_quote_for_eval "$arg"
1149 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1152 # Blanks in the command may have been stripped by the calling shell,
1153 # but not from the CC environment variable when configure was run.
1154 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1155 # Blanks at the start of $base_compile will cause this to fail
1156 # if we don't check for them as well.
1158 for z in $available_tags; do
1159 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1160 # Evaluate the configuration.
1161 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1164 # Double-quote args containing other shell metacharacters.
1165 func_quote_for_eval "$arg"
1166 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1169 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1170 # The compiler in the base compile command matches
1171 # the one in the tagged configuration.
1172 # Assume this is the tagged configuration we want.
1179 # If $tagname still isn't set, then no tagged configuration
1180 # was found and let the user know that the "--tag" command
1181 # line option must be used.
1182 if test -z "$tagname"; then
1183 func_echo "unable to infer tagged configuration"
1184 func_fatal_error "specify a tag with \`--tag'"
1186 # func_verbose "using $tagname tagged configuration"
1195 # func_generate_dlsyms outputname originator pic_p
1196 # Extract symbols from dlprefiles and create ${outputname}S.o with
1197 # a dlpreopen symbol table.
1198 func_generate_dlsyms ()
1204 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
1207 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1208 if test -n "$NM" && test -n "$global_symbol_pipe"; then
1209 my_dlsyms="${my_outputname}S.c"
1211 func_error "not configured to extract global symbols from dlpreopened files"
1215 if test -n "$my_dlsyms"; then
1219 # Discover the nlist of each of the dlfiles.
1220 nlist="$output_objdir/${my_outputname}.nm"
1222 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
1224 # Parse the name list into a source file.
1225 func_echo "creating $output_objdir/$my_dlsyms"
1227 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
1228 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
1229 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
1235 /* External symbol declarations for the compiler. */\
1238 if test "$dlself" = yes; then
1239 func_echo "generating symbol list for \`$output'"
1241 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
1243 # Add our own program objects to the symbol list.
1244 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1245 for progfile in $progfiles; do
1246 func_echo "extracting global C symbols from \`$progfile'"
1247 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
1250 if test -n "$exclude_expsyms"; then
1252 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
1253 eval '$MV "$nlist"T "$nlist"'
1257 if test -n "$export_symbols_regex"; then
1259 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
1260 eval '$MV "$nlist"T "$nlist"'
1264 # Prepare the list of exported symbols
1265 if test -z "$export_symbols"; then
1266 export_symbols="$output_objdir/$outputname.exp"
1269 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
1271 *cygwin* | *mingw* )
1272 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1273 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
1279 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
1280 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
1281 eval '$MV "$nlist"T "$nlist"'
1284 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1285 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
1292 for dlprefile in $dlprefiles; do
1293 func_echo "extracting global C symbols from \`$dlprefile'"
1294 func_basename "$dlprefile"
1295 name="$func_basename_result"
1297 eval '$ECHO ": $name " >> "$nlist"'
1298 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
1303 # Make sure we have at least an empty file.
1304 test -f "$nlist" || : > "$nlist"
1306 if test -n "$exclude_expsyms"; then
1307 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
1308 $MV "$nlist"T "$nlist"
1311 # Try sorting and uniquifying the output.
1312 if $GREP -v "^: " < "$nlist" |
1313 if sort -k 3 </dev/null >/dev/null 2>&1; then
1318 uniq > "$nlist"S; then
1321 $GREP -v "^: " < "$nlist" > "$nlist"S
1324 if test -f "$nlist"S; then
1325 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
1327 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
1330 $ECHO >> "$output_objdir/$my_dlsyms" "\
1332 /* The mapping between symbol names and symbols. */
1339 *cygwin* | *mingw* )
1340 $ECHO >> "$output_objdir/$my_dlsyms" "\
1341 /* DATA imports from DLLs on WIN32 con't be const, because
1342 runtime relocations are performed -- see ld's documentation
1343 on pseudo-relocs. */"
1346 echo >> "$output_objdir/$my_dlsyms" "\
1347 /* This system does not cope well with relocations in const data */"
1350 lt_dlsym_const=const ;;
1353 $ECHO >> "$output_objdir/$my_dlsyms" "\
1354 extern $lt_dlsym_const lt_dlsymlist
1355 lt_${my_prefix}_LTX_preloaded_symbols[];
1356 $lt_dlsym_const lt_dlsymlist
1357 lt_${my_prefix}_LTX_preloaded_symbols[] =
1359 { \"$my_originator\", (void *) 0 },"
1361 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
1363 $ECHO >> "$output_objdir/$my_dlsyms" "\
1367 /* This works around a problem in FreeBSD linker */
1368 #ifdef FREEBSD_WORKAROUND
1369 static const void *lt_preloaded_setup() {
1370 return lt_${my_prefix}_LTX_preloaded_symbols;
1380 pic_flag_for_symtable=
1381 case "$compile_command " in
1385 # compiling the symbol table file with pic_flag works around
1386 # a FreeBSD bug that causes programs to crash when -lm is
1387 # linked before any other PIC object. But we must not use
1388 # pic_flag when linking with -static. The problem exists in
1389 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
1390 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
1391 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
1393 pic_flag_for_symtable=" $pic_flag" ;;
1395 if test "X$my_pic_p" != Xno; then
1396 pic_flag_for_symtable=" $pic_flag"
1403 for arg in $LTCFLAGS; do
1405 -pie | -fpie | -fPIE) ;;
1406 *) symtab_cflags="$symtab_cflags $arg" ;;
1410 # Now compile the dynamic symbol file.
1411 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
1413 # Clean up the generated files.
1414 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
1416 # Transform the symbol file into the correct name.
1417 symfileobj="$output_objdir/${my_outputname}S.$objext"
1419 *cygwin* | *mingw* )
1420 if test -f "$output_objdir/$my_outputname.def"; then
1421 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1422 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1424 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1425 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1429 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1430 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1435 func_fatal_error "unknown suffix for \`$my_dlsyms'"
1439 # We keep going just in case the user didn't refer to
1440 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
1441 # really was required.
1443 # Nullify the symbol file.
1444 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1445 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1449 # func_extract_an_archive dir oldlib
1450 func_extract_an_archive ()
1453 f_ex_an_ar_dir="$1"; shift
1454 f_ex_an_ar_oldlib="$1"
1455 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" 'exit $?'
1456 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
1459 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
1464 # func_extract_archives gentop oldlib ...
1465 func_extract_archives ()
1468 my_gentop="$1"; shift
1469 my_oldlibs=${1+"$@"}
1475 for my_xlib in $my_oldlibs; do
1476 # Extract the objects.
1478 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
1479 *) my_xabs=`pwd`"/$my_xlib" ;;
1481 func_basename "$my_xlib"
1482 my_xlib="$func_basename_result"
1485 case " $extracted_archives " in
1487 extracted_serial=`expr $extracted_serial + 1`
1488 my_xlib_u=lt$extracted_serial-$my_xlib ;;
1492 extracted_archives="$extracted_archives $my_xlib_u"
1493 my_xdir="$my_gentop/$my_xlib_u"
1495 func_mkdir_p "$my_xdir"
1499 func_echo "Extracting $my_xabs"
1500 # Do not bother doing anything if just a dry run
1502 darwin_orig_dir=`pwd`
1503 cd $my_xdir || exit $?
1504 darwin_archive=$my_xabs
1506 darwin_base_archive=`basename $darwin_archive`
1507 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
1508 if test -n "$darwin_arches"; then
1509 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
1511 func_echo "$darwin_base_archive has multiple architectures $darwin_arches"
1512 for darwin_arch in $darwin_arches ; do
1513 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1514 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
1515 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1516 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
1518 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
1519 done # $darwin_arches
1520 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
1521 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
1524 for darwin_file in $darwin_filelist; do
1525 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
1526 lipo -create -output "$darwin_file" $darwin_files
1527 done # $darwin_filelist
1529 cd "$darwin_orig_dir"
1532 func_extract_an_archive "$my_xdir" "$my_xabs"
1537 func_extract_an_archive "$my_xdir" "$my_xabs"
1540 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
1543 func_extract_archives_result="$my_oldobjs"
1548 # func_write_libtool_object output_name pic_name nonpic_name
1549 # Create a libtool object file (analogous to a ".la" file),
1550 # but don't create it if we're doing a dry run.
1551 func_write_libtool_object ()
1554 if test "$build_libtool_libs" = yes; then
1560 if test "$build_old_libs" = yes; then
1561 write_oldobj=\'${3}\'
1567 cat >${write_libobj}T <<EOF
1568 # $write_libobj - a libtool object file
1569 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1571 # Please DO NOT delete this file!
1572 # It is necessary for linking the library.
1574 # Name of the PIC object.
1575 pic_object=$write_lobj
1577 # Name of the non-PIC object
1578 non_pic_object=$write_oldobj
1581 mv -f "${write_libobj}T" "${write_libobj}"
1585 # func_mode_compile arg...
1586 func_mode_compile ()
1589 # Get the compilation command and the source file.
1591 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1603 # do not "continue". Instead, add this to base_compile
1615 # Accept any command-line options.
1618 test -n "$libobj" && \
1619 func_fatal_error "you cannot specify \`-o' more than once"
1624 -pie | -fpie | -fPIE)
1625 pie_flag="$pie_flag $arg"
1629 -shared | -static | -prefer-pic | -prefer-non-pic)
1640 arg_mode=arg # the next one goes into the "base_compile" arg list
1641 continue # The current "srcfile" will either be retained or
1642 ;; # replaced later. I would guess that would be a bug.
1645 func_stripname '-Wc,' '' "$arg"
1646 args=$func_stripname_result
1648 save_ifs="$IFS"; IFS=','
1649 for arg in $args; do
1651 func_quote_for_eval "$arg"
1652 lastarg="$lastarg $func_quote_for_eval_result"
1655 func_stripname ' ' '' "$lastarg"
1656 lastarg=$func_stripname_result
1658 # Add the arguments to base_compile.
1659 base_compile="$base_compile $lastarg"
1664 # Accept the current argument as the source file.
1665 # The previous "srcfile" becomes the current argument.
1672 esac # case $arg_mode
1674 # Aesthetically quote the previous argument.
1675 func_quote_for_eval "$lastarg"
1676 base_compile="$base_compile $func_quote_for_eval_result"
1681 func_fatal_error "you must specify an argument for -Xcompile"
1684 func_fatal_error "you must specify a target with \`-o'"
1687 # Get the name of the library object.
1688 test -z "$libobj" && {
1689 func_basename "$srcfile"
1690 libobj="$func_basename_result"
1695 # Recognize several different file suffixes.
1696 # If the user specifies -o file.o, it is replaced with file.lo
1706 *.class) xform=class ;;
1709 *.[fF][09]?) xform='[fF][09].' ;;
1711 *.java) xform=java ;;
1715 libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
1718 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1720 func_fatal_error "cannot determine name of library object from \`$libobj'"
1724 func_infer_tag $base_compile
1726 for arg in $later; do
1729 test "$build_libtool_libs" != yes && \
1730 func_fatal_configuration "can not build a shared library"
1736 build_libtool_libs=no
1753 func_quote_for_eval "$libobj"
1754 test "X$libobj" != "X$func_quote_for_eval_result" \
1755 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1756 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1757 func_basename "$obj"
1758 objname="$func_basename_result"
1759 func_dirname "$obj" "/" ""
1760 xdir="$func_dirname_result"
1761 lobj=${xdir}$objdir/$objname
1763 test -z "$base_compile" && \
1764 func_fatal_help "you must specify a compilation command"
1766 # Delete any leftover library objects.
1767 if test "$build_old_libs" = yes; then
1768 removelist="$obj $lobj $libobj ${libobj}T"
1770 removelist="$lobj $libobj ${libobj}T"
1773 $opt_dry_run || $RM $removelist
1774 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1776 # On Cygwin there's no "real" PIC flag so we must build both object types
1778 cygwin* | mingw* | pw32* | os2*)
1782 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1783 # non-PIC code in shared libraries is not supported
1787 # Calculate the filename of the output object if compiler does
1788 # not support -o with -c
1789 if test "$compiler_c_o" = no; then
1790 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1791 lockfile="$output_obj.lock"
1792 removelist="$removelist $output_obj $lockfile"
1793 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1800 # Lock this critical section if it is needed
1801 # We use this script file to make the link, it avoids creating a new file
1802 if test "$need_locks" = yes; then
1803 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1804 func_echo "Waiting for $lockfile to be removed"
1807 elif test "$need_locks" = warn; then
1808 if test -f "$lockfile"; then
1810 *** ERROR, $lockfile exists and contains:
1811 `cat $lockfile 2>/dev/null`
1813 This indicates that another process is trying to use the same
1814 temporary object file, and libtool could not work around it because
1815 your compiler does not support \`-c' and \`-o' together. If you
1816 repeat this compilation, it may succeed, by chance, but you had better
1817 avoid parallel builds (make -j) in this platform, or get a better
1820 $opt_dry_run || $RM $removelist
1823 $ECHO "$srcfile" > "$lockfile"
1826 if test -n "$fix_srcfile_path"; then
1827 eval srcfile=\"$fix_srcfile_path\"
1829 func_quote_for_eval "$srcfile"
1830 qsrcfile=$func_quote_for_eval_result
1832 $opt_dry_run || $RM "$libobj" "${libobj}T"
1834 # Only build a PIC object if we are building libtool libraries.
1835 if test "$build_libtool_libs" = yes; then
1836 # Without this assignment, base_compile gets emptied.
1837 fbsd_hideous_sh_bug=$base_compile
1839 if test "$pic_mode" != no; then
1840 command="$base_compile $qsrcfile $pic_flag"
1842 # Don't build PIC code
1843 command="$base_compile $qsrcfile"
1846 func_mkdir_p "$xdir$objdir"
1848 if test -z "$output_obj"; then
1849 # Place PIC objects in $objdir
1850 command="$command -o $lobj"
1853 $opt_dry_run || $RM "$lobj" "$output_obj"
1855 func_show_eval "$command" \
1856 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1858 if test "$need_locks" = warn &&
1859 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1861 *** ERROR, $lockfile contains:
1862 `cat $lockfile 2>/dev/null`
1864 but it should contain:
1867 This indicates that another process is trying to use the same
1868 temporary object file, and libtool could not work around it because
1869 your compiler does not support \`-c' and \`-o' together. If you
1870 repeat this compilation, it may succeed, by chance, but you had better
1871 avoid parallel builds (make -j) in this platform, or get a better
1874 $opt_dry_run || $RM $removelist
1878 # Just move the object if needed, then go on to compile the next one
1879 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1880 func_show_eval '$MV "$output_obj" "$lobj"' \
1881 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1884 # Allow error messages only from the first compilation.
1885 if test "$suppress_opt" = yes; then
1886 suppress_output=' >/dev/null 2>&1'
1890 # Only build a position-dependent object if we build old libraries.
1891 if test "$build_old_libs" = yes; then
1892 if test "$pic_mode" != yes; then
1893 # Don't build PIC code
1894 command="$base_compile $qsrcfile$pie_flag"
1896 command="$base_compile $qsrcfile $pic_flag"
1898 if test "$compiler_c_o" = yes; then
1899 command="$command -o $obj"
1902 # Suppress compiler output if we already did a PIC compilation.
1903 command="$command$suppress_output"
1904 $opt_dry_run || $RM "$obj" "$output_obj"
1905 func_show_eval "$command" \
1906 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1908 if test "$need_locks" = warn &&
1909 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1911 *** ERROR, $lockfile contains:
1912 `cat $lockfile 2>/dev/null`
1914 but it should contain:
1917 This indicates that another process is trying to use the same
1918 temporary object file, and libtool could not work around it because
1919 your compiler does not support \`-c' and \`-o' together. If you
1920 repeat this compilation, it may succeed, by chance, but you had better
1921 avoid parallel builds (make -j) in this platform, or get a better
1924 $opt_dry_run || $RM $removelist
1928 # Just move the object if needed
1929 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1930 func_show_eval '$MV "$output_obj" "$obj"' \
1931 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1936 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1938 # Unlock the critical section if it was locked
1939 if test "$need_locks" != no; then
1947 test "$mode" = compile && func_mode_compile ${1+"$@"}
1950 # func_mode_execute arg...
1951 func_mode_execute ()
1954 # The first argument is the command name.
1957 func_fatal_help "you must specify a COMMAND"
1959 # Handle -dlopen flags immediately.
1960 for file in $execute_dlfiles; do
1962 || func_fatal_help "\`$file' is not a file"
1967 # Check to see that this really is a libtool archive.
1968 func_lalib_unsafe_p "$file" \
1969 || func_fatal_help "\`$lib' is not a valid libtool archive"
1971 # Read the libtool library.
1976 # Skip this library if it cannot be dlopened.
1977 if test -z "$dlname"; then
1978 # Warn if it was a shared library.
1979 test -n "$library_names" && \
1980 func_warning "\`$file' was not linked with \`-export-dynamic'"
1984 func_dirname "$file" "" "."
1985 dir="$func_dirname_result"
1987 if test -f "$dir/$objdir/$dlname"; then
1990 if test ! -f "$dir/$dlname"; then
1991 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1997 # Just add the directory containing the .lo file.
1998 func_dirname "$file" "" "."
1999 dir="$func_dirname_result"
2003 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2008 # Get the absolute pathname.
2009 absdir=`cd "$dir" && pwd`
2010 test -n "$absdir" && dir="$absdir"
2012 # Now add the directory to shlibpath_var.
2013 if eval "test -z \"\$$shlibpath_var\""; then
2014 eval "$shlibpath_var=\"\$dir\""
2016 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2020 # This variable tells wrapper scripts just to set shlibpath_var
2021 # rather than running their programs.
2022 libtool_execute_magic="$magic"
2024 # Check if any of the arguments is a wrapper script.
2031 # Do a test to see if this is really a libtool program.
2032 if func_ltwrapper_p "$file"; then
2035 # Transform arg to wrapped name.
2036 file="$progdir/$program"
2040 # Quote arguments (to preserve shell metacharacters).
2041 func_quote_for_eval "$file"
2042 args="$args $func_quote_for_eval_result"
2045 if test "X$opt_dry_run" = Xfalse; then
2046 if test -n "$shlibpath_var"; then
2047 # Export the shlibpath_var.
2048 eval "export $shlibpath_var"
2051 # Restore saved environment variables
2052 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2054 eval "if test \"\${save_$lt_var+set}\" = set; then
2055 $lt_var=\$save_$lt_var; export $lt_var
2061 # Now prepare to actually exec the command.
2062 exec_cmd="\$cmd$args"
2064 # Display what would be done.
2065 if test -n "$shlibpath_var"; then
2066 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2067 $ECHO "export $shlibpath_var"
2074 test "$mode" = execute && func_mode_execute ${1+"$@"}
2077 # func_mode_finish arg...
2084 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2087 libdirs="$libdirs $dir"
2090 for libdir in $libdirs; do
2091 if test -n "$finish_cmds"; then
2092 # Do each command in the finish commands.
2093 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2096 if test -n "$finish_eval"; then
2097 # Do the single finish_eval.
2098 eval cmds=\"$finish_eval\"
2099 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2105 # Exit here if they wanted silent mode.
2106 $opt_silent && exit $EXIT_SUCCESS
2108 $ECHO "X----------------------------------------------------------------------" | $Xsed
2109 $ECHO "Libraries have been installed in:"
2110 for libdir in $libdirs; do
2114 $ECHO "If you ever happen to want to link against installed libraries"
2115 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2116 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2117 $ECHO "flag during linking and do at least one of the following:"
2118 if test -n "$shlibpath_var"; then
2119 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2120 $ECHO " during execution"
2122 if test -n "$runpath_var"; then
2123 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2124 $ECHO " during linking"
2126 if test -n "$hardcode_libdir_flag_spec"; then
2128 eval flag=\"$hardcode_libdir_flag_spec\"
2130 $ECHO " - use the \`$flag' linker flag"
2132 if test -n "$admincmds"; then
2133 $ECHO " - have your system administrator run these commands:$admincmds"
2135 if test -f /etc/ld.so.conf; then
2136 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2140 $ECHO "See any operating system documentation about shared libraries for"
2142 solaris2.[6789]|solaris2.1[0-9])
2143 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2147 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2150 $ECHO "X----------------------------------------------------------------------" | $Xsed
2154 test "$mode" = finish && func_mode_finish ${1+"$@"}
2157 # func_mode_install arg...
2158 func_mode_install ()
2161 # There may be an optional sh(1) argument at the beginning of
2162 # install_prog (especially on Windows NT).
2163 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2164 # Allow the use of GNU shtool's install command.
2165 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2166 # Aesthetically quote it.
2167 func_quote_for_eval "$nonopt"
2168 install_prog="$func_quote_for_eval_result "
2176 # The real first argument should be the name of the installation program.
2177 # Aesthetically quote it.
2178 func_quote_for_eval "$arg"
2179 install_prog="$install_prog$func_quote_for_eval_result"
2181 # We need to accept at least all the BSD install flags.
2191 if test -n "$dest"; then
2192 files="$files $dest"
2200 case " $install_prog " in
2215 # If the previous option needed an argument, then skip it.
2216 if test -n "$prev"; then
2225 # Aesthetically quote the argument.
2226 func_quote_for_eval "$arg"
2227 install_prog="$install_prog $func_quote_for_eval_result"
2230 test -z "$install_prog" && \
2231 func_fatal_help "you must specify an install program"
2233 test -n "$prev" && \
2234 func_fatal_help "the \`$prev' option requires an argument"
2236 if test -z "$files"; then
2237 if test -z "$dest"; then
2238 func_fatal_help "no file or destination specified"
2240 func_fatal_help "you must specify a destination"
2244 # Strip any trailing slash from the destination.
2245 func_stripname '' '/' "$dest"
2246 dest=$func_stripname_result
2248 # Check to see that the destination is a directory.
2249 test -d "$dest" && isdir=yes
2250 if test "$isdir" = yes; then
2254 func_dirname "$dest" "" "."
2255 destdir="$func_dirname_result"
2256 func_basename "$dest"
2257 destname="$func_basename_result"
2259 # Not a directory, so check to see that there is only one file specified.
2260 set dummy $files; shift
2261 test "$#" -gt 1 && \
2262 func_fatal_help "\`$dest' is not a directory"
2265 [\\/]* | [A-Za-z]:[\\/]*) ;;
2267 for file in $files; do
2271 func_fatal_help "\`$destdir' must be an absolute directory name"
2278 # This variable tells wrapper scripts just to set variables rather
2279 # than running their programs.
2280 libtool_install_magic="$magic"
2285 for file in $files; do
2287 # Do each installation.
2290 # Do the static libraries later.
2291 staticlibs="$staticlibs $file"
2295 # Check to see that this really is a libtool archive.
2296 func_lalib_unsafe_p "$file" \
2297 || func_fatal_help "\`$file' is not a valid libtool archive"
2304 # Add the libdir to current_libdirs if it is the destination.
2305 if test "X$destdir" = "X$libdir"; then
2306 case "$current_libdirs " in
2308 *) current_libdirs="$current_libdirs $libdir" ;;
2311 # Note the libdir as a future libdir.
2312 case "$future_libdirs " in
2314 *) future_libdirs="$future_libdirs $libdir" ;;
2318 func_dirname "$file" "/" ""
2319 dir="$func_dirname_result"
2322 if test -n "$relink_command"; then
2323 # Determine the prefix the user has applied to our future dir.
2324 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2326 # Don't allow the user to place us outside of our expected
2327 # location b/c this prevents finding dependent libraries that
2328 # are installed to the same prefix.
2329 # At present, this check doesn't affect windows .dll's that
2330 # are installed into $libdir/../bin (currently, that works fine)
2331 # but it's something to keep an eye on.
2332 test "$inst_prefix_dir" = "$destdir" && \
2333 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2335 if test -n "$inst_prefix_dir"; then
2336 # Stick the inst_prefix_dir data into the link command.
2337 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2339 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2342 func_warning "relinking \`$file'"
2343 func_show_eval "$relink_command" \
2344 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2347 # See the names of the shared library.
2348 set dummy $library_names; shift
2349 if test -n "$1"; then
2354 test -n "$relink_command" && srcname="$realname"T
2356 # Install the shared library and build the symlinks.
2357 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2361 cygwin* | mingw* | pw32*)
2369 if test -n "$tstripme" && test -n "$striplib"; then
2370 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2373 if test "$#" -gt 0; then
2374 # Delete the old symlinks, and create new ones.
2375 # Try `ln -sf' first, because the `ln' binary might depend on
2376 # the symlink we replace! Solaris /bin/ln does not understand -f,
2377 # so we also need to try rm && ln -s.
2380 test "$linkname" != "$realname" \
2381 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2385 # Do each command in the postinstall commands.
2386 lib="$destdir/$realname"
2387 func_execute_cmds "$postinstall_cmds" 'exit $?'
2390 # Install the pseudo-library for information purposes.
2391 func_basename "$file"
2392 name="$func_basename_result"
2393 instname="$dir/$name"i
2394 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2396 # Maybe install the static library, too.
2397 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2401 # Install (i.e. copy) a libtool object.
2403 # Figure out destination file name, if it wasn't already specified.
2404 if test -n "$destname"; then
2405 destfile="$destdir/$destname"
2407 func_basename "$file"
2408 destfile="$func_basename_result"
2409 destfile="$destdir/$destfile"
2412 # Deduce the name of the destination old-style object file.
2415 func_lo2o "$destfile"
2416 staticdest=$func_lo2o_result
2419 staticdest="$destfile"
2423 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2427 # Install the libtool object if requested.
2428 test -n "$destfile" && \
2429 func_show_eval "$install_prog $file $destfile" 'exit $?'
2431 # Install the old object if enabled.
2432 if test "$build_old_libs" = yes; then
2433 # Deduce the name of the old-style object file.
2435 staticobj=$func_lo2o_result
2436 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2442 # Figure out destination file name, if it wasn't already specified.
2443 if test -n "$destname"; then
2444 destfile="$destdir/$destname"
2446 func_basename "$file"
2447 destfile="$func_basename_result"
2448 destfile="$destdir/$destfile"
2451 # If the file is missing, and there is a .exe on the end, strip it
2452 # because it is most likely a libtool script we actually want to
2457 if test ! -f "$file"; then
2458 func_stripname '' '.exe' "$file"
2459 file=$func_stripname_result
2465 # Do a test to see if this is really a libtool program.
2468 func_stripname '' '.exe' "$file"
2469 wrapper=$func_stripname_result
2475 if func_ltwrapper_p "$wrapper"; then
2479 func_source "$wrapper"
2481 # Check the variables that should have been set.
2482 test -z "$generated_by_libtool_version" && \
2483 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2486 for lib in $notinst_deplibs; do
2487 # Check to see that each library is installed.
2489 if test -f "$lib"; then
2492 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2493 if test -n "$libdir" && test ! -f "$libfile"; then
2494 func_warning "\`$lib' has not been installed in \`$libdir'"
2500 func_source "$wrapper"
2503 if test "$fast_install" = no && test -n "$relink_command"; then
2505 if test "$finalize" = yes; then
2506 tmpdir=`func_mktempdir`
2507 func_basename "$file$stripped_ext"
2508 file="$func_basename_result"
2509 outputname="$tmpdir/$file"
2510 # Replace the output file specification.
2511 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2514 func_quote_for_expand "$relink_command"
2515 eval "func_echo $func_quote_for_expand_result"
2517 if eval "$relink_command"; then :
2519 func_error "error: relink \`$file' with the above command before installing it"
2520 $opt_dry_run || ${RM}r "$tmpdir"
2525 func_warning "cannot relink \`$file'"
2529 # Install the binary that we compiled earlier.
2530 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2534 # remove .exe since cygwin /usr/bin/install will append another
2536 case $install_prog,$host in
2537 */usr/bin/install*,*cygwin*)
2538 case $file:$destfile in
2543 destfile=$destfile.exe
2546 func_stripname '' '.exe' "$destfile"
2547 destfile=$func_stripname_result
2552 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2553 $opt_dry_run || if test -n "$outputname"; then
2560 for file in $staticlibs; do
2561 func_basename "$file"
2562 name="$func_basename_result"
2564 # Set up the ranlib parameters.
2565 oldlib="$destdir/$name"
2567 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2569 if test -n "$stripme" && test -n "$old_striplib"; then
2570 func_show_eval "$old_striplib $oldlib" 'exit $?'
2573 # Do each command in the postinstall commands.
2574 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2577 test -n "$future_libdirs" && \
2578 func_warning "remember to run \`$progname --finish$future_libdirs'"
2580 if test -n "$current_libdirs"; then
2581 # Maybe just do a dry run.
2582 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2583 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2589 test "$mode" = install && func_mode_install ${1+"$@"}
2592 # func_mode_link arg...
2597 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
2598 # It is impossible to link a dll without this setting, and
2599 # we shouldn't force the makefile maintainer to figure out
2600 # which system we are compiling for in order to pass an extra
2601 # flag for every libtool invocation.
2602 # allow_undefined=no
2604 # FIXME: Unfortunately, there are problems with the above when trying
2605 # to make a dll which has undefined symbols, in which case not
2606 # even a static library is built. For now, we need to specify
2607 # -no-undefined on the libtool link line when we can be certain
2608 # that all symbols are satisfied, otherwise we get a static library.
2615 libtool_args=$nonopt
2616 base_compile="$nonopt $@"
2617 compile_command=$nonopt
2618 finalize_command=$nonopt
2631 lib_search_path=`pwd`
2633 new_inherited_linker_flags=
2641 export_symbols_regex=
2649 precious_files_regex=
2650 prefer_static_libs=no
2663 single_module="${wl}-single_module"
2664 func_infer_tag $base_compile
2666 # We need to know -static, to get the right output filenames.
2671 test "$build_libtool_libs" != yes && \
2672 func_fatal_configuration "can not build a shared library"
2676 -all-static | -static | -static-libtool-libs)
2679 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
2680 func_warning "complete static linking is impossible in this configuration"
2682 if test -n "$link_static_flag"; then
2683 dlopen_self=$dlopen_self_static
2684 # See comment for -static flag below, for more details.
2685 func_append compile_command " $link_static_flag"
2686 func_append finalize_command " $link_static_flag"
2688 prefer_static_libs=yes
2691 if test -z "$pic_flag" && test -n "$link_static_flag"; then
2692 dlopen_self=$dlopen_self_static
2694 prefer_static_libs=built
2696 -static-libtool-libs)
2697 if test -z "$pic_flag" && test -n "$link_static_flag"; then
2698 dlopen_self=$dlopen_self_static
2700 prefer_static_libs=yes
2703 build_libtool_libs=no
2710 # See if our shared archives depend on static archives.
2711 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
2713 # Go through the arguments, transforming them on the way.
2714 while test "$#" -gt 0; do
2717 func_quote_for_eval "$arg"
2718 qarg=$func_quote_for_eval_unquoted_result
2719 func_append libtool_args " $func_quote_for_eval_result"
2721 # If the previous option needs an argument, assign it.
2722 if test -n "$prev"; then
2725 func_append compile_command " @OUTPUT@"
2726 func_append finalize_command " @OUTPUT@"
2732 if test "$preload" = no; then
2733 # Add the symbol object into the linking commands.
2734 func_append compile_command " @SYMFILE@"
2735 func_append finalize_command " @SYMFILE@"
2739 *.la | *.lo) ;; # We handle these cases below.
2741 if test "$dlself" = no; then
2749 if test "$prev" = dlprefiles; then
2751 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
2761 if test "$prev" = dlfiles; then
2762 dlfiles="$dlfiles $arg"
2764 dlprefiles="$dlprefiles $arg"
2772 export_symbols="$arg"
2774 || func_fatal_error "symbol file \`$arg' does not exist"
2779 export_symbols_regex="$arg"
2787 *" $qarg.ltframework "*) ;;
2788 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
2797 inst_prefix_dir="$arg"
2802 if test -f "$arg"; then
2805 for fil in `cat "$save_arg"`
2807 # moreargs="$moreargs $fil"
2809 # A libtool-controlled object.
2811 # Check to see that this really is a libtool object.
2812 if func_lalib_unsafe_p "$arg"; then
2819 if test -z "$pic_object" ||
2820 test -z "$non_pic_object" ||
2821 test "$pic_object" = none &&
2822 test "$non_pic_object" = none; then
2823 func_fatal_error "cannot find name of object for \`$arg'"
2826 # Extract subdirectory from the argument.
2827 func_dirname "$arg" "/" ""
2828 xdir="$func_dirname_result"
2830 if test "$pic_object" != none; then
2831 # Prepend the subdirectory the object is found in.
2832 pic_object="$xdir$pic_object"
2834 if test "$prev" = dlfiles; then
2835 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
2836 dlfiles="$dlfiles $pic_object"
2840 # If libtool objects are unsupported, then we need to preload.
2845 # CHECK ME: I think I busted this. -Ossama
2846 if test "$prev" = dlprefiles; then
2847 # Preload the old-style object.
2848 dlprefiles="$dlprefiles $pic_object"
2853 func_append libobjs " $pic_object"
2858 if test "$non_pic_object" != none; then
2859 # Prepend the subdirectory the object is found in.
2860 non_pic_object="$xdir$non_pic_object"
2862 # A standard non-PIC object
2863 func_append non_pic_objects " $non_pic_object"
2864 if test -z "$pic_object" || test "$pic_object" = none ; then
2865 arg="$non_pic_object"
2868 # If the PIC object exists, use it instead.
2869 # $xdir was prepended to $pic_object above.
2870 non_pic_object="$pic_object"
2871 func_append non_pic_objects " $non_pic_object"
2874 # Only an error if not doing a dry-run.
2875 if $opt_dry_run; then
2876 # Extract subdirectory from the argument.
2877 func_dirname "$arg" "/" ""
2878 xdir="$func_dirname_result"
2881 pic_object=$xdir$objdir/$func_lo2o_result
2882 non_pic_object=$xdir$func_lo2o_result
2883 func_append libobjs " $pic_object"
2884 func_append non_pic_objects " $non_pic_object"
2886 func_fatal_error "\`$arg' is not a valid libtool object"
2891 func_fatal_error "link input file \`$arg' does not exist"
2898 precious_files_regex="$arg"
2908 # We need an absolute path.
2910 [\\/]* | [A-Za-z]:[\\/]*) ;;
2912 func_fatal_error "only absolute run-paths are allowed"
2915 if test "$prev" = rpath; then
2918 *) rpath="$rpath $arg" ;;
2923 *) xrpath="$xrpath $arg" ;;
2935 weak_libs="$weak_libs $arg"
2940 linker_flags="$linker_flags $qarg"
2941 compiler_flags="$compiler_flags $qarg"
2943 func_append compile_command " $qarg"
2944 func_append finalize_command " $qarg"
2948 compiler_flags="$compiler_flags $qarg"
2950 func_append compile_command " $qarg"
2951 func_append finalize_command " $qarg"
2955 linker_flags="$linker_flags $qarg"
2956 compiler_flags="$compiler_flags $wl$qarg"
2958 func_append compile_command " $wl$qarg"
2959 func_append finalize_command " $wl$qarg"
2963 eval "$prev=\"\$arg\""
2968 fi # test -n "$prev"
2974 # The effects of -all-static are defined in a previous loop.
2979 # FIXME: remove this flag sometime in the future.
2980 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
3003 -export-symbols | -export-symbols-regex)
3004 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3005 func_fatal_error "more than one -exported-symbols argument is not allowed"
3007 if test "X$arg" = "X-export-symbols"; then
3025 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
3026 # so, if we see these flags be careful not to treat them like -L
3028 case $with_gcc/$host in
3029 no/*-*-irix* | /*-*-irix*)
3030 func_append compile_command " $arg"
3031 func_append finalize_command " $arg"
3038 func_stripname '-L' '' "$arg"
3039 dir=$func_stripname_result
3040 # We need an absolute path.
3042 [\\/]* | [A-Za-z]:[\\/]*) ;;
3044 absdir=`cd "$dir" && pwd`
3045 test -z "$absdir" && \
3046 func_fatal_error "cannot determine absolute directory name of \`$dir'"
3053 deplibs="$deplibs -L$dir"
3054 lib_search_path="$lib_search_path $dir"
3058 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3059 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
3060 case :$dllsearchpath: in
3062 *) dllsearchpath="$dllsearchpath:$dir";;
3064 case :$dllsearchpath: in
3065 *":$testbindir:"*) ;;
3066 *) dllsearchpath="$dllsearchpath:$testbindir";;
3074 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
3076 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
3077 # These systems don't actually have a C or math library (as such)
3081 # These systems don't actually have a C library (as such)
3082 test "X$arg" = "X-lc" && continue
3084 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3085 # Do not include libc due to us having libc/libc_r.
3086 test "X$arg" = "X-lc" && continue
3088 *-*-rhapsody* | *-*-darwin1.[012])
3089 # Rhapsody C and math libraries are in the System framework
3090 deplibs="$deplibs System.ltframework"
3093 *-*-sco3.2v5* | *-*-sco5v6*)
3094 # Causes problems with __ctype
3095 test "X$arg" = "X-lc" && continue
3097 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3098 # Compiler inserts libc in the correct place for threads to work
3099 test "X$arg" = "X-lc" && continue
3102 elif test "X$arg" = "X-lc_r"; then
3104 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3105 # Do not include libc_r directly, use -pthread flag.
3110 deplibs="$deplibs $arg"
3119 # Tru64 UNIX uses -model [arg] to determine the layout of C++
3120 # classes, name mangling, and exception handling.
3121 # Darwin uses the -arch flag to determine output architecture.
3122 -model|-arch|-isysroot)
3123 compiler_flags="$compiler_flags $arg"
3124 func_append compile_command " $arg"
3125 func_append finalize_command " $arg"
3130 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
3131 compiler_flags="$compiler_flags $arg"
3132 func_append compile_command " $arg"
3133 func_append finalize_command " $arg"
3134 case "$new_inherited_linker_flags " in
3136 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
3142 single_module="${wl}-multi_module"
3153 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3154 # The PATH hackery in wrapper scripts is required on Windows
3155 # in order for the loader to find any dlls it needs.
3156 func_warning "\`-no-install' is ignored for $host"
3157 func_warning "assuming \`-no-fast-install' instead"
3160 *) no_install=yes ;;
3177 -precious-files-regex)
3198 func_stripname '-R' '' "$arg"
3199 dir=$func_stripname_result
3200 # We need an absolute path.
3202 [\\/]* | [A-Za-z]:[\\/]*) ;;
3204 func_fatal_error "only absolute run-paths are allowed"
3209 *) xrpath="$xrpath $dir" ;;
3215 # The effects of -shared are defined in a previous loop.
3224 -static | -static-libtool-libs)
3225 # The effects of -static are defined in a previous loop.
3226 # We used to do the same as -all-static on platforms that
3227 # didn't have a PIC flag, but the assumption that the effects
3228 # would be equivalent was wrong. It would break on at least
3229 # Digital Unix and AIX.
3255 func_stripname '-Wc,' '' "$arg"
3256 args=$func_stripname_result
3258 save_ifs="$IFS"; IFS=','
3259 for flag in $args; do
3261 func_quote_for_eval "$flag"
3262 arg="$arg $wl$func_quote_for_eval_result"
3263 compiler_flags="$compiler_flags $func_quote_for_eval_result"
3266 func_stripname ' ' '' "$arg"
3267 arg=$func_stripname_result
3271 func_stripname '-Wl,' '' "$arg"
3272 args=$func_stripname_result
3274 save_ifs="$IFS"; IFS=','
3275 for flag in $args; do
3277 func_quote_for_eval "$flag"
3278 arg="$arg $wl$func_quote_for_eval_result"
3279 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
3280 linker_flags="$linker_flags $func_quote_for_eval_result"
3283 func_stripname ' ' '' "$arg"
3284 arg=$func_stripname_result
3302 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
3303 # -r[0-9][0-9]* specifies the processor on the SGI compiler
3304 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
3305 # +DA*, +DD* enable 64-bit mode on the HP compiler
3306 # -q* pass through compiler args for the IBM compiler
3307 # -m*, -t[45]*, -txscale* pass through architecture-specific
3308 # compiler args for GCC
3309 # -F/path gives path to uninstalled frameworks, gcc on darwin
3310 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
3311 # @file GCC response files
3312 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
3313 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
3314 func_quote_for_eval "$arg"
3315 arg="$func_quote_for_eval_result"
3316 func_append compile_command " $arg"
3317 func_append finalize_command " $arg"
3318 compiler_flags="$compiler_flags $arg"
3322 # Some other compiler flag.
3324 func_quote_for_eval "$arg"
3325 arg="$func_quote_for_eval_result"
3329 # A standard object.
3334 # A libtool-controlled object.
3336 # Check to see that this really is a libtool object.
3337 if func_lalib_unsafe_p "$arg"; then
3344 if test -z "$pic_object" ||
3345 test -z "$non_pic_object" ||
3346 test "$pic_object" = none &&
3347 test "$non_pic_object" = none; then
3348 func_fatal_error "cannot find name of object for \`$arg'"
3351 # Extract subdirectory from the argument.
3352 func_dirname "$arg" "/" ""
3353 xdir="$func_dirname_result"
3355 if test "$pic_object" != none; then
3356 # Prepend the subdirectory the object is found in.
3357 pic_object="$xdir$pic_object"
3359 if test "$prev" = dlfiles; then
3360 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
3361 dlfiles="$dlfiles $pic_object"
3365 # If libtool objects are unsupported, then we need to preload.
3370 # CHECK ME: I think I busted this. -Ossama
3371 if test "$prev" = dlprefiles; then
3372 # Preload the old-style object.
3373 dlprefiles="$dlprefiles $pic_object"
3378 func_append libobjs " $pic_object"
3383 if test "$non_pic_object" != none; then
3384 # Prepend the subdirectory the object is found in.
3385 non_pic_object="$xdir$non_pic_object"
3387 # A standard non-PIC object
3388 func_append non_pic_objects " $non_pic_object"
3389 if test -z "$pic_object" || test "$pic_object" = none ; then
3390 arg="$non_pic_object"
3393 # If the PIC object exists, use it instead.
3394 # $xdir was prepended to $pic_object above.
3395 non_pic_object="$pic_object"
3396 func_append non_pic_objects " $non_pic_object"
3399 # Only an error if not doing a dry-run.
3400 if $opt_dry_run; then
3401 # Extract subdirectory from the argument.
3402 func_dirname "$arg" "/" ""
3403 xdir="$func_dirname_result"
3406 pic_object=$xdir$objdir/$func_lo2o_result
3407 non_pic_object=$xdir$func_lo2o_result
3408 func_append libobjs " $pic_object"
3409 func_append non_pic_objects " $non_pic_object"
3411 func_fatal_error "\`$arg' is not a valid libtool object"
3418 deplibs="$deplibs $arg"
3419 old_deplibs="$old_deplibs $arg"
3424 # A libtool-controlled library.
3426 if test "$prev" = dlfiles; then
3427 # This library was specified with -dlopen.
3428 dlfiles="$dlfiles $arg"
3430 elif test "$prev" = dlprefiles; then
3431 # The library was specified with -dlpreopen.
3432 dlprefiles="$dlprefiles $arg"
3435 deplibs="$deplibs $arg"
3440 # Some other compiler argument.
3442 # Unknown arguments in both finalize_command and compile_command need
3443 # to be aesthetically quoted because they are evaled later.
3444 func_quote_for_eval "$arg"
3445 arg="$func_quote_for_eval_result"
3449 # Now actually substitute the argument into the commands.
3450 if test -n "$arg"; then
3451 func_append compile_command " $arg"
3452 func_append finalize_command " $arg"
3454 done # argument parsing loop
3456 test -n "$prev" && \
3457 func_fatal_help "the \`$prevarg' option requires an argument"
3459 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
3460 eval arg=\"$export_dynamic_flag_spec\"
3461 func_append compile_command " $arg"
3462 func_append finalize_command " $arg"
3466 # calculate the name of the file, without its directory
3467 func_basename "$output"
3468 outputname="$func_basename_result"
3469 libobjs_save="$libobjs"
3471 if test -n "$shlibpath_var"; then
3472 # get the directories listed in $shlibpath_var
3473 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
3477 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
3478 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
3480 func_dirname "$output" "/" ""
3481 output_objdir="$func_dirname_result$objdir"
3482 # Create the object directory.
3483 func_mkdir_p "$output_objdir"
3485 # Determine the type of output
3488 func_fatal_help "you must specify an output file"
3490 *.$libext) linkmode=oldlib ;;
3491 *.lo | *.$objext) linkmode=obj ;;
3492 *.la) linkmode=lib ;;
3493 *) linkmode=prog ;; # Anything else should be a program.
3499 # Find all interdependent deplibs by searching for libraries
3500 # that are linked more than once (e.g. -la -lb -la)
3501 for deplib in $deplibs; do
3502 if $opt_duplicate_deps ; then
3504 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3507 libs="$libs $deplib"
3510 if test "$linkmode" = lib; then
3511 libs="$predeps $libs $compiler_lib_search_path $postdeps"
3513 # Compute libraries that are listed more than once in $predeps
3514 # $postdeps and mark them as special (i.e., whose duplicates are
3515 # not to be eliminated).
3517 if $opt_duplicate_compiler_generated_deps; then
3518 for pre_post_dep in $predeps $postdeps; do
3519 case "$pre_post_deps " in
3520 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
3522 pre_post_deps="$pre_post_deps $pre_post_dep"
3531 need_relink=no # whether we're linking any uninstalled libtool libraries
3532 notinst_deplibs= # not-installed libtool libraries
3533 notinst_path= # paths that contain not-installed libtool libraries
3537 passes="conv dlpreopen link"
3538 for file in $dlfiles $dlprefiles; do
3542 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
3553 passes="conv scan dlopen dlpreopen link"
3559 for pass in $passes; do
3560 # The preopen pass in lib mode reverses $deplibs; put it back here
3561 # so that -L comes before libs that need it for instance...
3562 if test "$linkmode,$pass" = "lib,link"; then
3563 ## FIXME: Find the place where the list is rebuilt in the wrong
3564 ## order, and fix it there properly
3566 for deplib in $deplibs; do
3567 tmp_deplibs="$deplib $tmp_deplibs"
3569 deplibs="$tmp_deplibs"
3572 if test "$linkmode,$pass" = "lib,link" ||
3573 test "$linkmode,$pass" = "prog,scan"; then
3577 if test "$linkmode" = prog; then
3579 dlopen) libs="$dlfiles" ;;
3580 dlpreopen) libs="$dlprefiles" ;;
3581 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
3584 if test "$linkmode,$pass" = "lib,dlpreopen"; then
3585 # Collect and forward deplibs of preopened libtool libs
3586 for lib in $dlprefiles; do
3587 # Ignore non-libtool-libs
3590 *.la) func_source "$lib" ;;
3593 # Collect preopened libtool deplibs, except any this library
3594 # has declared as weak libs
3595 for deplib in $dependency_libs; do
3596 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
3597 case " $weak_libs " in
3598 *" $deplib_base "*) ;;
3599 *) deplibs="$deplibs $deplib" ;;
3605 if test "$pass" = dlopen; then
3606 # Collect dlpreopened libraries
3607 save_deplibs="$deplibs"
3611 for deplib in $libs; do
3615 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
3616 if test "$linkmode,$pass" = "prog,link"; then
3617 compile_deplibs="$deplib $compile_deplibs"
3618 finalize_deplibs="$deplib $finalize_deplibs"
3620 compiler_flags="$compiler_flags $deplib"
3621 if test "$linkmode" = lib ; then
3622 case "$new_inherited_linker_flags " in
3624 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
3631 if test "$linkmode" != lib && test "$linkmode" != prog; then
3632 func_warning "\`-l' is ignored for archives/objects"
3635 func_stripname '-l' '' "$deplib"
3636 name=$func_stripname_result
3637 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
3638 for search_ext in .la $std_shrext .so .a; do
3639 # Search the libtool library
3640 lib="$searchdir/lib${name}${search_ext}"
3641 if test -f "$lib"; then
3642 if test "$search_ext" = ".la"; then
3651 if test "$found" != yes; then
3652 # deplib doesn't seem to be a libtool library
3653 if test "$linkmode,$pass" = "prog,link"; then
3654 compile_deplibs="$deplib $compile_deplibs"
3655 finalize_deplibs="$deplib $finalize_deplibs"
3657 deplibs="$deplib $deplibs"
3658 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
3661 else # deplib is a libtool library
3662 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
3663 # We need to do some special things here, and not later.
3664 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3665 case " $predeps $postdeps " in
3667 if func_lalib_p "$lib"; then
3671 for l in $old_library $library_names; do
3674 if test "X$ll" = "X$old_library" ; then # only static version available
3676 func_dirname "$lib" "" "."
3677 ladir="$func_dirname_result"
3678 lib=$ladir/$old_library
3679 if test "$linkmode,$pass" = "prog,link"; then
3680 compile_deplibs="$deplib $compile_deplibs"
3681 finalize_deplibs="$deplib $finalize_deplibs"
3683 deplibs="$deplib $deplibs"
3684 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
3696 if test "$linkmode,$pass" = "prog,link"; then
3697 compile_deplibs="$deplib $compile_deplibs"
3698 finalize_deplibs="$deplib $finalize_deplibs"
3700 deplibs="$deplib $deplibs"
3701 if test "$linkmode" = lib ; then
3702 case "$new_inherited_linker_flags " in
3704 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
3713 deplibs="$deplib $deplibs"
3714 test "$pass" = conv && continue
3715 newdependency_libs="$deplib $newdependency_libs"
3716 func_stripname '-L' '' "$deplib"
3717 newlib_search_path="$newlib_search_path $func_stripname_result"
3720 if test "$pass" = conv; then
3721 deplibs="$deplib $deplibs"
3724 if test "$pass" = scan; then
3725 deplibs="$deplib $deplibs"
3727 compile_deplibs="$deplib $compile_deplibs"
3728 finalize_deplibs="$deplib $finalize_deplibs"
3730 func_stripname '-L' '' "$deplib"
3731 newlib_search_path="$newlib_search_path $func_stripname_result"
3734 func_warning "\`-L' is ignored for archives/objects"
3740 if test "$pass" = link; then
3741 func_stripname '-R' '' "$deplib"
3742 dir=$func_stripname_result
3743 # Make sure the xrpath contains only unique directories.
3746 *) xrpath="$xrpath $dir" ;;
3749 deplibs="$deplib $deplibs"
3752 *.la) lib="$deplib" ;;
3754 if test "$pass" = conv; then
3755 deplibs="$deplib $deplibs"
3760 # Linking convenience modules into shared libraries is allowed,
3761 # but linking other static libraries is non-portable.
3762 case " $dlpreconveniencelibs " in
3766 case $deplibs_check_method in
3768 set dummy $deplibs_check_method; shift
3769 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
3770 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
3771 | $EGREP "$match_pattern_regex" > /dev/null; then
3779 if test "$valid_a_lib" != yes; then
3781 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
3782 $ECHO "*** I have the capability to make that library automatically link in when"
3783 $ECHO "*** you link to this library. But I can only do this if you have a"
3784 $ECHO "*** shared version of the library, which you do not appear to have"
3785 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
3786 $ECHO "*** that it is just a static archive that I should not use here."
3789 $ECHO "*** Warning: Linking the shared library $output against the"
3790 $ECHO "*** static library $deplib is not portable!"
3791 deplibs="$deplib $deplibs"
3798 if test "$pass" != link; then
3799 deplibs="$deplib $deplibs"
3801 compile_deplibs="$deplib $compile_deplibs"
3802 finalize_deplibs="$deplib $finalize_deplibs"
3809 if test "$pass" = conv; then
3810 deplibs="$deplib $deplibs"
3811 elif test "$linkmode" = prog; then
3812 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
3813 # If there is no dlopen support or we're linking statically,
3814 # we need to preload.
3815 newdlprefiles="$newdlprefiles $deplib"
3816 compile_deplibs="$deplib $compile_deplibs"
3817 finalize_deplibs="$deplib $finalize_deplibs"
3819 newdlfiles="$newdlfiles $deplib"
3830 if test "$found" = yes || test -f "$lib"; then :
3832 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
3835 # Check to see that this really is a libtool archive.
3836 func_lalib_unsafe_p "$lib" \
3837 || func_fatal_error "\`$lib' is not a valid libtool archive"
3839 func_dirname "$lib" "" "."
3840 ladir="$func_dirname_result"
3848 inherited_linker_flags=
3849 # If the library was installed with an old release of libtool,
3850 # it will not redefine variables installed, or shouldnotlink
3859 # Convert "-framework foo" to "foo.ltframework"
3860 if test -n "$inherited_linker_flags"; then
3861 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
3862 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
3863 case " $new_inherited_linker_flags " in
3864 *" $tmp_inherited_linker_flag "*) ;;
3865 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
3869 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
3870 if test "$linkmode,$pass" = "prog,link"; then
3871 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
3872 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
3874 compiler_flags="$compiler_flags $inherited_linker_flags"
3876 if test "$linkmode,$pass" = "lib,link" ||
3877 test "$linkmode,$pass" = "prog,scan" ||
3878 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
3879 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
3880 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
3883 if test "$pass" = conv; then
3884 # Only check for convenience libraries
3885 deplibs="$lib $deplibs"
3886 if test -z "$libdir"; then
3887 if test -z "$old_library"; then
3888 func_fatal_error "cannot find name of link library for \`$lib'"
3890 # It is a libtool convenience library, so add in its objects.
3891 convenience="$convenience $ladir/$objdir/$old_library"
3892 old_convenience="$old_convenience $ladir/$objdir/$old_library"
3893 elif test "$linkmode" != prog && test "$linkmode" != lib; then
3894 func_fatal_error "\`$lib' is not a convenience library"
3897 for deplib in $dependency_libs; do
3898 deplibs="$deplib $deplibs"
3899 if $opt_duplicate_deps ; then
3900 case "$tmp_libs " in
3901 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3904 tmp_libs="$tmp_libs $deplib"
3910 # Get the name of the library we link against.
3912 for l in $old_library $library_names; do
3915 if test -z "$linklib"; then
3916 func_fatal_error "cannot find name of link library for \`$lib'"
3919 # This library was specified with -dlopen.
3920 if test "$pass" = dlopen; then
3921 if test -z "$libdir"; then
3922 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
3924 if test -z "$dlname" ||
3925 test "$dlopen_support" != yes ||
3926 test "$build_libtool_libs" = no; then
3927 # If there is no dlname, no dlopen support or we're linking
3928 # statically, we need to preload. We also need to preload any
3929 # dependent libraries so libltdl's deplib preloader doesn't
3930 # bomb out in the load deplibs phase.
3931 dlprefiles="$dlprefiles $lib $dependency_libs"
3933 newdlfiles="$newdlfiles $lib"
3938 # We need an absolute path.
3940 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
3942 abs_ladir=`cd "$ladir" && pwd`
3943 if test -z "$abs_ladir"; then
3944 func_warning "cannot determine absolute directory name of \`$ladir'"
3945 func_warning "passing it literally to the linker, although it might fail"
3950 func_basename "$lib"
3951 laname="$func_basename_result"
3953 # Find the relevant object directory and library name.
3954 if test "X$installed" = Xyes; then
3955 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
3956 func_warning "library \`$lib' was moved."
3964 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
3966 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
3969 # Remove this search path later
3970 notinst_path="$notinst_path $abs_ladir"
3972 dir="$ladir/$objdir"
3973 absdir="$abs_ladir/$objdir"
3974 # Remove this search path later
3975 notinst_path="$notinst_path $abs_ladir"
3977 fi # $installed = yes
3978 func_stripname 'lib' '.la' "$laname"
3979 name=$func_stripname_result
3981 # This library was specified with -dlpreopen.
3982 if test "$pass" = dlpreopen; then
3983 if test -z "$libdir" && test "$linkmode" = prog; then
3984 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
3986 # Prefer using a static library (so that no silly _DYNAMIC symbols
3987 # are required to link).
3988 if test -n "$old_library"; then
3989 newdlprefiles="$newdlprefiles $dir/$old_library"
3990 # Keep a list of preopened convenience libraries to check
3991 # that they are being used correctly in the link pass.
3992 test -z "$libdir" && \
3993 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
3994 # Otherwise, use the dlname, so that lt_dlopen finds it.
3995 elif test -n "$dlname"; then
3996 newdlprefiles="$newdlprefiles $dir/$dlname"
3998 newdlprefiles="$newdlprefiles $dir/$linklib"
4000 fi # $pass = dlpreopen
4002 if test -z "$libdir"; then
4003 # Link the convenience library
4004 if test "$linkmode" = lib; then
4005 deplibs="$dir/$old_library $deplibs"
4006 elif test "$linkmode,$pass" = "prog,link"; then
4007 compile_deplibs="$dir/$old_library $compile_deplibs"
4008 finalize_deplibs="$dir/$old_library $finalize_deplibs"
4010 deplibs="$lib $deplibs" # used for prog,scan pass
4016 if test "$linkmode" = prog && test "$pass" != link; then
4017 newlib_search_path="$newlib_search_path $ladir"
4018 deplibs="$lib $deplibs"
4021 if test "$link_all_deplibs" != no || test -z "$library_names" ||
4022 test "$build_libtool_libs" = no; then
4027 for deplib in $dependency_libs; do
4029 -L*) func_stripname '-L' '' "$deplib"
4030 newlib_search_path="$newlib_search_path $func_stripname_result"
4033 # Need to link against all dependency_libs?
4034 if test "$linkalldeplibs" = yes; then
4035 deplibs="$deplib $deplibs"
4037 # Need to hardcode shared library paths
4038 # or/and link against static libraries
4039 newdependency_libs="$deplib $newdependency_libs"
4041 if $opt_duplicate_deps ; then
4042 case "$tmp_libs " in
4043 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4046 tmp_libs="$tmp_libs $deplib"
4049 fi # $linkmode = prog...
4051 if test "$linkmode,$pass" = "prog,link"; then
4052 if test -n "$library_names" &&
4053 { { test "$prefer_static_libs" = no ||
4054 test "$prefer_static_libs,$installed" = "built,yes"; } ||
4055 test -z "$old_library"; }; then
4056 # We need to hardcode the library path
4057 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
4058 # Make sure the rpath contains only unique directories.
4059 case "$temp_rpath:" in
4061 *) temp_rpath="$temp_rpath$absdir:" ;;
4065 # Hardcode the library path.
4066 # Skip directories that are in the system default run-time
4068 case " $sys_lib_dlsearch_path " in
4071 case "$compile_rpath " in
4073 *) compile_rpath="$compile_rpath $absdir"
4077 case " $sys_lib_dlsearch_path " in
4080 case "$finalize_rpath " in
4082 *) finalize_rpath="$finalize_rpath $libdir"
4086 fi # $linkmode,$pass = prog,link...
4088 if test "$alldeplibs" = yes &&
4089 { test "$deplibs_check_method" = pass_all ||
4090 { test "$build_libtool_libs" = yes &&
4091 test -n "$library_names"; }; }; then
4092 # We only need to search for static libraries
4097 link_static=no # Whether the deplib will be linked statically
4098 use_static_libs=$prefer_static_libs
4099 if test "$use_static_libs" = built && test "$installed" = yes; then
4102 if test -n "$library_names" &&
4103 { test "$use_static_libs" = no || test -z "$old_library"; }; then
4106 # No point in relinking DLLs because paths are not encoded
4107 notinst_deplibs="$notinst_deplibs $lib"
4111 if test "$installed" = no; then
4112 notinst_deplibs="$notinst_deplibs $lib"
4117 # This is a shared library
4119 # Warn about portability, can't link against -module's on some
4120 # systems (darwin). Don't bleat about dlopened modules though!
4122 for dlpremoduletest in $dlprefiles; do
4123 if test "X$dlpremoduletest" = "X$lib"; then
4124 dlopenmodule="$dlpremoduletest"
4128 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
4130 if test "$linkmode" = prog; then
4131 $ECHO "*** Warning: Linking the executable $output against the loadable module"
4133 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
4135 $ECHO "*** $linklib is not portable!"
4137 if test "$linkmode" = lib &&
4138 test "$hardcode_into_libs" = yes; then
4139 # Hardcode the library path.
4140 # Skip directories that are in the system default run-time
4142 case " $sys_lib_dlsearch_path " in
4145 case "$compile_rpath " in
4147 *) compile_rpath="$compile_rpath $absdir"
4151 case " $sys_lib_dlsearch_path " in
4154 case "$finalize_rpath " in
4156 *) finalize_rpath="$finalize_rpath $libdir"
4162 if test -n "$old_archive_from_expsyms_cmds"; then
4163 # figure out the soname
4164 set dummy $library_names
4168 libname=`eval "\\$ECHO \"$libname_spec\""`
4169 # use dlname if we got it. it's perfectly good, no?
4170 if test -n "$dlname"; then
4172 elif test -n "$soname_spec"; then
4176 major=`expr $current - $age`
4180 eval soname=\"$soname_spec\"
4185 # Make a new name for the extract_expsyms_cmds to use
4187 func_basename "$soroot"
4188 soname="$func_basename_result"
4189 func_stripname 'lib' '.dll' "$soname"
4190 newlib=libimp-$func_stripname_result.a
4192 # If the library has no export list, then create one now
4193 if test -f "$output_objdir/$soname-def"; then :
4195 func_echo "extracting exported symbol list from \`$soname'"
4196 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
4200 if test -f "$output_objdir/$newlib"; then :; else
4201 func_echo "generating import library for \`$soname'"
4202 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
4204 # make sure the library variables are pointing to the new library
4207 fi # test -n "$old_archive_from_expsyms_cmds"
4209 if test "$linkmode" = prog || test "$mode" != relink; then
4214 case $hardcode_action in
4215 immediate | unsupported)
4216 if test "$hardcode_direct" = no; then
4219 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
4220 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
4221 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
4222 *-*-unixware7*) add_dir="-L$dir" ;;
4224 # if the lib is a (non-dlopened) module then we can not
4225 # link against it, someone is ignoring the earlier warnings
4226 if /usr/bin/file -L $add 2> /dev/null |
4227 $GREP ": [^:]* bundle" >/dev/null ; then
4228 if test "X$dlopenmodule" != "X$lib"; then
4229 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
4230 if test -z "$old_library" ; then
4232 $ECHO "*** And there doesn't seem to be a static archive available"
4233 $ECHO "*** The link will probably fail, sorry"
4235 add="$dir/$old_library"
4237 elif test -n "$old_library"; then
4238 add="$dir/$old_library"
4242 elif test "$hardcode_minus_L" = no; then
4244 *-*-sunos*) add_shlibpath="$dir" ;;
4248 elif test "$hardcode_shlibpath_var" = no; then
4249 add_shlibpath="$dir"
4256 if test "$hardcode_direct" = yes &&
4257 test "$hardcode_direct_absolute" = no; then
4259 elif test "$hardcode_minus_L" = yes; then
4261 # Try looking first in the location we're being installed to.
4262 if test -n "$inst_prefix_dir"; then
4265 add_dir="$add_dir -L$inst_prefix_dir$libdir"
4270 elif test "$hardcode_shlibpath_var" = yes; then
4271 add_shlibpath="$dir"
4280 if test "$lib_linked" != yes; then
4281 func_fatal_configuration "unsupported hardcode properties"
4284 if test -n "$add_shlibpath"; then
4285 case :$compile_shlibpath: in
4286 *":$add_shlibpath:"*) ;;
4287 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
4290 if test "$linkmode" = prog; then
4291 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
4292 test -n "$add" && compile_deplibs="$add $compile_deplibs"
4294 test -n "$add_dir" && deplibs="$add_dir $deplibs"
4295 test -n "$add" && deplibs="$add $deplibs"
4296 if test "$hardcode_direct" != yes &&
4297 test "$hardcode_minus_L" != yes &&
4298 test "$hardcode_shlibpath_var" = yes; then
4299 case :$finalize_shlibpath: in
4301 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
4307 if test "$linkmode" = prog || test "$mode" = relink; then
4311 # Finalize command for both is simple: just hardcode it.
4312 if test "$hardcode_direct" = yes &&
4313 test "$hardcode_direct_absolute" = no; then
4314 add="$libdir/$linklib"
4315 elif test "$hardcode_minus_L" = yes; then
4318 elif test "$hardcode_shlibpath_var" = yes; then
4319 case :$finalize_shlibpath: in
4321 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
4324 elif test "$hardcode_automatic" = yes; then
4325 if test -n "$inst_prefix_dir" &&
4326 test -f "$inst_prefix_dir$libdir/$linklib" ; then
4327 add="$inst_prefix_dir$libdir/$linklib"
4329 add="$libdir/$linklib"
4332 # We cannot seem to hardcode it, guess we'll fake it.
4334 # Try looking first in the location we're being installed to.
4335 if test -n "$inst_prefix_dir"; then
4338 add_dir="$add_dir -L$inst_prefix_dir$libdir"
4345 if test "$linkmode" = prog; then
4346 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
4347 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
4349 test -n "$add_dir" && deplibs="$add_dir $deplibs"
4350 test -n "$add" && deplibs="$add $deplibs"
4353 elif test "$linkmode" = prog; then
4354 # Here we assume that one of hardcode_direct or hardcode_minus_L
4355 # is not unsupported. This is valid on all known static and
4357 if test "$hardcode_direct" != unsupported; then
4358 test -n "$old_library" && linklib="$old_library"
4359 compile_deplibs="$dir/$linklib $compile_deplibs"
4360 finalize_deplibs="$dir/$linklib $finalize_deplibs"
4362 compile_deplibs="-l$name -L$dir $compile_deplibs"
4363 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
4365 elif test "$build_libtool_libs" = yes; then
4366 # Not a shared library
4367 if test "$deplibs_check_method" != pass_all; then
4368 # We're trying link a shared library against a static one
4369 # but the system doesn't support it.
4371 # Just print a warning and add the library to dependency_libs so
4372 # that the program can be linked against the static library.
4374 $ECHO "*** Warning: This system can not link to static lib archive $lib."
4375 $ECHO "*** I have the capability to make that library automatically link in when"
4376 $ECHO "*** you link to this library. But I can only do this if you have a"
4377 $ECHO "*** shared version of the library, which you do not appear to have."
4378 if test "$module" = yes; then
4379 $ECHO "*** But as you try to build a module library, libtool will still create "
4380 $ECHO "*** a static module, that should work as long as the dlopening application"
4381 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
4382 if test -z "$global_symbol_pipe"; then
4384 $ECHO "*** However, this would only work if libtool was able to extract symbol"
4385 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
4386 $ECHO "*** not find such a program. So, this module is probably useless."
4387 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
4389 if test "$build_old_libs" = no; then
4390 build_libtool_libs=module
4393 build_libtool_libs=no
4397 deplibs="$dir/$old_library $deplibs"
4400 fi # link shared/static library?
4402 if test "$linkmode" = lib; then
4403 if test -n "$dependency_libs" &&
4404 { test "$hardcode_into_libs" != yes ||
4405 test "$build_old_libs" = yes ||
4406 test "$link_static" = yes; }; then
4407 # Extract -R from dependency_libs
4409 for libdir in $dependency_libs; do
4411 -R*) func_stripname '-R' '' "$libdir"
4412 temp_xrpath=$func_stripname_result
4414 *" $temp_xrpath "*) ;;
4415 *) xrpath="$xrpath $temp_xrpath";;
4417 *) temp_deplibs="$temp_deplibs $libdir";;
4420 dependency_libs="$temp_deplibs"
4423 newlib_search_path="$newlib_search_path $absdir"
4424 # Link against this library
4425 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
4426 # ... and its dependency_libs
4428 for deplib in $dependency_libs; do
4429 newdependency_libs="$deplib $newdependency_libs"
4430 if $opt_duplicate_deps ; then
4431 case "$tmp_libs " in
4432 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4435 tmp_libs="$tmp_libs $deplib"
4438 if test "$link_all_deplibs" != no; then
4439 # Add the search paths of all dependency libraries
4440 for deplib in $dependency_libs; do
4442 -L*) path="$deplib" ;;
4444 func_dirname "$deplib" "" "."
4445 dir="$func_dirname_result"
4446 # We need an absolute path.
4448 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
4450 absdir=`cd "$dir" && pwd`
4451 if test -z "$absdir"; then
4452 func_warning "cannot determine absolute directory name of \`$dir'"
4457 if $GREP "^installed=no" $deplib > /dev/null; then
4461 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
4462 if test -n "$deplibrary_names" ; then
4463 for tmp in $deplibrary_names ; do
4466 if test -f "$absdir/$objdir/$depdepl" ; then
4467 depdepl="$absdir/$objdir/$depdepl"
4468 darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
4469 darwin_install_name=`$ECHO $darwin_install_name`
4470 if test -z "$darwin_install_name"; then
4471 darwin_install_name=`otool64 -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
4472 darwin_install_name=`$ECHO $darwin_install_name`
4474 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
4475 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
4481 path="-L$absdir/$objdir"
4485 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4486 test -z "$libdir" && \
4487 func_fatal_error "\`$deplib' is not a valid libtool archive"
4488 test "$absdir" != "$libdir" && \
4489 func_warning "\`$deplib' seems to be moved"
4495 case " $deplibs " in
4497 *) deplibs="$path $deplibs" ;;
4500 fi # link_all_deplibs != no
4502 done # for deplib in $libs
4503 dependency_libs="$newdependency_libs"
4504 if test "$pass" = dlpreopen; then
4505 # Link the dlpreopened libraries before other libraries
4506 for deplib in $save_deplibs; do
4507 deplibs="$deplib $deplibs"
4510 if test "$pass" != dlopen; then
4511 if test "$pass" != conv; then
4512 # Make sure lib_search_path contains only unique directories.
4514 for dir in $newlib_search_path; do
4515 case "$lib_search_path " in
4517 *) lib_search_path="$lib_search_path $dir" ;;
4523 if test "$linkmode,$pass" != "prog,link"; then
4526 vars="compile_deplibs finalize_deplibs"
4528 for var in $vars dependency_libs; do
4529 # Add libraries to $var in reverse order
4530 eval tmp_libs=\"\$$var\"
4532 for deplib in $tmp_libs; do
4533 # FIXME: Pedantically, this is the right thing to do, so
4534 # that some nasty dependency loop isn't accidentally
4536 #new_libs="$deplib $new_libs"
4537 # Pragmatically, this seems to cause very few problems in
4540 -L*) new_libs="$deplib $new_libs" ;;
4543 # And here is the reason: when a library appears more
4544 # than once as an explicit dependence of a library, or
4545 # is implicitly linked in more than once by the
4546 # compiler, it is considered special, and multiple
4547 # occurrences thereof are not removed. Compare this
4548 # with having the same library being listed as a
4549 # dependency of multiple other libraries: in this case,
4550 # we know (pedantically, we assume) the library does not
4551 # need to be listed more than once, so we keep only the
4552 # last copy. This is not always right, but it is rare
4553 # enough that we require users that really mean to play
4554 # such unportable linking tricks to link the library
4555 # using -Wl,-lname, so that libtool does not consider it
4556 # for duplicate removal.
4557 case " $specialdeplibs " in
4558 *" $deplib "*) new_libs="$deplib $new_libs" ;;
4560 case " $new_libs " in
4562 *) new_libs="$deplib $new_libs" ;;
4570 for deplib in $new_libs; do
4573 case " $tmp_libs " in
4575 *) tmp_libs="$tmp_libs $deplib" ;;
4578 *) tmp_libs="$tmp_libs $deplib" ;;
4581 eval $var=\"$tmp_libs\"
4584 # Last step: remove runtime libs from dependency_libs
4585 # (they stay in deplibs)
4587 for i in $dependency_libs ; do
4588 case " $predeps $postdeps $compiler_lib_search_path " in
4593 if test -n "$i" ; then
4594 tmp_libs="$tmp_libs $i"
4597 dependency_libs=$tmp_libs
4599 if test "$linkmode" = prog; then
4600 dlfiles="$newdlfiles"
4602 if test "$linkmode" = prog || test "$linkmode" = lib; then
4603 dlprefiles="$newdlprefiles"
4608 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4609 func_warning "\`-dlopen' is ignored for archives"
4612 test -n "$deplibs" && \
4613 func_warning "\`-l' and \`-L' are ignored for archives"
4616 test -n "$rpath" && \
4617 func_warning "\`-rpath' is ignored for archives"
4619 test -n "$xrpath" && \
4620 func_warning "\`-R' is ignored for archives"
4622 test -n "$vinfo" && \
4623 func_warning "\`-version-info/-version-number' is ignored for archives"
4625 test -n "$release" && \
4626 func_warning "\`-release' is ignored for archives"
4628 test -n "$export_symbols$export_symbols_regex" && \
4629 func_warning "\`-export-symbols' is ignored for archives"
4631 # Now set the variables for building old libraries.
4632 build_libtool_libs=no
4634 objs="$objs$old_deplibs"
4638 # Make sure we only generate libraries of the form `libNAME.la'.
4641 func_stripname 'lib' '.la' "$outputname"
4642 name=$func_stripname_result
4643 eval shared_ext=\"$shrext_cmds\"
4644 eval libname=\"$libname_spec\"
4647 test "$module" = no && \
4648 func_fatal_help "libtool library \`$output' must begin with \`lib'"
4650 if test "$need_lib_prefix" != no; then
4651 # Add the "lib" prefix for modules if required
4652 func_stripname '' '.la' "$outputname"
4653 name=$func_stripname_result
4654 eval shared_ext=\"$shrext_cmds\"
4655 eval libname=\"$libname_spec\"
4657 func_stripname '' '.la' "$outputname"
4658 libname=$func_stripname_result
4663 if test -n "$objs"; then
4664 if test "$deplibs_check_method" != pass_all; then
4665 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
4668 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
4669 $ECHO "*** objects $objs is not portable!"
4670 libobjs="$libobjs $objs"
4674 test "$dlself" != no && \
4675 func_warning "\`-dlopen self' is ignored for libtool libraries"
4679 test "$#" -gt 1 && \
4680 func_warning "ignoring multiple \`-rpath's for a libtool library"
4685 if test -z "$rpath"; then
4686 if test "$build_libtool_libs" = yes; then
4687 # Building a libtool convenience library.
4688 # Some compilers have problems with a `.al' extension so
4689 # convenience libraries should have the same extension an
4690 # archive normally would.
4691 oldlibs="$output_objdir/$libname.$libext $oldlibs"
4692 build_libtool_libs=convenience
4696 test -n "$vinfo" && \
4697 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
4699 test -n "$release" && \
4700 func_warning "\`-release' is ignored for convenience libraries"
4703 # Parse the version information argument.
4704 save_ifs="$IFS"; IFS=':'
4705 set dummy $vinfo 0 0 0
4710 func_fatal_help "too many parameters to \`-version-info'"
4712 # convert absolute version numbers to libtool ages
4713 # this retains compatibility with .la files and attempts
4714 # to make the code below a bit more comprehensible
4716 case $vinfo_number in
4720 number_revision="$3"
4722 # There are really only two kinds -- those that
4723 # use the current revision as the major version
4724 # and those that subtract age and use age as
4725 # a minor version. But, then there is irix
4726 # which has an extra 1 added just for fun
4728 case $version_type in
4729 darwin|linux|osf|windows|none)
4730 current=`expr $number_major + $number_minor`
4732 revision="$number_revision"
4734 freebsd-aout|freebsd-elf|sunos)
4735 current="$number_major"
4736 revision="$number_minor"
4740 current=`expr $number_major + $number_minor - 1`
4742 revision="$number_minor"
4753 # Check that each of the things are valid numbers.
4755 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]) ;;
4757 func_error "CURRENT \`$current' must be a nonnegative integer"
4758 func_fatal_error "\`$vinfo' is not valid version information"
4763 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]) ;;
4765 func_error "REVISION \`$revision' must be a nonnegative integer"
4766 func_fatal_error "\`$vinfo' is not valid version information"
4771 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]) ;;
4773 func_error "AGE \`$age' must be a nonnegative integer"
4774 func_fatal_error "\`$vinfo' is not valid version information"
4778 if test "$age" -gt "$current"; then
4779 func_error "AGE \`$age' is greater than the current interface number \`$current'"
4780 func_fatal_error "\`$vinfo' is not valid version information"
4783 # Calculate the version variables.
4787 case $version_type in
4791 # Like Linux, but with the current version available in
4792 # verstring for coding it into the library header
4793 major=.`expr $current - $age`
4794 versuffix="$major.$age.$revision"
4795 # Darwin ld doesn't like 0 for these options...
4796 minor_current=`expr $current + 1`
4797 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
4802 versuffix=".$current.$revision";
4807 versuffix=".$current"
4811 major=`expr $current - $age + 1`
4813 case $version_type in
4814 nonstopux) verstring_prefix=nonstopux ;;
4815 *) verstring_prefix=sgi ;;
4817 verstring="$verstring_prefix$major.$revision"
4819 # Add in all the interfaces that we are compatible with.
4821 while test "$loop" -ne 0; do
4822 iface=`expr $revision - $loop`
4823 loop=`expr $loop - 1`
4824 verstring="$verstring_prefix$major.$iface:$verstring"
4827 # Before this point, $major must not contain `.'.
4829 versuffix="$major.$revision"
4833 major=.`expr $current - $age`
4834 versuffix="$major.$age.$revision"
4838 major=.`expr $current - $age`
4839 versuffix=".$current.$age.$revision"
4840 verstring="$current.$age.$revision"
4842 # Add in all the interfaces that we are compatible with.
4844 while test "$loop" -ne 0; do
4845 iface=`expr $current - $loop`
4846 loop=`expr $loop - 1`
4847 verstring="$verstring:${iface}.0"
4850 # Make executables depend on our current version.
4851 verstring="$verstring:${current}.0"
4856 versuffix=".$current"
4861 versuffix=".$current.$revision"
4865 # Use '-' rather than '.', since we only want one
4866 # extension on DOS 8.3 filesystems.
4867 major=`expr $current - $age`
4872 func_fatal_configuration "unknown library version type \`$version_type'"
4876 # Clear the version info if we defaulted, and they specified a release.
4877 if test -z "$vinfo" && test -n "$release"; then
4879 case $version_type in
4881 # we can't check for "0.0" in archive_cmds due to quoting
4882 # problems, so we reset it completely
4889 if test "$need_version" = no; then
4896 # Remove version info from name if versioning should be avoided
4897 if test "$avoid_version" = yes && test "$need_version" = no; then
4903 # Check to see if the archive will have undefined symbols.
4904 if test "$allow_undefined" = yes; then
4905 if test "$allow_undefined_flag" = unsupported; then
4906 func_warning "undefined symbols not allowed in $host shared libraries"
4907 build_libtool_libs=no
4911 # Don't allow undefined symbols.
4912 allow_undefined_flag="$no_undefined_flag"
4917 func_generate_dlsyms "$libname" "$libname" "yes"
4918 libobjs="$libobjs $symfileobj"
4919 test "X$libobjs" = "X " && libobjs=
4921 if test "$mode" != relink; then
4922 # Remove our outputs, but don't remove object files since they
4923 # may have been created when compiling PIC objects.
4925 tempremovelist=`$ECHO "$output_objdir/*"`
4926 for p in $tempremovelist; do
4930 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
4931 if test "X$precious_files_regex" != "X"; then
4932 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
4937 removelist="$removelist $p"
4942 test -n "$removelist" && \
4943 func_show_eval "${RM}r \$removelist"
4946 # Now set the variables for building old libraries.
4947 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
4948 oldlibs="$oldlibs $output_objdir/$libname.$libext"
4950 # Transform .lo files to .o files.
4951 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
4954 # Eliminate all temporary directories.
4955 #for path in $notinst_path; do
4956 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
4957 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
4958 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
4961 if test -n "$xrpath"; then
4962 # If the user specified any rpath flags, then add them.
4964 for libdir in $xrpath; do
4965 temp_xrpath="$temp_xrpath -R$libdir"
4966 case "$finalize_rpath " in
4968 *) finalize_rpath="$finalize_rpath $libdir" ;;
4971 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
4972 dependency_libs="$temp_xrpath $dependency_libs"
4976 # Make sure dlfiles contains only unique files that won't be dlpreopened
4977 old_dlfiles="$dlfiles"
4979 for lib in $old_dlfiles; do
4980 case " $dlprefiles $dlfiles " in
4982 *) dlfiles="$dlfiles $lib" ;;
4986 # Make sure dlprefiles contains only unique files
4987 old_dlprefiles="$dlprefiles"
4989 for lib in $old_dlprefiles; do
4990 case "$dlprefiles " in
4992 *) dlprefiles="$dlprefiles $lib" ;;
4996 if test "$build_libtool_libs" = yes; then
4997 if test -n "$rpath"; then
4999 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
5000 # these systems don't actually have a c library (as such)!
5002 *-*-rhapsody* | *-*-darwin1.[012])
5003 # Rhapsody C library is in the System framework
5004 deplibs="$deplibs System.ltframework"
5007 # Don't link with libc until the a.out ld.so is fixed.
5009 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5010 # Do not include libc due to us having libc/libc_r.
5012 *-*-sco3.2v5* | *-*-sco5v6*)
5013 # Causes problems with __ctype
5015 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5016 # Compiler inserts libc in the correct place for threads to work
5019 # Add libc to deplibs on all other systems if necessary.
5020 if test "$build_libtool_need_lc" = "yes"; then
5021 deplibs="$deplibs -lc"
5027 # Transform deplibs into only deplibs that can be linked in shared.
5029 libname_save=$libname
5030 release_save=$release
5031 versuffix_save=$versuffix
5033 # I'm not sure if I'm treating the release correctly. I think
5034 # release should show up in the -l (ie -lgmp5) so we don't want to
5035 # add it in twice. Is that correct?
5041 case $deplibs_check_method in
5043 # Don't check for shared/static. Everything works.
5044 # This might be a little naive. We might want to check
5045 # whether the library exists or not. But this is on
5046 # osf3 & osf4 and I'm not really sure... Just
5047 # implementing what was already the behavior.
5051 # This code stresses the "libraries are programs" paradigm to its
5052 # limits. Maybe even breaks it. We compile a program, linking it
5053 # against the deplibs as a proxy for the library. Then we can check
5054 # whether they linked in statically or dynamically with ldd.
5055 $opt_dry_run || $RM conftest.c
5056 cat > conftest.c <<EOF
5057 int main() { return 0; }
5059 $opt_dry_run || $RM conftest
5060 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
5061 ldd_output=`ldd conftest`
5062 for i in $deplibs; do
5063 name=`expr $i : '-l\(.*\)'`
5064 # If $name is empty we are operating on a -L argument.
5065 if test "$name" != "" && test "$name" != "0"; then
5066 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5067 case " $predeps $postdeps " in
5069 newdeplibs="$newdeplibs $i"
5074 if test -n "$i" ; then
5075 libname=`eval "\\$ECHO \"$libname_spec\""`
5076 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5077 set dummy $deplib_matches; shift
5079 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5080 newdeplibs="$newdeplibs $i"
5084 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
5085 $ECHO "*** I have the capability to make that library automatically link in when"
5086 $ECHO "*** you link to this library. But I can only do this if you have a"
5087 $ECHO "*** shared version of the library, which I believe you do not have"
5088 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
5089 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
5093 newdeplibs="$newdeplibs $i"
5097 # Error occurred in the first compile. Let's try to salvage
5098 # the situation: Compile a separate program for each library.
5099 for i in $deplibs; do
5100 name=`expr $i : '-l\(.*\)'`
5101 # If $name is empty we are operating on a -L argument.
5102 if test "$name" != "" && test "$name" != "0"; then
5103 $opt_dry_run || $RM conftest
5104 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
5105 ldd_output=`ldd conftest`
5106 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5107 case " $predeps $postdeps " in
5109 newdeplibs="$newdeplibs $i"
5114 if test -n "$i" ; then
5115 libname=`eval "\\$ECHO \"$libname_spec\""`
5116 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5117 set dummy $deplib_matches; shift
5119 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5120 newdeplibs="$newdeplibs $i"
5124 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
5125 $ECHO "*** I have the capability to make that library automatically link in when"
5126 $ECHO "*** you link to this library. But I can only do this if you have a"
5127 $ECHO "*** shared version of the library, which you do not appear to have"
5128 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
5129 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
5135 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
5136 $ECHO "*** make it link in! You will probably need to install it or some"
5137 $ECHO "*** library that it depends on before this library will be fully"
5138 $ECHO "*** functional. Installing it before continuing would be even better."
5141 newdeplibs="$newdeplibs $i"
5147 set dummy $deplibs_check_method; shift
5148 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5149 for a_deplib in $deplibs; do
5150 name=`expr $a_deplib : '-l\(.*\)'`
5151 # If $name is empty we are operating on a -L argument.
5152 if test "$name" != "" && test "$name" != "0"; then
5153 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5154 case " $predeps $postdeps " in
5156 newdeplibs="$newdeplibs $a_deplib"
5161 if test -n "$a_deplib" ; then
5162 libname=`eval "\\$ECHO \"$libname_spec\""`
5163 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
5164 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
5165 for potent_lib in $potential_libs; do
5166 # Follow soft links.
5167 if ls -lLd "$potent_lib" 2>/dev/null |
5168 $GREP " -> " >/dev/null; then
5171 # The statement above tries to avoid entering an
5172 # endless loop below, in case of cyclic links.
5173 # We might still enter an endless loop, since a link
5174 # loop can be closed while we follow links,
5176 potlib="$potent_lib"
5177 while test -h "$potlib" 2>/dev/null; do
5178 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
5180 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
5181 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
5184 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
5186 $EGREP "$file_magic_regex" > /dev/null; then
5187 newdeplibs="$newdeplibs $a_deplib"
5194 if test -n "$a_deplib" ; then
5197 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
5198 $ECHO "*** I have the capability to make that library automatically link in when"
5199 $ECHO "*** you link to this library. But I can only do this if you have a"
5200 $ECHO "*** shared version of the library, which you do not appear to have"
5201 $ECHO "*** because I did check the linker path looking for a file starting"
5202 if test -z "$potlib" ; then
5203 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
5205 $ECHO "*** with $libname and none of the candidates passed a file format test"
5206 $ECHO "*** using a file magic. Last file checked: $potlib"
5210 # Add a -L argument.
5211 newdeplibs="$newdeplibs $a_deplib"
5213 done # Gone through all deplibs.
5216 set dummy $deplibs_check_method; shift
5217 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5218 for a_deplib in $deplibs; do
5219 name=`expr $a_deplib : '-l\(.*\)'`
5220 # If $name is empty we are operating on a -L argument.
5221 if test -n "$name" && test "$name" != "0"; then
5222 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5223 case " $predeps $postdeps " in
5225 newdeplibs="$newdeplibs $a_deplib"
5230 if test -n "$a_deplib" ; then
5231 libname=`eval "\\$ECHO \"$libname_spec\""`
5232 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
5233 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
5234 for potent_lib in $potential_libs; do
5235 potlib="$potent_lib" # see symlink-check above in file_magic test
5236 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
5237 $EGREP "$match_pattern_regex" > /dev/null; then
5238 newdeplibs="$newdeplibs $a_deplib"
5245 if test -n "$a_deplib" ; then
5248 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
5249 $ECHO "*** I have the capability to make that library automatically link in when"
5250 $ECHO "*** you link to this library. But I can only do this if you have a"
5251 $ECHO "*** shared version of the library, which you do not appear to have"
5252 $ECHO "*** because I did check the linker path looking for a file starting"
5253 if test -z "$potlib" ; then
5254 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
5256 $ECHO "*** with $libname and none of the candidates passed a file format test"
5257 $ECHO "*** using a regex pattern. Last file checked: $potlib"
5261 # Add a -L argument.
5262 newdeplibs="$newdeplibs $a_deplib"
5264 done # Gone through all deplibs.
5268 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
5269 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
5270 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5271 for i in $predeps $postdeps ; do
5272 # can't use Xsed below, because $i might contain '/'
5273 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
5276 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
5277 $GREP . >/dev/null; then
5279 if test "X$deplibs_check_method" = "Xnone"; then
5280 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
5282 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
5284 $ECHO "*** All declared inter-library dependencies are being dropped."
5289 versuffix=$versuffix_save
5291 release=$release_save
5292 libname=$libname_save
5296 *-*-rhapsody* | *-*-darwin1.[012])
5297 # On Rhapsody replace the C library with the System framework
5298 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
5302 if test "$droppeddeps" = yes; then
5303 if test "$module" = yes; then
5305 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
5306 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
5307 $ECHO "*** a static module, that should work as long as the dlopening"
5308 $ECHO "*** application is linked with the -dlopen flag."
5309 if test -z "$global_symbol_pipe"; then
5311 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5312 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5313 $ECHO "*** not find such a program. So, this module is probably useless."
5314 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
5316 if test "$build_old_libs" = no; then
5317 oldlibs="$output_objdir/$libname.$libext"
5318 build_libtool_libs=module
5321 build_libtool_libs=no
5324 $ECHO "*** The inter-library dependencies that have been dropped here will be"
5325 $ECHO "*** automatically added whenever a program is linked with this library"
5326 $ECHO "*** or is declared to -dlopen it."
5328 if test "$allow_undefined" = no; then
5330 $ECHO "*** Since this library must not contain undefined symbols,"
5331 $ECHO "*** because either the platform does not support them or"
5332 $ECHO "*** it was explicitly requested with -no-undefined,"
5333 $ECHO "*** libtool will only create a static version of it."
5334 if test "$build_old_libs" = no; then
5335 oldlibs="$output_objdir/$libname.$libext"
5336 build_libtool_libs=module
5339 build_libtool_libs=no
5344 # Done checking deplibs!
5347 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
5350 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5351 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5352 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5356 # move library search paths that coincide with paths to not yet
5357 # installed libraries to the beginning of the library search list
5359 for path in $notinst_path; do
5360 case " $new_libs " in
5361 *" -L$path/$objdir "*) ;;
5363 case " $deplibs " in
5364 *" -L$path/$objdir "*)
5365 new_libs="$new_libs -L$path/$objdir" ;;
5370 for deplib in $deplibs; do
5373 case " $new_libs " in
5375 *) new_libs="$new_libs $deplib" ;;
5378 *) new_libs="$new_libs $deplib" ;;
5383 # All the library-specific variables (install_libdir is set above).
5388 # Test again, we may have decided not to build it any more
5389 if test "$build_libtool_libs" = yes; then
5390 if test "$hardcode_into_libs" = yes; then
5391 # Hardcode the library paths
5394 rpath="$finalize_rpath"
5395 test "$mode" != relink && rpath="$compile_rpath$rpath"
5396 for libdir in $rpath; do
5397 if test -n "$hardcode_libdir_flag_spec"; then
5398 if test -n "$hardcode_libdir_separator"; then
5399 if test -z "$hardcode_libdirs"; then
5400 hardcode_libdirs="$libdir"
5402 # Just accumulate the unique libdirs.
5403 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
5404 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
5407 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
5412 eval flag=\"$hardcode_libdir_flag_spec\"
5413 dep_rpath="$dep_rpath $flag"
5415 elif test -n "$runpath_var"; then
5416 case "$perm_rpath " in
5418 *) perm_rpath="$perm_rpath $libdir" ;;
5422 # Substitute the hardcoded libdirs into the rpath.
5423 if test -n "$hardcode_libdir_separator" &&
5424 test -n "$hardcode_libdirs"; then
5425 libdir="$hardcode_libdirs"
5426 if test -n "$hardcode_libdir_flag_spec_ld"; then
5427 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
5429 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
5432 if test -n "$runpath_var" && test -n "$perm_rpath"; then
5433 # We should set the runpath_var.
5435 for dir in $perm_rpath; do
5438 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
5440 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
5443 shlibpath="$finalize_shlibpath"
5444 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
5445 if test -n "$shlibpath"; then
5446 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
5449 # Get the real and link names of the library.
5450 eval shared_ext=\"$shrext_cmds\"
5451 eval library_names=\"$library_names_spec\"
5452 set dummy $library_names
5457 if test -n "$soname_spec"; then
5458 eval soname=\"$soname_spec\"
5462 if test -z "$dlname"; then
5466 lib="$output_objdir/$realname"
5470 linknames="$linknames $link"
5473 # Use standard objects if they are pic
5474 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
5475 test "X$libobjs" = "X " && libobjs=
5478 if test -n "$export_symbols" && test -n "$include_expsyms"; then
5479 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
5480 export_symbols="$output_objdir/$libname.uexp"
5481 delfiles="$delfiles $export_symbols"
5484 orig_export_symbols=
5487 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
5488 # exporting using user supplied symfile
5489 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
5490 # and it's NOT already a .def file. Must figure out
5491 # which of the given symbols are data symbols and tag
5492 # them as such. So, trigger use of export_symbols_cmds.
5493 # export_symbols gets reassigned inside the "prepare
5494 # the list of exported symbols" if statement, so the
5495 # include_expsyms logic still works.
5496 orig_export_symbols="$export_symbols"
5498 always_export_symbols=yes
5504 # Prepare the list of exported symbols
5505 if test -z "$export_symbols"; then
5506 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
5507 func_echo "generating symbol list for \`$libname.la'"
5508 export_symbols="$output_objdir/$libname.exp"
5509 $opt_dry_run || $RM $export_symbols
5510 cmds=$export_symbols_cmds
5511 save_ifs="$IFS"; IFS='~'
5512 for cmd in $cmds; do
5515 if len=`expr "X$cmd" : ".*"` &&
5516 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5517 func_show_eval "$cmd" 'exit $?'
5518 skipped_export=false
5520 # The command line is too long to execute in one step.
5521 func_echo "using reloadable object file for export list..."
5523 # Break out early, otherwise skipped_export may be
5524 # set to false by a later but shorter cmd.
5529 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
5530 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
5531 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
5536 if test -n "$export_symbols" && test -n "$include_expsyms"; then
5537 tmp_export_symbols="$export_symbols"
5538 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
5539 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
5542 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
5543 # The given exports_symbols file has to be filtered, so filter it.
5544 func_echo "filter symbol list for \`$libname.la' to tag DATA exports"
5545 # FIXME: $output_objdir/$libname.filter potentially contains lots of
5546 # 's' commands which not all seds can handle. GNU sed should be fine
5547 # though. Also, the filter scales superlinearly with the number of
5548 # global variables. join(1) would be nice here, but unfortunately
5549 # isn't a blessed tool.
5550 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
5551 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
5552 export_symbols=$output_objdir/$libname.def
5553 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
5557 for test_deplib in $deplibs; do
5558 case " $convenience " in
5559 *" $test_deplib "*) ;;
5561 tmp_deplibs="$tmp_deplibs $test_deplib"
5565 deplibs="$tmp_deplibs"
5567 if test -n "$convenience"; then
5568 if test -n "$whole_archive_flag_spec" &&
5569 test "$compiler_needs_object" = yes &&
5570 test -z "$libobjs"; then
5571 # extract the archives, so we have objects to list.
5572 # TODO: could optimize this to just extract one archive.
5573 whole_archive_flag_spec=
5575 if test -n "$whole_archive_flag_spec"; then
5576 save_libobjs=$libobjs
5577 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
5578 test "X$libobjs" = "X " && libobjs=
5580 gentop="$output_objdir/${outputname}x"
5581 generated="$generated $gentop"
5583 func_extract_archives $gentop $convenience
5584 libobjs="$libobjs $func_extract_archives_result"
5585 test "X$libobjs" = "X " && libobjs=
5589 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
5590 eval flag=\"$thread_safe_flag_spec\"
5591 linker_flags="$linker_flags $flag"
5594 # Make a backup of the uninstalled library when relinking
5595 if test "$mode" = relink; then
5596 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
5599 # Do each of the archive commands.
5600 if test "$module" = yes && test -n "$module_cmds" ; then
5601 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
5602 eval test_cmds=\"$module_expsym_cmds\"
5603 cmds=$module_expsym_cmds
5605 eval test_cmds=\"$module_cmds\"
5609 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
5610 eval test_cmds=\"$archive_expsym_cmds\"
5611 cmds=$archive_expsym_cmds
5613 eval test_cmds=\"$archive_cmds\"
5618 if test "X$skipped_export" != "X:" &&
5619 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5620 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5623 # The command line is too long to link in one step, link piecewise
5624 # or, if using GNU ld and skipped_export is not :, use a linker
5627 # Save the value of $output and $libobjs because we want to
5628 # use them later. If we have whole_archive_flag_spec, we
5629 # want to use save_libobjs as it was before
5630 # whole_archive_flag_spec was expanded, because we can't
5631 # assume the linker understands whole_archive_flag_spec.
5632 # This may have to be revisited, in case too many
5633 # convenience libraries get linked in and end up exceeding
5635 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
5636 save_libobjs=$libobjs
5639 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
5641 # Clear the reloadable object creation command queue and
5642 # initialize k to one.
5649 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
5650 output=${output_objdir}/${output_la}.lnkscript
5651 func_echo "creating GNU ld script: $output"
5652 $ECHO 'INPUT (' > $output
5653 for obj in $save_libobjs
5655 $ECHO "$obj" >> $output
5657 $ECHO ')' >> $output
5658 delfiles="$delfiles $output"
5659 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
5660 output=${output_objdir}/${output_la}.lnk
5661 func_echo "creating linker input file list: $output"
5666 if test "$compiler_needs_object" = yes; then
5672 $ECHO "$obj" >> $output
5674 delfiles="$delfiles $output"
5675 output=$firstobj\"$file_list_spec$output\"
5677 if test -n "$save_libobjs"; then
5678 func_echo "creating reloadable object files..."
5679 output=$output_objdir/$output_la-${k}.$objext
5680 # Loop over the list of objects to be linked.
5681 for obj in $save_libobjs
5683 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
5684 if test "X$objlist" = X ||
5685 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5686 test "$len" -le "$max_cmd_len"; }; then
5687 objlist="$objlist $obj"
5689 # The command $test_cmds is almost too long, add a
5690 # command to the queue.
5691 if test "$k" -eq 1 ; then
5692 # The first file doesn't have a previous command to add.
5693 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
5695 # All subsequent reloadable object files will link in
5696 # the last one created.
5697 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
5699 last_robj=$output_objdir/$output_la-${k}.$objext
5701 output=$output_objdir/$output_la-${k}.$objext
5706 # Handle the remaining objects by creating one last
5707 # reloadable object file. All subsequent reloadable object
5708 # files will link in the last one created.
5709 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5710 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
5712 # Set up a command to remove the reloadable object files
5713 # after they are used.
5715 while test "$i" -lt "$k"
5718 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
5724 if ${skipped_export-false}; then
5725 func_echo "generating symbol list for \`$libname.la'"
5726 export_symbols="$output_objdir/$libname.exp"
5727 $opt_dry_run || $RM $export_symbols
5729 # Append the command to create the export file.
5730 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5731 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
5734 test -n "$save_libobjs" &&
5735 func_echo "creating a temporary reloadable object file: $output"
5737 # Loop through the commands generated above and execute them.
5738 save_ifs="$IFS"; IFS='~'
5739 for cmd in $concat_cmds; do
5742 func_quote_for_expand "$cmd"
5743 eval "func_echo $func_quote_for_expand_result"
5745 $opt_dry_run || eval "$cmd" || {
5748 # Restore the uninstalled library and exit
5749 if test "$mode" = relink; then
5750 ( cd "$output_objdir" && \
5751 $RM "${realname}T" && \
5752 $MV "${realname}U" "$realname" )
5760 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
5761 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
5762 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
5766 if ${skipped_export-false}; then
5767 if test -n "$export_symbols" && test -n "$include_expsyms"; then
5768 tmp_export_symbols="$export_symbols"
5769 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
5770 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
5773 if test -n "$orig_export_symbols"; then
5774 # The given exports_symbols file has to be filtered, so filter it.
5775 func_echo "filter symbol list for \`$libname.la' to tag DATA exports"
5776 # FIXME: $output_objdir/$libname.filter potentially contains lots of
5777 # 's' commands which not all seds can handle. GNU sed should be fine
5778 # though. Also, the filter scales superlinearly with the number of
5779 # global variables. join(1) would be nice here, but unfortunately
5780 # isn't a blessed tool.
5781 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
5782 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
5783 export_symbols=$output_objdir/$libname.def
5784 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
5789 # Restore the value of output.
5792 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
5793 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
5794 test "X$libobjs" = "X " && libobjs=
5796 # Expand the library linking commands again to reset the
5797 # value of $libobjs for piecewise linking.
5799 # Do each of the archive commands.
5800 if test "$module" = yes && test -n "$module_cmds" ; then
5801 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
5802 cmds=$module_expsym_cmds
5807 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
5808 cmds=$archive_expsym_cmds
5815 if test -n "$delfiles"; then
5816 # Append the command to remove temporary files to $cmds.
5817 eval cmds=\"\$cmds~\$RM $delfiles\"
5820 # Add any objects from preloaded convenience libraries
5821 if test -n "$dlprefiles"; then
5822 gentop="$output_objdir/${outputname}x"
5823 generated="$generated $gentop"
5825 func_extract_archives $gentop $dlprefiles
5826 libobjs="$libobjs $func_extract_archives_result"
5827 test "X$libobjs" = "X " && libobjs=
5830 save_ifs="$IFS"; IFS='~'
5831 for cmd in $cmds; do
5835 func_quote_for_expand "$cmd"
5836 eval "func_echo $func_quote_for_expand_result"
5838 $opt_dry_run || eval "$cmd" || {
5841 # Restore the uninstalled library and exit
5842 if test "$mode" = relink; then
5843 ( cd "$output_objdir" && \
5844 $RM "${realname}T" && \
5845 $MV "${realname}U" "$realname" )
5853 # Restore the uninstalled library and exit
5854 if test "$mode" = relink; then
5855 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
5857 if test -n "$convenience"; then
5858 if test -z "$whole_archive_flag_spec"; then
5859 func_show_eval '${RM}r "$gentop"'
5866 # Create links to the real library.
5867 for linkname in $linknames; do
5868 if test "$realname" != "$linkname"; then
5869 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
5873 # If -module or -export-dynamic was specified, set the dlname.
5874 if test "$module" = yes || test "$export_dynamic" = yes; then
5875 # On all known operating systems, these are identical.
5882 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
5883 func_warning "\`-dlopen' is ignored for objects"
5886 test -n "$deplibs" && \
5887 func_warning "\`-l' and \`-L' are ignored for objects"
5889 test -n "$rpath" && \
5890 func_warning "\`-rpath' is ignored for objects"
5892 test -n "$xrpath" && \
5893 func_warning "\`-R' is ignored for objects"
5895 test -n "$vinfo" && \
5896 func_warning "\`-version-info' is ignored for objects"
5898 test -n "$release" && \
5899 func_warning "\`-release' is ignored for objects"
5903 test -n "$objs$old_deplibs" && \
5904 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
5908 obj=$func_lo2o_result
5916 # Delete the old objects.
5917 $opt_dry_run || $RM $obj $libobj
5919 # Objects from convenience libraries. This assumes
5920 # single-version convenience libraries. Whenever we create
5921 # different ones for PIC/non-PIC, this we'll have to duplicate
5925 # reload_cmds runs $LD directly, so let us get rid of
5926 # -Wl from whole_archive_flag_spec and hope we can get by with
5927 # turning comma into space..
5930 if test -n "$convenience"; then
5931 if test -n "$whole_archive_flag_spec"; then
5932 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
5933 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
5935 gentop="$output_objdir/${obj}x"
5936 generated="$generated $gentop"
5938 func_extract_archives $gentop $convenience
5939 reload_conv_objs="$reload_objs $func_extract_archives_result"
5943 # Create the old-style object.
5944 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
5947 func_execute_cmds "$reload_cmds" 'exit $?'
5949 # Exit if we aren't doing a library object file.
5950 if test -z "$libobj"; then
5951 if test -n "$gentop"; then
5952 func_show_eval '${RM}r "$gentop"'
5958 if test "$build_libtool_libs" != yes; then
5959 if test -n "$gentop"; then
5960 func_show_eval '${RM}r "$gentop"'
5963 # Create an invalid libtool object if no PIC, so that we don't
5964 # accidentally link it into a program.
5965 # $show "echo timestamp > $libobj"
5966 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
5970 if test -n "$pic_flag" || test "$pic_mode" != default; then
5971 # Only do commands if we really have different PIC objects.
5972 reload_objs="$libobjs $reload_conv_objs"
5974 func_execute_cmds "$reload_cmds" 'exit $?'
5977 if test -n "$gentop"; then
5978 func_show_eval '${RM}r "$gentop"'
5986 *cygwin*) func_stripname '' '.exe' "$output"
5987 output=$func_stripname_result.exe;;
5989 test -n "$vinfo" && \
5990 func_warning "\`-version-info' is ignored for programs"
5992 test -n "$release" && \
5993 func_warning "\`-release' is ignored for programs"
5995 test "$preload" = yes \
5996 && test "$dlopen_support" = unknown \
5997 && test "$dlopen_self" = unknown \
5998 && test "$dlopen_self_static" = unknown && \
5999 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
6002 *-*-rhapsody* | *-*-darwin1.[012])
6003 # On Rhapsody replace the C library is the System framework
6004 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6005 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6011 # Don't allow lazy linking, it breaks C++ global constructors
6012 # But is supposedly fixed on 10.4 or later (yay!).
6013 if test "$tagname" = CXX ; then
6014 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
6016 compile_command="$compile_command ${wl}-bind_at_load"
6017 finalize_command="$finalize_command ${wl}-bind_at_load"
6021 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6022 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6023 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6028 # move library search paths that coincide with paths to not yet
6029 # installed libraries to the beginning of the library search list
6031 for path in $notinst_path; do
6032 case " $new_libs " in
6033 *" -L$path/$objdir "*) ;;
6035 case " $compile_deplibs " in
6036 *" -L$path/$objdir "*)
6037 new_libs="$new_libs -L$path/$objdir" ;;
6042 for deplib in $compile_deplibs; do
6045 case " $new_libs " in
6047 *) new_libs="$new_libs $deplib" ;;
6050 *) new_libs="$new_libs $deplib" ;;
6053 compile_deplibs="$new_libs"
6056 compile_command="$compile_command $compile_deplibs"
6057 finalize_command="$finalize_command $finalize_deplibs"
6059 if test -n "$rpath$xrpath"; then
6060 # If the user specified any rpath flags, then add them.
6061 for libdir in $rpath $xrpath; do
6062 # This is the magic to use -rpath.
6063 case "$finalize_rpath " in
6065 *) finalize_rpath="$finalize_rpath $libdir" ;;
6070 # Now hardcode the library paths
6073 for libdir in $compile_rpath $finalize_rpath; do
6074 if test -n "$hardcode_libdir_flag_spec"; then
6075 if test -n "$hardcode_libdir_separator"; then
6076 if test -z "$hardcode_libdirs"; then
6077 hardcode_libdirs="$libdir"
6079 # Just accumulate the unique libdirs.
6080 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6081 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6084 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6089 eval flag=\"$hardcode_libdir_flag_spec\"
6090 rpath="$rpath $flag"
6092 elif test -n "$runpath_var"; then
6093 case "$perm_rpath " in
6095 *) perm_rpath="$perm_rpath $libdir" ;;
6099 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
6100 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
6101 case :$dllsearchpath: in
6103 *) dllsearchpath="$dllsearchpath:$libdir";;
6105 case :$dllsearchpath: in
6106 *":$testbindir:"*) ;;
6107 *) dllsearchpath="$dllsearchpath:$testbindir";;
6112 # Substitute the hardcoded libdirs into the rpath.
6113 if test -n "$hardcode_libdir_separator" &&
6114 test -n "$hardcode_libdirs"; then
6115 libdir="$hardcode_libdirs"
6116 eval rpath=\" $hardcode_libdir_flag_spec\"
6118 compile_rpath="$rpath"
6122 for libdir in $finalize_rpath; do
6123 if test -n "$hardcode_libdir_flag_spec"; then
6124 if test -n "$hardcode_libdir_separator"; then
6125 if test -z "$hardcode_libdirs"; then
6126 hardcode_libdirs="$libdir"
6128 # Just accumulate the unique libdirs.
6129 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6130 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6133 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6138 eval flag=\"$hardcode_libdir_flag_spec\"
6139 rpath="$rpath $flag"
6141 elif test -n "$runpath_var"; then
6142 case "$finalize_perm_rpath " in
6144 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
6148 # Substitute the hardcoded libdirs into the rpath.
6149 if test -n "$hardcode_libdir_separator" &&
6150 test -n "$hardcode_libdirs"; then
6151 libdir="$hardcode_libdirs"
6152 eval rpath=\" $hardcode_libdir_flag_spec\"
6154 finalize_rpath="$rpath"
6156 if test -n "$libobjs" && test "$build_old_libs" = yes; then
6157 # Transform all the library objects into standard objects.
6158 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6159 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6162 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
6164 # template prelinking step
6165 if test -n "$prelink_cmds"; then
6166 func_execute_cmds "$prelink_cmds" 'exit $?'
6169 wrappers_required=yes
6171 *cygwin* | *mingw* )
6172 if test "$build_libtool_libs" != yes; then
6173 wrappers_required=no
6177 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
6178 wrappers_required=no
6182 if test "$wrappers_required" = no; then
6183 # Replace the output file specification.
6184 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
6185 link_command="$compile_command$compile_rpath"
6187 # We have no uninstalled library dependencies, so finalize right now.
6189 func_show_eval "$link_command" 'exit_status=$?'
6191 # Delete the generated files.
6192 if test -f "$output_objdir/${outputname}S.${objext}"; then
6193 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
6199 if test -n "$compile_shlibpath$finalize_shlibpath"; then
6200 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
6202 if test -n "$finalize_shlibpath"; then
6203 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
6208 if test -n "$runpath_var"; then
6209 if test -n "$perm_rpath"; then
6210 # We should set the runpath_var.
6212 for dir in $perm_rpath; do
6215 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
6217 if test -n "$finalize_perm_rpath"; then
6218 # We should set the runpath_var.
6220 for dir in $finalize_perm_rpath; do
6223 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
6227 if test "$no_install" = yes; then
6228 # We don't need to create a wrapper script.
6229 link_command="$compile_var$compile_command$compile_rpath"
6230 # Replace the output file specification.
6231 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
6232 # Delete the old output file.
6233 $opt_dry_run || $RM $output
6234 # Link the executable and exit
6235 func_show_eval "$link_command" 'exit $?'
6239 if test "$hardcode_action" = relink; then
6240 # Fast installation is not supported
6241 link_command="$compile_var$compile_command$compile_rpath"
6242 relink_command="$finalize_var$finalize_command$finalize_rpath"
6244 func_warning "this platform does not like uninstalled shared libraries"
6245 func_warning "\`$output' will be relinked during installation"
6247 if test "$fast_install" != no; then
6248 link_command="$finalize_var$compile_command$finalize_rpath"
6249 if test "$fast_install" = yes; then
6250 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
6252 # fast_install is set to needless
6256 link_command="$compile_var$compile_command$compile_rpath"
6257 relink_command="$finalize_var$finalize_command$finalize_rpath"
6261 # Replace the output file specification.
6262 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
6264 # Delete the old output files.
6265 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
6267 func_show_eval "$link_command" 'exit $?'
6269 # Now create the wrapper script.
6270 func_echo "creating $output"
6272 # Quote the relink command for shipping.
6273 if test -n "$relink_command"; then
6274 # Preserve any variables that may affect compiler behavior
6275 for var in $variables_saved_for_relink; do
6276 if eval test -z \"\${$var+set}\"; then
6277 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
6278 elif eval var_value=\$$var; test -z "$var_value"; then
6279 relink_command="$var=; export $var; $relink_command"
6281 func_quote_for_eval "$var_value"
6282 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
6285 relink_command="(cd `pwd`; $relink_command)"
6286 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
6289 # Quote $ECHO for shipping.
6290 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
6292 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
6293 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
6295 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
6297 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
6300 # Only actually do things if not in dry run mode.
6302 # win32 will think the script is a binary if it has
6303 # a .exe suffix, so we strip it off here.
6305 *.exe) func_stripname '' '.exe' "$output"
6306 output=$func_stripname_result ;;
6308 # test for cygwin because mv fails w/o .exe extensions
6312 func_stripname '' '.exe' "$outputname"
6313 outputname=$func_stripname_result ;;
6317 *cygwin* | *mingw* )
6318 output_name=`basename $output`
6319 output_path=`dirname $output`
6320 cwrappersource="$output_path/$objdir/lt-$output_name.c"
6321 cwrapper="$output_path/$output_name.exe"
6322 $RM $cwrappersource $cwrapper
6323 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
6325 cat > $cwrappersource <<EOF
6327 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
6328 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
6330 The $output program cannot be directly executed until all the libtool
6331 libraries that it depends on are installed.
6333 This wrapper executable should never be moved out of the build directory.
6334 If it is, it will not operate correctly.
6336 Currently, it simply execs the wrapper *script* "/bin/sh $output",
6337 but could eventually absorb all of the scripts functionality and
6338 exec $objdir/$outputname directly.
6341 cat >> $cwrappersource<<"EOF"
6350 #include <sys/stat.h>
6352 #if defined(PATH_MAX)
6353 # define LT_PATHMAX PATH_MAX
6354 #elif defined(MAXPATHLEN)
6355 # define LT_PATHMAX MAXPATHLEN
6357 # define LT_PATHMAX 1024
6360 #ifndef DIR_SEPARATOR
6361 # define DIR_SEPARATOR '/'
6362 # define PATH_SEPARATOR ':'
6365 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
6367 # define HAVE_DOS_BASED_FILE_SYSTEM
6368 # ifndef DIR_SEPARATOR_2
6369 # define DIR_SEPARATOR_2 '\\'
6371 # ifndef PATH_SEPARATOR_2
6372 # define PATH_SEPARATOR_2 ';'
6376 #ifndef DIR_SEPARATOR_2
6377 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
6378 #else /* DIR_SEPARATOR_2 */
6379 # define IS_DIR_SEPARATOR(ch) \
6380 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
6381 #endif /* DIR_SEPARATOR_2 */
6383 #ifndef PATH_SEPARATOR_2
6384 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
6385 #else /* PATH_SEPARATOR_2 */
6386 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
6387 #endif /* PATH_SEPARATOR_2 */
6389 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
6390 #define XFREE(stale) do { \
6391 if (stale) { free ((void *) stale); stale = 0; } \
6394 /* -DDEBUG is fairly common in CFLAGS. */
6396 #if defined DEBUGWRAPPER
6397 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
6399 # define DEBUG(format, ...)
6402 const char *program_name = NULL;
6404 void * xmalloc (size_t num);
6405 char * xstrdup (const char *string);
6406 const char * base_name (const char *name);
6407 char * find_executable(const char *wrapper);
6408 int check_executable(const char *path);
6409 char * strendzap(char *str, const char *pat);
6410 void lt_fatal (const char *message, ...);
6413 main (int argc, char *argv[])
6418 program_name = (char *) xstrdup (base_name (argv[0]));
6419 DEBUG("(main) argv[0] : %s\n",argv[0]);
6420 DEBUG("(main) program_name : %s\n",program_name);
6421 newargz = XMALLOC(char *, argc+2);
6424 cat >> $cwrappersource <<EOF
6425 newargz[0] = (char *) xstrdup("$SHELL");
6428 cat >> $cwrappersource <<"EOF"
6429 newargz[1] = find_executable(argv[0]);
6430 if (newargz[1] == NULL)
6431 lt_fatal("Couldn't find %s", argv[0]);
6432 DEBUG("(main) found exe at : %s\n",newargz[1]);
6433 /* we know the script has the same name, without the .exe */
6434 /* so make sure newargz[1] doesn't end in .exe */
6435 strendzap(newargz[1],".exe");
6436 for (i = 1; i < argc; i++)
6437 newargz[i+1] = xstrdup(argv[i]);
6438 newargz[argc+1] = NULL;
6440 for (i=0; i<argc+1; i++)
6442 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
6450 cat >> $cwrappersource <<EOF
6451 execv("$SHELL",(char const **)newargz);
6455 cat >> $cwrappersource <<EOF
6456 execv("$SHELL",newargz);
6461 cat >> $cwrappersource <<"EOF"
6466 xmalloc (size_t num)
6468 void * p = (void *) malloc (num);
6470 lt_fatal ("Memory exhausted");
6476 xstrdup (const char *string)
6478 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
6483 base_name (const char *name)
6487 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
6488 /* Skip over the disk name in MSDOS pathnames. */
6489 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
6493 for (base = name; *name; name++)
6494 if (IS_DIR_SEPARATOR (*name))
6500 check_executable(const char * path)
6504 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
6505 if ((!path) || (!*path))
6508 if ((stat (path, &st) >= 0) &&
6510 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
6511 #if defined (S_IXOTH)
6512 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
6514 #if defined (S_IXGRP)
6515 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
6517 ((st.st_mode & S_IXUSR) == S_IXUSR))
6524 /* Searches for the full path of the wrapper. Returns
6525 newly allocated full path name if found, NULL otherwise */
6527 find_executable (const char* wrapper)
6532 /* static buffer for getcwd */
6533 char tmp[LT_PATHMAX + 1];
6537 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
6539 if ((wrapper == NULL) || (*wrapper == '\0'))
6542 /* Absolute path? */
6543 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
6544 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
6546 concat_name = xstrdup (wrapper);
6547 if (check_executable(concat_name))
6554 if (IS_DIR_SEPARATOR (wrapper[0]))
6556 concat_name = xstrdup (wrapper);
6557 if (check_executable(concat_name))
6561 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
6565 for (p = wrapper; *p; p++)
6573 /* no slashes; search PATH */
6574 const char* path = getenv ("PATH");
6577 for (p = path; *p; p = p_next)
6581 for (q = p; *q; q++)
6582 if (IS_PATH_SEPARATOR(*q))
6585 p_next = (*q == '\0' ? q : q + 1);
6588 /* empty path: current directory */
6589 if (getcwd (tmp, LT_PATHMAX) == NULL)
6590 lt_fatal ("getcwd failed");
6591 tmp_len = strlen(tmp);
6592 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
6593 memcpy (concat_name, tmp, tmp_len);
6594 concat_name[tmp_len] = '/';
6595 strcpy (concat_name + tmp_len + 1, wrapper);
6599 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
6600 memcpy (concat_name, p, p_len);
6601 concat_name[p_len] = '/';
6602 strcpy (concat_name + p_len + 1, wrapper);
6604 if (check_executable(concat_name))
6609 /* not found in PATH; assume curdir */
6611 /* Relative path | not found in path: prepend cwd */
6612 if (getcwd (tmp, LT_PATHMAX) == NULL)
6613 lt_fatal ("getcwd failed");
6614 tmp_len = strlen(tmp);
6615 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
6616 memcpy (concat_name, tmp, tmp_len);
6617 concat_name[tmp_len] = '/';
6618 strcpy (concat_name + tmp_len + 1, wrapper);
6620 if (check_executable(concat_name))
6627 strendzap(char *str, const char *pat)
6631 assert(str != NULL);
6632 assert(pat != NULL);
6635 patlen = strlen(pat);
6639 str += len - patlen;
6640 if (strcmp(str, pat) == 0)
6647 lt_error_core (int exit_status, const char * mode,
6648 const char * message, va_list ap)
6650 fprintf (stderr, "%s: %s: ", program_name, mode);
6651 vfprintf (stderr, message, ap);
6652 fprintf (stderr, ".\n");
6654 if (exit_status >= 0)
6659 lt_fatal (const char *message, ...)
6662 va_start (ap, message);
6663 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
6667 # we should really use a build-platform specific compiler
6668 # here, but OTOH, the wrappers (shell script and this C one)
6669 # are only useful if you want to execute the "real" binary.
6670 # Since the "real" binary is built for $host, then this
6671 # wrapper might as well be built for $host, too.
6672 $opt_dry_run || $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
6676 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
6681 # $output - temporary wrapper script for $objdir/$outputname
6682 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
6684 # The $output program cannot be directly executed until all the libtool
6685 # libraries that it depends on are installed.
6687 # This wrapper script should never be moved out of the build directory.
6688 # If it is, it will not operate correctly.
6690 # Sed substitution that helps us do robust quoting. It backslashifies
6691 # metacharacters that are still active within double-quoted strings.
6692 Xsed='${SED} -e 1s/^X//'
6693 sed_quote_subst='$sed_quote_subst'
6695 # Be Bourne compatible
6696 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
6699 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
6700 # is contrary to our usage. Disable this feature.
6701 alias -g '\${1+\"\$@\"}'='\"\$@\"'
6702 setopt NO_GLOB_SUBST
6704 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
6706 BIN_SH=xpg4; export BIN_SH # for Tru64
6707 DUALCASE=1; export DUALCASE # for MKS sh
6709 # The HP-UX ksh and POSIX shell print the target directory to stdout
6711 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
6713 relink_command=\"$relink_command\"
6715 # This environment variable determines our operation mode.
6716 if test \"\$libtool_install_magic\" = \"$magic\"; then
6717 # install mode needs the following variables:
6718 generated_by_libtool_version='$macro_version'
6719 notinst_deplibs='$notinst_deplibs'
6721 # When we are sourced in execute mode, \$file and \$ECHO are already set.
6722 if test \"\$libtool_execute_magic\" != \"$magic\"; then
6725 # Make sure echo works.
6726 if test \"X\$1\" = X--no-reexec; then
6727 # Discard the --no-reexec flag, and continue.
6729 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
6730 # Yippee, \$ECHO works!
6733 # Restart under the correct shell, and then maybe \$ECHO will work.
6734 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
6740 # Find the directory that this script lives in.
6741 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
6742 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
6744 # Follow symbolic links until we get to the real thisdir.
6745 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
6746 while test -n \"\$file\"; do
6747 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
6749 # If there was a directory component, then change thisdir.
6750 if test \"x\$destdir\" != \"x\$file\"; then
6751 case \"\$destdir\" in
6752 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
6753 *) thisdir=\"\$thisdir/\$destdir\" ;;
6757 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
6758 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
6761 # Try to get the absolute directory name.
6762 absdir=\`cd \"\$thisdir\" && pwd\`
6763 test -n \"\$absdir\" && thisdir=\"\$absdir\"
6766 if test "$fast_install" = yes; then
6768 program=lt-'$outputname'$exeext
6769 progdir=\"\$thisdir/$objdir\"
6771 if test ! -f \"\$progdir/\$program\" ||
6772 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
6773 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
6775 file=\"\$\$-\$program\"
6777 if test ! -d \"\$progdir\"; then
6778 $MKDIR \"\$progdir\"
6780 $RM \"\$progdir/\$file\"
6785 # relink executable if necessary
6786 if test -n \"\$relink_command\"; then
6787 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
6789 $ECHO \"\$relink_command_output\" >&2
6790 $RM \"\$progdir/\$file\"
6795 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
6796 { $RM \"\$progdir/\$program\";
6797 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
6798 $RM \"\$progdir/\$file\"
6802 program='$outputname'
6803 progdir=\"\$thisdir/$objdir\"
6809 if test -f \"\$progdir/\$program\"; then"
6811 # Export our shlibpath_var if we have one.
6812 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
6814 # Add our own library path to $shlibpath_var
6815 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
6817 # Some systems cannot cope with colon-terminated $shlibpath_var
6818 # The second colon is a workaround for a bug in BeOS R4 sed
6819 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
6821 export $shlibpath_var
6825 # fixup the dll searchpath if we need to.
6826 if test -n "$dllsearchpath"; then
6828 # Add the dll search path components to the executable PATH
6829 PATH=$dllsearchpath:\$PATH
6834 if test \"\$libtool_execute_magic\" != \"$magic\"; then
6835 # Run the actual program with our arguments.
6838 # Backslashes separate directories on plain windows
6839 *-*-mingw | *-*-os2*)
6841 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
6847 exec \"\$progdir/\$program\" \${1+\"\$@\"}
6852 \$ECHO \"\$0: cannot exec \$program \$*\"
6856 # The program doesn't exist.
6857 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
6858 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
6859 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
6870 # See if we need to build an old-fashioned archive.
6871 for oldlib in $oldlibs; do
6873 if test "$build_libtool_libs" = convenience; then
6874 oldobjs="$libobjs_save $symfileobj"
6875 addlibs="$convenience"
6876 build_libtool_libs=no
6878 if test "$build_libtool_libs" = module; then
6879 oldobjs="$libobjs_save"
6880 build_libtool_libs=no
6882 oldobjs="$old_deplibs $non_pic_objects"
6883 if test "$preload" = yes && test -f "$symfileobj"; then
6884 oldobjs="$oldobjs $symfileobj"
6887 addlibs="$old_convenience"
6890 if test -n "$addlibs"; then
6891 gentop="$output_objdir/${outputname}x"
6892 generated="$generated $gentop"
6894 func_extract_archives $gentop $addlibs
6895 oldobjs="$oldobjs $func_extract_archives_result"
6898 # Do each command in the archive commands.
6899 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
6900 cmds=$old_archive_from_new_cmds
6903 # Add any objects from preloaded convenience libraries
6904 if test -n "$dlprefiles"; then
6905 gentop="$output_objdir/${outputname}x"
6906 generated="$generated $gentop"
6908 func_extract_archives $gentop $dlprefiles
6909 oldobjs="$oldobjs $func_extract_archives_result"
6912 # POSIX demands no paths to be encoded in archives. We have
6913 # to avoid creating archives with duplicate basenames if we
6914 # might have to extract them afterwards, e.g., when creating a
6915 # static archive out of a convenience library, or when linking
6916 # the entirety of a libtool archive into another (currently
6917 # not supported by libtool).
6918 if (for obj in $oldobjs
6920 func_basename "$obj"
6921 $ECHO "$func_basename_result"
6922 done | sort | sort -uc >/dev/null 2>&1); then
6925 $ECHO "copying selected object files to avoid basename conflicts..."
6926 gentop="$output_objdir/${outputname}x"
6927 generated="$generated $gentop"
6928 func_mkdir_p "$gentop"
6929 save_oldobjs=$oldobjs
6932 for obj in $save_oldobjs
6934 func_basename "$obj"
6935 objbase="$func_basename_result"
6936 case " $oldobjs " in
6937 " ") oldobjs=$obj ;;
6940 # Make sure we don't pick an alternate name that also
6942 newobj=lt$counter-$objbase
6943 counter=`expr $counter + 1`
6944 case " $oldobjs " in
6945 *[\ /]"$newobj "*) ;;
6946 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
6949 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
6950 oldobjs="$oldobjs $gentop/$newobj"
6952 *) oldobjs="$oldobjs $obj" ;;
6956 eval cmds=\"$old_archive_cmds\"
6958 if len=`expr "X$cmds" : ".*" 2>/dev/null` &&
6959 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6960 cmds=$old_archive_cmds
6962 # the command line is too long to link in one step, link in parts
6963 func_echo "using piecewise archive linking..."
6968 save_oldobjs=$oldobjs
6969 # Is there a better way of finding the last object in the list?
6970 for obj in $save_oldobjs
6974 for obj in $save_oldobjs
6976 oldobjs="$objlist $obj"
6977 objlist="$objlist $obj"
6978 eval test_cmds=\"$old_archive_cmds\"
6979 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
6980 test "$len" -le "$max_cmd_len"; then
6983 # the above command should be used before it gets too long
6985 if test "$obj" = "$last_oldobj" ; then
6988 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6989 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
6995 if test "X$oldobjs" = "X" ; then
6996 eval cmds=\"\$concat_cmds\"
6998 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
7002 func_execute_cmds "$cmds" 'exit $?'
7005 test -n "$generated" && \
7006 func_show_eval "${RM}r$generated"
7008 # Now create the libtool archive.
7012 test "$build_old_libs" = yes && old_library="$libname.$libext"
7013 func_echo "creating $output"
7015 # Preserve any variables that may affect compiler behavior
7016 for var in $variables_saved_for_relink; do
7017 if eval test -z \"\${$var+set}\"; then
7018 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7019 elif eval var_value=\$$var; test -z "$var_value"; then
7020 relink_command="$var=; export $var; $relink_command"
7022 func_quote_for_eval "$var_value"
7023 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7026 # Quote the link command for shipping.
7027 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
7028 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7029 if test "$hardcode_automatic" = yes ; then
7033 # Only create the output if not a dry run.
7035 for installed in no yes; do
7036 if test "$installed" = yes; then
7037 if test -z "$install_libdir"; then
7040 output="$output_objdir/$outputname"i
7041 # Replace all uninstalled libtool libraries with the installed ones
7043 for deplib in $dependency_libs; do
7046 func_basename "$deplib"
7047 name="$func_basename_result"
7048 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7049 test -z "$libdir" && \
7050 func_fatal_error "\`$deplib' is not a valid libtool archive"
7051 newdependency_libs="$newdependency_libs $libdir/$name"
7053 *) newdependency_libs="$newdependency_libs $deplib" ;;
7056 dependency_libs="$newdependency_libs"
7059 for lib in $dlfiles; do
7062 func_basename "$lib"
7063 name="$func_basename_result"
7064 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7065 test -z "$libdir" && \
7066 func_fatal_error "\`$lib' is not a valid libtool archive"
7067 newdlfiles="$newdlfiles $libdir/$name"
7069 *) newdlfiles="$newdlfiles $lib" ;;
7072 dlfiles="$newdlfiles"
7074 for lib in $dlprefiles; do
7077 # Only pass preopened files to the pseudo-archive (for
7078 # eventual linking with the app. that links it) if we
7079 # didn't already link the preopened objects directly into
7081 func_basename "$lib"
7082 name="$func_basename_result"
7083 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7084 test -z "$libdir" && \
7085 func_fatal_error "\`$lib' is not a valid libtool archive"
7086 newdlprefiles="$newdlprefiles $libdir/$name"
7090 dlprefiles="$newdlprefiles"
7093 for lib in $dlfiles; do
7095 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7096 *) abs=`pwd`"/$lib" ;;
7098 newdlfiles="$newdlfiles $abs"
7100 dlfiles="$newdlfiles"
7102 for lib in $dlprefiles; do
7104 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7105 *) abs=`pwd`"/$lib" ;;
7107 newdlprefiles="$newdlprefiles $abs"
7109 dlprefiles="$newdlprefiles"
7112 # place dlname in correct position for cygwin
7114 case $host,$output,$installed,$module,$dlname in
7115 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
7118 # $outputname - a libtool library file
7119 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
7121 # Please DO NOT delete this file!
7122 # It is necessary for linking the library.
7124 # The name that we can dlopen(3).
7127 # Names of this library.
7128 library_names='$library_names'
7130 # The name of the static archive.
7131 old_library='$old_library'
7133 # Linker flags that can not go in dependency_libs.
7134 inherited_linker_flags='$new_inherited_linker_flags'
7136 # Libraries that this one depends upon.
7137 dependency_libs='$dependency_libs'
7139 # Names of additional weak libraries provided by this library
7140 weak_library_names='$weak_libs'
7142 # Version information for $libname.
7147 # Is this an already installed library?
7148 installed=$installed
7150 # Should we warn about portability when linking against -modules?
7151 shouldnotlink=$module
7153 # Files to dlopen/dlpreopen
7155 dlpreopen='$dlprefiles'
7157 # Directory that this library needs to be installed in:
7158 libdir='$install_libdir'"
7159 if test "$installed" = no && test "$need_relink" = yes; then
7161 relink_command=\"$relink_command\""
7166 # Do a symbolic link so that the libtool archive can be found in
7167 # LD_LIBRARY_PATH before the program is installed.
7168 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
7174 { test "$mode" = link || test "$mode" = relink; } &&
7175 func_mode_link ${1+"$@"}
7178 # func_mode_uninstall arg...
7179 func_mode_uninstall ()
7187 # This variable tells wrapper scripts just to set variables rather
7188 # than running their programs.
7189 libtool_install_magic="$magic"
7194 -f) RM="$RM $arg"; rmforce=yes ;;
7195 -*) RM="$RM $arg" ;;
7196 *) files="$files $arg" ;;
7201 func_fatal_help "you must specify an RM program"
7205 origobjdir="$objdir"
7206 for file in $files; do
7207 func_dirname "$file" "" "."
7208 dir="$func_dirname_result"
7209 if test "X$dir" = X.; then
7210 objdir="$origobjdir"
7212 objdir="$dir/$origobjdir"
7214 func_basename "$file"
7215 name="$func_basename_result"
7216 test "$mode" = uninstall && objdir="$dir"
7218 # Remember objdir for removal later, being careful to avoid duplicates
7219 if test "$mode" = clean; then
7222 *) rmdirs="$rmdirs $objdir" ;;
7226 # Don't error if the file doesn't exist and rm -f was used.
7227 if { test -L "$file"; } >/dev/null 2>&1 ||
7228 { test -h "$file"; } >/dev/null 2>&1 ||
7229 test -f "$file"; then
7231 elif test -d "$file"; then
7234 elif test "$rmforce" = yes; then
7242 # Possibly a libtool archive, so verify it.
7243 if func_lalib_p "$file"; then
7244 func_source $dir/$name
7246 # Delete the libtool libraries and symlinks.
7247 for n in $library_names; do
7248 rmfiles="$rmfiles $objdir/$n"
7250 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
7254 case " $library_names " in
7255 # " " in the beginning catches empty $dlname
7257 *) rmfiles="$rmfiles $objdir/$dlname" ;;
7259 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
7262 if test -n "$library_names"; then
7263 # Do each command in the postuninstall commands.
7264 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
7267 if test -n "$old_library"; then
7268 # Do each command in the old_postuninstall commands.
7269 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
7271 # FIXME: should reinstall the best remaining shared library.
7278 # Possibly a libtool object, so verify it.
7279 if func_lalib_p "$file"; then
7282 func_source $dir/$name
7284 # Add PIC object to the list of files to remove.
7285 if test -n "$pic_object" &&
7286 test "$pic_object" != none; then
7287 rmfiles="$rmfiles $dir/$pic_object"
7290 # Add non-PIC object to the list of files to remove.
7291 if test -n "$non_pic_object" &&
7292 test "$non_pic_object" != none; then
7293 rmfiles="$rmfiles $dir/$non_pic_object"
7299 if test "$mode" = clean ; then
7303 func_stripname '' '.exe' "$file"
7304 file=$func_stripname_result
7305 func_stripname '' '.exe' "$name"
7306 noexename=$func_stripname_result
7307 # $file with .exe has already been added to rmfiles,
7308 # add $file without .exe
7309 rmfiles="$rmfiles $file"
7312 # Do a test to see if this is a libtool program.
7313 if func_ltwrapper_p "$file"; then
7315 func_source $dir/$noexename
7317 # note $name still contains .exe if it was in $file originally
7318 # as does the version of $file that was added into $rmfiles
7319 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
7320 if test "$fast_install" = yes && test -n "$relink_command"; then
7321 rmfiles="$rmfiles $objdir/lt-$name"
7323 if test "X$noexename" != "X$name" ; then
7324 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
7330 func_show_eval "$RM $rmfiles" 'exit_status=1'
7332 objdir="$origobjdir"
7334 # Try to remove the ${objdir}s in the directories where we deleted files
7335 for dir in $rmdirs; do
7336 if test -d "$dir"; then
7337 func_show_eval "rmdir $dir >/dev/null 2>&1"
7344 { test "$mode" = uninstall || test "$mode" = clean; } &&
7345 func_mode_uninstall ${1+"$@"}
7347 test -z "$mode" && {
7348 help="$generic_help"
7349 func_fatal_help "you must specify a MODE"
7352 test -z "$exec_cmd" && \
7353 func_fatal_help "invalid operation mode \`$mode'"
7355 if test -n "$exec_cmd"; then
7356 eval exec "$exec_cmd"
7363 # The TAGs below are defined such that we never get into a situation
7364 # in which we disable both kinds of libraries. Given conflicting
7365 # choices, we go for a static library, that is the most portable,
7366 # since we can't tell whether shared libraries were disabled because
7367 # the user asked for that or because the platform doesn't support
7368 # them. This is particularly important on AIX, because we don't
7369 # support having both static and shared libraries enabled at the same
7370 # time on that platform, so we default to a shared-only configuration.
7371 # If a disable-shared tag is given, we'll fallback to a static-only
7372 # configuration. But we'll never go from static-only to shared-only.
7374 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
7375 build_libtool_libs=no
7377 # ### END LIBTOOL TAG CONFIG: disable-shared
7379 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
7380 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
7381 # ### END LIBTOOL TAG CONFIG: disable-static