1 # Generated from ltmain.m4sh; do not edit by hand
3 # ltmain.sh (GNU libtool 1.2316 2006/08/03 14:06:35) 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
7 # Free Software Foundation, Inc.
8 # This is free software; see the source for copying conditions. There is NO
9 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 # General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 # As a special exception to the GNU General Public License, if you
26 # distribute this file as part of a program that contains a
27 # configuration script generated by Autoconf, you may include it under
28 # the same distribution terms that you use for the rest of that program.
30 # Usage: $progname [OPTION]... [MODE-ARG]...
32 # Provide generalized library-building support services.
34 # --config show all configuration variables
35 # --debug enable verbose shell tracing
36 # -n, --dry-run display commands without modifying any files
37 # --features display basic configuration information and exit
38 # --mode=MODE use operation mode MODE
39 # --preserve-dup-deps don't remove duplicate dependency libraries
40 # --quiet, --silent don't print informational messages
41 # --tag=TAG use configuration variables from tag TAG
42 # -v, --verbose print informational messages (default)
43 # --version print version information
44 # -h, --help print short or long help message
46 # MODE must be one of the following:
48 # clean remove files from the build directory
49 # compile compile a source file into a libtool object
50 # execute automatically set library path, then run a program
51 # finish complete the installation of libtool libraries
52 # install install libraries or executables
53 # link create a library or an executable
54 # uninstall remove libraries from an installed directory
56 # MODE-ARGS vary depending on the MODE.
57 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
59 # When reporting a bug, please describe a test case to reproduce it and
60 # include the following information:
65 # compiler flags: $LTCFLAGS
66 # linker: $LD (gnu? $with_gnu_ld)
67 # $progname: (GNU libtool 1.2316 2006/08/03 14:06:35) 2.1a
68 # automake: $automake_version
69 # autoconf: $autoconf_version
71 # Report bugs to <bug-libtool@gnu.org>.
76 TIMESTAMP=" 1.2316 2006/08/03 14:06:35"
77 package_revision=1.2316
79 # Be Bourne compatible
80 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
83 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
84 # is contrary to our usage. Disable this feature.
85 alias -g '${1+"$@"}'='"$@"'
88 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
90 BIN_SH=xpg4; export BIN_SH # for Tru64
91 DUALCASE=1; export DUALCASE # for MKS sh
93 # NLS nuisances: We save the old values to restore during execute mode.
94 # Only set LANG and LC_ALL to C if already set.
95 # These must not be set unconditionally because not all systems understand
96 # e.g. LANG=C (notably SCO).
97 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
99 eval "if test \"\${$lt_var+set}\" = set; then
100 save_$lt_var=\$$lt_var
120 : ${SED="/usr/bin/sed"}
121 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
122 : ${Xsed="$SED -e 1s/^X//"}
127 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
128 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
130 exit_status=$EXIT_SUCCESS
132 # Make sure IFS has a sensible default
137 dirname="s,/[^/]*$,,"
140 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
141 # is ksh but when the shell is invoked as "sh" and the current value of
142 # the _XPG environment variable is not equal to 1 (one), the special
143 # positional parameter $0, within a function call, is the name of the
147 # The name of this program:
148 # In the unlikely event $progname began with a '-', it would play havoc with
149 # func_echo (imagine progname=-n), so we prepend ./ in that case:
150 progname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'`
152 # Make sure we have an absolute path for reexecution:
154 [\\/]*|[A-Za-z]:\\*) ;;
156 progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"`
157 progdir=`cd "$progdir" && pwd`
158 progpath="$progdir/$progname"
163 for progdir in $PATH; do
165 test -x "$progdir/$progname" && break
168 test -n "$progdir" || progdir=`pwd`
169 progpath="$progdir/$progname"
173 # Sed substitution that helps us do robust quoting. It backslashifies
174 # metacharacters that are still active within double-quoted strings.
175 Xsed="${SED}"' -e 1s/^X//'
176 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
178 # Same as above, but do not quote variable references.
179 double_quote_subst='s/\(["`\\]\)/\\\1/g'
181 # Re-`\' parameter expansions in output of double_quote_subst that were
182 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
183 # in input to double_quote_subst, that '$' was protected from expansion.
184 # Since each input `\' is now two `\'s, look for any number of runs of
185 # four `\'s followed by two `\'s and then a '$'. `\' that '$'. Note
186 # that the embedded single quotes serve only to enhance readability.
187 sed_double_backslash='s/^\(\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/;
188 s/\([^\\]\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/g'
197 # Echo program name prefixed message, along with the current mode
198 # name if it has been set yet.
201 $ECHO "$progname${mode+: }$mode: "${1+"$@"}
204 # func_verbose arg...
205 # Echo program name prefixed message in verbose mode only.
208 $opt_verbose && func_echo ${1+"$@"}
210 # A bug in bash halts the script if the last line of a function
211 # fails when set -e is in force, so we need another command to
217 # Echo program name prefixed message to standard error.
220 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
223 # func_warning arg...
224 # Echo program name prefixed warning message to standard error.
227 $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
230 # func_fatal_error arg...
231 # Echo program name prefixed message to standard error, and exit.
238 # func_fatal_help arg...
239 # Echo program name prefixed message to standard error, followed by
240 # a help hint, and exit.
244 func_fatal_error "$help"
246 help="Try \`$progname --help' for more information." ## default
249 # func_grep expression filename
250 # Check whether EXPRESSION matches any line of FILENAME, without output.
253 $GREP "$1" "$2" >/dev/null 2>&1
257 # func_mkdir_p directory-path
258 # Make sure the entire path to DIRECTORY-PATH is available.
261 my_directory_path="$1"
264 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
266 # Protect directory names starting with `-'
267 case $my_directory_path in
268 -*) my_directory_path="./$my_directory_path" ;;
271 # While some portion of DIR does not yet exist...
272 while test ! -d "$my_directory_path"; do
273 # ...make a list in topmost first order. Use a colon delimited
274 # list incase some portion of path contains whitespace.
275 my_dir_list="$my_directory_path:$my_dir_list"
277 # If the last portion added has no slash in it, the list is done
278 case $my_directory_path in */*) ;; *) break ;; esac
280 # ...otherwise throw away the child directory and loop
281 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
283 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
285 save_mkdir_p_IFS="$IFS"; IFS=':'
286 for my_dir in $my_dir_list; do
287 IFS="$save_mkdir_p_IFS"
288 # mkdir can fail with a `File exist' error if two processes
289 # try to create one of the directories concurrently. Don't
291 $MKDIR "$my_dir" 2>/dev/null || :
293 IFS="$save_mkdir_p_IFS"
295 # Bail out if we (or some other process) failed to create a directory.
296 test -d "$my_directory_path" || \
297 func_fatal_error "Failed to create \`$1'"
302 # func_mktempdir [string]
303 # Make a temporary directory that won't clash with other running
304 # libtool processes, and avoids race conditions if possible. If
305 # given, STRING is the basename for that directory.
308 my_template="${TMPDIR-/tmp}/${1-$progname}"
310 if test "$opt_dry_run" = ":"; then
311 # Return a directory name, but don't create it in dry-run mode
312 my_tmpdir="${my_template}-$$"
315 # If mktemp works, use that first and foremost
316 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
318 if test ! -d "$my_tmpdir"; then
319 # Failing that, at least try and use $RANDOM to avoid a race
320 my_tmpdir="${my_template}-${RANDOM-0}$$"
322 save_mktempdir_umask=`umask`
325 umask $save_mktempdir_umask
328 # If we're not in dry-run mode, bomb out on failure
329 test -d "$my_tmpdir" || \
330 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
333 $ECHO "X$my_tmpdir" | $Xsed
337 # func_quote_for_eval arg
338 # Aesthetically quote ARG to be evaled later.
339 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
340 # is double-quoted, suitable for a subsequent eval, whereas
341 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
342 # which are still active within double quotes backslashified.
343 func_quote_for_eval ()
347 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
349 func_quote_for_eval_unquoted_result="$1" ;;
352 case $func_quote_for_eval_unquoted_result in
353 # Double-quote args containing shell metacharacters to delay
354 # word splitting, command substitution and and variable
355 # expansion for a subsequent eval.
356 # Many Bourne shells cannot handle close brackets correctly
357 # in scan sets, so we specify it separately.
358 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
359 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
362 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
367 # func_quote_for_expand arg
368 # Aesthetically quote ARG to be evaled later; same as above,
369 # but do not quote variable references.
370 func_quote_for_expand ()
374 my_arg=`$ECHO "X$1" | $Xsed \
375 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
381 # Double-quote args containing shell metacharacters to delay
382 # word splitting and command substitution for a subsequent eval.
383 # Many Bourne shells cannot handle close brackets correctly
384 # in scan sets, so we specify it separately.
385 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
390 func_quote_for_expand_result="$my_arg"
394 # func_show_eval cmd [fail_exp]
395 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
396 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
397 # is given, then evaluate it.
403 ${opt_silent-false} || {
404 func_quote_for_expand "$my_cmd"
405 eval "func_echo $func_quote_for_expand_result"
408 if ${opt_dry_run-false}; then :; else
411 if test "$my_status" -eq 0; then :; else
412 eval "(exit $my_status); $my_fail_exp"
419 # Echo version message to standard output and exit.
422 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
425 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
432 # Echo short help message to standard output and exit.
435 $SED -n '/^# Usage:/,/# -h/ {
438 s/\$progname/'$progname'/
442 $ECHO "run \`$progname --help | more' for full usage"
447 # Echo long help message to standard output and exit.
450 $SED -n '/^# Usage:/,/# Report bugs to/ {
453 s*\$progname*'$progname'*
455 s*\$SHELL*'"$SHELL"'*
457 s*\$LTCFLAGS*'"$LTCFLAGS"'*
459 s/\$with_gnu_ld/'"$with_gnu_ld"'/
460 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
461 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
467 # func_missing_arg argname
468 # Echo program name prefixed message to standard error and set global
472 func_error "missing argument for $1"
479 # Check that we have a working $ECHO.
480 if test "X$1" = X--no-reexec; then
481 # Discard the --no-reexec flag, and continue.
483 elif test "X$1" = X--fallback-echo; then
484 # Avoid inline document here, it may be left over
486 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
487 # Yippee, $ECHO works!
490 # Restart under the correct shell, and then maybe $ECHO will work.
491 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
494 if test "X$1" = X--fallback-echo; then
495 # used as fallback echo
503 magic="%%%MAGIC variable%%%"
511 lo2o="s/\\.lo\$/.${objext}/"
512 o2lo="s/\\.${objext}\$/.lo/"
517 opt_duplicate_deps=false
521 # If this variable is set in any of the actions, the command in it
522 # will be execed at the end. This prevents here-documents from being
523 # left over by shells.
526 # func_fatal_configuration arg...
527 # Echo program name prefixed message to standard error, followed by
528 # a configuration failure hint, and exit.
529 func_fatal_configuration ()
532 func_error "See the $PACKAGE documentation for more information."
533 func_fatal_error "Fatal configuration error."
538 # Display the configuration for all the tags in this script.
541 re_begincf='^# ### BEGIN LIBTOOL'
542 re_endcf='^# ### END LIBTOOL'
544 # Default configuration.
545 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
547 # Now print the configurations for the tags.
548 for tagname in $taglist; do
549 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
556 # Display the features supported by this script.
560 if test "$build_libtool_libs" = yes; then
561 $ECHO "enable shared libraries"
563 $ECHO "disable shared libraries"
565 if test "$build_old_libs" = yes; then
566 $ECHO "enable static libraries"
568 $ECHO "disable static libraries"
574 # func_enable_tag tagname
575 # Verify that TAGNAME is valid, and either flag an error and exit, or
576 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
583 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
584 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
585 sed_extractcf="/$re_begincf/,/$re_endcf/p"
590 func_fatal_error "invalid tag name: $tagname"
594 # Don't test for the "default" C tag, as we know it's
595 # there but not specially marked.
599 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
600 taglist="$taglist $tagname"
602 # Evaluate the configuration. Be careful to quote the path
603 # and the sed script, to avoid splitting on whitespace, but
604 # also don't use non-portable quotes within backquotes within
605 # quotes we have to do it in 2 steps:
606 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
609 func_error "ignoring unknown tag $tagname"
618 # We need to display help for each of the modes.
621 # Generic help is extracted from the usage comments
622 # at the start of this file.
628 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
630 Remove files from the build directory.
632 RM is the name of the program to use to delete files associated with each FILE
633 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
636 If FILE is a libtool library, object or program, all the files associated
637 with it are deleted. Otherwise, only FILE itself is deleted using RM."
642 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
644 Compile a source file into a libtool library object.
646 This mode accepts the following additional options:
648 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
649 -no-suppress do not suppress compiler output for multiple passes
650 -prefer-pic try to building PIC objects only
651 -prefer-non-pic try to building non-PIC objects only
652 -shared do not build a \`.o' file suitable for static linking
653 -static only build a \`.o' file suitable for static linking
655 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
656 from the given SOURCEFILE.
658 The output file name is determined by removing the directory component from
659 SOURCEFILE, then substituting the C source code suffix \`.c' with the
660 library object suffix, \`.lo'."
665 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
667 Automatically set library path, then run a program.
669 This mode accepts the following additional options:
671 -dlopen FILE add the directory containing FILE to the library path
673 This mode sets the library path environment variable according to \`-dlopen'
676 If any of the ARGS are libtool executable wrappers, then they are translated
677 into their corresponding uninstalled binary, and any of their required library
678 directories are added to the library path.
680 Then, COMMAND is executed, with ARGS as arguments."
685 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
687 Complete the installation of libtool libraries.
689 Each LIBDIR is a directory that contains libtool libraries.
691 The commands that this mode executes may require superuser privileges. Use
692 the \`--dry-run' option if you just want to see what would be executed."
697 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
699 Install executables or libraries.
701 INSTALL-COMMAND is the installation command. The first component should be
702 either the \`install' or \`cp' program.
704 The following components of INSTALL-COMMAND are treated specially:
706 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
708 The rest of the components are interpreted as arguments to that command (only
709 BSD-compatible install options are recognized)."
714 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
716 Link object files or libraries together to form another library, or to
717 create an executable program.
719 LINK-COMMAND is a command using the C compiler that you would use to create
720 a program from several object files.
722 The following components of LINK-COMMAND are treated specially:
724 -all-static do not do any dynamic linking at all
725 -avoid-version do not add a version suffix if possible
726 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
727 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
728 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
729 -export-symbols SYMFILE
730 try to export only the symbols listed in SYMFILE
731 -export-symbols-regex REGEX
732 try to export only the symbols matching REGEX
733 -LLIBDIR search LIBDIR for required installed libraries
734 -lNAME OUTPUT-FILE requires the installed library libNAME
735 -module build a library that can dlopened
736 -no-fast-install disable the fast-install mode
737 -no-install link a not-installable executable
738 -no-undefined declare that a library does not refer to external symbols
739 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
740 -objectlist FILE Use a list of object files found in FILE to specify objects
741 -precious-files-regex REGEX
742 don't remove output files matching REGEX
743 -release RELEASE specify package release information
744 -rpath LIBDIR the created library will eventually be installed in LIBDIR
745 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
746 -shared only do dynamic linking of libtool libraries
747 -shrext SUFFIX override the standard shared library file extension
748 -static do not do any dynamic linking of uninstalled libtool libraries
750 do not do any dynamic linking of libtool libraries
751 -version-info CURRENT[:REVISION[:AGE]]
752 specify library version info [each variable defaults to 0]
753 -weak LIBNAME declare that the target provides the LIBNAME interface
755 All other options (arguments beginning with \`-') are ignored.
757 Every other argument is treated as a filename. Files ending in \`.la' are
758 treated as uninstalled libtool libraries, other files are standard or library
761 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
762 only library objects (\`.lo' files) may be specified, and \`-rpath' is
763 required, except when creating a convenience library.
765 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
766 using \`ar' and \`ranlib', or on Windows using \`lib'.
768 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
769 is created, otherwise an executable program is created."
774 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
776 Remove libraries from an installation directory.
778 RM is the name of the program to use to delete files associated with each FILE
779 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
782 If FILE is a libtool library, all the files associated with it are deleted.
783 Otherwise, only FILE itself is deleted using RM."
787 func_fatal_help "invalid operation mode \`$mode'"
792 $ECHO "Try \`$progname --help' for more information about other modes."
797 # TEST SUITE MARKER ## NON-FUNCTION
798 # Parse options once, thoroughly. This comes as soon as possible in
799 # the script to make things like `libtool --version' happen quickly.
802 my_sed_single_opt='1s/^\(..\).*$/\1/;q'
803 my_sed_single_rest='1s/^..\(.*\)$/\1/;q'
804 my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
805 my_sed_long_arg='1s/^-[^=]*=//'
807 # Shorthand for --mode=foo, only valid as the first argument
810 shift; set dummy --mode clean ${1+"$@"}; shift
812 compile|compil|compi|comp|com|co|c)
813 shift; set dummy --mode compile ${1+"$@"}; shift
815 execute|execut|execu|exec|exe|ex|e)
816 shift; set dummy --mode execute ${1+"$@"}; shift
818 finish|finis|fini|fin|fi|f)
819 shift; set dummy --mode finish ${1+"$@"}; shift
821 install|instal|insta|inst|ins|in|i)
822 shift; set dummy --mode install ${1+"$@"}; shift
825 shift; set dummy --mode link ${1+"$@"}; shift
827 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
828 shift; set dummy --mode uninstall ${1+"$@"}; shift
832 # Parse non-mode specific arguments:
833 while test "$#" -gt 0; do
838 --config) func_config ;;
840 --debug) preserve_args="$preserve_args $opt"
841 func_echo "enabling shell trace mode"
846 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
847 execute_dlfiles="$execute_dlfiles $1"
851 --dry-run | -n) opt_dry_run=: ;;
852 --features) func_features ;;
853 --finish) mode="finish" ;;
855 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
857 # Valid mode arguments:
867 # Catch anything else as an error
868 *) func_error "invalid argument for $opt"
879 opt_duplicate_deps=: ;;
881 --quiet|--silent) preserve_args="$preserve_args $opt"
885 --verbose| -v) preserve_args="$preserve_args $opt"
889 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
890 preserve_args="$preserve_args $opt $1"
891 func_enable_tag "$1" # tagname is set here
895 # Separate optargs to long options:
896 -dlopen=*|--mode=*|--tag=*)
897 arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"`
898 opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"`
899 set dummy "$opt" "$arg" ${1+"$@"}
903 # Separate optargs to short options:
905 # arg=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`
906 # opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`
907 # set dummy "$opt" "$arg" ${1+"$@"}
911 # Separate non-argument short options:
913 # rest=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`
914 # opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`
915 # set dummy "$opt" "-$rest" ${1+"$@"}
919 -\?|-h) func_usage ;;
920 --help) opt_help=: ;;
921 --version) func_version ;;
923 -*) func_fatal_help "unrecognized option \`$opt'" ;;
931 # Now that we've collected a possible --mode arg, show help if necessary
932 $opt_help && func_mode_help
935 *cygwin* | *mingw* | *pw32*)
936 # don't eliminate duplications in $postdeps and $predeps
937 opt_duplicate_compiler_generated_deps=:
940 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
944 # Having warned about all mis-specified options, bail out if
945 # anything was wrong.
946 $exit_cmd $EXIT_FAILURE
948 # TEST SUITE MARKER ## BEGIN SOURCABLE
950 # func_check_version_match
951 # Ensure that we are using m4 macros, and libtool script from the same
952 # release of libtool.
953 func_check_version_match ()
955 if test "$package_revision" != "$macro_revision"; then
956 if test "$VERSION" != "$macro_version"; then
957 if test -z "$macro_version"; then
959 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
960 $progname: definition of this LT_INIT comes from an older release.
961 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
962 $progname: and run autoconf again.
966 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
967 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
968 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
969 $progname: and run autoconf again.
974 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
975 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
976 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
977 $progname: of $PACKAGE $VERSION and run autoconf again.
987 # True iff FILE is a libtool `.la' library or `.lo' object file.
988 # This function is only a basic sanity check; it will hardly flush out
989 # determined imposters.
992 $SED -e 4q "$1" 2>/dev/null \
993 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
996 # func_lalib_unsafe_p file
997 # True iff FILE is a libtool `.la' library or `.lo' object file.
998 # This function implements the same check as func_lalib_p without
999 # resorting to external programs. To this end, it redirects stdin and
1000 # closes it afterwards, without saving the original file descriptor.
1001 # As a safety measure, use it only where a negative result would be
1002 # fatal anyway. Works if `file' does not exist.
1003 func_lalib_unsafe_p ()
1006 if test -r "$1" && exec 5<&1 <"$1"; then
1007 for lalib_p_l in 1 2 3 4
1010 case "$lalib_p_line" in
1011 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1016 test "$lalib_p" = yes
1019 # func_ltwrapper_p file
1020 # True iff FILE is a libtool wrapper script.
1021 # This function is only a basic sanity check; it will hardly flush out
1022 # determined imposters.
1029 # func_execute_cmds commands fail_cmd
1030 # Execute tilde-delimited COMMANDS.
1031 # If FAIL_CMD is given, eval that upon failure.
1032 # FAIL_CMD may read-access the current command in variable CMD!
1033 func_execute_cmds ()
1036 save_ifs=$IFS; IFS='~'
1040 func_show_eval "$cmd" "${2-:}"
1047 # Source FILE, adding directory component if necessary.
1048 # Note that it is not necessary on cygwin/mingw to append a dot to
1049 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1050 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1051 # `FILE.' does not work on cygwin managed mounts.
1056 */* | *\\*) . "$1" ;;
1062 # Generated shell functions inserted here.
1065 # func_win32_libid arg
1066 # return the library type of file 'arg'
1068 # Need a lot of goo to handle *both* DLLs and import libs
1069 # Has to be a shell function in order to 'eat' the argument
1070 # that is supplied when $file_magic_command is called.
1074 win32_libid_type="unknown"
1075 win32_fileres=`file -L $1 2>/dev/null`
1076 case $win32_fileres in
1077 *ar\ archive\ import\ library*) # definitely import
1078 win32_libid_type="x86 archive import"
1080 *ar\ archive*) # could be an import, or static
1081 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
1082 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1083 win32_nmres=`eval $NM -f posix -A $1 |
1092 case $win32_nmres in
1093 import*) win32_libid_type="x86 archive import";;
1094 *) win32_libid_type="x86 archive static";;
1099 win32_libid_type="x86 DLL"
1101 *executable*) # but shell scripts are "executable" too...
1102 case $win32_fileres in
1103 *MS\ Windows\ PE\ Intel*)
1104 win32_libid_type="x86 DLL"
1109 $ECHO "$win32_libid_type"
1114 # func_infer_tag arg
1115 # Infer tagged configuration to use if any are available and
1116 # if one wasn't chosen via the "--tag" command line option.
1117 # Only attempt this if the compiler in the base compile
1118 # command doesn't match the default compiler.
1119 # arg is usually of the form 'gcc ...'
1123 if test -n "$available_tags" && test -z "$tagname"; then
1126 func_quote_for_eval "$arg"
1127 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1130 # Blanks in the command may have been stripped by the calling shell,
1131 # but not from the CC environment variable when configure was run.
1132 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1133 # Blanks at the start of $base_compile will cause this to fail
1134 # if we don't check for them as well.
1136 for z in $available_tags; do
1137 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1138 # Evaluate the configuration.
1139 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1142 # Double-quote args containing other shell metacharacters.
1143 func_quote_for_eval "$arg"
1144 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1147 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1148 # The compiler in the base compile command matches
1149 # the one in the tagged configuration.
1150 # Assume this is the tagged configuration we want.
1157 # If $tagname still isn't set, then no tagged configuration
1158 # was found and let the user know that the "--tag" command
1159 # line option must be used.
1160 if test -z "$tagname"; then
1161 func_echo "unable to infer tagged configuration"
1162 func_fatal_error "specify a tag with \`--tag'"
1164 # func_verbose "using $tagname tagged configuration"
1173 # func_generate_dlsyms outputname originator pic_p
1174 # Extract symbols from dlprefiles and create ${outputname}S.o with
1175 # a dlpreopen symbol table.
1176 func_generate_dlsyms ()
1182 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
1185 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1186 if test -n "$NM" && test -n "$global_symbol_pipe"; then
1187 my_dlsyms="${my_outputname}S.c"
1189 func_error "not configured to extract global symbols from dlpreopened files"
1193 if test -n "$my_dlsyms"; then
1197 # Discover the nlist of each of the dlfiles.
1198 nlist="$output_objdir/${my_outputname}.nm"
1200 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
1202 # Parse the name list into a source file.
1203 func_echo "creating $output_objdir/$my_dlsyms"
1205 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
1206 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
1207 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
1213 /* External symbol declarations for the compiler. */\
1216 if test "$dlself" = yes; then
1217 func_echo "generating symbol list for \`$output'"
1219 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
1221 # Add our own program objects to the symbol list.
1222 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1223 for progfile in $progfiles; do
1224 func_echo "extracting global C symbols from \`$progfile'"
1225 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
1228 if test -n "$exclude_expsyms"; then
1230 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
1231 eval '$MV "$nlist"T "$nlist"'
1235 if test -n "$export_symbols_regex"; then
1237 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
1238 eval '$MV "$nlist"T "$nlist"'
1242 # Prepare the list of exported symbols
1243 if test -z "$export_symbols"; then
1244 export_symbols="$output_objdir/$outputname.exp"
1247 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
1249 *cygwin* | *mingw* )
1250 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1251 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
1257 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
1258 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
1259 eval '$MV "$nlist"T "$nlist"'
1262 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1263 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
1270 for dlprefile in $dlprefiles; do
1271 func_echo "extracting global C symbols from \`$dlprefile'"
1272 func_basename "$dlprefile"
1273 name="$func_basename_result"
1275 eval '$ECHO ": $name " >> "$nlist"'
1276 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
1281 # Make sure we have at least an empty file.
1282 test -f "$nlist" || : > "$nlist"
1284 if test -n "$exclude_expsyms"; then
1285 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
1286 $MV "$nlist"T "$nlist"
1289 # Try sorting and uniquifying the output.
1290 if $GREP -v "^: " < "$nlist" |
1291 if sort -k 3 </dev/null >/dev/null 2>&1; then
1296 uniq > "$nlist"S; then
1299 $GREP -v "^: " < "$nlist" > "$nlist"S
1302 if test -f "$nlist"S; then
1303 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
1305 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
1308 $ECHO >> "$output_objdir/$my_dlsyms" "\
1310 /* The mapping between symbol names and symbols. */
1313 *cygwin* | *mingw* )
1314 $ECHO >> "$output_objdir/$my_dlsyms" "\
1315 /* DATA imports from DLLs on WIN32 con't be const, because
1316 runtime relocations are performed -- see ld's documentation
1317 on pseudo-relocs. */
1322 $ECHO >> "$output_objdir/$my_dlsyms" "\
1328 $ECHO >> "$output_objdir/$my_dlsyms" "\
1332 lt_${my_prefix}_LTX_preloaded_symbols[] =
1334 { \"$my_originator\", (void *) 0 },
1337 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
1339 $ECHO >> "$output_objdir/$my_dlsyms" "\
1343 /* This works around a problem in FreeBSD linker */
1344 #ifdef FREEBSD_WORKAROUND
1345 static const void *lt_preloaded_setup() {
1346 return lt_${my_prefix}_LTX_preloaded_symbols;
1356 pic_flag_for_symtable=
1357 case "$compile_command " in
1361 # compiling the symbol table file with pic_flag works around
1362 # a FreeBSD bug that causes programs to crash when -lm is
1363 # linked before any other PIC object. But we must not use
1364 # pic_flag when linking with -static. The problem exists in
1365 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
1366 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
1367 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
1369 pic_flag_for_symtable=" $pic_flag" ;;
1371 if test "X$my_pic_p" != Xno; then
1372 pic_flag_for_symtable=" $pic_flag"
1379 for arg in $LTCFLAGS; do
1381 -pie | -fpie | -fPIE) ;;
1382 *) symtab_cflags="$symtab_cflags $arg" ;;
1386 # Now compile the dynamic symbol file.
1387 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
1389 # Clean up the generated files.
1390 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
1392 # Transform the symbol file into the correct name.
1393 symfileobj="$output_objdir/${my_outputname}S.$objext"
1395 *cygwin* | *mingw* )
1396 if test -f "$output_objdir/$my_outputname.def"; then
1397 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1398 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1400 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1401 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1405 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1406 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1411 func_fatal_error "unknown suffix for \`$my_dlsyms'"
1415 # We keep going just in case the user didn't refer to
1416 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
1417 # really was required.
1419 # Nullify the symbol file.
1420 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1421 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1425 # func_extract_an_archive dir oldlib
1426 func_extract_an_archive ()
1429 f_ex_an_ar_dir="$1"; shift
1430 f_ex_an_ar_oldlib="$1"
1431 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" 'exit $?'
1432 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
1435 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
1440 # func_extract_archives gentop oldlib ...
1441 func_extract_archives ()
1444 my_gentop="$1"; shift
1445 my_oldlibs=${1+"$@"}
1451 for my_xlib in $my_oldlibs; do
1452 # Extract the objects.
1454 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
1455 *) my_xabs=`pwd`"/$my_xlib" ;;
1457 func_basename "$my_xlib"
1458 my_xlib="$func_basename_result"
1461 case " $extracted_archives " in
1463 extracted_serial=`expr $extracted_serial + 1`
1464 my_xlib_u=lt$extracted_serial-$my_xlib ;;
1468 extracted_archives="$extracted_archives $my_xlib_u"
1469 my_xdir="$my_gentop/$my_xlib_u"
1471 func_mkdir_p "$my_xdir"
1475 func_echo "Extracting $my_xabs"
1476 # Do not bother doing anything if just a dry run
1478 darwin_orig_dir=`pwd`
1479 cd $my_xdir || exit $?
1480 darwin_archive=$my_xabs
1482 darwin_base_archive=`basename $darwin_archive`
1483 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
1484 if test -n "$darwin_arches"; then
1485 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
1487 func_echo "$darwin_base_archive has multiple architectures $darwin_arches"
1488 for darwin_arch in $darwin_arches ; do
1489 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1490 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
1491 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1492 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
1494 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
1495 done # $darwin_arches
1496 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
1497 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
1500 for darwin_file in $darwin_filelist; do
1501 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
1502 lipo -create -output "$darwin_file" $darwin_files
1503 done # $darwin_filelist
1505 cd "$darwin_orig_dir"
1508 func_extract_an_archive "$my_xdir" "$my_xabs"
1513 func_extract_an_archive "$my_xdir" "$my_xabs"
1516 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
1519 func_extract_archives_result="$my_oldobjs"
1524 # func_write_libtool_object output_name pic_name nonpic_name
1525 # Create a libtool object file (analogous to a ".la" file),
1526 # but don't create it if we're doing a dry run.
1527 func_write_libtool_object ()
1530 if test "$build_libtool_libs" = yes; then
1536 if test "$build_old_libs" = yes; then
1537 write_oldobj=\'${3}\'
1543 cat >${write_libobj}T <<EOF
1544 # $write_libobj - a libtool object file
1545 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1547 # Please DO NOT delete this file!
1548 # It is necessary for linking the library.
1550 # Name of the PIC object.
1551 pic_object=$write_lobj
1553 # Name of the non-PIC object
1554 non_pic_object=$write_oldobj
1557 mv -f "${write_libobj}T" "${write_libobj}"
1561 # func_mode_compile arg...
1562 func_mode_compile ()
1565 # Get the compilation command and the source file.
1567 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1579 # do not "continue". Instead, add this to base_compile
1591 # Accept any command-line options.
1594 test -n "$libobj" && \
1595 func_fatal_error "you cannot specify \`-o' more than once"
1600 -pie | -fpie | -fPIE)
1601 pie_flag="$pie_flag $arg"
1605 -shared | -static | -prefer-pic | -prefer-non-pic)
1616 arg_mode=arg # the next one goes into the "base_compile" arg list
1617 continue # The current "srcfile" will either be retained or
1618 ;; # replaced later. I would guess that would be a bug.
1621 func_stripname '-Wc,' '' "$arg"
1622 args=$func_stripname_result
1624 save_ifs="$IFS"; IFS=','
1625 for arg in $args; do
1627 func_quote_for_eval "$arg"
1628 lastarg="$lastarg $func_quote_for_eval_result"
1631 func_stripname ' ' '' "$lastarg"
1632 lastarg=$func_stripname_result
1634 # Add the arguments to base_compile.
1635 base_compile="$base_compile $lastarg"
1640 # Accept the current argument as the source file.
1641 # The previous "srcfile" becomes the current argument.
1648 esac # case $arg_mode
1650 # Aesthetically quote the previous argument.
1651 func_quote_for_eval "$lastarg"
1652 base_compile="$base_compile $func_quote_for_eval_result"
1657 func_fatal_error "you must specify an argument for -Xcompile"
1660 func_fatal_error "you must specify a target with \`-o'"
1663 # Get the name of the library object.
1664 test -z "$libobj" && {
1665 func_basename "$srcfile"
1666 libobj="$func_basename_result"
1671 # Recognize several different file suffixes.
1672 # If the user specifies -o file.o, it is replaced with file.lo
1682 *.class) xform=class ;;
1687 *.java) xform=java ;;
1691 libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
1694 *.lo) obj=`$ECHO "X$libobj" | $Xsed -e "$lo2o"` ;;
1696 func_fatal_error "cannot determine name of library object from \`$libobj'"
1700 func_infer_tag $base_compile
1702 for arg in $later; do
1705 test "$build_libtool_libs" != yes && \
1706 func_fatal_configuration "can not build a shared library"
1712 build_libtool_libs=no
1729 func_quote_for_eval "$libobj"
1730 test "X$libobj" != "X$func_quote_for_eval_result" \
1731 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1732 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1733 func_basename "$obj"
1734 objname="$func_basename_result"
1735 func_dirname "$obj" "/" ""
1736 xdir="$func_dirname_result"
1737 lobj=${xdir}$objdir/$objname
1739 test -z "$base_compile" && \
1740 func_fatal_help "you must specify a compilation command"
1742 # Delete any leftover library objects.
1743 if test "$build_old_libs" = yes; then
1744 removelist="$obj $lobj $libobj ${libobj}T"
1746 removelist="$lobj $libobj ${libobj}T"
1749 $opt_dry_run || $RM $removelist
1750 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1752 # On Cygwin there's no "real" PIC flag so we must build both object types
1754 cygwin* | mingw* | pw32* | os2*)
1758 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1759 # non-PIC code in shared libraries is not supported
1763 # Calculate the filename of the output object if compiler does
1764 # not support -o with -c
1765 if test "$compiler_c_o" = no; then
1766 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1767 lockfile="$output_obj.lock"
1768 removelist="$removelist $output_obj $lockfile"
1769 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1776 # Lock this critical section if it is needed
1777 # We use this script file to make the link, it avoids creating a new file
1778 if test "$need_locks" = yes; then
1779 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1780 func_echo "Waiting for $lockfile to be removed"
1783 elif test "$need_locks" = warn; then
1784 if test -f "$lockfile"; then
1786 *** ERROR, $lockfile exists and contains:
1787 `cat $lockfile 2>/dev/null`
1789 This indicates that another process is trying to use the same
1790 temporary object file, and libtool could not work around it because
1791 your compiler does not support \`-c' and \`-o' together. If you
1792 repeat this compilation, it may succeed, by chance, but you had better
1793 avoid parallel builds (make -j) in this platform, or get a better
1796 $opt_dry_run || $RM $removelist
1799 $ECHO "$srcfile" > "$lockfile"
1802 if test -n "$fix_srcfile_path"; then
1803 eval srcfile=\"$fix_srcfile_path\"
1805 func_quote_for_eval "$srcfile"
1806 qsrcfile=$func_quote_for_eval_result
1808 $opt_dry_run || $RM "$libobj" "${libobj}T"
1810 # Only build a PIC object if we are building libtool libraries.
1811 if test "$build_libtool_libs" = yes; then
1812 # Without this assignment, base_compile gets emptied.
1813 fbsd_hideous_sh_bug=$base_compile
1815 if test "$pic_mode" != no; then
1816 command="$base_compile $qsrcfile $pic_flag"
1818 # Don't build PIC code
1819 command="$base_compile $qsrcfile"
1822 func_mkdir_p "$xdir$objdir"
1824 if test -z "$output_obj"; then
1825 # Place PIC objects in $objdir
1826 command="$command -o $lobj"
1829 $opt_dry_run || $RM "$lobj" "$output_obj"
1831 func_show_eval "$command" \
1832 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1834 if test "$need_locks" = warn &&
1835 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1837 *** ERROR, $lockfile contains:
1838 `cat $lockfile 2>/dev/null`
1840 but it should contain:
1843 This indicates that another process is trying to use the same
1844 temporary object file, and libtool could not work around it because
1845 your compiler does not support \`-c' and \`-o' together. If you
1846 repeat this compilation, it may succeed, by chance, but you had better
1847 avoid parallel builds (make -j) in this platform, or get a better
1850 $opt_dry_run || $RM $removelist
1854 # Just move the object if needed, then go on to compile the next one
1855 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1856 func_show_eval '$MV "$output_obj" "$lobj"' \
1857 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1860 # Allow error messages only from the first compilation.
1861 if test "$suppress_opt" = yes; then
1862 suppress_output=' >/dev/null 2>&1'
1866 # Only build a position-dependent object if we build old libraries.
1867 if test "$build_old_libs" = yes; then
1868 if test "$pic_mode" != yes; then
1869 # Don't build PIC code
1870 command="$base_compile $qsrcfile$pie_flag"
1872 command="$base_compile $qsrcfile $pic_flag"
1874 if test "$compiler_c_o" = yes; then
1875 command="$command -o $obj"
1878 # Suppress compiler output if we already did a PIC compilation.
1879 command="$command$suppress_output"
1880 $opt_dry_run || $RM "$obj" "$output_obj"
1881 func_show_eval "$command" \
1882 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1884 if test "$need_locks" = warn &&
1885 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1887 *** ERROR, $lockfile contains:
1888 `cat $lockfile 2>/dev/null`
1890 but it should contain:
1893 This indicates that another process is trying to use the same
1894 temporary object file, and libtool could not work around it because
1895 your compiler does not support \`-c' and \`-o' together. If you
1896 repeat this compilation, it may succeed, by chance, but you had better
1897 avoid parallel builds (make -j) in this platform, or get a better
1900 $opt_dry_run || $RM $removelist
1904 # Just move the object if needed
1905 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1906 func_show_eval '$MV "$output_obj" "$obj"' \
1907 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1912 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1914 # Unlock the critical section if it was locked
1915 if test "$need_locks" != no; then
1924 # func_mode_execute arg...
1925 func_mode_execute ()
1928 # The first argument is the command name.
1931 func_fatal_help "you must specify a COMMAND"
1933 # Handle -dlopen flags immediately.
1934 for file in $execute_dlfiles; do
1936 || func_fatal_help "\`$file' is not a file"
1941 # Check to see that this really is a libtool archive.
1942 func_lalib_unsafe_p "$file" \
1943 || func_fatal_help "\`$lib' is not a valid libtool archive"
1945 # Read the libtool library.
1950 # Skip this library if it cannot be dlopened.
1951 if test -z "$dlname"; then
1952 # Warn if it was a shared library.
1953 test -n "$library_names" && \
1954 func_warning "\`$file' was not linked with \`-export-dynamic'"
1958 func_dirname "$file" "" "."
1959 dir="$func_dirname_result"
1961 if test -f "$dir/$objdir/$dlname"; then
1964 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1969 # Just add the directory containing the .lo file.
1970 func_dirname "$file" "" "."
1971 dir="$func_dirname_result"
1975 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1980 # Get the absolute pathname.
1981 absdir=`cd "$dir" && pwd`
1982 test -n "$absdir" && dir="$absdir"
1984 # Now add the directory to shlibpath_var.
1985 if eval "test -z \"\$$shlibpath_var\""; then
1986 eval "$shlibpath_var=\"\$dir\""
1988 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1992 # This variable tells wrapper scripts just to set shlibpath_var
1993 # rather than running their programs.
1994 libtool_execute_magic="$magic"
1996 # Check if any of the arguments is a wrapper script.
2003 # Do a test to see if this is really a libtool program.
2004 if func_ltwrapper_p "$file"; then
2007 # Transform arg to wrapped name.
2008 file="$progdir/$program"
2012 # Quote arguments (to preserve shell metacharacters).
2013 func_quote_for_eval "$file"
2014 args="$args $func_quote_for_eval_result"
2017 if test "X$opt_dry_run" = Xfalse; then
2018 if test -n "$shlibpath_var"; then
2019 # Export the shlibpath_var.
2020 eval "export $shlibpath_var"
2023 # Restore saved environment variables
2024 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2026 eval "if test \"\${save_$lt_var+set}\" = set; then
2027 $lt_var=\$save_$lt_var; export $lt_var
2033 # Now prepare to actually exec the command.
2034 exec_cmd="\$cmd$args"
2036 # Display what would be done.
2037 if test -n "$shlibpath_var"; then
2038 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2039 $ECHO "export $shlibpath_var"
2047 # func_mode_finish arg...
2054 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2057 libdirs="$libdirs $dir"
2060 for libdir in $libdirs; do
2061 if test -n "$finish_cmds"; then
2062 # Do each command in the finish commands.
2063 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2066 if test -n "$finish_eval"; then
2067 # Do the single finish_eval.
2068 eval cmds=\"$finish_eval\"
2069 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2075 # Exit here if they wanted silent mode.
2076 $opt_silent && exit $EXIT_SUCCESS
2078 $ECHO "X----------------------------------------------------------------------" | $Xsed
2079 $ECHO "Libraries have been installed in:"
2080 for libdir in $libdirs; do
2084 $ECHO "If you ever happen to want to link against installed libraries"
2085 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2086 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2087 $ECHO "flag during linking and do at least one of the following:"
2088 if test -n "$shlibpath_var"; then
2089 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2090 $ECHO " during execution"
2092 if test -n "$runpath_var"; then
2093 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2094 $ECHO " during linking"
2096 if test -n "$hardcode_libdir_flag_spec"; then
2098 eval flag=\"$hardcode_libdir_flag_spec\"
2100 $ECHO " - use the \`$flag' linker flag"
2102 if test -n "$admincmds"; then
2103 $ECHO " - have your system administrator run these commands:$admincmds"
2105 if test -f /etc/ld.so.conf; then
2106 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2110 $ECHO "See any operating system documentation about shared libraries for"
2112 solaris2.[6789]|solaris2.1[0-9])
2113 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2117 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2120 $ECHO "X----------------------------------------------------------------------" | $Xsed
2125 # func_mode_install arg...
2126 func_mode_install ()
2129 # There may be an optional sh(1) argument at the beginning of
2130 # install_prog (especially on Windows NT).
2131 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2132 # Allow the use of GNU shtool's install command.
2133 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2134 # Aesthetically quote it.
2135 func_quote_for_eval "$nonopt"
2136 install_prog="$func_quote_for_eval_result "
2144 # The real first argument should be the name of the installation program.
2145 # Aesthetically quote it.
2146 func_quote_for_eval "$arg"
2147 install_prog="$install_prog$func_quote_for_eval_result"
2149 # We need to accept at least all the BSD install flags.
2159 if test -n "$dest"; then
2160 files="$files $dest"
2168 case " $install_prog " in
2183 # If the previous option needed an argument, then skip it.
2184 if test -n "$prev"; then
2193 # Aesthetically quote the argument.
2194 func_quote_for_eval "$arg"
2195 install_prog="$install_prog $func_quote_for_eval_result"
2198 test -z "$install_prog" && \
2199 func_fatal_help "you must specify an install program"
2201 test -n "$prev" && \
2202 func_fatal_help "the \`$prev' option requires an argument"
2204 if test -z "$files"; then
2205 if test -z "$dest"; then
2206 func_fatal_help "no file or destination specified"
2208 func_fatal_help "you must specify a destination"
2212 # Strip any trailing slash from the destination.
2213 func_stripname '' '/' "$dest"
2214 dest=$func_stripname_result
2216 # Check to see that the destination is a directory.
2217 test -d "$dest" && isdir=yes
2218 if test "$isdir" = yes; then
2222 func_dirname "$dest" "" "."
2223 destdir="$func_dirname_result"
2224 func_basename "$dest"
2225 destname="$func_basename_result"
2227 # Not a directory, so check to see that there is only one file specified.
2228 set dummy $files; shift
2229 test "$#" -gt 1 && \
2230 func_fatal_help "\`$dest' is not a directory"
2233 [\\/]* | [A-Za-z]:[\\/]*) ;;
2235 for file in $files; do
2239 func_fatal_help "\`$destdir' must be an absolute directory name"
2246 # This variable tells wrapper scripts just to set variables rather
2247 # than running their programs.
2248 libtool_install_magic="$magic"
2253 for file in $files; do
2255 # Do each installation.
2258 # Do the static libraries later.
2259 staticlibs="$staticlibs $file"
2263 # Check to see that this really is a libtool archive.
2264 func_lalib_unsafe_p "$file" \
2265 || func_fatal_help "\`$file' is not a valid libtool archive"
2272 # Add the libdir to current_libdirs if it is the destination.
2273 if test "X$destdir" = "X$libdir"; then
2274 case "$current_libdirs " in
2276 *) current_libdirs="$current_libdirs $libdir" ;;
2279 # Note the libdir as a future libdir.
2280 case "$future_libdirs " in
2282 *) future_libdirs="$future_libdirs $libdir" ;;
2286 func_dirname "$file" "/" ""
2287 dir="$func_dirname_result"
2290 if test -n "$relink_command"; then
2291 # Determine the prefix the user has applied to our future dir.
2292 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2294 # Don't allow the user to place us outside of our expected
2295 # location b/c this prevents finding dependent libraries that
2296 # are installed to the same prefix.
2297 # At present, this check doesn't affect windows .dll's that
2298 # are installed into $libdir/../bin (currently, that works fine)
2299 # but it's something to keep an eye on.
2300 test "$inst_prefix_dir" = "$destdir" && \
2301 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2303 if test -n "$inst_prefix_dir"; then
2304 # Stick the inst_prefix_dir data into the link command.
2305 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2307 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2310 func_warning "relinking \`$file'"
2311 func_show_eval "$relink_command" \
2312 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2315 # See the names of the shared library.
2316 set dummy $library_names; shift
2317 if test -n "$1"; then
2322 test -n "$relink_command" && srcname="$realname"T
2324 # Install the shared library and build the symlinks.
2325 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2329 cygwin* | mingw* | pw32*)
2337 if test -n "$tstripme" && test -n "$striplib"; then
2338 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2341 if test "$#" -gt 0; then
2342 # Delete the old symlinks, and create new ones.
2343 # Try `ln -sf' first, because the `ln' binary might depend on
2344 # the symlink we replace! Solaris /bin/ln does not understand -f,
2345 # so we also need to try rm && ln -s.
2348 test "$linkname" != "$realname" \
2349 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2353 # Do each command in the postinstall commands.
2354 lib="$destdir/$realname"
2355 func_execute_cmds "$postinstall_cmds" 'exit $?'
2358 # Install the pseudo-library for information purposes.
2359 func_basename "$file"
2360 name="$func_basename_result"
2361 instname="$dir/$name"i
2362 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2364 # Maybe install the static library, too.
2365 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2369 # Install (i.e. copy) a libtool object.
2371 # Figure out destination file name, if it wasn't already specified.
2372 if test -n "$destname"; then
2373 destfile="$destdir/$destname"
2375 func_basename "$file"
2376 destfile="$func_basename_result"
2377 destfile="$destdir/$destfile"
2380 # Deduce the name of the destination old-style object file.
2383 staticdest=`$ECHO "X$destfile" | $Xsed -e "$lo2o"`
2386 staticdest="$destfile"
2390 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2394 # Install the libtool object if requested.
2395 test -n "$destfile" && \
2396 func_show_eval "$install_prog $file $destfile" 'exit $?'
2398 # Install the old object if enabled.
2399 if test "$build_old_libs" = yes; then
2400 # Deduce the name of the old-style object file.
2401 staticobj=`$ECHO "X$file" | $Xsed -e "$lo2o"`
2402 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2408 # Figure out destination file name, if it wasn't already specified.
2409 if test -n "$destname"; then
2410 destfile="$destdir/$destname"
2412 func_basename "$file"
2413 destfile="$func_basename_result"
2414 destfile="$destdir/$destfile"
2417 # If the file is missing, and there is a .exe on the end, strip it
2418 # because it is most likely a libtool script we actually want to
2423 if test ! -f "$file"; then
2424 func_stripname '' '.exe' "$file"
2425 file=$func_stripname_result
2431 # Do a test to see if this is really a libtool program.
2434 func_stripname '' '.exe' "$file"
2435 wrapper=$func_stripname_result
2441 if func_ltwrapper_p "$wrapper"; then
2445 func_source "$wrapper"
2447 # Check the variables that should have been set.
2448 test -z "$generated_by_libtool_version" && \
2449 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2452 for lib in $notinst_deplibs; do
2453 # Check to see that each library is installed.
2455 if test -f "$lib"; then
2458 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2459 if test -n "$libdir" && test ! -f "$libfile"; then
2460 func_warning "\`$lib' has not been installed in \`$libdir'"
2466 func_source "$wrapper"
2469 if test "$fast_install" = no && test -n "$relink_command"; then
2471 if test "$finalize" = yes; then
2472 tmpdir=`func_mktempdir`
2473 func_basename "$file$stripped_ext"
2474 file="$func_basename_result"
2475 outputname="$tmpdir/$file"
2476 # Replace the output file specification.
2477 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2480 func_quote_for_expand "$relink_command"
2481 eval "func_echo $func_quote_for_expand_result"
2483 if eval "$relink_command"; then :
2485 func_error "error: relink \`$file' with the above command before installing it"
2486 $opt_dry_run || ${RM}r "$tmpdir"
2491 func_warning "cannot relink \`$file'"
2495 # Install the binary that we compiled earlier.
2496 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2500 # remove .exe since cygwin /usr/bin/install will append another
2502 case $install_prog,$host in
2503 */usr/bin/install*,*cygwin*)
2504 case $file:$destfile in
2509 destfile=$destfile.exe
2512 func_stripname '' '.exe' "$destfile"
2513 destfile=$func_stripname_result
2518 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2519 $opt_dry_run || if test -n "$outputname"; then
2526 for file in $staticlibs; do
2527 func_basename "$file"
2528 name="$func_basename_result"
2530 # Set up the ranlib parameters.
2531 oldlib="$destdir/$name"
2533 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2535 if test -n "$stripme" && test -n "$old_striplib"; then
2536 func_show_eval "$old_striplib $oldlib" 'exit $?'
2539 # Do each command in the postinstall commands.
2540 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2543 test -n "$future_libdirs" && \
2544 func_warning "remember to run \`$progname --finish$future_libdirs'"
2546 if test -n "$current_libdirs"; then
2547 # Maybe just do a dry run.
2548 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2549 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2556 # func_mode_link arg...
2561 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
2562 # It is impossible to link a dll without this setting, and
2563 # we shouldn't force the makefile maintainer to figure out
2564 # which system we are compiling for in order to pass an extra
2565 # flag for every libtool invocation.
2566 # allow_undefined=no
2568 # FIXME: Unfortunately, there are problems with the above when trying
2569 # to make a dll which has undefined symbols, in which case not
2570 # even a static library is built. For now, we need to specify
2571 # -no-undefined on the libtool link line when we can be certain
2572 # that all symbols are satisfied, otherwise we get a static library.
2579 libtool_args=$nonopt
2580 base_compile="$nonopt $@"
2581 compile_command=$nonopt
2582 finalize_command=$nonopt
2595 lib_search_path=`pwd`
2597 new_inherited_linker_flags=
2605 export_symbols_regex=
2613 precious_files_regex=
2614 prefer_static_libs=no
2627 single_module="${wl}-single_module"
2628 func_infer_tag $base_compile
2630 # We need to know -static, to get the right output filenames.
2635 test "$build_libtool_libs" != yes && \
2636 func_fatal_configuration "can not build a shared library"
2640 -all-static | -static | -static-libtool-libs)
2643 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
2644 func_warning "complete static linking is impossible in this configuration"
2646 if test -n "$link_static_flag"; then
2647 dlopen_self=$dlopen_self_static
2648 # See comment for -static flag below, for more details.
2649 func_append compile_command " $link_static_flag"
2650 func_append finalize_command " $link_static_flag"
2652 prefer_static_libs=yes
2655 if test -z "$pic_flag" && test -n "$link_static_flag"; then
2656 dlopen_self=$dlopen_self_static
2658 prefer_static_libs=built
2660 -static-libtool-libs)
2661 if test -z "$pic_flag" && test -n "$link_static_flag"; then
2662 dlopen_self=$dlopen_self_static
2664 prefer_static_libs=yes
2667 build_libtool_libs=no
2674 # See if our shared archives depend on static archives.
2675 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
2677 # Go through the arguments, transforming them on the way.
2678 while test "$#" -gt 0; do
2681 func_quote_for_eval "$arg"
2682 qarg=$func_quote_for_eval_unquoted_result
2683 func_append libtool_args " $func_quote_for_eval_result"
2685 # If the previous option needs an argument, assign it.
2686 if test -n "$prev"; then
2689 func_append compile_command " @OUTPUT@"
2690 func_append finalize_command " @OUTPUT@"
2696 if test "$preload" = no; then
2697 # Add the symbol object into the linking commands.
2698 func_append compile_command " @SYMFILE@"
2699 func_append finalize_command " @SYMFILE@"
2703 *.la | *.lo) ;; # We handle these cases below.
2705 if test "$dlself" = no; then
2713 if test "$prev" = dlprefiles; then
2715 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
2725 if test "$prev" = dlfiles; then
2726 dlfiles="$dlfiles $arg"
2728 dlprefiles="$dlprefiles $arg"
2736 export_symbols="$arg"
2738 || func_fatal_error "symbol file \`$arg' does not exist"
2743 export_symbols_regex="$arg"
2751 *" $qarg.ltframework "*) ;;
2752 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
2761 inst_prefix_dir="$arg"
2766 if test -f "$arg"; then
2769 for fil in `cat "$save_arg"`
2771 # moreargs="$moreargs $fil"
2773 # A libtool-controlled object.
2775 # Check to see that this really is a libtool object.
2776 if func_lalib_unsafe_p "$arg"; then
2783 if test -z "$pic_object" ||
2784 test -z "$non_pic_object" ||
2785 test "$pic_object" = none &&
2786 test "$non_pic_object" = none; then
2787 func_fatal_error "cannot find name of object for \`$arg'"
2790 # Extract subdirectory from the argument.
2791 func_dirname "$arg" "/" ""
2792 xdir="$func_dirname_result"
2794 if test "$pic_object" != none; then
2795 # Prepend the subdirectory the object is found in.
2796 pic_object="$xdir$pic_object"
2798 if test "$prev" = dlfiles; then
2799 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
2800 dlfiles="$dlfiles $pic_object"
2804 # If libtool objects are unsupported, then we need to preload.
2809 # CHECK ME: I think I busted this. -Ossama
2810 if test "$prev" = dlprefiles; then
2811 # Preload the old-style object.
2812 dlprefiles="$dlprefiles $pic_object"
2817 func_append libobjs " $pic_object"
2822 if test "$non_pic_object" != none; then
2823 # Prepend the subdirectory the object is found in.
2824 non_pic_object="$xdir$non_pic_object"
2826 # A standard non-PIC object
2827 func_append non_pic_objects " $non_pic_object"
2828 if test -z "$pic_object" || test "$pic_object" = none ; then
2829 arg="$non_pic_object"
2832 # If the PIC object exists, use it instead.
2833 # $xdir was prepended to $pic_object above.
2834 non_pic_object="$pic_object"
2835 func_append non_pic_objects " $non_pic_object"
2838 # Only an error if not doing a dry-run.
2839 if $opt_dry_run; then
2840 # Extract subdirectory from the argument.
2841 func_dirname "$arg" "/" ""
2842 xdir="$func_dirname_result"
2844 pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
2845 non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
2846 func_append libobjs " $pic_object"
2847 func_append non_pic_objects " $non_pic_object"
2849 func_fatal_error "\`$arg' is not a valid libtool object"
2854 func_fatal_error "link input file \`$arg' does not exist"
2861 precious_files_regex="$arg"
2871 # We need an absolute path.
2873 [\\/]* | [A-Za-z]:[\\/]*) ;;
2875 func_fatal_error "only absolute run-paths are allowed"
2878 if test "$prev" = rpath; then
2881 *) rpath="$rpath $arg" ;;
2886 *) xrpath="$xrpath $arg" ;;
2898 weak_libs="$weak_libs $arg"
2903 linker_flags="$linker_flags $qarg"
2904 compiler_flags="$compiler_flags $qarg"
2906 func_append compile_command " $qarg"
2907 func_append finalize_command " $qarg"
2911 compiler_flags="$compiler_flags $qarg"
2913 func_append compile_command " $qarg"
2914 func_append finalize_command " $qarg"
2918 linker_flags="$linker_flags $qarg"
2919 compiler_flags="$compiler_flags $wl$qarg"
2921 func_append compile_command " $wl$qarg"
2922 func_append finalize_command " $wl$qarg"
2926 eval "$prev=\"\$arg\""
2931 fi # test -n "$prev"
2937 # The effects of -all-static are defined in a previous loop.
2942 # FIXME: remove this flag sometime in the future.
2943 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
2966 -export-symbols | -export-symbols-regex)
2967 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2968 func_fatal_error "more than one -exported-symbols argument is not allowed"
2970 if test "X$arg" = "X-export-symbols"; then
2988 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
2989 # so, if we see these flags be careful not to treat them like -L
2991 case $with_gcc/$host in
2992 no/*-*-irix* | /*-*-irix*)
2993 func_append compile_command " $arg"
2994 func_append finalize_command " $arg"
3001 func_stripname '-L' '' "$arg"
3002 dir=$func_stripname_result
3003 # We need an absolute path.
3005 [\\/]* | [A-Za-z]:[\\/]*) ;;
3007 absdir=`cd "$dir" && pwd`
3008 test -z "$absdir" && \
3009 func_fatal_error "cannot determine absolute directory name of \`$dir'"
3016 deplibs="$deplibs -L$dir"
3017 lib_search_path="$lib_search_path $dir"
3021 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3022 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
3023 case :$dllsearchpath: in
3025 *) dllsearchpath="$dllsearchpath:$dir";;
3027 case :$dllsearchpath: in
3028 *":$testbindir:"*) ;;
3029 *) dllsearchpath="$dllsearchpath:$testbindir";;
3037 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
3039 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
3040 # These systems don't actually have a C or math library (as such)
3044 # These systems don't actually have a C library (as such)
3045 test "X$arg" = "X-lc" && continue
3047 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3048 # Do not include libc due to us having libc/libc_r.
3049 test "X$arg" = "X-lc" && continue
3051 *-*-rhapsody* | *-*-darwin1.[012])
3052 # Rhapsody C and math libraries are in the System framework
3053 deplibs="$deplibs System.ltframework"
3056 *-*-sco3.2v5* | *-*-sco5v6*)
3057 # Causes problems with __ctype
3058 test "X$arg" = "X-lc" && continue
3060 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3061 # Compiler inserts libc in the correct place for threads to work
3062 test "X$arg" = "X-lc" && continue
3065 elif test "X$arg" = "X-lc_r"; then
3067 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3068 # Do not include libc_r directly, use -pthread flag.
3073 deplibs="$deplibs $arg"
3082 # Tru64 UNIX uses -model [arg] to determine the layout of C++
3083 # classes, name mangling, and exception handling.
3084 # Darwin uses the -arch flag to determine output architecture.
3085 -model|-arch|-isysroot)
3086 compiler_flags="$compiler_flags $arg"
3087 func_append compile_command " $arg"
3088 func_append finalize_command " $arg"
3093 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
3094 compiler_flags="$compiler_flags $arg"
3095 func_append compile_command " $arg"
3096 func_append finalize_command " $arg"
3097 case "$new_inherited_linker_flags " in
3099 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
3105 single_module="${wl}-multi_module"
3116 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3117 # The PATH hackery in wrapper scripts is required on Windows
3118 # in order for the loader to find any dlls it needs.
3119 func_warning "\`-no-install' is ignored for $host"
3120 func_warning "assuming \`-no-fast-install' instead"
3123 *) no_install=yes ;;
3140 -precious-files-regex)
3161 func_stripname '-R' '' "$arg"
3162 dir=$func_stripname_result
3163 # We need an absolute path.
3165 [\\/]* | [A-Za-z]:[\\/]*) ;;
3167 func_fatal_error "only absolute run-paths are allowed"
3172 *) xrpath="$xrpath $dir" ;;
3178 # The effects of -shared are defined in a previous loop.
3187 -static | -static-libtool-libs)
3188 # The effects of -static are defined in a previous loop.
3189 # We used to do the same as -all-static on platforms that
3190 # didn't have a PIC flag, but the assumption that the effects
3191 # would be equivalent was wrong. It would break on at least
3192 # Digital Unix and AIX.
3218 func_stripname '-Wc,' '' "$arg"
3219 args=$func_stripname_result
3221 save_ifs="$IFS"; IFS=','
3222 for flag in $args; do
3224 func_quote_for_eval "$flag"
3225 arg="$arg $wl$func_quote_for_eval_result"
3226 compiler_flags="$compiler_flags $func_quote_for_eval_result"
3229 func_stripname ' ' '' "$arg"
3230 arg=$func_stripname_result
3234 func_stripname '-Wl,' '' "$arg"
3235 args=$func_stripname_result
3237 save_ifs="$IFS"; IFS=','
3238 for flag in $args; do
3240 func_quote_for_eval "$flag"
3241 arg="$arg $wl$func_quote_for_eval_result"
3242 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
3243 linker_flags="$linker_flags $func_quote_for_eval_result"
3246 func_stripname ' ' '' "$arg"
3247 arg=$func_stripname_result
3265 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
3266 # -r[0-9][0-9]* specifies the processor on the SGI compiler
3267 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
3268 # +DA*, +DD* enable 64-bit mode on the HP compiler
3269 # -q* pass through compiler args for the IBM compiler
3270 # -m*, -t[45]*, -txscale* pass through architecture-specific
3271 # compiler args for GCC
3272 # @file GCC response files
3273 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
3274 -t[45]*|-txscale*|@*)
3275 func_quote_for_eval "$arg"
3276 arg="$func_quote_for_eval_result"
3277 func_append compile_command " $arg"
3278 func_append finalize_command " $arg"
3279 compiler_flags="$compiler_flags $arg"
3283 # Some other compiler flag.
3285 func_quote_for_eval "$arg"
3286 arg="$func_quote_for_eval_result"
3290 # A standard object.
3295 # A libtool-controlled object.
3297 # Check to see that this really is a libtool object.
3298 if func_lalib_unsafe_p "$arg"; then
3305 if test -z "$pic_object" ||
3306 test -z "$non_pic_object" ||
3307 test "$pic_object" = none &&
3308 test "$non_pic_object" = none; then
3309 func_fatal_error "cannot find name of object for \`$arg'"
3312 # Extract subdirectory from the argument.
3313 func_dirname "$arg" "/" ""
3314 xdir="$func_dirname_result"
3316 if test "$pic_object" != none; then
3317 # Prepend the subdirectory the object is found in.
3318 pic_object="$xdir$pic_object"
3320 if test "$prev" = dlfiles; then
3321 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
3322 dlfiles="$dlfiles $pic_object"
3326 # If libtool objects are unsupported, then we need to preload.
3331 # CHECK ME: I think I busted this. -Ossama
3332 if test "$prev" = dlprefiles; then
3333 # Preload the old-style object.
3334 dlprefiles="$dlprefiles $pic_object"
3339 func_append libobjs " $pic_object"
3344 if test "$non_pic_object" != none; then
3345 # Prepend the subdirectory the object is found in.
3346 non_pic_object="$xdir$non_pic_object"
3348 # A standard non-PIC object
3349 func_append non_pic_objects " $non_pic_object"
3350 if test -z "$pic_object" || test "$pic_object" = none ; then
3351 arg="$non_pic_object"
3354 # If the PIC object exists, use it instead.
3355 # $xdir was prepended to $pic_object above.
3356 non_pic_object="$pic_object"
3357 func_append non_pic_objects " $non_pic_object"
3360 # Only an error if not doing a dry-run.
3361 if $opt_dry_run; then
3362 # Extract subdirectory from the argument.
3363 func_dirname "$arg" "/" ""
3364 xdir="$func_dirname_result"
3366 pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
3367 non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
3368 func_append libobjs " $pic_object"
3369 func_append non_pic_objects " $non_pic_object"
3371 func_fatal_error "\`$arg' is not a valid libtool object"
3378 deplibs="$deplibs $arg"
3379 old_deplibs="$old_deplibs $arg"
3384 # A libtool-controlled library.
3386 if test "$prev" = dlfiles; then
3387 # This library was specified with -dlopen.
3388 dlfiles="$dlfiles $arg"
3390 elif test "$prev" = dlprefiles; then
3391 # The library was specified with -dlpreopen.
3392 dlprefiles="$dlprefiles $arg"
3395 deplibs="$deplibs $arg"
3400 # Some other compiler argument.
3402 # Unknown arguments in both finalize_command and compile_command need
3403 # to be aesthetically quoted because they are evaled later.
3404 func_quote_for_eval "$arg"
3405 arg="$func_quote_for_eval_result"
3409 # Now actually substitute the argument into the commands.
3410 if test -n "$arg"; then
3411 func_append compile_command " $arg"
3412 func_append finalize_command " $arg"
3414 done # argument parsing loop
3416 test -n "$prev" && \
3417 func_fatal_help "the \`$prevarg' option requires an argument"
3419 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
3420 eval arg=\"$export_dynamic_flag_spec\"
3421 func_append compile_command " $arg"
3422 func_append finalize_command " $arg"
3426 # calculate the name of the file, without its directory
3427 func_basename "$output"
3428 outputname="$func_basename_result"
3429 libobjs_save="$libobjs"
3431 if test -n "$shlibpath_var"; then
3432 # get the directories listed in $shlibpath_var
3433 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
3437 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
3438 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
3440 func_dirname "$output" "/" ""
3441 output_objdir="$func_dirname_result$objdir"
3442 # Create the object directory.
3443 func_mkdir_p "$output_objdir"
3445 # Determine the type of output
3448 func_fatal_help "you must specify an output file"
3450 *.$libext) linkmode=oldlib ;;
3451 *.lo | *.$objext) linkmode=obj ;;
3452 *.la) linkmode=lib ;;
3453 *) linkmode=prog ;; # Anything else should be a program.
3459 # Find all interdependent deplibs by searching for libraries
3460 # that are linked more than once (e.g. -la -lb -la)
3461 for deplib in $deplibs; do
3462 if $opt_duplicate_deps ; then
3464 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3467 libs="$libs $deplib"
3470 if test "$linkmode" = lib; then
3471 libs="$predeps $libs $compiler_lib_search_path $postdeps"
3473 # Compute libraries that are listed more than once in $predeps
3474 # $postdeps and mark them as special (i.e., whose duplicates are
3475 # not to be eliminated).
3477 if $opt_duplicate_compiler_generated_deps; then
3478 for pre_post_dep in $predeps $postdeps; do
3479 case "$pre_post_deps " in
3480 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
3482 pre_post_deps="$pre_post_deps $pre_post_dep"
3491 need_relink=no # whether we're linking any uninstalled libtool libraries
3492 notinst_deplibs= # not-installed libtool libraries
3493 notinst_path= # paths that contain not-installed libtool libraries
3497 passes="conv dlpreopen link"
3498 for file in $dlfiles $dlprefiles; do
3502 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
3513 passes="conv scan dlopen dlpreopen link"
3519 for pass in $passes; do
3520 # The preopen pass in lib mode reverses $deplibs; put it back here
3521 # so that -L comes before libs that need it for instance...
3522 if test "$linkmode,$pass" = "lib,link"; then
3523 ## FIXME: Find the place where the list is rebuilt in the wrong
3524 ## order, and fix it there properly
3526 for deplib in $deplibs; do
3527 tmp_deplibs="$deplib $tmp_deplibs"
3529 deplibs="$tmp_deplibs"
3532 if test "$linkmode,$pass" = "lib,link" ||
3533 test "$linkmode,$pass" = "prog,scan"; then
3537 if test "$linkmode" = prog; then
3539 dlopen) libs="$dlfiles" ;;
3540 dlpreopen) libs="$dlprefiles" ;;
3541 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
3544 if test "$linkmode,$pass" = "lib,dlpreopen"; then
3545 # Collect and forward deplibs of preopened libtool libs
3546 for lib in $dlprefiles; do
3547 # Ignore non-libtool-libs
3550 *.la) func_source "$lib" ;;
3553 # Collect preopened libtool deplibs, except any this library
3554 # has declared as weak libs
3555 for deplib in $dependency_libs; do
3556 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
3557 case " $weak_libs " in
3558 *" $deplib_base "*) ;;
3559 *) deplibs="$deplibs $deplib" ;;
3565 if test "$pass" = dlopen; then
3566 # Collect dlpreopened libraries
3567 save_deplibs="$deplibs"
3571 for deplib in $libs; do
3575 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
3576 if test "$linkmode,$pass" = "prog,link"; then
3577 compile_deplibs="$deplib $compile_deplibs"
3578 finalize_deplibs="$deplib $finalize_deplibs"
3580 compiler_flags="$compiler_flags $deplib"
3581 if test "$linkmode" = lib ; then
3582 case "$new_inherited_linker_flags " in
3584 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
3591 if test "$linkmode" != lib && test "$linkmode" != prog; then
3592 func_warning "\`-l' is ignored for archives/objects"
3595 func_stripname '-l' '' "$deplib"
3596 name=$func_stripname_result
3597 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
3598 for search_ext in .la $std_shrext .so .a; do
3599 # Search the libtool library
3600 lib="$searchdir/lib${name}${search_ext}"
3601 if test -f "$lib"; then
3602 if test "$search_ext" = ".la"; then
3611 if test "$found" != yes; then
3612 # deplib doesn't seem to be a libtool library
3613 if test "$linkmode,$pass" = "prog,link"; then
3614 compile_deplibs="$deplib $compile_deplibs"
3615 finalize_deplibs="$deplib $finalize_deplibs"
3617 deplibs="$deplib $deplibs"
3618 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
3621 else # deplib is a libtool library
3622 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
3623 # We need to do some special things here, and not later.
3624 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3625 case " $predeps $postdeps " in
3627 if func_lalib_p "$lib"; then
3631 for l in $old_library $library_names; do
3634 if test "X$ll" = "X$old_library" ; then # only static version available
3636 func_dirname "$lib" "" "."
3637 ladir="$func_dirname_result"
3638 lib=$ladir/$old_library
3639 if test "$linkmode,$pass" = "prog,link"; then
3640 compile_deplibs="$deplib $compile_deplibs"
3641 finalize_deplibs="$deplib $finalize_deplibs"
3643 deplibs="$deplib $deplibs"
3644 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
3656 if test "$linkmode,$pass" = "prog,link"; then
3657 compile_deplibs="$deplib $compile_deplibs"
3658 finalize_deplibs="$deplib $finalize_deplibs"
3660 deplibs="$deplib $deplibs"
3661 if test "$linkmode" = lib ; then
3662 case "$new_inherited_linker_flags " in
3664 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
3673 deplibs="$deplib $deplibs"
3674 test "$pass" = conv && continue
3675 newdependency_libs="$deplib $newdependency_libs"
3676 func_stripname '-L' '' "$deplib"
3677 newlib_search_path="$newlib_search_path $func_stripname_result"
3680 if test "$pass" = conv; then
3681 deplibs="$deplib $deplibs"
3684 if test "$pass" = scan; then
3685 deplibs="$deplib $deplibs"
3687 compile_deplibs="$deplib $compile_deplibs"
3688 finalize_deplibs="$deplib $finalize_deplibs"
3690 func_stripname '-L' '' "$deplib"
3691 newlib_search_path="$newlib_search_path $func_stripname_result"
3694 func_warning "\`-L' is ignored for archives/objects"
3700 if test "$pass" = link; then
3701 func_stripname '-R' '' "$deplib"
3702 dir=$func_stripname_result
3703 # Make sure the xrpath contains only unique directories.
3706 *) xrpath="$xrpath $dir" ;;
3709 deplibs="$deplib $deplibs"
3712 *.la) lib="$deplib" ;;
3714 if test "$pass" = conv; then
3715 deplibs="$deplib $deplibs"
3720 # Linking convenience modules into shared libraries is allowed,
3721 # but linking other static libraries is non-portable.
3722 case " $dlpreconveniencelibs " in
3726 case $deplibs_check_method in
3728 set dummy $deplibs_check_method; shift
3729 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
3730 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
3731 | $EGREP "$match_pattern_regex" > /dev/null; then
3739 if test "$valid_a_lib" != yes; then
3741 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
3742 $ECHO "*** I have the capability to make that library automatically link in when"
3743 $ECHO "*** you link to this library. But I can only do this if you have a"
3744 $ECHO "*** shared version of the library, which you do not appear to have"
3745 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
3746 $ECHO "*** that it is just a static archive that I should not use here."
3749 $ECHO "*** Warning: Linking the shared library $output against the"
3750 $ECHO "*** static library $deplib is not portable!"
3751 deplibs="$deplib $deplibs"
3758 if test "$pass" != link; then
3759 deplibs="$deplib $deplibs"
3761 compile_deplibs="$deplib $compile_deplibs"
3762 finalize_deplibs="$deplib $finalize_deplibs"
3769 if test "$pass" = conv; then
3770 deplibs="$deplib $deplibs"
3771 elif test "$linkmode" = prog; then
3772 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
3773 # If there is no dlopen support or we're linking statically,
3774 # we need to preload.
3775 newdlprefiles="$newdlprefiles $deplib"
3776 compile_deplibs="$deplib $compile_deplibs"
3777 finalize_deplibs="$deplib $finalize_deplibs"
3779 newdlfiles="$newdlfiles $deplib"
3790 if test "$found" = yes || test -f "$lib"; then :
3792 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
3795 # Check to see that this really is a libtool archive.
3796 func_lalib_unsafe_p "$lib" \
3797 || func_fatal_error "\`$lib' is not a valid libtool archive"
3799 func_dirname "$lib" "" "."
3800 ladir="$func_dirname_result"
3808 inherited_linker_flags=
3809 # If the library was installed with an old release of libtool,
3810 # it will not redefine variables installed, or shouldnotlink
3819 # Convert "-framework foo" to "foo.ltframework"
3820 if test -n "$inherited_linker_flags"; then
3821 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
3822 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
3823 case " $new_inherited_linker_flags " in
3824 *" $tmp_inherited_linker_flag "*) ;;
3825 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
3829 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
3830 if test "$linkmode,$pass" = "prog,link"; then
3831 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
3832 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
3834 compiler_flags="$compiler_flags $inherited_linker_flags"
3836 if test "$linkmode,$pass" = "lib,link" ||
3837 test "$linkmode,$pass" = "prog,scan" ||
3838 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
3839 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
3840 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
3843 if test "$pass" = conv; then
3844 # Only check for convenience libraries
3845 deplibs="$lib $deplibs"
3846 if test -z "$libdir"; then
3847 if test -z "$old_library"; then
3848 func_fatal_error "cannot find name of link library for \`$lib'"
3850 # It is a libtool convenience library, so add in its objects.
3851 convenience="$convenience $ladir/$objdir/$old_library"
3852 old_convenience="$old_convenience $ladir/$objdir/$old_library"
3853 elif test "$linkmode" != prog && test "$linkmode" != lib; then
3854 func_fatal_error "\`$lib' is not a convenience library"
3857 for deplib in $dependency_libs; do
3858 deplibs="$deplib $deplibs"
3859 if $opt_duplicate_deps ; then
3860 case "$tmp_libs " in
3861 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3864 tmp_libs="$tmp_libs $deplib"
3870 # Get the name of the library we link against.
3872 for l in $old_library $library_names; do
3875 if test -z "$linklib"; then
3876 func_fatal_error "cannot find name of link library for \`$lib'"
3879 # This library was specified with -dlopen.
3880 if test "$pass" = dlopen; then
3881 if test -z "$libdir"; then
3882 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
3884 if test -z "$dlname" ||
3885 test "$dlopen_support" != yes ||
3886 test "$build_libtool_libs" = no; then
3887 # If there is no dlname, no dlopen support or we're linking
3888 # statically, we need to preload. We also need to preload any
3889 # dependent libraries so libltdl's deplib preloader doesn't
3890 # bomb out in the load deplibs phase.
3891 dlprefiles="$dlprefiles $lib $dependency_libs"
3893 newdlfiles="$newdlfiles $lib"
3898 # We need an absolute path.
3900 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
3902 abs_ladir=`cd "$ladir" && pwd`
3903 if test -z "$abs_ladir"; then
3904 func_warning "cannot determine absolute directory name of \`$ladir'"
3905 func_warning "passing it literally to the linker, although it might fail"
3910 func_basename "$lib"
3911 laname="$func_basename_result"
3913 # Find the relevant object directory and library name.
3914 if test "X$installed" = Xyes; then
3915 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
3916 func_warning "library \`$lib' was moved."
3924 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
3926 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
3929 # Remove this search path later
3930 notinst_path="$notinst_path $abs_ladir"
3932 dir="$ladir/$objdir"
3933 absdir="$abs_ladir/$objdir"
3934 # Remove this search path later
3935 notinst_path="$notinst_path $abs_ladir"
3937 fi # $installed = yes
3938 func_stripname 'lib' '.la' "$laname"
3939 name=$func_stripname_result
3941 # This library was specified with -dlpreopen.
3942 if test "$pass" = dlpreopen; then
3943 if test -z "$libdir" && test "$linkmode" = prog; then
3944 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
3946 # Prefer using a static library (so that no silly _DYNAMIC symbols
3947 # are required to link).
3948 if test -n "$old_library"; then
3949 newdlprefiles="$newdlprefiles $dir/$old_library"
3950 # Keep a list of preopened convenience libraries to check
3951 # that they are being used correctly in the link pass.
3952 test -z "$libdir" && \
3953 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
3954 # Otherwise, use the dlname, so that lt_dlopen finds it.
3955 elif test -n "$dlname"; then
3956 newdlprefiles="$newdlprefiles $dir/$dlname"
3958 newdlprefiles="$newdlprefiles $dir/$linklib"
3960 fi # $pass = dlpreopen
3962 if test -z "$libdir"; then
3963 # Link the convenience library
3964 if test "$linkmode" = lib; then
3965 deplibs="$dir/$old_library $deplibs"
3966 elif test "$linkmode,$pass" = "prog,link"; then
3967 compile_deplibs="$dir/$old_library $compile_deplibs"
3968 finalize_deplibs="$dir/$old_library $finalize_deplibs"
3970 deplibs="$lib $deplibs" # used for prog,scan pass
3976 if test "$linkmode" = prog && test "$pass" != link; then
3977 newlib_search_path="$newlib_search_path $ladir"
3978 deplibs="$lib $deplibs"
3981 if test "$link_all_deplibs" != no || test -z "$library_names" ||
3982 test "$build_libtool_libs" = no; then
3987 for deplib in $dependency_libs; do
3989 -L*) func_stripname '-L' '' "$deplib"
3990 newlib_search_path="$newlib_search_path $func_stripname_result"
3993 # Need to link against all dependency_libs?
3994 if test "$linkalldeplibs" = yes; then
3995 deplibs="$deplib $deplibs"
3997 # Need to hardcode shared library paths
3998 # or/and link against static libraries
3999 newdependency_libs="$deplib $newdependency_libs"
4001 if $opt_duplicate_deps ; then
4002 case "$tmp_libs " in
4003 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4006 tmp_libs="$tmp_libs $deplib"
4009 fi # $linkmode = prog...
4011 if test "$linkmode,$pass" = "prog,link"; then
4012 if test -n "$library_names" &&
4013 { { test "$prefer_static_libs" = no ||
4014 test "$prefer_static_libs,$installed" = "built,yes"; } ||
4015 test -z "$old_library"; }; then
4016 # We need to hardcode the library path
4017 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
4018 # Make sure the rpath contains only unique directories.
4019 case "$temp_rpath:" in
4021 *) temp_rpath="$temp_rpath$absdir:" ;;
4025 # Hardcode the library path.
4026 # Skip directories that are in the system default run-time
4028 case " $sys_lib_dlsearch_path " in
4031 case "$compile_rpath " in
4033 *) compile_rpath="$compile_rpath $absdir"
4037 case " $sys_lib_dlsearch_path " in
4040 case "$finalize_rpath " in
4042 *) finalize_rpath="$finalize_rpath $libdir"
4046 fi # $linkmode,$pass = prog,link...
4048 if test "$alldeplibs" = yes &&
4049 { test "$deplibs_check_method" = pass_all ||
4050 { test "$build_libtool_libs" = yes &&
4051 test -n "$library_names"; }; }; then
4052 # We only need to search for static libraries
4057 link_static=no # Whether the deplib will be linked statically
4058 use_static_libs=$prefer_static_libs
4059 if test "$use_static_libs" = built && test "$installed" = yes; then
4062 if test -n "$library_names" &&
4063 { test "$use_static_libs" = no || test -z "$old_library"; }; then
4066 # No point in relinking DLLs because paths are not encoded
4067 notinst_deplibs="$notinst_deplibs $lib"
4071 if test "$installed" = no; then
4072 notinst_deplibs="$notinst_deplibs $lib"
4077 # This is a shared library
4079 # Warn about portability, can't link against -module's on some
4080 # systems (darwin). Don't bleat about dlopened modules though!
4082 for dlpremoduletest in $dlprefiles; do
4083 if test "X$dlpremoduletest" = "X$lib"; then
4084 dlopenmodule="$dlpremoduletest"
4088 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
4090 if test "$linkmode" = prog; then
4091 $ECHO "*** Warning: Linking the executable $output against the loadable module"
4093 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
4095 $ECHO "*** $linklib is not portable!"
4097 if test "$linkmode" = lib &&
4098 test "$hardcode_into_libs" = yes; then
4099 # Hardcode the library path.
4100 # Skip directories that are in the system default run-time
4102 case " $sys_lib_dlsearch_path " in
4105 case "$compile_rpath " in
4107 *) compile_rpath="$compile_rpath $absdir"
4111 case " $sys_lib_dlsearch_path " in
4114 case "$finalize_rpath " in
4116 *) finalize_rpath="$finalize_rpath $libdir"
4122 if test -n "$old_archive_from_expsyms_cmds"; then
4123 # figure out the soname
4124 set dummy $library_names
4128 libname=`eval "\\$ECHO \"$libname_spec\""`
4129 # use dlname if we got it. it's perfectly good, no?
4130 if test -n "$dlname"; then
4132 elif test -n "$soname_spec"; then
4136 major=`expr $current - $age`
4140 eval soname=\"$soname_spec\"
4145 # Make a new name for the extract_expsyms_cmds to use
4147 func_basename "$soroot"
4148 soname="$func_basename_result"
4149 func_stripname 'lib' '.dll' "$soname"
4150 newlib=libimp-$func_stripname_result.a
4152 # If the library has no export list, then create one now
4153 if test -f "$output_objdir/$soname-def"; then :
4155 func_echo "extracting exported symbol list from \`$soname'"
4156 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
4160 if test -f "$output_objdir/$newlib"; then :; else
4161 func_echo "generating import library for \`$soname'"
4162 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
4164 # make sure the library variables are pointing to the new library
4167 fi # test -n "$old_archive_from_expsyms_cmds"
4169 if test "$linkmode" = prog || test "$mode" != relink; then
4174 case $hardcode_action in
4175 immediate | unsupported)
4176 if test "$hardcode_direct" = no; then
4179 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
4180 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
4181 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
4182 *-*-unixware7*) add_dir="-L$dir" ;;
4184 # if the lib is a (non-dlopened) module then we can not
4185 # link against it, someone is ignoring the earlier warnings
4186 if /usr/bin/file -L $add 2> /dev/null |
4187 $GREP ": [^:]* bundle" >/dev/null ; then
4188 if test "X$dlopenmodule" != "X$lib"; then
4189 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
4190 if test -z "$old_library" ; then
4192 $ECHO "*** And there doesn't seem to be a static archive available"
4193 $ECHO "*** The link will probably fail, sorry"
4195 add="$dir/$old_library"
4197 elif test -n "$old_library"; then
4198 add="$dir/$old_library"
4202 elif test "$hardcode_minus_L" = no; then
4204 *-*-sunos*) add_shlibpath="$dir" ;;
4208 elif test "$hardcode_shlibpath_var" = no; then
4209 add_shlibpath="$dir"
4216 if test "$hardcode_direct" = yes &&
4217 test "$hardcode_direct_absolute" = no; then
4219 elif test "$hardcode_minus_L" = yes; then
4221 # Try looking first in the location we're being installed to.
4222 if test -n "$inst_prefix_dir"; then
4225 add_dir="$add_dir -L$inst_prefix_dir$libdir"
4230 elif test "$hardcode_shlibpath_var" = yes; then
4231 add_shlibpath="$dir"
4240 if test "$lib_linked" != yes; then
4241 func_fatal_configuration "unsupported hardcode properties"
4244 if test -n "$add_shlibpath"; then
4245 case :$compile_shlibpath: in
4246 *":$add_shlibpath:"*) ;;
4247 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
4250 if test "$linkmode" = prog; then
4251 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
4252 test -n "$add" && compile_deplibs="$add $compile_deplibs"
4254 test -n "$add_dir" && deplibs="$add_dir $deplibs"
4255 test -n "$add" && deplibs="$add $deplibs"
4256 if test "$hardcode_direct" != yes &&
4257 test "$hardcode_minus_L" != yes &&
4258 test "$hardcode_shlibpath_var" = yes; then
4259 case :$finalize_shlibpath: in
4261 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
4267 if test "$linkmode" = prog || test "$mode" = relink; then
4271 # Finalize command for both is simple: just hardcode it.
4272 if test "$hardcode_direct" = yes &&
4273 test "$hardcode_direct_absolute" = no; then
4274 add="$libdir/$linklib"
4275 elif test "$hardcode_minus_L" = yes; then
4278 elif test "$hardcode_shlibpath_var" = yes; then
4279 case :$finalize_shlibpath: in
4281 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
4284 elif test "$hardcode_automatic" = yes; then
4285 if test -n "$inst_prefix_dir" &&
4286 test -f "$inst_prefix_dir$libdir/$linklib" ; then
4287 add="$inst_prefix_dir$libdir/$linklib"
4289 add="$libdir/$linklib"
4292 # We cannot seem to hardcode it, guess we'll fake it.
4294 # Try looking first in the location we're being installed to.
4295 if test -n "$inst_prefix_dir"; then
4298 add_dir="$add_dir -L$inst_prefix_dir$libdir"
4305 if test "$linkmode" = prog; then
4306 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
4307 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
4309 test -n "$add_dir" && deplibs="$add_dir $deplibs"
4310 test -n "$add" && deplibs="$add $deplibs"
4313 elif test "$linkmode" = prog; then
4314 # Here we assume that one of hardcode_direct or hardcode_minus_L
4315 # is not unsupported. This is valid on all known static and
4317 if test "$hardcode_direct" != unsupported; then
4318 test -n "$old_library" && linklib="$old_library"
4319 compile_deplibs="$dir/$linklib $compile_deplibs"
4320 finalize_deplibs="$dir/$linklib $finalize_deplibs"
4322 compile_deplibs="-l$name -L$dir $compile_deplibs"
4323 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
4325 elif test "$build_libtool_libs" = yes; then
4326 # Not a shared library
4327 if test "$deplibs_check_method" != pass_all; then
4328 # We're trying link a shared library against a static one
4329 # but the system doesn't support it.
4331 # Just print a warning and add the library to dependency_libs so
4332 # that the program can be linked against the static library.
4334 $ECHO "*** Warning: This system can not link to static lib archive $lib."
4335 $ECHO "*** I have the capability to make that library automatically link in when"
4336 $ECHO "*** you link to this library. But I can only do this if you have a"
4337 $ECHO "*** shared version of the library, which you do not appear to have."
4338 if test "$module" = yes; then
4339 $ECHO "*** But as you try to build a module library, libtool will still create "
4340 $ECHO "*** a static module, that should work as long as the dlopening application"
4341 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
4342 if test -z "$global_symbol_pipe"; then
4344 $ECHO "*** However, this would only work if libtool was able to extract symbol"
4345 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
4346 $ECHO "*** not find such a program. So, this module is probably useless."
4347 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
4349 if test "$build_old_libs" = no; then
4350 build_libtool_libs=module
4353 build_libtool_libs=no
4357 deplibs="$dir/$old_library $deplibs"
4360 fi # link shared/static library?
4362 if test "$linkmode" = lib; then
4363 if test -n "$dependency_libs" &&
4364 { test "$hardcode_into_libs" != yes ||
4365 test "$build_old_libs" = yes ||
4366 test "$link_static" = yes; }; then
4367 # Extract -R from dependency_libs
4369 for libdir in $dependency_libs; do
4371 -R*) func_stripname '-R' '' "$libdir"
4372 temp_xrpath=$func_stripname_result
4374 *" $temp_xrpath "*) ;;
4375 *) xrpath="$xrpath $temp_xrpath";;
4377 *) temp_deplibs="$temp_deplibs $libdir";;
4380 dependency_libs="$temp_deplibs"
4383 newlib_search_path="$newlib_search_path $absdir"
4384 # Link against this library
4385 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
4386 # ... and its dependency_libs
4388 for deplib in $dependency_libs; do
4389 newdependency_libs="$deplib $newdependency_libs"
4390 if $opt_duplicate_deps ; then
4391 case "$tmp_libs " in
4392 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4395 tmp_libs="$tmp_libs $deplib"
4398 if test "$link_all_deplibs" != no; then
4399 # Add the search paths of all dependency libraries
4400 for deplib in $dependency_libs; do
4402 -L*) path="$deplib" ;;
4404 func_dirname "$deplib" "" "."
4405 dir="$func_dirname_result"
4406 # We need an absolute path.
4408 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
4410 absdir=`cd "$dir" && pwd`
4411 if test -z "$absdir"; then
4412 func_warning "cannot determine absolute directory name of \`$dir'"
4417 if $GREP "^installed=no" $deplib > /dev/null; then
4421 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
4422 if test -n "$deplibrary_names" ; then
4423 for tmp in $deplibrary_names ; do
4426 if test -f "$absdir/$objdir/$depdepl" ; then
4427 depdepl="$absdir/$objdir/$depdepl"
4428 darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
4429 darwin_install_name=`$ECHO $darwin_install_name`
4430 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
4431 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
4437 path="-L$absdir/$objdir"
4441 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4442 test -z "$libdir" && \
4443 func_fatal_error "\`$deplib' is not a valid libtool archive"
4444 test "$absdir" != "$libdir" && \
4445 func_warning "\`$deplib' seems to be moved"
4451 case " $deplibs " in
4453 *) deplibs="$path $deplibs" ;;
4456 fi # link_all_deplibs != no
4458 done # for deplib in $libs
4459 dependency_libs="$newdependency_libs"
4460 if test "$pass" = dlpreopen; then
4461 # Link the dlpreopened libraries before other libraries
4462 for deplib in $save_deplibs; do
4463 deplibs="$deplib $deplibs"
4466 if test "$pass" != dlopen; then
4467 if test "$pass" != conv; then
4468 # Make sure lib_search_path contains only unique directories.
4470 for dir in $newlib_search_path; do
4471 case "$lib_search_path " in
4473 *) lib_search_path="$lib_search_path $dir" ;;
4479 if test "$linkmode,$pass" != "prog,link"; then
4482 vars="compile_deplibs finalize_deplibs"
4484 for var in $vars dependency_libs; do
4485 # Add libraries to $var in reverse order
4486 eval tmp_libs=\"\$$var\"
4488 for deplib in $tmp_libs; do
4489 # FIXME: Pedantically, this is the right thing to do, so
4490 # that some nasty dependency loop isn't accidentally
4492 #new_libs="$deplib $new_libs"
4493 # Pragmatically, this seems to cause very few problems in
4496 -L*) new_libs="$deplib $new_libs" ;;
4499 # And here is the reason: when a library appears more
4500 # than once as an explicit dependence of a library, or
4501 # is implicitly linked in more than once by the
4502 # compiler, it is considered special, and multiple
4503 # occurrences thereof are not removed. Compare this
4504 # with having the same library being listed as a
4505 # dependency of multiple other libraries: in this case,
4506 # we know (pedantically, we assume) the library does not
4507 # need to be listed more than once, so we keep only the
4508 # last copy. This is not always right, but it is rare
4509 # enough that we require users that really mean to play
4510 # such unportable linking tricks to link the library
4511 # using -Wl,-lname, so that libtool does not consider it
4512 # for duplicate removal.
4513 case " $specialdeplibs " in
4514 *" $deplib "*) new_libs="$deplib $new_libs" ;;
4516 case " $new_libs " in
4518 *) new_libs="$deplib $new_libs" ;;
4526 for deplib in $new_libs; do
4529 case " $tmp_libs " in
4531 *) tmp_libs="$tmp_libs $deplib" ;;
4534 *) tmp_libs="$tmp_libs $deplib" ;;
4537 eval $var=\"$tmp_libs\"
4540 # Last step: remove runtime libs from dependency_libs
4541 # (they stay in deplibs)
4543 for i in $dependency_libs ; do
4544 case " $predeps $postdeps $compiler_lib_search_path " in
4549 if test -n "$i" ; then
4550 tmp_libs="$tmp_libs $i"
4553 dependency_libs=$tmp_libs
4555 if test "$linkmode" = prog; then
4556 dlfiles="$newdlfiles"
4558 if test "$linkmode" = prog || test "$linkmode" = lib; then
4559 dlprefiles="$newdlprefiles"
4564 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4565 func_warning "\`-dlopen' is ignored for archives"
4568 test -n "$deplibs" && \
4569 func_warning "\`-l' and \`-L' are ignored for archives"
4572 test -n "$rpath" && \
4573 func_warning "\`-rpath' is ignored for archives"
4575 test -n "$xrpath" && \
4576 func_warning "\`-R' is ignored for archives"
4578 test -n "$vinfo" && \
4579 func_warning "\`-version-info/-version-number' is ignored for archives"
4581 test -n "$release" && \
4582 func_warning "\`-release' is ignored for archives"
4584 test -n "$export_symbols$export_symbols_regex" && \
4585 func_warning "\`-export-symbols' is ignored for archives"
4587 # Now set the variables for building old libraries.
4588 build_libtool_libs=no
4590 objs="$objs$old_deplibs"
4594 # Make sure we only generate libraries of the form `libNAME.la'.
4597 func_stripname 'lib' '.la' "$outputname"
4598 name=$func_stripname_result
4599 eval shared_ext=\"$shrext_cmds\"
4600 eval libname=\"$libname_spec\"
4603 test "$module" = no && \
4604 func_fatal_help "libtool library \`$output' must begin with \`lib'"
4606 if test "$need_lib_prefix" != no; then
4607 # Add the "lib" prefix for modules if required
4608 func_stripname '' '.la' "$outputname"
4609 name=$func_stripname_result
4610 eval shared_ext=\"$shrext_cmds\"
4611 eval libname=\"$libname_spec\"
4613 func_stripname '' '.la' "$outputname"
4614 libname=$func_stripname_result
4619 if test -n "$objs"; then
4620 if test "$deplibs_check_method" != pass_all; then
4621 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
4624 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
4625 $ECHO "*** objects $objs is not portable!"
4626 libobjs="$libobjs $objs"
4630 test "$dlself" != no && \
4631 func_warning "\`-dlopen self' is ignored for libtool libraries"
4635 test "$#" -gt 1 && \
4636 func_warning "ignoring multiple \`-rpath's for a libtool library"
4641 if test -z "$rpath"; then
4642 if test "$build_libtool_libs" = yes; then
4643 # Building a libtool convenience library.
4644 # Some compilers have problems with a `.al' extension so
4645 # convenience libraries should have the same extension an
4646 # archive normally would.
4647 oldlibs="$output_objdir/$libname.$libext $oldlibs"
4648 build_libtool_libs=convenience
4652 test -n "$vinfo" && \
4653 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
4655 test -n "$release" && \
4656 func_warning "\`-release' is ignored for convenience libraries"
4659 # Parse the version information argument.
4660 save_ifs="$IFS"; IFS=':'
4661 set dummy $vinfo 0 0 0
4666 func_fatal_help "too many parameters to \`-version-info'"
4668 # convert absolute version numbers to libtool ages
4669 # this retains compatibility with .la files and attempts
4670 # to make the code below a bit more comprehensible
4672 case $vinfo_number in
4676 number_revision="$3"
4678 # There are really only two kinds -- those that
4679 # use the current revision as the major version
4680 # and those that subtract age and use age as
4681 # a minor version. But, then there is irix
4682 # which has an extra 1 added just for fun
4684 case $version_type in
4685 darwin|linux|osf|windows|none)
4686 current=`expr $number_major + $number_minor`
4688 revision="$number_revision"
4690 freebsd-aout|freebsd-elf|sunos)
4691 current="$number_major"
4692 revision="$number_minor"
4696 current=`expr $number_major + $number_minor - 1`
4698 revision="$number_minor"
4709 # Check that each of the things are valid numbers.
4711 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]) ;;
4713 func_error "CURRENT \`$current' must be a nonnegative integer"
4714 func_fatal_error "\`$vinfo' is not valid version information"
4719 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]) ;;
4721 func_error "REVISION \`$revision' must be a nonnegative integer"
4722 func_fatal_error "\`$vinfo' is not valid version information"
4727 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]) ;;
4729 func_error "AGE \`$age' must be a nonnegative integer"
4730 func_fatal_error "\`$vinfo' is not valid version information"
4734 if test "$age" -gt "$current"; then
4735 func_error "AGE \`$age' is greater than the current interface number \`$current'"
4736 func_fatal_error "\`$vinfo' is not valid version information"
4739 # Calculate the version variables.
4743 case $version_type in
4747 # Like Linux, but with the current version available in
4748 # verstring for coding it into the library header
4749 major=.`expr $current - $age`
4750 versuffix="$major.$age.$revision"
4751 # Darwin ld doesn't like 0 for these options...
4752 minor_current=`expr $current + 1`
4753 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
4758 versuffix=".$current.$revision";
4763 versuffix=".$current"
4767 major=`expr $current - $age + 1`
4769 case $version_type in
4770 nonstopux) verstring_prefix=nonstopux ;;
4771 *) verstring_prefix=sgi ;;
4773 verstring="$verstring_prefix$major.$revision"
4775 # Add in all the interfaces that we are compatible with.
4777 while test "$loop" -ne 0; do
4778 iface=`expr $revision - $loop`
4779 loop=`expr $loop - 1`
4780 verstring="$verstring_prefix$major.$iface:$verstring"
4783 # Before this point, $major must not contain `.'.
4785 versuffix="$major.$revision"
4789 major=.`expr $current - $age`
4790 versuffix="$major.$age.$revision"
4794 major=.`expr $current - $age`
4795 versuffix=".$current.$age.$revision"
4796 verstring="$current.$age.$revision"
4798 # Add in all the interfaces that we are compatible with.
4800 while test "$loop" -ne 0; do
4801 iface=`expr $current - $loop`
4802 loop=`expr $loop - 1`
4803 verstring="$verstring:${iface}.0"
4806 # Make executables depend on our current version.
4807 verstring="$verstring:${current}.0"
4812 versuffix=".$current"
4817 versuffix=".$current.$revision"
4821 # Use '-' rather than '.', since we only want one
4822 # extension on DOS 8.3 filesystems.
4823 major=`expr $current - $age`
4828 func_fatal_configuration "unknown library version type \`$version_type'"
4832 # Clear the version info if we defaulted, and they specified a release.
4833 if test -z "$vinfo" && test -n "$release"; then
4835 case $version_type in
4837 # we can't check for "0.0" in archive_cmds due to quoting
4838 # problems, so we reset it completely
4845 if test "$need_version" = no; then
4852 # Remove version info from name if versioning should be avoided
4853 if test "$avoid_version" = yes && test "$need_version" = no; then
4859 # Check to see if the archive will have undefined symbols.
4860 if test "$allow_undefined" = yes; then
4861 if test "$allow_undefined_flag" = unsupported; then
4862 func_warning "undefined symbols not allowed in $host shared libraries"
4863 build_libtool_libs=no
4867 # Don't allow undefined symbols.
4868 allow_undefined_flag="$no_undefined_flag"
4873 func_generate_dlsyms "$libname" "$libname" "yes"
4874 libobjs="$libobjs $symfileobj"
4876 if test "$mode" != relink; then
4877 # Remove our outputs, but don't remove object files since they
4878 # may have been created when compiling PIC objects.
4880 tempremovelist=`$ECHO "$output_objdir/*"`
4881 for p in $tempremovelist; do
4885 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
4886 if test "X$precious_files_regex" != "X"; then
4887 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
4892 removelist="$removelist $p"
4897 test -n "$removelist" && \
4898 func_show_eval "${RM}r \$removelist"
4901 # Now set the variables for building old libraries.
4902 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
4903 oldlibs="$oldlibs $output_objdir/$libname.$libext"
4905 # Transform .lo files to .o files.
4906 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
4909 # Eliminate all temporary directories.
4910 #for path in $notinst_path; do
4911 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
4912 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
4913 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
4916 if test -n "$xrpath"; then
4917 # If the user specified any rpath flags, then add them.
4919 for libdir in $xrpath; do
4920 temp_xrpath="$temp_xrpath -R$libdir"
4921 case "$finalize_rpath " in
4923 *) finalize_rpath="$finalize_rpath $libdir" ;;
4926 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
4927 dependency_libs="$temp_xrpath $dependency_libs"
4931 # Make sure dlfiles contains only unique files that won't be dlpreopened
4932 old_dlfiles="$dlfiles"
4934 for lib in $old_dlfiles; do
4935 case " $dlprefiles $dlfiles " in
4937 *) dlfiles="$dlfiles $lib" ;;
4941 # Make sure dlprefiles contains only unique files
4942 old_dlprefiles="$dlprefiles"
4944 for lib in $old_dlprefiles; do
4945 case "$dlprefiles " in
4947 *) dlprefiles="$dlprefiles $lib" ;;
4951 if test "$build_libtool_libs" = yes; then
4952 if test -n "$rpath"; then
4954 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
4955 # these systems don't actually have a c library (as such)!
4957 *-*-rhapsody* | *-*-darwin1.[012])
4958 # Rhapsody C library is in the System framework
4959 deplibs="$deplibs System.ltframework"
4962 # Don't link with libc until the a.out ld.so is fixed.
4964 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4965 # Do not include libc due to us having libc/libc_r.
4967 *-*-sco3.2v5* | *-*-sco5v6*)
4968 # Causes problems with __ctype
4970 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
4971 # Compiler inserts libc in the correct place for threads to work
4974 # Add libc to deplibs on all other systems if necessary.
4975 if test "$build_libtool_need_lc" = "yes"; then
4976 deplibs="$deplibs -lc"
4982 # Transform deplibs into only deplibs that can be linked in shared.
4984 libname_save=$libname
4985 release_save=$release
4986 versuffix_save=$versuffix
4988 # I'm not sure if I'm treating the release correctly. I think
4989 # release should show up in the -l (ie -lgmp5) so we don't want to
4990 # add it in twice. Is that correct?
4996 case $deplibs_check_method in
4998 # Don't check for shared/static. Everything works.
4999 # This might be a little naive. We might want to check
5000 # whether the library exists or not. But this is on
5001 # osf3 & osf4 and I'm not really sure... Just
5002 # implementing what was already the behavior.
5006 # This code stresses the "libraries are programs" paradigm to its
5007 # limits. Maybe even breaks it. We compile a program, linking it
5008 # against the deplibs as a proxy for the library. Then we can check
5009 # whether they linked in statically or dynamically with ldd.
5010 $opt_dry_run || $RM conftest.c
5011 cat > conftest.c <<EOF
5012 int main() { return 0; }
5014 $opt_dry_run || $RM conftest
5015 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
5016 ldd_output=`ldd conftest`
5017 for i in $deplibs; do
5018 name=`expr $i : '-l\(.*\)'`
5019 # If $name is empty we are operating on a -L argument.
5020 if test "$name" != "" && test "$name" != "0"; then
5021 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5022 case " $predeps $postdeps " in
5024 newdeplibs="$newdeplibs $i"
5029 if test -n "$i" ; then
5030 libname=`eval "\\$ECHO \"$libname_spec\""`
5031 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5032 set dummy $deplib_matches; shift
5034 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5035 newdeplibs="$newdeplibs $i"
5039 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
5040 $ECHO "*** I have the capability to make that library automatically link in when"
5041 $ECHO "*** you link to this library. But I can only do this if you have a"
5042 $ECHO "*** shared version of the library, which I believe you do not have"
5043 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
5044 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
5048 newdeplibs="$newdeplibs $i"
5052 # Error occurred in the first compile. Let's try to salvage
5053 # the situation: Compile a separate program for each library.
5054 for i in $deplibs; do
5055 name=`expr $i : '-l\(.*\)'`
5056 # If $name is empty we are operating on a -L argument.
5057 if test "$name" != "" && test "$name" != "0"; then
5058 $opt_dry_run || $RM conftest
5059 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
5060 ldd_output=`ldd conftest`
5061 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5062 case " $predeps $postdeps " in
5064 newdeplibs="$newdeplibs $i"
5069 if test -n "$i" ; then
5070 libname=`eval "\\$ECHO \"$libname_spec\""`
5071 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5072 set dummy $deplib_matches; shift
5074 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5075 newdeplibs="$newdeplibs $i"
5079 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
5080 $ECHO "*** I have the capability to make that library automatically link in when"
5081 $ECHO "*** you link to this library. But I can only do this if you have a"
5082 $ECHO "*** shared version of the library, which you do not appear to have"
5083 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
5084 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
5090 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
5091 $ECHO "*** make it link in! You will probably need to install it or some"
5092 $ECHO "*** library that it depends on before this library will be fully"
5093 $ECHO "*** functional. Installing it before continuing would be even better."
5096 newdeplibs="$newdeplibs $i"
5102 set dummy $deplibs_check_method; shift
5103 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5104 for a_deplib in $deplibs; do
5105 name=`expr $a_deplib : '-l\(.*\)'`
5106 # If $name is empty we are operating on a -L argument.
5107 if test "$name" != "" && test "$name" != "0"; then
5108 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5109 case " $predeps $postdeps " in
5111 newdeplibs="$newdeplibs $a_deplib"
5116 if test -n "$a_deplib" ; then
5117 libname=`eval "\\$ECHO \"$libname_spec\""`
5118 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
5119 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
5120 for potent_lib in $potential_libs; do
5121 # Follow soft links.
5122 if ls -lLd "$potent_lib" 2>/dev/null |
5123 $GREP " -> " >/dev/null; then
5126 # The statement above tries to avoid entering an
5127 # endless loop below, in case of cyclic links.
5128 # We might still enter an endless loop, since a link
5129 # loop can be closed while we follow links,
5131 potlib="$potent_lib"
5132 while test -h "$potlib" 2>/dev/null; do
5133 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
5135 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
5136 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
5139 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
5141 $EGREP "$file_magic_regex" > /dev/null; then
5142 newdeplibs="$newdeplibs $a_deplib"
5149 if test -n "$a_deplib" ; then
5152 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
5153 $ECHO "*** I have the capability to make that library automatically link in when"
5154 $ECHO "*** you link to this library. But I can only do this if you have a"
5155 $ECHO "*** shared version of the library, which you do not appear to have"
5156 $ECHO "*** because I did check the linker path looking for a file starting"
5157 if test -z "$potlib" ; then
5158 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
5160 $ECHO "*** with $libname and none of the candidates passed a file format test"
5161 $ECHO "*** using a file magic. Last file checked: $potlib"
5165 # Add a -L argument.
5166 newdeplibs="$newdeplibs $a_deplib"
5168 done # Gone through all deplibs.
5171 set dummy $deplibs_check_method; shift
5172 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5173 for a_deplib in $deplibs; do
5174 name=`expr $a_deplib : '-l\(.*\)'`
5175 # If $name is empty we are operating on a -L argument.
5176 if test -n "$name" && test "$name" != "0"; then
5177 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5178 case " $predeps $postdeps " in
5180 newdeplibs="$newdeplibs $a_deplib"
5185 if test -n "$a_deplib" ; then
5186 libname=`eval "\\$ECHO \"$libname_spec\""`
5187 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
5188 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
5189 for potent_lib in $potential_libs; do
5190 potlib="$potent_lib" # see symlink-check above in file_magic test
5191 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
5192 $EGREP "$match_pattern_regex" > /dev/null; then
5193 newdeplibs="$newdeplibs $a_deplib"
5200 if test -n "$a_deplib" ; then
5203 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
5204 $ECHO "*** I have the capability to make that library automatically link in when"
5205 $ECHO "*** you link to this library. But I can only do this if you have a"
5206 $ECHO "*** shared version of the library, which you do not appear to have"
5207 $ECHO "*** because I did check the linker path looking for a file starting"
5208 if test -z "$potlib" ; then
5209 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
5211 $ECHO "*** with $libname and none of the candidates passed a file format test"
5212 $ECHO "*** using a regex pattern. Last file checked: $potlib"
5216 # Add a -L argument.
5217 newdeplibs="$newdeplibs $a_deplib"
5219 done # Gone through all deplibs.
5223 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
5224 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
5225 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5226 for i in $predeps $postdeps ; do
5227 # can't use Xsed below, because $i might contain '/'
5228 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
5231 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
5232 $GREP . >/dev/null; then
5234 if test "X$deplibs_check_method" = "Xnone"; then
5235 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
5237 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
5239 $ECHO "*** All declared inter-library dependencies are being dropped."
5244 versuffix=$versuffix_save
5246 release=$release_save
5247 libname=$libname_save
5251 *-*-rhapsody* | *-*-darwin1.[012])
5252 # On Rhapsody replace the C library with the System framework
5253 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
5257 if test "$droppeddeps" = yes; then
5258 if test "$module" = yes; then
5260 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
5261 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
5262 $ECHO "*** a static module, that should work as long as the dlopening"
5263 $ECHO "*** application is linked with the -dlopen flag."
5264 if test -z "$global_symbol_pipe"; then
5266 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5267 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5268 $ECHO "*** not find such a program. So, this module is probably useless."
5269 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
5271 if test "$build_old_libs" = no; then
5272 oldlibs="$output_objdir/$libname.$libext"
5273 build_libtool_libs=module
5276 build_libtool_libs=no
5279 $ECHO "*** The inter-library dependencies that have been dropped here will be"
5280 $ECHO "*** automatically added whenever a program is linked with this library"
5281 $ECHO "*** or is declared to -dlopen it."
5283 if test "$allow_undefined" = no; then
5285 $ECHO "*** Since this library must not contain undefined symbols,"
5286 $ECHO "*** because either the platform does not support them or"
5287 $ECHO "*** it was explicitly requested with -no-undefined,"
5288 $ECHO "*** libtool will only create a static version of it."
5289 if test "$build_old_libs" = no; then
5290 oldlibs="$output_objdir/$libname.$libext"
5291 build_libtool_libs=module
5294 build_libtool_libs=no
5299 # Done checking deplibs!
5302 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
5305 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5306 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5307 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5311 # move library search paths that coincide with paths to not yet
5312 # installed libraries to the beginning of the library search list
5314 for path in $notinst_path; do
5315 case " $new_libs " in
5316 *" -L$path/$objdir "*) ;;
5318 case " $deplibs " in
5319 *" -L$path/$objdir "*)
5320 new_libs="$new_libs -L$path/$objdir" ;;
5325 for deplib in $deplibs; do
5328 case " $new_libs " in
5330 *) new_libs="$new_libs $deplib" ;;
5333 *) new_libs="$new_libs $deplib" ;;
5338 # All the library-specific variables (install_libdir is set above).
5343 # Test again, we may have decided not to build it any more
5344 if test "$build_libtool_libs" = yes; then
5345 if test "$hardcode_into_libs" = yes; then
5346 # Hardcode the library paths
5349 rpath="$finalize_rpath"
5350 test "$mode" != relink && rpath="$compile_rpath$rpath"
5351 for libdir in $rpath; do
5352 if test -n "$hardcode_libdir_flag_spec"; then
5353 if test -n "$hardcode_libdir_separator"; then
5354 if test -z "$hardcode_libdirs"; then
5355 hardcode_libdirs="$libdir"
5357 # Just accumulate the unique libdirs.
5358 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
5359 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
5362 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
5367 eval flag=\"$hardcode_libdir_flag_spec\"
5368 dep_rpath="$dep_rpath $flag"
5370 elif test -n "$runpath_var"; then
5371 case "$perm_rpath " in
5373 *) perm_rpath="$perm_rpath $libdir" ;;
5377 # Substitute the hardcoded libdirs into the rpath.
5378 if test -n "$hardcode_libdir_separator" &&
5379 test -n "$hardcode_libdirs"; then
5380 libdir="$hardcode_libdirs"
5381 if test -n "$hardcode_libdir_flag_spec_ld"; then
5382 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
5384 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
5387 if test -n "$runpath_var" && test -n "$perm_rpath"; then
5388 # We should set the runpath_var.
5390 for dir in $perm_rpath; do
5393 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
5395 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
5398 shlibpath="$finalize_shlibpath"
5399 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
5400 if test -n "$shlibpath"; then
5401 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
5404 # Get the real and link names of the library.
5405 eval shared_ext=\"$shrext_cmds\"
5406 eval library_names=\"$library_names_spec\"
5407 set dummy $library_names
5412 if test -n "$soname_spec"; then
5413 eval soname=\"$soname_spec\"
5417 if test -z "$dlname"; then
5421 lib="$output_objdir/$realname"
5425 linknames="$linknames $link"
5428 # Use standard objects if they are pic
5429 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
5432 if test -n "$export_symbols" && test -n "$include_expsyms"; then
5433 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
5434 export_symbols="$output_objdir/$libname.uexp"
5435 delfiles="$delfiles $export_symbols"
5438 orig_export_symbols=
5441 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
5442 # exporting using user supplied symfile
5443 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
5444 # and it's NOT already a .def file. Must figure out
5445 # which of the given symbols are data symbols and tag
5446 # them as such. So, trigger use of export_symbols_cmds.
5447 # export_symbols gets reassigned inside the "prepare
5448 # the list of exported symbols" if statement, so the
5449 # include_expsyms logic still works.
5450 orig_export_symbols="$export_symbols"
5452 always_export_symbols=yes
5458 # Prepare the list of exported symbols
5459 if test -z "$export_symbols"; then
5460 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
5461 func_echo "generating symbol list for \`$libname.la'"
5462 export_symbols="$output_objdir/$libname.exp"
5463 $opt_dry_run || $RM $export_symbols
5464 cmds=$export_symbols_cmds
5465 save_ifs="$IFS"; IFS='~'
5466 for cmd in $cmds; do
5469 if len=`expr "X$cmd" : ".*"` &&
5470 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5471 func_show_eval "$cmd" 'exit $?'
5472 skipped_export=false
5474 # The command line is too long to execute in one step.
5475 func_echo "using reloadable object file for export list..."
5477 # Break out early, otherwise skipped_export may be
5478 # set to false by a later but shorter cmd.
5483 if test -n "$export_symbols_regex"; then
5484 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
5485 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
5490 if test -n "$export_symbols" && test -n "$include_expsyms"; then
5491 tmp_export_symbols="$export_symbols"
5492 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
5493 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
5496 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
5497 # The given exports_symbols file has to be filtered, so filter it.
5498 func_echo "filter symbol list for \`$libname.la' to tag DATA exports"
5499 # FIXME: $output_objdir/$libname.filter potentially contains lots of
5500 # 's' commands which not all seds can handle. GNU sed should be fine
5501 # though. Also, the filter scales superlinearly with the number of
5502 # global variables. join(1) would be nice here, but unfortunately
5503 # isn't a blessed tool.
5504 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
5505 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
5506 export_symbols=$output_objdir/$libname.def
5507 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
5511 for test_deplib in $deplibs; do
5512 case " $convenience " in
5513 *" $test_deplib "*) ;;
5515 tmp_deplibs="$tmp_deplibs $test_deplib"
5519 deplibs="$tmp_deplibs"
5521 if test -n "$convenience"; then
5522 if test -n "$whole_archive_flag_spec"; then
5523 save_libobjs=$libobjs
5524 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
5526 gentop="$output_objdir/${outputname}x"
5527 generated="$generated $gentop"
5529 func_extract_archives $gentop $convenience
5530 libobjs="$libobjs $func_extract_archives_result"
5534 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
5535 eval flag=\"$thread_safe_flag_spec\"
5536 linker_flags="$linker_flags $flag"
5539 # Make a backup of the uninstalled library when relinking
5540 if test "$mode" = relink; then
5541 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
5544 # Do each of the archive commands.
5545 if test "$module" = yes && test -n "$module_cmds" ; then
5546 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
5547 eval test_cmds=\"$module_expsym_cmds\"
5548 cmds=$module_expsym_cmds
5550 eval test_cmds=\"$module_cmds\"
5554 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
5555 eval test_cmds=\"$archive_expsym_cmds\"
5556 cmds=$archive_expsym_cmds
5558 eval test_cmds=\"$archive_cmds\"
5563 if test "X$skipped_export" != "X:" &&
5564 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5565 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5568 # The command line is too long to link in one step, link piecewise
5569 # or, if using GNU ld and skipped_export is not :, use a linker
5572 # Save the value of $output and $libobjs because we want to
5573 # use them later. If we have whole_archive_flag_spec, we
5574 # want to use save_libobjs as it was before
5575 # whole_archive_flag_spec was expanded, because we can't
5576 # assume the linker understands whole_archive_flag_spec.
5577 # This may have to be revisited, in case too many
5578 # convenience libraries get linked in and end up exceeding
5580 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
5581 save_libobjs=$libobjs
5584 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
5586 # Clear the reloadable object creation command queue and
5587 # initialize k to one.
5594 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
5595 output=${output_objdir}/${output_la}.lnkscript
5596 func_echo "creating GNU ld script: $output"
5597 $ECHO 'INPUT (' > $output
5598 for obj in $save_libobjs
5600 $ECHO \""$obj"\" >> $output
5602 $ECHO ')' >> $output
5603 delfiles="$delfiles $output"
5604 elif test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
5605 output=${output_objdir}/${output_la}.lnk
5606 func_echo "creating linker input file list: $output"
5608 for obj in $save_libobjs
5610 $ECHO "$obj" >> $output
5612 delfiles="$delfiles $output"
5613 output=\"$file_list_spec$output\"
5615 func_echo "creating reloadable object files..."
5616 output=$output_objdir/$output_la-${k}.$objext
5617 # Loop over the list of objects to be linked.
5618 for obj in $save_libobjs
5620 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
5621 if test "X$objlist" = X ||
5622 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5623 test "$len" -le "$max_cmd_len"; }; then
5624 objlist="$objlist $obj"
5626 # The command $test_cmds is almost too long, add a
5627 # command to the queue.
5628 if test "$k" -eq 1 ; then
5629 # The first file doesn't have a previous command to add.
5630 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
5632 # All subsequent reloadable object files will link in
5633 # the last one created.
5634 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
5636 last_robj=$output_objdir/$output_la-${k}.$objext
5638 output=$output_objdir/$output_la-${k}.$objext
5643 # Handle the remaining objects by creating one last
5644 # reloadable object file. All subsequent reloadable object
5645 # files will link in the last one created.
5646 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5647 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
5649 if ${skipped_export-false}; then
5650 func_echo "generating symbol list for \`$libname.la'"
5651 export_symbols="$output_objdir/$libname.exp"
5652 $opt_dry_run || $RM $export_symbols
5654 # Append the command to create the export file.
5655 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
5658 # Set up a command to remove the reloadable object files
5659 # after they are used.
5661 while test "$i" -lt "$k"
5664 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
5667 func_echo "creating a temporary reloadable object file: $output"
5669 # Loop through the commands generated above and execute them.
5670 save_ifs="$IFS"; IFS='~'
5671 for cmd in $concat_cmds; do
5674 func_quote_for_expand "$cmd"
5675 eval "func_echo $func_quote_for_expand_result"
5677 $opt_dry_run || eval "$cmd" || {
5680 # Restore the uninstalled library and exit
5681 if test "$mode" = relink; then
5682 ( cd "$output_objdir" && \
5683 $RM "${realname}T" && \
5684 $MV "${realname}U" "$realname" )
5694 # Restore the value of output.
5697 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
5698 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
5700 # Expand the library linking commands again to reset the
5701 # value of $libobjs for piecewise linking.
5703 # Do each of the archive commands.
5704 if test "$module" = yes && test -n "$module_cmds" ; then
5705 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
5706 cmds=$module_expsym_cmds
5711 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
5712 cmds=$archive_expsym_cmds
5719 if test -n "$delfiles"; then
5720 # Append the command to remove temporary files to $cmds.
5721 eval cmds=\"\$cmds~\$RM $delfiles\"
5724 # Add any objects from preloaded convenience libraries
5725 if test -n "$dlprefiles"; then
5726 gentop="$output_objdir/${outputname}x"
5727 generated="$generated $gentop"
5729 func_extract_archives $gentop $dlprefiles
5730 libobjs="$libobjs $func_extract_archives_result"
5733 save_ifs="$IFS"; IFS='~'
5734 for cmd in $cmds; do
5738 func_quote_for_expand "$cmd"
5739 eval "func_echo $func_quote_for_expand_result"
5741 $opt_dry_run || eval "$cmd" || {
5744 # Restore the uninstalled library and exit
5745 if test "$mode" = relink; then
5746 ( cd "$output_objdir" && \
5747 $RM "${realname}T" && \
5748 $MV "${realname}U" "$realname" )
5756 # Restore the uninstalled library and exit
5757 if test "$mode" = relink; then
5758 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
5760 if test -n "$convenience"; then
5761 if test -z "$whole_archive_flag_spec"; then
5762 func_show_eval '${RM}r "$gentop"'
5769 # Create links to the real library.
5770 for linkname in $linknames; do
5771 if test "$realname" != "$linkname"; then
5772 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
5776 # If -module or -export-dynamic was specified, set the dlname.
5777 if test "$module" = yes || test "$export_dynamic" = yes; then
5778 # On all known operating systems, these are identical.
5785 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
5786 func_warning "\`-dlopen' is ignored for objects"
5789 test -n "$deplibs" && \
5790 func_warning "\`-l' and \`-L' are ignored for objects"
5792 test -n "$rpath" && \
5793 func_warning "\`-rpath' is ignored for objects"
5795 test -n "$xrpath" && \
5796 func_warning "\`-R' is ignored for objects"
5798 test -n "$vinfo" && \
5799 func_warning "\`-version-info' is ignored for objects"
5801 test -n "$release" && \
5802 func_warning "\`-release' is ignored for objects"
5806 test -n "$objs$old_deplibs" && \
5807 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
5810 obj=`$ECHO "X$output" | $Xsed -e "$lo2o"`
5818 # Delete the old objects.
5819 $opt_dry_run || $RM $obj $libobj
5821 # Objects from convenience libraries. This assumes
5822 # single-version convenience libraries. Whenever we create
5823 # different ones for PIC/non-PIC, this we'll have to duplicate
5827 # reload_cmds runs $LD directly, so let us get rid of
5828 # -Wl from whole_archive_flag_spec and hope we can get by with
5829 # turning comma into space..
5832 if test -n "$convenience"; then
5833 if test -n "$whole_archive_flag_spec"; then
5834 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
5835 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
5837 gentop="$output_objdir/${obj}x"
5838 generated="$generated $gentop"
5840 func_extract_archives $gentop $convenience
5841 reload_conv_objs="$reload_objs $func_extract_archives_result"
5845 # Create the old-style object.
5846 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
5849 func_execute_cmds "$reload_cmds" 'exit $?'
5851 # Exit if we aren't doing a library object file.
5852 if test -z "$libobj"; then
5853 if test -n "$gentop"; then
5854 func_show_eval '${RM}r "$gentop"'
5860 if test "$build_libtool_libs" != yes; then
5861 if test -n "$gentop"; then
5862 func_show_eval '${RM}r "$gentop"'
5865 # Create an invalid libtool object if no PIC, so that we don't
5866 # accidentally link it into a program.
5867 # $show "echo timestamp > $libobj"
5868 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
5872 if test -n "$pic_flag" || test "$pic_mode" != default; then
5873 # Only do commands if we really have different PIC objects.
5874 reload_objs="$libobjs $reload_conv_objs"
5876 func_execute_cmds "$reload_cmds" 'exit $?'
5879 if test -n "$gentop"; then
5880 func_show_eval '${RM}r "$gentop"'
5888 *cygwin*) func_stripname '' '.exe' "$output"
5889 output=$func_stripname_result.exe;;
5891 test -n "$vinfo" && \
5892 func_warning "\`-version-info' is ignored for programs"
5894 test -n "$release" && \
5895 func_warning "\`-release' is ignored for programs"
5897 test "$preload" = yes \
5898 && test "$dlopen_support" = unknown \
5899 && test "$dlopen_self" = unknown \
5900 && test "$dlopen_self_static" = unknown && \
5901 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
5904 *-*-rhapsody* | *-*-darwin1.[012])
5905 # On Rhapsody replace the C library is the System framework
5906 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
5907 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
5913 # Don't allow lazy linking, it breaks C++ global constructors
5914 # But is supposedly fixed on 10.4 or later (yay!).
5915 if test "$tagname" = CXX ; then
5916 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
5918 compile_command="$compile_command ${wl}-bind_at_load"
5919 finalize_command="$finalize_command ${wl}-bind_at_load"
5923 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
5924 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5925 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5930 # move library search paths that coincide with paths to not yet
5931 # installed libraries to the beginning of the library search list
5933 for path in $notinst_path; do
5934 case " $new_libs " in
5935 *" -L$path/$objdir "*) ;;
5937 case " $compile_deplibs " in
5938 *" -L$path/$objdir "*)
5939 new_libs="$new_libs -L$path/$objdir" ;;
5944 for deplib in $compile_deplibs; do
5947 case " $new_libs " in
5949 *) new_libs="$new_libs $deplib" ;;
5952 *) new_libs="$new_libs $deplib" ;;
5955 compile_deplibs="$new_libs"
5958 compile_command="$compile_command $compile_deplibs"
5959 finalize_command="$finalize_command $finalize_deplibs"
5961 if test -n "$rpath$xrpath"; then
5962 # If the user specified any rpath flags, then add them.
5963 for libdir in $rpath $xrpath; do
5964 # This is the magic to use -rpath.
5965 case "$finalize_rpath " in
5967 *) finalize_rpath="$finalize_rpath $libdir" ;;
5972 # Now hardcode the library paths
5975 for libdir in $compile_rpath $finalize_rpath; do
5976 if test -n "$hardcode_libdir_flag_spec"; then
5977 if test -n "$hardcode_libdir_separator"; then
5978 if test -z "$hardcode_libdirs"; then
5979 hardcode_libdirs="$libdir"
5981 # Just accumulate the unique libdirs.
5982 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
5983 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
5986 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
5991 eval flag=\"$hardcode_libdir_flag_spec\"
5992 rpath="$rpath $flag"
5994 elif test -n "$runpath_var"; then
5995 case "$perm_rpath " in
5997 *) perm_rpath="$perm_rpath $libdir" ;;
6001 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
6002 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
6003 case :$dllsearchpath: in
6005 *) dllsearchpath="$dllsearchpath:$libdir";;
6007 case :$dllsearchpath: in
6008 *":$testbindir:"*) ;;
6009 *) dllsearchpath="$dllsearchpath:$testbindir";;
6014 # Substitute the hardcoded libdirs into the rpath.
6015 if test -n "$hardcode_libdir_separator" &&
6016 test -n "$hardcode_libdirs"; then
6017 libdir="$hardcode_libdirs"
6018 eval rpath=\" $hardcode_libdir_flag_spec\"
6020 compile_rpath="$rpath"
6024 for libdir in $finalize_rpath; do
6025 if test -n "$hardcode_libdir_flag_spec"; then
6026 if test -n "$hardcode_libdir_separator"; then
6027 if test -z "$hardcode_libdirs"; then
6028 hardcode_libdirs="$libdir"
6030 # Just accumulate the unique libdirs.
6031 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6032 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6035 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6040 eval flag=\"$hardcode_libdir_flag_spec\"
6041 rpath="$rpath $flag"
6043 elif test -n "$runpath_var"; then
6044 case "$finalize_perm_rpath " in
6046 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
6050 # Substitute the hardcoded libdirs into the rpath.
6051 if test -n "$hardcode_libdir_separator" &&
6052 test -n "$hardcode_libdirs"; then
6053 libdir="$hardcode_libdirs"
6054 eval rpath=\" $hardcode_libdir_flag_spec\"
6056 finalize_rpath="$rpath"
6058 if test -n "$libobjs" && test "$build_old_libs" = yes; then
6059 # Transform all the library objects into standard objects.
6060 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6061 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6064 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
6066 # template prelinking step
6067 if test -n "$prelink_cmds"; then
6068 func_execute_cmds "$prelink_cmds" 'exit $?'
6071 wrappers_required=yes
6073 *cygwin* | *mingw* )
6074 if test "$build_libtool_libs" != yes; then
6075 wrappers_required=no
6079 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
6080 wrappers_required=no
6084 if test "$wrappers_required" = no; then
6085 # Replace the output file specification.
6086 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
6087 link_command="$compile_command$compile_rpath"
6089 # We have no uninstalled library dependencies, so finalize right now.
6091 func_show_eval "$link_command" 'exit_status=$?'
6093 # Delete the generated files.
6094 if test -f "$output_objdir/${outputname}S.${objext}"; then
6095 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
6101 if test -n "$compile_shlibpath$finalize_shlibpath"; then
6102 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
6104 if test -n "$finalize_shlibpath"; then
6105 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
6110 if test -n "$runpath_var"; then
6111 if test -n "$perm_rpath"; then
6112 # We should set the runpath_var.
6114 for dir in $perm_rpath; do
6117 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
6119 if test -n "$finalize_perm_rpath"; then
6120 # We should set the runpath_var.
6122 for dir in $finalize_perm_rpath; do
6125 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
6129 if test "$no_install" = yes; then
6130 # We don't need to create a wrapper script.
6131 link_command="$compile_var$compile_command$compile_rpath"
6132 # Replace the output file specification.
6133 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
6134 # Delete the old output file.
6135 $opt_dry_run || $RM $output
6136 # Link the executable and exit
6137 func_show_eval "$link_command" 'exit $?'
6141 if test "$hardcode_action" = relink; then
6142 # Fast installation is not supported
6143 link_command="$compile_var$compile_command$compile_rpath"
6144 relink_command="$finalize_var$finalize_command$finalize_rpath"
6146 func_warning "this platform does not like uninstalled shared libraries"
6147 func_warning "\`$output' will be relinked during installation"
6149 if test "$fast_install" != no; then
6150 link_command="$finalize_var$compile_command$finalize_rpath"
6151 if test "$fast_install" = yes; then
6152 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
6154 # fast_install is set to needless
6158 link_command="$compile_var$compile_command$compile_rpath"
6159 relink_command="$finalize_var$finalize_command$finalize_rpath"
6163 # Replace the output file specification.
6164 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
6166 # Delete the old output files.
6167 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
6169 func_show_eval "$link_command" 'exit $?'
6171 # Now create the wrapper script.
6172 func_echo "creating $output"
6174 # Quote the relink command for shipping.
6175 if test -n "$relink_command"; then
6176 # Preserve any variables that may affect compiler behavior
6177 for var in $variables_saved_for_relink; do
6178 if eval test -z \"\${$var+set}\"; then
6179 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
6180 elif eval var_value=\$$var; test -z "$var_value"; then
6181 relink_command="$var=; export $var; $relink_command"
6183 func_quote_for_eval "$var_value"
6184 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
6187 relink_command="(cd `pwd`; $relink_command)"
6188 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
6191 # Quote $ECHO for shipping.
6192 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
6194 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
6195 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
6197 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
6199 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
6202 # Only actually do things if not in dry run mode.
6204 # win32 will think the script is a binary if it has
6205 # a .exe suffix, so we strip it off here.
6207 *.exe) func_stripname '' '.exe' "$output"
6208 output=$func_stripname_result ;;
6210 # test for cygwin because mv fails w/o .exe extensions
6214 func_stripname '' '.exe' "$outputname"
6215 outputname=$func_stripname_result ;;
6219 *cygwin* | *mingw* )
6220 output_name=`basename $output`
6221 output_path=`dirname $output`
6222 cwrappersource="$output_path/$objdir/lt-$output_name.c"
6223 cwrapper="$output_path/$output_name.exe"
6224 $RM $cwrappersource $cwrapper
6225 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
6227 cat > $cwrappersource <<EOF
6229 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
6230 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
6232 The $output program cannot be directly executed until all the libtool
6233 libraries that it depends on are installed.
6235 This wrapper executable should never be moved out of the build directory.
6236 If it is, it will not operate correctly.
6238 Currently, it simply execs the wrapper *script* "/bin/sh $output",
6239 but could eventually absorb all of the scripts functionality and
6240 exec $objdir/$outputname directly.
6243 cat >> $cwrappersource<<"EOF"
6252 #include <sys/stat.h>
6254 #if defined(PATH_MAX)
6255 # define LT_PATHMAX PATH_MAX
6256 #elif defined(MAXPATHLEN)
6257 # define LT_PATHMAX MAXPATHLEN
6259 # define LT_PATHMAX 1024
6262 #ifndef DIR_SEPARATOR
6263 # define DIR_SEPARATOR '/'
6264 # define PATH_SEPARATOR ':'
6267 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
6269 # define HAVE_DOS_BASED_FILE_SYSTEM
6270 # ifndef DIR_SEPARATOR_2
6271 # define DIR_SEPARATOR_2 '\\'
6273 # ifndef PATH_SEPARATOR_2
6274 # define PATH_SEPARATOR_2 ';'
6278 #ifndef DIR_SEPARATOR_2
6279 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
6280 #else /* DIR_SEPARATOR_2 */
6281 # define IS_DIR_SEPARATOR(ch) \
6282 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
6283 #endif /* DIR_SEPARATOR_2 */
6285 #ifndef PATH_SEPARATOR_2
6286 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
6287 #else /* PATH_SEPARATOR_2 */
6288 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
6289 #endif /* PATH_SEPARATOR_2 */
6291 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
6292 #define XFREE(stale) do { \
6293 if (stale) { free ((void *) stale); stale = 0; } \