1 # Generated from ltmain.m4sh.
3 # ltmain.sh (GNU libtool) 2.2
4 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
7 # This is free software; see the source for copying conditions. There is NO
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # GNU Libtool is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # As a special exception to the GNU General Public License,
16 # if you distribute this file as part of a program or library that
17 # is built using GNU Libtool, you may include this file under the
18 # same distribution terms that you use for the rest of that program.
20 # GNU Libtool is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with GNU Libtool; see the file COPYING. If not, a copy
27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
28 # or obtained by writing to the Free Software Foundation, Inc.,
29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 # Usage: $progname [OPTION]... [MODE-ARG]...
33 # Provide generalized library-building support services.
35 # --config show all configuration variables
36 # --debug enable verbose shell tracing
37 # -n, --dry-run display commands without modifying any files
38 # --features display basic configuration information and exit
39 # --mode=MODE use operation mode MODE
40 # --preserve-dup-deps don't remove duplicate dependency libraries
41 # --quiet, --silent don't print informational messages
42 # --tag=TAG use configuration variables from tag TAG
43 # -v, --verbose print informational messages (default)
44 # --version print version information
45 # -h, --help print short or long help message
47 # MODE must be one of the following:
49 # clean remove files from the build directory
50 # compile compile a source file into a libtool object
51 # execute automatically set library path, then run a program
52 # finish complete the installation of libtool libraries
53 # install install libraries or executables
54 # link create a library or an executable
55 # uninstall remove libraries from an installed directory
57 # MODE-ARGS vary depending on the MODE.
58 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
60 # When reporting a bug, please describe a test case to reproduce it and
61 # include the following information:
66 # compiler flags: $LTCFLAGS
67 # linker: $LD (gnu? $with_gnu_ld)
68 # $progname: (GNU libtool) 2.2
69 # automake: $automake_version
70 # autoconf: $autoconf_version
72 # Report bugs to <bug-libtool@gnu.org>.
78 package_revision=1.2599
80 # Be Bourne compatible
81 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
84 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
85 # is contrary to our usage. Disable this feature.
86 alias -g '${1+"$@"}'='"$@"'
89 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
91 BIN_SH=xpg4; export BIN_SH # for Tru64
92 DUALCASE=1; export DUALCASE # for MKS sh
94 # NLS nuisances: We save the old values to restore during execute mode.
95 # Only set LANG and LC_ALL to C if already set.
96 # These must not be set unconditionally because not all systems understand
97 # e.g. LANG=C (notably SCO).
98 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
100 eval "if test \"\${$lt_var+set}\" = set; then
101 save_$lt_var=\$$lt_var
115 : ${EGREP="/usr/bin/grep -E"}
116 : ${FGREP="/usr/bin/grep -F"}
117 : ${GREP="/usr/bin/grep"}
123 : ${SED="/usr/bin/sed"}
124 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
125 : ${Xsed="$SED -e 1s/^X//"}
130 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
131 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
133 exit_status=$EXIT_SUCCESS
135 # Make sure IFS has a sensible default
140 dirname="s,/[^/]*$,,"
143 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
144 # is ksh but when the shell is invoked as "sh" and the current value of
145 # the _XPG environment variable is not equal to 1 (one), the special
146 # positional parameter $0, within a function call, is the name of the
150 # The name of this program:
151 # In the unlikely event $progname began with a '-', it would play havoc with
152 # func_echo (imagine progname=-n), so we prepend ./ in that case:
153 progname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'`
155 # Make sure we have an absolute path for reexecution:
157 [\\/]*|[A-Za-z]:\\*) ;;
159 progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"`
160 progdir=`cd "$progdir" && pwd`
161 progpath="$progdir/$progname"
166 for progdir in $PATH; do
168 test -x "$progdir/$progname" && break
171 test -n "$progdir" || progdir=`pwd`
172 progpath="$progdir/$progname"
176 # Sed substitution that helps us do robust quoting. It backslashifies
177 # metacharacters that are still active within double-quoted strings.
178 Xsed="${SED}"' -e 1s/^X//'
179 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
181 # Same as above, but do not quote variable references.
182 double_quote_subst='s/\(["`\\]\)/\\\1/g'
184 # Re-`\' parameter expansions in output of double_quote_subst that were
185 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
186 # in input to double_quote_subst, that '$' was protected from expansion.
187 # Since each input `\' is now two `\'s, look for any number of runs of
188 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
193 sed_double_backslash="\
197 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
207 # Echo program name prefixed message, along with the current mode
208 # name if it has been set yet.
211 $ECHO "$progname${mode+: }$mode: $*"
214 # func_verbose arg...
215 # Echo program name prefixed message in verbose mode only.
218 $opt_verbose && func_echo ${1+"$@"}
220 # A bug in bash halts the script if the last line of a function
221 # fails when set -e is in force, so we need another command to
227 # Echo program name prefixed message to standard error.
230 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
233 # func_warning arg...
234 # Echo program name prefixed warning message to standard error.
237 $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
240 # func_fatal_error arg...
241 # Echo program name prefixed message to standard error, and exit.
248 # func_fatal_help arg...
249 # Echo program name prefixed message to standard error, followed by
250 # a help hint, and exit.
254 func_fatal_error "$help"
256 help="Try \`$progname --help' for more information." ## default
259 # func_grep expression filename
260 # Check whether EXPRESSION matches any line of FILENAME, without output.
263 $GREP "$1" "$2" >/dev/null 2>&1
267 # func_mkdir_p directory-path
268 # Make sure the entire path to DIRECTORY-PATH is available.
271 my_directory_path="$1"
274 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
276 # Protect directory names starting with `-'
277 case $my_directory_path in
278 -*) my_directory_path="./$my_directory_path" ;;
281 # While some portion of DIR does not yet exist...
282 while test ! -d "$my_directory_path"; do
283 # ...make a list in topmost first order. Use a colon delimited
284 # list incase some portion of path contains whitespace.
285 my_dir_list="$my_directory_path:$my_dir_list"
287 # If the last portion added has no slash in it, the list is done
288 case $my_directory_path in */*) ;; *) break ;; esac
290 # ...otherwise throw away the child directory and loop
291 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
293 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
295 save_mkdir_p_IFS="$IFS"; IFS=':'
296 for my_dir in $my_dir_list; do
297 IFS="$save_mkdir_p_IFS"
298 # mkdir can fail with a `File exist' error if two processes
299 # try to create one of the directories concurrently. Don't
301 $MKDIR "$my_dir" 2>/dev/null || :
303 IFS="$save_mkdir_p_IFS"
305 # Bail out if we (or some other process) failed to create a directory.
306 test -d "$my_directory_path" || \
307 func_fatal_error "Failed to create \`$1'"
312 # func_mktempdir [string]
313 # Make a temporary directory that won't clash with other running
314 # libtool processes, and avoids race conditions if possible. If
315 # given, STRING is the basename for that directory.
318 my_template="${TMPDIR-/tmp}/${1-$progname}"
320 if test "$opt_dry_run" = ":"; then
321 # Return a directory name, but don't create it in dry-run mode
322 my_tmpdir="${my_template}-$$"
325 # If mktemp works, use that first and foremost
326 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
328 if test ! -d "$my_tmpdir"; then
329 # Failing that, at least try and use $RANDOM to avoid a race
330 my_tmpdir="${my_template}-${RANDOM-0}$$"
332 save_mktempdir_umask=`umask`
335 umask $save_mktempdir_umask
338 # If we're not in dry-run mode, bomb out on failure
339 test -d "$my_tmpdir" || \
340 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
343 $ECHO "X$my_tmpdir" | $Xsed
347 # func_quote_for_eval arg
348 # Aesthetically quote ARG to be evaled later.
349 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
350 # is double-quoted, suitable for a subsequent eval, whereas
351 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
352 # which are still active within double quotes backslashified.
353 func_quote_for_eval ()
357 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
359 func_quote_for_eval_unquoted_result="$1" ;;
362 case $func_quote_for_eval_unquoted_result in
363 # Double-quote args containing shell metacharacters to delay
364 # word splitting, command substitution and and variable
365 # expansion for a subsequent eval.
366 # Many Bourne shells cannot handle close brackets correctly
367 # in scan sets, so we specify it separately.
368 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
369 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
372 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
377 # func_quote_for_expand arg
378 # Aesthetically quote ARG to be evaled later; same as above,
379 # but do not quote variable references.
380 func_quote_for_expand ()
384 my_arg=`$ECHO "X$1" | $Xsed \
385 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
391 # Double-quote args containing shell metacharacters to delay
392 # word splitting and command substitution for a subsequent eval.
393 # Many Bourne shells cannot handle close brackets correctly
394 # in scan sets, so we specify it separately.
395 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
400 func_quote_for_expand_result="$my_arg"
404 # func_show_eval cmd [fail_exp]
405 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
406 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
407 # is given, then evaluate it.
413 ${opt_silent-false} || {
414 func_quote_for_expand "$my_cmd"
415 eval "func_echo $func_quote_for_expand_result"
418 if ${opt_dry_run-false}; then :; else
421 if test "$my_status" -eq 0; then :; else
422 eval "(exit $my_status); $my_fail_exp"
432 # Echo version message to standard output and exit.
435 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
438 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
445 # Echo short help message to standard output and exit.
448 $SED -n '/^# Usage:/,/# -h/ {
451 s/\$progname/'$progname'/
455 $ECHO "run \`$progname --help | more' for full usage"
460 # Echo long help message to standard output and exit.
463 $SED -n '/^# Usage:/,/# Report bugs to/ {
466 s*\$progname*'$progname'*
468 s*\$SHELL*'"$SHELL"'*
470 s*\$LTCFLAGS*'"$LTCFLAGS"'*
472 s/\$with_gnu_ld/'"$with_gnu_ld"'/
473 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
474 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
480 # func_missing_arg argname
481 # Echo program name prefixed message to standard error and set global
485 func_error "missing argument for $1"
495 # Check that we have a working $ECHO.
496 if test "X$1" = X--no-reexec; then
497 # Discard the --no-reexec flag, and continue.
499 elif test "X$1" = X--fallback-echo; then
500 # Avoid inline document here, it may be left over
502 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
503 # Yippee, $ECHO works!
506 # Restart under the correct shell, and then maybe $ECHO will work.
507 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
510 if test "X$1" = X--fallback-echo; then
511 # used as fallback echo
519 magic="%%%MAGIC variable%%%"
520 magic_exe="%%%MAGIC EXE variable%%%"
527 lo2o="s/\\.lo\$/.${objext}/"
528 o2lo="s/\\.${objext}\$/.lo/"
533 opt_duplicate_deps=false
537 # If this variable is set in any of the actions, the command in it
538 # will be execed at the end. This prevents here-documents from being
539 # left over by shells.
542 # func_fatal_configuration arg...
543 # Echo program name prefixed message to standard error, followed by
544 # a configuration failure hint, and exit.
545 func_fatal_configuration ()
548 func_error "See the $PACKAGE documentation for more information."
549 func_fatal_error "Fatal configuration error."
554 # Display the configuration for all the tags in this script.
557 re_begincf='^# ### BEGIN LIBTOOL'
558 re_endcf='^# ### END LIBTOOL'
560 # Default configuration.
561 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
563 # Now print the configurations for the tags.
564 for tagname in $taglist; do
565 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
572 # Display the features supported by this script.
576 if test "$build_libtool_libs" = yes; then
577 $ECHO "enable shared libraries"
579 $ECHO "disable shared libraries"
581 if test "$build_old_libs" = yes; then
582 $ECHO "enable static libraries"
584 $ECHO "disable static libraries"
590 # func_enable_tag tagname
591 # Verify that TAGNAME is valid, and either flag an error and exit, or
592 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
599 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
600 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
601 sed_extractcf="/$re_begincf/,/$re_endcf/p"
606 func_fatal_error "invalid tag name: $tagname"
610 # Don't test for the "default" C tag, as we know it's
611 # there but not specially marked.
615 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
616 taglist="$taglist $tagname"
618 # Evaluate the configuration. Be careful to quote the path
619 # and the sed script, to avoid splitting on whitespace, but
620 # also don't use non-portable quotes within backquotes within
621 # quotes we have to do it in 2 steps:
622 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
625 func_error "ignoring unknown tag $tagname"
634 # We need to display help for each of the modes.
637 # Generic help is extracted from the usage comments
638 # at the start of this file.
644 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
646 Remove files from the build directory.
648 RM is the name of the program to use to delete files associated with each FILE
649 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
652 If FILE is a libtool library, object or program, all the files associated
653 with it are deleted. Otherwise, only FILE itself is deleted using RM."
658 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
660 Compile a source file into a libtool library object.
662 This mode accepts the following additional options:
664 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
665 -no-suppress do not suppress compiler output for multiple passes
666 -prefer-pic try to building PIC objects only
667 -prefer-non-pic try to building non-PIC objects only
668 -shared do not build a \`.o' file suitable for static linking
669 -static only build a \`.o' file suitable for static linking
671 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
672 from the given SOURCEFILE.
674 The output file name is determined by removing the directory component from
675 SOURCEFILE, then substituting the C source code suffix \`.c' with the
676 library object suffix, \`.lo'."
681 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
683 Automatically set library path, then run a program.
685 This mode accepts the following additional options:
687 -dlopen FILE add the directory containing FILE to the library path
689 This mode sets the library path environment variable according to \`-dlopen'
692 If any of the ARGS are libtool executable wrappers, then they are translated
693 into their corresponding uninstalled binary, and any of their required library
694 directories are added to the library path.
696 Then, COMMAND is executed, with ARGS as arguments."
701 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
703 Complete the installation of libtool libraries.
705 Each LIBDIR is a directory that contains libtool libraries.
707 The commands that this mode executes may require superuser privileges. Use
708 the \`--dry-run' option if you just want to see what would be executed."
713 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
715 Install executables or libraries.
717 INSTALL-COMMAND is the installation command. The first component should be
718 either the \`install' or \`cp' program.
720 The following components of INSTALL-COMMAND are treated specially:
722 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
724 The rest of the components are interpreted as arguments to that command (only
725 BSD-compatible install options are recognized)."
730 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
732 Link object files or libraries together to form another library, or to
733 create an executable program.
735 LINK-COMMAND is a command using the C compiler that you would use to create
736 a program from several object files.
738 The following components of LINK-COMMAND are treated specially:
740 -all-static do not do any dynamic linking at all
741 -avoid-version do not add a version suffix if possible
742 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
743 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
744 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
745 -export-symbols SYMFILE
746 try to export only the symbols listed in SYMFILE
747 -export-symbols-regex REGEX
748 try to export only the symbols matching REGEX
749 -LLIBDIR search LIBDIR for required installed libraries
750 -lNAME OUTPUT-FILE requires the installed library libNAME
751 -module build a library that can dlopened
752 -no-fast-install disable the fast-install mode
753 -no-install link a not-installable executable
754 -no-undefined declare that a library does not refer to external symbols
755 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
756 -objectlist FILE Use a list of object files found in FILE to specify objects
757 -precious-files-regex REGEX
758 don't remove output files matching REGEX
759 -release RELEASE specify package release information
760 -rpath LIBDIR the created library will eventually be installed in LIBDIR
761 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
762 -shared only do dynamic linking of libtool libraries
763 -shrext SUFFIX override the standard shared library file extension
764 -static do not do any dynamic linking of uninstalled libtool libraries
766 do not do any dynamic linking of libtool libraries
767 -version-info CURRENT[:REVISION[:AGE]]
768 specify library version info [each variable defaults to 0]
769 -weak LIBNAME declare that the target provides the LIBNAME interface
771 All other options (arguments beginning with \`-') are ignored.
773 Every other argument is treated as a filename. Files ending in \`.la' are
774 treated as uninstalled libtool libraries, other files are standard or library
777 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
778 only library objects (\`.lo' files) may be specified, and \`-rpath' is
779 required, except when creating a convenience library.
781 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
782 using \`ar' and \`ranlib', or on Windows using \`lib'.
784 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
785 is created, otherwise an executable program is created."
790 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
792 Remove libraries from an installation directory.
794 RM is the name of the program to use to delete files associated with each FILE
795 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
798 If FILE is a libtool library, all the files associated with it are deleted.
799 Otherwise, only FILE itself is deleted using RM."
803 func_fatal_help "invalid operation mode \`$mode'"
808 $ECHO "Try \`$progname --help' for more information about other modes."
813 # Generated shell functions inserted here.
816 # Parse options once, thoroughly. This comes as soon as possible in
817 # the script to make things like `libtool --version' happen quickly.
820 # Shorthand for --mode=foo, only valid as the first argument
823 shift; set dummy --mode clean ${1+"$@"}; shift
825 compile|compil|compi|comp|com|co|c)
826 shift; set dummy --mode compile ${1+"$@"}; shift
828 execute|execut|execu|exec|exe|ex|e)
829 shift; set dummy --mode execute ${1+"$@"}; shift
831 finish|finis|fini|fin|fi|f)
832 shift; set dummy --mode finish ${1+"$@"}; shift
834 install|instal|insta|inst|ins|in|i)
835 shift; set dummy --mode install ${1+"$@"}; shift
838 shift; set dummy --mode link ${1+"$@"}; shift
840 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
841 shift; set dummy --mode uninstall ${1+"$@"}; shift
845 # Parse non-mode specific arguments:
846 while test "$#" -gt 0; do
851 --config) func_config ;;
853 --debug) preserve_args="$preserve_args $opt"
854 func_echo "enabling shell trace mode"
859 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
860 execute_dlfiles="$execute_dlfiles $1"
864 --dry-run | -n) opt_dry_run=: ;;
865 --features) func_features ;;
866 --finish) mode="finish" ;;
868 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
870 # Valid mode arguments:
880 # Catch anything else as an error
881 *) func_error "invalid argument for $opt"
892 opt_duplicate_deps=: ;;
894 --quiet|--silent) preserve_args="$preserve_args $opt"
898 --verbose| -v) preserve_args="$preserve_args $opt"
902 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
903 preserve_args="$preserve_args $opt $1"
904 func_enable_tag "$1" # tagname is set here
908 # Separate optargs to long options:
909 -dlopen=*|--mode=*|--tag=*)
910 func_opt_split "$opt"
911 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
915 -\?|-h) func_usage ;;
916 --help) opt_help=: ;;
917 --version) func_version ;;
919 -*) func_fatal_help "unrecognized option \`$opt'" ;;
927 # Now that we've collected a possible --mode arg, show help if necessary
928 $opt_help && func_mode_help
931 *cygwin* | *mingw* | *pw32*)
932 # don't eliminate duplications in $postdeps and $predeps
933 opt_duplicate_compiler_generated_deps=:
936 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
940 # Having warned about all mis-specified options, bail out if
941 # anything was wrong.
942 $exit_cmd $EXIT_FAILURE
945 # func_check_version_match
946 # Ensure that we are using m4 macros, and libtool script from the same
947 # release of libtool.
948 func_check_version_match ()
950 if test "$package_revision" != "$macro_revision"; then
951 if test "$VERSION" != "$macro_version"; then
952 if test -z "$macro_version"; then
954 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
955 $progname: definition of this LT_INIT comes from an older release.
956 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
957 $progname: and run autoconf again.
961 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
962 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
963 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
964 $progname: and run autoconf again.
969 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
970 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
971 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
972 $progname: of $PACKAGE $VERSION and run autoconf again.
986 # Sanity checks first:
987 func_check_version_match
989 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
990 func_fatal_configuration "not configured to build any kind of library"
993 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
997 eval std_shrext=\"$shrext_cmds\"
1000 # Only execute mode is allowed to have -dlopen flags.
1001 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1002 func_error "unrecognized option \`-dlopen'"
1007 # Change the help message to a mode-specific one.
1008 generic_help="$help"
1009 help="Try \`$progname --help --mode=$mode' for more information."
1014 # True iff FILE is a libtool `.la' library or `.lo' object file.
1015 # This function is only a basic sanity check; it will hardly flush out
1016 # determined imposters.
1019 $SED -e 4q "$1" 2>/dev/null \
1020 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1023 # func_lalib_unsafe_p file
1024 # True iff FILE is a libtool `.la' library or `.lo' object file.
1025 # This function implements the same check as func_lalib_p without
1026 # resorting to external programs. To this end, it redirects stdin and
1027 # closes it afterwards, without saving the original file descriptor.
1028 # As a safety measure, use it only where a negative result would be
1029 # fatal anyway. Works if `file' does not exist.
1030 func_lalib_unsafe_p ()
1033 if test -r "$1" && exec 5<&1 <"$1"; then
1034 for lalib_p_l in 1 2 3 4
1037 case "$lalib_p_line" in
1038 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1043 test "$lalib_p" = yes
1046 # func_ltwrapper_script_p file
1047 # True iff FILE is a libtool wrapper script
1048 # This function is only a basic sanity check; it will hardly flush out
1049 # determined imposters.
1050 func_ltwrapper_script_p ()
1055 # func_ltwrapper_executable_p file
1056 # True iff FILE is a libtool wrapper executable
1057 # This function is only a basic sanity check; it will hardly flush out
1058 # determined imposters.
1059 func_ltwrapper_executable_p ()
1061 func_ltwrapper_exec_suffix=
1064 *) func_ltwrapper_exec_suffix=.exe ;;
1066 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1069 # func_ltwrapper_scriptname file
1070 # Assumes file is an ltwrapper_executable
1071 # uses $file to determine the appropriate filename for a
1072 # temporary ltwrapper_script.
1073 func_ltwrapper_scriptname ()
1075 func_ltwrapper_scriptname_result=""
1076 if func_ltwrapper_executable_p "$1"; then
1077 func_dirname_and_basename "$1" "" "."
1078 func_stripname '' '.exe' "$func_basename_result"
1079 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1083 # func_ltwrapper_p file
1084 # True iff FILE is a libtool wrapper script or wrapper executable
1085 # This function is only a basic sanity check; it will hardly flush out
1086 # determined imposters.
1089 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1093 # func_execute_cmds commands fail_cmd
1094 # Execute tilde-delimited COMMANDS.
1095 # If FAIL_CMD is given, eval that upon failure.
1096 # FAIL_CMD may read-access the current command in variable CMD!
1097 func_execute_cmds ()
1100 save_ifs=$IFS; IFS='~'
1104 func_show_eval "$cmd" "${2-:}"
1111 # Source FILE, adding directory component if necessary.
1112 # Note that it is not necessary on cygwin/mingw to append a dot to
1113 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1114 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1115 # `FILE.' does not work on cygwin managed mounts.
1120 */* | *\\*) . "$1" ;;
1126 # func_win32_libid arg
1127 # return the library type of file 'arg'
1129 # Need a lot of goo to handle *both* DLLs and import libs
1130 # Has to be a shell function in order to 'eat' the argument
1131 # that is supplied when $file_magic_command is called.
1135 win32_libid_type="unknown"
1136 win32_fileres=`file -L $1 2>/dev/null`
1137 case $win32_fileres in
1138 *ar\ archive\ import\ library*) # definitely import
1139 win32_libid_type="x86 archive import"
1141 *ar\ archive*) # could be an import, or static
1142 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
1143 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1144 win32_nmres=`eval $NM -f posix -A $1 |
1153 case $win32_nmres in
1154 import*) win32_libid_type="x86 archive import";;
1155 *) win32_libid_type="x86 archive static";;
1160 win32_libid_type="x86 DLL"
1162 *executable*) # but shell scripts are "executable" too...
1163 case $win32_fileres in
1164 *MS\ Windows\ PE\ Intel*)
1165 win32_libid_type="x86 DLL"
1170 $ECHO "$win32_libid_type"
1175 # func_infer_tag arg
1176 # Infer tagged configuration to use if any are available and
1177 # if one wasn't chosen via the "--tag" command line option.
1178 # Only attempt this if the compiler in the base compile
1179 # command doesn't match the default compiler.
1180 # arg is usually of the form 'gcc ...'
1184 if test -n "$available_tags" && test -z "$tagname"; then
1187 func_quote_for_eval "$arg"
1188 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1191 # Blanks in the command may have been stripped by the calling shell,
1192 # but not from the CC environment variable when configure was run.
1193 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1194 # Blanks at the start of $base_compile will cause this to fail
1195 # if we don't check for them as well.
1197 for z in $available_tags; do
1198 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1199 # Evaluate the configuration.
1200 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1203 # Double-quote args containing other shell metacharacters.
1204 func_quote_for_eval "$arg"
1205 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1208 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1209 # The compiler in the base compile command matches
1210 # the one in the tagged configuration.
1211 # Assume this is the tagged configuration we want.
1218 # If $tagname still isn't set, then no tagged configuration
1219 # was found and let the user know that the "--tag" command
1220 # line option must be used.
1221 if test -z "$tagname"; then
1222 func_echo "unable to infer tagged configuration"
1223 func_fatal_error "specify a tag with \`--tag'"
1225 # func_verbose "using $tagname tagged configuration"
1234 # func_generate_dlsyms outputname originator pic_p
1235 # Extract symbols from dlprefiles and create ${outputname}S.o with
1236 # a dlpreopen symbol table.
1237 func_generate_dlsyms ()
1243 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
1246 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1247 if test -n "$NM" && test -n "$global_symbol_pipe"; then
1248 my_dlsyms="${my_outputname}S.c"
1250 func_error "not configured to extract global symbols from dlpreopened files"
1254 if test -n "$my_dlsyms"; then
1258 # Discover the nlist of each of the dlfiles.
1259 nlist="$output_objdir/${my_outputname}.nm"
1261 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
1263 # Parse the name list into a source file.
1264 func_verbose "creating $output_objdir/$my_dlsyms"
1266 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
1267 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
1268 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
1274 /* External symbol declarations for the compiler. */\
1277 if test "$dlself" = yes; then
1278 func_verbose "generating symbol list for \`$output'"
1280 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
1282 # Add our own program objects to the symbol list.
1283 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1284 for progfile in $progfiles; do
1285 func_verbose "extracting global C symbols from \`$progfile'"
1286 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
1289 if test -n "$exclude_expsyms"; then
1291 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
1292 eval '$MV "$nlist"T "$nlist"'
1296 if test -n "$export_symbols_regex"; then
1298 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
1299 eval '$MV "$nlist"T "$nlist"'
1303 # Prepare the list of exported symbols
1304 if test -z "$export_symbols"; then
1305 export_symbols="$output_objdir/$outputname.exp"
1308 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
1310 *cygwin* | *mingw* )
1311 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1312 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
1318 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
1319 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
1320 eval '$MV "$nlist"T "$nlist"'
1323 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1324 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
1331 for dlprefile in $dlprefiles; do
1332 func_verbose "extracting global C symbols from \`$dlprefile'"
1333 func_basename "$dlprefile"
1334 name="$func_basename_result"
1336 eval '$ECHO ": $name " >> "$nlist"'
1337 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
1342 # Make sure we have at least an empty file.
1343 test -f "$nlist" || : > "$nlist"
1345 if test -n "$exclude_expsyms"; then
1346 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
1347 $MV "$nlist"T "$nlist"
1350 # Try sorting and uniquifying the output.
1351 if $GREP -v "^: " < "$nlist" |
1352 if sort -k 3 </dev/null >/dev/null 2>&1; then
1357 uniq > "$nlist"S; then
1360 $GREP -v "^: " < "$nlist" > "$nlist"S
1363 if test -f "$nlist"S; then
1364 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
1366 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
1369 $ECHO >> "$output_objdir/$my_dlsyms" "\
1371 /* The mapping between symbol names and symbols. */
1378 *cygwin* | *mingw* )
1379 $ECHO >> "$output_objdir/$my_dlsyms" "\
1380 /* DATA imports from DLLs on WIN32 con't be const, because
1381 runtime relocations are performed -- see ld's documentation
1382 on pseudo-relocs. */"
1385 echo >> "$output_objdir/$my_dlsyms" "\
1386 /* This system does not cope well with relocations in const data */"
1389 lt_dlsym_const=const ;;
1392 $ECHO >> "$output_objdir/$my_dlsyms" "\
1393 extern $lt_dlsym_const lt_dlsymlist
1394 lt_${my_prefix}_LTX_preloaded_symbols[];
1395 $lt_dlsym_const lt_dlsymlist
1396 lt_${my_prefix}_LTX_preloaded_symbols[] =
1398 { \"$my_originator\", (void *) 0 },"
1400 case $need_lib_prefix in
1402 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
1405 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
1408 $ECHO >> "$output_objdir/$my_dlsyms" "\
1412 /* This works around a problem in FreeBSD linker */
1413 #ifdef FREEBSD_WORKAROUND
1414 static const void *lt_preloaded_setup() {
1415 return lt_${my_prefix}_LTX_preloaded_symbols;
1425 pic_flag_for_symtable=
1426 case "$compile_command " in
1430 # compiling the symbol table file with pic_flag works around
1431 # a FreeBSD bug that causes programs to crash when -lm is
1432 # linked before any other PIC object. But we must not use
1433 # pic_flag when linking with -static. The problem exists in
1434 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
1435 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
1436 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
1438 pic_flag_for_symtable=" $pic_flag" ;;
1440 if test "X$my_pic_p" != Xno; then
1441 pic_flag_for_symtable=" $pic_flag"
1448 for arg in $LTCFLAGS; do
1450 -pie | -fpie | -fPIE) ;;
1451 *) symtab_cflags="$symtab_cflags $arg" ;;
1455 # Now compile the dynamic symbol file.
1456 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
1458 # Clean up the generated files.
1459 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
1461 # Transform the symbol file into the correct name.
1462 symfileobj="$output_objdir/${my_outputname}S.$objext"
1464 *cygwin* | *mingw* )
1465 if test -f "$output_objdir/$my_outputname.def"; then
1466 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1467 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1469 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1470 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1474 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1475 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1480 func_fatal_error "unknown suffix for \`$my_dlsyms'"
1484 # We keep going just in case the user didn't refer to
1485 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
1486 # really was required.
1488 # Nullify the symbol file.
1489 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1490 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1494 # func_extract_an_archive dir oldlib
1495 func_extract_an_archive ()
1498 f_ex_an_ar_dir="$1"; shift
1499 f_ex_an_ar_oldlib="$1"
1500 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
1501 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
1504 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
1509 # func_extract_archives gentop oldlib ...
1510 func_extract_archives ()
1513 my_gentop="$1"; shift
1514 my_oldlibs=${1+"$@"}
1520 for my_xlib in $my_oldlibs; do
1521 # Extract the objects.
1523 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
1524 *) my_xabs=`pwd`"/$my_xlib" ;;
1526 func_basename "$my_xlib"
1527 my_xlib="$func_basename_result"
1530 case " $extracted_archives " in
1532 extracted_serial=`expr $extracted_serial + 1`
1533 my_xlib_u=lt$extracted_serial-$my_xlib ;;
1537 extracted_archives="$extracted_archives $my_xlib_u"
1538 my_xdir="$my_gentop/$my_xlib_u"
1540 func_mkdir_p "$my_xdir"
1544 func_verbose "Extracting $my_xabs"
1545 # Do not bother doing anything if just a dry run
1547 darwin_orig_dir=`pwd`
1548 cd $my_xdir || exit $?
1549 darwin_archive=$my_xabs
1551 darwin_base_archive=`basename "$darwin_archive"`
1552 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
1553 if test -n "$darwin_arches"; then
1554 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
1556 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
1557 for darwin_arch in $darwin_arches ; do
1558 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1559 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
1560 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1561 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
1563 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
1564 done # $darwin_arches
1565 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
1566 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
1569 for darwin_file in $darwin_filelist; do
1570 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
1571 lipo -create -output "$darwin_file" $darwin_files
1572 done # $darwin_filelist
1574 cd "$darwin_orig_dir"
1577 func_extract_an_archive "$my_xdir" "$my_xabs"
1582 func_extract_an_archive "$my_xdir" "$my_xabs"
1585 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
1588 func_extract_archives_result="$my_oldobjs"
1593 # func_write_libtool_object output_name pic_name nonpic_name
1594 # Create a libtool object file (analogous to a ".la" file),
1595 # but don't create it if we're doing a dry run.
1596 func_write_libtool_object ()
1599 if test "$build_libtool_libs" = yes; then
1605 if test "$build_old_libs" = yes; then
1606 write_oldobj=\'${3}\'
1612 cat >${write_libobj}T <<EOF
1613 # $write_libobj - a libtool object file
1614 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1616 # Please DO NOT delete this file!
1617 # It is necessary for linking the library.
1619 # Name of the PIC object.
1620 pic_object=$write_lobj
1622 # Name of the non-PIC object
1623 non_pic_object=$write_oldobj
1626 mv -f "${write_libobj}T" "${write_libobj}"
1630 # func_mode_compile arg...
1631 func_mode_compile ()
1634 # Get the compilation command and the source file.
1636 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1648 # do not "continue". Instead, add this to base_compile
1660 # Accept any command-line options.
1663 test -n "$libobj" && \
1664 func_fatal_error "you cannot specify \`-o' more than once"
1669 -pie | -fpie | -fPIE)
1670 pie_flag="$pie_flag $arg"
1674 -shared | -static | -prefer-pic | -prefer-non-pic)
1685 arg_mode=arg # the next one goes into the "base_compile" arg list
1686 continue # The current "srcfile" will either be retained or
1687 ;; # replaced later. I would guess that would be a bug.
1690 func_stripname '-Wc,' '' "$arg"
1691 args=$func_stripname_result
1693 save_ifs="$IFS"; IFS=','
1694 for arg in $args; do
1696 func_quote_for_eval "$arg"
1697 lastarg="$lastarg $func_quote_for_eval_result"
1700 func_stripname ' ' '' "$lastarg"
1701 lastarg=$func_stripname_result
1703 # Add the arguments to base_compile.
1704 base_compile="$base_compile $lastarg"
1709 # Accept the current argument as the source file.
1710 # The previous "srcfile" becomes the current argument.
1717 esac # case $arg_mode
1719 # Aesthetically quote the previous argument.
1720 func_quote_for_eval "$lastarg"
1721 base_compile="$base_compile $func_quote_for_eval_result"
1726 func_fatal_error "you must specify an argument for -Xcompile"
1729 func_fatal_error "you must specify a target with \`-o'"
1732 # Get the name of the library object.
1733 test -z "$libobj" && {
1734 func_basename "$srcfile"
1735 libobj="$func_basename_result"
1740 # Recognize several different file suffixes.
1741 # If the user specifies -o file.o, it is replaced with file.lo
1751 *.class) xform=class ;;
1754 *.[fF][09]?) xform='[fF][09].' ;;
1756 *.java) xform=java ;;
1761 libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
1764 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1766 func_fatal_error "cannot determine name of library object from \`$libobj'"
1770 func_infer_tag $base_compile
1772 for arg in $later; do
1775 test "$build_libtool_libs" != yes && \
1776 func_fatal_configuration "can not build a shared library"
1782 build_libtool_libs=no
1799 func_quote_for_eval "$libobj"
1800 test "X$libobj" != "X$func_quote_for_eval_result" \
1801 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1802 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1803 func_dirname_and_basename "$obj" "/" ""
1804 objname="$func_basename_result"
1805 xdir="$func_dirname_result"
1806 lobj=${xdir}$objdir/$objname
1808 test -z "$base_compile" && \
1809 func_fatal_help "you must specify a compilation command"
1811 # Delete any leftover library objects.
1812 if test "$build_old_libs" = yes; then
1813 removelist="$obj $lobj $libobj ${libobj}T"
1815 removelist="$lobj $libobj ${libobj}T"
1818 $opt_dry_run || $RM $removelist
1819 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1821 # On Cygwin there's no "real" PIC flag so we must build both object types
1823 cygwin* | mingw* | pw32* | os2*)
1827 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1828 # non-PIC code in shared libraries is not supported
1832 # Calculate the filename of the output object if compiler does
1833 # not support -o with -c
1834 if test "$compiler_c_o" = no; then
1835 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1836 lockfile="$output_obj.lock"
1837 removelist="$removelist $output_obj $lockfile"
1838 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1845 # Lock this critical section if it is needed
1846 # We use this script file to make the link, it avoids creating a new file
1847 if test "$need_locks" = yes; then
1848 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1849 func_echo "Waiting for $lockfile to be removed"
1852 elif test "$need_locks" = warn; then
1853 if test -f "$lockfile"; then
1855 *** ERROR, $lockfile exists and contains:
1856 `cat $lockfile 2>/dev/null`
1858 This indicates that another process is trying to use the same
1859 temporary object file, and libtool could not work around it because
1860 your compiler does not support \`-c' and \`-o' together. If you
1861 repeat this compilation, it may succeed, by chance, but you had better
1862 avoid parallel builds (make -j) in this platform, or get a better
1865 $opt_dry_run || $RM $removelist
1868 $ECHO "$srcfile" > "$lockfile"
1871 if test -n "$fix_srcfile_path"; then
1872 eval srcfile=\"$fix_srcfile_path\"
1874 func_quote_for_eval "$srcfile"
1875 qsrcfile=$func_quote_for_eval_result
1877 $opt_dry_run || $RM "$libobj" "${libobj}T"
1879 # Only build a PIC object if we are building libtool libraries.
1880 if test "$build_libtool_libs" = yes; then
1881 # Without this assignment, base_compile gets emptied.
1882 fbsd_hideous_sh_bug=$base_compile
1884 if test "$pic_mode" != no; then
1885 command="$base_compile $qsrcfile $pic_flag"
1887 # Don't build PIC code
1888 command="$base_compile $qsrcfile"
1891 func_mkdir_p "$xdir$objdir"
1893 if test -z "$output_obj"; then
1894 # Place PIC objects in $objdir
1895 command="$command -o $lobj"
1898 $opt_dry_run || $RM "$lobj" "$output_obj"
1900 func_show_eval "$command" \
1901 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1903 if test "$need_locks" = warn &&
1904 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1906 *** ERROR, $lockfile contains:
1907 `cat $lockfile 2>/dev/null`
1909 but it should contain:
1912 This indicates that another process is trying to use the same
1913 temporary object file, and libtool could not work around it because
1914 your compiler does not support \`-c' and \`-o' together. If you
1915 repeat this compilation, it may succeed, by chance, but you had better
1916 avoid parallel builds (make -j) in this platform, or get a better
1919 $opt_dry_run || $RM $removelist
1923 # Just move the object if needed, then go on to compile the next one
1924 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1925 func_show_eval '$MV "$output_obj" "$lobj"' \
1926 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1929 # Allow error messages only from the first compilation.
1930 if test "$suppress_opt" = yes; then
1931 suppress_output=' >/dev/null 2>&1'
1935 # Only build a position-dependent object if we build old libraries.
1936 if test "$build_old_libs" = yes; then
1937 if test "$pic_mode" != yes; then
1938 # Don't build PIC code
1939 command="$base_compile $qsrcfile$pie_flag"
1941 command="$base_compile $qsrcfile $pic_flag"
1943 if test "$compiler_c_o" = yes; then
1944 command="$command -o $obj"
1947 # Suppress compiler output if we already did a PIC compilation.
1948 command="$command$suppress_output"
1949 $opt_dry_run || $RM "$obj" "$output_obj"
1950 func_show_eval "$command" \
1951 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1953 if test "$need_locks" = warn &&
1954 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1956 *** ERROR, $lockfile contains:
1957 `cat $lockfile 2>/dev/null`
1959 but it should contain:
1962 This indicates that another process is trying to use the same
1963 temporary object file, and libtool could not work around it because
1964 your compiler does not support \`-c' and \`-o' together. If you
1965 repeat this compilation, it may succeed, by chance, but you had better
1966 avoid parallel builds (make -j) in this platform, or get a better
1969 $opt_dry_run || $RM $removelist
1973 # Just move the object if needed
1974 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1975 func_show_eval '$MV "$output_obj" "$obj"' \
1976 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1981 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1983 # Unlock the critical section if it was locked
1984 if test "$need_locks" != no; then
1992 test "$mode" = compile && func_mode_compile ${1+"$@"}
1995 # func_mode_execute arg...
1996 func_mode_execute ()
1999 # The first argument is the command name.
2002 func_fatal_help "you must specify a COMMAND"
2004 # Handle -dlopen flags immediately.
2005 for file in $execute_dlfiles; do
2007 || func_fatal_help "\`$file' is not a file"
2012 # Check to see that this really is a libtool archive.
2013 func_lalib_unsafe_p "$file" \
2014 || func_fatal_help "\`$lib' is not a valid libtool archive"
2016 # Read the libtool library.
2021 # Skip this library if it cannot be dlopened.
2022 if test -z "$dlname"; then
2023 # Warn if it was a shared library.
2024 test -n "$library_names" && \
2025 func_warning "\`$file' was not linked with \`-export-dynamic'"
2029 func_dirname "$file" "" "."
2030 dir="$func_dirname_result"
2032 if test -f "$dir/$objdir/$dlname"; then
2035 if test ! -f "$dir/$dlname"; then
2036 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2042 # Just add the directory containing the .lo file.
2043 func_dirname "$file" "" "."
2044 dir="$func_dirname_result"
2048 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2053 # Get the absolute pathname.
2054 absdir=`cd "$dir" && pwd`
2055 test -n "$absdir" && dir="$absdir"
2057 # Now add the directory to shlibpath_var.
2058 if eval "test -z \"\$$shlibpath_var\""; then
2059 eval "$shlibpath_var=\"\$dir\""
2061 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2065 # This variable tells wrapper scripts just to set shlibpath_var
2066 # rather than running their programs.
2067 libtool_execute_magic="$magic"
2069 # Check if any of the arguments is a wrapper script.
2076 # Do a test to see if this is really a libtool program.
2077 if func_ltwrapper_script_p "$file"; then
2079 elif func_ltwrapper_executable_p "$file"; then
2080 func_ltwrapper_scriptname "$file"
2081 func_source "$func_ltwrapper_scriptname_result"
2083 # Transform arg to wrapped name.
2084 file="$progdir/$program"
2087 # Quote arguments (to preserve shell metacharacters).
2088 func_quote_for_eval "$file"
2089 args="$args $func_quote_for_eval_result"
2092 if test "X$opt_dry_run" = Xfalse; then
2093 if test -n "$shlibpath_var"; then
2094 # Export the shlibpath_var.
2095 eval "export $shlibpath_var"
2098 # Restore saved environment variables
2099 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2101 eval "if test \"\${save_$lt_var+set}\" = set; then
2102 $lt_var=\$save_$lt_var; export $lt_var
2108 # Now prepare to actually exec the command.
2109 exec_cmd="\$cmd$args"
2111 # Display what would be done.
2112 if test -n "$shlibpath_var"; then
2113 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2114 $ECHO "export $shlibpath_var"
2121 test "$mode" = execute && func_mode_execute ${1+"$@"}
2124 # func_mode_finish arg...
2131 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2134 libdirs="$libdirs $dir"
2137 for libdir in $libdirs; do
2138 if test -n "$finish_cmds"; then
2139 # Do each command in the finish commands.
2140 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2143 if test -n "$finish_eval"; then
2144 # Do the single finish_eval.
2145 eval cmds=\"$finish_eval\"
2146 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2152 # Exit here if they wanted silent mode.
2153 $opt_silent && exit $EXIT_SUCCESS
2155 $ECHO "X----------------------------------------------------------------------" | $Xsed
2156 $ECHO "Libraries have been installed in:"
2157 for libdir in $libdirs; do
2161 $ECHO "If you ever happen to want to link against installed libraries"
2162 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2163 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2164 $ECHO "flag during linking and do at least one of the following:"
2165 if test -n "$shlibpath_var"; then
2166 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2167 $ECHO " during execution"
2169 if test -n "$runpath_var"; then
2170 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2171 $ECHO " during linking"
2173 if test -n "$hardcode_libdir_flag_spec"; then
2175 eval flag=\"$hardcode_libdir_flag_spec\"
2177 $ECHO " - use the \`$flag' linker flag"
2179 if test -n "$admincmds"; then
2180 $ECHO " - have your system administrator run these commands:$admincmds"
2182 if test -f /etc/ld.so.conf; then
2183 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2187 $ECHO "See any operating system documentation about shared libraries for"
2189 solaris2.[6789]|solaris2.1[0-9])
2190 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2194 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2197 $ECHO "X----------------------------------------------------------------------" | $Xsed
2201 test "$mode" = finish && func_mode_finish ${1+"$@"}
2204 # func_mode_install arg...
2205 func_mode_install ()
2208 # There may be an optional sh(1) argument at the beginning of
2209 # install_prog (especially on Windows NT).
2210 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2211 # Allow the use of GNU shtool's install command.
2212 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2213 # Aesthetically quote it.
2214 func_quote_for_eval "$nonopt"
2215 install_prog="$func_quote_for_eval_result "
2223 # The real first argument should be the name of the installation program.
2224 # Aesthetically quote it.
2225 func_quote_for_eval "$arg"
2226 install_prog="$install_prog$func_quote_for_eval_result"
2228 # We need to accept at least all the BSD install flags.
2238 if test -n "$dest"; then
2239 files="$files $dest"
2247 case " $install_prog " in
2262 # If the previous option needed an argument, then skip it.
2263 if test -n "$prev"; then
2272 # Aesthetically quote the argument.
2273 func_quote_for_eval "$arg"
2274 install_prog="$install_prog $func_quote_for_eval_result"
2277 test -z "$install_prog" && \
2278 func_fatal_help "you must specify an install program"
2280 test -n "$prev" && \
2281 func_fatal_help "the \`$prev' option requires an argument"
2283 if test -z "$files"; then
2284 if test -z "$dest"; then
2285 func_fatal_help "no file or destination specified"
2287 func_fatal_help "you must specify a destination"
2291 # Strip any trailing slash from the destination.
2292 func_stripname '' '/' "$dest"
2293 dest=$func_stripname_result
2295 # Check to see that the destination is a directory.
2296 test -d "$dest" && isdir=yes
2297 if test "$isdir" = yes; then
2301 func_dirname_and_basename "$dest" "" "."
2302 destdir="$func_dirname_result"
2303 destname="$func_basename_result"
2305 # Not a directory, so check to see that there is only one file specified.
2306 set dummy $files; shift
2307 test "$#" -gt 1 && \
2308 func_fatal_help "\`$dest' is not a directory"
2311 [\\/]* | [A-Za-z]:[\\/]*) ;;
2313 for file in $files; do
2317 func_fatal_help "\`$destdir' must be an absolute directory name"
2324 # This variable tells wrapper scripts just to set variables rather
2325 # than running their programs.
2326 libtool_install_magic="$magic"
2331 for file in $files; do
2333 # Do each installation.
2336 # Do the static libraries later.
2337 staticlibs="$staticlibs $file"
2341 # Check to see that this really is a libtool archive.
2342 func_lalib_unsafe_p "$file" \
2343 || func_fatal_help "\`$file' is not a valid libtool archive"
2350 # Add the libdir to current_libdirs if it is the destination.
2351 if test "X$destdir" = "X$libdir"; then
2352 case "$current_libdirs " in
2354 *) current_libdirs="$current_libdirs $libdir" ;;
2357 # Note the libdir as a future libdir.
2358 case "$future_libdirs " in
2360 *) future_libdirs="$future_libdirs $libdir" ;;
2364 func_dirname "$file" "/" ""
2365 dir="$func_dirname_result"
2368 if test -n "$relink_command"; then
2369 # Determine the prefix the user has applied to our future dir.
2370 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2372 # Don't allow the user to place us outside of our expected
2373 # location b/c this prevents finding dependent libraries that
2374 # are installed to the same prefix.
2375 # At present, this check doesn't affect windows .dll's that
2376 # are installed into $libdir/../bin (currently, that works fine)
2377 # but it's something to keep an eye on.
2378 test "$inst_prefix_dir" = "$destdir" && \
2379 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2381 if test -n "$inst_prefix_dir"; then
2382 # Stick the inst_prefix_dir data into the link command.
2383 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2385 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2388 func_warning "relinking \`$file'"
2389 func_show_eval "$relink_command" \
2390 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2393 # See the names of the shared library.
2394 set dummy $library_names; shift
2395 if test -n "$1"; then
2400 test -n "$relink_command" && srcname="$realname"T
2402 # Install the shared library and build the symlinks.
2403 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2407 cygwin* | mingw* | pw32*)
2415 if test -n "$tstripme" && test -n "$striplib"; then
2416 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2419 if test "$#" -gt 0; then
2420 # Delete the old symlinks, and create new ones.
2421 # Try `ln -sf' first, because the `ln' binary might depend on
2422 # the symlink we replace! Solaris /bin/ln does not understand -f,
2423 # so we also need to try rm && ln -s.
2426 test "$linkname" != "$realname" \
2427 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2431 # Do each command in the postinstall commands.
2432 lib="$destdir/$realname"
2433 func_execute_cmds "$postinstall_cmds" 'exit $?'
2436 # Install the pseudo-library for information purposes.
2437 func_basename "$file"
2438 name="$func_basename_result"
2439 instname="$dir/$name"i
2440 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2442 # Maybe install the static library, too.
2443 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2447 # Install (i.e. copy) a libtool object.
2449 # Figure out destination file name, if it wasn't already specified.
2450 if test -n "$destname"; then
2451 destfile="$destdir/$destname"
2453 func_basename "$file"
2454 destfile="$func_basename_result"
2455 destfile="$destdir/$destfile"
2458 # Deduce the name of the destination old-style object file.
2461 func_lo2o "$destfile"
2462 staticdest=$func_lo2o_result
2465 staticdest="$destfile"
2469 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2473 # Install the libtool object if requested.
2474 test -n "$destfile" && \
2475 func_show_eval "$install_prog $file $destfile" 'exit $?'
2477 # Install the old object if enabled.
2478 if test "$build_old_libs" = yes; then
2479 # Deduce the name of the old-style object file.
2481 staticobj=$func_lo2o_result
2482 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2488 # Figure out destination file name, if it wasn't already specified.
2489 if test -n "$destname"; then
2490 destfile="$destdir/$destname"
2492 func_basename "$file"
2493 destfile="$func_basename_result"
2494 destfile="$destdir/$destfile"
2497 # If the file is missing, and there is a .exe on the end, strip it
2498 # because it is most likely a libtool script we actually want to
2503 if test ! -f "$file"; then
2504 func_stripname '' '.exe' "$file"
2505 file=$func_stripname_result
2511 # Do a test to see if this is really a libtool program.
2514 if func_ltwrapper_executable_p "$file"; then
2515 func_ltwrapper_scriptname "$file"
2516 wrapper=$func_ltwrapper_scriptname_result
2518 func_stripname '' '.exe' "$file"
2519 wrapper=$func_stripname_result
2526 if func_ltwrapper_script_p "$wrapper"; then
2530 func_source "$wrapper"
2532 # Check the variables that should have been set.
2533 test -z "$generated_by_libtool_version" && \
2534 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2537 for lib in $notinst_deplibs; do
2538 # Check to see that each library is installed.
2540 if test -f "$lib"; then
2543 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2544 if test -n "$libdir" && test ! -f "$libfile"; then
2545 func_warning "\`$lib' has not been installed in \`$libdir'"
2551 func_source "$wrapper"
2554 if test "$fast_install" = no && test -n "$relink_command"; then
2556 if test "$finalize" = yes; then
2557 tmpdir=`func_mktempdir`
2558 func_basename "$file$stripped_ext"
2559 file="$func_basename_result"
2560 outputname="$tmpdir/$file"
2561 # Replace the output file specification.
2562 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2565 func_quote_for_expand "$relink_command"
2566 eval "func_echo $func_quote_for_expand_result"
2568 if eval "$relink_command"; then :
2570 func_error "error: relink \`$file' with the above command before installing it"
2571 $opt_dry_run || ${RM}r "$tmpdir"
2576 func_warning "cannot relink \`$file'"
2580 # Install the binary that we compiled earlier.
2581 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2585 # remove .exe since cygwin /usr/bin/install will append another
2587 case $install_prog,$host in
2588 */usr/bin/install*,*cygwin*)
2589 case $file:$destfile in
2594 destfile=$destfile.exe
2597 func_stripname '' '.exe' "$destfile"
2598 destfile=$func_stripname_result
2603 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2604 $opt_dry_run || if test -n "$outputname"; then
2611 for file in $staticlibs; do
2612 func_basename "$file"
2613 name="$func_basename_result"
2615 # Set up the ranlib parameters.
2616 oldlib="$destdir/$name"
2618 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2620 if test -n "$stripme" && test -n "$old_striplib"; then
2621 func_show_eval "$old_striplib $oldlib" 'exit $?'
2624 # Do each command in the postinstall commands.
2625 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2628 test -n "$future_libdirs" && \
2629 func_warning "remember to run \`$progname --finish$future_libdirs'"
2631 if test -n "$current_libdirs"; then
2632 # Maybe just do a dry run.
2633 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2634 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2640 test "$mode" = install && func_mode_install ${1+"$@"}
2643 # func_emit_wrapper arg
2645 # emit a libtool wrapper script on stdout
2646 # don't directly open a file because we may want to
2647 # incorporate the script contents within a cygwin/mingw
2648 # wrapper executable. Must ONLY be called from within
2649 # func_mode_link because it depends on a number of variable
2652 # arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2653 # variable will take. If 'yes', then the emitted script
2654 # will assume that the directory in which it is stored is
2655 # the '.lib' directory. This is a cygwin/mingw-specific
2657 func_emit_wrapper ()
2659 func_emit_wrapper_arg1=no
2660 if test -n "$1" ; then
2661 func_emit_wrapper_arg1=$1
2667 # $output - temporary wrapper script for $objdir/$outputname
2668 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2670 # The $output program cannot be directly executed until all the libtool
2671 # libraries that it depends on are installed.
2673 # This wrapper script should never be moved out of the build directory.
2674 # If it is, it will not operate correctly.
2676 # Sed substitution that helps us do robust quoting. It backslashifies
2677 # metacharacters that are still active within double-quoted strings.
2678 Xsed='${SED} -e 1s/^X//'
2679 sed_quote_subst='$sed_quote_subst'
2681 # Be Bourne compatible
2682 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2685 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2686 # is contrary to our usage. Disable this feature.
2687 alias -g '\${1+\"\$@\"}'='\"\$@\"'
2688 setopt NO_GLOB_SUBST
2690 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2692 BIN_SH=xpg4; export BIN_SH # for Tru64
2693 DUALCASE=1; export DUALCASE # for MKS sh
2695 # The HP-UX ksh and POSIX shell print the target directory to stdout
2697 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2699 relink_command=\"$relink_command\"
2701 # This environment variable determines our operation mode.
2702 if test \"\$libtool_install_magic\" = \"$magic\"; then
2703 # install mode needs the following variables:
2704 generated_by_libtool_version='$macro_version'
2705 notinst_deplibs='$notinst_deplibs'
2707 # When we are sourced in execute mode, \$file and \$ECHO are already set.
2708 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2711 # Make sure echo works.
2712 if test \"X\$1\" = X--no-reexec; then
2713 # Discard the --no-reexec flag, and continue.
2715 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2716 # Yippee, \$ECHO works!
2719 # Restart under the correct shell, and then maybe \$ECHO will work.
2720 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2726 # Find the directory that this script lives in.
2727 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2728 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2730 # Follow symbolic links until we get to the real thisdir.
2731 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2732 while test -n \"\$file\"; do
2733 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2735 # If there was a directory component, then change thisdir.
2736 if test \"x\$destdir\" != \"x\$file\"; then
2737 case \"\$destdir\" in
2738 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2739 *) thisdir=\"\$thisdir/\$destdir\" ;;
2743 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2744 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2747 # Usually 'no', except on cygwin/mingw when embedded into
2749 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
2750 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2751 # special case for '.'
2752 if test \"\$thisdir\" = \".\"; then
2755 # remove .libs from thisdir
2756 case \"\$thisdir\" in
2757 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
2758 $objdir ) thisdir=. ;;
2762 # Try to get the absolute directory name.
2763 absdir=\`cd \"\$thisdir\" && pwd\`
2764 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2767 if test "$fast_install" = yes; then
2769 program=lt-'$outputname'$exeext
2770 progdir=\"\$thisdir/$objdir\"
2772 if test ! -f \"\$progdir/\$program\" ||
2773 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2774 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2776 file=\"\$\$-\$program\"
2778 if test ! -d \"\$progdir\"; then
2779 $MKDIR \"\$progdir\"
2781 $RM \"\$progdir/\$file\"
2786 # relink executable if necessary
2787 if test -n \"\$relink_command\"; then
2788 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2790 $ECHO \"\$relink_command_output\" >&2
2791 $RM \"\$progdir/\$file\"
2796 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2797 { $RM \"\$progdir/\$program\";
2798 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2799 $RM \"\$progdir/\$file\"
2803 program='$outputname'
2804 progdir=\"\$thisdir/$objdir\"
2810 if test -f \"\$progdir/\$program\"; then"
2812 # Export our shlibpath_var if we have one.
2813 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2815 # Add our own library path to $shlibpath_var
2816 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2818 # Some systems cannot cope with colon-terminated $shlibpath_var
2819 # The second colon is a workaround for a bug in BeOS R4 sed
2820 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2822 export $shlibpath_var
2826 # fixup the dll searchpath if we need to.
2827 if test -n "$dllsearchpath"; then
2829 # Add the dll search path components to the executable PATH
2830 PATH=$dllsearchpath:\$PATH
2835 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2836 # Run the actual program with our arguments.
2839 # Backslashes separate directories on plain windows
2840 *-*-mingw | *-*-os2*)
2842 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
2848 exec \"\$progdir/\$program\" \${1+\"\$@\"}
2853 \$ECHO \"\$0: cannot exec \$program \$*\"
2857 # The program doesn't exist.
2858 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
2859 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
2860 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
2866 # end: func_emit_wrapper
2868 # func_emit_cwrapperexe_src
2869 # emit the source code for a wrapper executable on stdout
2870 # Must ONLY be called from within func_mode_link because
2871 # it depends on a number of variable set therein.
2872 func_emit_cwrapperexe_src ()
2876 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
2877 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2879 The $output program cannot be directly executed until all the libtool
2880 libraries that it depends on are installed.
2882 This wrapper executable should never be moved out of the build directory.
2883 If it is, it will not operate correctly.
2885 Currently, it simply execs the wrapper *script* "$SHELL $output",
2886 but could eventually absorb all of the scripts functionality and
2887 exec $objdir/$outputname directly.
2894 # include <direct.h>
2895 # include <process.h>
2897 # include <unistd.h>
2898 # include <stdint.h>
2906 #include <sys/stat.h>
2908 #if defined(PATH_MAX)
2909 # define LT_PATHMAX PATH_MAX
2910 #elif defined(MAXPATHLEN)
2911 # define LT_PATHMAX MAXPATHLEN
2913 # define LT_PATHMAX 1024
2924 # define S_IXUSR _S_IEXEC
2926 # ifndef _INTPTR_T_DEFINED
2927 # define intptr_t int
2931 #ifndef DIR_SEPARATOR
2932 # define DIR_SEPARATOR '/'
2933 # define PATH_SEPARATOR ':'
2936 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
2938 # define HAVE_DOS_BASED_FILE_SYSTEM
2939 # ifndef DIR_SEPARATOR_2
2940 # define DIR_SEPARATOR_2 '\\'
2942 # ifndef PATH_SEPARATOR_2
2943 # define PATH_SEPARATOR_2 ';'
2947 #ifndef DIR_SEPARATOR_2
2948 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
2949 #else /* DIR_SEPARATOR_2 */
2950 # define IS_DIR_SEPARATOR(ch) \
2951 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
2952 #endif /* DIR_SEPARATOR_2 */
2954 #ifndef PATH_SEPARATOR_2
2955 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
2956 #else /* PATH_SEPARATOR_2 */
2957 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
2958 #endif /* PATH_SEPARATOR_2 */
2960 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
2961 #define XFREE(stale) do { \
2962 if (stale) { free ((void *) stale); stale = 0; } \
2965 #undef LTWRAPPER_DEBUGPRINTF
2966 #if defined DEBUGWRAPPER
2967 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
2969 ltwrapper_debugprintf (const char *fmt, ...)
2972 va_start (args, fmt);
2973 (void) vfprintf (stderr, fmt, args);
2977 # define LTWRAPPER_DEBUGPRINTF(args)
2980 const char *program_name = NULL;
2982 void *xmalloc (size_t num);
2983 char *xstrdup (const char *string);
2984 const char *base_name (const char *name);
2985 char *find_executable (const char *wrapper);
2986 char *chase_symlinks (const char *pathspec);
2987 int make_executable (const char *path);
2988 int check_executable (const char *path);
2989 char *strendzap (char *str, const char *pat);
2990 void lt_fatal (const char *message, ...);
2992 static const char *script_text =
2995 func_emit_wrapper yes |
2996 $SED -e 's/\([\\"]\)/\\\1/g' \
2997 -e 's/^/ "/' -e 's/$/\\n"/'
3001 const char * MAGIC_EXE = "$magic_exe";
3004 main (int argc, char *argv[])
3008 char *actual_cwrapper_path;
3009 char *shwrapper_name;
3010 intptr_t rval = 127;
3013 const char *dumpscript_opt = "--lt-dump-script";
3016 program_name = (char *) xstrdup (base_name (argv[0]));
3017 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3018 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3020 /* very simple arg parsing; don't want to rely on getopt */
3021 for (i = 1; i < argc; i++)
3023 if (strcmp (argv[i], dumpscript_opt) == 0)
3025 printf ("%s", script_text);
3030 newargz = XMALLOC (char *, argc + 2);
3033 if test -n "$TARGETSHELL" ; then
3034 # no path translation at all
3035 lt_newargv0=$TARGETSHELL
3039 # awkward: cmd appends spaces to result
3040 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3041 lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
3042 case $lt_newargv0 in
3044 *) lt_newargv0=$lt_newargv0.exe ;;
3047 * ) lt_newargv0=$SHELL ;;
3052 newargz[0] = (char *) xstrdup ("$lt_newargv0");
3056 tmp_pathspec = find_executable (argv[0]);
3057 if (tmp_pathspec == NULL)
3058 lt_fatal ("Couldn't find %s", argv[0]);
3059 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3062 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3063 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3064 actual_cwrapper_path));
3065 XFREE (tmp_pathspec);
3067 shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
3068 strendzap (actual_cwrapper_path, shwrapper_name);
3070 /* shwrapper_name transforms */
3071 strendzap (shwrapper_name, ".exe");
3072 tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
3073 strlen ("_ltshwrapperTMP") + 1));
3074 strcpy (tmp_pathspec, shwrapper_name);
3075 strcat (tmp_pathspec, "_ltshwrapperTMP");
3076 XFREE (shwrapper_name);
3077 shwrapper_name = tmp_pathspec;
3079 LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
3085 XMALLOC (char, (strlen (actual_cwrapper_path) +
3086 strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
3087 strcpy (newargz[1], actual_cwrapper_path);
3088 strcat (newargz[1], "$objdir");
3089 strcat (newargz[1], "/");
3090 strcat (newargz[1], shwrapper_name);
3099 while ((p = strchr (newargz[1], '\\')) != NULL)
3109 XFREE (shwrapper_name);
3110 XFREE (actual_cwrapper_path);
3112 /* note: do NOT use "wt" here! -- defer to underlying
3113 * mount type on cygwin
3115 if ((shwrapper = fopen (newargz[1], "w")) == 0)
3117 lt_fatal ("Could not open %s for writing", newargz[1]);
3119 fprintf (shwrapper, "%s", script_text);
3122 make_executable (newargz[1]);
3124 for (i = 1; i < argc; i++)
3125 newargz[i + 1] = xstrdup (argv[i]);
3126 newargz[argc + 1] = NULL;
3128 for (i = 0; i < argc + 1; i++)
3130 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, newargz[i]));
3138 /* execv doesn't actually work on mingw as expected on unix */
3139 rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
3142 /* failed to start process */
3143 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
3152 execv ("$lt_newargv0", newargz);
3153 return rval; /* =127, but avoids unused variable warning */
3162 xmalloc (size_t num)
3164 void *p = (void *) malloc (num);
3166 lt_fatal ("Memory exhausted");
3172 xstrdup (const char *string)
3174 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3179 base_name (const char *name)
3183 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3184 /* Skip over the disk name in MSDOS pathnames. */
3185 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3189 for (base = name; *name; name++)
3190 if (IS_DIR_SEPARATOR (*name))
3196 check_executable (const char *path)
3200 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
3201 path ? (*path ? path : "EMPTY!") : "NULL!"));
3202 if ((!path) || (!*path))
3205 if ((stat (path, &st) >= 0)
3206 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3213 make_executable (const char *path)
3218 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
3219 path ? (*path ? path : "EMPTY!") : "NULL!"));
3220 if ((!path) || (!*path))
3223 if (stat (path, &st) >= 0)
3225 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3230 /* Searches for the full path of the wrapper. Returns
3231 newly allocated full path name if found, NULL otherwise
3232 Does not chase symlinks, even on platforms that support them.
3235 find_executable (const char *wrapper)
3240 /* static buffer for getcwd */
3241 char tmp[LT_PATHMAX + 1];
3245 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
3246 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3248 if ((wrapper == NULL) || (*wrapper == '\0'))
3251 /* Absolute path? */
3252 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3253 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3255 concat_name = xstrdup (wrapper);
3256 if (check_executable (concat_name))
3258 XFREE (concat_name);
3263 if (IS_DIR_SEPARATOR (wrapper[0]))
3265 concat_name = xstrdup (wrapper);
3266 if (check_executable (concat_name))
3268 XFREE (concat_name);
3270 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3274 for (p = wrapper; *p; p++)
3282 /* no slashes; search PATH */
3283 const char *path = getenv ("PATH");
3286 for (p = path; *p; p = p_next)
3290 for (q = p; *q; q++)
3291 if (IS_PATH_SEPARATOR (*q))
3294 p_next = (*q == '\0' ? q : q + 1);
3297 /* empty path: current directory */
3298 if (getcwd (tmp, LT_PATHMAX) == NULL)
3299 lt_fatal ("getcwd failed");
3300 tmp_len = strlen (tmp);
3302 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3303 memcpy (concat_name, tmp, tmp_len);
3304 concat_name[tmp_len] = '/';
3305 strcpy (concat_name + tmp_len + 1, wrapper);
3310 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3311 memcpy (concat_name, p, p_len);
3312 concat_name[p_len] = '/';
3313 strcpy (concat_name + p_len + 1, wrapper);
3315 if (check_executable (concat_name))
3317 XFREE (concat_name);
3320 /* not found in PATH; assume curdir */
3322 /* Relative path | not found in path: prepend cwd */
3323 if (getcwd (tmp, LT_PATHMAX) == NULL)
3324 lt_fatal ("getcwd failed");
3325 tmp_len = strlen (tmp);
3326 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3327 memcpy (concat_name, tmp, tmp_len);
3328 concat_name[tmp_len] = '/';
3329 strcpy (concat_name + tmp_len + 1, wrapper);
3331 if (check_executable (concat_name))
3333 XFREE (concat_name);
3338 chase_symlinks (const char *pathspec)
3341 return xstrdup (pathspec);
3343 char buf[LT_PATHMAX];
3345 char *tmp_pathspec = xstrdup (pathspec);
3347 int has_symlinks = 0;
3348 while (strlen (tmp_pathspec) && !has_symlinks)
3350 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3352 if (lstat (tmp_pathspec, &s) == 0)
3354 if (S_ISLNK (s.st_mode) != 0)
3360 /* search backwards for last DIR_SEPARATOR */
3361 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3362 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3364 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3366 /* no more DIR_SEPARATORS left */
3373 char *errstr = strerror (errno);
3374 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3377 XFREE (tmp_pathspec);
3381 return xstrdup (pathspec);
3384 tmp_pathspec = realpath (pathspec, buf);
3385 if (tmp_pathspec == 0)
3387 lt_fatal ("Could not follow symlinks for %s", pathspec);
3389 return xstrdup (tmp_pathspec);
3394 strendzap (char *str, const char *pat)
3398 assert (str != NULL);
3399 assert (pat != NULL);
3402 patlen = strlen (pat);
3406 str += len - patlen;
3407 if (strcmp (str, pat) == 0)
3414 lt_error_core (int exit_status, const char *mode,
3415 const char *message, va_list ap)
3417 fprintf (stderr, "%s: %s: ", program_name, mode);
3418 vfprintf (stderr, message, ap);
3419 fprintf (stderr, ".\n");
3421 if (exit_status >= 0)
3426 lt_fatal (const char *message, ...)
3429 va_start (ap, message);
3430 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
3435 # end: func_emit_cwrapperexe_src
3437 # func_mode_link arg...
3442 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3443 # It is impossible to link a dll without this setting, and
3444 # we shouldn't force the makefile maintainer to figure out
3445 # which system we are compiling for in order to pass an extra
3446 # flag for every libtool invocation.
3447 # allow_undefined=no
3449 # FIXME: Unfortunately, there are problems with the above when trying
3450 # to make a dll which has undefined symbols, in which case not
3451 # even a static library is built. For now, we need to specify
3452 # -no-undefined on the libtool link line when we can be certain
3453 # that all symbols are satisfied, otherwise we get a static library.
3460 libtool_args=$nonopt
3461 base_compile="$nonopt $@"
3462 compile_command=$nonopt
3463 finalize_command=$nonopt
3476 lib_search_path=`pwd`
3478 new_inherited_linker_flags=
3486 export_symbols_regex=
3494 precious_files_regex=
3495 prefer_static_libs=no
3508 single_module="${wl}-single_module"
3509 func_infer_tag $base_compile
3511 # We need to know -static, to get the right output filenames.
3516 test "$build_libtool_libs" != yes && \
3517 func_fatal_configuration "can not build a shared library"
3521 -all-static | -static | -static-libtool-libs)
3524 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
3525 func_warning "complete static linking is impossible in this configuration"
3527 if test -n "$link_static_flag"; then
3528 dlopen_self=$dlopen_self_static
3529 # See comment for -static flag below, for more details.
3530 func_append compile_command " $link_static_flag"
3531 func_append finalize_command " $link_static_flag"
3533 prefer_static_libs=yes
3536 if test -z "$pic_flag" && test -n "$link_static_flag"; then
3537 dlopen_self=$dlopen_self_static
3539 prefer_static_libs=built
3541 -static-libtool-libs)
3542 if test -z "$pic_flag" && test -n "$link_static_flag"; then
3543 dlopen_self=$dlopen_self_static
3545 prefer_static_libs=yes
3548 build_libtool_libs=no
3555 # See if our shared archives depend on static archives.
3556 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
3558 # Go through the arguments, transforming them on the way.
3559 while test "$#" -gt 0; do
3562 func_quote_for_eval "$arg"
3563 qarg=$func_quote_for_eval_unquoted_result
3564 func_append libtool_args " $func_quote_for_eval_result"
3566 # If the previous option needs an argument, assign it.
3567 if test -n "$prev"; then
3570 func_append compile_command " @OUTPUT@"
3571 func_append finalize_command " @OUTPUT@"
3577 if test "$preload" = no; then
3578 # Add the symbol object into the linking commands.
3579 func_append compile_command " @SYMFILE@"
3580 func_append finalize_command " @SYMFILE@"
3584 *.la | *.lo) ;; # We handle these cases below.
3586 if test "$dlself" = no; then
3594 if test "$prev" = dlprefiles; then
3596 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
3606 if test "$prev" = dlfiles; then
3607 dlfiles="$dlfiles $arg"
3609 dlprefiles="$dlprefiles $arg"
3617 export_symbols="$arg"
3619 || func_fatal_error "symbol file \`$arg' does not exist"
3624 export_symbols_regex="$arg"
3632 *" $qarg.ltframework "*) ;;
3633 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
3642 inst_prefix_dir="$arg"
3647 if test -f "$arg"; then
3650 for fil in `cat "$save_arg"`
3652 # moreargs="$moreargs $fil"
3654 # A libtool-controlled object.
3656 # Check to see that this really is a libtool object.
3657 if func_lalib_unsafe_p "$arg"; then
3664 if test -z "$pic_object" ||
3665 test -z "$non_pic_object" ||
3666 test "$pic_object" = none &&
3667 test "$non_pic_object" = none; then
3668 func_fatal_error "cannot find name of object for \`$arg'"
3671 # Extract subdirectory from the argument.
3672 func_dirname "$arg" "/" ""
3673 xdir="$func_dirname_result"
3675 if test "$pic_object" != none; then
3676 # Prepend the subdirectory the object is found in.
3677 pic_object="$xdir$pic_object"
3679 if test "$prev" = dlfiles; then
3680 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
3681 dlfiles="$dlfiles $pic_object"
3685 # If libtool objects are unsupported, then we need to preload.
3690 # CHECK ME: I think I busted this. -Ossama
3691 if test "$prev" = dlprefiles; then
3692 # Preload the old-style object.
3693 dlprefiles="$dlprefiles $pic_object"
3698 func_append libobjs " $pic_object"
3703 if test "$non_pic_object" != none; then
3704 # Prepend the subdirectory the object is found in.
3705 non_pic_object="$xdir$non_pic_object"
3707 # A standard non-PIC object
3708 func_append non_pic_objects " $non_pic_object"
3709 if test -z "$pic_object" || test "$pic_object" = none ; then
3710 arg="$non_pic_object"
3713 # If the PIC object exists, use it instead.
3714 # $xdir was prepended to $pic_object above.
3715 non_pic_object="$pic_object"
3716 func_append non_pic_objects " $non_pic_object"
3719 # Only an error if not doing a dry-run.
3720 if $opt_dry_run; then
3721 # Extract subdirectory from the argument.
3722 func_dirname "$arg" "/" ""
3723 xdir="$func_dirname_result"
3726 pic_object=$xdir$objdir/$func_lo2o_result
3727 non_pic_object=$xdir$func_lo2o_result
3728 func_append libobjs " $pic_object"
3729 func_append non_pic_objects " $non_pic_object"
3731 func_fatal_error "\`$arg' is not a valid libtool object"
3736 func_fatal_error "link input file \`$arg' does not exist"
3743 precious_files_regex="$arg"
3753 # We need an absolute path.
3755 [\\/]* | [A-Za-z]:[\\/]*) ;;
3757 func_fatal_error "only absolute run-paths are allowed"
3760 if test "$prev" = rpath; then
3763 *) rpath="$rpath $arg" ;;
3768 *) xrpath="$xrpath $arg" ;;
3780 weak_libs="$weak_libs $arg"
3785 linker_flags="$linker_flags $qarg"
3786 compiler_flags="$compiler_flags $qarg"
3788 func_append compile_command " $qarg"
3789 func_append finalize_command " $qarg"
3793 compiler_flags="$compiler_flags $qarg"
3795 func_append compile_command " $qarg"
3796 func_append finalize_command " $qarg"
3800 linker_flags="$linker_flags $qarg"
3801 compiler_flags="$compiler_flags $wl$qarg"
3803 func_append compile_command " $wl$qarg"
3804 func_append finalize_command " $wl$qarg"
3808 eval "$prev=\"\$arg\""
3813 fi # test -n "$prev"
3819 # The effects of -all-static are defined in a previous loop.
3824 # FIXME: remove this flag sometime in the future.
3825 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
3848 -export-symbols | -export-symbols-regex)
3849 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3850 func_fatal_error "more than one -exported-symbols argument is not allowed"
3852 if test "X$arg" = "X-export-symbols"; then
3870 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
3871 # so, if we see these flags be careful not to treat them like -L
3873 case $with_gcc/$host in
3874 no/*-*-irix* | /*-*-irix*)
3875 func_append compile_command " $arg"
3876 func_append finalize_command " $arg"
3883 func_stripname '-L' '' "$arg"
3884 dir=$func_stripname_result
3885 # We need an absolute path.
3887 [\\/]* | [A-Za-z]:[\\/]*) ;;
3889 absdir=`cd "$dir" && pwd`
3890 test -z "$absdir" && \
3891 func_fatal_error "cannot determine absolute directory name of \`$dir'"
3898 deplibs="$deplibs -L$dir"
3899 lib_search_path="$lib_search_path $dir"
3903 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3904 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
3905 case :$dllsearchpath: in
3907 *) dllsearchpath="$dllsearchpath:$dir";;
3909 case :$dllsearchpath: in
3910 *":$testbindir:"*) ;;
3911 *) dllsearchpath="$dllsearchpath:$testbindir";;
3919 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
3921 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
3922 # These systems don't actually have a C or math library (as such)
3926 # These systems don't actually have a C library (as such)
3927 test "X$arg" = "X-lc" && continue
3929 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3930 # Do not include libc due to us having libc/libc_r.
3931 test "X$arg" = "X-lc" && continue
3933 *-*-rhapsody* | *-*-darwin1.[012])
3934 # Rhapsody C and math libraries are in the System framework
3935 deplibs="$deplibs System.ltframework"
3938 *-*-sco3.2v5* | *-*-sco5v6*)
3939 # Causes problems with __ctype
3940 test "X$arg" = "X-lc" && continue
3942 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3943 # Compiler inserts libc in the correct place for threads to work
3944 test "X$arg" = "X-lc" && continue
3947 elif test "X$arg" = "X-lc_r"; then
3949 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3950 # Do not include libc_r directly, use -pthread flag.
3955 deplibs="$deplibs $arg"
3964 # Tru64 UNIX uses -model [arg] to determine the layout of C++
3965 # classes, name mangling, and exception handling.
3966 # Darwin uses the -arch flag to determine output architecture.
3967 -model|-arch|-isysroot)
3968 compiler_flags="$compiler_flags $arg"
3969 func_append compile_command " $arg"
3970 func_append finalize_command " $arg"
3975 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
3976 compiler_flags="$compiler_flags $arg"
3977 func_append compile_command " $arg"
3978 func_append finalize_command " $arg"
3979 case "$new_inherited_linker_flags " in
3981 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
3987 single_module="${wl}-multi_module"
3998 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
3999 # The PATH hackery in wrapper scripts is required on Windows
4000 # and Darwin in order for the loader to find any dlls it needs.
4001 func_warning "\`-no-install' is ignored for $host"
4002 func_warning "assuming \`-no-fast-install' instead"
4005 *) no_install=yes ;;
4022 -precious-files-regex)
4043 func_stripname '-R' '' "$arg"
4044 dir=$func_stripname_result
4045 # We need an absolute path.
4047 [\\/]* | [A-Za-z]:[\\/]*) ;;
4049 func_fatal_error "only absolute run-paths are allowed"
4054 *) xrpath="$xrpath $dir" ;;
4060 # The effects of -shared are defined in a previous loop.
4069 -static | -static-libtool-libs)
4070 # The effects of -static are defined in a previous loop.
4071 # We used to do the same as -all-static on platforms that
4072 # didn't have a PIC flag, but the assumption that the effects
4073 # would be equivalent was wrong. It would break on at least
4074 # Digital Unix and AIX.
4100 func_stripname '-Wc,' '' "$arg"
4101 args=$func_stripname_result
4103 save_ifs="$IFS"; IFS=','
4104 for flag in $args; do
4106 func_quote_for_eval "$flag"
4107 arg="$arg $wl$func_quote_for_eval_result"
4108 compiler_flags="$compiler_flags $func_quote_for_eval_result"
4111 func_stripname ' ' '' "$arg"
4112 arg=$func_stripname_result
4116 func_stripname '-Wl,' '' "$arg"
4117 args=$func_stripname_result
4119 save_ifs="$IFS"; IFS=','
4120 for flag in $args; do
4122 func_quote_for_eval "$flag"
4123 arg="$arg $wl$func_quote_for_eval_result"
4124 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
4125 linker_flags="$linker_flags $func_quote_for_eval_result"
4128 func_stripname ' ' '' "$arg"
4129 arg=$func_stripname_result
4149 func_quote_for_eval "$arg"
4150 arg="$func_quote_for_eval_result"
4153 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
4154 # -r[0-9][0-9]* specifies the processor on the SGI compiler
4155 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
4156 # +DA*, +DD* enable 64-bit mode on the HP compiler
4157 # -q* pass through compiler args for the IBM compiler
4158 # -m*, -t[45]*, -txscale* pass through architecture-specific
4159 # compiler args for GCC
4160 # -F/path gives path to uninstalled frameworks, gcc on darwin
4161 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
4162 # @file GCC response files
4163 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
4164 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
4165 func_quote_for_eval "$arg"
4166 arg="$func_quote_for_eval_result"
4167 func_append compile_command " $arg"
4168 func_append finalize_command " $arg"
4169 compiler_flags="$compiler_flags $arg"
4173 # Some other compiler flag.
4175 func_quote_for_eval "$arg"
4176 arg="$func_quote_for_eval_result"
4180 # A standard object.
4185 # A libtool-controlled object.
4187 # Check to see that this really is a libtool object.
4188 if func_lalib_unsafe_p "$arg"; then
4195 if test -z "$pic_object" ||
4196 test -z "$non_pic_object" ||
4197 test "$pic_object" = none &&
4198 test "$non_pic_object" = none; then
4199 func_fatal_error "cannot find name of object for \`$arg'"
4202 # Extract subdirectory from the argument.
4203 func_dirname "$arg" "/" ""
4204 xdir="$func_dirname_result"
4206 if test "$pic_object" != none; then
4207 # Prepend the subdirectory the object is found in.
4208 pic_object="$xdir$pic_object"
4210 if test "$prev" = dlfiles; then
4211 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4212 dlfiles="$dlfiles $pic_object"
4216 # If libtool objects are unsupported, then we need to preload.
4221 # CHECK ME: I think I busted this. -Ossama
4222 if test "$prev" = dlprefiles; then
4223 # Preload the old-style object.
4224 dlprefiles="$dlprefiles $pic_object"
4229 func_append libobjs " $pic_object"
4234 if test "$non_pic_object" != none; then
4235 # Prepend the subdirectory the object is found in.
4236 non_pic_object="$xdir$non_pic_object"
4238 # A standard non-PIC object
4239 func_append non_pic_objects " $non_pic_object"
4240 if test -z "$pic_object" || test "$pic_object" = none ; then
4241 arg="$non_pic_object"
4244 # If the PIC object exists, use it instead.
4245 # $xdir was prepended to $pic_object above.
4246 non_pic_object="$pic_object"
4247 func_append non_pic_objects " $non_pic_object"
4250 # Only an error if not doing a dry-run.
4251 if $opt_dry_run; then
4252 # Extract subdirectory from the argument.
4253 func_dirname "$arg" "/" ""
4254 xdir="$func_dirname_result"
4257 pic_object=$xdir$objdir/$func_lo2o_result
4258 non_pic_object=$xdir$func_lo2o_result
4259 func_append libobjs " $pic_object"
4260 func_append non_pic_objects " $non_pic_object"
4262 func_fatal_error "\`$arg' is not a valid libtool object"
4269 deplibs="$deplibs $arg"
4270 old_deplibs="$old_deplibs $arg"
4275 # A libtool-controlled library.
4277 if test "$prev" = dlfiles; then
4278 # This library was specified with -dlopen.
4279 dlfiles="$dlfiles $arg"
4281 elif test "$prev" = dlprefiles; then
4282 # The library was specified with -dlpreopen.
4283 dlprefiles="$dlprefiles $arg"
4286 deplibs="$deplibs $arg"
4291 # Some other compiler argument.
4293 # Unknown arguments in both finalize_command and compile_command need
4294 # to be aesthetically quoted because they are evaled later.
4295 func_quote_for_eval "$arg"
4296 arg="$func_quote_for_eval_result"
4300 # Now actually substitute the argument into the commands.
4301 if test -n "$arg"; then
4302 func_append compile_command " $arg"
4303 func_append finalize_command " $arg"
4305 done # argument parsing loop
4307 test -n "$prev" && \
4308 func_fatal_help "the \`$prevarg' option requires an argument"
4310 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
4311 eval arg=\"$export_dynamic_flag_spec\"
4312 func_append compile_command " $arg"
4313 func_append finalize_command " $arg"
4317 # calculate the name of the file, without its directory
4318 func_basename "$output"
4319 outputname="$func_basename_result"
4320 libobjs_save="$libobjs"
4322 if test -n "$shlibpath_var"; then
4323 # get the directories listed in $shlibpath_var
4324 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
4328 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
4329 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
4331 func_dirname "$output" "/" ""
4332 output_objdir="$func_dirname_result$objdir"
4333 # Create the object directory.
4334 func_mkdir_p "$output_objdir"
4336 # Determine the type of output
4339 func_fatal_help "you must specify an output file"
4341 *.$libext) linkmode=oldlib ;;
4342 *.lo | *.$objext) linkmode=obj ;;
4343 *.la) linkmode=lib ;;
4344 *) linkmode=prog ;; # Anything else should be a program.
4350 # Find all interdependent deplibs by searching for libraries
4351 # that are linked more than once (e.g. -la -lb -la)
4352 for deplib in $deplibs; do
4353 if $opt_duplicate_deps ; then
4355 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4358 libs="$libs $deplib"
4361 if test "$linkmode" = lib; then
4362 libs="$predeps $libs $compiler_lib_search_path $postdeps"
4364 # Compute libraries that are listed more than once in $predeps
4365 # $postdeps and mark them as special (i.e., whose duplicates are
4366 # not to be eliminated).
4368 if $opt_duplicate_compiler_generated_deps; then
4369 for pre_post_dep in $predeps $postdeps; do
4370 case "$pre_post_deps " in
4371 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
4373 pre_post_deps="$pre_post_deps $pre_post_dep"
4382 need_relink=no # whether we're linking any uninstalled libtool libraries
4383 notinst_deplibs= # not-installed libtool libraries
4384 notinst_path= # paths that contain not-installed libtool libraries
4388 passes="conv dlpreopen link"
4389 for file in $dlfiles $dlprefiles; do
4393 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
4404 passes="conv scan dlopen dlpreopen link"
4410 for pass in $passes; do
4411 # The preopen pass in lib mode reverses $deplibs; put it back here
4412 # so that -L comes before libs that need it for instance...
4413 if test "$linkmode,$pass" = "lib,link"; then
4414 ## FIXME: Find the place where the list is rebuilt in the wrong
4415 ## order, and fix it there properly
4417 for deplib in $deplibs; do
4418 tmp_deplibs="$deplib $tmp_deplibs"
4420 deplibs="$tmp_deplibs"
4423 if test "$linkmode,$pass" = "lib,link" ||
4424 test "$linkmode,$pass" = "prog,scan"; then
4428 if test "$linkmode" = prog; then
4430 dlopen) libs="$dlfiles" ;;
4431 dlpreopen) libs="$dlprefiles" ;;
4432 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
4435 if test "$linkmode,$pass" = "lib,dlpreopen"; then
4436 # Collect and forward deplibs of preopened libtool libs
4437 for lib in $dlprefiles; do
4438 # Ignore non-libtool-libs
4441 *.la) func_source "$lib" ;;
4444 # Collect preopened libtool deplibs, except any this library
4445 # has declared as weak libs
4446 for deplib in $dependency_libs; do
4447 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
4448 case " $weak_libs " in
4449 *" $deplib_base "*) ;;
4450 *) deplibs="$deplibs $deplib" ;;
4456 if test "$pass" = dlopen; then
4457 # Collect dlpreopened libraries
4458 save_deplibs="$deplibs"
4462 for deplib in $libs; do
4466 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4467 if test "$linkmode,$pass" = "prog,link"; then
4468 compile_deplibs="$deplib $compile_deplibs"
4469 finalize_deplibs="$deplib $finalize_deplibs"
4471 compiler_flags="$compiler_flags $deplib"
4472 if test "$linkmode" = lib ; then
4473 case "$new_inherited_linker_flags " in
4475 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
4482 if test "$linkmode" != lib && test "$linkmode" != prog; then
4483 func_warning "\`-l' is ignored for archives/objects"
4486 func_stripname '-l' '' "$deplib"
4487 name=$func_stripname_result
4488 if test "$linkmode" = lib; then
4489 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
4491 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
4493 for searchdir in $searchdirs; do
4494 for search_ext in .la $std_shrext .so .a; do
4495 # Search the libtool library
4496 lib="$searchdir/lib${name}${search_ext}"
4497 if test -f "$lib"; then
4498 if test "$search_ext" = ".la"; then
4507 if test "$found" != yes; then
4508 # deplib doesn't seem to be a libtool library
4509 if test "$linkmode,$pass" = "prog,link"; then
4510 compile_deplibs="$deplib $compile_deplibs"
4511 finalize_deplibs="$deplib $finalize_deplibs"
4513 deplibs="$deplib $deplibs"
4514 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
4517 else # deplib is a libtool library
4518 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
4519 # We need to do some special things here, and not later.
4520 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
4521 case " $predeps $postdeps " in
4523 if func_lalib_p "$lib"; then
4527 for l in $old_library $library_names; do
4530 if test "X$ll" = "X$old_library" ; then # only static version available
4532 func_dirname "$lib" "" "."
4533 ladir="$func_dirname_result"
4534 lib=$ladir/$old_library
4535 if test "$linkmode,$pass" = "prog,link"; then
4536 compile_deplibs="$deplib $compile_deplibs"
4537 finalize_deplibs="$deplib $finalize_deplibs"
4539 deplibs="$deplib $deplibs"
4540 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
4552 if test "$linkmode,$pass" = "prog,link"; then
4553 compile_deplibs="$deplib $compile_deplibs"
4554 finalize_deplibs="$deplib $finalize_deplibs"
4556 deplibs="$deplib $deplibs"
4557 if test "$linkmode" = lib ; then
4558 case "$new_inherited_linker_flags " in
4560 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
4569 deplibs="$deplib $deplibs"
4570 test "$pass" = conv && continue
4571 newdependency_libs="$deplib $newdependency_libs"
4572 func_stripname '-L' '' "$deplib"
4573 newlib_search_path="$newlib_search_path $func_stripname_result"
4576 if test "$pass" = conv; then
4577 deplibs="$deplib $deplibs"
4580 if test "$pass" = scan; then
4581 deplibs="$deplib $deplibs"
4583 compile_deplibs="$deplib $compile_deplibs"
4584 finalize_deplibs="$deplib $finalize_deplibs"
4586 func_stripname '-L' '' "$deplib"
4587 newlib_search_path="$newlib_search_path $func_stripname_result"
4590 func_warning "\`-L' is ignored for archives/objects"
4596 if test "$pass" = link; then
4597 func_stripname '-R' '' "$deplib"
4598 dir=$func_stripname_result
4599 # Make sure the xrpath contains only unique directories.
4602 *) xrpath="$xrpath $dir" ;;
4605 deplibs="$deplib $deplibs"
4608 *.la) lib="$deplib" ;;
4610 if test "$pass" = conv; then
4611 deplibs="$deplib $deplibs"
4616 # Linking convenience modules into shared libraries is allowed,
4617 # but linking other static libraries is non-portable.
4618 case " $dlpreconveniencelibs " in
4622 case $deplibs_check_method in
4624 set dummy $deplibs_check_method; shift
4625 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
4626 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
4627 | $EGREP "$match_pattern_regex" > /dev/null; then
4635 if test "$valid_a_lib" != yes; then
4637 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
4638 $ECHO "*** I have the capability to make that library automatically link in when"
4639 $ECHO "*** you link to this library. But I can only do this if you have a"
4640 $ECHO "*** shared version of the library, which you do not appear to have"
4641 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
4642 $ECHO "*** that it is just a static archive that I should not use here."
4645 $ECHO "*** Warning: Linking the shared library $output against the"
4646 $ECHO "*** static library $deplib is not portable!"
4647 deplibs="$deplib $deplibs"
4654 if test "$pass" != link; then
4655 deplibs="$deplib $deplibs"
4657 compile_deplibs="$deplib $compile_deplibs"
4658 finalize_deplibs="$deplib $finalize_deplibs"
4665 if test "$pass" = conv; then
4666 deplibs="$deplib $deplibs"
4667 elif test "$linkmode" = prog; then
4668 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
4669 # If there is no dlopen support or we're linking statically,
4670 # we need to preload.
4671 newdlprefiles="$newdlprefiles $deplib"
4672 compile_deplibs="$deplib $compile_deplibs"
4673 finalize_deplibs="$deplib $finalize_deplibs"
4675 newdlfiles="$newdlfiles $deplib"
4686 if test "$found" = yes || test -f "$lib"; then :
4688 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
4691 # Check to see that this really is a libtool archive.
4692 func_lalib_unsafe_p "$lib" \
4693 || func_fatal_error "\`$lib' is not a valid libtool archive"
4695 func_dirname "$lib" "" "."
4696 ladir="$func_dirname_result"
4704 inherited_linker_flags=
4705 # If the library was installed with an old release of libtool,
4706 # it will not redefine variables installed, or shouldnotlink
4715 # Convert "-framework foo" to "foo.ltframework"
4716 if test -n "$inherited_linker_flags"; then
4717 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
4718 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
4719 case " $new_inherited_linker_flags " in
4720 *" $tmp_inherited_linker_flag "*) ;;
4721 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
4725 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
4726 if test "$linkmode,$pass" = "lib,link" ||
4727 test "$linkmode,$pass" = "prog,scan" ||
4728 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
4729 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
4730 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
4733 if test "$pass" = conv; then
4734 # Only check for convenience libraries
4735 deplibs="$lib $deplibs"
4736 if test -z "$libdir"; then
4737 if test -z "$old_library"; then
4738 func_fatal_error "cannot find name of link library for \`$lib'"
4740 # It is a libtool convenience library, so add in its objects.
4741 convenience="$convenience $ladir/$objdir/$old_library"
4742 old_convenience="$old_convenience $ladir/$objdir/$old_library"
4743 elif test "$linkmode" != prog && test "$linkmode" != lib; then
4744 func_fatal_error "\`$lib' is not a convenience library"
4747 for deplib in $dependency_libs; do
4748 deplibs="$deplib $deplibs"
4749 if $opt_duplicate_deps ; then
4750 case "$tmp_libs " in
4751 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4754 tmp_libs="$tmp_libs $deplib"
4760 # Get the name of the library we link against.
4762 for l in $old_library $library_names; do
4765 if test -z "$linklib"; then
4766 func_fatal_error "cannot find name of link library for \`$lib'"
4769 # This library was specified with -dlopen.
4770 if test "$pass" = dlopen; then
4771 if test -z "$libdir"; then
4772 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
4774 if test -z "$dlname" ||
4775 test "$dlopen_support" != yes ||
4776 test "$build_libtool_libs" = no; then
4777 # If there is no dlname, no dlopen support or we're linking
4778 # statically, we need to preload. We also need to preload any
4779 # dependent libraries so libltdl's deplib preloader doesn't
4780 # bomb out in the load deplibs phase.
4781 dlprefiles="$dlprefiles $lib $dependency_libs"
4783 newdlfiles="$newdlfiles $lib"
4788 # We need an absolute path.
4790 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
4792 abs_ladir=`cd "$ladir" && pwd`
4793 if test -z "$abs_ladir"; then
4794 func_warning "cannot determine absolute directory name of \`$ladir'"
4795 func_warning "passing it literally to the linker, although it might fail"
4800 func_basename "$lib"
4801 laname="$func_basename_result"
4803 # Find the relevant object directory and library name.
4804 if test "X$installed" = Xyes; then
4805 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
4806 func_warning "library \`$lib' was moved."
4814 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
4816 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
4819 # Remove this search path later
4820 notinst_path="$notinst_path $abs_ladir"
4822 dir="$ladir/$objdir"
4823 absdir="$abs_ladir/$objdir"
4824 # Remove this search path later
4825 notinst_path="$notinst_path $abs_ladir"
4827 fi # $installed = yes
4828 func_stripname 'lib' '.la' "$laname"
4829 name=$func_stripname_result
4831 # This library was specified with -dlpreopen.
4832 if test "$pass" = dlpreopen; then
4833 if test -z "$libdir" && test "$linkmode" = prog; then
4834 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
4836 # Prefer using a static library (so that no silly _DYNAMIC symbols
4837 # are required to link).
4838 if test -n "$old_library"; then
4839 newdlprefiles="$newdlprefiles $dir/$old_library"
4840 # Keep a list of preopened convenience libraries to check
4841 # that they are being used correctly in the link pass.
4842 test -z "$libdir" && \
4843 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
4844 # Otherwise, use the dlname, so that lt_dlopen finds it.
4845 elif test -n "$dlname"; then
4846 newdlprefiles="$newdlprefiles $dir/$dlname"
4848 newdlprefiles="$newdlprefiles $dir/$linklib"
4850 fi # $pass = dlpreopen
4852 if test -z "$libdir"; then
4853 # Link the convenience library
4854 if test "$linkmode" = lib; then
4855 deplibs="$dir/$old_library $deplibs"
4856 elif test "$linkmode,$pass" = "prog,link"; then
4857 compile_deplibs="$dir/$old_library $compile_deplibs"
4858 finalize_deplibs="$dir/$old_library $finalize_deplibs"
4860 deplibs="$lib $deplibs" # used for prog,scan pass
4866 if test "$linkmode" = prog && test "$pass" != link; then
4867 newlib_search_path="$newlib_search_path $ladir"
4868 deplibs="$lib $deplibs"
4871 if test "$link_all_deplibs" != no || test -z "$library_names" ||
4872 test "$build_libtool_libs" = no; then
4877 for deplib in $dependency_libs; do
4879 -L*) func_stripname '-L' '' "$deplib"
4880 newlib_search_path="$newlib_search_path $func_stripname_result"
4883 # Need to link against all dependency_libs?
4884 if test "$linkalldeplibs" = yes; then
4885 deplibs="$deplib $deplibs"
4887 # Need to hardcode shared library paths
4888 # or/and link against static libraries
4889 newdependency_libs="$deplib $newdependency_libs"
4891 if $opt_duplicate_deps ; then
4892 case "$tmp_libs " in
4893 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4896 tmp_libs="$tmp_libs $deplib"
4899 fi # $linkmode = prog...
4901 if test "$linkmode,$pass" = "prog,link"; then
4902 if test -n "$library_names" &&
4903 { { test "$prefer_static_libs" = no ||
4904 test "$prefer_static_libs,$installed" = "built,yes"; } ||
4905 test -z "$old_library"; }; then
4906 # We need to hardcode the library path
4907 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
4908 # Make sure the rpath contains only unique directories.
4909 case "$temp_rpath:" in
4911 *) temp_rpath="$temp_rpath$absdir:" ;;
4915 # Hardcode the library path.
4916 # Skip directories that are in the system default run-time
4918 case " $sys_lib_dlsearch_path " in
4921 case "$compile_rpath " in
4923 *) compile_rpath="$compile_rpath $absdir"
4927 case " $sys_lib_dlsearch_path " in
4930 case "$finalize_rpath " in
4932 *) finalize_rpath="$finalize_rpath $libdir"
4936 fi # $linkmode,$pass = prog,link...
4938 if test "$alldeplibs" = yes &&
4939 { test "$deplibs_check_method" = pass_all ||
4940 { test "$build_libtool_libs" = yes &&
4941 test -n "$library_names"; }; }; then
4942 # We only need to search for static libraries
4947 link_static=no # Whether the deplib will be linked statically
4948 use_static_libs=$prefer_static_libs
4949 if test "$use_static_libs" = built && test "$installed" = yes; then
4952 if test -n "$library_names" &&
4953 { test "$use_static_libs" = no || test -z "$old_library"; }; then
4956 # No point in relinking DLLs because paths are not encoded
4957 notinst_deplibs="$notinst_deplibs $lib"
4961 if test "$installed" = no; then
4962 notinst_deplibs="$notinst_deplibs $lib"
4967 # This is a shared library
4969 # Warn about portability, can't link against -module's on some
4970 # systems (darwin). Don't bleat about dlopened modules though!
4972 for dlpremoduletest in $dlprefiles; do
4973 if test "X$dlpremoduletest" = "X$lib"; then
4974 dlopenmodule="$dlpremoduletest"
4978 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
4980 if test "$linkmode" = prog; then
4981 $ECHO "*** Warning: Linking the executable $output against the loadable module"
4983 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
4985 $ECHO "*** $linklib is not portable!"
4987 if test "$linkmode" = lib &&
4988 test "$hardcode_into_libs" = yes; then
4989 # Hardcode the library path.
4990 # Skip directories that are in the system default run-time
4992 case " $sys_lib_dlsearch_path " in
4995 case "$compile_rpath " in
4997 *) compile_rpath="$compile_rpath $absdir"
5001 case " $sys_lib_dlsearch_path " in
5004 case "$finalize_rpath " in
5006 *) finalize_rpath="$finalize_rpath $libdir"
5012 if test -n "$old_archive_from_expsyms_cmds"; then
5013 # figure out the soname
5014 set dummy $library_names
5018 libname=`eval "\\$ECHO \"$libname_spec\""`
5019 # use dlname if we got it. it's perfectly good, no?
5020 if test -n "$dlname"; then
5022 elif test -n "$soname_spec"; then
5026 major=`expr $current - $age`
5030 eval soname=\"$soname_spec\"
5035 # Make a new name for the extract_expsyms_cmds to use
5037 func_basename "$soroot"
5038 soname="$func_basename_result"
5039 func_stripname 'lib' '.dll' "$soname"
5040 newlib=libimp-$func_stripname_result.a
5042 # If the library has no export list, then create one now
5043 if test -f "$output_objdir/$soname-def"; then :
5045 func_verbose "extracting exported symbol list from \`$soname'"
5046 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
5050 if test -f "$output_objdir/$newlib"; then :; else
5051 func_verbose "generating import library for \`$soname'"
5052 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
5054 # make sure the library variables are pointing to the new library
5057 fi # test -n "$old_archive_from_expsyms_cmds"
5059 if test "$linkmode" = prog || test "$mode" != relink; then
5064 case $hardcode_action in
5065 immediate | unsupported)
5066 if test "$hardcode_direct" = no; then
5069 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
5070 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
5071 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
5072 *-*-unixware7*) add_dir="-L$dir" ;;
5074 # if the lib is a (non-dlopened) module then we can not
5075 # link against it, someone is ignoring the earlier warnings
5076 if /usr/bin/file -L $add 2> /dev/null |
5077 $GREP ": [^:]* bundle" >/dev/null ; then
5078 if test "X$dlopenmodule" != "X$lib"; then
5079 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
5080 if test -z "$old_library" ; then
5082 $ECHO "*** And there doesn't seem to be a static archive available"
5083 $ECHO "*** The link will probably fail, sorry"
5085 add="$dir/$old_library"
5087 elif test -n "$old_library"; then
5088 add="$dir/$old_library"
5092 elif test "$hardcode_minus_L" = no; then
5094 *-*-sunos*) add_shlibpath="$dir" ;;
5098 elif test "$hardcode_shlibpath_var" = no; then
5099 add_shlibpath="$dir"
5106 if test "$hardcode_direct" = yes &&
5107 test "$hardcode_direct_absolute" = no; then
5109 elif test "$hardcode_minus_L" = yes; then
5111 # Try looking first in the location we're being installed to.
5112 if test -n "$inst_prefix_dir"; then
5115 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5120 elif test "$hardcode_shlibpath_var" = yes; then
5121 add_shlibpath="$dir"
5130 if test "$lib_linked" != yes; then
5131 func_fatal_configuration "unsupported hardcode properties"
5134 if test -n "$add_shlibpath"; then
5135 case :$compile_shlibpath: in
5136 *":$add_shlibpath:"*) ;;
5137 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
5140 if test "$linkmode" = prog; then
5141 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
5142 test -n "$add" && compile_deplibs="$add $compile_deplibs"
5144 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5145 test -n "$add" && deplibs="$add $deplibs"
5146 if test "$hardcode_direct" != yes &&
5147 test "$hardcode_minus_L" != yes &&
5148 test "$hardcode_shlibpath_var" = yes; then
5149 case :$finalize_shlibpath: in
5151 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5157 if test "$linkmode" = prog || test "$mode" = relink; then
5161 # Finalize command for both is simple: just hardcode it.
5162 if test "$hardcode_direct" = yes &&
5163 test "$hardcode_direct_absolute" = no; then
5164 add="$libdir/$linklib"
5165 elif test "$hardcode_minus_L" = yes; then
5168 elif test "$hardcode_shlibpath_var" = yes; then
5169 case :$finalize_shlibpath: in
5171 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5174 elif test "$hardcode_automatic" = yes; then
5175 if test -n "$inst_prefix_dir" &&
5176 test -f "$inst_prefix_dir$libdir/$linklib" ; then
5177 add="$inst_prefix_dir$libdir/$linklib"
5179 add="$libdir/$linklib"
5182 # We cannot seem to hardcode it, guess we'll fake it.
5184 # Try looking first in the location we're being installed to.
5185 if test -n "$inst_prefix_dir"; then
5188 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5195 if test "$linkmode" = prog; then
5196 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
5197 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
5199 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5200 test -n "$add" && deplibs="$add $deplibs"
5203 elif test "$linkmode" = prog; then
5204 # Here we assume that one of hardcode_direct or hardcode_minus_L
5205 # is not unsupported. This is valid on all known static and
5207 if test "$hardcode_direct" != unsupported; then
5208 test -n "$old_library" && linklib="$old_library"
5209 compile_deplibs="$dir/$linklib $compile_deplibs"
5210 finalize_deplibs="$dir/$linklib $finalize_deplibs"
5212 compile_deplibs="-l$name -L$dir $compile_deplibs"
5213 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
5215 elif test "$build_libtool_libs" = yes; then
5216 # Not a shared library
5217 if test "$deplibs_check_method" != pass_all; then
5218 # We're trying link a shared library against a static one
5219 # but the system doesn't support it.
5221 # Just print a warning and add the library to dependency_libs so
5222 # that the program can be linked against the static library.
5224 $ECHO "*** Warning: This system can not link to static lib archive $lib."
5225 $ECHO "*** I have the capability to make that library automatically link in when"
5226 $ECHO "*** you link to this library. But I can only do this if you have a"
5227 $ECHO "*** shared version of the library, which you do not appear to have."
5228 if test "$module" = yes; then
5229 $ECHO "*** But as you try to build a module library, libtool will still create "
5230 $ECHO "*** a static module, that should work as long as the dlopening application"
5231 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
5232 if test -z "$global_symbol_pipe"; then
5234 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5235 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5236 $ECHO "*** not find such a program. So, this module is probably useless."
5237 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
5239 if test "$build_old_libs" = no; then
5240 build_libtool_libs=module
5243 build_libtool_libs=no
5247 deplibs="$dir/$old_library $deplibs"
5250 fi # link shared/static library?
5252 if test "$linkmode" = lib; then
5253 if test -n "$dependency_libs" &&
5254 { test "$hardcode_into_libs" != yes ||
5255 test "$build_old_libs" = yes ||
5256 test "$link_static" = yes; }; then
5257 # Extract -R from dependency_libs
5259 for libdir in $dependency_libs; do
5261 -R*) func_stripname '-R' '' "$libdir"
5262 temp_xrpath=$func_stripname_result
5264 *" $temp_xrpath "*) ;;
5265 *) xrpath="$xrpath $temp_xrpath";;
5267 *) temp_deplibs="$temp_deplibs $libdir";;
5270 dependency_libs="$temp_deplibs"
5273 newlib_search_path="$newlib_search_path $absdir"
5274 # Link against this library
5275 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
5276 # ... and its dependency_libs
5278 for deplib in $dependency_libs; do
5279 newdependency_libs="$deplib $newdependency_libs"
5280 if $opt_duplicate_deps ; then
5281 case "$tmp_libs " in
5282 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5285 tmp_libs="$tmp_libs $deplib"
5288 if test "$link_all_deplibs" != no; then
5289 # Add the search paths of all dependency libraries
5290 for deplib in $dependency_libs; do
5292 -L*) path="$deplib" ;;
5294 func_dirname "$deplib" "" "."
5295 dir="$func_dirname_result"
5296 # We need an absolute path.
5298 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
5300 absdir=`cd "$dir" && pwd`
5301 if test -z "$absdir"; then
5302 func_warning "cannot determine absolute directory name of \`$dir'"
5307 if $GREP "^installed=no" $deplib > /dev/null; then
5311 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
5312 if test -n "$deplibrary_names" ; then
5313 for tmp in $deplibrary_names ; do
5316 if test -f "$absdir/$objdir/$depdepl" ; then
5317 depdepl="$absdir/$objdir/$depdepl"
5318 darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
5319 darwin_install_name=`$ECHO $darwin_install_name`
5320 if test -z "$darwin_install_name"; then
5321 darwin_install_name=`otool64 -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
5322 darwin_install_name=`$ECHO $darwin_install_name`
5324 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
5325 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
5331 path="-L$absdir/$objdir"
5335 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5336 test -z "$libdir" && \
5337 func_fatal_error "\`$deplib' is not a valid libtool archive"
5338 test "$absdir" != "$libdir" && \
5339 func_warning "\`$deplib' seems to be moved"
5345 case " $deplibs " in
5347 *) deplibs="$path $deplibs" ;;
5350 fi # link_all_deplibs != no
5352 done # for deplib in $libs
5353 if test "$pass" = link; then
5354 if test "$linkmode" = "prog"; then
5355 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
5356 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
5358 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5361 dependency_libs="$newdependency_libs"
5362 if test "$pass" = dlpreopen; then
5363 # Link the dlpreopened libraries before other libraries
5364 for deplib in $save_deplibs; do
5365 deplibs="$deplib $deplibs"
5368 if test "$pass" != dlopen; then
5369 if test "$pass" != conv; then
5370 # Make sure lib_search_path contains only unique directories.
5372 for dir in $newlib_search_path; do
5373 case "$lib_search_path " in
5375 *) lib_search_path="$lib_search_path $dir" ;;
5381 if test "$linkmode,$pass" != "prog,link"; then
5384 vars="compile_deplibs finalize_deplibs"
5386 for var in $vars dependency_libs; do
5387 # Add libraries to $var in reverse order
5388 eval tmp_libs=\"\$$var\"
5390 for deplib in $tmp_libs; do
5391 # FIXME: Pedantically, this is the right thing to do, so
5392 # that some nasty dependency loop isn't accidentally
5394 #new_libs="$deplib $new_libs"
5395 # Pragmatically, this seems to cause very few problems in
5398 -L*) new_libs="$deplib $new_libs" ;;
5401 # And here is the reason: when a library appears more
5402 # than once as an explicit dependence of a library, or
5403 # is implicitly linked in more than once by the
5404 # compiler, it is considered special, and multiple
5405 # occurrences thereof are not removed. Compare this
5406 # with having the same library being listed as a
5407 # dependency of multiple other libraries: in this case,
5408 # we know (pedantically, we assume) the library does not
5409 # need to be listed more than once, so we keep only the
5410 # last copy. This is not always right, but it is rare
5411 # enough that we require users that really mean to play
5412 # such unportable linking tricks to link the library
5413 # using -Wl,-lname, so that libtool does not consider it
5414 # for duplicate removal.
5415 case " $specialdeplibs " in
5416 *" $deplib "*) new_libs="$deplib $new_libs" ;;
5418 case " $new_libs " in
5420 *) new_libs="$deplib $new_libs" ;;
5428 for deplib in $new_libs; do
5431 case " $tmp_libs " in
5433 *) tmp_libs="$tmp_libs $deplib" ;;
5436 *) tmp_libs="$tmp_libs $deplib" ;;
5439 eval $var=\"$tmp_libs\"
5442 # Last step: remove runtime libs from dependency_libs
5443 # (they stay in deplibs)
5445 for i in $dependency_libs ; do
5446 case " $predeps $postdeps $compiler_lib_search_path " in
5451 if test -n "$i" ; then
5452 tmp_libs="$tmp_libs $i"
5455 dependency_libs=$tmp_libs
5457 if test "$linkmode" = prog; then
5458 dlfiles="$newdlfiles"
5460 if test "$linkmode" = prog || test "$linkmode" = lib; then
5461 dlprefiles="$newdlprefiles"
5466 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
5467 func_warning "\`-dlopen' is ignored for archives"
5472 func_warning "\`-l' and \`-L' are ignored for archives" ;;
5475 test -n "$rpath" && \
5476 func_warning "\`-rpath' is ignored for archives"
5478 test -n "$xrpath" && \
5479 func_warning "\`-R' is ignored for archives"
5481 test -n "$vinfo" && \
5482 func_warning "\`-version-info/-version-number' is ignored for archives"
5484 test -n "$release" && \
5485 func_warning "\`-release' is ignored for archives"
5487 test -n "$export_symbols$export_symbols_regex" && \
5488 func_warning "\`-export-symbols' is ignored for archives"
5490 # Now set the variables for building old libraries.
5491 build_libtool_libs=no
5493 objs="$objs$old_deplibs"
5497 # Make sure we only generate libraries of the form `libNAME.la'.
5500 func_stripname 'lib' '.la' "$outputname"
5501 name=$func_stripname_result
5502 eval shared_ext=\"$shrext_cmds\"
5503 eval libname=\"$libname_spec\"
5506 test "$module" = no && \
5507 func_fatal_help "libtool library \`$output' must begin with \`lib'"
5509 if test "$need_lib_prefix" != no; then
5510 # Add the "lib" prefix for modules if required
5511 func_stripname '' '.la' "$outputname"
5512 name=$func_stripname_result
5513 eval shared_ext=\"$shrext_cmds\"
5514 eval libname=\"$libname_spec\"
5516 func_stripname '' '.la' "$outputname"
5517 libname=$func_stripname_result
5522 if test -n "$objs"; then
5523 if test "$deplibs_check_method" != pass_all; then
5524 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
5527 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
5528 $ECHO "*** objects $objs is not portable!"
5529 libobjs="$libobjs $objs"
5533 test "$dlself" != no && \
5534 func_warning "\`-dlopen self' is ignored for libtool libraries"
5538 test "$#" -gt 1 && \
5539 func_warning "ignoring multiple \`-rpath's for a libtool library"
5544 if test -z "$rpath"; then
5545 if test "$build_libtool_libs" = yes; then
5546 # Building a libtool convenience library.
5547 # Some compilers have problems with a `.al' extension so
5548 # convenience libraries should have the same extension an
5549 # archive normally would.
5550 oldlibs="$output_objdir/$libname.$libext $oldlibs"
5551 build_libtool_libs=convenience
5555 test -n "$vinfo" && \
5556 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
5558 test -n "$release" && \
5559 func_warning "\`-release' is ignored for convenience libraries"
5562 # Parse the version information argument.
5563 save_ifs="$IFS"; IFS=':'
5564 set dummy $vinfo 0 0 0
5569 func_fatal_help "too many parameters to \`-version-info'"
5571 # convert absolute version numbers to libtool ages
5572 # this retains compatibility with .la files and attempts
5573 # to make the code below a bit more comprehensible
5575 case $vinfo_number in
5579 number_revision="$3"
5581 # There are really only two kinds -- those that
5582 # use the current revision as the major version
5583 # and those that subtract age and use age as
5584 # a minor version. But, then there is irix
5585 # which has an extra 1 added just for fun
5587 case $version_type in
5588 darwin|linux|osf|windows|none)
5589 current=`expr $number_major + $number_minor`
5591 revision="$number_revision"
5593 freebsd-aout|freebsd-elf|sunos)
5594 current="$number_major"
5595 revision="$number_minor"
5599 current=`expr $number_major + $number_minor`
5601 revision="$number_minor"
5602 lt_irix_increment=no
5613 # Check that each of the things are valid numbers.
5615 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]) ;;
5617 func_error "CURRENT \`$current' must be a nonnegative integer"
5618 func_fatal_error "\`$vinfo' is not valid version information"
5623 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]) ;;
5625 func_error "REVISION \`$revision' must be a nonnegative integer"
5626 func_fatal_error "\`$vinfo' is not valid version information"
5631 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]) ;;
5633 func_error "AGE \`$age' must be a nonnegative integer"
5634 func_fatal_error "\`$vinfo' is not valid version information"
5638 if test "$age" -gt "$current"; then
5639 func_error "AGE \`$age' is greater than the current interface number \`$current'"
5640 func_fatal_error "\`$vinfo' is not valid version information"
5643 # Calculate the version variables.
5647 case $version_type in
5651 # Like Linux, but with the current version available in
5652 # verstring for coding it into the library header
5653 major=.`expr $current - $age`
5654 versuffix="$major.$age.$revision"
5655 # Darwin ld doesn't like 0 for these options...
5656 minor_current=`expr $current + 1`
5657 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
5658 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
5663 versuffix=".$current.$revision";
5668 versuffix=".$current"
5672 if test "X$lt_irix_increment" = "Xno"; then
5673 major=`expr $current - $age`
5675 major=`expr $current - $age + 1`
5678 case $version_type in
5679 nonstopux) verstring_prefix=nonstopux ;;
5680 *) verstring_prefix=sgi ;;
5682 verstring="$verstring_prefix$major.$revision"
5684 # Add in all the interfaces that we are compatible with.
5686 while test "$loop" -ne 0; do
5687 iface=`expr $revision - $loop`
5688 loop=`expr $loop - 1`
5689 verstring="$verstring_prefix$major.$iface:$verstring"
5692 # Before this point, $major must not contain `.'.
5694 versuffix="$major.$revision"
5698 major=.`expr $current - $age`
5699 versuffix="$major.$age.$revision"
5703 major=.`expr $current - $age`
5704 versuffix=".$current.$age.$revision"
5705 verstring="$current.$age.$revision"
5707 # Add in all the interfaces that we are compatible with.
5709 while test "$loop" -ne 0; do
5710 iface=`expr $current - $loop`
5711 loop=`expr $loop - 1`
5712 verstring="$verstring:${iface}.0"
5715 # Make executables depend on our current version.
5716 verstring="$verstring:${current}.0"
5721 versuffix=".$current"
5726 versuffix=".$current.$revision"
5730 # Use '-' rather than '.', since we only want one
5731 # extension on DOS 8.3 filesystems.
5732 major=`expr $current - $age`
5737 func_fatal_configuration "unknown library version type \`$version_type'"
5741 # Clear the version info if we defaulted, and they specified a release.
5742 if test -z "$vinfo" && test -n "$release"; then
5744 case $version_type in
5746 # we can't check for "0.0" in archive_cmds due to quoting
5747 # problems, so we reset it completely
5754 if test "$need_version" = no; then
5761 # Remove version info from name if versioning should be avoided
5762 if test "$avoid_version" = yes && test "$need_version" = no; then
5768 # Check to see if the archive will have undefined symbols.
5769 if test "$allow_undefined" = yes; then
5770 if test "$allow_undefined_flag" = unsupported; then
5771 func_warning "undefined symbols not allowed in $host shared libraries"
5772 build_libtool_libs=no
5776 # Don't allow undefined symbols.
5777 allow_undefined_flag="$no_undefined_flag"
5782 func_generate_dlsyms "$libname" "$libname" "yes"
5783 libobjs="$libobjs $symfileobj"
5784 test "X$libobjs" = "X " && libobjs=
5786 if test "$mode" != relink; then
5787 # Remove our outputs, but don't remove object files since they
5788 # may have been created when compiling PIC objects.
5790 tempremovelist=`$ECHO "$output_objdir/*"`
5791 for p in $tempremovelist; do
5795 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
5796 if test "X$precious_files_regex" != "X"; then
5797 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
5802 removelist="$removelist $p"
5807 test -n "$removelist" && \
5808 func_show_eval "${RM}r \$removelist"
5811 # Now set the variables for building old libraries.
5812 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
5813 oldlibs="$oldlibs $output_objdir/$libname.$libext"
5815 # Transform .lo files to .o files.
5816 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
5819 # Eliminate all temporary directories.
5820 #for path in $notinst_path; do
5821 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
5822 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
5823 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
5826 if test -n "$xrpath"; then
5827 # If the user specified any rpath flags, then add them.
5829 for libdir in $xrpath; do
5830 temp_xrpath="$temp_xrpath -R$libdir"
5831 case "$finalize_rpath " in
5833 *) finalize_rpath="$finalize_rpath $libdir" ;;
5836 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
5837 dependency_libs="$temp_xrpath $dependency_libs"
5841 # Make sure dlfiles contains only unique files that won't be dlpreopened
5842 old_dlfiles="$dlfiles"
5844 for lib in $old_dlfiles; do
5845 case " $dlprefiles $dlfiles " in
5847 *) dlfiles="$dlfiles $lib" ;;
5851 # Make sure dlprefiles contains only unique files
5852 old_dlprefiles="$dlprefiles"
5854 for lib in $old_dlprefiles; do
5855 case "$dlprefiles " in
5857 *) dlprefiles="$dlprefiles $lib" ;;
5861 if test "$build_libtool_libs" = yes; then
5862 if test -n "$rpath"; then
5864 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
5865 # these systems don't actually have a c library (as such)!
5867 *-*-rhapsody* | *-*-darwin1.[012])
5868 # Rhapsody C library is in the System framework
5869 deplibs="$deplibs System.ltframework"
5872 # Don't link with libc until the a.out ld.so is fixed.
5874 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5875 # Do not include libc due to us having libc/libc_r.
5877 *-*-sco3.2v5* | *-*-sco5v6*)
5878 # Causes problems with __ctype
5880 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5881 # Compiler inserts libc in the correct place for threads to work
5884 # Add libc to deplibs on all other systems if necessary.
5885 if test "$build_libtool_need_lc" = "yes"; then
5886 deplibs="$deplibs -lc"
5892 # Transform deplibs into only deplibs that can be linked in shared.
5894 libname_save=$libname
5895 release_save=$release
5896 versuffix_save=$versuffix
5898 # I'm not sure if I'm treating the release correctly. I think
5899 # release should show up in the -l (ie -lgmp5) so we don't want to
5900 # add it in twice. Is that correct?
5906 case $deplibs_check_method in
5908 # Don't check for shared/static. Everything works.
5909 # This might be a little naive. We might want to check
5910 # whether the library exists or not. But this is on
5911 # osf3 & osf4 and I'm not really sure... Just
5912 # implementing what was already the behavior.
5916 # This code stresses the "libraries are programs" paradigm to its
5917 # limits. Maybe even breaks it. We compile a program, linking it
5918 # against the deplibs as a proxy for the library. Then we can check
5919 # whether they linked in statically or dynamically with ldd.
5920 $opt_dry_run || $RM conftest.c
5921 cat > conftest.c <<EOF
5922 int main() { return 0; }
5924 $opt_dry_run || $RM conftest
5925 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
5926 ldd_output=`ldd conftest`
5927 for i in $deplibs; do
5928 name=`expr $i : '-l\(.*\)'`
5929 # If $name is empty we are operating on a -L argument.
5930 if test "$name" != "" && test "$name" != "0"; then
5931 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5932 case " $predeps $postdeps " in
5934 newdeplibs="$newdeplibs $i"
5939 if test -n "$i" ; then
5940 libname=`eval "\\$ECHO \"$libname_spec\""`
5941 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5942 set dummy $deplib_matches; shift
5944 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5945 newdeplibs="$newdeplibs $i"
5949 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
5950 $ECHO "*** I have the capability to make that library automatically link in when"
5951 $ECHO "*** you link to this library. But I can only do this if you have a"
5952 $ECHO "*** shared version of the library, which I believe you do not have"
5953 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
5954 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
5958 newdeplibs="$newdeplibs $i"
5962 # Error occurred in the first compile. Let's try to salvage
5963 # the situation: Compile a separate program for each library.
5964 for i in $deplibs; do
5965 name=`expr $i : '-l\(.*\)'`
5966 # If $name is empty we are operating on a -L argument.
5967 if test "$name" != "" && test "$name" != "0"; then
5968 $opt_dry_run || $RM conftest
5969 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
5970 ldd_output=`ldd conftest`
5971 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5972 case " $predeps $postdeps " in
5974 newdeplibs="$newdeplibs $i"
5979 if test -n "$i" ; then
5980 libname=`eval "\\$ECHO \"$libname_spec\""`
5981 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5982 set dummy $deplib_matches; shift
5984 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5985 newdeplibs="$newdeplibs $i"
5989 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
5990 $ECHO "*** I have the capability to make that library automatically link in when"
5991 $ECHO "*** you link to this library. But I can only do this if you have a"
5992 $ECHO "*** shared version of the library, which you do not appear to have"
5993 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
5994 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
6000 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
6001 $ECHO "*** make it link in! You will probably need to install it or some"
6002 $ECHO "*** library that it depends on before this library will be fully"
6003 $ECHO "*** functional. Installing it before continuing would be even better."
6006 newdeplibs="$newdeplibs $i"
6012 set dummy $deplibs_check_method; shift
6013 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6014 for a_deplib in $deplibs; do
6015 name=`expr $a_deplib : '-l\(.*\)'`
6016 # If $name is empty we are operating on a -L argument.
6017 if test "$name" != "" && test "$name" != "0"; then
6018 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6019 case " $predeps $postdeps " in
6021 newdeplibs="$newdeplibs $a_deplib"
6026 if test -n "$a_deplib" ; then
6027 libname=`eval "\\$ECHO \"$libname_spec\""`
6028 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6029 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6030 for potent_lib in $potential_libs; do
6031 # Follow soft links.
6032 if ls -lLd "$potent_lib" 2>/dev/null |
6033 $GREP " -> " >/dev/null; then
6036 # The statement above tries to avoid entering an
6037 # endless loop below, in case of cyclic links.
6038 # We might still enter an endless loop, since a link
6039 # loop can be closed while we follow links,
6041 potlib="$potent_lib"
6042 while test -h "$potlib" 2>/dev/null; do
6043 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
6045 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
6046 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
6049 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
6051 $EGREP "$file_magic_regex" > /dev/null; then
6052 newdeplibs="$newdeplibs $a_deplib"
6059 if test -n "$a_deplib" ; then
6062 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6063 $ECHO "*** I have the capability to make that library automatically link in when"
6064 $ECHO "*** you link to this library. But I can only do this if you have a"
6065 $ECHO "*** shared version of the library, which you do not appear to have"
6066 $ECHO "*** because I did check the linker path looking for a file starting"
6067 if test -z "$potlib" ; then
6068 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
6070 $ECHO "*** with $libname and none of the candidates passed a file format test"
6071 $ECHO "*** using a file magic. Last file checked: $potlib"
6075 # Add a -L argument.
6076 newdeplibs="$newdeplibs $a_deplib"
6078 done # Gone through all deplibs.
6081 set dummy $deplibs_check_method; shift
6082 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6083 for a_deplib in $deplibs; do
6084 name=`expr $a_deplib : '-l\(.*\)'`
6085 # If $name is empty we are operating on a -L argument.
6086 if test -n "$name" && test "$name" != "0"; then
6087 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6088 case " $predeps $postdeps " in
6090 newdeplibs="$newdeplibs $a_deplib"
6095 if test -n "$a_deplib" ; then
6096 libname=`eval "\\$ECHO \"$libname_spec\""`
6097 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6098 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6099 for potent_lib in $potential_libs; do
6100 potlib="$potent_lib" # see symlink-check above in file_magic test
6101 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
6102 $EGREP "$match_pattern_regex" > /dev/null; then
6103 newdeplibs="$newdeplibs $a_deplib"
6110 if test -n "$a_deplib" ; then
6113 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6114 $ECHO "*** I have the capability to make that library automatically link in when"
6115 $ECHO "*** you link to this library. But I can only do this if you have a"
6116 $ECHO "*** shared version of the library, which you do not appear to have"
6117 $ECHO "*** because I did check the linker path looking for a file starting"
6118 if test -z "$potlib" ; then
6119 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
6121 $ECHO "*** with $libname and none of the candidates passed a file format test"
6122 $ECHO "*** using a regex pattern. Last file checked: $potlib"
6126 # Add a -L argument.
6127 newdeplibs="$newdeplibs $a_deplib"
6129 done # Gone through all deplibs.
6133 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
6134 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
6135 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6136 for i in $predeps $postdeps ; do
6137 # can't use Xsed below, because $i might contain '/'
6138 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
6141 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
6142 $GREP . >/dev/null; then
6144 if test "X$deplibs_check_method" = "Xnone"; then
6145 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
6147 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
6149 $ECHO "*** All declared inter-library dependencies are being dropped."
6154 versuffix=$versuffix_save
6156 release=$release_save
6157 libname=$libname_save
6161 *-*-rhapsody* | *-*-darwin1.[012])
6162 # On Rhapsody replace the C library with the System framework
6163 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6167 if test "$droppeddeps" = yes; then
6168 if test "$module" = yes; then
6170 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
6171 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
6172 $ECHO "*** a static module, that should work as long as the dlopening"
6173 $ECHO "*** application is linked with the -dlopen flag."
6174 if test -z "$global_symbol_pipe"; then
6176 $ECHO "*** However, this would only work if libtool was able to extract symbol"
6177 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6178 $ECHO "*** not find such a program. So, this module is probably useless."
6179 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6181 if test "$build_old_libs" = no; then
6182 oldlibs="$output_objdir/$libname.$libext"
6183 build_libtool_libs=module
6186 build_libtool_libs=no
6189 $ECHO "*** The inter-library dependencies that have been dropped here will be"
6190 $ECHO "*** automatically added whenever a program is linked with this library"
6191 $ECHO "*** or is declared to -dlopen it."
6193 if test "$allow_undefined" = no; then
6195 $ECHO "*** Since this library must not contain undefined symbols,"
6196 $ECHO "*** because either the platform does not support them or"
6197 $ECHO "*** it was explicitly requested with -no-undefined,"
6198 $ECHO "*** libtool will only create a static version of it."
6199 if test "$build_old_libs" = no; then
6200 oldlibs="$output_objdir/$libname.$libext"
6201 build_libtool_libs=module
6204 build_libtool_libs=no
6209 # Done checking deplibs!
6212 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6215 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6216 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6217 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6221 # move library search paths that coincide with paths to not yet
6222 # installed libraries to the beginning of the library search list
6224 for path in $notinst_path; do
6225 case " $new_libs " in
6226 *" -L$path/$objdir "*) ;;
6228 case " $deplibs " in
6229 *" -L$path/$objdir "*)
6230 new_libs="$new_libs -L$path/$objdir" ;;
6235 for deplib in $deplibs; do
6238 case " $new_libs " in
6240 *) new_libs="$new_libs $deplib" ;;
6243 *) new_libs="$new_libs $deplib" ;;
6248 # All the library-specific variables (install_libdir is set above).
6253 # Test again, we may have decided not to build it any more
6254 if test "$build_libtool_libs" = yes; then
6255 if test "$hardcode_into_libs" = yes; then
6256 # Hardcode the library paths
6259 rpath="$finalize_rpath"
6260 test "$mode" != relink && rpath="$compile_rpath$rpath"
6261 for libdir in $rpath; do
6262 if test -n "$hardcode_libdir_flag_spec"; then
6263 if test -n "$hardcode_libdir_separator"; then
6264 if test -z "$hardcode_libdirs"; then
6265 hardcode_libdirs="$libdir"
6267 # Just accumulate the unique libdirs.
6268 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6269 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6272 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6277 eval flag=\"$hardcode_libdir_flag_spec\"
6278 dep_rpath="$dep_rpath $flag"
6280 elif test -n "$runpath_var"; then
6281 case "$perm_rpath " in
6283 *) perm_rpath="$perm_rpath $libdir" ;;
6287 # Substitute the hardcoded libdirs into the rpath.
6288 if test -n "$hardcode_libdir_separator" &&
6289 test -n "$hardcode_libdirs"; then
6290 libdir="$hardcode_libdirs"
6291 if test -n "$hardcode_libdir_flag_spec_ld"; then
6292 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
6294 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
6297 if test -n "$runpath_var" && test -n "$perm_rpath"; then
6298 # We should set the runpath_var.
6300 for dir in $perm_rpath; do
6303 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
6305 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
6308 shlibpath="$finalize_shlibpath"
6309 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
6310 if test -n "$shlibpath"; then
6311 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
6314 # Get the real and link names of the library.
6315 eval shared_ext=\"$shrext_cmds\"
6316 eval library_names=\"$library_names_spec\"
6317 set dummy $library_names
6322 if test -n "$soname_spec"; then
6323 eval soname=\"$soname_spec\"
6327 if test -z "$dlname"; then
6331 lib="$output_objdir/$realname"
6335 linknames="$linknames $link"
6338 # Use standard objects if they are pic
6339 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6340 test "X$libobjs" = "X " && libobjs=
6343 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6344 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
6345 export_symbols="$output_objdir/$libname.uexp"
6346 delfiles="$delfiles $export_symbols"
6349 orig_export_symbols=
6352 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
6353 # exporting using user supplied symfile
6354 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
6355 # and it's NOT already a .def file. Must figure out
6356 # which of the given symbols are data symbols and tag
6357 # them as such. So, trigger use of export_symbols_cmds.
6358 # export_symbols gets reassigned inside the "prepare
6359 # the list of exported symbols" if statement, so the
6360 # include_expsyms logic still works.
6361 orig_export_symbols="$export_symbols"
6363 always_export_symbols=yes
6369 # Prepare the list of exported symbols
6370 if test -z "$export_symbols"; then
6371 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
6372 func_verbose "generating symbol list for \`$libname.la'"
6373 export_symbols="$output_objdir/$libname.exp"
6374 $opt_dry_run || $RM $export_symbols
6375 cmds=$export_symbols_cmds
6376 save_ifs="$IFS"; IFS='~'
6377 for cmd in $cmds; do
6380 if len=`expr "X$cmd" : ".*"` &&
6381 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6382 func_show_eval "$cmd" 'exit $?'
6383 skipped_export=false
6385 # The command line is too long to execute in one step.
6386 func_verbose "using reloadable object file for export list..."
6388 # Break out early, otherwise skipped_export may be
6389 # set to false by a later but shorter cmd.
6394 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
6395 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
6396 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
6401 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6402 tmp_export_symbols="$export_symbols"
6403 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
6404 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
6407 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
6408 # The given exports_symbols file has to be filtered, so filter it.
6409 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
6410 # FIXME: $output_objdir/$libname.filter potentially contains lots of
6411 # 's' commands which not all seds can handle. GNU sed should be fine
6412 # though. Also, the filter scales superlinearly with the number of
6413 # global variables. join(1) would be nice here, but unfortunately
6414 # isn't a blessed tool.
6415 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
6416 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
6417 export_symbols=$output_objdir/$libname.def
6418 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
6422 for test_deplib in $deplibs; do
6423 case " $convenience " in
6424 *" $test_deplib "*) ;;
6426 tmp_deplibs="$tmp_deplibs $test_deplib"
6430 deplibs="$tmp_deplibs"
6432 if test -n "$convenience"; then
6433 if test -n "$whole_archive_flag_spec" &&
6434 test "$compiler_needs_object" = yes &&
6435 test -z "$libobjs"; then
6436 # extract the archives, so we have objects to list.
6437 # TODO: could optimize this to just extract one archive.
6438 whole_archive_flag_spec=
6440 if test -n "$whole_archive_flag_spec"; then
6441 save_libobjs=$libobjs
6442 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
6443 test "X$libobjs" = "X " && libobjs=
6445 gentop="$output_objdir/${outputname}x"
6446 generated="$generated $gentop"
6448 func_extract_archives $gentop $convenience
6449 libobjs="$libobjs $func_extract_archives_result"
6450 test "X$libobjs" = "X " && libobjs=
6454 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
6455 eval flag=\"$thread_safe_flag_spec\"
6456 linker_flags="$linker_flags $flag"
6459 # Make a backup of the uninstalled library when relinking
6460 if test "$mode" = relink; then
6461 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
6464 # Do each of the archive commands.
6465 if test "$module" = yes && test -n "$module_cmds" ; then
6466 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
6467 eval test_cmds=\"$module_expsym_cmds\"
6468 cmds=$module_expsym_cmds
6470 eval test_cmds=\"$module_cmds\"
6474 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
6475 eval test_cmds=\"$archive_expsym_cmds\"
6476 cmds=$archive_expsym_cmds
6478 eval test_cmds=\"$archive_cmds\"
6483 if test "X$skipped_export" != "X:" &&
6484 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
6485 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6488 # The command line is too long to link in one step, link piecewise
6489 # or, if using GNU ld and skipped_export is not :, use a linker
6492 # Save the value of $output and $libobjs because we want to
6493 # use them later. If we have whole_archive_flag_spec, we
6494 # want to use save_libobjs as it was before
6495 # whole_archive_flag_spec was expanded, because we can't
6496 # assume the linker understands whole_archive_flag_spec.
6497 # This may have to be revisited, in case too many
6498 # convenience libraries get linked in and end up exceeding
6500 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
6501 save_libobjs=$libobjs
6504 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
6506 # Clear the reloadable object creation command queue and
6507 # initialize k to one.
6514 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
6515 output=${output_objdir}/${output_la}.lnkscript
6516 func_verbose "creating GNU ld script: $output"
6517 $ECHO 'INPUT (' > $output
6518 for obj in $save_libobjs
6520 $ECHO "$obj" >> $output
6522 $ECHO ')' >> $output
6523 delfiles="$delfiles $output"
6524 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
6525 output=${output_objdir}/${output_la}.lnk
6526 func_verbose "creating linker input file list: $output"
6531 if test "$compiler_needs_object" = yes; then
6537 $ECHO "$obj" >> $output
6539 delfiles="$delfiles $output"
6540 output=$firstobj\"$file_list_spec$output\"
6542 if test -n "$save_libobjs"; then
6543 func_verbose "creating reloadable object files..."
6544 output=$output_objdir/$output_la-${k}.$objext
6545 # Loop over the list of objects to be linked.
6546 for obj in $save_libobjs
6548 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
6549 if test "X$objlist" = X ||
6550 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
6551 test "$len" -le "$max_cmd_len"; }; then
6552 objlist="$objlist $obj"
6554 # The command $test_cmds is almost too long, add a
6555 # command to the queue.
6556 if test "$k" -eq 1 ; then
6557 # The first file doesn't have a previous command to add.
6558 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
6560 # All subsequent reloadable object files will link in
6561 # the last one created.
6562 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
6564 last_robj=$output_objdir/$output_la-${k}.$objext
6566 output=$output_objdir/$output_la-${k}.$objext
6571 # Handle the remaining objects by creating one last
6572 # reloadable object file. All subsequent reloadable object
6573 # files will link in the last one created.
6574 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6575 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
6576 if test -n "$last_robj"; then
6577 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
6579 delfiles="$delfiles $output"
6585 if ${skipped_export-false}; then
6586 func_verbose "generating symbol list for \`$libname.la'"
6587 export_symbols="$output_objdir/$libname.exp"
6588 $opt_dry_run || $RM $export_symbols
6590 # Append the command to create the export file.
6591 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6592 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
6593 if test -n "$last_robj"; then
6594 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
6598 test -n "$save_libobjs" &&
6599 func_verbose "creating a temporary reloadable object file: $output"
6601 # Loop through the commands generated above and execute them.
6602 save_ifs="$IFS"; IFS='~'
6603 for cmd in $concat_cmds; do
6606 func_quote_for_expand "$cmd"
6607 eval "func_echo $func_quote_for_expand_result"
6609 $opt_dry_run || eval "$cmd" || {
6612 # Restore the uninstalled library and exit
6613 if test "$mode" = relink; then
6614 ( cd "$output_objdir" && \
6615 $RM "${realname}T" && \
6616 $MV "${realname}U" "$realname" )
6624 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
6625 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
6626 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
6630 if ${skipped_export-false}; then
6631 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6632 tmp_export_symbols="$export_symbols"
6633 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
6634 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
6637 if test -n "$orig_export_symbols"; then
6638 # The given exports_symbols file has to be filtered, so filter it.
6639 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
6640 # FIXME: $output_objdir/$libname.filter potentially contains lots of
6641 # 's' commands which not all seds can handle. GNU sed should be fine
6642 # though. Also, the filter scales superlinearly with the number of
6643 # global variables. join(1) would be nice here, but unfortunately
6644 # isn't a blessed tool.
6645 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
6646 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
6647 export_symbols=$output_objdir/$libname.def
6648 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
6653 # Restore the value of output.
6656 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
6657 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
6658 test "X$libobjs" = "X " && libobjs=
6660 # Expand the library linking commands again to reset the
6661 # value of $libobjs for piecewise linking.
6663 # Do each of the archive commands.
6664 if test "$module" = yes && test -n "$module_cmds" ; then
6665 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
6666 cmds=$module_expsym_cmds
6671 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
6672 cmds=$archive_expsym_cmds
6679 if test -n "$delfiles"; then
6680 # Append the command to remove temporary files to $cmds.
6681 eval cmds=\"\$cmds~\$RM $delfiles\"
6684 # Add any objects from preloaded convenience libraries
6685 if test -n "$dlprefiles"; then
6686 gentop="$output_objdir/${outputname}x"
6687 generated="$generated $gentop"
6689 func_extract_archives $gentop $dlprefiles
6690 libobjs="$libobjs $func_extract_archives_result"
6691 test "X$libobjs" = "X " && libobjs=
6694 save_ifs="$IFS"; IFS='~'
6695 for cmd in $cmds; do
6699 func_quote_for_expand "$cmd"
6700 eval "func_echo $func_quote_for_expand_result"
6702 $opt_dry_run || eval "$cmd" || {
6705 # Restore the uninstalled library and exit
6706 if test "$mode" = relink; then
6707 ( cd "$output_objdir" && \
6708 $RM "${realname}T" && \
6709 $MV "${realname}U" "$realname" )
6717 # Restore the uninstalled library and exit
6718 if test "$mode" = relink; then
6719 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
6721 if test -n "$convenience"; then
6722 if test -z "$whole_archive_flag_spec"; then
6723 func_show_eval '${RM}r "$gentop"'
6730 # Create links to the real library.
6731 for linkname in $linknames; do
6732 if test "$realname" != "$linkname"; then
6733 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
6737 # If -module or -export-dynamic was specified, set the dlname.
6738 if test "$module" = yes || test "$export_dynamic" = yes; then
6739 # On all known operating systems, these are identical.
6746 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6747 func_warning "\`-dlopen' is ignored for objects"
6752 func_warning "\`-l' and \`-L' are ignored for objects" ;;
6755 test -n "$rpath" && \
6756 func_warning "\`-rpath' is ignored for objects"
6758 test -n "$xrpath" && \
6759 func_warning "\`-R' is ignored for objects"
6761 test -n "$vinfo" && \
6762 func_warning "\`-version-info' is ignored for objects"
6764 test -n "$release" && \
6765 func_warning "\`-release' is ignored for objects"
6769 test -n "$objs$old_deplibs" && \
6770 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
6774 obj=$func_lo2o_result
6782 # Delete the old objects.
6783 $opt_dry_run || $RM $obj $libobj
6785 # Objects from convenience libraries. This assumes
6786 # single-version convenience libraries. Whenever we create
6787 # different ones for PIC/non-PIC, this we'll have to duplicate
6791 # reload_cmds runs $LD directly, so let us get rid of
6792 # -Wl from whole_archive_flag_spec and hope we can get by with
6793 # turning comma into space..
6796 if test -n "$convenience"; then
6797 if test -n "$whole_archive_flag_spec"; then
6798 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
6799 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
6801 gentop="$output_objdir/${obj}x"
6802 generated="$generated $gentop"
6804 func_extract_archives $gentop $convenience
6805 reload_conv_objs="$reload_objs $func_extract_archives_result"
6809 # Create the old-style object.
6810 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
6813 func_execute_cmds "$reload_cmds" 'exit $?'
6815 # Exit if we aren't doing a library object file.
6816 if test -z "$libobj"; then
6817 if test -n "$gentop"; then
6818 func_show_eval '${RM}r "$gentop"'
6824 if test "$build_libtool_libs" != yes; then
6825 if test -n "$gentop"; then
6826 func_show_eval '${RM}r "$gentop"'
6829 # Create an invalid libtool object if no PIC, so that we don't
6830 # accidentally link it into a program.
6831 # $show "echo timestamp > $libobj"
6832 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
6836 if test -n "$pic_flag" || test "$pic_mode" != default; then
6837 # Only do commands if we really have different PIC objects.
6838 reload_objs="$libobjs $reload_conv_objs"
6840 func_execute_cmds "$reload_cmds" 'exit $?'
6843 if test -n "$gentop"; then
6844 func_show_eval '${RM}r "$gentop"'
6852 *cygwin*) func_stripname '' '.exe' "$output"
6853 output=$func_stripname_result.exe;;
6855 test -n "$vinfo" && \
6856 func_warning "\`-version-info' is ignored for programs"
6858 test -n "$release" && \
6859 func_warning "\`-release' is ignored for programs"
6861 test "$preload" = yes \
6862 && test "$dlopen_support" = unknown \
6863 && test "$dlopen_self" = unknown \
6864 && test "$dlopen_self_static" = unknown && \
6865 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
6868 *-*-rhapsody* | *-*-darwin1.[012])
6869 # On Rhapsody replace the C library is the System framework
6870 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6871 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6877 # Don't allow lazy linking, it breaks C++ global constructors
6878 # But is supposedly fixed on 10.4 or later (yay!).
6879 if test "$tagname" = CXX ; then
6880 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
6882 compile_command="$compile_command ${wl}-bind_at_load"
6883 finalize_command="$finalize_command ${wl}-bind_at_load"
6887 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6888 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6889 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6894 # move library search paths that coincide with paths to not yet
6895 # installed libraries to the beginning of the library search list
6897 for path in $notinst_path; do
6898 case " $new_libs " in
6899 *" -L$path/$objdir "*) ;;
6901 case " $compile_deplibs " in
6902 *" -L$path/$objdir "*)
6903 new_libs="$new_libs -L$path/$objdir" ;;
6908 for deplib in $compile_deplibs; do
6911 case " $new_libs " in
6913 *) new_libs="$new_libs $deplib" ;;
6916 *) new_libs="$new_libs $deplib" ;;
6919 compile_deplibs="$new_libs"
6922 compile_command="$compile_command $compile_deplibs"
6923 finalize_command="$finalize_command $finalize_deplibs"
6925 if test -n "$rpath$xrpath"; then
6926 # If the user specified any rpath flags, then add them.
6927 for libdir in $rpath $xrpath; do
6928 # This is the magic to use -rpath.
6929 case "$finalize_rpath " in
6931 *) finalize_rpath="$finalize_rpath $libdir" ;;
6936 # Now hardcode the library paths
6939 for libdir in $compile_rpath $finalize_rpath; do
6940 if test -n "$hardcode_libdir_flag_spec"; then
6941 if test -n "$hardcode_libdir_separator"; then
6942 if test -z "$hardcode_libdirs"; then
6943 hardcode_libdirs="$libdir"
6945 # Just accumulate the unique libdirs.
6946 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6947 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6950 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6955 eval flag=\"$hardcode_libdir_flag_spec\"
6956 rpath="$rpath $flag"
6958 elif test -n "$runpath_var"; then
6959 case "$perm_rpath " in
6961 *) perm_rpath="$perm_rpath $libdir" ;;
6965 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
6966 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
6967 case :$dllsearchpath: in
6969 *) dllsearchpath="$dllsearchpath:$libdir";;
6971 case :$dllsearchpath: in
6972 *":$testbindir:"*) ;;
6973 *) dllsearchpath="$dllsearchpath:$testbindir";;
6978 # Substitute the hardcoded libdirs into the rpath.
6979 if test -n "$hardcode_libdir_separator" &&
6980 test -n "$hardcode_libdirs"; then
6981 libdir="$hardcode_libdirs"
6982 eval rpath=\" $hardcode_libdir_flag_spec\"
6984 compile_rpath="$rpath"
6988 for libdir in $finalize_rpath; do
6989 if test -n "$hardcode_libdir_flag_spec"; then
6990 if test -n "$hardcode_libdir_separator"; then
6991 if test -z "$hardcode_libdirs"; then
6992 hardcode_libdirs="$libdir"
6994 # Just accumulate the unique libdirs.
6995 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6996 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6999 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7004 eval flag=\"$hardcode_libdir_flag_spec\"
7005 rpath="$rpath $flag"
7007 elif test -n "$runpath_var"; then
7008 case "$finalize_perm_rpath " in
7010 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
7014 # Substitute the hardcoded libdirs into the rpath.
7015 if test -n "$hardcode_libdir_separator" &&
7016 test -n "$hardcode_libdirs"; then
7017 libdir="$hardcode_libdirs"
7018 eval rpath=\" $hardcode_libdir_flag_spec\"
7020 finalize_rpath="$rpath"
7022 if test -n "$libobjs" && test "$build_old_libs" = yes; then
7023 # Transform all the library objects into standard objects.
7024 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7025 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7028 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
7030 # template prelinking step
7031 if test -n "$prelink_cmds"; then
7032 func_execute_cmds "$prelink_cmds" 'exit $?'
7035 wrappers_required=yes
7037 *cygwin* | *mingw* )
7038 if test "$build_libtool_libs" != yes; then
7039 wrappers_required=no
7043 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
7044 wrappers_required=no
7048 if test "$wrappers_required" = no; then
7049 # Replace the output file specification.
7050 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7051 link_command="$compile_command$compile_rpath"
7053 # We have no uninstalled library dependencies, so finalize right now.
7055 func_show_eval "$link_command" 'exit_status=$?'
7057 # Delete the generated files.
7058 if test -f "$output_objdir/${outputname}S.${objext}"; then
7059 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
7065 if test -n "$compile_shlibpath$finalize_shlibpath"; then
7066 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
7068 if test -n "$finalize_shlibpath"; then
7069 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
7074 if test -n "$runpath_var"; then
7075 if test -n "$perm_rpath"; then
7076 # We should set the runpath_var.
7078 for dir in $perm_rpath; do
7081 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
7083 if test -n "$finalize_perm_rpath"; then
7084 # We should set the runpath_var.
7086 for dir in $finalize_perm_rpath; do
7089 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
7093 if test "$no_install" = yes; then
7094 # We don't need to create a wrapper script.
7095 link_command="$compile_var$compile_command$compile_rpath"
7096 # Replace the output file specification.
7097 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7098 # Delete the old output file.
7099 $opt_dry_run || $RM $output
7100 # Link the executable and exit
7101 func_show_eval "$link_command" 'exit $?'
7105 if test "$hardcode_action" = relink; then
7106 # Fast installation is not supported
7107 link_command="$compile_var$compile_command$compile_rpath"
7108 relink_command="$finalize_var$finalize_command$finalize_rpath"
7110 func_warning "this platform does not like uninstalled shared libraries"
7111 func_warning "\`$output' will be relinked during installation"
7113 if test "$fast_install" != no; then
7114 link_command="$finalize_var$compile_command$finalize_rpath"
7115 if test "$fast_install" = yes; then
7116 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
7118 # fast_install is set to needless
7122 link_command="$compile_var$compile_command$compile_rpath"
7123 relink_command="$finalize_var$finalize_command$finalize_rpath"
7127 # Replace the output file specification.
7128 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7130 # Delete the old output files.
7131 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
7133 func_show_eval "$link_command" 'exit $?'
7135 # Now create the wrapper script.
7136 func_verbose "creating $output"
7138 # Quote the relink command for shipping.
7139 if test -n "$relink_command"; then
7140 # Preserve any variables that may affect compiler behavior
7141 for var in $variables_saved_for_relink; do
7142 if eval test -z \"\${$var+set}\"; then
7143 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7144 elif eval var_value=\$$var; test -z "$var_value"; then
7145 relink_command="$var=; export $var; $relink_command"
7147 func_quote_for_eval "$var_value"
7148 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7151 relink_command="(cd `pwd`; $relink_command)"
7152 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7155 # Quote $ECHO for shipping.
7156 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
7158 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
7159 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
7161 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
7163 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
7166 # Only actually do things if not in dry run mode.
7168 # win32 will think the script is a binary if it has
7169 # a .exe suffix, so we strip it off here.
7171 *.exe) func_stripname '' '.exe' "$output"
7172 output=$func_stripname_result ;;
7174 # test for cygwin because mv fails w/o .exe extensions
7178 func_stripname '' '.exe' "$outputname"
7179 outputname=$func_stripname_result ;;
7183 *cygwin* | *mingw* )
7184 func_dirname_and_basename "$output" "" "."
7185 output_name=$func_basename_result
7186 output_path=$func_dirname_result
7187 cwrappersource="$output_path/$objdir/lt-$output_name.c"
7188 cwrapper="$output_path/$output_name.exe"
7189 $RM $cwrappersource $cwrapper
7190 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7192 func_emit_cwrapperexe_src > $cwrappersource
7194 # we should really use a build-platform specific compiler
7195 # here, but OTOH, the wrappers (shell script and this C one)
7196 # are only useful if you want to execute the "real" binary.
7197 # Since the "real" binary is built for $host, then this
7198 # wrapper might as well be built for $host, too.
7200 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
7204 # Now, create the wrapper script for func_source use:
7205 func_ltwrapper_scriptname $cwrapper
7206 $RM $func_ltwrapper_scriptname_result
7207 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
7209 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7214 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
7216 func_emit_wrapper no > $output
7225 # See if we need to build an old-fashioned archive.
7226 for oldlib in $oldlibs; do
7228 if test "$build_libtool_libs" = convenience; then
7229 oldobjs="$libobjs_save $symfileobj"
7230 addlibs="$convenience"
7231 build_libtool_libs=no
7233 if test "$build_libtool_libs" = module; then
7234 oldobjs="$libobjs_save"
7235 build_libtool_libs=no
7237 oldobjs="$old_deplibs $non_pic_objects"
7238 if test "$preload" = yes && test -f "$symfileobj"; then
7239 oldobjs="$oldobjs $symfileobj"
7242 addlibs="$old_convenience"
7245 if test -n "$addlibs"; then
7246 gentop="$output_objdir/${outputname}x"
7247 generated="$generated $gentop"
7249 func_extract_archives $gentop $addlibs
7250 oldobjs="$oldobjs $func_extract_archives_result"
7253 # Do each command in the archive commands.
7254 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
7255 cmds=$old_archive_from_new_cmds
7258 # Add any objects from preloaded convenience libraries
7259 if test -n "$dlprefiles"; then
7260 gentop="$output_objdir/${outputname}x"
7261 generated="$generated $gentop"
7263 func_extract_archives $gentop $dlprefiles
7264 oldobjs="$oldobjs $func_extract_archives_result"
7267 # POSIX demands no paths to be encoded in archives. We have
7268 # to avoid creating archives with duplicate basenames if we
7269 # might have to extract them afterwards, e.g., when creating a
7270 # static archive out of a convenience library, or when linking
7271 # the entirety of a libtool archive into another (currently
7272 # not supported by libtool).
7273 if (for obj in $oldobjs
7275 func_basename "$obj"
7276 $ECHO "$func_basename_result"
7277 done | sort | sort -uc >/dev/null 2>&1); then
7280 $ECHO "copying selected object files to avoid basename conflicts..."
7281 gentop="$output_objdir/${outputname}x"
7282 generated="$generated $gentop"
7283 func_mkdir_p "$gentop"
7284 save_oldobjs=$oldobjs
7287 for obj in $save_oldobjs
7289 func_basename "$obj"
7290 objbase="$func_basename_result"
7291 case " $oldobjs " in
7292 " ") oldobjs=$obj ;;
7295 # Make sure we don't pick an alternate name that also
7297 newobj=lt$counter-$objbase
7298 counter=`expr $counter + 1`
7299 case " $oldobjs " in
7300 *[\ /]"$newobj "*) ;;
7301 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
7304 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
7305 oldobjs="$oldobjs $gentop/$newobj"
7307 *) oldobjs="$oldobjs $obj" ;;
7311 eval cmds=\"$old_archive_cmds\"
7313 if len=`expr "X$cmds" : ".*" 2>/dev/null` &&
7314 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7315 cmds=$old_archive_cmds
7317 # the command line is too long to link in one step, link in parts
7318 func_verbose "using piecewise archive linking..."
7323 save_oldobjs=$oldobjs
7324 # Is there a better way of finding the last object in the list?
7325 for obj in $save_oldobjs
7329 for obj in $save_oldobjs
7331 oldobjs="$objlist $obj"
7332 objlist="$objlist $obj"
7333 eval test_cmds=\"$old_archive_cmds\"
7334 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
7335 test "$len" -le "$max_cmd_len"; then
7338 # the above command should be used before it gets too long
7340 if test "$obj" = "$last_oldobj" ; then
7343 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7344 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
7350 if test "X$oldobjs" = "X" ; then
7351 eval cmds=\"\$concat_cmds\"
7353 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
7357 func_execute_cmds "$cmds" 'exit $?'
7360 test -n "$generated" && \
7361 func_show_eval "${RM}r$generated"
7363 # Now create the libtool archive.
7367 test "$build_old_libs" = yes && old_library="$libname.$libext"
7368 func_verbose "creating $output"
7370 # Preserve any variables that may affect compiler behavior
7371 for var in $variables_saved_for_relink; do
7372 if eval test -z \"\${$var+set}\"; then
7373 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7374 elif eval var_value=\$$var; test -z "$var_value"; then
7375 relink_command="$var=; export $var; $relink_command"
7377 func_quote_for_eval "$var_value"
7378 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7381 # Quote the link command for shipping.
7382 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
7383 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7384 if test "$hardcode_automatic" = yes ; then
7388 # Only create the output if not a dry run.
7390 for installed in no yes; do
7391 if test "$installed" = yes; then
7392 if test -z "$install_libdir"; then
7395 output="$output_objdir/$outputname"i
7396 # Replace all uninstalled libtool libraries with the installed ones
7398 for deplib in $dependency_libs; do
7401 func_basename "$deplib"
7402 name="$func_basename_result"
7403 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7404 test -z "$libdir" && \
7405 func_fatal_error "\`$deplib' is not a valid libtool archive"
7406 newdependency_libs="$newdependency_libs $libdir/$name"
7408 *) newdependency_libs="$newdependency_libs $deplib" ;;
7411 dependency_libs="$newdependency_libs"
7414 for lib in $dlfiles; do
7417 func_basename "$lib"
7418 name="$func_basename_result"
7419 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7420 test -z "$libdir" && \
7421 func_fatal_error "\`$lib' is not a valid libtool archive"
7422 newdlfiles="$newdlfiles $libdir/$name"
7424 *) newdlfiles="$newdlfiles $lib" ;;
7427 dlfiles="$newdlfiles"
7429 for lib in $dlprefiles; do
7432 # Only pass preopened files to the pseudo-archive (for
7433 # eventual linking with the app. that links it) if we
7434 # didn't already link the preopened objects directly into
7436 func_basename "$lib"
7437 name="$func_basename_result"
7438 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7439 test -z "$libdir" && \
7440 func_fatal_error "\`$lib' is not a valid libtool archive"
7441 newdlprefiles="$newdlprefiles $libdir/$name"
7445 dlprefiles="$newdlprefiles"
7448 for lib in $dlfiles; do
7450 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7451 *) abs=`pwd`"/$lib" ;;
7453 newdlfiles="$newdlfiles $abs"
7455 dlfiles="$newdlfiles"
7457 for lib in $dlprefiles; do
7459 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7460 *) abs=`pwd`"/$lib" ;;
7462 newdlprefiles="$newdlprefiles $abs"
7464 dlprefiles="$newdlprefiles"
7467 # place dlname in correct position for cygwin
7469 case $host,$output,$installed,$module,$dlname in
7470 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
7473 # $outputname - a libtool library file
7474 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
7476 # Please DO NOT delete this file!
7477 # It is necessary for linking the library.
7479 # The name that we can dlopen(3).
7482 # Names of this library.
7483 library_names='$library_names'
7485 # The name of the static archive.
7486 old_library='$old_library'
7488 # Linker flags that can not go in dependency_libs.
7489 inherited_linker_flags='$new_inherited_linker_flags'
7491 # Libraries that this one depends upon.
7492 dependency_libs='$dependency_libs'
7494 # Names of additional weak libraries provided by this library
7495 weak_library_names='$weak_libs'
7497 # Version information for $libname.
7502 # Is this an already installed library?
7503 installed=$installed
7505 # Should we warn about portability when linking against -modules?
7506 shouldnotlink=$module
7508 # Files to dlopen/dlpreopen
7510 dlpreopen='$dlprefiles'
7512 # Directory that this library needs to be installed in:
7513 libdir='$install_libdir'"
7514 if test "$installed" = no && test "$need_relink" = yes; then
7516 relink_command=\"$relink_command\""
7521 # Do a symbolic link so that the libtool archive can be found in
7522 # LD_LIBRARY_PATH before the program is installed.
7523 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
7529 { test "$mode" = link || test "$mode" = relink; } &&
7530 func_mode_link ${1+"$@"}
7533 # func_mode_uninstall arg...
7534 func_mode_uninstall ()
7542 # This variable tells wrapper scripts just to set variables rather
7543 # than running their programs.
7544 libtool_install_magic="$magic"
7549 -f) RM="$RM $arg"; rmforce=yes ;;
7550 -*) RM="$RM $arg" ;;
7551 *) files="$files $arg" ;;
7556 func_fatal_help "you must specify an RM program"
7560 origobjdir="$objdir"
7561 for file in $files; do
7562 func_dirname "$file" "" "."
7563 dir="$func_dirname_result"
7564 if test "X$dir" = X.; then
7565 objdir="$origobjdir"
7567 objdir="$dir/$origobjdir"
7569 func_basename "$file"
7570 name="$func_basename_result"
7571 test "$mode" = uninstall && objdir="$dir"
7573 # Remember objdir for removal later, being careful to avoid duplicates
7574 if test "$mode" = clean; then
7577 *) rmdirs="$rmdirs $objdir" ;;
7581 # Don't error if the file doesn't exist and rm -f was used.
7582 if { test -L "$file"; } >/dev/null 2>&1 ||
7583 { test -h "$file"; } >/dev/null 2>&1 ||
7584 test -f "$file"; then
7586 elif test -d "$file"; then
7589 elif test "$rmforce" = yes; then
7597 # Possibly a libtool archive, so verify it.
7598 if func_lalib_p "$file"; then
7599 func_source $dir/$name
7601 # Delete the libtool libraries and symlinks.
7602 for n in $library_names; do
7603 rmfiles="$rmfiles $objdir/$n"
7605 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
7609 case " $library_names " in
7610 # " " in the beginning catches empty $dlname
7612 *) rmfiles="$rmfiles $objdir/$dlname" ;;
7614 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
7617 if test -n "$library_names"; then
7618 # Do each command in the postuninstall commands.
7619 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
7622 if test -n "$old_library"; then
7623 # Do each command in the old_postuninstall commands.
7624 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
7626 # FIXME: should reinstall the best remaining shared library.
7633 # Possibly a libtool object, so verify it.
7634 if func_lalib_p "$file"; then
7637 func_source $dir/$name
7639 # Add PIC object to the list of files to remove.
7640 if test -n "$pic_object" &&
7641 test "$pic_object" != none; then
7642 rmfiles="$rmfiles $dir/$pic_object"
7645 # Add non-PIC object to the list of files to remove.
7646 if test -n "$non_pic_object" &&
7647 test "$non_pic_object" != none; then
7648 rmfiles="$rmfiles $dir/$non_pic_object"
7654 if test "$mode" = clean ; then
7658 func_stripname '' '.exe' "$file"
7659 file=$func_stripname_result
7660 func_stripname '' '.exe' "$name"
7661 noexename=$func_stripname_result
7662 # $file with .exe has already been added to rmfiles,
7663 # add $file without .exe
7664 rmfiles="$rmfiles $file"
7667 # Do a test to see if this is a libtool program.
7668 if func_ltwrapper_p "$file"; then
7669 if func_ltwrapper_executable_p "$file"; then
7670 func_ltwrapper_scriptname "$file"
7672 func_source $func_ltwrapper_scriptname_result
7673 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
7676 func_source $dir/$noexename
7679 # note $name still contains .exe if it was in $file originally
7680 # as does the version of $file that was added into $rmfiles
7681 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
7682 if test "$fast_install" = yes && test -n "$relink_command"; then
7683 rmfiles="$rmfiles $objdir/lt-$name"
7685 if test "X$noexename" != "X$name" ; then
7686 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
7692 func_show_eval "$RM $rmfiles" 'exit_status=1'
7694 objdir="$origobjdir"
7696 # Try to remove the ${objdir}s in the directories where we deleted files
7697 for dir in $rmdirs; do
7698 if test -d "$dir"; then
7699 func_show_eval "rmdir $dir >/dev/null 2>&1"
7706 { test "$mode" = uninstall || test "$mode" = clean; } &&
7707 func_mode_uninstall ${1+"$@"}
7709 test -z "$mode" && {
7710 help="$generic_help"
7711 func_fatal_help "you must specify a MODE"
7714 test -z "$exec_cmd" && \
7715 func_fatal_help "invalid operation mode \`$mode'"
7717 if test -n "$exec_cmd"; then
7718 eval exec "$exec_cmd"
7725 # The TAGs below are defined such that we never get into a situation
7726 # in which we disable both kinds of libraries. Given conflicting
7727 # choices, we go for a static library, that is the most portable,
7728 # since we can't tell whether shared libraries were disabled because
7729 # the user asked for that or because the platform doesn't support
7730 # them. This is particularly important on AIX, because we don't
7731 # support having both static and shared libraries enabled at the same
7732 # time on that platform, so we default to a shared-only configuration.
7733 # If a disable-shared tag is given, we'll fallback to a static-only
7734 # configuration. But we'll never go from static-only to shared-only.
7736 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
7737 build_libtool_libs=no
7739 # ### END LIBTOOL TAG CONFIG: disable-shared
7741 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
7742 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
7743 # ### END LIBTOOL TAG CONFIG: disable-static