3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (gtest) 1.6.0
5 # Libtool was configured on host dahyeong-Samsung-DeskTop-System:
6 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
8 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
9 # 2006, 2007, 2008 Free Software Foundation, Inc.
10 # Written by Gordon Matzigkeit, 1996
12 # This file is part of GNU Libtool.
14 # GNU Libtool is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License as
16 # published by the Free Software Foundation; either version 2 of
17 # the License, or (at your option) any later version.
19 # As a special exception to the GNU General Public License,
20 # if you distribute this file as part of a program or library that
21 # is built using GNU Libtool, you may include this file under the
22 # same distribution terms that you use for the rest of that program.
24 # GNU Libtool is distributed in the hope that it will be useful,
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 # GNU General Public License for more details.
29 # You should have received a copy of the GNU General Public License
30 # along with GNU Libtool; see the file COPYING. If not, a copy
31 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
32 # obtained by writing to the Free Software Foundation, Inc.,
33 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
36 # The names of the tagged configurations supported by this script.
39 # ### BEGIN LIBTOOL CONFIG
41 # Which release of libtool.m4 was used?
45 # Whether or not to build shared libraries.
46 build_libtool_libs=yes
48 # Whether or not to build static libraries.
51 # What type of objects to build.
54 # Whether or not to optimize for fast installation.
59 host=i686-pc-linux-gnu
64 build=i686-pc-linux-gnu
67 # A sed program that does not truncate output.
70 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
71 Xsed="$SED -e 1s/^X//"
73 # A grep program that handles long lines.
79 # A literal string matcher.
82 # A BSD- or MS-compatible name lister.
85 # Whether we need soft or hard links.
88 # What is the maximum length of a command?
91 # Object file suffix (normally "o").
94 # Executable file suffix (normally "").
97 # whether the shell understands "unset".
100 # turn spaces into newlines.
101 SP2NL="tr \\040 \\012"
103 # turn newlines into spaces.
104 NL2SP="tr \\015\\012 \\040\\040"
106 # How to create reloadable object files.
108 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
110 # An object symbol dumper.
113 # Method to check whether dependent libraries are shared objects.
114 deplibs_check_method="pass_all"
116 # Command to use when deplibs_check_method == "file_magic".
117 file_magic_cmd="\$MAGIC_CMD"
123 # A symbol stripping program.
126 # Commands used to install an old-style archive.
128 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
129 old_postuninstall_cmds=""
134 # LTCC compiler flags.
137 # Take the output of nm and produce a listing of raw symbols and C names.
138 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
140 # Transform the output of nm in a proper C declaration.
141 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
143 # Transform the output of nm in a C name address pair.
144 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
146 # Transform the output of nm in a C name address pair when lib prefix is needed.
147 global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'"
149 # The name of the directory that contains temporary libtool files.
152 # Shell to use when invoking shell scripts.
155 # An echo program that does not interpret backslashes.
158 # Used to examine libraries when file_magic_cmd begins with "file".
161 # Must we lock files when doing compilation?
164 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
167 # Tool to change global to local symbols on Mac OS X.
170 # Tool to manipulate fat objects and archives on Mac OS X.
173 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
176 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
179 # Old archive suffix (normally "a").
182 # Shared library suffix (normally ".so").
185 # The commands to extract the exported symbol list from a shared archive.
186 extract_expsyms_cmds=""
188 # Variables whose values should be saved in libtool wrapper scripts and
189 # restored at link time.
190 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
192 # Do we need the "lib" prefix for modules?
195 # Do we need a version for libraries?
198 # Library versioning type.
201 # Shared library runtime path variable.
202 runpath_var=LD_RUN_PATH
204 # Shared library path variable.
205 shlibpath_var=LD_LIBRARY_PATH
207 # Is shlibpath searched before the hard-coded library search path?
208 shlibpath_overrides_runpath=no
210 # Format of library name prefix.
211 libname_spec="lib\$name"
213 # List of archive names. First name is the real one, the rest are links.
214 # The last name is the one that the linker finds with -lNAME
215 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
217 # The coded name of the library, if different from the real name.
218 soname_spec="\${libname}\${release}\${shared_ext}\$major"
220 # Command to use after installation of a shared archive.
223 # Command to use after uninstallation of a shared archive.
224 postuninstall_cmds=""
226 # Commands used to finish a libtool library installation in a directory.
227 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
229 # As "finish_cmds", except a single script fragment to be evaled but
233 # Whether we should hardcode library paths into libraries.
234 hardcode_into_libs=yes
236 # Compile-time system search path for libraries.
237 sys_lib_search_path_spec="/usr/lib/gcc/i686-linux-gnu/4.6.1 /usr/lib/i386-linux-gnu /usr/lib /lib/i386-linux-gnu /lib"
239 # Run-time system search path for libraries.
240 sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/nvidia-current /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib /usr/lib/nvidia-settings "
242 # Whether dlopen is supported.
243 dlopen_support=unknown
245 # Whether dlopen of programs is supported.
248 # Whether dlopen of statically linked programs is supported.
249 dlopen_self_static=unknown
251 # Commands to strip libraries.
252 old_striplib="strip --strip-debug"
253 striplib="strip --strip-unneeded"
256 # The linker used to build libraries.
259 # Commands used to build an old-style archive.
260 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
262 # A language specific compiler.
265 # Is the compiler the GNU compiler?
268 # Compiler flag to turn off builtin functions.
269 no_builtin_flag=" -fno-builtin"
271 # How to pass a linker flag through the compiler.
274 # Additional compiler flags for building library objects.
275 pic_flag=" -fPIC -DPIC"
277 # Compiler flag to prevent dynamic linking.
278 link_static_flag="-static"
280 # Does compiler simultaneously support -c and -o options?
283 # Whether or not to add -lc for building shared libraries.
284 build_libtool_need_lc=no
286 # Whether or not to disallow shared libs when runtime libs are static.
287 allow_libtool_libs_with_static_runtimes=no
289 # Compiler flag to allow reflexive dlopens.
290 export_dynamic_flag_spec="\${wl}--export-dynamic"
292 # Compiler flag to generate shared objects directly from archives.
293 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
295 # Whether the compiler copes with passing no objects directly.
296 compiler_needs_object="no"
298 # Create an old-style archive from a shared archive.
299 old_archive_from_new_cmds=""
301 # Create a temporary old-style archive to link instead of a shared archive.
302 old_archive_from_expsyms_cmds=""
304 # Commands used to build a shared archive.
305 archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
306 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
307 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
308 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
309 \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
311 # Commands used to build a loadable module if different from building
314 module_expsym_cmds=""
316 # Whether we are building with GNU ld or not.
319 # Flag that allows shared libraries with undefined symbols to be built.
320 allow_undefined_flag=""
322 # Flag that enforces no undefined symbols.
325 # Flag to hardcode $libdir into a binary during linking.
326 # This must work even if $libdir does not exist
327 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
329 # If ld is used when linking, flag to hardcode $libdir into a binary
330 # during linking. This must work even if $libdir does not exist.
331 hardcode_libdir_flag_spec_ld=""
333 # Whether we need a single "-rpath" flag with a separated argument.
334 hardcode_libdir_separator=""
336 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
337 # DIR into the resulting binary.
340 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
341 # DIR into the resulting binary and the resulting library dependency is
342 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
343 # library is relocated.
344 hardcode_direct_absolute=no
346 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
347 # into the resulting binary.
350 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
351 # into the resulting binary.
352 hardcode_shlibpath_var=unsupported
354 # Set to "yes" if building a shared library automatically hardcodes DIR
355 # into the library and all subsequent libraries and executables linked
357 hardcode_automatic=no
359 # Set to yes if linker adds runtime paths of dependent libraries
360 # to runtime path list.
363 # Whether libtool must link a program against all its dependency libraries.
366 # Fix the shell variable $srcfile for the compiler.
369 # Set to "yes" if exported symbols are required.
370 always_export_symbols=no
372 # The commands to list exported symbols.
373 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
375 # Symbols that should not be listed in the preloaded symbols.
376 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
378 # Symbols that must always be exported.
381 # Commands necessary for linking programs (against libraries) with templates.
384 # Specify filename containing input files.
387 # How to hardcode a shared library path into an executable.
388 hardcode_action=immediate
390 # The directories searched by this compiler when creating a shared library.
391 compiler_lib_search_dirs=""
393 # Dependencies to place before and after the objects being linked to
394 # create a shared library.
400 # The library search path used internally by the compiler when linking
402 compiler_lib_search_path=""
404 # ### END LIBTOOL CONFIG
406 # Generated from ltmain.m4sh.
408 # ltmain.sh (GNU libtool) 2.2.6b
409 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
411 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
412 # This is free software; see the source for copying conditions. There is NO
413 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
415 # GNU Libtool is free software; you can redistribute it and/or modify
416 # it under the terms of the GNU General Public License as published by
417 # the Free Software Foundation; either version 2 of the License, or
418 # (at your option) any later version.
420 # As a special exception to the GNU General Public License,
421 # if you distribute this file as part of a program or library that
422 # is built using GNU Libtool, you may include this file under the
423 # same distribution terms that you use for the rest of that program.
425 # GNU Libtool is distributed in the hope that it will be useful, but
426 # WITHOUT ANY WARRANTY; without even the implied warranty of
427 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
428 # General Public License for more details.
430 # You should have received a copy of the GNU General Public License
431 # along with GNU Libtool; see the file COPYING. If not, a copy
432 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
433 # or obtained by writing to the Free Software Foundation, Inc.,
434 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
436 # Usage: $progname [OPTION]... [MODE-ARG]...
438 # Provide generalized library-building support services.
440 # --config show all configuration variables
441 # --debug enable verbose shell tracing
442 # -n, --dry-run display commands without modifying any files
443 # --features display basic configuration information and exit
444 # --mode=MODE use operation mode MODE
445 # --preserve-dup-deps don't remove duplicate dependency libraries
446 # --quiet, --silent don't print informational messages
447 # --tag=TAG use configuration variables from tag TAG
448 # -v, --verbose print informational messages (default)
449 # --version print version information
450 # -h, --help print short or long help message
452 # MODE must be one of the following:
454 # clean remove files from the build directory
455 # compile compile a source file into a libtool object
456 # execute automatically set library path, then run a program
457 # finish complete the installation of libtool libraries
458 # install install libraries or executables
459 # link create a library or an executable
460 # uninstall remove libraries from an installed directory
462 # MODE-ARGS vary depending on the MODE.
463 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
465 # When reporting a bug, please describe a test case to reproduce it and
466 # include the following information:
468 # host-triplet: $host
471 # compiler flags: $LTCFLAGS
472 # linker: $LD (gnu? $with_gnu_ld)
473 # $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
474 # automake: $automake_version
475 # autoconf: $autoconf_version
477 # Report bugs to <bug-libtool@gnu.org>.
481 VERSION="2.2.6b Debian-2.2.6b-2ubuntu1"
483 package_revision=1.3017
485 # Be Bourne compatible
486 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
489 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
490 # is contrary to our usage. Disable this feature.
491 alias -g '${1+"$@"}'='"$@"'
494 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
496 BIN_SH=xpg4; export BIN_SH # for Tru64
497 DUALCASE=1; export DUALCASE # for MKS sh
499 # NLS nuisances: We save the old values to restore during execute mode.
500 # Only set LANG and LC_ALL to C if already set.
501 # These must not be set unconditionally because not all systems understand
502 # e.g. LANG=C (notably SCO).
505 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
507 eval "if test \"\${$lt_var+set}\" = set; then
508 save_$lt_var=\$$lt_var
511 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
512 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
524 : ${EGREP="/bin/grep -E"}
525 : ${FGREP="/bin/grep -F"}
526 : ${GREP="/bin/grep"}
533 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
534 : ${Xsed="$SED -e 1s/^X//"}
539 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
540 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
542 exit_status=$EXIT_SUCCESS
544 # Make sure IFS has a sensible default
549 dirname="s,/[^/]*$,,"
552 # func_dirname_and_basename file append nondir_replacement
553 # perform func_basename and func_dirname in a single function
555 # dirname: Compute the dirname of FILE. If nonempty,
556 # add APPEND to the result, otherwise set result
557 # to NONDIR_REPLACEMENT.
558 # value returned in "$func_dirname_result"
559 # basename: Compute filename of FILE.
560 # value retuned in "$func_basename_result"
561 # Implementation must be kept synchronized with func_dirname
562 # and func_basename. For efficiency, we do not delegate to
563 # those functions but instead duplicate the functionality here.
564 func_dirname_and_basename ()
566 # Extract subdirectory from the argument.
567 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
568 if test "X$func_dirname_result" = "X${1}"; then
569 func_dirname_result="${3}"
571 func_dirname_result="$func_dirname_result${2}"
573 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
576 # Generated shell functions inserted here.
578 # func_dirname file append nondir_replacement
579 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
580 # otherwise set result to NONDIR_REPLACEMENT.
584 */*) func_dirname_result="${1%/*}${2}" ;;
585 * ) func_dirname_result="${3}" ;;
592 func_basename_result="${1##*/}"
595 # func_dirname_and_basename file append nondir_replacement
596 # perform func_basename and func_dirname in a single function
598 # dirname: Compute the dirname of FILE. If nonempty,
599 # add APPEND to the result, otherwise set result
600 # to NONDIR_REPLACEMENT.
601 # value returned in "$func_dirname_result"
602 # basename: Compute filename of FILE.
603 # value retuned in "$func_basename_result"
604 # Implementation must be kept synchronized with func_dirname
605 # and func_basename. For efficiency, we do not delegate to
606 # those functions but instead duplicate the functionality here.
607 func_dirname_and_basename ()
610 */*) func_dirname_result="${1%/*}${2}" ;;
611 * ) func_dirname_result="${3}" ;;
613 func_basename_result="${1##*/}"
616 # func_stripname prefix suffix name
617 # strip PREFIX and SUFFIX off of NAME.
618 # PREFIX and SUFFIX must not contain globbing or regex special
619 # characters, hashes, percent signs, but SUFFIX may contain a leading
620 # dot (in which case that matches only a dot).
623 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
624 # positional parameters, so assign one to ordinary parameter first.
625 func_stripname_result=${3}
626 func_stripname_result=${func_stripname_result#"${1}"}
627 func_stripname_result=${func_stripname_result%"${2}"}
633 func_opt_split_opt=${1%%=*}
634 func_opt_split_arg=${1#*=}
641 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
642 *) func_lo2o_result=${1} ;;
646 # func_xform libobj-or-source
649 func_xform_result=${1%.*}.lo
652 # func_arith arithmetic-term...
655 func_arith_result=$(( $* ))
659 # STRING may not start with a hyphen.
662 func_len_result=${#1}
666 # func_append var value
667 # Append VALUE to the end of shell variable VAR.
672 # Generated shell functions inserted here.
674 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
675 # is ksh but when the shell is invoked as "sh" and the current value of
676 # the _XPG environment variable is not equal to 1 (one), the special
677 # positional parameter $0, within a function call, is the name of the
681 # The name of this program:
682 # In the unlikely event $progname began with a '-', it would play havoc with
683 # func_echo (imagine progname=-n), so we prepend ./ in that case:
684 func_dirname_and_basename "$progpath"
685 progname=$func_basename_result
687 -*) progname=./$progname ;;
690 # Make sure we have an absolute path for reexecution:
692 [\\/]*|[A-Za-z]:\\*) ;;
694 progdir=$func_dirname_result
695 progdir=`cd "$progdir" && pwd`
696 progpath="$progdir/$progname"
701 for progdir in $PATH; do
703 test -x "$progdir/$progname" && break
706 test -n "$progdir" || progdir=`pwd`
707 progpath="$progdir/$progname"
711 # Sed substitution that helps us do robust quoting. It backslashifies
712 # metacharacters that are still active within double-quoted strings.
713 Xsed="${SED}"' -e 1s/^X//'
714 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
716 # Same as above, but do not quote variable references.
717 double_quote_subst='s/\(["`\\]\)/\\\1/g'
719 # Re-`\' parameter expansions in output of double_quote_subst that were
720 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
721 # in input to double_quote_subst, that '$' was protected from expansion.
722 # Since each input `\' is now two `\'s, look for any number of runs of
723 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
728 sed_double_backslash="\
732 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
743 # Echo program name prefixed message, along with the current mode
744 # name if it has been set yet.
747 $ECHO "$progname${mode+: }$mode: $*"
750 # func_verbose arg...
751 # Echo program name prefixed message in verbose mode only.
754 $opt_verbose && func_echo ${1+"$@"}
756 # A bug in bash halts the script if the last line of a function
757 # fails when set -e is in force, so we need another command to
763 # Echo program name prefixed message to standard error.
766 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
769 # func_warning arg...
770 # Echo program name prefixed warning message to standard error.
773 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
779 # func_fatal_error arg...
780 # Echo program name prefixed message to standard error, and exit.
787 # func_fatal_help arg...
788 # Echo program name prefixed message to standard error, followed by
789 # a help hint, and exit.
793 func_fatal_error "$help"
795 help="Try \`$progname --help' for more information." ## default
798 # func_grep expression filename
799 # Check whether EXPRESSION matches any line of FILENAME, without output.
802 $GREP "$1" "$2" >/dev/null 2>&1
806 # func_mkdir_p directory-path
807 # Make sure the entire path to DIRECTORY-PATH is available.
810 my_directory_path="$1"
813 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
815 # Protect directory names starting with `-'
816 case $my_directory_path in
817 -*) my_directory_path="./$my_directory_path" ;;
820 # While some portion of DIR does not yet exist...
821 while test ! -d "$my_directory_path"; do
822 # ...make a list in topmost first order. Use a colon delimited
823 # list incase some portion of path contains whitespace.
824 my_dir_list="$my_directory_path:$my_dir_list"
826 # If the last portion added has no slash in it, the list is done
827 case $my_directory_path in */*) ;; *) break ;; esac
829 # ...otherwise throw away the child directory and loop
830 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
832 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
834 save_mkdir_p_IFS="$IFS"; IFS=':'
835 for my_dir in $my_dir_list; do
836 IFS="$save_mkdir_p_IFS"
837 # mkdir can fail with a `File exist' error if two processes
838 # try to create one of the directories concurrently. Don't
840 $MKDIR "$my_dir" 2>/dev/null || :
842 IFS="$save_mkdir_p_IFS"
844 # Bail out if we (or some other process) failed to create a directory.
845 test -d "$my_directory_path" || \
846 func_fatal_error "Failed to create \`$1'"
851 # func_mktempdir [string]
852 # Make a temporary directory that won't clash with other running
853 # libtool processes, and avoids race conditions if possible. If
854 # given, STRING is the basename for that directory.
857 my_template="${TMPDIR-/tmp}/${1-$progname}"
859 if test "$opt_dry_run" = ":"; then
860 # Return a directory name, but don't create it in dry-run mode
861 my_tmpdir="${my_template}-$$"
864 # If mktemp works, use that first and foremost
865 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
867 if test ! -d "$my_tmpdir"; then
868 # Failing that, at least try and use $RANDOM to avoid a race
869 my_tmpdir="${my_template}-${RANDOM-0}$$"
871 save_mktempdir_umask=`umask`
874 umask $save_mktempdir_umask
877 # If we're not in dry-run mode, bomb out on failure
878 test -d "$my_tmpdir" || \
879 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
882 $ECHO "X$my_tmpdir" | $Xsed
886 # func_quote_for_eval arg
887 # Aesthetically quote ARG to be evaled later.
888 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
889 # is double-quoted, suitable for a subsequent eval, whereas
890 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
891 # which are still active within double quotes backslashified.
892 func_quote_for_eval ()
896 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
898 func_quote_for_eval_unquoted_result="$1" ;;
901 case $func_quote_for_eval_unquoted_result in
902 # Double-quote args containing shell metacharacters to delay
903 # word splitting, command substitution and and variable
904 # expansion for a subsequent eval.
905 # Many Bourne shells cannot handle close brackets correctly
906 # in scan sets, so we specify it separately.
907 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
908 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
911 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
916 # func_quote_for_expand arg
917 # Aesthetically quote ARG to be evaled later; same as above,
918 # but do not quote variable references.
919 func_quote_for_expand ()
923 my_arg=`$ECHO "X$1" | $Xsed \
924 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
930 # Double-quote args containing shell metacharacters to delay
931 # word splitting and command substitution for a subsequent eval.
932 # Many Bourne shells cannot handle close brackets correctly
933 # in scan sets, so we specify it separately.
934 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
939 func_quote_for_expand_result="$my_arg"
943 # func_show_eval cmd [fail_exp]
944 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
945 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
946 # is given, then evaluate it.
952 ${opt_silent-false} || {
953 func_quote_for_expand "$my_cmd"
954 eval "func_echo $func_quote_for_expand_result"
957 if ${opt_dry_run-false}; then :; else
960 if test "$my_status" -eq 0; then :; else
961 eval "(exit $my_status); $my_fail_exp"
967 # func_show_eval_locale cmd [fail_exp]
968 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
969 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
970 # is given, then evaluate it. Use the saved locale for evaluation.
971 func_show_eval_locale ()
976 ${opt_silent-false} || {
977 func_quote_for_expand "$my_cmd"
978 eval "func_echo $func_quote_for_expand_result"
981 if ${opt_dry_run-false}; then :; else
982 eval "$lt_user_locale
985 eval "$lt_safe_locale"
986 if test "$my_status" -eq 0; then :; else
987 eval "(exit $my_status); $my_fail_exp"
997 # Echo version message to standard output and exit.
1000 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
1003 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1010 # Echo short help message to standard output and exit.
1013 $SED -n '/^# Usage:/,/# -h/ {
1016 s/\$progname/'$progname'/
1020 $ECHO "run \`$progname --help | more' for full usage"
1025 # Echo long help message to standard output and exit.
1028 $SED -n '/^# Usage:/,/# Report bugs to/ {
1031 s*\$progname*'$progname'*
1033 s*\$SHELL*'"$SHELL"'*
1035 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1037 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1038 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1039 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1045 # func_missing_arg argname
1046 # Echo program name prefixed message to standard error and set global
1050 func_error "missing argument for $1"
1060 # Check that we have a working $ECHO.
1061 if test "X$1" = X--no-reexec; then
1062 # Discard the --no-reexec flag, and continue.
1064 elif test "X$1" = X--fallback-echo; then
1065 # Avoid inline document here, it may be left over
1067 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
1068 # Yippee, $ECHO works!
1071 # Restart under the correct shell, and then maybe $ECHO will work.
1072 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
1075 if test "X$1" = X--fallback-echo; then
1076 # used as fallback echo
1084 magic="%%%MAGIC variable%%%"
1085 magic_exe="%%%MAGIC EXE variable%%%"
1092 lo2o="s/\\.lo\$/.${objext}/"
1093 o2lo="s/\\.${objext}\$/.lo/"
1098 opt_duplicate_deps=false
1102 # If this variable is set in any of the actions, the command in it
1103 # will be execed at the end. This prevents here-documents from being
1104 # left over by shells.
1107 # func_fatal_configuration arg...
1108 # Echo program name prefixed message to standard error, followed by
1109 # a configuration failure hint, and exit.
1110 func_fatal_configuration ()
1112 func_error ${1+"$@"}
1113 func_error "See the $PACKAGE documentation for more information."
1114 func_fatal_error "Fatal configuration error."
1119 # Display the configuration for all the tags in this script.
1122 re_begincf='^# ### BEGIN LIBTOOL'
1123 re_endcf='^# ### END LIBTOOL'
1125 # Default configuration.
1126 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1128 # Now print the configurations for the tags.
1129 for tagname in $taglist; do
1130 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1137 # Display the features supported by this script.
1141 if test "$build_libtool_libs" = yes; then
1142 $ECHO "enable shared libraries"
1144 $ECHO "disable shared libraries"
1146 if test "$build_old_libs" = yes; then
1147 $ECHO "enable static libraries"
1149 $ECHO "disable static libraries"
1155 # func_enable_tag tagname
1156 # Verify that TAGNAME is valid, and either flag an error and exit, or
1157 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1164 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1165 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1166 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1171 func_fatal_error "invalid tag name: $tagname"
1175 # Don't test for the "default" C tag, as we know it's
1176 # there but not specially marked.
1180 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1181 taglist="$taglist $tagname"
1183 # Evaluate the configuration. Be careful to quote the path
1184 # and the sed script, to avoid splitting on whitespace, but
1185 # also don't use non-portable quotes within backquotes within
1186 # quotes we have to do it in 2 steps:
1187 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1190 func_error "ignoring unknown tag $tagname"
1196 # Parse options once, thoroughly. This comes as soon as possible in
1197 # the script to make things like `libtool --version' happen quickly.
1200 # Shorthand for --mode=foo, only valid as the first argument
1203 shift; set dummy --mode clean ${1+"$@"}; shift
1205 compile|compil|compi|comp|com|co|c)
1206 shift; set dummy --mode compile ${1+"$@"}; shift
1208 execute|execut|execu|exec|exe|ex|e)
1209 shift; set dummy --mode execute ${1+"$@"}; shift
1211 finish|finis|fini|fin|fi|f)
1212 shift; set dummy --mode finish ${1+"$@"}; shift
1214 install|instal|insta|inst|ins|in|i)
1215 shift; set dummy --mode install ${1+"$@"}; shift
1218 shift; set dummy --mode link ${1+"$@"}; shift
1220 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1221 shift; set dummy --mode uninstall ${1+"$@"}; shift
1225 # Parse non-mode specific arguments:
1226 while test "$#" -gt 0; do
1231 --config) func_config ;;
1233 --debug) preserve_args="$preserve_args $opt"
1234 func_echo "enabling shell trace mode"
1239 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
1240 execute_dlfiles="$execute_dlfiles $1"
1244 --dry-run | -n) opt_dry_run=: ;;
1245 --features) func_features ;;
1246 --finish) mode="finish" ;;
1248 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
1250 # Valid mode arguments:
1260 # Catch anything else as an error
1261 *) func_error "invalid argument for $opt"
1271 --preserve-dup-deps)
1272 opt_duplicate_deps=: ;;
1274 --quiet|--silent) preserve_args="$preserve_args $opt"
1278 --verbose| -v) preserve_args="$preserve_args $opt"
1282 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
1283 preserve_args="$preserve_args $opt $1"
1284 func_enable_tag "$1" # tagname is set here
1288 # Separate optargs to long options:
1289 -dlopen=*|--mode=*|--tag=*)
1290 func_opt_split "$opt"
1291 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
1295 -\?|-h) func_usage ;;
1296 --help) opt_help=: ;;
1297 --version) func_version ;;
1299 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1309 *cygwin* | *mingw* | *pw32* | *cegcc*)
1310 # don't eliminate duplications in $postdeps and $predeps
1311 opt_duplicate_compiler_generated_deps=:
1314 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
1318 # Having warned about all mis-specified options, bail out if
1319 # anything was wrong.
1320 $exit_cmd $EXIT_FAILURE
1323 # func_check_version_match
1324 # Ensure that we are using m4 macros, and libtool script from the same
1325 # release of libtool.
1326 func_check_version_match ()
1328 if test "$package_revision" != "$macro_revision"; then
1329 if test "$VERSION" != "$macro_version"; then
1330 if test -z "$macro_version"; then
1332 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1333 $progname: definition of this LT_INIT comes from an older release.
1334 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1335 $progname: and run autoconf again.
1339 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1340 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1341 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1342 $progname: and run autoconf again.
1347 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1348 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1349 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1350 $progname: of $PACKAGE $VERSION and run autoconf again.
1364 # Sanity checks first:
1365 func_check_version_match
1367 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1368 func_fatal_configuration "not configured to build any kind of library"
1371 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1375 eval std_shrext=\"$shrext_cmds\"
1378 # Only execute mode is allowed to have -dlopen flags.
1379 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1380 func_error "unrecognized option \`-dlopen'"
1385 # Change the help message to a mode-specific one.
1386 generic_help="$help"
1387 help="Try \`$progname --help --mode=$mode' for more information."
1392 # True iff FILE is a libtool `.la' library or `.lo' object file.
1393 # This function is only a basic sanity check; it will hardly flush out
1394 # determined imposters.
1398 $SED -e 4q "$1" 2>/dev/null \
1399 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1402 # func_lalib_unsafe_p file
1403 # True iff FILE is a libtool `.la' library or `.lo' object file.
1404 # This function implements the same check as func_lalib_p without
1405 # resorting to external programs. To this end, it redirects stdin and
1406 # closes it afterwards, without saving the original file descriptor.
1407 # As a safety measure, use it only where a negative result would be
1408 # fatal anyway. Works if `file' does not exist.
1409 func_lalib_unsafe_p ()
1412 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1413 for lalib_p_l in 1 2 3 4
1416 case "$lalib_p_line" in
1417 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1422 test "$lalib_p" = yes
1425 # func_ltwrapper_script_p file
1426 # True iff FILE is a libtool wrapper script
1427 # This function is only a basic sanity check; it will hardly flush out
1428 # determined imposters.
1429 func_ltwrapper_script_p ()
1434 # func_ltwrapper_executable_p file
1435 # True iff FILE is a libtool wrapper executable
1436 # This function is only a basic sanity check; it will hardly flush out
1437 # determined imposters.
1438 func_ltwrapper_executable_p ()
1440 func_ltwrapper_exec_suffix=
1443 *) func_ltwrapper_exec_suffix=.exe ;;
1445 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1448 # func_ltwrapper_scriptname file
1449 # Assumes file is an ltwrapper_executable
1450 # uses $file to determine the appropriate filename for a
1451 # temporary ltwrapper_script.
1452 func_ltwrapper_scriptname ()
1454 func_ltwrapper_scriptname_result=""
1455 if func_ltwrapper_executable_p "$1"; then
1456 func_dirname_and_basename "$1" "" "."
1457 func_stripname '' '.exe' "$func_basename_result"
1458 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1462 # func_ltwrapper_p file
1463 # True iff FILE is a libtool wrapper script or wrapper executable
1464 # This function is only a basic sanity check; it will hardly flush out
1465 # determined imposters.
1468 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1472 # func_execute_cmds commands fail_cmd
1473 # Execute tilde-delimited COMMANDS.
1474 # If FAIL_CMD is given, eval that upon failure.
1475 # FAIL_CMD may read-access the current command in variable CMD!
1476 func_execute_cmds ()
1479 save_ifs=$IFS; IFS='~'
1483 func_show_eval "$cmd" "${2-:}"
1490 # Source FILE, adding directory component if necessary.
1491 # Note that it is not necessary on cygwin/mingw to append a dot to
1492 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1493 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1494 # `FILE.' does not work on cygwin managed mounts.
1499 */* | *\\*) . "$1" ;;
1505 # func_infer_tag arg
1506 # Infer tagged configuration to use if any are available and
1507 # if one wasn't chosen via the "--tag" command line option.
1508 # Only attempt this if the compiler in the base compile
1509 # command doesn't match the default compiler.
1510 # arg is usually of the form 'gcc ...'
1514 if test -n "$available_tags" && test -z "$tagname"; then
1517 func_quote_for_eval "$arg"
1518 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1521 # Blanks in the command may have been stripped by the calling shell,
1522 # but not from the CC environment variable when configure was run.
1523 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1524 # Blanks at the start of $base_compile will cause this to fail
1525 # if we don't check for them as well.
1527 for z in $available_tags; do
1528 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1529 # Evaluate the configuration.
1530 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1533 # Double-quote args containing other shell metacharacters.
1534 func_quote_for_eval "$arg"
1535 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1538 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1539 # The compiler in the base compile command matches
1540 # the one in the tagged configuration.
1541 # Assume this is the tagged configuration we want.
1548 # If $tagname still isn't set, then no tagged configuration
1549 # was found and let the user know that the "--tag" command
1550 # line option must be used.
1551 if test -z "$tagname"; then
1552 func_echo "unable to infer tagged configuration"
1553 func_fatal_error "specify a tag with \`--tag'"
1555 # func_verbose "using $tagname tagged configuration"
1564 # func_write_libtool_object output_name pic_name nonpic_name
1565 # Create a libtool object file (analogous to a ".la" file),
1566 # but don't create it if we're doing a dry run.
1567 func_write_libtool_object ()
1570 if test "$build_libtool_libs" = yes; then
1576 if test "$build_old_libs" = yes; then
1577 write_oldobj=\'${3}\'
1583 cat >${write_libobj}T <<EOF
1584 # $write_libobj - a libtool object file
1585 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1587 # Please DO NOT delete this file!
1588 # It is necessary for linking the library.
1590 # Name of the PIC object.
1591 pic_object=$write_lobj
1593 # Name of the non-PIC object
1594 non_pic_object=$write_oldobj
1597 $MV "${write_libobj}T" "${write_libobj}"
1601 # func_mode_compile arg...
1602 func_mode_compile ()
1605 # Get the compilation command and the source file.
1607 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1619 # do not "continue". Instead, add this to base_compile
1631 # Accept any command-line options.
1634 test -n "$libobj" && \
1635 func_fatal_error "you cannot specify \`-o' more than once"
1640 -pie | -fpie | -fPIE)
1641 pie_flag="$pie_flag $arg"
1645 -shared | -static | -prefer-pic | -prefer-non-pic)
1656 arg_mode=arg # the next one goes into the "base_compile" arg list
1657 continue # The current "srcfile" will either be retained or
1658 ;; # replaced later. I would guess that would be a bug.
1661 func_stripname '-Wc,' '' "$arg"
1662 args=$func_stripname_result
1664 save_ifs="$IFS"; IFS=','
1665 for arg in $args; do
1667 func_quote_for_eval "$arg"
1668 lastarg="$lastarg $func_quote_for_eval_result"
1671 func_stripname ' ' '' "$lastarg"
1672 lastarg=$func_stripname_result
1674 # Add the arguments to base_compile.
1675 base_compile="$base_compile $lastarg"
1680 # Accept the current argument as the source file.
1681 # The previous "srcfile" becomes the current argument.
1688 esac # case $arg_mode
1690 # Aesthetically quote the previous argument.
1691 func_quote_for_eval "$lastarg"
1692 base_compile="$base_compile $func_quote_for_eval_result"
1697 func_fatal_error "you must specify an argument for -Xcompile"
1700 func_fatal_error "you must specify a target with \`-o'"
1703 # Get the name of the library object.
1704 test -z "$libobj" && {
1705 func_basename "$srcfile"
1706 libobj="$func_basename_result"
1711 # Recognize several different file suffixes.
1712 # If the user specifies -o file.o, it is replaced with file.lo
1715 *.ada | *.adb | *.ads | *.asm | \
1716 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1717 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1718 func_xform "$libobj"
1719 libobj=$func_xform_result
1724 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1726 func_fatal_error "cannot determine name of library object from \`$libobj'"
1730 func_infer_tag $base_compile
1732 for arg in $later; do
1735 test "$build_libtool_libs" != yes && \
1736 func_fatal_configuration "can not build a shared library"
1742 build_libtool_libs=no
1759 func_quote_for_eval "$libobj"
1760 test "X$libobj" != "X$func_quote_for_eval_result" \
1761 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1762 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1763 func_dirname_and_basename "$obj" "/" ""
1764 objname="$func_basename_result"
1765 xdir="$func_dirname_result"
1766 lobj=${xdir}$objdir/$objname
1768 test -z "$base_compile" && \
1769 func_fatal_help "you must specify a compilation command"
1771 # Delete any leftover library objects.
1772 if test "$build_old_libs" = yes; then
1773 removelist="$obj $lobj $libobj ${libobj}T"
1775 removelist="$lobj $libobj ${libobj}T"
1778 # On Cygwin there's no "real" PIC flag so we must build both object types
1780 cygwin* | mingw* | pw32* | os2* | cegcc*)
1784 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1785 # non-PIC code in shared libraries is not supported
1789 # Calculate the filename of the output object if compiler does
1790 # not support -o with -c
1791 if test "$compiler_c_o" = no; then
1792 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1793 lockfile="$output_obj.lock"
1800 # Lock this critical section if it is needed
1801 # We use this script file to make the link, it avoids creating a new file
1802 if test "$need_locks" = yes; then
1803 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1804 func_echo "Waiting for $lockfile to be removed"
1807 elif test "$need_locks" = warn; then
1808 if test -f "$lockfile"; then
1810 *** ERROR, $lockfile exists and contains:
1811 `cat $lockfile 2>/dev/null`
1813 This indicates that another process is trying to use the same
1814 temporary object file, and libtool could not work around it because
1815 your compiler does not support \`-c' and \`-o' together. If you
1816 repeat this compilation, it may succeed, by chance, but you had better
1817 avoid parallel builds (make -j) in this platform, or get a better
1820 $opt_dry_run || $RM $removelist
1823 removelist="$removelist $output_obj"
1824 $ECHO "$srcfile" > "$lockfile"
1827 $opt_dry_run || $RM $removelist
1828 removelist="$removelist $lockfile"
1829 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1831 if test -n "$fix_srcfile_path"; then
1832 eval srcfile=\"$fix_srcfile_path\"
1834 func_quote_for_eval "$srcfile"
1835 qsrcfile=$func_quote_for_eval_result
1837 # Only build a PIC object if we are building libtool libraries.
1838 if test "$build_libtool_libs" = yes; then
1839 # Without this assignment, base_compile gets emptied.
1840 fbsd_hideous_sh_bug=$base_compile
1842 if test "$pic_mode" != no; then
1843 command="$base_compile $qsrcfile $pic_flag"
1845 # Don't build PIC code
1846 command="$base_compile $qsrcfile"
1849 func_mkdir_p "$xdir$objdir"
1851 if test -z "$output_obj"; then
1852 # Place PIC objects in $objdir
1853 command="$command -o $lobj"
1856 func_show_eval_locale "$command" \
1857 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1859 if test "$need_locks" = warn &&
1860 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1862 *** ERROR, $lockfile contains:
1863 `cat $lockfile 2>/dev/null`
1865 but it should contain:
1868 This indicates that another process is trying to use the same
1869 temporary object file, and libtool could not work around it because
1870 your compiler does not support \`-c' and \`-o' together. If you
1871 repeat this compilation, it may succeed, by chance, but you had better
1872 avoid parallel builds (make -j) in this platform, or get a better
1875 $opt_dry_run || $RM $removelist
1879 # Just move the object if needed, then go on to compile the next one
1880 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1881 func_show_eval '$MV "$output_obj" "$lobj"' \
1882 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1885 # Allow error messages only from the first compilation.
1886 if test "$suppress_opt" = yes; then
1887 suppress_output=' >/dev/null 2>&1'
1891 # Only build a position-dependent object if we build old libraries.
1892 if test "$build_old_libs" = yes; then
1893 if test "$pic_mode" != yes; then
1894 # Don't build PIC code
1895 command="$base_compile $qsrcfile$pie_flag"
1897 command="$base_compile $qsrcfile $pic_flag"
1899 if test "$compiler_c_o" = yes; then
1900 command="$command -o $obj"
1903 # Suppress compiler output if we already did a PIC compilation.
1904 command="$command$suppress_output"
1905 func_show_eval_locale "$command" \
1906 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1908 if test "$need_locks" = warn &&
1909 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1911 *** ERROR, $lockfile contains:
1912 `cat $lockfile 2>/dev/null`
1914 but it should contain:
1917 This indicates that another process is trying to use the same
1918 temporary object file, and libtool could not work around it because
1919 your compiler does not support \`-c' and \`-o' together. If you
1920 repeat this compilation, it may succeed, by chance, but you had better
1921 avoid parallel builds (make -j) in this platform, or get a better
1924 $opt_dry_run || $RM $removelist
1928 # Just move the object if needed
1929 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1930 func_show_eval '$MV "$output_obj" "$obj"' \
1931 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1936 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1938 # Unlock the critical section if it was locked
1939 if test "$need_locks" != no; then
1940 removelist=$lockfile
1949 test "$mode" = compile && func_mode_compile ${1+"$@"}
1954 # We need to display help for each of the modes.
1957 # Generic help is extracted from the usage comments
1958 # at the start of this file.
1964 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1966 Remove files from the build directory.
1968 RM is the name of the program to use to delete files associated with each FILE
1969 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1972 If FILE is a libtool library, object or program, all the files associated
1973 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1978 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1980 Compile a source file into a libtool library object.
1982 This mode accepts the following additional options:
1984 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1985 -no-suppress do not suppress compiler output for multiple passes
1986 -prefer-pic try to building PIC objects only
1987 -prefer-non-pic try to building non-PIC objects only
1988 -shared do not build a \`.o' file suitable for static linking
1989 -static only build a \`.o' file suitable for static linking
1991 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1992 from the given SOURCEFILE.
1994 The output file name is determined by removing the directory component from
1995 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1996 library object suffix, \`.lo'."
2001 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2003 Automatically set library path, then run a program.
2005 This mode accepts the following additional options:
2007 -dlopen FILE add the directory containing FILE to the library path
2009 This mode sets the library path environment variable according to \`-dlopen'
2012 If any of the ARGS are libtool executable wrappers, then they are translated
2013 into their corresponding uninstalled binary, and any of their required library
2014 directories are added to the library path.
2016 Then, COMMAND is executed, with ARGS as arguments."
2021 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2023 Complete the installation of libtool libraries.
2025 Each LIBDIR is a directory that contains libtool libraries.
2027 The commands that this mode executes may require superuser privileges. Use
2028 the \`--dry-run' option if you just want to see what would be executed."
2033 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2035 Install executables or libraries.
2037 INSTALL-COMMAND is the installation command. The first component should be
2038 either the \`install' or \`cp' program.
2040 The following components of INSTALL-COMMAND are treated specially:
2042 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2044 The rest of the components are interpreted as arguments to that command (only
2045 BSD-compatible install options are recognized)."
2050 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2052 Link object files or libraries together to form another library, or to
2053 create an executable program.
2055 LINK-COMMAND is a command using the C compiler that you would use to create
2056 a program from several object files.
2058 The following components of LINK-COMMAND are treated specially:
2060 -all-static do not do any dynamic linking at all
2061 -avoid-version do not add a version suffix if possible
2062 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2063 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2064 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2065 -export-symbols SYMFILE
2066 try to export only the symbols listed in SYMFILE
2067 -export-symbols-regex REGEX
2068 try to export only the symbols matching REGEX
2069 -LLIBDIR search LIBDIR for required installed libraries
2070 -lNAME OUTPUT-FILE requires the installed library libNAME
2071 -module build a library that can dlopened
2072 -no-fast-install disable the fast-install mode
2073 -no-install link a not-installable executable
2074 -no-undefined declare that a library does not refer to external symbols
2075 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2076 -objectlist FILE Use a list of object files found in FILE to specify objects
2077 -precious-files-regex REGEX
2078 don't remove output files matching REGEX
2079 -release RELEASE specify package release information
2080 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2081 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2082 -shared only do dynamic linking of libtool libraries
2083 -shrext SUFFIX override the standard shared library file extension
2084 -static do not do any dynamic linking of uninstalled libtool libraries
2085 -static-libtool-libs
2086 do not do any dynamic linking of libtool libraries
2087 -version-info CURRENT[:REVISION[:AGE]]
2088 specify library version info [each variable defaults to 0]
2089 -weak LIBNAME declare that the target provides the LIBNAME interface
2091 All other options (arguments beginning with \`-') are ignored.
2093 Every other argument is treated as a filename. Files ending in \`.la' are
2094 treated as uninstalled libtool libraries, other files are standard or library
2097 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2098 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2099 required, except when creating a convenience library.
2101 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2102 using \`ar' and \`ranlib', or on Windows using \`lib'.
2104 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2105 is created, otherwise an executable program is created."
2110 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2112 Remove libraries from an installation directory.
2114 RM is the name of the program to use to delete files associated with each FILE
2115 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2118 If FILE is a libtool library, all the files associated with it are deleted.
2119 Otherwise, only FILE itself is deleted using RM."
2123 func_fatal_help "invalid operation mode \`$mode'"
2128 $ECHO "Try \`$progname --help' for more information about other modes."
2133 # Now that we've collected a possible --mode arg, show help if necessary
2134 $opt_help && func_mode_help
2137 # func_mode_execute arg...
2138 func_mode_execute ()
2141 # The first argument is the command name.
2144 func_fatal_help "you must specify a COMMAND"
2146 # Handle -dlopen flags immediately.
2147 for file in $execute_dlfiles; do
2149 || func_fatal_help "\`$file' is not a file"
2154 # Check to see that this really is a libtool archive.
2155 func_lalib_unsafe_p "$file" \
2156 || func_fatal_help "\`$lib' is not a valid libtool archive"
2158 # Read the libtool library.
2163 # Skip this library if it cannot be dlopened.
2164 if test -z "$dlname"; then
2165 # Warn if it was a shared library.
2166 test -n "$library_names" && \
2167 func_warning "\`$file' was not linked with \`-export-dynamic'"
2171 func_dirname "$file" "" "."
2172 dir="$func_dirname_result"
2174 if test -f "$dir/$objdir/$dlname"; then
2177 if test ! -f "$dir/$dlname"; then
2178 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2184 # Just add the directory containing the .lo file.
2185 func_dirname "$file" "" "."
2186 dir="$func_dirname_result"
2190 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2195 # Get the absolute pathname.
2196 absdir=`cd "$dir" && pwd`
2197 test -n "$absdir" && dir="$absdir"
2199 # Now add the directory to shlibpath_var.
2200 if eval "test -z \"\$$shlibpath_var\""; then
2201 eval "$shlibpath_var=\"\$dir\""
2203 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2207 # This variable tells wrapper scripts just to set shlibpath_var
2208 # rather than running their programs.
2209 libtool_execute_magic="$magic"
2211 # Check if any of the arguments is a wrapper script.
2218 # Do a test to see if this is really a libtool program.
2219 if func_ltwrapper_script_p "$file"; then
2221 # Transform arg to wrapped name.
2222 file="$progdir/$program"
2223 elif func_ltwrapper_executable_p "$file"; then
2224 func_ltwrapper_scriptname "$file"
2225 func_source "$func_ltwrapper_scriptname_result"
2226 # Transform arg to wrapped name.
2227 file="$progdir/$program"
2231 # Quote arguments (to preserve shell metacharacters).
2232 func_quote_for_eval "$file"
2233 args="$args $func_quote_for_eval_result"
2236 if test "X$opt_dry_run" = Xfalse; then
2237 if test -n "$shlibpath_var"; then
2238 # Export the shlibpath_var.
2239 eval "export $shlibpath_var"
2242 # Restore saved environment variables
2243 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2245 eval "if test \"\${save_$lt_var+set}\" = set; then
2246 $lt_var=\$save_$lt_var; export $lt_var
2252 # Now prepare to actually exec the command.
2253 exec_cmd="\$cmd$args"
2255 # Display what would be done.
2256 if test -n "$shlibpath_var"; then
2257 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2258 $ECHO "export $shlibpath_var"
2265 test "$mode" = execute && func_mode_execute ${1+"$@"}
2268 # func_mode_finish arg...
2275 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2278 libdirs="$libdirs $dir"
2281 for libdir in $libdirs; do
2282 if test -n "$finish_cmds"; then
2283 # Do each command in the finish commands.
2284 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2287 if test -n "$finish_eval"; then
2288 # Do the single finish_eval.
2289 eval cmds=\"$finish_eval\"
2290 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2296 # Exit here if they wanted silent mode.
2297 $opt_silent && exit $EXIT_SUCCESS
2299 $ECHO "X----------------------------------------------------------------------" | $Xsed
2300 $ECHO "Libraries have been installed in:"
2301 for libdir in $libdirs; do
2305 $ECHO "If you ever happen to want to link against installed libraries"
2306 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2307 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2308 $ECHO "flag during linking and do at least one of the following:"
2309 if test -n "$shlibpath_var"; then
2310 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2311 $ECHO " during execution"
2313 if test -n "$runpath_var"; then
2314 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2315 $ECHO " during linking"
2317 if test -n "$hardcode_libdir_flag_spec"; then
2319 eval flag=\"$hardcode_libdir_flag_spec\"
2321 $ECHO " - use the \`$flag' linker flag"
2323 if test -n "$admincmds"; then
2324 $ECHO " - have your system administrator run these commands:$admincmds"
2326 if test -f /etc/ld.so.conf; then
2327 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2331 $ECHO "See any operating system documentation about shared libraries for"
2333 solaris2.[6789]|solaris2.1[0-9])
2334 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2338 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2341 $ECHO "X----------------------------------------------------------------------" | $Xsed
2345 test "$mode" = finish && func_mode_finish ${1+"$@"}
2348 # func_mode_install arg...
2349 func_mode_install ()
2352 # There may be an optional sh(1) argument at the beginning of
2353 # install_prog (especially on Windows NT).
2354 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2355 # Allow the use of GNU shtool's install command.
2356 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2357 # Aesthetically quote it.
2358 func_quote_for_eval "$nonopt"
2359 install_prog="$func_quote_for_eval_result "
2367 # The real first argument should be the name of the installation program.
2368 # Aesthetically quote it.
2369 func_quote_for_eval "$arg"
2370 install_prog="$install_prog$func_quote_for_eval_result"
2372 # We need to accept at least all the BSD install flags.
2382 if test -n "$dest"; then
2383 files="$files $dest"
2391 case " $install_prog " in
2406 # If the previous option needed an argument, then skip it.
2407 if test -n "$prev"; then
2416 # Aesthetically quote the argument.
2417 func_quote_for_eval "$arg"
2418 install_prog="$install_prog $func_quote_for_eval_result"
2421 test -z "$install_prog" && \
2422 func_fatal_help "you must specify an install program"
2424 test -n "$prev" && \
2425 func_fatal_help "the \`$prev' option requires an argument"
2427 if test -z "$files"; then
2428 if test -z "$dest"; then
2429 func_fatal_help "no file or destination specified"
2431 func_fatal_help "you must specify a destination"
2435 # Strip any trailing slash from the destination.
2436 func_stripname '' '/' "$dest"
2437 dest=$func_stripname_result
2439 # Check to see that the destination is a directory.
2440 test -d "$dest" && isdir=yes
2441 if test "$isdir" = yes; then
2445 func_dirname_and_basename "$dest" "" "."
2446 destdir="$func_dirname_result"
2447 destname="$func_basename_result"
2449 # Not a directory, so check to see that there is only one file specified.
2450 set dummy $files; shift
2451 test "$#" -gt 1 && \
2452 func_fatal_help "\`$dest' is not a directory"
2455 [\\/]* | [A-Za-z]:[\\/]*) ;;
2457 for file in $files; do
2461 func_fatal_help "\`$destdir' must be an absolute directory name"
2468 # This variable tells wrapper scripts just to set variables rather
2469 # than running their programs.
2470 libtool_install_magic="$magic"
2475 for file in $files; do
2477 # Do each installation.
2480 # Do the static libraries later.
2481 staticlibs="$staticlibs $file"
2485 # Check to see that this really is a libtool archive.
2486 func_lalib_unsafe_p "$file" \
2487 || func_fatal_help "\`$file' is not a valid libtool archive"
2494 # Add the libdir to current_libdirs if it is the destination.
2495 if test "X$destdir" = "X$libdir"; then
2496 case "$current_libdirs " in
2498 *) current_libdirs="$current_libdirs $libdir" ;;
2501 # Note the libdir as a future libdir.
2502 case "$future_libdirs " in
2504 *) future_libdirs="$future_libdirs $libdir" ;;
2508 func_dirname "$file" "/" ""
2509 dir="$func_dirname_result"
2512 if test -n "$relink_command"; then
2513 # Determine the prefix the user has applied to our future dir.
2514 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2516 # Don't allow the user to place us outside of our expected
2517 # location b/c this prevents finding dependent libraries that
2518 # are installed to the same prefix.
2519 # At present, this check doesn't affect windows .dll's that
2520 # are installed into $libdir/../bin (currently, that works fine)
2521 # but it's something to keep an eye on.
2522 test "$inst_prefix_dir" = "$destdir" && \
2523 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2525 if test -n "$inst_prefix_dir"; then
2526 # Stick the inst_prefix_dir data into the link command.
2527 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2529 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2532 func_warning "relinking \`$file'"
2533 func_show_eval "$relink_command" \
2534 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2537 # See the names of the shared library.
2538 set dummy $library_names; shift
2539 if test -n "$1"; then
2544 test -n "$relink_command" && srcname="$realname"T
2546 # Install the shared library and build the symlinks.
2547 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2551 cygwin* | mingw* | pw32* | cegcc*)
2559 if test -n "$tstripme" && test -n "$striplib"; then
2560 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2563 if test "$#" -gt 0; then
2564 # Delete the old symlinks, and create new ones.
2565 # Try `ln -sf' first, because the `ln' binary might depend on
2566 # the symlink we replace! Solaris /bin/ln does not understand -f,
2567 # so we also need to try rm && ln -s.
2570 test "$linkname" != "$realname" \
2571 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2575 # Do each command in the postinstall commands.
2576 lib="$destdir/$realname"
2577 func_execute_cmds "$postinstall_cmds" 'exit $?'
2580 # Install the pseudo-library for information purposes.
2581 func_basename "$file"
2582 name="$func_basename_result"
2583 instname="$dir/$name"i
2584 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2586 # Maybe install the static library, too.
2587 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2591 # Install (i.e. copy) a libtool object.
2593 # Figure out destination file name, if it wasn't already specified.
2594 if test -n "$destname"; then
2595 destfile="$destdir/$destname"
2597 func_basename "$file"
2598 destfile="$func_basename_result"
2599 destfile="$destdir/$destfile"
2602 # Deduce the name of the destination old-style object file.
2605 func_lo2o "$destfile"
2606 staticdest=$func_lo2o_result
2609 staticdest="$destfile"
2613 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2617 # Install the libtool object if requested.
2618 test -n "$destfile" && \
2619 func_show_eval "$install_prog $file $destfile" 'exit $?'
2621 # Install the old object if enabled.
2622 if test "$build_old_libs" = yes; then
2623 # Deduce the name of the old-style object file.
2625 staticobj=$func_lo2o_result
2626 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2632 # Figure out destination file name, if it wasn't already specified.
2633 if test -n "$destname"; then
2634 destfile="$destdir/$destname"
2636 func_basename "$file"
2637 destfile="$func_basename_result"
2638 destfile="$destdir/$destfile"
2641 # If the file is missing, and there is a .exe on the end, strip it
2642 # because it is most likely a libtool script we actually want to
2647 if test ! -f "$file"; then
2648 func_stripname '' '.exe' "$file"
2649 file=$func_stripname_result
2655 # Do a test to see if this is really a libtool program.
2658 if func_ltwrapper_executable_p "$file"; then
2659 func_ltwrapper_scriptname "$file"
2660 wrapper=$func_ltwrapper_scriptname_result
2662 func_stripname '' '.exe' "$file"
2663 wrapper=$func_stripname_result
2670 if func_ltwrapper_script_p "$wrapper"; then
2674 func_source "$wrapper"
2676 # Check the variables that should have been set.
2677 test -z "$generated_by_libtool_version" && \
2678 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2681 for lib in $notinst_deplibs; do
2682 # Check to see that each library is installed.
2684 if test -f "$lib"; then
2687 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2688 if test -n "$libdir" && test ! -f "$libfile"; then
2689 func_warning "\`$lib' has not been installed in \`$libdir'"
2695 func_source "$wrapper"
2698 if test "$fast_install" = no && test -n "$relink_command"; then
2700 if test "$finalize" = yes; then
2701 tmpdir=`func_mktempdir`
2702 func_basename "$file$stripped_ext"
2703 file="$func_basename_result"
2704 outputname="$tmpdir/$file"
2705 # Replace the output file specification.
2706 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2709 func_quote_for_expand "$relink_command"
2710 eval "func_echo $func_quote_for_expand_result"
2712 if eval "$relink_command"; then :
2714 func_error "error: relink \`$file' with the above command before installing it"
2715 $opt_dry_run || ${RM}r "$tmpdir"
2720 func_warning "cannot relink \`$file'"
2724 # Install the binary that we compiled earlier.
2725 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2729 # remove .exe since cygwin /usr/bin/install will append another
2731 case $install_prog,$host in
2732 */usr/bin/install*,*cygwin*)
2733 case $file:$destfile in
2738 destfile=$destfile.exe
2741 func_stripname '' '.exe' "$destfile"
2742 destfile=$func_stripname_result
2747 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2748 $opt_dry_run || if test -n "$outputname"; then
2755 for file in $staticlibs; do
2756 func_basename "$file"
2757 name="$func_basename_result"
2759 # Set up the ranlib parameters.
2760 oldlib="$destdir/$name"
2762 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2764 if test -n "$stripme" && test -n "$old_striplib"; then
2765 func_show_eval "$old_striplib $oldlib" 'exit $?'
2768 # Do each command in the postinstall commands.
2769 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2772 test -n "$future_libdirs" && \
2773 func_warning "remember to run \`$progname --finish$future_libdirs'"
2775 if test -n "$current_libdirs"; then
2776 # Maybe just do a dry run.
2777 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2778 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2784 test "$mode" = install && func_mode_install ${1+"$@"}
2787 # func_generate_dlsyms outputname originator pic_p
2788 # Extract symbols from dlprefiles and create ${outputname}S.o with
2789 # a dlpreopen symbol table.
2790 func_generate_dlsyms ()
2796 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2799 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2800 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2801 my_dlsyms="${my_outputname}S.c"
2803 func_error "not configured to extract global symbols from dlpreopened files"
2807 if test -n "$my_dlsyms"; then
2811 # Discover the nlist of each of the dlfiles.
2812 nlist="$output_objdir/${my_outputname}.nm"
2814 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2816 # Parse the name list into a source file.
2817 func_verbose "creating $output_objdir/$my_dlsyms"
2819 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2820 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2821 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2827 /* External symbol declarations for the compiler. */\
2830 if test "$dlself" = yes; then
2831 func_verbose "generating symbol list for \`$output'"
2833 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2835 # Add our own program objects to the symbol list.
2836 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2837 for progfile in $progfiles; do
2838 func_verbose "extracting global C symbols from \`$progfile'"
2839 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2842 if test -n "$exclude_expsyms"; then
2844 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2845 eval '$MV "$nlist"T "$nlist"'
2849 if test -n "$export_symbols_regex"; then
2851 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2852 eval '$MV "$nlist"T "$nlist"'
2856 # Prepare the list of exported symbols
2857 if test -z "$export_symbols"; then
2858 export_symbols="$output_objdir/$outputname.exp"
2861 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2863 *cygwin* | *mingw* | *cegcc* )
2864 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2865 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2871 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2872 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2873 eval '$MV "$nlist"T "$nlist"'
2875 *cygwin | *mingw* | *cegcc* )
2876 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2877 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2884 for dlprefile in $dlprefiles; do
2885 func_verbose "extracting global C symbols from \`$dlprefile'"
2886 func_basename "$dlprefile"
2887 name="$func_basename_result"
2889 eval '$ECHO ": $name " >> "$nlist"'
2890 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2895 # Make sure we have at least an empty file.
2896 test -f "$nlist" || : > "$nlist"
2898 if test -n "$exclude_expsyms"; then
2899 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2900 $MV "$nlist"T "$nlist"
2903 # Try sorting and uniquifying the output.
2904 if $GREP -v "^: " < "$nlist" |
2905 if sort -k 3 </dev/null >/dev/null 2>&1; then
2910 uniq > "$nlist"S; then
2913 $GREP -v "^: " < "$nlist" > "$nlist"S
2916 if test -f "$nlist"S; then
2917 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2919 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2922 $ECHO >> "$output_objdir/$my_dlsyms" "\
2924 /* The mapping between symbol names and symbols. */
2931 *cygwin* | *mingw* | *cegcc* )
2932 $ECHO >> "$output_objdir/$my_dlsyms" "\
2933 /* DATA imports from DLLs on WIN32 con't be const, because
2934 runtime relocations are performed -- see ld's documentation
2935 on pseudo-relocs. */"
2938 echo >> "$output_objdir/$my_dlsyms" "\
2939 /* This system does not cope well with relocations in const data */"
2942 lt_dlsym_const=const ;;
2945 $ECHO >> "$output_objdir/$my_dlsyms" "\
2946 extern $lt_dlsym_const lt_dlsymlist
2947 lt_${my_prefix}_LTX_preloaded_symbols[];
2948 $lt_dlsym_const lt_dlsymlist
2949 lt_${my_prefix}_LTX_preloaded_symbols[] =
2951 { \"$my_originator\", (void *) 0 },"
2953 case $need_lib_prefix in
2955 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2958 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2961 $ECHO >> "$output_objdir/$my_dlsyms" "\
2965 /* This works around a problem in FreeBSD linker */
2966 #ifdef FREEBSD_WORKAROUND
2967 static const void *lt_preloaded_setup() {
2968 return lt_${my_prefix}_LTX_preloaded_symbols;
2978 pic_flag_for_symtable=
2979 case "$compile_command " in
2983 # compiling the symbol table file with pic_flag works around
2984 # a FreeBSD bug that causes programs to crash when -lm is
2985 # linked before any other PIC object. But we must not use
2986 # pic_flag when linking with -static. The problem exists in
2987 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2988 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2989 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2991 pic_flag_for_symtable=" $pic_flag" ;;
2993 if test "X$my_pic_p" != Xno; then
2994 pic_flag_for_symtable=" $pic_flag"
3001 for arg in $LTCFLAGS; do
3003 -pie | -fpie | -fPIE) ;;
3004 *) symtab_cflags="$symtab_cflags $arg" ;;
3008 # Now compile the dynamic symbol file.
3009 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3011 # Clean up the generated files.
3012 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3014 # Transform the symbol file into the correct name.
3015 symfileobj="$output_objdir/${my_outputname}S.$objext"
3017 *cygwin* | *mingw* | *cegcc* )
3018 if test -f "$output_objdir/$my_outputname.def"; then
3019 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3020 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3022 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3023 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3027 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3028 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3033 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3037 # We keep going just in case the user didn't refer to
3038 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3039 # really was required.
3041 # Nullify the symbol file.
3042 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3043 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3047 # func_win32_libid arg
3048 # return the library type of file 'arg'
3050 # Need a lot of goo to handle *both* DLLs and import libs
3051 # Has to be a shell function in order to 'eat' the argument
3052 # that is supplied when $file_magic_command is called.
3056 win32_libid_type="unknown"
3057 win32_fileres=`file -L $1 2>/dev/null`
3058 case $win32_fileres in
3059 *ar\ archive\ import\ library*) # definitely import
3060 win32_libid_type="x86 archive import"
3062 *ar\ archive*) # could be an import, or static
3063 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3064 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
3065 win32_nmres=`eval $NM -f posix -A $1 |
3074 case $win32_nmres in
3075 import*) win32_libid_type="x86 archive import";;
3076 *) win32_libid_type="x86 archive static";;
3081 win32_libid_type="x86 DLL"
3083 *executable*) # but shell scripts are "executable" too...
3084 case $win32_fileres in
3085 *MS\ Windows\ PE\ Intel*)
3086 win32_libid_type="x86 DLL"
3091 $ECHO "$win32_libid_type"
3096 # func_extract_an_archive dir oldlib
3097 func_extract_an_archive ()
3100 f_ex_an_ar_dir="$1"; shift
3101 f_ex_an_ar_oldlib="$1"
3102 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
3103 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3106 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3111 # func_extract_archives gentop oldlib ...
3112 func_extract_archives ()
3115 my_gentop="$1"; shift
3116 my_oldlibs=${1+"$@"}
3122 for my_xlib in $my_oldlibs; do
3123 # Extract the objects.
3125 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3126 *) my_xabs=`pwd`"/$my_xlib" ;;
3128 func_basename "$my_xlib"
3129 my_xlib="$func_basename_result"
3132 case " $extracted_archives " in
3134 func_arith $extracted_serial + 1
3135 extracted_serial=$func_arith_result
3136 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3140 extracted_archives="$extracted_archives $my_xlib_u"
3141 my_xdir="$my_gentop/$my_xlib_u"
3143 func_mkdir_p "$my_xdir"
3147 func_verbose "Extracting $my_xabs"
3148 # Do not bother doing anything if just a dry run
3150 darwin_orig_dir=`pwd`
3151 cd $my_xdir || exit $?
3152 darwin_archive=$my_xabs
3154 darwin_base_archive=`basename "$darwin_archive"`
3155 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3156 if test -n "$darwin_arches"; then
3157 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3159 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3160 for darwin_arch in $darwin_arches ; do
3161 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3162 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3163 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3164 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3166 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3167 done # $darwin_arches
3168 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3169 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3172 for darwin_file in $darwin_filelist; do
3173 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
3174 $LIPO -create -output "$darwin_file" $darwin_files
3175 done # $darwin_filelist
3177 cd "$darwin_orig_dir"
3180 func_extract_an_archive "$my_xdir" "$my_xabs"
3185 func_extract_an_archive "$my_xdir" "$my_xabs"
3188 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3191 func_extract_archives_result="$my_oldobjs"
3196 # func_emit_wrapper_part1 [arg=no]
3198 # Emit the first part of a libtool wrapper script on stdout.
3199 # For more information, see the description associated with
3200 # func_emit_wrapper(), below.
3201 func_emit_wrapper_part1 ()
3203 func_emit_wrapper_part1_arg1=no
3204 if test -n "$1" ; then
3205 func_emit_wrapper_part1_arg1=$1
3211 # $output - temporary wrapper script for $objdir/$outputname
3212 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3214 # The $output program cannot be directly executed until all the libtool
3215 # libraries that it depends on are installed.
3217 # This wrapper script should never be moved out of the build directory.
3218 # If it is, it will not operate correctly.
3220 # Sed substitution that helps us do robust quoting. It backslashifies
3221 # metacharacters that are still active within double-quoted strings.
3222 Xsed='${SED} -e 1s/^X//'
3223 sed_quote_subst='$sed_quote_subst'
3225 # Be Bourne compatible
3226 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3229 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3230 # is contrary to our usage. Disable this feature.
3231 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3232 setopt NO_GLOB_SUBST
3234 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3236 BIN_SH=xpg4; export BIN_SH # for Tru64
3237 DUALCASE=1; export DUALCASE # for MKS sh
3239 # The HP-UX ksh and POSIX shell print the target directory to stdout
3241 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3243 relink_command=\"$relink_command\"
3245 # This environment variable determines our operation mode.
3246 if test \"\$libtool_install_magic\" = \"$magic\"; then
3247 # install mode needs the following variables:
3248 generated_by_libtool_version='$macro_version'
3249 notinst_deplibs='$notinst_deplibs'
3251 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3252 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3255 # Make sure echo works.
3256 if test \"X\$1\" = X--no-reexec; then
3257 # Discard the --no-reexec flag, and continue.
3259 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
3260 # Yippee, \$ECHO works!
3263 # Restart under the correct shell, and then maybe \$ECHO will work.
3264 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3270 # Find the directory that this script lives in.
3271 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3272 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3274 # Follow symbolic links until we get to the real thisdir.
3275 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3276 while test -n \"\$file\"; do
3277 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3279 # If there was a directory component, then change thisdir.
3280 if test \"x\$destdir\" != \"x\$file\"; then
3281 case \"\$destdir\" in
3282 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3283 *) thisdir=\"\$thisdir/\$destdir\" ;;
3287 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3288 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3292 # end: func_emit_wrapper_part1
3294 # func_emit_wrapper_part2 [arg=no]
3296 # Emit the second part of a libtool wrapper script on stdout.
3297 # For more information, see the description associated with
3298 # func_emit_wrapper(), below.
3299 func_emit_wrapper_part2 ()
3301 func_emit_wrapper_part2_arg1=no
3302 if test -n "$1" ; then
3303 func_emit_wrapper_part2_arg1=$1
3308 # Usually 'no', except on cygwin/mingw when embedded into
3310 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
3311 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3312 # special case for '.'
3313 if test \"\$thisdir\" = \".\"; then
3316 # remove .libs from thisdir
3317 case \"\$thisdir\" in
3318 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
3319 $objdir ) thisdir=. ;;
3323 # Try to get the absolute directory name.
3324 absdir=\`cd \"\$thisdir\" && pwd\`
3325 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3328 if test "$fast_install" = yes; then
3330 program=lt-'$outputname'$exeext
3331 progdir=\"\$thisdir/$objdir\"
3333 if test ! -f \"\$progdir/\$program\" ||
3334 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3335 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3337 file=\"\$\$-\$program\"
3339 if test ! -d \"\$progdir\"; then
3340 $MKDIR \"\$progdir\"
3342 $RM \"\$progdir/\$file\"
3347 # relink executable if necessary
3348 if test -n \"\$relink_command\"; then
3349 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3351 $ECHO \"\$relink_command_output\" >&2
3352 $RM \"\$progdir/\$file\"
3357 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3358 { $RM \"\$progdir/\$program\";
3359 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3360 $RM \"\$progdir/\$file\"
3364 program='$outputname'
3365 progdir=\"\$thisdir/$objdir\"
3371 if test -f \"\$progdir/\$program\"; then"
3373 # Export our shlibpath_var if we have one.
3374 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3376 # Add our own library path to $shlibpath_var
3377 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3379 # Some systems cannot cope with colon-terminated $shlibpath_var
3380 # The second colon is a workaround for a bug in BeOS R4 sed
3381 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3383 export $shlibpath_var
3387 # fixup the dll searchpath if we need to.
3388 if test -n "$dllsearchpath"; then
3390 # Add the dll search path components to the executable PATH
3391 PATH=$dllsearchpath:\$PATH
3396 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3397 # Run the actual program with our arguments.
3400 # Backslashes separate directories on plain windows
3401 *-*-mingw | *-*-os2* | *-cegcc*)
3403 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3409 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3414 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3418 # The program doesn't exist.
3419 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3420 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3421 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3427 # end: func_emit_wrapper_part2
3430 # func_emit_wrapper [arg=no]
3432 # Emit a libtool wrapper script on stdout.
3433 # Don't directly open a file because we may want to
3434 # incorporate the script contents within a cygwin/mingw
3435 # wrapper executable. Must ONLY be called from within
3436 # func_mode_link because it depends on a number of variables
3439 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3440 # variable will take. If 'yes', then the emitted script
3441 # will assume that the directory in which it is stored is
3442 # the $objdir directory. This is a cygwin/mingw-specific
3444 func_emit_wrapper ()
3446 func_emit_wrapper_arg1=no
3447 if test -n "$1" ; then
3448 func_emit_wrapper_arg1=$1
3451 # split this up so that func_emit_cwrapperexe_src
3452 # can call each part independently.
3453 func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
3454 func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
3458 # func_to_host_path arg
3460 # Convert paths to host format when used with build tools.
3461 # Intended for use with "native" mingw (where libtool itself
3462 # is running under the msys shell), or in the following cross-
3463 # build environments:
3465 # mingw (msys) mingw [e.g. native]
3468 # where wine is equipped with the `winepath' executable.
3469 # In the native mingw case, the (msys) shell automatically
3470 # converts paths for any non-msys applications it launches,
3471 # but that facility isn't available from inside the cwrapper.
3472 # Similar accommodations are necessary for $host mingw and
3473 # $build cygwin. Calling this function does no harm for other
3474 # $host/$build combinations not listed above.
3476 # ARG is the path (on $build) that should be converted to
3477 # the proper representation for $host. The result is stored
3478 # in $func_to_host_path_result.
3479 func_to_host_path ()
3481 func_to_host_path_result="$1"
3482 if test -n "$1" ; then
3485 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3487 *mingw* ) # actually, msys
3488 # awkward: cmd appends spaces to result
3489 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3490 func_to_host_path_tmp1=`( cmd //c echo "$1" |\
3491 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3492 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3493 $SED -e "$lt_sed_naive_backslashify"`
3496 func_to_host_path_tmp1=`cygpath -w "$1"`
3497 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3498 $SED -e "$lt_sed_naive_backslashify"`
3501 # Unfortunately, winepath does not exit with a non-zero
3502 # error code, so we are forced to check the contents of
3503 # stdout. On the other hand, if the command is not
3504 # found, the shell will set an exit code of 127 and print
3505 # *an error message* to stdout. So we must check for both
3506 # error code of zero AND non-empty stdout, which explains
3507 # the odd construction:
3508 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3509 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3510 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3511 $SED -e "$lt_sed_naive_backslashify"`
3513 # Allow warning below.
3514 func_to_host_path_result=""
3518 if test -z "$func_to_host_path_result" ; then
3519 func_error "Could not determine host path corresponding to"
3521 func_error "Continuing, but uninstalled executables may not work."
3523 func_to_host_path_result="$1"
3529 # end: func_to_host_path
3531 # func_to_host_pathlist arg
3533 # Convert pathlists to host format when used with build tools.
3534 # See func_to_host_path(), above. This function supports the
3535 # following $build/$host combinations (but does no harm for
3536 # combinations not listed here):
3538 # mingw (msys) mingw [e.g. native]
3542 # Path separators are also converted from $build format to
3543 # $host format. If ARG begins or ends with a path separator
3544 # character, it is preserved (but converted to $host format)
3547 # ARG is a pathlist (on $build) that should be converted to
3548 # the proper representation on $host. The result is stored
3549 # in $func_to_host_pathlist_result.
3550 func_to_host_pathlist ()
3552 func_to_host_pathlist_result="$1"
3553 if test -n "$1" ; then
3556 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3557 # Remove leading and trailing path separator characters from
3558 # ARG. msys behavior is inconsistent here, cygpath turns them
3559 # into '.;' and ';.', and winepath ignores them completely.
3560 func_to_host_pathlist_tmp2="$1"
3561 # Once set for this call, this variable should not be
3562 # reassigned. It is used in tha fallback case.
3563 func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
3564 $SED -e 's|^:*||' -e 's|:*$||'`
3566 *mingw* ) # Actually, msys.
3567 # Awkward: cmd appends spaces to result.
3568 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3569 func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
3570 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3571 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3572 $SED -e "$lt_sed_naive_backslashify"`
3575 func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
3576 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3577 $SED -e "$lt_sed_naive_backslashify"`
3580 # unfortunately, winepath doesn't convert pathlists
3581 func_to_host_pathlist_result=""
3582 func_to_host_pathlist_oldIFS=$IFS
3584 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3585 IFS=$func_to_host_pathlist_oldIFS
3586 if test -n "$func_to_host_pathlist_f" ; then
3587 func_to_host_path "$func_to_host_pathlist_f"
3588 if test -n "$func_to_host_path_result" ; then
3589 if test -z "$func_to_host_pathlist_result" ; then
3590 func_to_host_pathlist_result="$func_to_host_path_result"
3592 func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
3598 IFS=$func_to_host_pathlist_oldIFS
3601 if test -z "$func_to_host_pathlist_result" ; then
3602 func_error "Could not determine the host path(s) corresponding to"
3604 func_error "Continuing, but uninstalled executables may not work."
3605 # Fallback. This may break if $1 contains DOS-style drive
3606 # specifications. The fix is not to complicate the expression
3607 # below, but for the user to provide a working wine installation
3608 # with winepath so that path translation in the cross-to-mingw
3609 # case works properly.
3610 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3611 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3612 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3614 # Now, add the leading and trailing path separators back
3616 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3620 *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
3627 # end: func_to_host_pathlist
3629 # func_emit_cwrapperexe_src
3630 # emit the source code for a wrapper executable on stdout
3631 # Must ONLY be called from within func_mode_link because
3632 # it depends on a number of variable set therein.
3633 func_emit_cwrapperexe_src ()
3637 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3638 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3640 The $output program cannot be directly executed until all the libtool
3641 libraries that it depends on are installed.
3643 This wrapper executable should never be moved out of the build directory.
3644 If it is, it will not operate correctly.
3646 Currently, it simply execs the wrapper *script* "$SHELL $output",
3647 but could eventually absorb all of the scripts functionality and
3648 exec $objdir/$outputname directly.
3655 # include <direct.h>
3656 # include <process.h>
3658 # define setmode _setmode
3660 # include <unistd.h>
3661 # include <stdint.h>
3664 # define HAVE_SETENV
3665 # ifdef __STRICT_ANSI__
3666 char *realpath (const char *, char *);
3667 int putenv (char *);
3668 int setenv (const char *, const char *, int);
3679 #include <sys/stat.h>
3681 #if defined(PATH_MAX)
3682 # define LT_PATHMAX PATH_MAX
3683 #elif defined(MAXPATHLEN)
3684 # define LT_PATHMAX MAXPATHLEN
3686 # define LT_PATHMAX 1024
3697 # define S_IXUSR _S_IEXEC
3699 # ifndef _INTPTR_T_DEFINED
3700 # define intptr_t int
3704 #ifndef DIR_SEPARATOR
3705 # define DIR_SEPARATOR '/'
3706 # define PATH_SEPARATOR ':'
3709 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3711 # define HAVE_DOS_BASED_FILE_SYSTEM
3712 # define FOPEN_WB "wb"
3713 # ifndef DIR_SEPARATOR_2
3714 # define DIR_SEPARATOR_2 '\\'
3716 # ifndef PATH_SEPARATOR_2
3717 # define PATH_SEPARATOR_2 ';'
3721 #ifndef DIR_SEPARATOR_2
3722 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3723 #else /* DIR_SEPARATOR_2 */
3724 # define IS_DIR_SEPARATOR(ch) \
3725 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3726 #endif /* DIR_SEPARATOR_2 */
3728 #ifndef PATH_SEPARATOR_2
3729 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3730 #else /* PATH_SEPARATOR_2 */
3731 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3732 #endif /* PATH_SEPARATOR_2 */
3735 # define FOPEN_WB "wb"
3739 # define FOPEN_WB "w"
3742 # define _O_BINARY 0
3745 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3746 #define XFREE(stale) do { \
3747 if (stale) { free ((void *) stale); stale = 0; } \
3750 #undef LTWRAPPER_DEBUGPRINTF
3751 #if defined DEBUGWRAPPER
3752 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3754 ltwrapper_debugprintf (const char *fmt, ...)
3757 va_start (args, fmt);
3758 (void) vfprintf (stderr, fmt, args);
3762 # define LTWRAPPER_DEBUGPRINTF(args)
3765 const char *program_name = NULL;
3767 void *xmalloc (size_t num);
3768 char *xstrdup (const char *string);
3769 const char *base_name (const char *name);
3770 char *find_executable (const char *wrapper);
3771 char *chase_symlinks (const char *pathspec);
3772 int make_executable (const char *path);
3773 int check_executable (const char *path);
3774 char *strendzap (char *str, const char *pat);
3775 void lt_fatal (const char *message, ...);
3776 void lt_setenv (const char *name, const char *value);
3777 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3778 void lt_opt_process_env_set (const char *arg);
3779 void lt_opt_process_env_prepend (const char *arg);
3780 void lt_opt_process_env_append (const char *arg);
3781 int lt_split_name_value (const char *arg, char** name, char** value);
3782 void lt_update_exe_path (const char *name, const char *value);
3783 void lt_update_lib_path (const char *name, const char *value);
3785 static const char *script_text_part1 =
3788 func_emit_wrapper_part1 yes |
3789 $SED -e 's/\([\\"]\)/\\\1/g' \
3790 -e 's/^/ "/' -e 's/$/\\n"/'
3794 static const char *script_text_part2 =
3796 func_emit_wrapper_part2 yes |
3797 $SED -e 's/\([\\"]\)/\\\1/g' \
3798 -e 's/^/ "/' -e 's/$/\\n"/'
3802 const char * MAGIC_EXE = "$magic_exe";
3803 const char * LIB_PATH_VARNAME = "$shlibpath_var";
3806 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3807 func_to_host_pathlist "$temp_rpath"
3809 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
3813 const char * LIB_PATH_VALUE = "";
3817 if test -n "$dllsearchpath"; then
3818 func_to_host_pathlist "$dllsearchpath:"
3820 const char * EXE_PATH_VARNAME = "PATH";
3821 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
3825 const char * EXE_PATH_VARNAME = "";
3826 const char * EXE_PATH_VALUE = "";
3830 if test "$fast_install" = yes; then
3832 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3836 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3843 #define LTWRAPPER_OPTION_PREFIX "--lt-"
3844 #define LTWRAPPER_OPTION_PREFIX_LENGTH 5
3846 static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
3847 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3849 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
3851 static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
3852 static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
3853 /* argument is putenv-style "foo=bar", value of foo is set to bar */
3855 static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
3856 static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
3857 /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
3859 static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
3860 static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
3861 /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
3864 main (int argc, char *argv[])
3869 char *actual_cwrapper_path;
3870 char *actual_cwrapper_name;
3873 intptr_t rval = 127;
3877 program_name = (char *) xstrdup (base_name (argv[0]));
3878 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3879 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3881 /* very simple arg parsing; don't want to rely on getopt */
3882 for (i = 1; i < argc; i++)
3884 if (strcmp (argv[i], dumpscript_opt) == 0)
3888 *mingw* | *cygwin* )
3889 # make stdout use "unix" line endings
3890 echo " setmode(1,_O_BINARY);"
3895 printf ("%s", script_text_part1);
3896 printf ("%s", script_text_part2);
3901 newargz = XMALLOC (char *, argc + 1);
3902 tmp_pathspec = find_executable (argv[0]);
3903 if (tmp_pathspec == NULL)
3904 lt_fatal ("Couldn't find %s", argv[0]);
3905 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3908 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3909 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3910 actual_cwrapper_path));
3911 XFREE (tmp_pathspec);
3913 actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
3914 strendzap (actual_cwrapper_path, actual_cwrapper_name);
3916 /* wrapper name transforms */
3917 strendzap (actual_cwrapper_name, ".exe");
3918 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3919 XFREE (actual_cwrapper_name);
3920 actual_cwrapper_name = tmp_pathspec;
3923 /* target_name transforms -- use actual target program name; might have lt- prefix */
3924 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3925 strendzap (target_name, ".exe");
3926 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3927 XFREE (target_name);
3928 target_name = tmp_pathspec;
3931 LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
3937 XMALLOC (char, (strlen (actual_cwrapper_path) +
3938 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3939 strcpy (newargz[0], actual_cwrapper_path);
3940 strcat (newargz[0], "$objdir");
3941 strcat (newargz[0], "/");
3945 /* stop here, and copy so we don't have to do this twice */
3946 tmp_pathspec = xstrdup (newargz[0]);
3948 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3949 strcat (newargz[0], actual_cwrapper_name);
3951 /* DO want the lt- prefix here if it exists, so use target_name */
3952 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3953 XFREE (tmp_pathspec);
3954 tmp_pathspec = NULL;
3962 while ((p = strchr (newargz[0], '\\')) != NULL)
3966 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
3976 XFREE (target_name);
3977 XFREE (actual_cwrapper_path);
3978 XFREE (actual_cwrapper_name);
3980 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3981 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
3982 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3983 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3986 for (i = 1; i < argc; i++)
3988 if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
3990 if (argv[i][env_set_opt_len] == '=')
3992 const char *p = argv[i] + env_set_opt_len + 1;
3993 lt_opt_process_env_set (p);
3995 else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
3997 lt_opt_process_env_set (argv[++i]); /* don't copy */
4000 lt_fatal ("%s missing required argument", env_set_opt);
4003 if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
4005 if (argv[i][env_prepend_opt_len] == '=')
4007 const char *p = argv[i] + env_prepend_opt_len + 1;
4008 lt_opt_process_env_prepend (p);
4010 else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
4012 lt_opt_process_env_prepend (argv[++i]); /* don't copy */
4015 lt_fatal ("%s missing required argument", env_prepend_opt);
4018 if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
4020 if (argv[i][env_append_opt_len] == '=')
4022 const char *p = argv[i] + env_append_opt_len + 1;
4023 lt_opt_process_env_append (p);
4025 else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
4027 lt_opt_process_env_append (argv[++i]); /* don't copy */
4030 lt_fatal ("%s missing required argument", env_append_opt);
4033 if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
4035 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4036 namespace, but it is not one of the ones we know about and
4037 have already dealt with, above (inluding dump-script), then
4038 report an error. Otherwise, targets might begin to believe
4039 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4040 namespace. The first time any user complains about this, we'll
4041 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4042 or a configure.ac-settable value.
4044 lt_fatal ("Unrecognized option in %s namespace: '%s'",
4045 ltwrapper_option_prefix, argv[i]);
4048 newargz[++newargc] = xstrdup (argv[i]);
4050 newargz[++newargc] = NULL;
4052 LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
4053 for (i = 0; i < newargc; i++)
4055 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
4063 /* execv doesn't actually work on mingw as expected on unix */
4064 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4067 /* failed to start process */
4068 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
4076 execv (lt_argv_zero, newargz);
4077 return rval; /* =127, but avoids unused variable warning */
4086 xmalloc (size_t num)
4088 void *p = (void *) malloc (num);
4090 lt_fatal ("Memory exhausted");
4096 xstrdup (const char *string)
4098 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4103 base_name (const char *name)
4107 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4108 /* Skip over the disk name in MSDOS pathnames. */
4109 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4113 for (base = name; *name; name++)
4114 if (IS_DIR_SEPARATOR (*name))
4120 check_executable (const char *path)
4124 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
4125 path ? (*path ? path : "EMPTY!") : "NULL!"));
4126 if ((!path) || (!*path))
4129 if ((stat (path, &st) >= 0)
4130 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4137 make_executable (const char *path)
4142 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
4143 path ? (*path ? path : "EMPTY!") : "NULL!"));
4144 if ((!path) || (!*path))
4147 if (stat (path, &st) >= 0)
4149 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4154 /* Searches for the full path of the wrapper. Returns
4155 newly allocated full path name if found, NULL otherwise
4156 Does not chase symlinks, even on platforms that support them.
4159 find_executable (const char *wrapper)
4164 /* static buffer for getcwd */
4165 char tmp[LT_PATHMAX + 1];
4169 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
4170 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
4172 if ((wrapper == NULL) || (*wrapper == '\0'))
4175 /* Absolute path? */
4176 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4177 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4179 concat_name = xstrdup (wrapper);
4180 if (check_executable (concat_name))
4182 XFREE (concat_name);
4187 if (IS_DIR_SEPARATOR (wrapper[0]))
4189 concat_name = xstrdup (wrapper);
4190 if (check_executable (concat_name))
4192 XFREE (concat_name);
4194 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4198 for (p = wrapper; *p; p++)
4206 /* no slashes; search PATH */
4207 const char *path = getenv ("PATH");
4210 for (p = path; *p; p = p_next)
4214 for (q = p; *q; q++)
4215 if (IS_PATH_SEPARATOR (*q))
4218 p_next = (*q == '\0' ? q : q + 1);
4221 /* empty path: current directory */
4222 if (getcwd (tmp, LT_PATHMAX) == NULL)
4223 lt_fatal ("getcwd failed");
4224 tmp_len = strlen (tmp);
4226 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4227 memcpy (concat_name, tmp, tmp_len);
4228 concat_name[tmp_len] = '/';
4229 strcpy (concat_name + tmp_len + 1, wrapper);
4234 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4235 memcpy (concat_name, p, p_len);
4236 concat_name[p_len] = '/';
4237 strcpy (concat_name + p_len + 1, wrapper);
4239 if (check_executable (concat_name))
4241 XFREE (concat_name);
4244 /* not found in PATH; assume curdir */
4246 /* Relative path | not found in path: prepend cwd */
4247 if (getcwd (tmp, LT_PATHMAX) == NULL)
4248 lt_fatal ("getcwd failed");
4249 tmp_len = strlen (tmp);
4250 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4251 memcpy (concat_name, tmp, tmp_len);
4252 concat_name[tmp_len] = '/';
4253 strcpy (concat_name + tmp_len + 1, wrapper);
4255 if (check_executable (concat_name))
4257 XFREE (concat_name);
4262 chase_symlinks (const char *pathspec)
4265 return xstrdup (pathspec);
4267 char buf[LT_PATHMAX];
4269 char *tmp_pathspec = xstrdup (pathspec);
4271 int has_symlinks = 0;
4272 while (strlen (tmp_pathspec) && !has_symlinks)
4274 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
4276 if (lstat (tmp_pathspec, &s) == 0)
4278 if (S_ISLNK (s.st_mode) != 0)
4284 /* search backwards for last DIR_SEPARATOR */
4285 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4286 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4288 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4290 /* no more DIR_SEPARATORS left */
4297 char *errstr = strerror (errno);
4298 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
4301 XFREE (tmp_pathspec);
4305 return xstrdup (pathspec);
4308 tmp_pathspec = realpath (pathspec, buf);
4309 if (tmp_pathspec == 0)
4311 lt_fatal ("Could not follow symlinks for %s", pathspec);
4313 return xstrdup (tmp_pathspec);
4318 strendzap (char *str, const char *pat)
4322 assert (str != NULL);
4323 assert (pat != NULL);
4326 patlen = strlen (pat);
4330 str += len - patlen;
4331 if (strcmp (str, pat) == 0)
4338 lt_error_core (int exit_status, const char *mode,
4339 const char *message, va_list ap)
4341 fprintf (stderr, "%s: %s: ", program_name, mode);
4342 vfprintf (stderr, message, ap);
4343 fprintf (stderr, ".\n");
4345 if (exit_status >= 0)
4350 lt_fatal (const char *message, ...)
4353 va_start (ap, message);
4354 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4359 lt_setenv (const char *name, const char *value)
4361 LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
4362 (name ? name : "<NULL>"),
4363 (value ? value : "<NULL>")));
4366 /* always make a copy, for consistency with !HAVE_SETENV */
4367 char *str = xstrdup (value);
4368 setenv (name, str, 1);
4370 int len = strlen (name) + 1 + strlen (value) + 1;
4371 char *str = XMALLOC (char, len);
4372 sprintf (str, "%s=%s", name, value);
4373 if (putenv (str) != EXIT_SUCCESS)
4382 lt_extend_str (const char *orig_value, const char *add, int to_end)
4385 if (orig_value && *orig_value)
4387 int orig_value_len = strlen (orig_value);
4388 int add_len = strlen (add);
4389 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4392 strcpy (new_value, orig_value);
4393 strcpy (new_value + orig_value_len, add);
4397 strcpy (new_value, add);
4398 strcpy (new_value + add_len, orig_value);
4403 new_value = xstrdup (add);
4409 lt_split_name_value (const char *arg, char** name, char** value)
4416 p = strchr (arg, (int)'=');
4421 *value = xstrdup (++p);
4423 len = strlen (arg) - strlen (*value);
4424 *name = XMALLOC (char, len);
4425 strncpy (*name, arg, len-1);
4426 (*name)[len - 1] = '\0';
4432 lt_opt_process_env_set (const char *arg)
4437 if (lt_split_name_value (arg, &name, &value) != 0)
4441 lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
4444 lt_setenv (name, value);
4450 lt_opt_process_env_prepend (const char *arg)
4454 char *new_value = NULL;
4456 if (lt_split_name_value (arg, &name, &value) != 0)
4460 lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
4463 new_value = lt_extend_str (getenv (name), value, 0);
4464 lt_setenv (name, new_value);
4471 lt_opt_process_env_append (const char *arg)
4475 char *new_value = NULL;
4477 if (lt_split_name_value (arg, &name, &value) != 0)
4481 lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
4484 new_value = lt_extend_str (getenv (name), value, 1);
4485 lt_setenv (name, new_value);
4492 lt_update_exe_path (const char *name, const char *value)
4494 LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4495 (name ? name : "<NULL>"),
4496 (value ? value : "<NULL>")));
4498 if (name && *name && value && *value)
4500 char *new_value = lt_extend_str (getenv (name), value, 0);
4501 /* some systems can't cope with a ':'-terminated path #' */
4502 int len = strlen (new_value);
4503 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4505 new_value[len-1] = '\0';
4507 lt_setenv (name, new_value);
4513 lt_update_lib_path (const char *name, const char *value)
4515 LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4516 (name ? name : "<NULL>"),
4517 (value ? value : "<NULL>")));
4519 if (name && *name && value && *value)
4521 char *new_value = lt_extend_str (getenv (name), value, 0);
4522 lt_setenv (name, new_value);
4530 # end: func_emit_cwrapperexe_src
4532 # func_mode_link arg...
4537 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4538 # It is impossible to link a dll without this setting, and
4539 # we shouldn't force the makefile maintainer to figure out
4540 # which system we are compiling for in order to pass an extra
4541 # flag for every libtool invocation.
4542 # allow_undefined=no
4544 # FIXME: Unfortunately, there are problems with the above when trying
4545 # to make a dll which has undefined symbols, in which case not
4546 # even a static library is built. For now, we need to specify
4547 # -no-undefined on the libtool link line when we can be certain
4548 # that all symbols are satisfied, otherwise we get a static library.
4555 libtool_args=$nonopt
4556 base_compile="$nonopt $@"
4557 compile_command=$nonopt
4558 finalize_command=$nonopt
4571 lib_search_path=`pwd`
4573 new_inherited_linker_flags=
4581 export_symbols_regex=
4589 precious_files_regex=
4590 prefer_static_libs=no
4603 single_module="${wl}-single_module"
4604 func_infer_tag $base_compile
4606 # We need to know -static, to get the right output filenames.
4611 test "$build_libtool_libs" != yes && \
4612 func_fatal_configuration "can not build a shared library"
4616 -all-static | -static | -static-libtool-libs)
4619 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4620 func_warning "complete static linking is impossible in this configuration"
4622 if test -n "$link_static_flag"; then
4623 dlopen_self=$dlopen_self_static
4625 prefer_static_libs=yes
4628 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4629 dlopen_self=$dlopen_self_static
4631 prefer_static_libs=built
4633 -static-libtool-libs)
4634 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4635 dlopen_self=$dlopen_self_static
4637 prefer_static_libs=yes
4640 build_libtool_libs=no
4647 # See if our shared archives depend on static archives.
4648 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4650 # Go through the arguments, transforming them on the way.
4651 while test "$#" -gt 0; do
4654 func_quote_for_eval "$arg"
4655 qarg=$func_quote_for_eval_unquoted_result
4656 func_append libtool_args " $func_quote_for_eval_result"
4658 # If the previous option needs an argument, assign it.
4659 if test -n "$prev"; then
4662 func_append compile_command " @OUTPUT@"
4663 func_append finalize_command " @OUTPUT@"
4669 if test "$preload" = no; then
4670 # Add the symbol object into the linking commands.
4671 func_append compile_command " @SYMFILE@"
4672 func_append finalize_command " @SYMFILE@"
4676 *.la | *.lo) ;; # We handle these cases below.
4678 if test "$dlself" = no; then
4686 if test "$prev" = dlprefiles; then
4688 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4698 if test "$prev" = dlfiles; then
4699 dlfiles="$dlfiles $arg"
4701 dlprefiles="$dlprefiles $arg"
4709 export_symbols="$arg"
4711 || func_fatal_error "symbol file \`$arg' does not exist"
4716 export_symbols_regex="$arg"
4724 *" $qarg.ltframework "*) ;;
4725 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4734 inst_prefix_dir="$arg"
4739 if test -f "$arg"; then
4742 for fil in `cat "$save_arg"`
4744 # moreargs="$moreargs $fil"
4746 # A libtool-controlled object.
4748 # Check to see that this really is a libtool object.
4749 if func_lalib_unsafe_p "$arg"; then
4756 if test -z "$pic_object" ||
4757 test -z "$non_pic_object" ||
4758 test "$pic_object" = none &&
4759 test "$non_pic_object" = none; then
4760 func_fatal_error "cannot find name of object for \`$arg'"
4763 # Extract subdirectory from the argument.
4764 func_dirname "$arg" "/" ""
4765 xdir="$func_dirname_result"
4767 if test "$pic_object" != none; then
4768 # Prepend the subdirectory the object is found in.
4769 pic_object="$xdir$pic_object"
4771 if test "$prev" = dlfiles; then
4772 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4773 dlfiles="$dlfiles $pic_object"
4777 # If libtool objects are unsupported, then we need to preload.
4782 # CHECK ME: I think I busted this. -Ossama
4783 if test "$prev" = dlprefiles; then
4784 # Preload the old-style object.
4785 dlprefiles="$dlprefiles $pic_object"
4790 func_append libobjs " $pic_object"
4795 if test "$non_pic_object" != none; then
4796 # Prepend the subdirectory the object is found in.
4797 non_pic_object="$xdir$non_pic_object"
4799 # A standard non-PIC object
4800 func_append non_pic_objects " $non_pic_object"
4801 if test -z "$pic_object" || test "$pic_object" = none ; then
4802 arg="$non_pic_object"
4805 # If the PIC object exists, use it instead.
4806 # $xdir was prepended to $pic_object above.
4807 non_pic_object="$pic_object"
4808 func_append non_pic_objects " $non_pic_object"
4811 # Only an error if not doing a dry-run.
4812 if $opt_dry_run; then
4813 # Extract subdirectory from the argument.
4814 func_dirname "$arg" "/" ""
4815 xdir="$func_dirname_result"
4818 pic_object=$xdir$objdir/$func_lo2o_result
4819 non_pic_object=$xdir$func_lo2o_result
4820 func_append libobjs " $pic_object"
4821 func_append non_pic_objects " $non_pic_object"
4823 func_fatal_error "\`$arg' is not a valid libtool object"
4828 func_fatal_error "link input file \`$arg' does not exist"
4835 precious_files_regex="$arg"
4845 # We need an absolute path.
4847 [\\/]* | [A-Za-z]:[\\/]*) ;;
4849 func_fatal_error "only absolute run-paths are allowed"
4852 if test "$prev" = rpath; then
4855 *) rpath="$rpath $arg" ;;
4860 *) xrpath="$xrpath $arg" ;;
4872 weak_libs="$weak_libs $arg"
4877 linker_flags="$linker_flags $qarg"
4878 compiler_flags="$compiler_flags $qarg"
4880 func_append compile_command " $qarg"
4881 func_append finalize_command " $qarg"
4885 compiler_flags="$compiler_flags $qarg"
4887 func_append compile_command " $qarg"
4888 func_append finalize_command " $qarg"
4892 linker_flags="$linker_flags $qarg"
4893 compiler_flags="$compiler_flags $wl$qarg"
4895 func_append compile_command " $wl$qarg"
4896 func_append finalize_command " $wl$qarg"
4900 eval "$prev=\"\$arg\""
4905 fi # test -n "$prev"
4911 if test -n "$link_static_flag"; then
4912 # See comment for -static flag below, for more details.
4913 func_append compile_command " $link_static_flag"
4914 func_append finalize_command " $link_static_flag"
4920 # FIXME: remove this flag sometime in the future.
4921 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
4944 -export-symbols | -export-symbols-regex)
4945 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
4946 func_fatal_error "more than one -exported-symbols argument is not allowed"
4948 if test "X$arg" = "X-export-symbols"; then
4966 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
4967 # so, if we see these flags be careful not to treat them like -L
4969 case $with_gcc/$host in
4970 no/*-*-irix* | /*-*-irix*)
4971 func_append compile_command " $arg"
4972 func_append finalize_command " $arg"
4979 func_stripname '-L' '' "$arg"
4980 dir=$func_stripname_result
4981 if test -z "$dir"; then
4982 if test "$#" -gt 0; then
4983 func_fatal_error "require no space between \`-L' and \`$1'"
4985 func_fatal_error "need path for \`-L' option"
4988 # We need an absolute path.
4990 [\\/]* | [A-Za-z]:[\\/]*) ;;
4992 absdir=`cd "$dir" && pwd`
4993 test -z "$absdir" && \
4994 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5001 deplibs="$deplibs -L$dir"
5002 lib_search_path="$lib_search_path $dir"
5006 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5007 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
5008 case :$dllsearchpath: in
5010 ::) dllsearchpath=$dir;;
5011 *) dllsearchpath="$dllsearchpath:$dir";;
5013 case :$dllsearchpath: in
5014 *":$testbindir:"*) ;;
5015 ::) dllsearchpath=$testbindir;;
5016 *) dllsearchpath="$dllsearchpath:$testbindir";;
5024 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5026 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
5027 # These systems don't actually have a C or math library (as such)
5031 # These systems don't actually have a C library (as such)
5032 test "X$arg" = "X-lc" && continue
5034 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5035 # Do not include libc due to us having libc/libc_r.
5036 test "X$arg" = "X-lc" && continue
5038 *-*-rhapsody* | *-*-darwin1.[012])
5039 # Rhapsody C and math libraries are in the System framework
5040 deplibs="$deplibs System.ltframework"
5043 *-*-sco3.2v5* | *-*-sco5v6*)
5044 # Causes problems with __ctype
5045 test "X$arg" = "X-lc" && continue
5047 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5048 # Compiler inserts libc in the correct place for threads to work
5049 test "X$arg" = "X-lc" && continue
5052 elif test "X$arg" = "X-lc_r"; then
5054 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5055 # Do not include libc_r directly, use -pthread flag.
5060 deplibs="$deplibs $arg"
5069 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5070 # classes, name mangling, and exception handling.
5071 # Darwin uses the -arch flag to determine output architecture.
5072 -model|-arch|-isysroot)
5073 compiler_flags="$compiler_flags $arg"
5074 func_append compile_command " $arg"
5075 func_append finalize_command " $arg"
5080 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5081 compiler_flags="$compiler_flags $arg"
5082 func_append compile_command " $arg"
5083 func_append finalize_command " $arg"
5084 case "$new_inherited_linker_flags " in
5086 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
5092 single_module="${wl}-multi_module"
5103 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5104 # The PATH hackery in wrapper scripts is required on Windows
5105 # and Darwin in order for the loader to find any dlls it needs.
5106 func_warning "\`-no-install' is ignored for $host"
5107 func_warning "assuming \`-no-fast-install' instead"
5110 *) no_install=yes ;;
5127 -precious-files-regex)
5148 func_stripname '-R' '' "$arg"
5149 dir=$func_stripname_result
5150 # We need an absolute path.
5152 [\\/]* | [A-Za-z]:[\\/]*) ;;
5154 func_fatal_error "only absolute run-paths are allowed"
5159 *) xrpath="$xrpath $dir" ;;
5165 # The effects of -shared are defined in a previous loop.
5174 -static | -static-libtool-libs)
5175 # The effects of -static are defined in a previous loop.
5176 # We used to do the same as -all-static on platforms that
5177 # didn't have a PIC flag, but the assumption that the effects
5178 # would be equivalent was wrong. It would break on at least
5179 # Digital Unix and AIX.
5205 func_stripname '-Wc,' '' "$arg"
5206 args=$func_stripname_result
5208 save_ifs="$IFS"; IFS=','
5209 for flag in $args; do
5211 func_quote_for_eval "$flag"
5212 arg="$arg $wl$func_quote_for_eval_result"
5213 compiler_flags="$compiler_flags $func_quote_for_eval_result"
5216 func_stripname ' ' '' "$arg"
5217 arg=$func_stripname_result
5221 func_stripname '-Wl,' '' "$arg"
5222 args=$func_stripname_result
5224 save_ifs="$IFS"; IFS=','
5225 for flag in $args; do
5227 func_quote_for_eval "$flag"
5228 arg="$arg $wl$func_quote_for_eval_result"
5229 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
5230 linker_flags="$linker_flags $func_quote_for_eval_result"
5233 func_stripname ' ' '' "$arg"
5234 arg=$func_stripname_result
5254 func_quote_for_eval "$arg"
5255 arg="$func_quote_for_eval_result"
5258 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
5259 # -r[0-9][0-9]* specifies the processor on the SGI compiler
5260 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
5261 # +DA*, +DD* enable 64-bit mode on the HP compiler
5262 # -q* pass through compiler args for the IBM compiler
5263 # -m*, -t[45]*, -txscale* pass through architecture-specific
5264 # compiler args for GCC
5265 # -F/path gives path to uninstalled frameworks, gcc on darwin
5266 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
5267 # @file GCC response files
5268 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5269 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
5270 func_quote_for_eval "$arg"
5271 arg="$func_quote_for_eval_result"
5272 func_append compile_command " $arg"
5273 func_append finalize_command " $arg"
5274 compiler_flags="$compiler_flags $arg"
5278 # Some other compiler flag.
5280 func_quote_for_eval "$arg"
5281 arg="$func_quote_for_eval_result"
5285 # A standard object.
5290 # A libtool-controlled object.
5292 # Check to see that this really is a libtool object.
5293 if func_lalib_unsafe_p "$arg"; then
5300 if test -z "$pic_object" ||
5301 test -z "$non_pic_object" ||
5302 test "$pic_object" = none &&
5303 test "$non_pic_object" = none; then
5304 func_fatal_error "cannot find name of object for \`$arg'"
5307 # Extract subdirectory from the argument.
5308 func_dirname "$arg" "/" ""
5309 xdir="$func_dirname_result"
5311 if test "$pic_object" != none; then
5312 # Prepend the subdirectory the object is found in.
5313 pic_object="$xdir$pic_object"
5315 if test "$prev" = dlfiles; then
5316 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5317 dlfiles="$dlfiles $pic_object"
5321 # If libtool objects are unsupported, then we need to preload.
5326 # CHECK ME: I think I busted this. -Ossama
5327 if test "$prev" = dlprefiles; then
5328 # Preload the old-style object.
5329 dlprefiles="$dlprefiles $pic_object"
5334 func_append libobjs " $pic_object"
5339 if test "$non_pic_object" != none; then
5340 # Prepend the subdirectory the object is found in.
5341 non_pic_object="$xdir$non_pic_object"
5343 # A standard non-PIC object
5344 func_append non_pic_objects " $non_pic_object"
5345 if test -z "$pic_object" || test "$pic_object" = none ; then
5346 arg="$non_pic_object"
5349 # If the PIC object exists, use it instead.
5350 # $xdir was prepended to $pic_object above.
5351 non_pic_object="$pic_object"
5352 func_append non_pic_objects " $non_pic_object"
5355 # Only an error if not doing a dry-run.
5356 if $opt_dry_run; then
5357 # Extract subdirectory from the argument.
5358 func_dirname "$arg" "/" ""
5359 xdir="$func_dirname_result"
5362 pic_object=$xdir$objdir/$func_lo2o_result
5363 non_pic_object=$xdir$func_lo2o_result
5364 func_append libobjs " $pic_object"
5365 func_append non_pic_objects " $non_pic_object"
5367 func_fatal_error "\`$arg' is not a valid libtool object"
5374 deplibs="$deplibs $arg"
5375 old_deplibs="$old_deplibs $arg"
5380 # A libtool-controlled library.
5382 if test "$prev" = dlfiles; then
5383 # This library was specified with -dlopen.
5384 dlfiles="$dlfiles $arg"
5386 elif test "$prev" = dlprefiles; then
5387 # The library was specified with -dlpreopen.
5388 dlprefiles="$dlprefiles $arg"
5391 deplibs="$deplibs $arg"
5396 # Some other compiler argument.
5398 # Unknown arguments in both finalize_command and compile_command need
5399 # to be aesthetically quoted because they are evaled later.
5400 func_quote_for_eval "$arg"
5401 arg="$func_quote_for_eval_result"
5405 # Now actually substitute the argument into the commands.
5406 if test -n "$arg"; then
5407 func_append compile_command " $arg"
5408 func_append finalize_command " $arg"
5410 done # argument parsing loop
5412 test -n "$prev" && \
5413 func_fatal_help "the \`$prevarg' option requires an argument"
5415 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5416 eval arg=\"$export_dynamic_flag_spec\"
5417 func_append compile_command " $arg"
5418 func_append finalize_command " $arg"
5422 # calculate the name of the file, without its directory
5423 func_basename "$output"
5424 outputname="$func_basename_result"
5425 libobjs_save="$libobjs"
5427 if test -n "$shlibpath_var"; then
5428 # get the directories listed in $shlibpath_var
5429 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
5433 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5434 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5436 func_dirname "$output" "/" ""
5437 output_objdir="$func_dirname_result$objdir"
5438 # Create the object directory.
5439 func_mkdir_p "$output_objdir"
5441 # Determine the type of output
5444 func_fatal_help "you must specify an output file"
5446 *.$libext) linkmode=oldlib ;;
5447 *.lo | *.$objext) linkmode=obj ;;
5448 *.la) linkmode=lib ;;
5449 *) linkmode=prog ;; # Anything else should be a program.
5455 # Find all interdependent deplibs by searching for libraries
5456 # that are linked more than once (e.g. -la -lb -la)
5457 for deplib in $deplibs; do
5458 if $opt_duplicate_deps ; then
5460 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5463 libs="$libs $deplib"
5466 if test "$linkmode" = lib; then
5467 libs="$predeps $libs $compiler_lib_search_path $postdeps"
5469 # Compute libraries that are listed more than once in $predeps
5470 # $postdeps and mark them as special (i.e., whose duplicates are
5471 # not to be eliminated).
5473 if $opt_duplicate_compiler_generated_deps; then
5474 for pre_post_dep in $predeps $postdeps; do
5475 case "$pre_post_deps " in
5476 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
5478 pre_post_deps="$pre_post_deps $pre_post_dep"
5487 need_relink=no # whether we're linking any uninstalled libtool libraries
5488 notinst_deplibs= # not-installed libtool libraries
5489 notinst_path= # paths that contain not-installed libtool libraries
5493 passes="conv dlpreopen link"
5494 for file in $dlfiles $dlprefiles; do
5498 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5509 passes="conv scan dlopen dlpreopen link"
5515 for pass in $passes; do
5516 # The preopen pass in lib mode reverses $deplibs; put it back here
5517 # so that -L comes before libs that need it for instance...
5518 if test "$linkmode,$pass" = "lib,link"; then
5519 ## FIXME: Find the place where the list is rebuilt in the wrong
5520 ## order, and fix it there properly
5522 for deplib in $deplibs; do
5523 tmp_deplibs="$deplib $tmp_deplibs"
5525 deplibs="$tmp_deplibs"
5528 if test "$linkmode,$pass" = "lib,link" ||
5529 test "$linkmode,$pass" = "prog,scan"; then
5533 if test "$linkmode" = prog; then
5535 dlopen) libs="$dlfiles" ;;
5536 dlpreopen) libs="$dlprefiles" ;;
5538 libs="$deplibs %DEPLIBS%"
5539 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
5543 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5544 # Collect and forward deplibs of preopened libtool libs
5545 for lib in $dlprefiles; do
5546 # Ignore non-libtool-libs
5549 *.la) func_source "$lib" ;;
5552 # Collect preopened libtool deplibs, except any this library
5553 # has declared as weak libs
5554 for deplib in $dependency_libs; do
5555 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
5556 case " $weak_libs " in
5557 *" $deplib_base "*) ;;
5558 *) deplibs="$deplibs $deplib" ;;
5564 if test "$pass" = dlopen; then
5565 # Collect dlpreopened libraries
5566 save_deplibs="$deplibs"
5570 for deplib in $libs; do
5574 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5575 if test "$linkmode,$pass" = "prog,link"; then
5576 compile_deplibs="$deplib $compile_deplibs"
5577 finalize_deplibs="$deplib $finalize_deplibs"
5579 compiler_flags="$compiler_flags $deplib"
5580 if test "$linkmode" = lib ; then
5581 case "$new_inherited_linker_flags " in
5583 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5590 if test "$linkmode" != lib && test "$linkmode" != prog; then
5591 func_warning "\`-l' is ignored for archives/objects"
5594 func_stripname '-l' '' "$deplib"
5595 name=$func_stripname_result
5596 if test "$linkmode" = lib; then
5597 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5599 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5601 for searchdir in $searchdirs; do
5602 for search_ext in .la $std_shrext .so .a; do
5603 # Search the libtool library
5604 lib="$searchdir/lib${name}${search_ext}"
5605 if test -f "$lib"; then
5606 if test "$search_ext" = ".la"; then
5615 if test "$found" != yes; then
5616 # deplib doesn't seem to be a libtool library
5617 if test "$linkmode,$pass" = "prog,link"; then
5618 compile_deplibs="$deplib $compile_deplibs"
5619 finalize_deplibs="$deplib $finalize_deplibs"
5621 deplibs="$deplib $deplibs"
5622 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5625 else # deplib is a libtool library
5626 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5627 # We need to do some special things here, and not later.
5628 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5629 case " $predeps $postdeps " in
5631 if func_lalib_p "$lib"; then
5635 for l in $old_library $library_names; do
5638 if test "X$ll" = "X$old_library" ; then # only static version available
5640 func_dirname "$lib" "" "."
5641 ladir="$func_dirname_result"
5642 lib=$ladir/$old_library
5643 if test "$linkmode,$pass" = "prog,link"; then
5644 compile_deplibs="$deplib $compile_deplibs"
5645 finalize_deplibs="$deplib $finalize_deplibs"
5647 deplibs="$deplib $deplibs"
5648 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5660 if test "$linkmode,$pass" = "prog,link"; then
5661 compile_deplibs="$deplib $compile_deplibs"
5662 finalize_deplibs="$deplib $finalize_deplibs"
5664 deplibs="$deplib $deplibs"
5665 if test "$linkmode" = lib ; then
5666 case "$new_inherited_linker_flags " in
5668 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5677 deplibs="$deplib $deplibs"
5678 test "$pass" = conv && continue
5679 newdependency_libs="$deplib $newdependency_libs"
5680 func_stripname '-L' '' "$deplib"
5681 newlib_search_path="$newlib_search_path $func_stripname_result"
5684 if test "$pass" = conv; then
5685 deplibs="$deplib $deplibs"
5688 if test "$pass" = scan; then
5689 deplibs="$deplib $deplibs"
5691 compile_deplibs="$deplib $compile_deplibs"
5692 finalize_deplibs="$deplib $finalize_deplibs"
5694 func_stripname '-L' '' "$deplib"
5695 newlib_search_path="$newlib_search_path $func_stripname_result"
5698 func_warning "\`-L' is ignored for archives/objects"
5704 if test "$pass" = link; then
5705 func_stripname '-R' '' "$deplib"
5706 dir=$func_stripname_result
5707 # Make sure the xrpath contains only unique directories.
5710 *) xrpath="$xrpath $dir" ;;
5713 deplibs="$deplib $deplibs"
5716 *.la) lib="$deplib" ;;
5718 if test "$pass" = conv; then
5719 deplibs="$deplib $deplibs"
5724 # Linking convenience modules into shared libraries is allowed,
5725 # but linking other static libraries is non-portable.
5726 case " $dlpreconveniencelibs " in
5730 case $deplibs_check_method in
5732 set dummy $deplibs_check_method; shift
5733 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5734 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
5735 | $EGREP "$match_pattern_regex" > /dev/null; then
5743 if test "$valid_a_lib" != yes; then
5745 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5746 $ECHO "*** I have the capability to make that library automatically link in when"
5747 $ECHO "*** you link to this library. But I can only do this if you have a"
5748 $ECHO "*** shared version of the library, which you do not appear to have"
5749 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
5750 $ECHO "*** that it is just a static archive that I should not use here."
5753 $ECHO "*** Warning: Linking the shared library $output against the"
5754 $ECHO "*** static library $deplib is not portable!"
5755 deplibs="$deplib $deplibs"
5762 if test "$pass" != link; then
5763 deplibs="$deplib $deplibs"
5765 compile_deplibs="$deplib $compile_deplibs"
5766 finalize_deplibs="$deplib $finalize_deplibs"
5773 if test "$pass" = conv; then
5774 deplibs="$deplib $deplibs"
5775 elif test "$linkmode" = prog; then
5776 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5777 # If there is no dlopen support or we're linking statically,
5778 # we need to preload.
5779 newdlprefiles="$newdlprefiles $deplib"
5780 compile_deplibs="$deplib $compile_deplibs"
5781 finalize_deplibs="$deplib $finalize_deplibs"
5783 newdlfiles="$newdlfiles $deplib"
5794 if test "$found" = yes || test -f "$lib"; then :
5796 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
5799 # Check to see that this really is a libtool archive.
5800 func_lalib_unsafe_p "$lib" \
5801 || func_fatal_error "\`$lib' is not a valid libtool archive"
5803 func_dirname "$lib" "" "."
5804 ladir="$func_dirname_result"
5812 inherited_linker_flags=
5813 # If the library was installed with an old release of libtool,
5814 # it will not redefine variables installed, or shouldnotlink
5823 # Convert "-framework foo" to "foo.ltframework"
5824 if test -n "$inherited_linker_flags"; then
5825 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
5826 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5827 case " $new_inherited_linker_flags " in
5828 *" $tmp_inherited_linker_flag "*) ;;
5829 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
5833 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5834 if test "$linkmode,$pass" = "lib,link" ||
5835 test "$linkmode,$pass" = "prog,scan" ||
5836 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
5837 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
5838 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
5841 if test "$pass" = conv; then
5842 # Only check for convenience libraries
5843 deplibs="$lib $deplibs"
5844 if test -z "$libdir"; then
5845 if test -z "$old_library"; then
5846 func_fatal_error "cannot find name of link library for \`$lib'"
5848 # It is a libtool convenience library, so add in its objects.
5849 convenience="$convenience $ladir/$objdir/$old_library"
5850 old_convenience="$old_convenience $ladir/$objdir/$old_library"
5852 for deplib in $dependency_libs; do
5853 deplibs="$deplib $deplibs"
5854 if $opt_duplicate_deps ; then
5855 case "$tmp_libs " in
5856 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5859 tmp_libs="$tmp_libs $deplib"
5861 elif test "$linkmode" != prog && test "$linkmode" != lib; then
5862 func_fatal_error "\`$lib' is not a convenience library"
5868 # Get the name of the library we link against.
5870 for l in $old_library $library_names; do
5873 if test -z "$linklib"; then
5874 func_fatal_error "cannot find name of link library for \`$lib'"
5877 # This library was specified with -dlopen.
5878 if test "$pass" = dlopen; then
5879 if test -z "$libdir"; then
5880 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
5882 if test -z "$dlname" ||
5883 test "$dlopen_support" != yes ||
5884 test "$build_libtool_libs" = no; then
5885 # If there is no dlname, no dlopen support or we're linking
5886 # statically, we need to preload. We also need to preload any
5887 # dependent libraries so libltdl's deplib preloader doesn't
5888 # bomb out in the load deplibs phase.
5889 dlprefiles="$dlprefiles $lib $dependency_libs"
5891 newdlfiles="$newdlfiles $lib"
5896 # We need an absolute path.
5898 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
5900 abs_ladir=`cd "$ladir" && pwd`
5901 if test -z "$abs_ladir"; then
5902 func_warning "cannot determine absolute directory name of \`$ladir'"
5903 func_warning "passing it literally to the linker, although it might fail"
5908 func_basename "$lib"
5909 laname="$func_basename_result"
5911 # Find the relevant object directory and library name.
5912 if test "X$installed" = Xyes; then
5913 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5914 func_warning "library \`$lib' was moved."
5922 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
5924 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5927 # Remove this search path later
5928 notinst_path="$notinst_path $abs_ladir"
5930 dir="$ladir/$objdir"
5931 absdir="$abs_ladir/$objdir"
5932 # Remove this search path later
5933 notinst_path="$notinst_path $abs_ladir"
5935 fi # $installed = yes
5936 func_stripname 'lib' '.la' "$laname"
5937 name=$func_stripname_result
5939 # This library was specified with -dlpreopen.
5940 if test "$pass" = dlpreopen; then
5941 if test -z "$libdir" && test "$linkmode" = prog; then
5942 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
5944 # Prefer using a static library (so that no silly _DYNAMIC symbols
5945 # are required to link).
5946 if test -n "$old_library"; then
5947 newdlprefiles="$newdlprefiles $dir/$old_library"
5948 # Keep a list of preopened convenience libraries to check
5949 # that they are being used correctly in the link pass.
5950 test -z "$libdir" && \
5951 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
5952 # Otherwise, use the dlname, so that lt_dlopen finds it.
5953 elif test -n "$dlname"; then
5954 newdlprefiles="$newdlprefiles $dir/$dlname"
5956 newdlprefiles="$newdlprefiles $dir/$linklib"
5958 fi # $pass = dlpreopen
5960 if test -z "$libdir"; then
5961 # Link the convenience library
5962 if test "$linkmode" = lib; then
5963 deplibs="$dir/$old_library $deplibs"
5964 elif test "$linkmode,$pass" = "prog,link"; then
5965 compile_deplibs="$dir/$old_library $compile_deplibs"
5966 finalize_deplibs="$dir/$old_library $finalize_deplibs"
5968 deplibs="$lib $deplibs" # used for prog,scan pass
5974 if test "$linkmode" = prog && test "$pass" != link; then
5975 newlib_search_path="$newlib_search_path $ladir"
5976 deplibs="$lib $deplibs"
5979 if test "$link_all_deplibs" != no || test -z "$library_names" ||
5980 test "$build_libtool_libs" = no; then
5985 for deplib in $dependency_libs; do
5987 -L*) func_stripname '-L' '' "$deplib"
5988 newlib_search_path="$newlib_search_path $func_stripname_result"
5991 # Need to link against all dependency_libs?
5992 if test "$linkalldeplibs" = yes; then
5993 deplibs="$deplib $deplibs"
5995 # Need to hardcode shared library paths
5996 # or/and link against static libraries
5997 newdependency_libs="$deplib $newdependency_libs"
5999 if $opt_duplicate_deps ; then
6000 case "$tmp_libs " in
6001 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6004 tmp_libs="$tmp_libs $deplib"
6007 fi # $linkmode = prog...
6009 if test "$linkmode,$pass" = "prog,link"; then
6010 if test -n "$library_names" &&
6011 { { test "$prefer_static_libs" = no ||
6012 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6013 test -z "$old_library"; }; then
6014 # We need to hardcode the library path
6015 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6016 # Make sure the rpath contains only unique directories.
6017 case "$temp_rpath:" in
6019 *) temp_rpath="$temp_rpath$absdir:" ;;
6023 # Hardcode the library path.
6024 # Skip directories that are in the system default run-time
6026 case " $sys_lib_dlsearch_path " in
6029 case "$compile_rpath " in
6031 *) compile_rpath="$compile_rpath $absdir"
6035 case " $sys_lib_dlsearch_path " in
6038 case "$finalize_rpath " in
6040 *) finalize_rpath="$finalize_rpath $libdir"
6044 fi # $linkmode,$pass = prog,link...
6046 if test "$alldeplibs" = yes &&
6047 { test "$deplibs_check_method" = pass_all ||
6048 { test "$build_libtool_libs" = yes &&
6049 test -n "$library_names"; }; }; then
6050 # We only need to search for static libraries
6055 link_static=no # Whether the deplib will be linked statically
6056 use_static_libs=$prefer_static_libs
6057 if test "$use_static_libs" = built && test "$installed" = yes; then
6060 if test -n "$library_names" &&
6061 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6063 *cygwin* | *mingw* | *cegcc*)
6064 # No point in relinking DLLs because paths are not encoded
6065 notinst_deplibs="$notinst_deplibs $lib"
6069 if test "$installed" = no; then
6070 notinst_deplibs="$notinst_deplibs $lib"
6075 # This is a shared library
6077 # Warn about portability, can't link against -module's on some
6078 # systems (darwin). Don't bleat about dlopened modules though!
6080 for dlpremoduletest in $dlprefiles; do
6081 if test "X$dlpremoduletest" = "X$lib"; then
6082 dlopenmodule="$dlpremoduletest"
6086 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6088 if test "$linkmode" = prog; then
6089 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6091 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6093 $ECHO "*** $linklib is not portable!"
6095 if test "$linkmode" = lib &&
6096 test "$hardcode_into_libs" = yes; then
6097 # Hardcode the library path.
6098 # Skip directories that are in the system default run-time
6100 case " $sys_lib_dlsearch_path " in
6103 case "$compile_rpath " in
6105 *) compile_rpath="$compile_rpath $absdir"
6109 case " $sys_lib_dlsearch_path " in
6112 case "$finalize_rpath " in
6114 *) finalize_rpath="$finalize_rpath $libdir"
6120 if test -n "$old_archive_from_expsyms_cmds"; then
6121 # figure out the soname
6122 set dummy $library_names
6126 libname=`eval "\\$ECHO \"$libname_spec\""`
6127 # use dlname if we got it. it's perfectly good, no?
6128 if test -n "$dlname"; then
6130 elif test -n "$soname_spec"; then
6133 *cygwin* | mingw* | *cegcc*)
6134 func_arith $current - $age
6135 major=$func_arith_result
6139 eval soname=\"$soname_spec\"
6144 # Make a new name for the extract_expsyms_cmds to use
6146 func_basename "$soroot"
6147 soname="$func_basename_result"
6148 func_stripname 'lib' '.dll' "$soname"
6149 newlib=libimp-$func_stripname_result.a
6151 # If the library has no export list, then create one now
6152 if test -f "$output_objdir/$soname-def"; then :
6154 func_verbose "extracting exported symbol list from \`$soname'"
6155 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6159 if test -f "$output_objdir/$newlib"; then :; else
6160 func_verbose "generating import library for \`$soname'"
6161 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6163 # make sure the library variables are pointing to the new library
6166 fi # test -n "$old_archive_from_expsyms_cmds"
6168 if test "$linkmode" = prog || test "$mode" != relink; then
6173 case $hardcode_action in
6174 immediate | unsupported)
6175 if test "$hardcode_direct" = no; then
6178 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6179 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6180 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6181 *-*-unixware7*) add_dir="-L$dir" ;;
6183 # if the lib is a (non-dlopened) module then we can not
6184 # link against it, someone is ignoring the earlier warnings
6185 if /usr/bin/file -L $add 2> /dev/null |
6186 $GREP ": [^:]* bundle" >/dev/null ; then
6187 if test "X$dlopenmodule" != "X$lib"; then
6188 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6189 if test -z "$old_library" ; then
6191 $ECHO "*** And there doesn't seem to be a static archive available"
6192 $ECHO "*** The link will probably fail, sorry"
6194 add="$dir/$old_library"
6196 elif test -n "$old_library"; then
6197 add="$dir/$old_library"
6201 elif test "$hardcode_minus_L" = no; then
6203 *-*-sunos*) add_shlibpath="$dir" ;;
6207 elif test "$hardcode_shlibpath_var" = no; then
6208 add_shlibpath="$dir"
6215 if test "$hardcode_direct" = yes &&
6216 test "$hardcode_direct_absolute" = no; then
6218 elif test "$hardcode_minus_L" = yes; then
6220 # Try looking first in the location we're being installed to.
6221 if test -n "$inst_prefix_dir"; then
6224 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6229 elif test "$hardcode_shlibpath_var" = yes; then
6230 add_shlibpath="$dir"
6239 if test "$lib_linked" != yes; then
6240 func_fatal_configuration "unsupported hardcode properties"
6243 if test -n "$add_shlibpath"; then
6244 case :$compile_shlibpath: in
6245 *":$add_shlibpath:"*) ;;
6246 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
6249 if test "$linkmode" = prog; then
6250 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6251 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6253 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6254 test -n "$add" && deplibs="$add $deplibs"
6255 if test "$hardcode_direct" != yes &&
6256 test "$hardcode_minus_L" != yes &&
6257 test "$hardcode_shlibpath_var" = yes; then
6258 case :$finalize_shlibpath: in
6260 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6266 if test "$linkmode" = prog || test "$mode" = relink; then
6270 # Finalize command for both is simple: just hardcode it.
6271 if test "$hardcode_direct" = yes &&
6272 test "$hardcode_direct_absolute" = no; then
6273 add="$libdir/$linklib"
6274 elif test "$hardcode_minus_L" = yes; then
6277 elif test "$hardcode_shlibpath_var" = yes; then
6278 case :$finalize_shlibpath: in
6280 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6283 elif test "$hardcode_automatic" = yes; then
6284 if test -n "$inst_prefix_dir" &&
6285 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6286 add="$inst_prefix_dir$libdir/$linklib"
6288 add="$libdir/$linklib"
6291 # We cannot seem to hardcode it, guess we'll fake it.
6293 # Try looking first in the location we're being installed to.
6294 if test -n "$inst_prefix_dir"; then
6297 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6304 if test "$linkmode" = prog; then
6305 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6306 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6308 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6309 test -n "$add" && deplibs="$add $deplibs"
6312 elif test "$linkmode" = prog; then
6313 # Here we assume that one of hardcode_direct or hardcode_minus_L
6314 # is not unsupported. This is valid on all known static and
6316 if test "$hardcode_direct" != unsupported; then
6317 test -n "$old_library" && linklib="$old_library"
6318 compile_deplibs="$dir/$linklib $compile_deplibs"
6319 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6321 compile_deplibs="-l$name -L$dir $compile_deplibs"
6322 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6324 elif test "$build_libtool_libs" = yes; then
6325 # Not a shared library
6326 if test "$deplibs_check_method" != pass_all; then
6327 # We're trying link a shared library against a static one
6328 # but the system doesn't support it.
6330 # Just print a warning and add the library to dependency_libs so
6331 # that the program can be linked against the static library.
6333 $ECHO "*** Warning: This system can not link to static lib archive $lib."
6334 $ECHO "*** I have the capability to make that library automatically link in when"
6335 $ECHO "*** you link to this library. But I can only do this if you have a"
6336 $ECHO "*** shared version of the library, which you do not appear to have."
6337 if test "$module" = yes; then
6338 $ECHO "*** But as you try to build a module library, libtool will still create "
6339 $ECHO "*** a static module, that should work as long as the dlopening application"
6340 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
6341 if test -z "$global_symbol_pipe"; then
6343 $ECHO "*** However, this would only work if libtool was able to extract symbol"
6344 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6345 $ECHO "*** not find such a program. So, this module is probably useless."
6346 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6348 if test "$build_old_libs" = no; then
6349 build_libtool_libs=module
6352 build_libtool_libs=no
6356 deplibs="$dir/$old_library $deplibs"
6359 fi # link shared/static library?
6361 if test "$linkmode" = lib; then
6362 if test -n "$dependency_libs" &&
6363 { test "$hardcode_into_libs" != yes ||
6364 test "$build_old_libs" = yes ||
6365 test "$link_static" = yes; }; then
6366 # Extract -R from dependency_libs
6368 for libdir in $dependency_libs; do
6370 -R*) func_stripname '-R' '' "$libdir"
6371 temp_xrpath=$func_stripname_result
6373 *" $temp_xrpath "*) ;;
6374 *) xrpath="$xrpath $temp_xrpath";;
6376 *) temp_deplibs="$temp_deplibs $libdir";;
6379 dependency_libs="$temp_deplibs"
6382 newlib_search_path="$newlib_search_path $absdir"
6383 # Link against this library
6384 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6385 # ... and its dependency_libs
6387 for deplib in $dependency_libs; do
6388 newdependency_libs="$deplib $newdependency_libs"
6389 if $opt_duplicate_deps ; then
6390 case "$tmp_libs " in
6391 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6394 tmp_libs="$tmp_libs $deplib"
6397 if test "$link_all_deplibs" != no; then
6398 # Add the search paths of all dependency libraries
6399 for deplib in $dependency_libs; do
6402 -L*) path="$deplib" ;;
6404 func_dirname "$deplib" "" "."
6405 dir="$func_dirname_result"
6406 # We need an absolute path.
6408 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
6410 absdir=`cd "$dir" && pwd`
6411 if test -z "$absdir"; then
6412 func_warning "cannot determine absolute directory name of \`$dir'"
6417 if $GREP "^installed=no" $deplib > /dev/null; then
6421 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
6422 if test -n "$deplibrary_names" ; then
6423 for tmp in $deplibrary_names ; do
6426 if test -f "$absdir/$objdir/$depdepl" ; then
6427 depdepl="$absdir/$objdir/$depdepl"
6428 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6429 if test -z "$darwin_install_name"; then
6430 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6432 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
6433 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
6439 path="-L$absdir/$objdir"
6443 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6444 test -z "$libdir" && \
6445 func_fatal_error "\`$deplib' is not a valid libtool archive"
6446 test "$absdir" != "$libdir" && \
6447 func_warning "\`$deplib' seems to be moved"
6453 case " $deplibs " in
6455 *) deplibs="$path $deplibs" ;;
6458 fi # link_all_deplibs != no
6460 done # for deplib in $libs
6461 if test "$pass" = link; then
6462 if test "$linkmode" = "prog"; then
6463 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
6464 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
6466 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6469 dependency_libs="$newdependency_libs"
6470 if test "$pass" = dlpreopen; then
6471 # Link the dlpreopened libraries before other libraries
6472 for deplib in $save_deplibs; do
6473 deplibs="$deplib $deplibs"
6476 if test "$pass" != dlopen; then
6477 if test "$pass" != conv; then
6478 # Make sure lib_search_path contains only unique directories.
6480 for dir in $newlib_search_path; do
6481 case "$lib_search_path " in
6483 *) lib_search_path="$lib_search_path $dir" ;;
6489 if test "$linkmode,$pass" != "prog,link"; then
6492 vars="compile_deplibs finalize_deplibs"
6494 for var in $vars dependency_libs; do
6495 # Add libraries to $var in reverse order
6496 eval tmp_libs=\"\$$var\"
6498 for deplib in $tmp_libs; do
6499 # FIXME: Pedantically, this is the right thing to do, so
6500 # that some nasty dependency loop isn't accidentally
6502 #new_libs="$deplib $new_libs"
6503 # Pragmatically, this seems to cause very few problems in
6506 -L*) new_libs="$deplib $new_libs" ;;
6509 # And here is the reason: when a library appears more
6510 # than once as an explicit dependence of a library, or
6511 # is implicitly linked in more than once by the
6512 # compiler, it is considered special, and multiple
6513 # occurrences thereof are not removed. Compare this
6514 # with having the same library being listed as a
6515 # dependency of multiple other libraries: in this case,
6516 # we know (pedantically, we assume) the library does not
6517 # need to be listed more than once, so we keep only the
6518 # last copy. This is not always right, but it is rare
6519 # enough that we require users that really mean to play
6520 # such unportable linking tricks to link the library
6521 # using -Wl,-lname, so that libtool does not consider it
6522 # for duplicate removal.
6523 case " $specialdeplibs " in
6524 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6526 case " $new_libs " in
6528 *) new_libs="$deplib $new_libs" ;;
6536 for deplib in $new_libs; do
6539 case " $tmp_libs " in
6541 *) tmp_libs="$tmp_libs $deplib" ;;
6544 *) tmp_libs="$tmp_libs $deplib" ;;
6547 eval $var=\"$tmp_libs\"
6550 # Last step: remove runtime libs from dependency_libs
6551 # (they stay in deplibs)
6553 for i in $dependency_libs ; do
6554 case " $predeps $postdeps $compiler_lib_search_path " in
6559 if test -n "$i" ; then
6560 tmp_libs="$tmp_libs $i"
6563 dependency_libs=$tmp_libs
6565 if test "$linkmode" = prog; then
6566 dlfiles="$newdlfiles"
6568 if test "$linkmode" = prog || test "$linkmode" = lib; then
6569 dlprefiles="$newdlprefiles"
6574 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6575 func_warning "\`-dlopen' is ignored for archives"
6580 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6583 test -n "$rpath" && \
6584 func_warning "\`-rpath' is ignored for archives"
6586 test -n "$xrpath" && \
6587 func_warning "\`-R' is ignored for archives"
6589 test -n "$vinfo" && \
6590 func_warning "\`-version-info/-version-number' is ignored for archives"
6592 test -n "$release" && \
6593 func_warning "\`-release' is ignored for archives"
6595 test -n "$export_symbols$export_symbols_regex" && \
6596 func_warning "\`-export-symbols' is ignored for archives"
6598 # Now set the variables for building old libraries.
6599 build_libtool_libs=no
6601 objs="$objs$old_deplibs"
6605 # Make sure we only generate libraries of the form `libNAME.la'.
6608 func_stripname 'lib' '.la' "$outputname"
6609 name=$func_stripname_result
6610 eval shared_ext=\"$shrext_cmds\"
6611 eval libname=\"$libname_spec\"
6614 test "$module" = no && \
6615 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6617 if test "$need_lib_prefix" != no; then
6618 # Add the "lib" prefix for modules if required
6619 func_stripname '' '.la' "$outputname"
6620 name=$func_stripname_result
6621 eval shared_ext=\"$shrext_cmds\"
6622 eval libname=\"$libname_spec\"
6624 func_stripname '' '.la' "$outputname"
6625 libname=$func_stripname_result
6630 if test -n "$objs"; then
6631 if test "$deplibs_check_method" != pass_all; then
6632 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6635 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6636 $ECHO "*** objects $objs is not portable!"
6637 libobjs="$libobjs $objs"
6641 test "$dlself" != no && \
6642 func_warning "\`-dlopen self' is ignored for libtool libraries"
6646 test "$#" -gt 1 && \
6647 func_warning "ignoring multiple \`-rpath's for a libtool library"
6652 if test -z "$rpath"; then
6653 if test "$build_libtool_libs" = yes; then
6654 # Building a libtool convenience library.
6655 # Some compilers have problems with a `.al' extension so
6656 # convenience libraries should have the same extension an
6657 # archive normally would.
6658 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6659 build_libtool_libs=convenience
6663 test -n "$vinfo" && \
6664 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6666 test -n "$release" && \
6667 func_warning "\`-release' is ignored for convenience libraries"
6670 # Parse the version information argument.
6671 save_ifs="$IFS"; IFS=':'
6672 set dummy $vinfo 0 0 0
6677 func_fatal_help "too many parameters to \`-version-info'"
6679 # convert absolute version numbers to libtool ages
6680 # this retains compatibility with .la files and attempts
6681 # to make the code below a bit more comprehensible
6683 case $vinfo_number in
6687 number_revision="$3"
6689 # There are really only two kinds -- those that
6690 # use the current revision as the major version
6691 # and those that subtract age and use age as
6692 # a minor version. But, then there is irix
6693 # which has an extra 1 added just for fun
6695 case $version_type in
6696 darwin|linux|osf|windows|none)
6697 func_arith $number_major + $number_minor
6698 current=$func_arith_result
6700 revision="$number_revision"
6702 freebsd-aout|freebsd-elf|sunos)
6703 current="$number_major"
6704 revision="$number_minor"
6708 func_arith $number_major + $number_minor
6709 current=$func_arith_result
6711 revision="$number_minor"
6712 lt_irix_increment=no
6715 func_fatal_configuration "$modename: unknown library version type \`$version_type'"
6726 # Check that each of the things are valid numbers.
6728 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]) ;;
6730 func_error "CURRENT \`$current' must be a nonnegative integer"
6731 func_fatal_error "\`$vinfo' is not valid version information"
6736 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]) ;;
6738 func_error "REVISION \`$revision' must be a nonnegative integer"
6739 func_fatal_error "\`$vinfo' is not valid version information"
6744 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]) ;;
6746 func_error "AGE \`$age' must be a nonnegative integer"
6747 func_fatal_error "\`$vinfo' is not valid version information"
6751 if test "$age" -gt "$current"; then
6752 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6753 func_fatal_error "\`$vinfo' is not valid version information"
6756 # Calculate the version variables.
6760 case $version_type in
6764 # Like Linux, but with the current version available in
6765 # verstring for coding it into the library header
6766 func_arith $current - $age
6767 major=.$func_arith_result
6768 versuffix="$major.$age.$revision"
6769 # Darwin ld doesn't like 0 for these options...
6770 func_arith $current + 1
6771 minor_current=$func_arith_result
6772 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6773 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6778 versuffix=".$current.$revision";
6783 versuffix=".$current"
6787 if test "X$lt_irix_increment" = "Xno"; then
6788 func_arith $current - $age
6790 func_arith $current - $age + 1
6792 major=$func_arith_result
6794 case $version_type in
6795 nonstopux) verstring_prefix=nonstopux ;;
6796 *) verstring_prefix=sgi ;;
6798 verstring="$verstring_prefix$major.$revision"
6800 # Add in all the interfaces that we are compatible with.
6802 while test "$loop" -ne 0; do
6803 func_arith $revision - $loop
6804 iface=$func_arith_result
6805 func_arith $loop - 1
6806 loop=$func_arith_result
6807 verstring="$verstring_prefix$major.$iface:$verstring"
6810 # Before this point, $major must not contain `.'.
6812 versuffix="$major.$revision"
6816 func_arith $current - $age
6817 major=.$func_arith_result
6818 versuffix="$major.$age.$revision"
6822 func_arith $current - $age
6823 major=.$func_arith_result
6824 versuffix=".$current.$age.$revision"
6825 verstring="$current.$age.$revision"
6827 # Add in all the interfaces that we are compatible with.
6829 while test "$loop" -ne 0; do
6830 func_arith $current - $loop
6831 iface=$func_arith_result
6832 func_arith $loop - 1
6833 loop=$func_arith_result
6834 verstring="$verstring:${iface}.0"
6837 # Make executables depend on our current version.
6838 verstring="$verstring:${current}.0"
6843 versuffix=".$current"
6848 versuffix=".$current.$revision"
6852 # Use '-' rather than '.', since we only want one
6853 # extension on DOS 8.3 filesystems.
6854 func_arith $current - $age
6855 major=$func_arith_result
6860 func_fatal_configuration "unknown library version type \`$version_type'"
6864 # Clear the version info if we defaulted, and they specified a release.
6865 if test -z "$vinfo" && test -n "$release"; then
6867 case $version_type in
6869 # we can't check for "0.0" in archive_cmds due to quoting
6870 # problems, so we reset it completely
6877 if test "$need_version" = no; then
6884 # Remove version info from name if versioning should be avoided
6885 if test "$avoid_version" = yes && test "$need_version" = no; then
6891 # Check to see if the archive will have undefined symbols.
6892 if test "$allow_undefined" = yes; then
6893 if test "$allow_undefined_flag" = unsupported; then
6894 func_warning "undefined symbols not allowed in $host shared libraries"
6895 build_libtool_libs=no
6899 # Don't allow undefined symbols.
6900 allow_undefined_flag="$no_undefined_flag"
6905 func_generate_dlsyms "$libname" "$libname" "yes"
6906 libobjs="$libobjs $symfileobj"
6907 test "X$libobjs" = "X " && libobjs=
6909 if test "$mode" != relink; then
6910 # Remove our outputs, but don't remove object files since they
6911 # may have been created when compiling PIC objects.
6913 tempremovelist=`$ECHO "$output_objdir/*"`
6914 for p in $tempremovelist; do
6918 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
6919 if test "X$precious_files_regex" != "X"; then
6920 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6925 removelist="$removelist $p"
6930 test -n "$removelist" && \
6931 func_show_eval "${RM}r \$removelist"
6934 # Now set the variables for building old libraries.
6935 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
6936 oldlibs="$oldlibs $output_objdir/$libname.$libext"
6938 # Transform .lo files to .o files.
6939 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
6942 # Eliminate all temporary directories.
6943 #for path in $notinst_path; do
6944 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
6945 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
6946 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
6949 if test -n "$xrpath"; then
6950 # If the user specified any rpath flags, then add them.
6952 for libdir in $xrpath; do
6953 temp_xrpath="$temp_xrpath -R$libdir"
6954 case "$finalize_rpath " in
6956 *) finalize_rpath="$finalize_rpath $libdir" ;;
6959 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
6960 dependency_libs="$temp_xrpath $dependency_libs"
6964 # Make sure dlfiles contains only unique files that won't be dlpreopened
6965 old_dlfiles="$dlfiles"
6967 for lib in $old_dlfiles; do
6968 case " $dlprefiles $dlfiles " in
6970 *) dlfiles="$dlfiles $lib" ;;
6974 # Make sure dlprefiles contains only unique files
6975 old_dlprefiles="$dlprefiles"
6977 for lib in $old_dlprefiles; do
6978 case "$dlprefiles " in
6980 *) dlprefiles="$dlprefiles $lib" ;;
6984 if test "$build_libtool_libs" = yes; then
6985 if test -n "$rpath"; then
6987 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
6988 # these systems don't actually have a c library (as such)!
6990 *-*-rhapsody* | *-*-darwin1.[012])
6991 # Rhapsody C library is in the System framework
6992 deplibs="$deplibs System.ltframework"
6995 # Don't link with libc until the a.out ld.so is fixed.
6997 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6998 # Do not include libc due to us having libc/libc_r.
7000 *-*-sco3.2v5* | *-*-sco5v6*)
7001 # Causes problems with __ctype
7003 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7004 # Compiler inserts libc in the correct place for threads to work
7007 # Add libc to deplibs on all other systems if necessary.
7008 if test "$build_libtool_need_lc" = "yes"; then
7009 deplibs="$deplibs -lc"
7015 # Transform deplibs into only deplibs that can be linked in shared.
7017 libname_save=$libname
7018 release_save=$release
7019 versuffix_save=$versuffix
7021 # I'm not sure if I'm treating the release correctly. I think
7022 # release should show up in the -l (ie -lgmp5) so we don't want to
7023 # add it in twice. Is that correct?
7029 case $deplibs_check_method in
7031 # Don't check for shared/static. Everything works.
7032 # This might be a little naive. We might want to check
7033 # whether the library exists or not. But this is on
7034 # osf3 & osf4 and I'm not really sure... Just
7035 # implementing what was already the behavior.
7039 # This code stresses the "libraries are programs" paradigm to its
7040 # limits. Maybe even breaks it. We compile a program, linking it
7041 # against the deplibs as a proxy for the library. Then we can check
7042 # whether they linked in statically or dynamically with ldd.
7043 $opt_dry_run || $RM conftest.c
7044 cat > conftest.c <<EOF
7045 int main() { return 0; }
7047 $opt_dry_run || $RM conftest
7048 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7049 ldd_output=`ldd conftest`
7050 for i in $deplibs; do
7053 func_stripname -l '' "$i"
7054 name=$func_stripname_result
7055 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7056 case " $predeps $postdeps " in
7058 newdeplibs="$newdeplibs $i"
7063 if test -n "$i" ; then
7064 libname=`eval "\\$ECHO \"$libname_spec\""`
7065 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7066 set dummy $deplib_matches; shift
7068 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7069 newdeplibs="$newdeplibs $i"
7073 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7074 $ECHO "*** I have the capability to make that library automatically link in when"
7075 $ECHO "*** you link to this library. But I can only do this if you have a"
7076 $ECHO "*** shared version of the library, which I believe you do not have"
7077 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
7078 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
7083 newdeplibs="$newdeplibs $i"
7088 # Error occurred in the first compile. Let's try to salvage
7089 # the situation: Compile a separate program for each library.
7090 for i in $deplibs; do
7093 func_stripname -l '' "$i"
7094 name=$func_stripname_result
7095 $opt_dry_run || $RM conftest
7096 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7097 ldd_output=`ldd conftest`
7098 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7099 case " $predeps $postdeps " in
7101 newdeplibs="$newdeplibs $i"
7106 if test -n "$i" ; then
7107 libname=`eval "\\$ECHO \"$libname_spec\""`
7108 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7109 set dummy $deplib_matches; shift
7111 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7112 newdeplibs="$newdeplibs $i"
7116 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7117 $ECHO "*** I have the capability to make that library automatically link in when"
7118 $ECHO "*** you link to this library. But I can only do this if you have a"
7119 $ECHO "*** shared version of the library, which you do not appear to have"
7120 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
7121 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
7127 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7128 $ECHO "*** make it link in! You will probably need to install it or some"
7129 $ECHO "*** library that it depends on before this library will be fully"
7130 $ECHO "*** functional. Installing it before continuing would be even better."
7134 newdeplibs="$newdeplibs $i"
7141 set dummy $deplibs_check_method; shift
7142 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7143 for a_deplib in $deplibs; do
7146 func_stripname -l '' "$a_deplib"
7147 name=$func_stripname_result
7148 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7149 case " $predeps $postdeps " in
7151 newdeplibs="$newdeplibs $a_deplib"
7156 if test -n "$a_deplib" ; then
7157 libname=`eval "\\$ECHO \"$libname_spec\""`
7158 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7159 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7160 for potent_lib in $potential_libs; do
7161 # Follow soft links.
7162 if ls -lLd "$potent_lib" 2>/dev/null |
7163 $GREP " -> " >/dev/null; then
7166 # The statement above tries to avoid entering an
7167 # endless loop below, in case of cyclic links.
7168 # We might still enter an endless loop, since a link
7169 # loop can be closed while we follow links,
7171 potlib="$potent_lib"
7172 while test -h "$potlib" 2>/dev/null; do
7173 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7175 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7176 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
7179 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7181 $EGREP "$file_magic_regex" > /dev/null; then
7182 newdeplibs="$newdeplibs $a_deplib"
7189 if test -n "$a_deplib" ; then
7192 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7193 $ECHO "*** I have the capability to make that library automatically link in when"
7194 $ECHO "*** you link to this library. But I can only do this if you have a"
7195 $ECHO "*** shared version of the library, which you do not appear to have"
7196 $ECHO "*** because I did check the linker path looking for a file starting"
7197 if test -z "$potlib" ; then
7198 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7200 $ECHO "*** with $libname and none of the candidates passed a file format test"
7201 $ECHO "*** using a file magic. Last file checked: $potlib"
7206 # Add a -L argument.
7207 newdeplibs="$newdeplibs $a_deplib"
7210 done # Gone through all deplibs.
7213 set dummy $deplibs_check_method; shift
7214 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7215 for a_deplib in $deplibs; do
7218 func_stripname -l '' "$a_deplib"
7219 name=$func_stripname_result
7220 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7221 case " $predeps $postdeps " in
7223 newdeplibs="$newdeplibs $a_deplib"
7228 if test -n "$a_deplib" ; then
7229 libname=`eval "\\$ECHO \"$libname_spec\""`
7230 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7231 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7232 for potent_lib in $potential_libs; do
7233 potlib="$potent_lib" # see symlink-check above in file_magic test
7234 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
7235 $EGREP "$match_pattern_regex" > /dev/null; then
7236 newdeplibs="$newdeplibs $a_deplib"
7243 if test -n "$a_deplib" ; then
7246 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7247 $ECHO "*** I have the capability to make that library automatically link in when"
7248 $ECHO "*** you link to this library. But I can only do this if you have a"
7249 $ECHO "*** shared version of the library, which you do not appear to have"
7250 $ECHO "*** because I did check the linker path looking for a file starting"
7251 if test -z "$potlib" ; then
7252 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7254 $ECHO "*** with $libname and none of the candidates passed a file format test"
7255 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7260 # Add a -L argument.
7261 newdeplibs="$newdeplibs $a_deplib"
7264 done # Gone through all deplibs.
7268 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
7269 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
7270 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7271 for i in $predeps $postdeps ; do
7272 # can't use Xsed below, because $i might contain '/'
7273 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
7276 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
7277 $GREP . >/dev/null; then
7279 if test "X$deplibs_check_method" = "Xnone"; then
7280 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
7282 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
7284 $ECHO "*** All declared inter-library dependencies are being dropped."
7289 versuffix=$versuffix_save
7291 release=$release_save
7292 libname=$libname_save
7296 *-*-rhapsody* | *-*-darwin1.[012])
7297 # On Rhapsody replace the C library with the System framework
7298 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7302 if test "$droppeddeps" = yes; then
7303 if test "$module" = yes; then
7305 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
7306 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7307 $ECHO "*** a static module, that should work as long as the dlopening"
7308 $ECHO "*** application is linked with the -dlopen flag."
7309 if test -z "$global_symbol_pipe"; then
7311 $ECHO "*** However, this would only work if libtool was able to extract symbol"
7312 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
7313 $ECHO "*** not find such a program. So, this module is probably useless."
7314 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
7316 if test "$build_old_libs" = no; then
7317 oldlibs="$output_objdir/$libname.$libext"
7318 build_libtool_libs=module
7321 build_libtool_libs=no
7324 $ECHO "*** The inter-library dependencies that have been dropped here will be"
7325 $ECHO "*** automatically added whenever a program is linked with this library"
7326 $ECHO "*** or is declared to -dlopen it."
7328 if test "$allow_undefined" = no; then
7330 $ECHO "*** Since this library must not contain undefined symbols,"
7331 $ECHO "*** because either the platform does not support them or"
7332 $ECHO "*** it was explicitly requested with -no-undefined,"
7333 $ECHO "*** libtool will only create a static version of it."
7334 if test "$build_old_libs" = no; then
7335 oldlibs="$output_objdir/$libname.$libext"
7336 build_libtool_libs=module
7339 build_libtool_libs=no
7344 # Done checking deplibs!
7347 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7350 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7351 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7352 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7356 # move library search paths that coincide with paths to not yet
7357 # installed libraries to the beginning of the library search list
7359 for path in $notinst_path; do
7360 case " $new_libs " in
7361 *" -L$path/$objdir "*) ;;
7363 case " $deplibs " in
7364 *" -L$path/$objdir "*)
7365 new_libs="$new_libs -L$path/$objdir" ;;
7370 for deplib in $deplibs; do
7373 case " $new_libs " in
7375 *) new_libs="$new_libs $deplib" ;;
7378 *) new_libs="$new_libs $deplib" ;;
7383 # All the library-specific variables (install_libdir is set above).
7388 # Test again, we may have decided not to build it any more
7389 if test "$build_libtool_libs" = yes; then
7390 if test "$hardcode_into_libs" = yes; then
7391 # Hardcode the library paths
7394 rpath="$finalize_rpath"
7395 test "$mode" != relink && rpath="$compile_rpath$rpath"
7396 for libdir in $rpath; do
7397 if test -n "$hardcode_libdir_flag_spec"; then
7398 if test -n "$hardcode_libdir_separator"; then
7399 if test -z "$hardcode_libdirs"; then
7400 hardcode_libdirs="$libdir"
7402 # Just accumulate the unique libdirs.
7403 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7404 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7407 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7412 eval flag=\"$hardcode_libdir_flag_spec\"
7413 dep_rpath="$dep_rpath $flag"
7415 elif test -n "$runpath_var"; then
7416 case "$perm_rpath " in
7418 *) perm_rpath="$perm_rpath $libdir" ;;
7422 # Substitute the hardcoded libdirs into the rpath.
7423 if test -n "$hardcode_libdir_separator" &&
7424 test -n "$hardcode_libdirs"; then
7425 libdir="$hardcode_libdirs"
7426 if test -n "$hardcode_libdir_flag_spec_ld"; then
7427 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
7429 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
7432 if test -n "$runpath_var" && test -n "$perm_rpath"; then
7433 # We should set the runpath_var.
7435 for dir in $perm_rpath; do
7438 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
7440 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
7443 shlibpath="$finalize_shlibpath"
7444 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
7445 if test -n "$shlibpath"; then
7446 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
7449 # Get the real and link names of the library.
7450 eval shared_ext=\"$shrext_cmds\"
7451 eval library_names=\"$library_names_spec\"
7452 set dummy $library_names
7457 if test -n "$soname_spec"; then
7458 eval soname=\"$soname_spec\"
7462 if test -z "$dlname"; then
7466 lib="$output_objdir/$realname"
7470 linknames="$linknames $link"
7473 # Use standard objects if they are pic
7474 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7475 test "X$libobjs" = "X " && libobjs=
7478 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7479 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
7480 export_symbols="$output_objdir/$libname.uexp"
7481 delfiles="$delfiles $export_symbols"
7484 orig_export_symbols=
7486 cygwin* | mingw* | cegcc*)
7487 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
7488 # exporting using user supplied symfile
7489 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
7490 # and it's NOT already a .def file. Must figure out
7491 # which of the given symbols are data symbols and tag
7492 # them as such. So, trigger use of export_symbols_cmds.
7493 # export_symbols gets reassigned inside the "prepare
7494 # the list of exported symbols" if statement, so the
7495 # include_expsyms logic still works.
7496 orig_export_symbols="$export_symbols"
7498 always_export_symbols=yes
7504 # Prepare the list of exported symbols
7505 if test -z "$export_symbols"; then
7506 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7507 func_verbose "generating symbol list for \`$libname.la'"
7508 export_symbols="$output_objdir/$libname.exp"
7509 $opt_dry_run || $RM $export_symbols
7510 cmds=$export_symbols_cmds
7511 save_ifs="$IFS"; IFS='~'
7512 for cmd in $cmds; do
7516 len=$func_len_result
7517 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7518 func_show_eval "$cmd" 'exit $?'
7519 skipped_export=false
7521 # The command line is too long to execute in one step.
7522 func_verbose "using reloadable object file for export list..."
7524 # Break out early, otherwise skipped_export may be
7525 # set to false by a later but shorter cmd.
7530 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7531 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7532 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7537 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7538 tmp_export_symbols="$export_symbols"
7539 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7540 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7543 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7544 # The given exports_symbols file has to be filtered, so filter it.
7545 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7546 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7547 # 's' commands which not all seds can handle. GNU sed should be fine
7548 # though. Also, the filter scales superlinearly with the number of
7549 # global variables. join(1) would be nice here, but unfortunately
7550 # isn't a blessed tool.
7551 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7552 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7553 export_symbols=$output_objdir/$libname.def
7554 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7558 for test_deplib in $deplibs; do
7559 case " $convenience " in
7560 *" $test_deplib "*) ;;
7562 tmp_deplibs="$tmp_deplibs $test_deplib"
7566 deplibs="$tmp_deplibs"
7568 if test -n "$convenience"; then
7569 if test -n "$whole_archive_flag_spec" &&
7570 test "$compiler_needs_object" = yes &&
7571 test -z "$libobjs"; then
7572 # extract the archives, so we have objects to list.
7573 # TODO: could optimize this to just extract one archive.
7574 whole_archive_flag_spec=
7576 if test -n "$whole_archive_flag_spec"; then
7577 save_libobjs=$libobjs
7578 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7579 test "X$libobjs" = "X " && libobjs=
7581 gentop="$output_objdir/${outputname}x"
7582 generated="$generated $gentop"
7584 func_extract_archives $gentop $convenience
7585 libobjs="$libobjs $func_extract_archives_result"
7586 test "X$libobjs" = "X " && libobjs=
7590 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7591 eval flag=\"$thread_safe_flag_spec\"
7592 linker_flags="$linker_flags $flag"
7595 # Make a backup of the uninstalled library when relinking
7596 if test "$mode" = relink; then
7597 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7600 # Do each of the archive commands.
7601 if test "$module" = yes && test -n "$module_cmds" ; then
7602 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7603 eval test_cmds=\"$module_expsym_cmds\"
7604 cmds=$module_expsym_cmds
7606 eval test_cmds=\"$module_cmds\"
7610 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7611 eval test_cmds=\"$archive_expsym_cmds\"
7612 cmds=$archive_expsym_cmds
7614 eval test_cmds=\"$archive_cmds\"
7619 if test "X$skipped_export" != "X:" &&
7620 func_len " $test_cmds" &&
7621 len=$func_len_result &&
7622 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7625 # The command line is too long to link in one step, link piecewise
7626 # or, if using GNU ld and skipped_export is not :, use a linker
7629 # Save the value of $output and $libobjs because we want to
7630 # use them later. If we have whole_archive_flag_spec, we
7631 # want to use save_libobjs as it was before
7632 # whole_archive_flag_spec was expanded, because we can't
7633 # assume the linker understands whole_archive_flag_spec.
7634 # This may have to be revisited, in case too many
7635 # convenience libraries get linked in and end up exceeding
7637 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7638 save_libobjs=$libobjs
7641 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
7643 # Clear the reloadable object creation command queue and
7644 # initialize k to one.
7651 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7652 output=${output_objdir}/${output_la}.lnkscript
7653 func_verbose "creating GNU ld script: $output"
7654 $ECHO 'INPUT (' > $output
7655 for obj in $save_libobjs
7657 $ECHO "$obj" >> $output
7659 $ECHO ')' >> $output
7660 delfiles="$delfiles $output"
7661 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7662 output=${output_objdir}/${output_la}.lnk
7663 func_verbose "creating linker input file list: $output"
7668 if test "$compiler_needs_object" = yes; then
7674 $ECHO "$obj" >> $output
7676 delfiles="$delfiles $output"
7677 output=$firstobj\"$file_list_spec$output\"
7679 if test -n "$save_libobjs"; then
7680 func_verbose "creating reloadable object files..."
7681 output=$output_objdir/$output_la-${k}.$objext
7682 eval test_cmds=\"$reload_cmds\"
7683 func_len " $test_cmds"
7684 len0=$func_len_result
7687 # Loop over the list of objects to be linked.
7688 for obj in $save_libobjs
7691 func_arith $len + $func_len_result
7692 len=$func_arith_result
7693 if test "X$objlist" = X ||
7694 test "$len" -lt "$max_cmd_len"; then
7695 func_append objlist " $obj"
7697 # The command $test_cmds is almost too long, add a
7698 # command to the queue.
7699 if test "$k" -eq 1 ; then
7700 # The first file doesn't have a previous command to add.
7701 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
7703 # All subsequent reloadable object files will link in
7704 # the last one created.
7705 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
7707 last_robj=$output_objdir/$output_la-${k}.$objext
7709 k=$func_arith_result
7710 output=$output_objdir/$output_la-${k}.$objext
7712 func_len " $last_robj"
7713 func_arith $len0 + $func_len_result
7714 len=$func_arith_result
7717 # Handle the remaining objects by creating one last
7718 # reloadable object file. All subsequent reloadable object
7719 # files will link in the last one created.
7720 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7721 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
7722 if test -n "$last_robj"; then
7723 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7725 delfiles="$delfiles $output"
7731 if ${skipped_export-false}; then
7732 func_verbose "generating symbol list for \`$libname.la'"
7733 export_symbols="$output_objdir/$libname.exp"
7734 $opt_dry_run || $RM $export_symbols
7736 # Append the command to create the export file.
7737 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7738 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7739 if test -n "$last_robj"; then
7740 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7744 test -n "$save_libobjs" &&
7745 func_verbose "creating a temporary reloadable object file: $output"
7747 # Loop through the commands generated above and execute them.
7748 save_ifs="$IFS"; IFS='~'
7749 for cmd in $concat_cmds; do
7752 func_quote_for_expand "$cmd"
7753 eval "func_echo $func_quote_for_expand_result"
7755 $opt_dry_run || eval "$cmd" || {
7758 # Restore the uninstalled library and exit
7759 if test "$mode" = relink; then
7760 ( cd "$output_objdir" && \
7761 $RM "${realname}T" && \
7762 $MV "${realname}U" "$realname" )
7770 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7771 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7772 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7776 if ${skipped_export-false}; then
7777 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7778 tmp_export_symbols="$export_symbols"
7779 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7780 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7783 if test -n "$orig_export_symbols"; then
7784 # The given exports_symbols file has to be filtered, so filter it.
7785 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7786 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7787 # 's' commands which not all seds can handle. GNU sed should be fine
7788 # though. Also, the filter scales superlinearly with the number of
7789 # global variables. join(1) would be nice here, but unfortunately
7790 # isn't a blessed tool.
7791 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7792 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7793 export_symbols=$output_objdir/$libname.def
7794 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7799 # Restore the value of output.
7802 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
7803 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7804 test "X$libobjs" = "X " && libobjs=
7806 # Expand the library linking commands again to reset the
7807 # value of $libobjs for piecewise linking.
7809 # Do each of the archive commands.
7810 if test "$module" = yes && test -n "$module_cmds" ; then
7811 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7812 cmds=$module_expsym_cmds
7817 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7818 cmds=$archive_expsym_cmds
7825 if test -n "$delfiles"; then
7826 # Append the command to remove temporary files to $cmds.
7827 eval cmds=\"\$cmds~\$RM $delfiles\"
7830 # Add any objects from preloaded convenience libraries
7831 if test -n "$dlprefiles"; then
7832 gentop="$output_objdir/${outputname}x"
7833 generated="$generated $gentop"
7835 func_extract_archives $gentop $dlprefiles
7836 libobjs="$libobjs $func_extract_archives_result"
7837 test "X$libobjs" = "X " && libobjs=
7840 save_ifs="$IFS"; IFS='~'
7841 for cmd in $cmds; do
7845 func_quote_for_expand "$cmd"
7846 eval "func_echo $func_quote_for_expand_result"
7848 $opt_dry_run || eval "$cmd" || {
7851 # Restore the uninstalled library and exit
7852 if test "$mode" = relink; then
7853 ( cd "$output_objdir" && \
7854 $RM "${realname}T" && \
7855 $MV "${realname}U" "$realname" )
7863 # Restore the uninstalled library and exit
7864 if test "$mode" = relink; then
7865 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
7867 if test -n "$convenience"; then
7868 if test -z "$whole_archive_flag_spec"; then
7869 func_show_eval '${RM}r "$gentop"'
7876 # Create links to the real library.
7877 for linkname in $linknames; do
7878 if test "$realname" != "$linkname"; then
7879 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
7883 # If -module or -export-dynamic was specified, set the dlname.
7884 if test "$module" = yes || test "$export_dynamic" = yes; then
7885 # On all known operating systems, these are identical.
7892 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7893 func_warning "\`-dlopen' is ignored for objects"
7898 func_warning "\`-l' and \`-L' are ignored for objects" ;;
7901 test -n "$rpath" && \
7902 func_warning "\`-rpath' is ignored for objects"
7904 test -n "$xrpath" && \
7905 func_warning "\`-R' is ignored for objects"
7907 test -n "$vinfo" && \
7908 func_warning "\`-version-info' is ignored for objects"
7910 test -n "$release" && \
7911 func_warning "\`-release' is ignored for objects"
7915 test -n "$objs$old_deplibs" && \
7916 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
7920 obj=$func_lo2o_result
7928 # Delete the old objects.
7929 $opt_dry_run || $RM $obj $libobj
7931 # Objects from convenience libraries. This assumes
7932 # single-version convenience libraries. Whenever we create
7933 # different ones for PIC/non-PIC, this we'll have to duplicate
7937 # reload_cmds runs $LD directly, so let us get rid of
7938 # -Wl from whole_archive_flag_spec and hope we can get by with
7939 # turning comma into space..
7942 if test -n "$convenience"; then
7943 if test -n "$whole_archive_flag_spec"; then
7944 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
7945 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
7947 gentop="$output_objdir/${obj}x"
7948 generated="$generated $gentop"
7950 func_extract_archives $gentop $convenience
7951 reload_conv_objs="$reload_objs $func_extract_archives_result"
7955 # Create the old-style object.
7956 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
7959 func_execute_cmds "$reload_cmds" 'exit $?'
7961 # Exit if we aren't doing a library object file.
7962 if test -z "$libobj"; then
7963 if test -n "$gentop"; then
7964 func_show_eval '${RM}r "$gentop"'
7970 if test "$build_libtool_libs" != yes; then
7971 if test -n "$gentop"; then
7972 func_show_eval '${RM}r "$gentop"'
7975 # Create an invalid libtool object if no PIC, so that we don't
7976 # accidentally link it into a program.
7977 # $show "echo timestamp > $libobj"
7978 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
7982 if test -n "$pic_flag" || test "$pic_mode" != default; then
7983 # Only do commands if we really have different PIC objects.
7984 reload_objs="$libobjs $reload_conv_objs"
7986 func_execute_cmds "$reload_cmds" 'exit $?'
7989 if test -n "$gentop"; then
7990 func_show_eval '${RM}r "$gentop"'
7998 *cygwin*) func_stripname '' '.exe' "$output"
7999 output=$func_stripname_result.exe;;
8001 test -n "$vinfo" && \
8002 func_warning "\`-version-info' is ignored for programs"
8004 test -n "$release" && \
8005 func_warning "\`-release' is ignored for programs"
8007 test "$preload" = yes \
8008 && test "$dlopen_support" = unknown \
8009 && test "$dlopen_self" = unknown \
8010 && test "$dlopen_self_static" = unknown && \
8011 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8014 *-*-rhapsody* | *-*-darwin1.[012])
8015 # On Rhapsody replace the C library is the System framework
8016 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
8017 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
8023 # Don't allow lazy linking, it breaks C++ global constructors
8024 # But is supposedly fixed on 10.4 or later (yay!).
8025 if test "$tagname" = CXX ; then
8026 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8028 compile_command="$compile_command ${wl}-bind_at_load"
8029 finalize_command="$finalize_command ${wl}-bind_at_load"
8033 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8034 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
8035 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
8040 # move library search paths that coincide with paths to not yet
8041 # installed libraries to the beginning of the library search list
8043 for path in $notinst_path; do
8044 case " $new_libs " in
8045 *" -L$path/$objdir "*) ;;
8047 case " $compile_deplibs " in
8048 *" -L$path/$objdir "*)
8049 new_libs="$new_libs -L$path/$objdir" ;;
8054 for deplib in $compile_deplibs; do
8057 case " $new_libs " in
8059 *) new_libs="$new_libs $deplib" ;;
8062 *) new_libs="$new_libs $deplib" ;;
8065 compile_deplibs="$new_libs"
8068 compile_command="$compile_command $compile_deplibs"
8069 finalize_command="$finalize_command $finalize_deplibs"
8071 if test -n "$rpath$xrpath"; then
8072 # If the user specified any rpath flags, then add them.
8073 for libdir in $rpath $xrpath; do
8074 # This is the magic to use -rpath.
8075 case "$finalize_rpath " in
8077 *) finalize_rpath="$finalize_rpath $libdir" ;;
8082 # Now hardcode the library paths
8085 for libdir in $compile_rpath $finalize_rpath; do
8086 if test -n "$hardcode_libdir_flag_spec"; then
8087 if test -n "$hardcode_libdir_separator"; then
8088 if test -z "$hardcode_libdirs"; then
8089 hardcode_libdirs="$libdir"
8091 # Just accumulate the unique libdirs.
8092 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8093 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8096 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8101 eval flag=\"$hardcode_libdir_flag_spec\"
8102 rpath="$rpath $flag"
8104 elif test -n "$runpath_var"; then
8105 case "$perm_rpath " in
8107 *) perm_rpath="$perm_rpath $libdir" ;;
8111 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8112 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8113 case :$dllsearchpath: in
8115 ::) dllsearchpath=$libdir;;
8116 *) dllsearchpath="$dllsearchpath:$libdir";;
8118 case :$dllsearchpath: in
8119 *":$testbindir:"*) ;;
8120 ::) dllsearchpath=$testbindir;;
8121 *) dllsearchpath="$dllsearchpath:$testbindir";;
8126 # Substitute the hardcoded libdirs into the rpath.
8127 if test -n "$hardcode_libdir_separator" &&
8128 test -n "$hardcode_libdirs"; then
8129 libdir="$hardcode_libdirs"
8130 eval rpath=\" $hardcode_libdir_flag_spec\"
8132 compile_rpath="$rpath"
8136 for libdir in $finalize_rpath; do
8137 if test -n "$hardcode_libdir_flag_spec"; then
8138 if test -n "$hardcode_libdir_separator"; then
8139 if test -z "$hardcode_libdirs"; then
8140 hardcode_libdirs="$libdir"
8142 # Just accumulate the unique libdirs.
8143 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8144 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8147 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8152 eval flag=\"$hardcode_libdir_flag_spec\"
8153 rpath="$rpath $flag"
8155 elif test -n "$runpath_var"; then
8156 case "$finalize_perm_rpath " in
8158 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
8162 # Substitute the hardcoded libdirs into the rpath.
8163 if test -n "$hardcode_libdir_separator" &&
8164 test -n "$hardcode_libdirs"; then
8165 libdir="$hardcode_libdirs"
8166 eval rpath=\" $hardcode_libdir_flag_spec\"
8168 finalize_rpath="$rpath"
8170 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8171 # Transform all the library objects into standard objects.
8172 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
8173 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
8176 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8178 # template prelinking step
8179 if test -n "$prelink_cmds"; then
8180 func_execute_cmds "$prelink_cmds" 'exit $?'
8183 wrappers_required=yes
8185 *cygwin* | *mingw* )
8186 if test "$build_libtool_libs" != yes; then
8187 wrappers_required=no
8191 # Disable wrappers for cegcc, we are cross compiling anyway.
8192 wrappers_required=no
8195 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8196 wrappers_required=no
8200 if test "$wrappers_required" = no; then
8201 # Replace the output file specification.
8202 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
8203 link_command="$compile_command$compile_rpath"
8205 # We have no uninstalled library dependencies, so finalize right now.
8207 func_show_eval "$link_command" 'exit_status=$?'
8209 # Delete the generated files.
8210 if test -f "$output_objdir/${outputname}S.${objext}"; then
8211 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8217 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8218 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8220 if test -n "$finalize_shlibpath"; then
8221 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8226 if test -n "$runpath_var"; then
8227 if test -n "$perm_rpath"; then
8228 # We should set the runpath_var.
8230 for dir in $perm_rpath; do
8233 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8235 if test -n "$finalize_perm_rpath"; then
8236 # We should set the runpath_var.
8238 for dir in $finalize_perm_rpath; do
8241 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8245 if test "$no_install" = yes; then
8246 # We don't need to create a wrapper script.
8247 link_command="$compile_var$compile_command$compile_rpath"
8248 # Replace the output file specification.
8249 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
8250 # Delete the old output file.
8251 $opt_dry_run || $RM $output
8252 # Link the executable and exit
8253 func_show_eval "$link_command" 'exit $?'
8257 if test "$hardcode_action" = relink; then
8258 # Fast installation is not supported
8259 link_command="$compile_var$compile_command$compile_rpath"
8260 relink_command="$finalize_var$finalize_command$finalize_rpath"
8262 func_warning "this platform does not like uninstalled shared libraries"
8263 func_warning "\`$output' will be relinked during installation"
8265 if test "$fast_install" != no; then
8266 link_command="$finalize_var$compile_command$finalize_rpath"
8267 if test "$fast_install" = yes; then
8268 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
8270 # fast_install is set to needless
8274 link_command="$compile_var$compile_command$compile_rpath"
8275 relink_command="$finalize_var$finalize_command$finalize_rpath"
8279 # Replace the output file specification.
8280 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8282 # Delete the old output files.
8283 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8285 func_show_eval "$link_command" 'exit $?'
8287 # Now create the wrapper script.
8288 func_verbose "creating $output"
8290 # Quote the relink command for shipping.
8291 if test -n "$relink_command"; then
8292 # Preserve any variables that may affect compiler behavior
8293 for var in $variables_saved_for_relink; do
8294 if eval test -z \"\${$var+set}\"; then
8295 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8296 elif eval var_value=\$$var; test -z "$var_value"; then
8297 relink_command="$var=; export $var; $relink_command"
8299 func_quote_for_eval "$var_value"
8300 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8303 relink_command="(cd `pwd`; $relink_command)"
8304 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
8307 # Quote $ECHO for shipping.
8308 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
8310 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
8311 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
8313 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
8315 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
8318 # Only actually do things if not in dry run mode.
8320 # win32 will think the script is a binary if it has
8321 # a .exe suffix, so we strip it off here.
8323 *.exe) func_stripname '' '.exe' "$output"
8324 output=$func_stripname_result ;;
8326 # test for cygwin because mv fails w/o .exe extensions
8330 func_stripname '' '.exe' "$outputname"
8331 outputname=$func_stripname_result ;;
8335 *cygwin* | *mingw* )
8336 func_dirname_and_basename "$output" "" "."
8337 output_name=$func_basename_result
8338 output_path=$func_dirname_result
8339 cwrappersource="$output_path/$objdir/lt-$output_name.c"
8340 cwrapper="$output_path/$output_name.exe"
8341 $RM $cwrappersource $cwrapper
8342 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8344 func_emit_cwrapperexe_src > $cwrappersource
8346 # The wrapper executable is built using the $host compiler,
8347 # because it contains $host paths and files. If cross-
8348 # compiling, it, like the target executable, must be
8349 # executed on the $host or under an emulation environment.
8351 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8355 # Now, create the wrapper script for func_source use:
8356 func_ltwrapper_scriptname $cwrapper
8357 $RM $func_ltwrapper_scriptname_result
8358 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8360 # note: this script will not be executed, so do not chmod.
8361 if test "x$build" = "x$host" ; then
8362 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8364 func_emit_wrapper no > $func_ltwrapper_scriptname_result
8370 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8372 func_emit_wrapper no > $output
8381 # See if we need to build an old-fashioned archive.
8382 for oldlib in $oldlibs; do
8384 if test "$build_libtool_libs" = convenience; then
8385 oldobjs="$libobjs_save $symfileobj"
8386 addlibs="$convenience"
8387 build_libtool_libs=no
8389 if test "$build_libtool_libs" = module; then
8390 oldobjs="$libobjs_save"
8391 build_libtool_libs=no
8393 oldobjs="$old_deplibs $non_pic_objects"
8394 if test "$preload" = yes && test -f "$symfileobj"; then
8395 oldobjs="$oldobjs $symfileobj"
8398 addlibs="$old_convenience"
8401 if test -n "$addlibs"; then
8402 gentop="$output_objdir/${outputname}x"
8403 generated="$generated $gentop"
8405 func_extract_archives $gentop $addlibs
8406 oldobjs="$oldobjs $func_extract_archives_result"
8409 # Do each command in the archive commands.
8410 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
8411 cmds=$old_archive_from_new_cmds
8414 # Add any objects from preloaded convenience libraries
8415 if test -n "$dlprefiles"; then
8416 gentop="$output_objdir/${outputname}x"
8417 generated="$generated $gentop"
8419 func_extract_archives $gentop $dlprefiles
8420 oldobjs="$oldobjs $func_extract_archives_result"
8423 # POSIX demands no paths to be encoded in archives. We have
8424 # to avoid creating archives with duplicate basenames if we
8425 # might have to extract them afterwards, e.g., when creating a
8426 # static archive out of a convenience library, or when linking
8427 # the entirety of a libtool archive into another (currently
8428 # not supported by libtool).
8429 if (for obj in $oldobjs
8431 func_basename "$obj"
8432 $ECHO "$func_basename_result"
8433 done | sort | sort -uc >/dev/null 2>&1); then
8436 $ECHO "copying selected object files to avoid basename conflicts..."
8437 gentop="$output_objdir/${outputname}x"
8438 generated="$generated $gentop"
8439 func_mkdir_p "$gentop"
8440 save_oldobjs=$oldobjs
8443 for obj in $save_oldobjs
8445 func_basename "$obj"
8446 objbase="$func_basename_result"
8447 case " $oldobjs " in
8448 " ") oldobjs=$obj ;;
8451 # Make sure we don't pick an alternate name that also
8453 newobj=lt$counter-$objbase
8454 func_arith $counter + 1
8455 counter=$func_arith_result
8456 case " $oldobjs " in
8457 *[\ /]"$newobj "*) ;;
8458 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
8461 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8462 oldobjs="$oldobjs $gentop/$newobj"
8464 *) oldobjs="$oldobjs $obj" ;;
8468 eval cmds=\"$old_archive_cmds\"
8471 len=$func_len_result
8472 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8473 cmds=$old_archive_cmds
8475 # the command line is too long to link in one step, link in parts
8476 func_verbose "using piecewise archive linking..."
8481 save_oldobjs=$oldobjs
8483 # Is there a better way of finding the last object in the list?
8484 for obj in $save_oldobjs
8488 eval test_cmds=\"$old_archive_cmds\"
8489 func_len " $test_cmds"
8490 len0=$func_len_result
8492 for obj in $save_oldobjs
8495 func_arith $len + $func_len_result
8496 len=$func_arith_result
8497 func_append objlist " $obj"
8498 if test "$len" -lt "$max_cmd_len"; then
8501 # the above command should be used before it gets too long
8503 if test "$obj" = "$last_oldobj" ; then
8506 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8507 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8514 if test "X$oldobjs" = "X" ; then
8515 eval cmds=\"\$concat_cmds\"
8517 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8521 func_execute_cmds "$cmds" 'exit $?'
8524 test -n "$generated" && \
8525 func_show_eval "${RM}r$generated"
8527 # Now create the libtool archive.
8531 test "$build_old_libs" = yes && old_library="$libname.$libext"
8532 func_verbose "creating $output"
8534 # Preserve any variables that may affect compiler behavior
8535 for var in $variables_saved_for_relink; do
8536 if eval test -z \"\${$var+set}\"; then
8537 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8538 elif eval var_value=\$$var; test -z "$var_value"; then
8539 relink_command="$var=; export $var; $relink_command"
8541 func_quote_for_eval "$var_value"
8542 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8545 # Quote the link command for shipping.
8546 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8547 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
8548 if test "$hardcode_automatic" = yes ; then
8552 # Only create the output if not a dry run.
8554 for installed in no yes; do
8555 if test "$installed" = yes; then
8556 if test -z "$install_libdir"; then
8559 output="$output_objdir/$outputname"i
8560 # Replace all uninstalled libtool libraries with the installed ones
8562 for deplib in $dependency_libs; do
8565 func_basename "$deplib"
8566 name="$func_basename_result"
8567 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8568 test -z "$libdir" && \
8569 func_fatal_error "\`$deplib' is not a valid libtool archive"
8570 newdependency_libs="$newdependency_libs $libdir/$name"
8572 *) newdependency_libs="$newdependency_libs $deplib" ;;
8575 dependency_libs="$newdependency_libs"
8578 for lib in $dlfiles; do
8581 func_basename "$lib"
8582 name="$func_basename_result"
8583 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8584 test -z "$libdir" && \
8585 func_fatal_error "\`$lib' is not a valid libtool archive"
8586 newdlfiles="$newdlfiles $libdir/$name"
8588 *) newdlfiles="$newdlfiles $lib" ;;
8591 dlfiles="$newdlfiles"
8593 for lib in $dlprefiles; do
8596 # Only pass preopened files to the pseudo-archive (for
8597 # eventual linking with the app. that links it) if we
8598 # didn't already link the preopened objects directly into
8600 func_basename "$lib"
8601 name="$func_basename_result"
8602 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8603 test -z "$libdir" && \
8604 func_fatal_error "\`$lib' is not a valid libtool archive"
8605 newdlprefiles="$newdlprefiles $libdir/$name"
8609 dlprefiles="$newdlprefiles"
8612 for lib in $dlfiles; do
8614 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8615 *) abs=`pwd`"/$lib" ;;
8617 newdlfiles="$newdlfiles $abs"
8619 dlfiles="$newdlfiles"
8621 for lib in $dlprefiles; do
8623 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8624 *) abs=`pwd`"/$lib" ;;
8626 newdlprefiles="$newdlprefiles $abs"
8628 dlprefiles="$newdlprefiles"
8631 # place dlname in correct position for cygwin
8633 case $host,$output,$installed,$module,$dlname in
8634 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
8637 # $outputname - a libtool library file
8638 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8640 # Please DO NOT delete this file!
8641 # It is necessary for linking the library.
8643 # The name that we can dlopen(3).
8646 # Names of this library.
8647 library_names='$library_names'
8649 # The name of the static archive.
8650 old_library='$old_library'
8652 # Linker flags that can not go in dependency_libs.
8653 inherited_linker_flags='$new_inherited_linker_flags'
8655 # Libraries that this one depends upon.
8656 dependency_libs='$dependency_libs'
8658 # Names of additional weak libraries provided by this library
8659 weak_library_names='$weak_libs'
8661 # Version information for $libname.
8666 # Is this an already installed library?
8667 installed=$installed
8669 # Should we warn about portability when linking against -modules?
8670 shouldnotlink=$module
8672 # Files to dlopen/dlpreopen
8674 dlpreopen='$dlprefiles'
8676 # Directory that this library needs to be installed in:
8677 libdir='$install_libdir'"
8678 if test "$installed" = no && test "$need_relink" = yes; then
8680 relink_command=\"$relink_command\""
8685 # Do a symbolic link so that the libtool archive can be found in
8686 # LD_LIBRARY_PATH before the program is installed.
8687 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8693 { test "$mode" = link || test "$mode" = relink; } &&
8694 func_mode_link ${1+"$@"}
8697 # func_mode_uninstall arg...
8698 func_mode_uninstall ()
8706 # This variable tells wrapper scripts just to set variables rather
8707 # than running their programs.
8708 libtool_install_magic="$magic"
8713 -f) RM="$RM $arg"; rmforce=yes ;;
8714 -*) RM="$RM $arg" ;;
8715 *) files="$files $arg" ;;
8720 func_fatal_help "you must specify an RM program"
8724 origobjdir="$objdir"
8725 for file in $files; do
8726 func_dirname "$file" "" "."
8727 dir="$func_dirname_result"
8728 if test "X$dir" = X.; then
8729 objdir="$origobjdir"
8731 objdir="$dir/$origobjdir"
8733 func_basename "$file"
8734 name="$func_basename_result"
8735 test "$mode" = uninstall && objdir="$dir"
8737 # Remember objdir for removal later, being careful to avoid duplicates
8738 if test "$mode" = clean; then
8741 *) rmdirs="$rmdirs $objdir" ;;
8745 # Don't error if the file doesn't exist and rm -f was used.
8746 if { test -L "$file"; } >/dev/null 2>&1 ||
8747 { test -h "$file"; } >/dev/null 2>&1 ||
8748 test -f "$file"; then
8750 elif test -d "$file"; then
8753 elif test "$rmforce" = yes; then
8761 # Possibly a libtool archive, so verify it.
8762 if func_lalib_p "$file"; then
8763 func_source $dir/$name
8765 # Delete the libtool libraries and symlinks.
8766 for n in $library_names; do
8767 rmfiles="$rmfiles $objdir/$n"
8769 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
8773 case " $library_names " in
8774 # " " in the beginning catches empty $dlname
8776 *) rmfiles="$rmfiles $objdir/$dlname" ;;
8778 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
8781 if test -n "$library_names"; then
8782 # Do each command in the postuninstall commands.
8783 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8786 if test -n "$old_library"; then
8787 # Do each command in the old_postuninstall commands.
8788 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8790 # FIXME: should reinstall the best remaining shared library.
8797 # Possibly a libtool object, so verify it.
8798 if func_lalib_p "$file"; then
8801 func_source $dir/$name
8803 # Add PIC object to the list of files to remove.
8804 if test -n "$pic_object" &&
8805 test "$pic_object" != none; then
8806 rmfiles="$rmfiles $dir/$pic_object"
8809 # Add non-PIC object to the list of files to remove.
8810 if test -n "$non_pic_object" &&
8811 test "$non_pic_object" != none; then
8812 rmfiles="$rmfiles $dir/$non_pic_object"
8818 if test "$mode" = clean ; then
8822 func_stripname '' '.exe' "$file"
8823 file=$func_stripname_result
8824 func_stripname '' '.exe' "$name"
8825 noexename=$func_stripname_result
8826 # $file with .exe has already been added to rmfiles,
8827 # add $file without .exe
8828 rmfiles="$rmfiles $file"
8831 # Do a test to see if this is a libtool program.
8832 if func_ltwrapper_p "$file"; then
8833 if func_ltwrapper_executable_p "$file"; then
8834 func_ltwrapper_scriptname "$file"
8836 func_source $func_ltwrapper_scriptname_result
8837 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
8840 func_source $dir/$noexename
8843 # note $name still contains .exe if it was in $file originally
8844 # as does the version of $file that was added into $rmfiles
8845 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
8846 if test "$fast_install" = yes && test -n "$relink_command"; then
8847 rmfiles="$rmfiles $objdir/lt-$name"
8849 if test "X$noexename" != "X$name" ; then
8850 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
8856 func_show_eval "$RM $rmfiles" 'exit_status=1'
8858 objdir="$origobjdir"
8860 # Try to remove the ${objdir}s in the directories where we deleted files
8861 for dir in $rmdirs; do
8862 if test -d "$dir"; then
8863 func_show_eval "rmdir $dir >/dev/null 2>&1"
8870 { test "$mode" = uninstall || test "$mode" = clean; } &&
8871 func_mode_uninstall ${1+"$@"}
8873 test -z "$mode" && {
8874 help="$generic_help"
8875 func_fatal_help "you must specify a MODE"
8878 test -z "$exec_cmd" && \
8879 func_fatal_help "invalid operation mode \`$mode'"
8881 if test -n "$exec_cmd"; then
8882 eval exec "$exec_cmd"
8889 # The TAGs below are defined such that we never get into a situation
8890 # in which we disable both kinds of libraries. Given conflicting
8891 # choices, we go for a static library, that is the most portable,
8892 # since we can't tell whether shared libraries were disabled because
8893 # the user asked for that or because the platform doesn't support
8894 # them. This is particularly important on AIX, because we don't
8895 # support having both static and shared libraries enabled at the same
8896 # time on that platform, so we default to a shared-only configuration.
8897 # If a disable-shared tag is given, we'll fallback to a static-only
8898 # configuration. But we'll never go from static-only to shared-only.
8900 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
8901 build_libtool_libs=no
8903 # ### END LIBTOOL TAG CONFIG: disable-shared
8905 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
8906 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
8907 # ### END LIBTOOL TAG CONFIG: disable-static
8916 # ### BEGIN LIBTOOL TAG CONFIG: CXX
8918 # The linker used to build libraries.
8921 # Commands used to build an old-style archive.
8922 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
8924 # A language specific compiler.
8927 # Is the compiler the GNU compiler?
8930 # Compiler flag to turn off builtin functions.
8931 no_builtin_flag=" -fno-builtin"
8933 # How to pass a linker flag through the compiler.
8936 # Additional compiler flags for building library objects.
8937 pic_flag=" -fPIC -DPIC"
8939 # Compiler flag to prevent dynamic linking.
8940 link_static_flag="-static"
8942 # Does compiler simultaneously support -c and -o options?
8945 # Whether or not to add -lc for building shared libraries.
8946 build_libtool_need_lc=no
8948 # Whether or not to disallow shared libs when runtime libs are static.
8949 allow_libtool_libs_with_static_runtimes=no
8951 # Compiler flag to allow reflexive dlopens.
8952 export_dynamic_flag_spec="\${wl}--export-dynamic"
8954 # Compiler flag to generate shared objects directly from archives.
8955 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
8957 # Whether the compiler copes with passing no objects directly.
8958 compiler_needs_object="no"
8960 # Create an old-style archive from a shared archive.
8961 old_archive_from_new_cmds=""
8963 # Create a temporary old-style archive to link instead of a shared archive.
8964 old_archive_from_expsyms_cmds=""
8966 # Commands used to build a shared archive.
8967 archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
8968 archive_expsym_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib"
8970 # Commands used to build a loadable module if different from building
8973 module_expsym_cmds=""
8975 # Whether we are building with GNU ld or not.
8978 # Flag that allows shared libraries with undefined symbols to be built.
8979 allow_undefined_flag=""
8981 # Flag that enforces no undefined symbols.
8982 no_undefined_flag=""
8984 # Flag to hardcode $libdir into a binary during linking.
8985 # This must work even if $libdir does not exist
8986 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
8988 # If ld is used when linking, flag to hardcode $libdir into a binary
8989 # during linking. This must work even if $libdir does not exist.
8990 hardcode_libdir_flag_spec_ld=""
8992 # Whether we need a single "-rpath" flag with a separated argument.
8993 hardcode_libdir_separator=""
8995 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
8996 # DIR into the resulting binary.
8999 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
9000 # DIR into the resulting binary and the resulting library dependency is
9001 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
9002 # library is relocated.
9003 hardcode_direct_absolute=no
9005 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
9006 # into the resulting binary.
9009 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
9010 # into the resulting binary.
9011 hardcode_shlibpath_var=unsupported
9013 # Set to "yes" if building a shared library automatically hardcodes DIR
9014 # into the library and all subsequent libraries and executables linked
9016 hardcode_automatic=no
9018 # Set to yes if linker adds runtime paths of dependent libraries
9019 # to runtime path list.
9022 # Whether libtool must link a program against all its dependency libraries.
9025 # Fix the shell variable $srcfile for the compiler.
9028 # Set to "yes" if exported symbols are required.
9029 always_export_symbols=no
9031 # The commands to list exported symbols.
9032 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
9034 # Symbols that should not be listed in the preloaded symbols.
9035 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
9037 # Symbols that must always be exported.
9040 # Commands necessary for linking programs (against libraries) with templates.
9043 # Specify filename containing input files.
9046 # How to hardcode a shared library path into an executable.
9047 hardcode_action=immediate
9049 # The directories searched by this compiler when creating a shared library.
9050 compiler_lib_search_dirs="/usr/lib/gcc/i686-linux-gnu/4.6.1 /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../../lib /lib/i386-linux-gnu /lib/../lib /usr/lib/i386-linux-gnu /usr/lib/../lib /usr/lib/gcc/i686-linux-gnu/4.6.1/../../.."
9052 # Dependencies to place before and after the objects being linked to
9053 # create a shared library.
9054 predep_objects="/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crti.o /usr/lib/gcc/i686-linux-gnu/4.6.1/crtbeginS.o"
9055 postdep_objects="/usr/lib/gcc/i686-linux-gnu/4.6.1/crtendS.o /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crtn.o"
9057 postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
9059 # The library search path used internally by the compiler when linking
9061 compiler_lib_search_path="-L/usr/lib/gcc/i686-linux-gnu/4.6.1 -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../../lib -L/lib/i386-linux-gnu -L/lib/../lib -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../.."
9063 # ### END LIBTOOL TAG CONFIG: CXX