2 # Generated automatically by config.status (rtl433) UNKNOWN
3 # Libtool was configured on host estia:
4 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
6 # Provide generalized library-building support services.
7 # Written by Gordon Matzigkeit, 1996
9 # Copyright (C) 2014 Free Software Foundation, Inc.
10 # This is free software; see the source for copying conditions. There is NO
11 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 # GNU Libtool is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of of the License, or
16 # (at your option) any later version.
18 # As a special exception to the GNU General Public License, if you
19 # distribute this file as part of a program or library that is built
20 # using GNU Libtool, you may include this file under the same
21 # distribution terms that you use for the rest of that program.
23 # GNU Libtool is distributed in the hope that it will be useful, but
24 # WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 # GNU General Public License for more details.
28 # You should have received a copy of the GNU General Public License
29 # along with this program. If not, see <http://www.gnu.org/licenses/>.
32 # The names of the tagged configurations supported by this script.
35 # Configured defaults for sys_lib_dlsearch_path munging.
36 : ${LT_SYS_LIBRARY_PATH=""}
38 # ### BEGIN LIBTOOL CONFIG
40 # Which release of libtool.m4 was used?
44 # Whether or not to build shared libraries.
45 build_libtool_libs=yes
47 # Whether or not to build static libraries.
50 # What type of objects to build.
53 # Whether or not to optimize for fast installation.
56 # Shared archive member basename,for filename based shared library versioning on AIX.
57 shared_archive_member_spec=
59 # Shell to use when invoking shell scripts.
62 # An echo program that protects backslashes.
65 # The PATH separator for the build system.
70 host=x86_64-pc-linux-gnu
75 build=x86_64-pc-linux-gnu
78 # A sed program that does not truncate output.
81 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
82 Xsed="$SED -e 1s/^X//"
84 # A grep program that handles long lines.
90 # A literal string matcher.
93 # A BSD- or MS-compatible name lister.
96 # Whether we need soft or hard links.
99 # What is the maximum length of a command?
102 # Object file suffix (normally "o").
105 # Executable file suffix (normally "").
108 # whether the shell understands "unset".
111 # turn spaces into newlines.
112 SP2NL="tr \\040 \\012"
114 # turn newlines into spaces.
115 NL2SP="tr \\015\\012 \\040\\040"
117 # convert $build file names to $host format.
118 to_host_file_cmd=func_convert_file_noop
120 # convert $build files to toolchain format.
121 to_tool_file_cmd=func_convert_file_noop
123 # An object symbol dumper.
126 # Method to check whether dependent libraries are shared objects.
127 deplibs_check_method="pass_all"
129 # Command to use when deplibs_check_method = "file_magic".
130 file_magic_cmd="\$MAGIC_CMD"
132 # How to find potential files when deplibs_check_method = "file_magic".
135 # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
138 # DLL creation program.
141 # Command to associate shared and link libraries.
142 sharedlib_from_linklib_cmd="printf %s\\n"
147 # Flags to create an archive.
150 # How to feed a file listing to the archiver.
151 archiver_list_spec="@"
153 # A symbol stripping program.
156 # Commands used to install an old-style archive.
158 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
159 old_postuninstall_cmds=""
161 # Whether to use a lock for old archive extraction.
162 lock_old_archive_extraction=no
167 # LTCC compiler flags.
168 LTCFLAGS="-g -O2 -I/usr/include/ -Wall -Wextra -Wno-unused -Wsign-compare"
170 # Take the output of nm and produce a listing of raw symbols and C names.
171 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
173 # Transform the output of nm in a proper C declaration.
174 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
176 # Transform the output of nm into a list of symbols to manually relocate.
177 global_symbol_to_import=""
179 # Transform the output of nm in a C name address pair.
180 global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'"
182 # Transform the output of nm in a C name address pair when lib prefix is needed.
183 global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(lib.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"lib\\1\", (void *) \\&\\1},/p'"
185 # The name lister interface.
186 nm_interface="BSD nm"
188 # Specify filename containing input files for $NM.
189 nm_file_list_spec="@"
191 # The root where to search for dependent libraries,and where our libraries should be installed.
194 # Command to truncate a binary pipe.
195 lt_truncate_bin="/bin/dd bs=4096 count=1"
197 # The name of the directory that contains temporary libtool files.
200 # Used to examine libraries when file_magic_cmd begins with "file".
203 # Must we lock files when doing compilation?
209 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
212 # Tool to change global to local symbols on Mac OS X.
215 # Tool to manipulate fat objects and archives on Mac OS X.
218 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
221 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
224 # Old archive suffix (normally "a").
227 # Shared library suffix (normally ".so").
230 # The commands to extract the exported symbol list from a shared archive.
231 extract_expsyms_cmds=""
233 # Variables whose values should be saved in libtool wrapper scripts and
234 # restored at link time.
235 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
237 # Do we need the "lib" prefix for modules?
240 # Do we need a version for libraries?
243 # Library versioning type.
246 # Shared library runtime path variable.
247 runpath_var=LD_RUN_PATH
249 # Shared library path variable.
250 shlibpath_var=LD_LIBRARY_PATH
252 # Is shlibpath searched before the hard-coded library search path?
253 shlibpath_overrides_runpath=no
255 # Format of library name prefix.
256 libname_spec="lib\$name"
258 # List of archive names. First name is the real one, the rest are links.
259 # The last name is the one that the linker finds with -lNAME
260 library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
262 # The coded name of the library, if different from the real name.
263 soname_spec="\$libname\$release\$shared_ext\$major"
265 # Permission mode override for installation of shared libraries.
266 install_override_mode=""
268 # Command to use after installation of a shared archive.
271 # Command to use after uninstallation of a shared archive.
272 postuninstall_cmds=""
274 # Commands used to finish a libtool library installation in a directory.
275 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
277 # As "finish_cmds", except a single script fragment to be evaled but
281 # Whether we should hardcode library paths into libraries.
282 hardcode_into_libs=yes
284 # Compile-time system search path for libraries.
285 sys_lib_search_path_spec="/usr/lib/gcc/x86_64-linux-gnu/5 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib "
287 # Detected run-time system search path for libraries.
288 sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/lib/i386-linux-gnu/mesa /opt/intel/common/mdf/lib64 /usr/local/lib /opt/intel/opencl /usr/local/lib /usr/lib/OpenCL/vendors/intel/ /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/mesa-egl /usr/lib/x86_64-linux-gnu/mesa /lib32 /usr/lib32 /libx32 /usr/libx32 "
290 # Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
291 configure_time_lt_sys_library_path=""
293 # Whether dlopen is supported.
294 dlopen_support=unknown
296 # Whether dlopen of programs is supported.
299 # Whether dlopen of statically linked programs is supported.
300 dlopen_self_static=unknown
302 # Commands to strip libraries.
303 old_striplib="strip --strip-debug"
304 striplib="strip --strip-unneeded"
307 # The linker used to build libraries.
308 LD="/usr/bin/ld -m elf_x86_64"
310 # How to create reloadable object files.
312 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
314 # Commands used to build an old-style archive.
315 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
317 # A language specific compiler.
320 # Is the compiler the GNU compiler?
323 # Compiler flag to turn off builtin functions.
324 no_builtin_flag=" -fno-builtin"
326 # Additional compiler flags for building library objects.
327 pic_flag=" -fPIC -DPIC"
329 # How to pass a linker flag through the compiler.
332 # Compiler flag to prevent dynamic linking.
333 link_static_flag="-static"
335 # Does compiler simultaneously support -c and -o options?
338 # Whether or not to add -lc for building shared libraries.
339 build_libtool_need_lc=no
341 # Whether or not to disallow shared libs when runtime libs are static.
342 allow_libtool_libs_with_static_runtimes=no
344 # Compiler flag to allow reflexive dlopens.
345 export_dynamic_flag_spec="\$wl--export-dynamic"
347 # Compiler flag to generate shared objects directly from archives.
348 whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
350 # Whether the compiler copes with passing no objects directly.
351 compiler_needs_object="no"
353 # Create an old-style archive from a shared archive.
354 old_archive_from_new_cmds=""
356 # Create a temporary old-style archive to link instead of a shared archive.
357 old_archive_from_expsyms_cmds=""
359 # Commands used to build a shared archive.
360 archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
361 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
362 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
363 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
364 \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
366 # Commands used to build a loadable module if different from building
369 module_expsym_cmds=""
371 # Whether we are building with GNU ld or not.
374 # Flag that allows shared libraries with undefined symbols to be built.
375 allow_undefined_flag=""
377 # Flag that enforces no undefined symbols.
380 # Flag to hardcode $libdir into a binary during linking.
381 # This must work even if $libdir does not exist
382 hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
384 # Whether we need a single "-rpath" flag with a separated argument.
385 hardcode_libdir_separator=""
387 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
388 # DIR into the resulting binary.
391 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
392 # DIR into the resulting binary and the resulting library dependency is
393 # "absolute",i.e impossible to change by setting $shlibpath_var if the
394 # library is relocated.
395 hardcode_direct_absolute=no
397 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
398 # into the resulting binary.
401 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
402 # into the resulting binary.
403 hardcode_shlibpath_var=unsupported
405 # Set to "yes" if building a shared library automatically hardcodes DIR
406 # into the library and all subsequent libraries and executables linked
408 hardcode_automatic=no
410 # Set to yes if linker adds runtime paths of dependent libraries
411 # to runtime path list.
414 # Whether libtool must link a program against all its dependency libraries.
417 # Set to "yes" if exported symbols are required.
418 always_export_symbols=no
420 # The commands to list exported symbols.
421 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
423 # Symbols that should not be listed in the preloaded symbols.
424 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
426 # Symbols that must always be exported.
429 # Commands necessary for linking programs (against libraries) with templates.
432 # Commands necessary for finishing linking programs.
435 # Specify filename containing input files.
438 # How to hardcode a shared library path into an executable.
439 hardcode_action=immediate
441 # ### END LIBTOOL CONFIG
444 # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
446 # func_munge_path_list VARIABLE PATH
447 # -----------------------------------
448 # VARIABLE is name of variable containing _space_ separated list of
449 # directories to be munged by the contents of PATH, which is string
452 # string "DIR[ DIR]" will be prepended to VARIABLE
454 # string "DIR[ DIR]" will be appended to VARIABLE
455 # "DIRP[:DIRP]::[DIRA:]DIRA"
456 # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
457 # "DIRA[ DIRA]" will be appended to VARIABLE
459 # VARIABLE will be replaced by "DIR[ DIR]"
460 func_munge_path_list ()
466 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
469 eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
472 eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
473 eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
476 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
482 # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
485 for cc_temp in $*""; do
487 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
488 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
493 func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
497 # ### END FUNCTIONS SHARED WITH CONFIGURE
500 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
501 ## by inline-source v2014-01-03.01
503 # libtool (GNU libtool) 2.4.6
504 # Provide generalized library-building support services.
505 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
507 # Copyright (C) 1996-2015 Free Software Foundation, Inc.
508 # This is free software; see the source for copying conditions. There is NO
509 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
511 # GNU Libtool is free software; you can redistribute it and/or modify
512 # it under the terms of the GNU General Public License as published by
513 # the Free Software Foundation; either version 2 of the License, or
514 # (at your option) any later version.
516 # As a special exception to the GNU General Public License,
517 # if you distribute this file as part of a program or library that
518 # is built using GNU Libtool, you may include this file under the
519 # same distribution terms that you use for the rest of that program.
521 # GNU Libtool is distributed in the hope that it will be useful, but
522 # WITHOUT ANY WARRANTY; without even the implied warranty of
523 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
524 # General Public License for more details.
526 # You should have received a copy of the GNU General Public License
527 # along with this program. If not, see <http://www.gnu.org/licenses/>.
532 VERSION="2.4.6 Debian-2.4.6-0.1"
533 package_revision=2.4.6
540 # Run './libtool --help' for help with using this script from the
544 ## ------------------------------- ##
545 ## User overridable command paths. ##
546 ## ------------------------------- ##
548 # After configure completes, it has a better idea of some of the
549 # shell tools we need than the defaults used by the functions shared
550 # with bootstrap, so set those here where they can still be over-
551 # ridden by the user, but otherwise take precedence.
553 : ${AUTOCONF="autoconf"}
554 : ${AUTOMAKE="automake"}
557 ## -------------------------- ##
558 ## Source external libraries. ##
559 ## -------------------------- ##
561 # Much of our low-level functionality needs to be sourced from external
562 # libraries, which are installed to $pkgauxdir.
564 # Set a version string for this script.
565 scriptversion=2015-01-20.17; # UTC
567 # General shell script boiler plate, and helper functions.
568 # Written by Gary V. Vaughan, 2004
570 # Copyright (C) 2004-2015 Free Software Foundation, Inc.
571 # This is free software; see the source for copying conditions. There is NO
572 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
574 # This program is free software; you can redistribute it and/or modify
575 # it under the terms of the GNU General Public License as published by
576 # the Free Software Foundation; either version 3 of the License, or
577 # (at your option) any later version.
579 # As a special exception to the GNU General Public License, if you distribute
580 # this file as part of a program or library that is built using GNU Libtool,
581 # you may include this file under the same distribution terms that you use
582 # for the rest of that program.
584 # This program is distributed in the hope that it will be useful,
585 # but WITHOUT ANY WARRANTY; without even the implied warranty of
586 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
587 # General Public License for more details.
589 # You should have received a copy of the GNU General Public License
590 # along with this program. If not, see <http://www.gnu.org/licenses/>.
592 # Please report bugs or propose patches to gary@gnu.org.
599 # Evaluate this file near the top of your script to gain access to
600 # the functions and variables defined here:
602 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
604 # If you need to override any of the default environment variable
605 # settings, do that before evaluating this file.
608 ## -------------------- ##
609 ## Shell normalisation. ##
610 ## -------------------- ##
612 # Some shells need a little help to be as Bourne compatible as possible.
613 # Before doing anything else, make sure all that help has been provided!
615 DUALCASE=1; export DUALCASE # for MKS sh
616 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
619 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
620 # is contrary to our usage. Disable this feature.
621 alias -g '${1+"$@"}'='"$@"'
624 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
627 # NLS nuisances: We save the old values in case they are required later.
630 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
632 eval "if test set = \"\${$_G_var+set}\"; then
633 save_$_G_var=\$$_G_var
636 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
637 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
642 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
644 # Make sure IFS has a sensible default
650 # There are apparently some retarded systems that use ';' as a PATH separator!
651 if test "${PATH_SEPARATOR+set}" != set; then
653 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
654 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
661 ## ------------------------- ##
662 ## Locate command utilities. ##
663 ## ------------------------- ##
666 # func_executable_p FILE
667 # ----------------------
668 # Check that FILE is an executable regular file.
671 test -f "$1" && test -x "$1"
675 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
676 # --------------------------------------------
677 # Search for either a program that responds to --version with output
678 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
679 # trying all the directories in PATH with each of the elements of
682 # CHECK_FUNC should accept the path to a candidate program, and
683 # set $func_check_prog_result if it truncates its output less than
684 # $_G_path_prog_max characters.
692 _G_path_prog_found=false
693 _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
694 for _G_dir in $_G_PATH; do
696 test -z "$_G_dir" && _G_dir=.
697 for _G_prog_name in $_G_progs_list; do
698 for _exeext in '' .EXE; do
699 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
700 func_executable_p "$_G_path_prog" || continue
701 case `"$_G_path_prog" --version 2>&1` in
702 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
703 *) $_G_check_func $_G_path_prog
704 func_path_progs_result=$func_check_prog_result
707 $_G_path_prog_found && break 3
712 test -z "$func_path_progs_result" && {
713 echo "no acceptable sed could be found in \$PATH" >&2
719 # We want to be able to use the functions in this file before configure
720 # has figured out where the best binaries are kept, which means we have
721 # to search for them ourselves - except when the results are already set
722 # where we skip the searches.
724 # Unless the user overrides by setting SED, search the path for either GNU
725 # sed, or the sed that truncates its output the least.
727 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
728 for _G_i in 1 2 3 4 5 6 7; do
729 _G_sed_script=$_G_sed_script$nl$_G_sed_script
731 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
734 func_check_prog_sed ()
739 printf 0123456789 >conftest.in
742 cat conftest.in conftest.in >conftest.tmp
743 mv conftest.tmp conftest.in
744 cp conftest.in conftest.nl
745 echo '' >> conftest.nl
746 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
747 diff conftest.out conftest.nl >/dev/null 2>&1 || break
748 _G_count=`expr $_G_count + 1`
749 if test "$_G_count" -gt "$_G_path_prog_max"; then
750 # Best one so far, save it but keep looking for a better one
751 func_check_prog_result=$_G_path_prog
752 _G_path_prog_max=$_G_count
754 # 10*(2^10) chars as input seems more than enough
755 test 10 -lt "$_G_count" && break
757 rm -f conftest.in conftest.tmp conftest.nl conftest.out
760 func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
762 SED=$func_path_progs_result
766 # Unless the user overrides by setting GREP, search the path for either GNU
767 # grep, or the grep that truncates its output the least.
769 func_check_prog_grep ()
775 printf 0123456789 >conftest.in
778 cat conftest.in conftest.in >conftest.tmp
779 mv conftest.tmp conftest.in
780 cp conftest.in conftest.nl
781 echo 'GREP' >> conftest.nl
782 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
783 diff conftest.out conftest.nl >/dev/null 2>&1 || break
784 _G_count=`expr $_G_count + 1`
785 if test "$_G_count" -gt "$_G_path_prog_max"; then
786 # Best one so far, save it but keep looking for a better one
787 func_check_prog_result=$_G_path_prog
788 _G_path_prog_max=$_G_count
790 # 10*(2^10) chars as input seems more than enough
791 test 10 -lt "$_G_count" && break
793 rm -f conftest.in conftest.tmp conftest.nl conftest.out
796 func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
797 GREP=$func_path_progs_result
801 ## ------------------------------- ##
802 ## User overridable command paths. ##
803 ## ------------------------------- ##
805 # All uppercase variable names are used for environment variables. These
806 # variables can be overridden by the user before calling a script that
807 # uses them if a suitable command of that name is not already available
808 # in the command search PATH.
811 : ${ECHO="printf %s\n"}
812 : ${EGREP="$GREP -E"}
813 : ${FGREP="$GREP -F"}
819 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
822 ## -------------------- ##
823 ## Useful sed snippets. ##
824 ## -------------------- ##
826 sed_dirname='s|/[^/]*$||'
827 sed_basename='s|^.*/||'
829 # Sed substitution that helps us do robust quoting. It backslashifies
830 # metacharacters that are still active within double-quoted strings.
831 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
833 # Same as above, but do not quote variable references.
834 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
836 # Sed substitution that turns a string into a regex matching for the
838 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
840 # Sed substitution that converts a w32 file name or path
841 # that contains forward slashes, into one that contains
842 # (escaped) backslashes. A very naive implementation.
843 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
845 # Re-'\' parameter expansions in output of sed_double_quote_subst that
846 # were '\'-ed in input to the same. If an odd number of '\' preceded a
847 # '$' in input to sed_double_quote_subst, that '$' was protected from
848 # expansion. Since each input '\' is now two '\'s, look for any number
849 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
854 sed_double_backslash="\
857 s/^$_G_bs2$_G_dollar/$_G_bs&/
858 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
862 ## ----------------- ##
863 ## Global variables. ##
864 ## ----------------- ##
866 # Except for the global variables explicitly listed below, the following
867 # functions in the '^func_' namespace, and the '^require_' namespace
868 # variables initialised in the 'Resource management' section, sourcing
869 # this file will not pollute your global namespace with anything
870 # else. There's no portable way to scope variables in Bourne shell
871 # though, so actually running these functions will sometimes place
872 # results into a variable named after the function, and often use
873 # temporary variables in the '^_G_' namespace. If you are careful to
874 # avoid using those namespaces casually in your sourcing script, things
875 # should continue to work as you expect. And, of course, you can freely
876 # overwrite any of the functions or variables defined here before
877 # calling anything to customize them.
881 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
882 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
884 # Allow overriding, eg assuming that you follow the convention of
885 # putting '$debug_cmd' at the start of all your functions, you can get
886 # bash to show function call trace with:
888 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
889 debug_cmd=${debug_cmd-":"}
892 # By convention, finish your script with:
896 # so that you can set exit_status to non-zero if you want to indicate
897 # something went wrong during execution without actually bailing out at
898 # the point of failure.
899 exit_status=$EXIT_SUCCESS
901 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
902 # is ksh but when the shell is invoked as "sh" and the current value of
903 # the _XPG environment variable is not equal to 1 (one), the special
904 # positional parameter $0, within a function call, is the name of the
908 # The name of this program.
909 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
911 # Make sure we have an absolute progpath for reexecution:
913 [\\/]*|[A-Za-z]:\\*) ;;
915 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
916 progdir=`cd "$progdir" && pwd`
917 progpath=$progdir/$progname
921 IFS=${PATH_SEPARATOR-:}
922 for progdir in $PATH; do
924 test -x "$progdir/$progname" && break
927 test -n "$progdir" || progdir=`pwd`
928 progpath=$progdir/$progname
933 ## ----------------- ##
934 ## Standard options. ##
935 ## ----------------- ##
937 # The following options affect the operation of the functions defined
938 # below, and should be set appropriately depending on run-time para-
939 # meters passed on the command line.
945 # Categories 'all' and 'none' are always available. Append any others
946 # you will pass as the first argument to func_warning from your own
950 # By default, display warnings according to 'opt_warning_types'. Set
951 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
952 # treat the next displayed warning as a fatal error.
953 warning_func=func_warn_and_continue
955 # Set to 'all' to display all warnings, 'none' to suppress all
956 # warnings, or a space delimited list of some subset of
957 # 'warning_categories' to display only the listed warnings.
958 opt_warning_types=all
961 ## -------------------- ##
962 ## Resource management. ##
963 ## -------------------- ##
965 # This section contains definitions for functions that each ensure a
966 # particular resource (a file, or a non-empty configuration variable for
967 # example) is available, and if appropriate to extract default values
968 # from pertinent package files. Call them using their associated
969 # 'require_*' variable to ensure that they are executed, at most, once.
971 # It's entirely deliberate that calling these functions can set
972 # variables that don't obey the namespace limitations obeyed by the rest
973 # of this file, in order that that they be as useful as possible to
977 # require_term_colors
978 # -------------------
979 # Allow display of bold text on terminals that support it.
980 require_term_colors=func_require_term_colors
981 func_require_term_colors ()
986 # COLORTERM and USE_ANSI_COLORS environment variables take
987 # precedence, because most terminfo databases neglect to describe
988 # whether color sequences are supported.
989 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
991 if test 1 = "$USE_ANSI_COLORS"; then
992 # Standard ANSI escape sequences
994 tc_bold='
\e[1m'; tc_standout='
\e[7m'
995 tc_red='
\e[31m'; tc_green='
\e[32m'
996 tc_blue='
\e[34m'; tc_cyan='
\e[36m'
998 # Otherwise trust the terminfo database after all.
999 test -n "`tput sgr0 2>/dev/null`" && {
1000 tc_reset=`tput sgr0`
1001 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
1002 tc_standout=$tc_bold
1003 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
1004 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
1005 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
1006 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
1007 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
1012 require_term_colors=:
1016 ## ----------------- ##
1017 ## Function library. ##
1018 ## ----------------- ##
1020 # This section contains a variety of useful functions to call in your
1021 # scripts. Take note of the portable wrappers for features provided by
1022 # some modern shells, which will fall back to slower equivalents on
1023 # less featureful shells.
1026 # func_append VAR VALUE
1027 # ---------------------
1028 # Append VALUE onto the existing contents of VAR.
1030 # We should try to minimise forks, especially on Windows where they are
1031 # unreasonably slow, so skip the feature probes when bash or zsh are
1033 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
1034 : ${_G_HAVE_ARITH_OP="yes"}
1035 : ${_G_HAVE_XSI_OPS="yes"}
1036 # The += operator was introduced in bash 3.1
1037 case $BASH_VERSION in
1038 [12].* | 3.0 | 3.0*) ;;
1040 : ${_G_HAVE_PLUSEQ_OP="yes"}
1046 # Can be empty, in which case the shell is probed, "yes" if += is
1047 # useable or anything else if it does not work.
1048 test -z "$_G_HAVE_PLUSEQ_OP" \
1049 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
1050 && _G_HAVE_PLUSEQ_OP=yes
1052 if test yes = "$_G_HAVE_PLUSEQ_OP"
1054 # This is an XSI compatible shell, allowing a faster implementation...
1055 eval 'func_append ()
1062 # ...otherwise fall back to using expr, which is often a shell builtin.
1072 # func_append_quoted VAR VALUE
1073 # ----------------------------
1074 # Quote VALUE and append to the end of shell variable VAR, separated
1076 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
1077 eval 'func_append_quoted ()
1081 func_quote_for_eval "$2"
1082 eval "$1+=\\ \$func_quote_for_eval_result"
1085 func_append_quoted ()
1089 func_quote_for_eval "$2"
1090 eval "$1=\$$1\\ \$func_quote_for_eval_result"
1095 # func_append_uniq VAR VALUE
1096 # --------------------------
1097 # Append unique VALUE onto the existing contents of VAR, assuming
1098 # entries are delimited by the first character of VALUE. For example:
1100 # func_append_uniq options " --another-option option-argument"
1102 # will only append to $options if " --another-option option-argument "
1103 # is not already present somewhere in $options already (note spaces at
1104 # each end implied by leading space in second argument).
1109 eval _G_current_value='`$ECHO $'$1'`'
1110 _G_delim=`expr "$2" : '\(.\)'`
1112 case $_G_delim$_G_current_value$_G_delim in
1114 *) func_append "$@" ;;
1119 # func_arith TERM...
1120 # ------------------
1121 # Set func_arith_result to the result of evaluating TERMs.
1122 test -z "$_G_HAVE_ARITH_OP" \
1123 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
1124 && _G_HAVE_ARITH_OP=yes
1126 if test yes = "$_G_HAVE_ARITH_OP"; then
1131 func_arith_result=$(( $* ))
1138 func_arith_result=`expr "$@"`
1143 # func_basename FILE
1144 # ------------------
1145 # Set func_basename_result to FILE with everything up to and including
1146 # the last / stripped.
1147 if test yes = "$_G_HAVE_XSI_OPS"; then
1148 # If this shell supports suffix pattern removal, then use it to avoid
1149 # forking. Hide the definitions single quotes in case the shell chokes
1150 # on unsupported syntax...
1151 _b='func_basename_result=${1##*/}'
1153 */*) func_dirname_result=${1%/*}$2 ;;
1154 * ) func_dirname_result=$3 ;;
1158 # ...otherwise fall back to using sed.
1159 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
1160 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
1161 if test "X$func_dirname_result" = "X$1"; then
1162 func_dirname_result=$3
1164 func_append func_dirname_result "$2"
1168 eval 'func_basename ()
1176 # func_dirname FILE APPEND NONDIR_REPLACEMENT
1177 # -------------------------------------------
1178 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
1179 # otherwise set result to NONDIR_REPLACEMENT.
1180 eval 'func_dirname ()
1188 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
1189 # --------------------------------------------------------
1190 # Perform func_basename and func_dirname in a single function
1192 # dirname: Compute the dirname of FILE. If nonempty,
1193 # add APPEND to the result, otherwise set result
1194 # to NONDIR_REPLACEMENT.
1195 # value returned in "$func_dirname_result"
1196 # basename: Compute filename of FILE.
1197 # value retuned in "$func_basename_result"
1198 # For efficiency, we do not delegate to the functions above but instead
1199 # duplicate the functionality here.
1200 eval 'func_dirname_and_basename ()
1211 # Echo program name prefixed message.
1220 for _G_line in $_G_message; do
1222 $ECHO "$progname: $_G_line"
1228 # func_echo_all ARG...
1229 # --------------------
1230 # Invoke $ECHO with all args, space-separated.
1237 # func_echo_infix_1 INFIX ARG...
1238 # ------------------------------
1239 # Echo program name, followed by INFIX on the first line, with any
1240 # additional lines not showing INFIX.
1241 func_echo_infix_1 ()
1245 $require_term_colors
1249 _G_prefix="$progname: $_G_infix: "
1252 # Strip color escape sequences before counting printable length
1253 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
1255 test -n "$_G_tc" && {
1256 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
1257 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
1260 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
1262 func_echo_infix_1_IFS=$IFS
1264 for _G_line in $_G_message; do
1265 IFS=$func_echo_infix_1_IFS
1266 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
1267 _G_prefix=$_G_indent
1269 IFS=$func_echo_infix_1_IFS
1275 # Echo program name prefixed message to standard error.
1280 $require_term_colors
1282 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
1286 # func_fatal_error ARG...
1287 # -----------------------
1288 # Echo program name prefixed message to standard error, and exit.
1298 # func_grep EXPRESSION FILENAME
1299 # -----------------------------
1300 # Check whether EXPRESSION matches any line of FILENAME, without output.
1305 $GREP "$1" "$2" >/dev/null 2>&1
1311 # Set func_len_result to the length of STRING. STRING may not
1312 # start with a hyphen.
1313 test -z "$_G_HAVE_XSI_OPS" \
1315 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
1316 && _G_HAVE_XSI_OPS=yes
1318 if test yes = "$_G_HAVE_XSI_OPS"; then
1323 func_len_result=${#1}
1330 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
1335 # func_mkdir_p DIRECTORY-PATH
1336 # ---------------------------
1337 # Make sure the entire path to DIRECTORY-PATH is available.
1342 _G_directory_path=$1
1345 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
1347 # Protect directory names starting with '-'
1348 case $_G_directory_path in
1349 -*) _G_directory_path=./$_G_directory_path ;;
1352 # While some portion of DIR does not yet exist...
1353 while test ! -d "$_G_directory_path"; do
1354 # ...make a list in topmost first order. Use a colon delimited
1355 # list incase some portion of path contains whitespace.
1356 _G_dir_list=$_G_directory_path:$_G_dir_list
1358 # If the last portion added has no slash in it, the list is done
1359 case $_G_directory_path in */*) ;; *) break ;; esac
1361 # ...otherwise throw away the child directory and loop
1362 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
1364 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
1366 func_mkdir_p_IFS=$IFS; IFS=:
1367 for _G_dir in $_G_dir_list; do
1368 IFS=$func_mkdir_p_IFS
1369 # mkdir can fail with a 'File exist' error if two processes
1370 # try to create one of the directories concurrently. Don't
1371 # stop in that case!
1372 $MKDIR "$_G_dir" 2>/dev/null || :
1374 IFS=$func_mkdir_p_IFS
1376 # Bail out if we (or some other process) failed to create a directory.
1377 test -d "$_G_directory_path" || \
1378 func_fatal_error "Failed to create '$1'"
1383 # func_mktempdir [BASENAME]
1384 # -------------------------
1385 # Make a temporary directory that won't clash with other running
1386 # libtool processes, and avoids race conditions if possible. If
1387 # given, BASENAME is the basename for that directory.
1392 _G_template=${TMPDIR-/tmp}/${1-$progname}
1394 if test : = "$opt_dry_run"; then
1395 # Return a directory name, but don't create it in dry-run mode
1396 _G_tmpdir=$_G_template-$$
1399 # If mktemp works, use that first and foremost
1400 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
1402 if test ! -d "$_G_tmpdir"; then
1403 # Failing that, at least try and use $RANDOM to avoid a race
1404 _G_tmpdir=$_G_template-${RANDOM-0}$$
1406 func_mktempdir_umask=`umask`
1409 umask $func_mktempdir_umask
1412 # If we're not in dry-run mode, bomb out on failure
1413 test -d "$_G_tmpdir" || \
1414 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
1421 # func_normal_abspath PATH
1422 # ------------------------
1423 # Remove doubled-up and trailing slashes, "." path components,
1424 # and cancel out any ".." path components in PATH after making
1425 # it an absolute path.
1426 func_normal_abspath ()
1430 # These SED scripts presuppose an absolute path with a trailing slash.
1431 _G_pathcar='s|^/\([^/]*\).*$|\1|'
1432 _G_pathcdr='s|^/[^/]*||'
1433 _G_removedotparts=':dotsl
1437 _G_collapseslashes='s|/\{1,\}|/|g'
1438 _G_finalslash='s|/*$|/|'
1440 # Start from root dir and reassemble the path.
1441 func_normal_abspath_result=
1442 func_normal_abspath_tpath=$1
1443 func_normal_abspath_altnamespace=
1444 case $func_normal_abspath_tpath in
1446 # Empty path, that just means $cwd.
1447 func_stripname '' '/' "`pwd`"
1448 func_normal_abspath_result=$func_stripname_result
1451 # The next three entries are used to spot a run of precisely
1452 # two leading slashes without using negated character classes;
1453 # we take advantage of case's first-match behaviour.
1455 # Unusual form of absolute path, do nothing.
1458 # Not necessarily an ordinary path; POSIX reserves leading '//'
1459 # and for example Cygwin uses it to access remote file shares
1460 # over CIFS/SMB, so we conserve a leading double slash if found.
1461 func_normal_abspath_altnamespace=/
1464 # Absolute path, do nothing.
1467 # Relative path, prepend $cwd.
1468 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
1472 # Cancel out all the simple stuff to save iterations. We also want
1473 # the path to end with a slash for ease of parsing, so make sure
1474 # there is one (and only one) here.
1475 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1476 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
1478 # Processed it all yet?
1479 if test / = "$func_normal_abspath_tpath"; then
1480 # If we ascended to the root using ".." the result may be empty now.
1481 if test -z "$func_normal_abspath_result"; then
1482 func_normal_abspath_result=/
1486 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
1488 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1490 # Figure out what to do with it
1491 case $func_normal_abspath_tcomponent in
1493 # Trailing empty path component, ignore it.
1496 # Parent dir; strip last assembled component from result.
1497 func_dirname "$func_normal_abspath_result"
1498 func_normal_abspath_result=$func_dirname_result
1501 # Actual path component, append it.
1502 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1506 # Restore leading double-slash if one was found on entry.
1507 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1511 # func_notquiet ARG...
1512 # --------------------
1513 # Echo program name prefixed message only when not in quiet mode.
1518 $opt_quiet || func_echo ${1+"$@"}
1520 # A bug in bash halts the script if the last line of a function
1521 # fails when set -e is in force, so we need another command to
1527 # func_relative_path SRCDIR DSTDIR
1528 # --------------------------------
1529 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1530 func_relative_path ()
1534 func_relative_path_result=
1535 func_normal_abspath "$1"
1536 func_relative_path_tlibdir=$func_normal_abspath_result
1537 func_normal_abspath "$2"
1538 func_relative_path_tbindir=$func_normal_abspath_result
1540 # Ascend the tree starting from libdir
1542 # check if we have found a prefix of bindir
1543 case $func_relative_path_tbindir in
1544 $func_relative_path_tlibdir)
1545 # found an exact match
1546 func_relative_path_tcancelled=
1549 $func_relative_path_tlibdir*)
1550 # found a matching prefix
1551 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1552 func_relative_path_tcancelled=$func_stripname_result
1553 if test -z "$func_relative_path_result"; then
1554 func_relative_path_result=.
1559 func_dirname $func_relative_path_tlibdir
1560 func_relative_path_tlibdir=$func_dirname_result
1561 if test -z "$func_relative_path_tlibdir"; then
1562 # Have to descend all the way to the root!
1563 func_relative_path_result=../$func_relative_path_result
1564 func_relative_path_tcancelled=$func_relative_path_tbindir
1567 func_relative_path_result=../$func_relative_path_result
1572 # Now calculate path; take care to avoid doubling-up slashes.
1573 func_stripname '' '/' "$func_relative_path_result"
1574 func_relative_path_result=$func_stripname_result
1575 func_stripname '/' '/' "$func_relative_path_tcancelled"
1576 if test -n "$func_stripname_result"; then
1577 func_append func_relative_path_result "/$func_stripname_result"
1580 # Normalisation. If bindir is libdir, return '.' else relative path.
1581 if test -n "$func_relative_path_result"; then
1582 func_stripname './' '' "$func_relative_path_result"
1583 func_relative_path_result=$func_stripname_result
1586 test -n "$func_relative_path_result" || func_relative_path_result=.
1592 # func_quote_for_eval ARG...
1593 # --------------------------
1594 # Aesthetically quote ARGs to be evaled later.
1595 # This function returns two values:
1596 # i) func_quote_for_eval_result
1597 # double-quoted, suitable for a subsequent eval
1598 # ii) func_quote_for_eval_unquoted_result
1599 # has all characters that are still active within double
1600 # quotes backslashified.
1601 func_quote_for_eval ()
1605 func_quote_for_eval_unquoted_result=
1606 func_quote_for_eval_result=
1607 while test 0 -lt $#; do
1610 _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
1612 _G_unquoted_arg=$1 ;;
1614 if test -n "$func_quote_for_eval_unquoted_result"; then
1615 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
1617 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
1620 case $_G_unquoted_arg in
1621 # Double-quote args containing shell metacharacters to delay
1622 # word splitting, command substitution and variable expansion
1623 # for a subsequent eval.
1624 # Many Bourne shells cannot handle close brackets correctly
1625 # in scan sets, so we specify it separately.
1626 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1627 _G_quoted_arg=\"$_G_unquoted_arg\"
1630 _G_quoted_arg=$_G_unquoted_arg
1634 if test -n "$func_quote_for_eval_result"; then
1635 func_append func_quote_for_eval_result " $_G_quoted_arg"
1637 func_append func_quote_for_eval_result "$_G_quoted_arg"
1644 # func_quote_for_expand ARG
1645 # -------------------------
1646 # Aesthetically quote ARG to be evaled later; same as above,
1647 # but do not quote variable references.
1648 func_quote_for_expand ()
1654 _G_arg=`$ECHO "$1" | $SED \
1655 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
1661 # Double-quote args containing shell metacharacters to delay
1662 # word splitting and command substitution for a subsequent eval.
1663 # Many Bourne shells cannot handle close brackets correctly
1664 # in scan sets, so we specify it separately.
1665 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1670 func_quote_for_expand_result=$_G_arg
1674 # func_stripname PREFIX SUFFIX NAME
1675 # ---------------------------------
1676 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1677 # PREFIX and SUFFIX must not contain globbing or regex special
1678 # characters, hashes, percent signs, but SUFFIX may contain a leading
1679 # dot (in which case that matches only a dot).
1680 if test yes = "$_G_HAVE_XSI_OPS"; then
1681 eval 'func_stripname ()
1685 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1686 # positional parameters, so assign one to ordinary variable first.
1687 func_stripname_result=$3
1688 func_stripname_result=${func_stripname_result#"$1"}
1689 func_stripname_result=${func_stripname_result%"$2"}
1697 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1698 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1704 # func_show_eval CMD [FAIL_EXP]
1705 # -----------------------------
1706 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1707 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1708 # is given, then evaluate it.
1714 _G_fail_exp=${2-':'}
1716 func_quote_for_expand "$_G_cmd"
1717 eval "func_notquiet $func_quote_for_expand_result"
1722 if test 0 -ne "$_G_status"; then
1723 eval "(exit $_G_status); $_G_fail_exp"
1729 # func_show_eval_locale CMD [FAIL_EXP]
1730 # ------------------------------------
1731 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1732 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1733 # is given, then evaluate it. Use the saved locale for evaluation.
1734 func_show_eval_locale ()
1739 _G_fail_exp=${2-':'}
1742 func_quote_for_expand "$_G_cmd"
1743 eval "func_echo $func_quote_for_expand_result"
1747 eval "$_G_user_locale
1750 eval "$_G_safe_locale"
1751 if test 0 -ne "$_G_status"; then
1752 eval "(exit $_G_status); $_G_fail_exp"
1760 # Turn $1 into a string suitable for a shell variable name.
1761 # Result is stored in $func_tr_sh_result. All characters
1762 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1763 # if $1 begins with a digit, a '_' is prepended as well.
1769 [0-9]* | *[!a-zA-Z0-9_]*)
1770 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1773 func_tr_sh_result=$1
1779 # func_verbose ARG...
1780 # -------------------
1781 # Echo program name prefixed message in verbose mode only.
1786 $opt_verbose && func_echo "$*"
1792 # func_warn_and_continue ARG...
1793 # -----------------------------
1794 # Echo program name prefixed warning message to standard error.
1795 func_warn_and_continue ()
1799 $require_term_colors
1801 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1805 # func_warning CATEGORY ARG...
1806 # ----------------------------
1807 # Echo program name prefixed warning message to standard error. Warning
1808 # messages can be filtered according to CATEGORY, where this function
1809 # elides messages where CATEGORY is not listed in the global variable
1810 # 'opt_warning_types'.
1815 # CATEGORY must be in the warning_categories list!
1816 case " $warning_categories " in
1818 *) func_internal_error "invalid warning category '$1'" ;;
1824 case " $opt_warning_types " in
1825 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1830 # func_sort_ver VER1 VER2
1831 # -----------------------
1832 # 'sort -V' is not generally available.
1833 # Note this deviates from the version comparison in automake
1834 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1835 # but this should suffice as we won't be specifying old
1836 # version formats or redundant trailing .0 in bootstrap.conf.
1837 # If we did want full compatibility then we should probably
1838 # use m4_version_compare from autoconf.
1843 printf '%s\n%s\n' "$1" "$2" \
1844 | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
1847 # func_lt_ver PREV CURR
1848 # ---------------------
1849 # Return true if PREV and CURR are in the correct order according to
1850 # func_sort_ver, otherwise false. Use it like this:
1852 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1857 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1862 # mode: shell-script
1864 # eval: (add-hook 'before-save-hook 'time-stamp)
1865 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1866 # time-stamp-time-zone: "UTC"
1870 # Set a version string for this script.
1871 scriptversion=2014-01-07.03; # UTC
1873 # A portable, pluggable option parser for Bourne shell.
1874 # Written by Gary V. Vaughan, 2010
1876 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
1877 # This is free software; see the source for copying conditions. There is NO
1878 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1880 # This program is free software: you can redistribute it and/or modify
1881 # it under the terms of the GNU General Public License as published by
1882 # the Free Software Foundation, either version 3 of the License, or
1883 # (at your option) any later version.
1885 # This program is distributed in the hope that it will be useful,
1886 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1887 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1888 # GNU General Public License for more details.
1890 # You should have received a copy of the GNU General Public License
1891 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1893 # Please report bugs or propose patches to gary@gnu.org.
1900 # This file is a library for parsing options in your shell scripts along
1901 # with assorted other useful supporting features that you can make use
1904 # For the simplest scripts you might need only:
1907 # . relative/path/to/funclib.sh
1908 # . relative/path/to/options-parser
1910 # func_options ${1+"$@"}
1911 # eval set dummy "$func_options_result"; shift
1912 # ...rest of your script...
1914 # In order for the '--version' option to work, you will need to have a
1915 # suitably formatted comment like the one at the top of this file
1916 # starting with '# Written by ' and ending with '# warranty; '.
1918 # For '-h' and '--help' to work, you will also need a one line
1919 # description of your script's purpose in a comment directly above the
1920 # '# Written by ' line, like the one at the top of this file.
1922 # The default options also support '--debug', which will turn on shell
1923 # execution tracing (see the comment above debug_cmd below for another
1924 # use), and '--verbose' and the func_verbose function to allow your script
1925 # to display verbose messages only when your user has specified
1928 # After sourcing this file, you can plug processing for additional
1929 # options by amending the variables from the 'Configuration' section
1930 # below, and following the instructions in the 'Option parsing'
1931 # section further down.
1933 ## -------------- ##
1934 ## Configuration. ##
1935 ## -------------- ##
1937 # You should override these variables in your script after sourcing this
1938 # file so that they reflect the customisations you have added to the
1941 # The usage line for option parsing errors and the start of '-h' and
1942 # '--help' output messages. You can embed shell variables for delayed
1943 # expansion at the time the message is displayed, but you will need to
1944 # quote other shell meta-characters carefully to prevent them being
1945 # expanded when the contents are evaled.
1946 usage='$progpath [OPTION]...'
1948 # Short help message in response to '-h' and '--help'. Add to this or
1949 # override it after sourcing this library to reflect the full set of
1950 # options your script accepts.
1952 --debug enable verbose shell tracing
1953 -W, --warnings=CATEGORY
1954 report the warnings falling in CATEGORY [all]
1955 -v, --verbose verbosely report processing
1956 --version print version information and exit
1957 -h, --help print short or long help message and exit
1960 # Additional text appended to 'usage_message' in response to '--help'.
1962 Warning categories include:
1963 'all' show all warnings
1964 'none' turn off all the warnings
1965 'error' warnings are treated as fatal errors"
1967 # Help message printed before fatal option parsing errors.
1968 fatal_help="Try '\$progname --help' for more information."
1972 ## ------------------------- ##
1973 ## Hook function management. ##
1974 ## ------------------------- ##
1976 # This section contains functions for adding, removing, and running hooks
1977 # to the main code. A hook is just a named list of of function, that can
1978 # be run in order later on.
1980 # func_hookable FUNC_NAME
1981 # -----------------------
1982 # Declare that FUNC_NAME will run hooks added with
1983 # 'func_add_hook FUNC_NAME ...'.
1988 func_append hookable_fns " $1"
1992 # func_add_hook FUNC_NAME HOOK_FUNC
1993 # ---------------------------------
1994 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
1995 # first have been declared "hookable" by a call to 'func_hookable'.
2000 case " $hookable_fns " in
2002 *) func_fatal_error "'$1' does not accept hook functions." ;;
2005 eval func_append ${1}_hooks '" $2"'
2009 # func_remove_hook FUNC_NAME HOOK_FUNC
2010 # ------------------------------------
2011 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
2016 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
2020 # func_run_hooks FUNC_NAME [ARG]...
2021 # ---------------------------------
2022 # Run all hook functions registered to FUNC_NAME.
2023 # It is assumed that the list of hook functions contains nothing more
2024 # than a whitespace-delimited list of legal shell function names, and
2025 # no effort is wasted trying to catch shell meta-characters or preserve
2031 case " $hookable_fns " in
2033 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
2036 eval _G_hook_fns=\$$1_hooks; shift
2038 for _G_hook in $_G_hook_fns; do
2039 eval $_G_hook '"$@"'
2041 # store returned options list back into positional
2042 # parameters for next 'cmd' execution.
2043 eval _G_hook_result=\$${_G_hook}_result
2044 eval set dummy "$_G_hook_result"; shift
2047 func_quote_for_eval ${1+"$@"}
2048 func_run_hooks_result=$func_quote_for_eval_result
2053 ## --------------- ##
2054 ## Option parsing. ##
2055 ## --------------- ##
2057 # In order to add your own option parsing hooks, you must accept the
2058 # full positional parameter list in your hook function, remove any
2059 # options that you action, and then pass back the remaining unprocessed
2060 # options in '<hooked_function_name>_result', escaped suitably for
2061 # 'eval'. Like this:
2063 # my_options_prep ()
2067 # # Extend the existing usage message.
2068 # usage_message=$usage_message'
2069 # -s, --silent don'\''t print informational messages
2072 # func_quote_for_eval ${1+"$@"}
2073 # my_options_prep_result=$func_quote_for_eval_result
2075 # func_add_hook func_options_prep my_options_prep
2078 # my_silent_option ()
2082 # # Note that for efficiency, we parse as many options as we can
2083 # # recognise in a loop before passing the remainder back to the
2084 # # caller on the first unrecognised argument we encounter.
2085 # while test $# -gt 0; do
2088 # --silent|-s) opt_silent=: ;;
2089 # # Separate non-argument short options:
2090 # -s*) func_split_short_opt "$_G_opt"
2091 # set dummy "$func_split_short_opt_name" \
2092 # "-$func_split_short_opt_arg" ${1+"$@"}
2095 # *) set dummy "$_G_opt" "$*"; shift; break ;;
2099 # func_quote_for_eval ${1+"$@"}
2100 # my_silent_option_result=$func_quote_for_eval_result
2102 # func_add_hook func_parse_options my_silent_option
2105 # my_option_validation ()
2109 # $opt_silent && $opt_verbose && func_fatal_help "\
2110 # '--silent' and '--verbose' options are mutually exclusive."
2112 # func_quote_for_eval ${1+"$@"}
2113 # my_option_validation_result=$func_quote_for_eval_result
2115 # func_add_hook func_validate_options my_option_validation
2117 # You'll alse need to manually amend $usage_message to reflect the extra
2118 # options you parse. It's preferable to append if you can, so that
2119 # multiple option parsing hooks can be added safely.
2122 # func_options [ARG]...
2123 # ---------------------
2124 # All the functions called inside func_options are hookable. See the
2125 # individual implementations for details.
2126 func_hookable func_options
2131 func_options_prep ${1+"$@"}
2132 eval func_parse_options \
2133 ${func_options_prep_result+"$func_options_prep_result"}
2134 eval func_validate_options \
2135 ${func_parse_options_result+"$func_parse_options_result"}
2137 eval func_run_hooks func_options \
2138 ${func_validate_options_result+"$func_validate_options_result"}
2140 # save modified positional parameters for caller
2141 func_options_result=$func_run_hooks_result
2145 # func_options_prep [ARG]...
2146 # --------------------------
2147 # All initialisations required before starting the option parse loop.
2148 # Note that when calling hook functions, we pass through the list of
2149 # positional parameters. If a hook function modifies that list, and
2150 # needs to propogate that back to rest of this script, then the complete
2151 # modified list must be put in 'func_run_hooks_result' before
2153 func_hookable func_options_prep
2154 func_options_prep ()
2162 func_run_hooks func_options_prep ${1+"$@"}
2164 # save modified positional parameters for caller
2165 func_options_prep_result=$func_run_hooks_result
2169 # func_parse_options [ARG]...
2170 # ---------------------------
2171 # The main option parsing loop.
2172 func_hookable func_parse_options
2173 func_parse_options ()
2177 func_parse_options_result=
2179 # this just eases exit handling
2180 while test $# -gt 0; do
2181 # Defer to hook functions for initial option parsing, so they
2182 # get priority in the event of reusing an option name.
2183 func_run_hooks func_parse_options ${1+"$@"}
2185 # Adjust func_parse_options positional parameters to match
2186 eval set dummy "$func_run_hooks_result"; shift
2188 # Break out of the loop if we already parsed every option.
2189 test $# -gt 0 || break
2194 --debug|-x) debug_cmd='set -x'
2195 func_echo "enabling shell trace mode"
2199 --no-warnings|--no-warning|--no-warn)
2200 set dummy --warnings none ${1+"$@"}
2204 --warnings|--warning|-W)
2205 test $# = 0 && func_missing_arg $_G_opt && break
2206 case " $warning_categories $1" in
2208 # trailing space prevents matching last $1 above
2209 func_append_uniq opt_warning_types " $1"
2212 opt_warning_types=$warning_categories
2215 opt_warning_types=none
2219 opt_warning_types=$warning_categories
2220 warning_func=func_fatal_error
2224 "unsupported warning category: '$1'"
2230 --verbose|-v) opt_verbose=: ;;
2231 --version) func_version ;;
2232 -\?|-h) func_usage ;;
2233 --help) func_help ;;
2235 # Separate optargs to long options (plugins may need this):
2236 --*=*) func_split_equals "$_G_opt"
2237 set dummy "$func_split_equals_lhs" \
2238 "$func_split_equals_rhs" ${1+"$@"}
2242 # Separate optargs to short options:
2244 func_split_short_opt "$_G_opt"
2245 set dummy "$func_split_short_opt_name" \
2246 "$func_split_short_opt_arg" ${1+"$@"}
2250 # Separate non-argument short options:
2252 func_split_short_opt "$_G_opt"
2253 set dummy "$func_split_short_opt_name" \
2254 "-$func_split_short_opt_arg" ${1+"$@"}
2259 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
2260 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2264 # save modified positional parameters for caller
2265 func_quote_for_eval ${1+"$@"}
2266 func_parse_options_result=$func_quote_for_eval_result
2270 # func_validate_options [ARG]...
2271 # ------------------------------
2272 # Perform any sanity checks on option settings and/or unconsumed
2274 func_hookable func_validate_options
2275 func_validate_options ()
2279 # Display all warnings if -W was not given.
2280 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
2282 func_run_hooks func_validate_options ${1+"$@"}
2284 # Bail if the options were screwed!
2285 $exit_cmd $EXIT_FAILURE
2287 # save modified positional parameters for caller
2288 func_validate_options_result=$func_run_hooks_result
2293 ## ----------------- ##
2294 ## Helper functions. ##
2295 ## ----------------- ##
2297 # This section contains the helper functions used by the rest of the
2298 # hookable option parser framework in ascii-betical order.
2301 # func_fatal_help ARG...
2302 # ----------------------
2303 # Echo program name prefixed message to standard error, followed by
2304 # a help hint, and exit.
2309 eval \$ECHO \""Usage: $usage"\"
2310 eval \$ECHO \""$fatal_help"\"
2311 func_error ${1+"$@"}
2318 # Echo long help message to standard output and exit.
2324 $ECHO "$long_help_message"
2329 # func_missing_arg ARGNAME
2330 # ------------------------
2331 # Echo program name prefixed message to standard error and set global
2337 func_error "Missing argument for '$1'."
2342 # func_split_equals STRING
2343 # ------------------------
2344 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
2345 # splitting STRING at the '=' sign.
2346 test -z "$_G_HAVE_XSI_OPS" \
2348 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
2349 && _G_HAVE_XSI_OPS=yes
2351 if test yes = "$_G_HAVE_XSI_OPS"
2353 # This is an XSI compatible shell, allowing a faster implementation...
2354 eval 'func_split_equals ()
2358 func_split_equals_lhs=${1%%=*}
2359 func_split_equals_rhs=${1#*=}
2360 test "x$func_split_equals_lhs" = "x$1" \
2361 && func_split_equals_rhs=
2364 # ...otherwise fall back to using expr, which is often a shell builtin.
2365 func_split_equals ()
2369 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
2370 func_split_equals_rhs=
2371 test "x$func_split_equals_lhs" = "x$1" \
2372 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
2374 fi #func_split_equals
2377 # func_split_short_opt SHORTOPT
2378 # -----------------------------
2379 # Set func_split_short_opt_name and func_split_short_opt_arg shell
2380 # variables after splitting SHORTOPT after the 2nd character.
2381 if test yes = "$_G_HAVE_XSI_OPS"
2383 # This is an XSI compatible shell, allowing a faster implementation...
2384 eval 'func_split_short_opt ()
2388 func_split_short_opt_arg=${1#??}
2389 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
2392 # ...otherwise fall back to using expr, which is often a shell builtin.
2393 func_split_short_opt ()
2397 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
2398 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
2400 fi #func_split_short_opt
2405 # Echo short help message to standard output and exit.
2411 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
2416 # func_usage_message
2417 # ------------------
2418 # Echo short help message to standard output.
2419 func_usage_message ()
2423 eval \$ECHO \""Usage: $usage"\"
2430 /^Written by/q' < "$progpath"
2432 eval \$ECHO \""$usage_message"\"
2438 # Echo version message to standard output and exit.
2443 printf '%s\n' "$progname $scriptversion"
2453 /^# Written by /,/# warranty; / {
2456 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2463 /^warranty; /q' < "$progpath"
2470 # mode: shell-script
2472 # eval: (add-hook 'before-save-hook 'time-stamp)
2473 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2474 # time-stamp-time-zone: "UTC"
2477 # Set a version string.
2478 scriptversion='(GNU libtool) 2.4.6'
2483 # Libtool also displays the current mode in messages, so override
2484 # funclib.sh func_echo with this custom definition.
2493 for _G_line in $_G_message; do
2495 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2501 # func_warning ARG...
2502 # -------------------
2503 # Libtool warnings are not categorized, so override funclib.sh
2504 # func_warning with this simpler definition.
2509 $warning_func ${1+"$@"}
2513 ## ---------------- ##
2514 ## Options parsing. ##
2515 ## ---------------- ##
2517 # Hook in the functions to make sure our own options are parsed during
2518 # the option parsing loop.
2520 usage='$progpath [OPTION]... [MODE-ARG]...'
2522 # Short help message in response to '-h'.
2523 usage_message="Options:
2524 --config show all configuration variables
2525 --debug enable verbose shell tracing
2526 -n, --dry-run display commands without modifying any files
2527 --features display basic configuration information and exit
2528 --mode=MODE use operation mode MODE
2529 --no-warnings equivalent to '-Wnone'
2530 --preserve-dup-deps don't remove duplicate dependency libraries
2531 --quiet, --silent don't print informational messages
2532 --tag=TAG use configuration variables from tag TAG
2533 -v, --verbose print more informational messages than default
2534 --version print version information
2535 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2536 -h, --help, --help-all print short, long, or detailed help message
2539 # Additional text appended to 'usage_message' in response to '--help'.
2545 $ECHO "$long_help_message
2547 MODE must be one of the following:
2549 clean remove files from the build directory
2550 compile compile a source file into a libtool object
2551 execute automatically set library path, then run a program
2552 finish complete the installation of libtool libraries
2553 install install libraries or executables
2554 link create a library or an executable
2555 uninstall remove libraries from an installed directory
2557 MODE-ARGS vary depending on the MODE. When passed as first option,
2558 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2559 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2561 When reporting a bug, please describe a test case to reproduce it and
2562 include the following information:
2567 compiler flags: $LTCFLAGS
2568 linker: $LD (gnu? $with_gnu_ld)
2569 version: $progname (GNU libtool) 2.4.6
2570 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2571 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2573 Report bugs to <bug-libtool@gnu.org>.
2574 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2575 General help using GNU software: <http://www.gnu.org/gethelp/>."
2580 # func_lo2o OBJECT-NAME
2581 # ---------------------
2582 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2585 lo2o=s/\\.lo\$/.$objext/
2586 o2lo=s/\\.$objext\$/.lo/
2588 if test yes = "$_G_HAVE_XSI_OPS"; then
2592 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2593 * ) func_lo2o_result=$1 ;;
2597 # func_xform LIBOBJ-OR-SOURCE
2598 # ---------------------------
2599 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2600 # suffix to a '.lo' libtool-object suffix.
2603 func_xform_result=${1%.*}.lo
2606 # ...otherwise fall back to using sed.
2609 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2614 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2619 # func_fatal_configuration ARG...
2620 # -------------------------------
2621 # Echo program name prefixed message to standard error, followed by
2622 # a configuration failure hint, and exit.
2623 func_fatal_configuration ()
2625 func__fatal_error ${1+"$@"} \
2626 "See the $PACKAGE documentation for more information." \
2627 "Fatal configuration error."
2633 # Display the configuration for all the tags in this script.
2636 re_begincf='^# ### BEGIN LIBTOOL'
2637 re_endcf='^# ### END LIBTOOL'
2639 # Default configuration.
2640 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2642 # Now print the configurations for the tags.
2643 for tagname in $taglist; do
2644 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2653 # Display the features supported by this script.
2657 if test yes = "$build_libtool_libs"; then
2658 echo "enable shared libraries"
2660 echo "disable shared libraries"
2662 if test yes = "$build_old_libs"; then
2663 echo "enable static libraries"
2665 echo "disable static libraries"
2672 # func_enable_tag TAGNAME
2673 # -----------------------
2674 # Verify that TAGNAME is valid, and either flag an error and exit, or
2675 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2682 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2683 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2684 sed_extractcf=/$re_begincf/,/$re_endcf/p
2689 func_fatal_error "invalid tag name: $tagname"
2693 # Don't test for the "default" C tag, as we know it's
2694 # there but not specially marked.
2698 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2699 taglist="$taglist $tagname"
2701 # Evaluate the configuration. Be careful to quote the path
2702 # and the sed script, to avoid splitting on whitespace, but
2703 # also don't use non-portable quotes within backquotes within
2704 # quotes we have to do it in 2 steps:
2705 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2708 func_error "ignoring unknown tag $tagname"
2715 # func_check_version_match
2716 # ------------------------
2717 # Ensure that we are using m4 macros, and libtool script from the same
2718 # release of libtool.
2719 func_check_version_match ()
2721 if test "$package_revision" != "$macro_revision"; then
2722 if test "$VERSION" != "$macro_version"; then
2723 if test -z "$macro_version"; then
2725 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2726 $progname: definition of this LT_INIT comes from an older release.
2727 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2728 $progname: and run autoconf again.
2732 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2733 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2734 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2735 $progname: and run autoconf again.
2740 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2741 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2742 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2743 $progname: of $PACKAGE $VERSION and run autoconf again.
2752 # libtool_options_prep [ARG]...
2753 # -----------------------------
2754 # Preparation for options parsed by libtool.
2755 libtool_options_prep ()
2765 opt_preserve_dup_deps=false
2771 # Shorthand for --mode=foo, only valid as the first argument
2774 shift; set dummy --mode clean ${1+"$@"}; shift
2776 compile|compil|compi|comp|com|co|c)
2777 shift; set dummy --mode compile ${1+"$@"}; shift
2779 execute|execut|execu|exec|exe|ex|e)
2780 shift; set dummy --mode execute ${1+"$@"}; shift
2782 finish|finis|fini|fin|fi|f)
2783 shift; set dummy --mode finish ${1+"$@"}; shift
2785 install|instal|insta|inst|ins|in|i)
2786 shift; set dummy --mode install ${1+"$@"}; shift
2789 shift; set dummy --mode link ${1+"$@"}; shift
2791 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2792 shift; set dummy --mode uninstall ${1+"$@"}; shift
2796 # Pass back the list of options.
2797 func_quote_for_eval ${1+"$@"}
2798 libtool_options_prep_result=$func_quote_for_eval_result
2800 func_add_hook func_options_prep libtool_options_prep
2803 # libtool_parse_options [ARG]...
2804 # ---------------------------------
2805 # Provide handling for libtool specific options.
2806 libtool_parse_options ()
2810 # Perform our own loop to consume as many options as possible in
2812 while test $# -gt 0; do
2816 --dry-run|--dryrun|-n)
2820 --config) func_config ;;
2823 opt_dlopen="${opt_dlopen+$opt_dlopen
2828 --preserve-dup-deps)
2829 opt_preserve_dup_deps=: ;;
2831 --features) func_features ;;
2833 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2835 --help) opt_help=: ;;
2837 --help-all) opt_help=': help-all' ;;
2839 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2842 # Valid mode arguments:
2843 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2845 # Catch anything else as an error
2846 *) func_error "invalid argument for $_G_opt"
2854 --no-silent|--no-quiet)
2856 func_append preserve_args " $_G_opt"
2859 --no-warnings|--no-warning|--no-warn)
2861 func_append preserve_args " $_G_opt"
2866 func_append preserve_args " $_G_opt"
2872 func_append preserve_args " $_G_opt"
2875 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2877 func_append preserve_args " $_G_opt $1"
2878 func_enable_tag "$1"
2882 --verbose|-v) opt_quiet=false
2884 func_append preserve_args " $_G_opt"
2887 # An option not handled by this hook function:
2888 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2893 # save modified positional parameters for caller
2894 func_quote_for_eval ${1+"$@"}
2895 libtool_parse_options_result=$func_quote_for_eval_result
2897 func_add_hook func_parse_options libtool_parse_options
2901 # libtool_validate_options [ARG]...
2902 # ---------------------------------
2903 # Perform any sanity checks on option settings and/or unconsumed
2905 libtool_validate_options ()
2907 # save first non-option argument
2908 if test 0 -lt $#; then
2914 test : = "$debug_cmd" || func_append preserve_args " --debug"
2917 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2918 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2919 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
2920 # don't eliminate duplications in $postdeps and $predeps
2921 opt_duplicate_compiler_generated_deps=:
2924 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2929 # Sanity checks first:
2930 func_check_version_match
2932 test yes != "$build_libtool_libs" \
2933 && test yes != "$build_old_libs" \
2934 && func_fatal_configuration "not configured to build any kind of library"
2937 eval std_shrext=\"$shrext_cmds\"
2939 # Only execute mode is allowed to have -dlopen flags.
2940 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2941 func_error "unrecognized option '-dlopen'"
2946 # Change the help message to a mode-specific one.
2948 help="Try '$progname --help --mode=$opt_mode' for more information."
2951 # Pass back the unparsed argument list
2952 func_quote_for_eval ${1+"$@"}
2953 libtool_validate_options_result=$func_quote_for_eval_result
2955 func_add_hook func_validate_options libtool_validate_options
2958 # Process options as early as possible so that --help and --version
2959 # can return quickly.
2960 func_options ${1+"$@"}
2961 eval set dummy "$func_options_result"; shift
2969 magic='%%%MAGIC variable%%%'
2970 magic_exe='%%%MAGIC EXE variable%%%'
2976 # If this variable is set in any of the actions, the command in it
2977 # will be execed at the end. This prevents here-documents from being
2978 # left over by shells.
2982 # A function that is used when there is no print builtin or printf.
2983 func_fallback_echo ()
2985 eval 'cat <<_LTECHO_EOF
2990 # func_generated_by_libtool
2991 # True iff stdin has been generated by Libtool. This function is only
2992 # a basic sanity check; it will hardly flush out determined imposters.
2993 func_generated_by_libtool_p ()
2995 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
2999 # True iff FILE is a libtool '.la' library or '.lo' object file.
3000 # This function is only a basic sanity check; it will hardly flush out
3001 # determined imposters.
3005 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
3008 # func_lalib_unsafe_p file
3009 # True iff FILE is a libtool '.la' library or '.lo' object file.
3010 # This function implements the same check as func_lalib_p without
3011 # resorting to external programs. To this end, it redirects stdin and
3012 # closes it afterwards, without saving the original file descriptor.
3013 # As a safety measure, use it only where a negative result would be
3014 # fatal anyway. Works if 'file' does not exist.
3015 func_lalib_unsafe_p ()
3018 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
3019 for lalib_p_l in 1 2 3 4
3022 case $lalib_p_line in
3023 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
3028 test yes = "$lalib_p"
3031 # func_ltwrapper_script_p file
3032 # True iff FILE is a libtool wrapper script
3033 # This function is only a basic sanity check; it will hardly flush out
3034 # determined imposters.
3035 func_ltwrapper_script_p ()
3038 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
3041 # func_ltwrapper_executable_p file
3042 # True iff FILE is a libtool wrapper executable
3043 # This function is only a basic sanity check; it will hardly flush out
3044 # determined imposters.
3045 func_ltwrapper_executable_p ()
3047 func_ltwrapper_exec_suffix=
3050 *) func_ltwrapper_exec_suffix=.exe ;;
3052 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
3055 # func_ltwrapper_scriptname file
3056 # Assumes file is an ltwrapper_executable
3057 # uses $file to determine the appropriate filename for a
3058 # temporary ltwrapper_script.
3059 func_ltwrapper_scriptname ()
3061 func_dirname_and_basename "$1" "" "."
3062 func_stripname '' '.exe' "$func_basename_result"
3063 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
3066 # func_ltwrapper_p file
3067 # True iff FILE is a libtool wrapper script or wrapper executable
3068 # This function is only a basic sanity check; it will hardly flush out
3069 # determined imposters.
3072 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
3076 # func_execute_cmds commands fail_cmd
3077 # Execute tilde-delimited COMMANDS.
3078 # If FAIL_CMD is given, eval that upon failure.
3079 # FAIL_CMD may read-access the current command in variable CMD!
3080 func_execute_cmds ()
3084 save_ifs=$IFS; IFS='~'
3089 func_show_eval "$cmd" "${2-:}"
3096 # Source FILE, adding directory component if necessary.
3097 # Note that it is not necessary on cygwin/mingw to append a dot to
3098 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
3099 # behavior happens only for exec(3), not for open(2)! Also, sourcing
3100 # 'FILE.' does not work on cygwin managed mounts.
3106 */* | *\\*) . "$1" ;;
3112 # func_resolve_sysroot PATH
3113 # Replace a leading = in PATH with a sysroot. Store the result into
3114 # func_resolve_sysroot_result
3115 func_resolve_sysroot ()
3117 func_resolve_sysroot_result=$1
3118 case $func_resolve_sysroot_result in
3120 func_stripname '=' '' "$func_resolve_sysroot_result"
3121 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
3126 # func_replace_sysroot PATH
3127 # If PATH begins with the sysroot, replace it with = and
3128 # store the result into func_replace_sysroot_result.
3129 func_replace_sysroot ()
3131 case $lt_sysroot:$1 in
3133 func_stripname "$lt_sysroot" '' "$1"
3134 func_replace_sysroot_result='='$func_stripname_result
3137 # Including no sysroot.
3138 func_replace_sysroot_result=$1
3143 # func_infer_tag arg
3144 # Infer tagged configuration to use if any are available and
3145 # if one wasn't chosen via the "--tag" command line option.
3146 # Only attempt this if the compiler in the base compile
3147 # command doesn't match the default compiler.
3148 # arg is usually of the form 'gcc ...'
3153 if test -n "$available_tags" && test -z "$tagname"; then
3156 func_append_quoted CC_quoted "$arg"
3158 CC_expanded=`func_echo_all $CC`
3159 CC_quoted_expanded=`func_echo_all $CC_quoted`
3161 # Blanks in the command may have been stripped by the calling shell,
3162 # but not from the CC environment variable when configure was run.
3163 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
3164 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
3165 # Blanks at the start of $base_compile will cause this to fail
3166 # if we don't check for them as well.
3168 for z in $available_tags; do
3169 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
3170 # Evaluate the configuration.
3171 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
3174 # Double-quote args containing other shell metacharacters.
3175 func_append_quoted CC_quoted "$arg"
3177 CC_expanded=`func_echo_all $CC`
3178 CC_quoted_expanded=`func_echo_all $CC_quoted`
3180 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
3181 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
3182 # The compiler in the base compile command matches
3183 # the one in the tagged configuration.
3184 # Assume this is the tagged configuration we want.
3191 # If $tagname still isn't set, then no tagged configuration
3192 # was found and let the user know that the "--tag" command
3193 # line option must be used.
3194 if test -z "$tagname"; then
3195 func_echo "unable to infer tagged configuration"
3196 func_fatal_error "specify a tag with '--tag'"
3198 # func_verbose "using $tagname tagged configuration"
3207 # func_write_libtool_object output_name pic_name nonpic_name
3208 # Create a libtool object file (analogous to a ".la" file),
3209 # but don't create it if we're doing a dry run.
3210 func_write_libtool_object ()
3213 if test yes = "$build_libtool_libs"; then
3219 if test yes = "$build_old_libs"; then
3226 cat >${write_libobj}T <<EOF
3227 # $write_libobj - a libtool object file
3228 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
3230 # Please DO NOT delete this file!
3231 # It is necessary for linking the library.
3233 # Name of the PIC object.
3234 pic_object=$write_lobj
3236 # Name of the non-PIC object
3237 non_pic_object=$write_oldobj
3240 $MV "${write_libobj}T" "$write_libobj"
3245 ##################################################
3246 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
3247 ##################################################
3249 # func_convert_core_file_wine_to_w32 ARG
3250 # Helper function used by file name conversion functions when $build is *nix,
3251 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
3252 # correctly configured wine environment available, with the winepath program
3253 # in $build's $PATH.
3255 # ARG is the $build file name to be converted to w32 format.
3256 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
3257 # be empty on error (or when ARG is empty)
3258 func_convert_core_file_wine_to_w32 ()
3262 func_convert_core_file_wine_to_w32_result=$1
3263 if test -n "$1"; then
3264 # Unfortunately, winepath does not exit with a non-zero error code, so we
3265 # are forced to check the contents of stdout. On the other hand, if the
3266 # command is not found, the shell will set an exit code of 127 and print
3267 # *an error message* to stdout. So we must check for both error code of
3268 # zero AND non-empty stdout, which explains the odd construction:
3269 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
3270 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
3271 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
3272 $SED -e "$sed_naive_backslashify"`
3274 func_convert_core_file_wine_to_w32_result=
3278 # end: func_convert_core_file_wine_to_w32
3281 # func_convert_core_path_wine_to_w32 ARG
3282 # Helper function used by path conversion functions when $build is *nix, and
3283 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
3284 # configured wine environment available, with the winepath program in $build's
3285 # $PATH. Assumes ARG has no leading or trailing path separator characters.
3287 # ARG is path to be converted from $build format to win32.
3288 # Result is available in $func_convert_core_path_wine_to_w32_result.
3289 # Unconvertible file (directory) names in ARG are skipped; if no directory names
3290 # are convertible, then the result may be empty.
3291 func_convert_core_path_wine_to_w32 ()
3295 # unfortunately, winepath doesn't convert paths, only file names
3296 func_convert_core_path_wine_to_w32_result=
3297 if test -n "$1"; then
3300 for func_convert_core_path_wine_to_w32_f in $1; do
3302 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
3303 if test -n "$func_convert_core_file_wine_to_w32_result"; then
3304 if test -z "$func_convert_core_path_wine_to_w32_result"; then
3305 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
3307 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
3314 # end: func_convert_core_path_wine_to_w32
3317 # func_cygpath ARGS...
3318 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
3319 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
3320 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
3321 # (2), returns the Cygwin file name or path in func_cygpath_result (input
3322 # file name or path is assumed to be in w32 format, as previously converted
3323 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
3324 # or path in func_cygpath_result (input file name or path is assumed to be in
3325 # Cygwin format). Returns an empty string on error.
3327 # ARGS are passed to cygpath, with the last one being the file name or path to
3330 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
3331 # environment variable; do not put it in $PATH.
3336 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
3337 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
3338 if test "$?" -ne 0; then
3339 # on failure, ensure result is empty
3340 func_cygpath_result=
3343 func_cygpath_result=
3344 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
3350 # func_convert_core_msys_to_w32 ARG
3351 # Convert file name or path ARG from MSYS format to w32 format. Return
3352 # result in func_convert_core_msys_to_w32_result.
3353 func_convert_core_msys_to_w32 ()
3357 # awkward: cmd appends spaces to result
3358 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
3359 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
3361 #end: func_convert_core_msys_to_w32
3364 # func_convert_file_check ARG1 ARG2
3365 # Verify that ARG1 (a file name in $build format) was converted to $host
3366 # format in ARG2. Otherwise, emit an error message, but continue (resetting
3367 # func_to_host_file_result to ARG1).
3368 func_convert_file_check ()
3372 if test -z "$2" && test -n "$1"; then
3373 func_error "Could not determine host file name corresponding to"
3375 func_error "Continuing, but uninstalled executables may not work."
3377 func_to_host_file_result=$1
3380 # end func_convert_file_check
3383 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
3384 # Verify that FROM_PATH (a path in $build format) was converted to $host
3385 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
3386 # func_to_host_file_result to a simplistic fallback value (see below).
3387 func_convert_path_check ()
3391 if test -z "$4" && test -n "$3"; then
3392 func_error "Could not determine the host path corresponding to"
3394 func_error "Continuing, but uninstalled executables may not work."
3395 # Fallback. This is a deliberately simplistic "conversion" and
3396 # should not be "improved". See libtool.info.
3397 if test "x$1" != "x$2"; then
3398 lt_replace_pathsep_chars="s|$1|$2|g"
3399 func_to_host_path_result=`echo "$3" |
3400 $SED -e "$lt_replace_pathsep_chars"`
3402 func_to_host_path_result=$3
3406 # end func_convert_path_check
3409 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
3410 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
3411 # and appending REPL if ORIG matches BACKPAT.
3412 func_convert_path_front_back_pathsep ()
3417 $1 ) func_to_host_path_result=$3$func_to_host_path_result
3421 $2 ) func_append func_to_host_path_result "$3"
3425 # end func_convert_path_front_back_pathsep
3428 ##################################################
3429 # $build to $host FILE NAME CONVERSION FUNCTIONS #
3430 ##################################################
3431 # invoked via '$to_host_file_cmd ARG'
3433 # In each case, ARG is the path to be converted from $build to $host format.
3434 # Result will be available in $func_to_host_file_result.
3437 # func_to_host_file ARG
3438 # Converts the file name ARG from $build format to $host format. Return result
3439 # in func_to_host_file_result.
3440 func_to_host_file ()
3444 $to_host_file_cmd "$1"
3446 # end func_to_host_file
3449 # func_to_tool_file ARG LAZY
3450 # converts the file name ARG from $build format to toolchain format. Return
3451 # result in func_to_tool_file_result. If the conversion in use is listed
3452 # in (the comma separated) LAZY, no conversion takes place.
3453 func_to_tool_file ()
3458 *,"$to_tool_file_cmd",*)
3459 func_to_tool_file_result=$1
3462 $to_tool_file_cmd "$1"
3463 func_to_tool_file_result=$func_to_host_file_result
3467 # end func_to_tool_file
3470 # func_convert_file_noop ARG
3471 # Copy ARG to func_to_host_file_result.
3472 func_convert_file_noop ()
3474 func_to_host_file_result=$1
3476 # end func_convert_file_noop
3479 # func_convert_file_msys_to_w32 ARG
3480 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
3481 # conversion to w32 is not available inside the cwrapper. Returns result in
3482 # func_to_host_file_result.
3483 func_convert_file_msys_to_w32 ()
3487 func_to_host_file_result=$1
3488 if test -n "$1"; then
3489 func_convert_core_msys_to_w32 "$1"
3490 func_to_host_file_result=$func_convert_core_msys_to_w32_result
3492 func_convert_file_check "$1" "$func_to_host_file_result"
3494 # end func_convert_file_msys_to_w32
3497 # func_convert_file_cygwin_to_w32 ARG
3498 # Convert file name ARG from Cygwin to w32 format. Returns result in
3499 # func_to_host_file_result.
3500 func_convert_file_cygwin_to_w32 ()
3504 func_to_host_file_result=$1
3505 if test -n "$1"; then
3506 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3507 # LT_CYGPATH in this case.
3508 func_to_host_file_result=`cygpath -m "$1"`
3510 func_convert_file_check "$1" "$func_to_host_file_result"
3512 # end func_convert_file_cygwin_to_w32
3515 # func_convert_file_nix_to_w32 ARG
3516 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3517 # and a working winepath. Returns result in func_to_host_file_result.
3518 func_convert_file_nix_to_w32 ()
3522 func_to_host_file_result=$1
3523 if test -n "$1"; then
3524 func_convert_core_file_wine_to_w32 "$1"
3525 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3527 func_convert_file_check "$1" "$func_to_host_file_result"
3529 # end func_convert_file_nix_to_w32
3532 # func_convert_file_msys_to_cygwin ARG
3533 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3534 # Returns result in func_to_host_file_result.
3535 func_convert_file_msys_to_cygwin ()
3539 func_to_host_file_result=$1
3540 if test -n "$1"; then
3541 func_convert_core_msys_to_w32 "$1"
3542 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3543 func_to_host_file_result=$func_cygpath_result
3545 func_convert_file_check "$1" "$func_to_host_file_result"
3547 # end func_convert_file_msys_to_cygwin
3550 # func_convert_file_nix_to_cygwin ARG
3551 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3552 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3553 # in func_to_host_file_result.
3554 func_convert_file_nix_to_cygwin ()
3558 func_to_host_file_result=$1
3559 if test -n "$1"; then
3560 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3561 func_convert_core_file_wine_to_w32 "$1"
3562 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3563 func_to_host_file_result=$func_cygpath_result
3565 func_convert_file_check "$1" "$func_to_host_file_result"
3567 # end func_convert_file_nix_to_cygwin
3570 #############################################
3571 # $build to $host PATH CONVERSION FUNCTIONS #
3572 #############################################
3573 # invoked via '$to_host_path_cmd ARG'
3575 # In each case, ARG is the path to be converted from $build to $host format.
3576 # The result will be available in $func_to_host_path_result.
3578 # Path separators are also converted from $build format to $host format. If
3579 # ARG begins or ends with a path separator character, it is preserved (but
3580 # converted to $host format) on output.
3582 # All path conversion functions are named using the following convention:
3583 # file name conversion function : func_convert_file_X_to_Y ()
3584 # path conversion function : func_convert_path_X_to_Y ()
3585 # where, for any given $build/$host combination the 'X_to_Y' value is the
3586 # same. If conversion functions are added for new $build/$host combinations,
3587 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3591 # func_init_to_host_path_cmd
3592 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3593 # appropriate value, based on the value of $to_host_file_cmd.
3595 func_init_to_host_path_cmd ()
3599 if test -z "$to_host_path_cmd"; then
3600 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3601 to_host_path_cmd=func_convert_path_$func_stripname_result
3606 # func_to_host_path ARG
3607 # Converts the path ARG from $build format to $host format. Return result
3608 # in func_to_host_path_result.
3609 func_to_host_path ()
3613 func_init_to_host_path_cmd
3614 $to_host_path_cmd "$1"
3616 # end func_to_host_path
3619 # func_convert_path_noop ARG
3620 # Copy ARG to func_to_host_path_result.
3621 func_convert_path_noop ()
3623 func_to_host_path_result=$1
3625 # end func_convert_path_noop
3628 # func_convert_path_msys_to_w32 ARG
3629 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3630 # conversion to w32 is not available inside the cwrapper. Returns result in
3631 # func_to_host_path_result.
3632 func_convert_path_msys_to_w32 ()
3636 func_to_host_path_result=$1
3637 if test -n "$1"; then
3638 # Remove leading and trailing path separator characters from ARG. MSYS
3639 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3640 # and winepath ignores them completely.
3641 func_stripname : : "$1"
3642 func_to_host_path_tmp1=$func_stripname_result
3643 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3644 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3645 func_convert_path_check : ";" \
3646 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3647 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3650 # end func_convert_path_msys_to_w32
3653 # func_convert_path_cygwin_to_w32 ARG
3654 # Convert path ARG from Cygwin to w32 format. Returns result in
3655 # func_to_host_file_result.
3656 func_convert_path_cygwin_to_w32 ()
3660 func_to_host_path_result=$1
3661 if test -n "$1"; then
3662 # See func_convert_path_msys_to_w32:
3663 func_stripname : : "$1"
3664 func_to_host_path_tmp1=$func_stripname_result
3665 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3666 func_convert_path_check : ";" \
3667 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3668 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3671 # end func_convert_path_cygwin_to_w32
3674 # func_convert_path_nix_to_w32 ARG
3675 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3676 # a working winepath. Returns result in func_to_host_file_result.
3677 func_convert_path_nix_to_w32 ()
3681 func_to_host_path_result=$1
3682 if test -n "$1"; then
3683 # See func_convert_path_msys_to_w32:
3684 func_stripname : : "$1"
3685 func_to_host_path_tmp1=$func_stripname_result
3686 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3687 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3688 func_convert_path_check : ";" \
3689 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3690 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3693 # end func_convert_path_nix_to_w32
3696 # func_convert_path_msys_to_cygwin ARG
3697 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3698 # Returns result in func_to_host_file_result.
3699 func_convert_path_msys_to_cygwin ()
3703 func_to_host_path_result=$1
3704 if test -n "$1"; then
3705 # See func_convert_path_msys_to_w32:
3706 func_stripname : : "$1"
3707 func_to_host_path_tmp1=$func_stripname_result
3708 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3709 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3710 func_to_host_path_result=$func_cygpath_result
3711 func_convert_path_check : : \
3712 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3713 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3716 # end func_convert_path_msys_to_cygwin
3719 # func_convert_path_nix_to_cygwin ARG
3720 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3721 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3722 # func_to_host_file_result.
3723 func_convert_path_nix_to_cygwin ()
3727 func_to_host_path_result=$1
3728 if test -n "$1"; then
3729 # Remove leading and trailing path separator characters from
3730 # ARG. msys behavior is inconsistent here, cygpath turns them
3731 # into '.;' and ';.', and winepath ignores them completely.
3732 func_stripname : : "$1"
3733 func_to_host_path_tmp1=$func_stripname_result
3734 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3735 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3736 func_to_host_path_result=$func_cygpath_result
3737 func_convert_path_check : : \
3738 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3739 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3742 # end func_convert_path_nix_to_cygwin
3745 # func_dll_def_p FILE
3746 # True iff FILE is a Windows DLL '.def' file.
3747 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3752 func_dll_def_p_tmp=`$SED -n \
3754 -e '/^\(;.*\)*$/d' \
3755 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3758 test DEF = "$func_dll_def_p_tmp"
3762 # func_mode_compile arg...
3763 func_mode_compile ()
3767 # Get the compilation command and the source file.
3769 srcfile=$nonopt # always keep a non-empty value in "srcfile"
3781 # do not "continue". Instead, add this to base_compile
3793 # Accept any command-line options.
3796 test -n "$libobj" && \
3797 func_fatal_error "you cannot specify '-o' more than once"
3802 -pie | -fpie | -fPIE)
3803 func_append pie_flag " $arg"
3807 -shared | -static | -prefer-pic | -prefer-non-pic)
3808 func_append later " $arg"
3818 arg_mode=arg # the next one goes into the "base_compile" arg list
3819 continue # The current "srcfile" will either be retained or
3820 ;; # replaced later. I would guess that would be a bug.
3823 func_stripname '-Wc,' '' "$arg"
3824 args=$func_stripname_result
3826 save_ifs=$IFS; IFS=,
3827 for arg in $args; do
3829 func_append_quoted lastarg "$arg"
3832 func_stripname ' ' '' "$lastarg"
3833 lastarg=$func_stripname_result
3835 # Add the arguments to base_compile.
3836 func_append base_compile " $lastarg"
3841 # Accept the current argument as the source file.
3842 # The previous "srcfile" becomes the current argument.
3849 esac # case $arg_mode
3851 # Aesthetically quote the previous argument.
3852 func_append_quoted base_compile "$lastarg"
3857 func_fatal_error "you must specify an argument for -Xcompile"
3860 func_fatal_error "you must specify a target with '-o'"
3863 # Get the name of the library object.
3864 test -z "$libobj" && {
3865 func_basename "$srcfile"
3866 libobj=$func_basename_result
3871 # Recognize several different file suffixes.
3872 # If the user specifies -o file.o, it is replaced with file.lo
3875 *.ada | *.adb | *.ads | *.asm | \
3876 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3877 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3878 func_xform "$libobj"
3879 libobj=$func_xform_result
3884 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3886 func_fatal_error "cannot determine name of library object from '$libobj'"
3890 func_infer_tag $base_compile
3892 for arg in $later; do
3895 test yes = "$build_libtool_libs" \
3896 || func_fatal_configuration "cannot build a shared library"
3902 build_libtool_libs=no
3919 func_quote_for_eval "$libobj"
3920 test "X$libobj" != "X$func_quote_for_eval_result" \
3921 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3922 && func_warning "libobj name '$libobj' may not contain shell special characters."
3923 func_dirname_and_basename "$obj" "/" ""
3924 objname=$func_basename_result
3925 xdir=$func_dirname_result
3926 lobj=$xdir$objdir/$objname
3928 test -z "$base_compile" && \
3929 func_fatal_help "you must specify a compilation command"
3931 # Delete any leftover library objects.
3932 if test yes = "$build_old_libs"; then
3933 removelist="$obj $lobj $libobj ${libobj}T"
3935 removelist="$lobj $libobj ${libobj}T"
3938 # On Cygwin there's no "real" PIC flag so we must build both object types
3940 cygwin* | mingw* | pw32* | os2* | cegcc*)
3944 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3945 # non-PIC code in shared libraries is not supported
3949 # Calculate the filename of the output object if compiler does
3950 # not support -o with -c
3951 if test no = "$compiler_c_o"; then
3952 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3953 lockfile=$output_obj.lock
3960 # Lock this critical section if it is needed
3961 # We use this script file to make the link, it avoids creating a new file
3962 if test yes = "$need_locks"; then
3963 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3964 func_echo "Waiting for $lockfile to be removed"
3967 elif test warn = "$need_locks"; then
3968 if test -f "$lockfile"; then
3970 *** ERROR, $lockfile exists and contains:
3971 `cat $lockfile 2>/dev/null`
3973 This indicates that another process is trying to use the same
3974 temporary object file, and libtool could not work around it because
3975 your compiler does not support '-c' and '-o' together. If you
3976 repeat this compilation, it may succeed, by chance, but you had better
3977 avoid parallel builds (make -j) in this platform, or get a better
3980 $opt_dry_run || $RM $removelist
3983 func_append removelist " $output_obj"
3984 $ECHO "$srcfile" > "$lockfile"
3987 $opt_dry_run || $RM $removelist
3988 func_append removelist " $lockfile"
3989 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
3991 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3992 srcfile=$func_to_tool_file_result
3993 func_quote_for_eval "$srcfile"
3994 qsrcfile=$func_quote_for_eval_result
3996 # Only build a PIC object if we are building libtool libraries.
3997 if test yes = "$build_libtool_libs"; then
3998 # Without this assignment, base_compile gets emptied.
3999 fbsd_hideous_sh_bug=$base_compile
4001 if test no != "$pic_mode"; then
4002 command="$base_compile $qsrcfile $pic_flag"
4004 # Don't build PIC code
4005 command="$base_compile $qsrcfile"
4008 func_mkdir_p "$xdir$objdir"
4010 if test -z "$output_obj"; then
4011 # Place PIC objects in $objdir
4012 func_append command " -o $lobj"
4015 func_show_eval_locale "$command" \
4016 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
4018 if test warn = "$need_locks" &&
4019 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
4021 *** ERROR, $lockfile contains:
4022 `cat $lockfile 2>/dev/null`
4024 but it should contain:
4027 This indicates that another process is trying to use the same
4028 temporary object file, and libtool could not work around it because
4029 your compiler does not support '-c' and '-o' together. If you
4030 repeat this compilation, it may succeed, by chance, but you had better
4031 avoid parallel builds (make -j) in this platform, or get a better
4034 $opt_dry_run || $RM $removelist
4038 # Just move the object if needed, then go on to compile the next one
4039 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
4040 func_show_eval '$MV "$output_obj" "$lobj"' \
4041 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
4044 # Allow error messages only from the first compilation.
4045 if test yes = "$suppress_opt"; then
4046 suppress_output=' >/dev/null 2>&1'
4050 # Only build a position-dependent object if we build old libraries.
4051 if test yes = "$build_old_libs"; then
4052 if test yes != "$pic_mode"; then
4053 # Don't build PIC code
4054 command="$base_compile $qsrcfile$pie_flag"
4056 command="$base_compile $qsrcfile $pic_flag"
4058 if test yes = "$compiler_c_o"; then
4059 func_append command " -o $obj"
4062 # Suppress compiler output if we already did a PIC compilation.
4063 func_append command "$suppress_output"
4064 func_show_eval_locale "$command" \
4065 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
4067 if test warn = "$need_locks" &&
4068 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
4070 *** ERROR, $lockfile contains:
4071 `cat $lockfile 2>/dev/null`
4073 but it should contain:
4076 This indicates that another process is trying to use the same
4077 temporary object file, and libtool could not work around it because
4078 your compiler does not support '-c' and '-o' together. If you
4079 repeat this compilation, it may succeed, by chance, but you had better
4080 avoid parallel builds (make -j) in this platform, or get a better
4083 $opt_dry_run || $RM $removelist
4087 # Just move the object if needed
4088 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
4089 func_show_eval '$MV "$output_obj" "$obj"' \
4090 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
4095 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
4097 # Unlock the critical section if it was locked
4098 if test no != "$need_locks"; then
4099 removelist=$lockfile
4108 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
4113 # We need to display help for each of the modes.
4116 # Generic help is extracted from the usage comments
4117 # at the start of this file.
4123 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4125 Remove files from the build directory.
4127 RM is the name of the program to use to delete files associated with each FILE
4128 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4131 If FILE is a libtool library, object or program, all the files associated
4132 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4137 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4139 Compile a source file into a libtool library object.
4141 This mode accepts the following additional options:
4143 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4144 -no-suppress do not suppress compiler output for multiple passes
4145 -prefer-pic try to build PIC objects only
4146 -prefer-non-pic try to build non-PIC objects only
4147 -shared do not build a '.o' file suitable for static linking
4148 -static only build a '.o' file suitable for static linking
4149 -Wc,FLAG pass FLAG directly to the compiler
4151 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
4152 from the given SOURCEFILE.
4154 The output file name is determined by removing the directory component from
4155 SOURCEFILE, then substituting the C source code suffix '.c' with the
4156 library object suffix, '.lo'."
4161 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
4163 Automatically set library path, then run a program.
4165 This mode accepts the following additional options:
4167 -dlopen FILE add the directory containing FILE to the library path
4169 This mode sets the library path environment variable according to '-dlopen'
4172 If any of the ARGS are libtool executable wrappers, then they are translated
4173 into their corresponding uninstalled binary, and any of their required library
4174 directories are added to the library path.
4176 Then, COMMAND is executed, with ARGS as arguments."
4181 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
4183 Complete the installation of libtool libraries.
4185 Each LIBDIR is a directory that contains libtool libraries.
4187 The commands that this mode executes may require superuser privileges. Use
4188 the '--dry-run' option if you just want to see what would be executed."
4193 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
4195 Install executables or libraries.
4197 INSTALL-COMMAND is the installation command. The first component should be
4198 either the 'install' or 'cp' program.
4200 The following components of INSTALL-COMMAND are treated specially:
4202 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
4204 The rest of the components are interpreted as arguments to that command (only
4205 BSD-compatible install options are recognized)."
4210 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
4212 Link object files or libraries together to form another library, or to
4213 create an executable program.
4215 LINK-COMMAND is a command using the C compiler that you would use to create
4216 a program from several object files.
4218 The following components of LINK-COMMAND are treated specially:
4220 -all-static do not do any dynamic linking at all
4221 -avoid-version do not add a version suffix if possible
4222 -bindir BINDIR specify path to binaries directory (for systems where
4223 libraries must be found in the PATH setting at runtime)
4224 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
4225 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4226 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4227 -export-symbols SYMFILE
4228 try to export only the symbols listed in SYMFILE
4229 -export-symbols-regex REGEX
4230 try to export only the symbols matching REGEX
4231 -LLIBDIR search LIBDIR for required installed libraries
4232 -lNAME OUTPUT-FILE requires the installed library libNAME
4233 -module build a library that can dlopened
4234 -no-fast-install disable the fast-install mode
4235 -no-install link a not-installable executable
4236 -no-undefined declare that a library does not refer to external symbols
4237 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4238 -objectlist FILE use a list of object files found in FILE to specify objects
4239 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
4240 -precious-files-regex REGEX
4241 don't remove output files matching REGEX
4242 -release RELEASE specify package release information
4243 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4244 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4245 -shared only do dynamic linking of libtool libraries
4246 -shrext SUFFIX override the standard shared library file extension
4247 -static do not do any dynamic linking of uninstalled libtool libraries
4248 -static-libtool-libs
4249 do not do any dynamic linking of libtool libraries
4250 -version-info CURRENT[:REVISION[:AGE]]
4251 specify library version info [each variable defaults to 0]
4252 -weak LIBNAME declare that the target provides the LIBNAME interface
4254 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
4256 -Xlinker FLAG pass linker-specific FLAG directly to the linker
4257 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
4259 All other options (arguments beginning with '-') are ignored.
4261 Every other argument is treated as a filename. Files ending in '.la' are
4262 treated as uninstalled libtool libraries, other files are standard or library
4265 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
4266 only library objects ('.lo' files) may be specified, and '-rpath' is
4267 required, except when creating a convenience library.
4269 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
4270 using 'ar' and 'ranlib', or on Windows using 'lib'.
4272 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
4273 is created, otherwise an executable program is created."
4278 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4280 Remove libraries from an installation directory.
4282 RM is the name of the program to use to delete files associated with each FILE
4283 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4286 If FILE is a libtool library, all the files associated with it are deleted.
4287 Otherwise, only FILE itself is deleted using RM."
4291 func_fatal_help "invalid operation mode '$opt_mode'"
4296 $ECHO "Try '$progname --help' for more information about other modes."
4299 # Now that we've collected a possible --mode arg, show help if necessary
4301 if test : = "$opt_help"; then
4306 for opt_mode in compile link execute install finish uninstall clean; do
4309 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
4312 for opt_mode in compile link execute install finish uninstall clean; do
4318 /^When reporting/,/^Report/{
4323 /information about other modes/d
4324 /more detailed .*MODE/d
4325 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
4331 # func_mode_execute arg...
4332 func_mode_execute ()
4336 # The first argument is the command name.
4339 func_fatal_help "you must specify a COMMAND"
4341 # Handle -dlopen flags immediately.
4342 for file in $opt_dlopen; do
4344 || func_fatal_help "'$file' is not a file"
4349 func_resolve_sysroot "$file"
4350 file=$func_resolve_sysroot_result
4352 # Check to see that this really is a libtool archive.
4353 func_lalib_unsafe_p "$file" \
4354 || func_fatal_help "'$lib' is not a valid libtool archive"
4356 # Read the libtool library.
4361 # Skip this library if it cannot be dlopened.
4362 if test -z "$dlname"; then
4363 # Warn if it was a shared library.
4364 test -n "$library_names" && \
4365 func_warning "'$file' was not linked with '-export-dynamic'"
4369 func_dirname "$file" "" "."
4370 dir=$func_dirname_result
4372 if test -f "$dir/$objdir/$dlname"; then
4373 func_append dir "/$objdir"
4375 if test ! -f "$dir/$dlname"; then
4376 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
4382 # Just add the directory containing the .lo file.
4383 func_dirname "$file" "" "."
4384 dir=$func_dirname_result
4388 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
4393 # Get the absolute pathname.
4394 absdir=`cd "$dir" && pwd`
4395 test -n "$absdir" && dir=$absdir
4397 # Now add the directory to shlibpath_var.
4398 if eval "test -z \"\$$shlibpath_var\""; then
4399 eval "$shlibpath_var=\"\$dir\""
4401 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4405 # This variable tells wrapper scripts just to set shlibpath_var
4406 # rather than running their programs.
4407 libtool_execute_magic=$magic
4409 # Check if any of the arguments is a wrapper script.
4414 -* | *.la | *.lo ) ;;
4416 # Do a test to see if this is really a libtool program.
4417 if func_ltwrapper_script_p "$file"; then
4419 # Transform arg to wrapped name.
4420 file=$progdir/$program
4421 elif func_ltwrapper_executable_p "$file"; then
4422 func_ltwrapper_scriptname "$file"
4423 func_source "$func_ltwrapper_scriptname_result"
4424 # Transform arg to wrapped name.
4425 file=$progdir/$program
4429 # Quote arguments (to preserve shell metacharacters).
4430 func_append_quoted args "$file"
4433 if $opt_dry_run; then
4434 # Display what would be done.
4435 if test -n "$shlibpath_var"; then
4436 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
4437 echo "export $shlibpath_var"
4442 if test -n "$shlibpath_var"; then
4443 # Export the shlibpath_var.
4444 eval "export $shlibpath_var"
4447 # Restore saved environment variables
4448 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
4450 eval "if test \"\${save_$lt_var+set}\" = set; then
4451 $lt_var=\$save_$lt_var; export $lt_var
4457 # Now prepare to actually exec the command.
4462 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
4465 # func_mode_finish arg...
4474 for opt in "$nonopt" ${1+"$@"}
4476 if test -d "$opt"; then
4477 func_append libdirs " $opt"
4479 elif test -f "$opt"; then
4480 if func_lalib_unsafe_p "$opt"; then
4481 func_append libs " $opt"
4483 func_warning "'$opt' is not a valid libtool archive"
4487 func_fatal_error "invalid argument '$opt'"
4491 if test -n "$libs"; then
4492 if test -n "$lt_sysroot"; then
4493 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
4494 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
4499 # Remove sysroot references
4500 if $opt_dry_run; then
4501 for lib in $libs; do
4502 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4505 tmpdir=`func_mktempdir`
4506 for lib in $libs; do
4507 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4509 mv -f $tmpdir/tmp-la $lib
4515 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4516 for libdir in $libdirs; do
4517 if test -n "$finish_cmds"; then
4518 # Do each command in the finish commands.
4519 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4522 if test -n "$finish_eval"; then
4523 # Do the single finish_eval.
4524 eval cmds=\"$finish_eval\"
4525 $opt_dry_run || eval "$cmds" || func_append admincmds "
4531 # Exit here if they wanted silent mode.
4532 $opt_quiet && exit $EXIT_SUCCESS
4534 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4535 echo "----------------------------------------------------------------------"
4536 echo "Libraries have been installed in:"
4537 for libdir in $libdirs; do
4541 echo "If you ever happen to want to link against installed libraries"
4542 echo "in a given directory, LIBDIR, you must either use libtool, and"
4543 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4544 echo "flag during linking and do at least one of the following:"
4545 if test -n "$shlibpath_var"; then
4546 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4547 echo " during execution"
4549 if test -n "$runpath_var"; then
4550 echo " - add LIBDIR to the '$runpath_var' environment variable"
4551 echo " during linking"
4553 if test -n "$hardcode_libdir_flag_spec"; then
4555 eval flag=\"$hardcode_libdir_flag_spec\"
4557 $ECHO " - use the '$flag' linker flag"
4559 if test -n "$admincmds"; then
4560 $ECHO " - have your system administrator run these commands:$admincmds"
4562 if test -f /etc/ld.so.conf; then
4563 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4567 echo "See any operating system documentation about shared libraries for"
4569 solaris2.[6789]|solaris2.1[0-9])
4570 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4574 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4577 echo "----------------------------------------------------------------------"
4582 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4585 # func_mode_install arg...
4586 func_mode_install ()
4590 # There may be an optional sh(1) argument at the beginning of
4591 # install_prog (especially on Windows NT).
4592 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4593 # Allow the use of GNU shtool's install command.
4594 case $nonopt in *shtool*) :;; *) false;; esac
4596 # Aesthetically quote it.
4597 func_quote_for_eval "$nonopt"
4598 install_prog="$func_quote_for_eval_result "
4606 # The real first argument should be the name of the installation program.
4607 # Aesthetically quote it.
4608 func_quote_for_eval "$arg"
4609 func_append install_prog "$func_quote_for_eval_result"
4610 install_shared_prog=$install_prog
4611 case " $install_prog " in
4612 *[\\\ /]cp\ *) install_cp=: ;;
4613 *) install_cp=false ;;
4616 # We need to accept at least all the BSD install flags.
4628 if test -n "$dest"; then
4629 func_append files " $dest"
4637 if $install_cp; then :; else
4651 # If the previous option needed an argument, then skip it.
4652 if test -n "$prev"; then
4653 if test X-m = "X$prev" && test -n "$install_override_mode"; then
4654 arg2=$install_override_mode
4665 # Aesthetically quote the argument.
4666 func_quote_for_eval "$arg"
4667 func_append install_prog " $func_quote_for_eval_result"
4668 if test -n "$arg2"; then
4669 func_quote_for_eval "$arg2"
4671 func_append install_shared_prog " $func_quote_for_eval_result"
4674 test -z "$install_prog" && \
4675 func_fatal_help "you must specify an install program"
4677 test -n "$prev" && \
4678 func_fatal_help "the '$prev' option requires an argument"
4680 if test -n "$install_override_mode" && $no_mode; then
4681 if $install_cp; then :; else
4682 func_quote_for_eval "$install_override_mode"
4683 func_append install_shared_prog " -m $func_quote_for_eval_result"
4687 if test -z "$files"; then
4688 if test -z "$dest"; then
4689 func_fatal_help "no file or destination specified"
4691 func_fatal_help "you must specify a destination"
4695 # Strip any trailing slash from the destination.
4696 func_stripname '' '/' "$dest"
4697 dest=$func_stripname_result
4699 # Check to see that the destination is a directory.
4700 test -d "$dest" && isdir=:
4705 func_dirname_and_basename "$dest" "" "."
4706 destdir=$func_dirname_result
4707 destname=$func_basename_result
4709 # Not a directory, so check to see that there is only one file specified.
4710 set dummy $files; shift
4711 test "$#" -gt 1 && \
4712 func_fatal_help "'$dest' is not a directory"
4715 [\\/]* | [A-Za-z]:[\\/]*) ;;
4717 for file in $files; do
4721 func_fatal_help "'$destdir' must be an absolute directory name"
4728 # This variable tells wrapper scripts just to set variables rather
4729 # than running their programs.
4730 libtool_install_magic=$magic
4735 for file in $files; do
4737 # Do each installation.
4740 # Do the static libraries later.
4741 func_append staticlibs " $file"
4745 func_resolve_sysroot "$file"
4746 file=$func_resolve_sysroot_result
4748 # Check to see that this really is a libtool archive.
4749 func_lalib_unsafe_p "$file" \
4750 || func_fatal_help "'$file' is not a valid libtool archive"
4757 # Add the libdir to current_libdirs if it is the destination.
4758 if test "X$destdir" = "X$libdir"; then
4759 case "$current_libdirs " in
4761 *) func_append current_libdirs " $libdir" ;;
4764 # Note the libdir as a future libdir.
4765 case "$future_libdirs " in
4767 *) func_append future_libdirs " $libdir" ;;
4771 func_dirname "$file" "/" ""
4772 dir=$func_dirname_result
4773 func_append dir "$objdir"
4775 if test -n "$relink_command"; then
4776 # Determine the prefix the user has applied to our future dir.
4777 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4779 # Don't allow the user to place us outside of our expected
4780 # location b/c this prevents finding dependent libraries that
4781 # are installed to the same prefix.
4782 # At present, this check doesn't affect windows .dll's that
4783 # are installed into $libdir/../bin (currently, that works fine)
4784 # but it's something to keep an eye on.
4785 test "$inst_prefix_dir" = "$destdir" && \
4786 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
4788 if test -n "$inst_prefix_dir"; then
4789 # Stick the inst_prefix_dir data into the link command.
4790 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4792 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4795 func_warning "relinking '$file'"
4796 func_show_eval "$relink_command" \
4797 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4800 # See the names of the shared library.
4801 set dummy $library_names; shift
4802 if test -n "$1"; then
4807 test -n "$relink_command" && srcname=${realname}T
4809 # Install the shared library and build the symlinks.
4810 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
4814 cygwin* | mingw* | pw32* | cegcc*)
4829 if test -n "$tstripme" && test -n "$striplib"; then
4830 func_show_eval "$striplib $destdir/$realname" 'exit $?'
4833 if test "$#" -gt 0; then
4834 # Delete the old symlinks, and create new ones.
4835 # Try 'ln -sf' first, because the 'ln' binary might depend on
4836 # the symlink we replace! Solaris /bin/ln does not understand -f,
4837 # so we also need to try rm && ln -s.
4840 test "$linkname" != "$realname" \
4841 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4845 # Do each command in the postinstall commands.
4846 lib=$destdir/$realname
4847 func_execute_cmds "$postinstall_cmds" 'exit $?'
4850 # Install the pseudo-library for information purposes.
4851 func_basename "$file"
4852 name=$func_basename_result
4853 instname=$dir/${name}i
4854 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
4856 # Maybe install the static library, too.
4857 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
4861 # Install (i.e. copy) a libtool object.
4863 # Figure out destination file name, if it wasn't already specified.
4864 if test -n "$destname"; then
4865 destfile=$destdir/$destname
4867 func_basename "$file"
4868 destfile=$func_basename_result
4869 destfile=$destdir/$destfile
4872 # Deduce the name of the destination old-style object file.
4875 func_lo2o "$destfile"
4876 staticdest=$func_lo2o_result
4879 staticdest=$destfile
4883 func_fatal_help "cannot copy a libtool object to '$destfile'"
4887 # Install the libtool object if requested.
4888 test -n "$destfile" && \
4889 func_show_eval "$install_prog $file $destfile" 'exit $?'
4891 # Install the old object if enabled.
4892 if test yes = "$build_old_libs"; then
4893 # Deduce the name of the old-style object file.
4895 staticobj=$func_lo2o_result
4896 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
4902 # Figure out destination file name, if it wasn't already specified.
4903 if test -n "$destname"; then
4904 destfile=$destdir/$destname
4906 func_basename "$file"
4907 destfile=$func_basename_result
4908 destfile=$destdir/$destfile
4911 # If the file is missing, and there is a .exe on the end, strip it
4912 # because it is most likely a libtool script we actually want to
4917 if test ! -f "$file"; then
4918 func_stripname '' '.exe' "$file"
4919 file=$func_stripname_result
4925 # Do a test to see if this is really a libtool program.
4928 if func_ltwrapper_executable_p "$file"; then
4929 func_ltwrapper_scriptname "$file"
4930 wrapper=$func_ltwrapper_scriptname_result
4932 func_stripname '' '.exe' "$file"
4933 wrapper=$func_stripname_result
4940 if func_ltwrapper_script_p "$wrapper"; then
4944 func_source "$wrapper"
4946 # Check the variables that should have been set.
4947 test -z "$generated_by_libtool_version" && \
4948 func_fatal_error "invalid libtool wrapper script '$wrapper'"
4951 for lib in $notinst_deplibs; do
4952 # Check to see that each library is installed.
4954 if test -f "$lib"; then
4957 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4958 if test -n "$libdir" && test ! -f "$libfile"; then
4959 func_warning "'$lib' has not been installed in '$libdir'"
4965 func_source "$wrapper"
4968 if test no = "$fast_install" && test -n "$relink_command"; then
4971 tmpdir=`func_mktempdir`
4972 func_basename "$file$stripped_ext"
4973 file=$func_basename_result
4974 outputname=$tmpdir/$file
4975 # Replace the output file specification.
4976 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4979 func_quote_for_expand "$relink_command"
4980 eval "func_echo $func_quote_for_expand_result"
4982 if eval "$relink_command"; then :
4984 func_error "error: relink '$file' with the above command before installing it"
4985 $opt_dry_run || ${RM}r "$tmpdir"
4990 func_warning "cannot relink '$file'"
4994 # Install the binary that we compiled earlier.
4995 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
4999 # remove .exe since cygwin /usr/bin/install will append another
5001 case $install_prog,$host in
5002 */usr/bin/install*,*cygwin*)
5003 case $file:$destfile in
5008 destfile=$destfile.exe
5011 func_stripname '' '.exe' "$destfile"
5012 destfile=$func_stripname_result
5017 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
5018 $opt_dry_run || if test -n "$outputname"; then
5025 for file in $staticlibs; do
5026 func_basename "$file"
5027 name=$func_basename_result
5029 # Set up the ranlib parameters.
5030 oldlib=$destdir/$name
5031 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
5032 tool_oldlib=$func_to_tool_file_result
5034 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
5036 if test -n "$stripme" && test -n "$old_striplib"; then
5037 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
5040 # Do each command in the postinstall commands.
5041 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
5044 test -n "$future_libdirs" && \
5045 func_warning "remember to run '$progname --finish$future_libdirs'"
5047 if test -n "$current_libdirs"; then
5048 # Maybe just do a dry run.
5049 $opt_dry_run && current_libdirs=" -n$current_libdirs"
5050 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
5056 test install = "$opt_mode" && func_mode_install ${1+"$@"}
5059 # func_generate_dlsyms outputname originator pic_p
5060 # Extract symbols from dlprefiles and create ${outputname}S.o with
5061 # a dlpreopen symbol table.
5062 func_generate_dlsyms ()
5069 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
5072 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
5073 if test -n "$NM" && test -n "$global_symbol_pipe"; then
5074 my_dlsyms=${my_outputname}S.c
5076 func_error "not configured to extract global symbols from dlpreopened files"
5080 if test -n "$my_dlsyms"; then
5084 # Discover the nlist of each of the dlfiles.
5085 nlist=$output_objdir/$my_outputname.nm
5087 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
5089 # Parse the name list into a source file.
5090 func_verbose "creating $output_objdir/$my_dlsyms"
5092 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
5093 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
5094 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
5100 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
5101 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
5104 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
5105 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
5106 /* DATA imports from DLLs on WIN32 can't be const, because runtime
5107 relocations are performed -- see ld's documentation on pseudo-relocs. */
5108 # define LT_DLSYM_CONST
5109 #elif defined __osf__
5110 /* This system does not cope well with relocations in const data. */
5111 # define LT_DLSYM_CONST
5113 # define LT_DLSYM_CONST const
5116 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5118 /* External symbol declarations for the compiler. */\
5121 if test yes = "$dlself"; then
5122 func_verbose "generating symbol list for '$output'"
5124 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
5126 # Add our own program objects to the symbol list.
5127 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
5128 for progfile in $progfiles; do
5129 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
5130 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
5131 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
5134 if test -n "$exclude_expsyms"; then
5136 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
5137 eval '$MV "$nlist"T "$nlist"'
5141 if test -n "$export_symbols_regex"; then
5143 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
5144 eval '$MV "$nlist"T "$nlist"'
5148 # Prepare the list of exported symbols
5149 if test -z "$export_symbols"; then
5150 export_symbols=$output_objdir/$outputname.exp
5153 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
5155 *cygwin* | *mingw* | *cegcc* )
5156 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5157 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
5163 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
5164 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
5165 eval '$MV "$nlist"T "$nlist"'
5167 *cygwin* | *mingw* | *cegcc* )
5168 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5169 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
5176 for dlprefile in $dlprefiles; do
5177 func_verbose "extracting global C symbols from '$dlprefile'"
5178 func_basename "$dlprefile"
5179 name=$func_basename_result
5181 *cygwin* | *mingw* | *cegcc* )
5182 # if an import library, we need to obtain dlname
5183 if func_win32_import_lib_p "$dlprefile"; then
5184 func_tr_sh "$dlprefile"
5185 eval "curr_lafile=\$libfile_$func_tr_sh_result"
5186 dlprefile_dlbasename=
5187 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
5188 # Use subshell, to avoid clobbering current variable values
5189 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
5190 if test -n "$dlprefile_dlname"; then
5191 func_basename "$dlprefile_dlname"
5192 dlprefile_dlbasename=$func_basename_result
5194 # no lafile. user explicitly requested -dlpreopen <import library>.
5195 $sharedlib_from_linklib_cmd "$dlprefile"
5196 dlprefile_dlbasename=$sharedlib_from_linklib_result
5200 if test -n "$dlprefile_dlbasename"; then
5201 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
5203 func_warning "Could not compute DLL name from $name"
5204 eval '$ECHO ": $name " >> "$nlist"'
5206 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5207 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
5208 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
5210 else # not an import lib
5212 eval '$ECHO ": $name " >> "$nlist"'
5213 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5214 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5220 eval '$ECHO ": $name " >> "$nlist"'
5221 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5222 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5229 # Make sure we have at least an empty file.
5230 test -f "$nlist" || : > "$nlist"
5232 if test -n "$exclude_expsyms"; then
5233 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
5234 $MV "$nlist"T "$nlist"
5237 # Try sorting and uniquifying the output.
5238 if $GREP -v "^: " < "$nlist" |
5239 if sort -k 3 </dev/null >/dev/null 2>&1; then
5244 uniq > "$nlist"S; then
5247 $GREP -v "^: " < "$nlist" > "$nlist"S
5250 if test -f "$nlist"S; then
5251 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
5253 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
5256 func_show_eval '$RM "${nlist}I"'
5257 if test -n "$global_symbol_to_import"; then
5258 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
5261 echo >> "$output_objdir/$my_dlsyms" "\
5263 /* The mapping between symbol names and symbols. */
5268 extern LT_DLSYM_CONST lt_dlsymlist
5269 lt_${my_prefix}_LTX_preloaded_symbols[];\
5272 if test -s "$nlist"I; then
5273 echo >> "$output_objdir/$my_dlsyms" "\
5274 static void lt_syminit(void)
5276 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
5277 for (; symbol->name; ++symbol)
5279 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
5280 echo >> "$output_objdir/$my_dlsyms" "\
5284 echo >> "$output_objdir/$my_dlsyms" "\
5285 LT_DLSYM_CONST lt_dlsymlist
5286 lt_${my_prefix}_LTX_preloaded_symbols[] =
5287 { {\"$my_originator\", (void *) 0},"
5289 if test -s "$nlist"I; then
5290 echo >> "$output_objdir/$my_dlsyms" "\
5291 {\"@INIT@\", (void *) <_syminit},"
5294 case $need_lib_prefix in
5296 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
5299 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
5302 echo >> "$output_objdir/$my_dlsyms" "\
5306 /* This works around a problem in FreeBSD linker */
5307 #ifdef FREEBSD_WORKAROUND
5308 static const void *lt_preloaded_setup() {
5309 return lt_${my_prefix}_LTX_preloaded_symbols;
5319 pic_flag_for_symtable=
5320 case "$compile_command " in
5324 # compiling the symbol table file with pic_flag works around
5325 # a FreeBSD bug that causes programs to crash when -lm is
5326 # linked before any other PIC object. But we must not use
5327 # pic_flag when linking with -static. The problem exists in
5328 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
5329 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
5330 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
5332 pic_flag_for_symtable=" $pic_flag" ;;
5334 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
5340 for arg in $LTCFLAGS; do
5342 -pie | -fpie | -fPIE) ;;
5343 *) func_append symtab_cflags " $arg" ;;
5347 # Now compile the dynamic symbol file.
5348 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
5350 # Clean up the generated files.
5351 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
5353 # Transform the symbol file into the correct name.
5354 symfileobj=$output_objdir/${my_outputname}S.$objext
5356 *cygwin* | *mingw* | *cegcc* )
5357 if test -f "$output_objdir/$my_outputname.def"; then
5358 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5359 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5361 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5362 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5366 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5367 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5372 func_fatal_error "unknown suffix for '$my_dlsyms'"
5376 # We keep going just in case the user didn't refer to
5377 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
5378 # really was required.
5380 # Nullify the symbol file.
5381 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
5382 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
5386 # func_cygming_gnu_implib_p ARG
5387 # This predicate returns with zero status (TRUE) if
5388 # ARG is a GNU/binutils-style import library. Returns
5389 # with nonzero status (FALSE) otherwise.
5390 func_cygming_gnu_implib_p ()
5394 func_to_tool_file "$1" func_convert_file_msys_to_w32
5395 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
5396 test -n "$func_cygming_gnu_implib_tmp"
5399 # func_cygming_ms_implib_p ARG
5400 # This predicate returns with zero status (TRUE) if
5401 # ARG is an MS-style import library. Returns
5402 # with nonzero status (FALSE) otherwise.
5403 func_cygming_ms_implib_p ()
5407 func_to_tool_file "$1" func_convert_file_msys_to_w32
5408 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
5409 test -n "$func_cygming_ms_implib_tmp"
5412 # func_win32_libid arg
5413 # return the library type of file 'arg'
5415 # Need a lot of goo to handle *both* DLLs and import libs
5416 # Has to be a shell function in order to 'eat' the argument
5417 # that is supplied when $file_magic_command is called.
5418 # Despite the name, also deal with 64 bit binaries.
5423 win32_libid_type=unknown
5424 win32_fileres=`file -L $1 2>/dev/null`
5425 case $win32_fileres in
5426 *ar\ archive\ import\ library*) # definitely import
5427 win32_libid_type="x86 archive import"
5429 *ar\ archive*) # could be an import, or static
5430 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
5431 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
5432 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
5433 case $nm_interface in
5435 if func_cygming_ms_implib_p "$1" ||
5436 func_cygming_gnu_implib_p "$1"
5444 func_to_tool_file "$1" func_convert_file_msys_to_w32
5445 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
5456 case $win32_nmres in
5457 import*) win32_libid_type="x86 archive import";;
5458 *) win32_libid_type="x86 archive static";;
5463 win32_libid_type="x86 DLL"
5465 *executable*) # but shell scripts are "executable" too...
5466 case $win32_fileres in
5467 *MS\ Windows\ PE\ Intel*)
5468 win32_libid_type="x86 DLL"
5473 $ECHO "$win32_libid_type"
5476 # func_cygming_dll_for_implib ARG
5478 # Platform-specific function to extract the
5479 # name of the DLL associated with the specified
5480 # import library ARG.
5481 # Invoked by eval'ing the libtool variable
5482 # $sharedlib_from_linklib_cmd
5483 # Result is available in the variable
5484 # $sharedlib_from_linklib_result
5485 func_cygming_dll_for_implib ()
5489 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
5492 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
5494 # The is the core of a fallback implementation of a
5495 # platform-specific function to extract the name of the
5496 # DLL associated with the specified import library LIBNAME.
5498 # SECTION_NAME is either .idata$6 or .idata$7, depending
5499 # on the platform and compiler that created the implib.
5501 # Echos the name of the DLL associated with the
5502 # specified import library.
5503 func_cygming_dll_for_implib_fallback_core ()
5507 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5508 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5509 $SED '/^Contents of section '"$match_literal"':/{
5510 # Place marker at beginning of archive member dllname section
5515 # These lines can sometimes be longer than 43 characters, but
5516 # are always uninteresting
5517 /:[ ]*file format pe[i]\{,1\}-/d
5518 /^In archive [^:]*:/d
5519 # Ensure marker is printed
5521 # Remove all lines with less than 43 characters
5523 # From remaining lines, remove first 43 characters
5526 # Join marker and all lines until next marker into a single line
5527 /^====MARK====/ b para
5536 # Remove trailing dots and whitespace
5540 # we now have a list, one entry per line, of the stringified
5541 # contents of the appropriate section of all members of the
5542 # archive that possess that section. Heuristic: eliminate
5543 # all those that have a first or second character that is
5544 # a '.' (that is, objdump's representation of an unprintable
5545 # character.) This should work for all archives with less than
5546 # 0x302f exports -- but will fail for DLLs whose name actually
5547 # begins with a literal '.' or a single character followed by
5550 # Of those that remain, print the first one.
5551 $SED -e '/^\./d;/^.\./d;q'
5554 # func_cygming_dll_for_implib_fallback ARG
5555 # Platform-specific function to extract the
5556 # name of the DLL associated with the specified
5557 # import library ARG.
5559 # This fallback implementation is for use when $DLLTOOL
5560 # does not support the --identify-strict option.
5561 # Invoked by eval'ing the libtool variable
5562 # $sharedlib_from_linklib_cmd
5563 # Result is available in the variable
5564 # $sharedlib_from_linklib_result
5565 func_cygming_dll_for_implib_fallback ()
5569 if func_cygming_gnu_implib_p "$1"; then
5570 # binutils import library
5571 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5572 elif func_cygming_ms_implib_p "$1"; then
5573 # ms-generated import library
5574 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5577 sharedlib_from_linklib_result=
5582 # func_extract_an_archive dir oldlib
5583 func_extract_an_archive ()
5587 f_ex_an_ar_dir=$1; shift
5588 f_ex_an_ar_oldlib=$1
5589 if test yes = "$lock_old_archive_extraction"; then
5590 lockfile=$f_ex_an_ar_oldlib.lock
5591 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5592 func_echo "Waiting for $lockfile to be removed"
5596 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5597 'stat=$?; rm -f "$lockfile"; exit $stat'
5598 if test yes = "$lock_old_archive_extraction"; then
5599 $opt_dry_run || rm -f "$lockfile"
5601 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5604 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5609 # func_extract_archives gentop oldlib ...
5610 func_extract_archives ()
5615 my_oldlibs=${1+"$@"}
5621 for my_xlib in $my_oldlibs; do
5622 # Extract the objects.
5624 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5625 *) my_xabs=`pwd`"/$my_xlib" ;;
5627 func_basename "$my_xlib"
5628 my_xlib=$func_basename_result
5631 case " $extracted_archives " in
5633 func_arith $extracted_serial + 1
5634 extracted_serial=$func_arith_result
5635 my_xlib_u=lt$extracted_serial-$my_xlib ;;
5639 extracted_archives="$extracted_archives $my_xlib_u"
5640 my_xdir=$my_gentop/$my_xlib_u
5642 func_mkdir_p "$my_xdir"
5646 func_verbose "Extracting $my_xabs"
5647 # Do not bother doing anything if just a dry run
5649 darwin_orig_dir=`pwd`
5650 cd $my_xdir || exit $?
5651 darwin_archive=$my_xabs
5653 func_basename "$darwin_archive"
5654 darwin_base_archive=$func_basename_result
5655 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5656 if test -n "$darwin_arches"; then
5657 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5659 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5660 for darwin_arch in $darwin_arches; do
5661 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5662 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5663 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5664 func_extract_an_archive "`pwd`" "$darwin_base_archive"
5666 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5667 done # $darwin_arches
5668 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5669 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5672 for darwin_file in $darwin_filelist; do
5673 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5674 $LIPO -create -output "$darwin_file" $darwin_files
5675 done # $darwin_filelist
5677 cd "$darwin_orig_dir"
5680 func_extract_an_archive "$my_xdir" "$my_xabs"
5685 func_extract_an_archive "$my_xdir" "$my_xabs"
5688 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5691 func_extract_archives_result=$my_oldobjs
5695 # func_emit_wrapper [arg=no]
5697 # Emit a libtool wrapper script on stdout.
5698 # Don't directly open a file because we may want to
5699 # incorporate the script contents within a cygwin/mingw
5700 # wrapper executable. Must ONLY be called from within
5701 # func_mode_link because it depends on a number of variables
5704 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5705 # variable will take. If 'yes', then the emitted script
5706 # will assume that the directory where it is stored is
5707 # the $objdir directory. This is a cygwin/mingw-specific
5709 func_emit_wrapper ()
5711 func_emit_wrapper_arg1=${1-no}
5716 # $output - temporary wrapper script for $objdir/$outputname
5717 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5719 # The $output program cannot be directly executed until all the libtool
5720 # libraries that it depends on are installed.
5722 # This wrapper script should never be moved out of the build directory.
5723 # If it is, it will not operate correctly.
5725 # Sed substitution that helps us do robust quoting. It backslashifies
5726 # metacharacters that are still active within double-quoted strings.
5727 sed_quote_subst='$sed_quote_subst'
5729 # Be Bourne compatible
5730 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5733 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5734 # is contrary to our usage. Disable this feature.
5735 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5736 setopt NO_GLOB_SUBST
5738 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5740 BIN_SH=xpg4; export BIN_SH # for Tru64
5741 DUALCASE=1; export DUALCASE # for MKS sh
5743 # The HP-UX ksh and POSIX shell print the target directory to stdout
5745 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5747 relink_command=\"$relink_command\"
5749 # This environment variable determines our operation mode.
5750 if test \"\$libtool_install_magic\" = \"$magic\"; then
5751 # install mode needs the following variables:
5752 generated_by_libtool_version='$macro_version'
5753 notinst_deplibs='$notinst_deplibs'
5755 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5756 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5759 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
5762 # A function that is used when there is no print builtin or printf.
5763 func_fallback_echo ()
5765 eval 'cat <<_LTECHO_EOF
5772 # Very basic option parsing. These options are (a) specific to
5773 # the libtool wrapper, (b) are identical between the wrapper
5774 # /script/ and the wrapper /executable/ that is used only on
5775 # windows platforms, and (c) all begin with the string "--lt-"
5776 # (application programs are unlikely to have options that match
5779 # There are only two supported options: --lt-debug and
5780 # --lt-dump-script. There is, deliberately, no --lt-help.
5782 # The first argument to this parsing function should be the
5783 # script's $0 value, followed by "$@".
5785 func_parse_lt_options ()
5791 case \"\$lt_opt\" in
5792 --lt-debug) lt_option_debug=1 ;;
5794 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5795 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5796 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5797 cat \"\$lt_dump_D/\$lt_dump_F\"
5801 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5807 # Print the debug banner immediately:
5808 if test -n \"\$lt_option_debug\"; then
5809 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5813 # Used when --lt-debug. Prints its arguments to stdout
5814 # (redirection is the responsibility of the caller)
5815 func_lt_dump_args ()
5820 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5821 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5825 # Core function for launching the target application
5826 func_exec_program_core ()
5830 # Backslashes separate directories on plain windows
5831 *-*-mingw | *-*-os2* | *-cegcc*)
5833 if test -n \"\$lt_option_debug\"; then
5834 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5835 func_lt_dump_args \${1+\"\$@\"} 1>&2
5837 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5843 if test -n \"\$lt_option_debug\"; then
5844 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5845 func_lt_dump_args \${1+\"\$@\"} 1>&2
5847 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5852 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5856 # A function to encapsulate launching the target application
5857 # Strips options in the --lt-* namespace from \$@ and
5858 # launches target application with the remaining arguments.
5859 func_exec_program ()
5867 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5872 func_exec_program_core \${1+\"\$@\"}
5876 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5878 # Find the directory that this script lives in.
5879 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5880 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5882 # Follow symbolic links until we get to the real thisdir.
5883 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5884 while test -n \"\$file\"; do
5885 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5887 # If there was a directory component, then change thisdir.
5888 if test \"x\$destdir\" != \"x\$file\"; then
5889 case \"\$destdir\" in
5890 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5891 *) thisdir=\"\$thisdir/\$destdir\" ;;
5895 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5896 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5899 # Usually 'no', except on cygwin/mingw when embedded into
5901 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5902 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5903 # special case for '.'
5904 if test \"\$thisdir\" = \".\"; then
5907 # remove .libs from thisdir
5908 case \"\$thisdir\" in
5909 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5910 $objdir ) thisdir=. ;;
5914 # Try to get the absolute directory name.
5915 absdir=\`cd \"\$thisdir\" && pwd\`
5916 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5919 if test yes = "$fast_install"; then
5921 program=lt-'$outputname'$exeext
5922 progdir=\"\$thisdir/$objdir\"
5924 if test ! -f \"\$progdir/\$program\" ||
5925 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5926 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5928 file=\"\$\$-\$program\"
5930 if test ! -d \"\$progdir\"; then
5931 $MKDIR \"\$progdir\"
5933 $RM \"\$progdir/\$file\"
5938 # relink executable if necessary
5939 if test -n \"\$relink_command\"; then
5940 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5942 \$ECHO \"\$relink_command_output\" >&2
5943 $RM \"\$progdir/\$file\"
5948 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5949 { $RM \"\$progdir/\$program\";
5950 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5951 $RM \"\$progdir/\$file\"
5955 program='$outputname'
5956 progdir=\"\$thisdir/$objdir\"
5962 if test -f \"\$progdir/\$program\"; then"
5964 # fixup the dll searchpath if we need to.
5966 # Fix the DLL searchpath if we need to. Do this before prepending
5967 # to shlibpath, because on Windows, both are PATH and uninstalled
5968 # libraries must come first.
5969 if test -n "$dllsearchpath"; then
5971 # Add the dll search path components to the executable PATH
5972 PATH=$dllsearchpath:\$PATH
5976 # Export our shlibpath_var if we have one.
5977 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5979 # Add our own library path to $shlibpath_var
5980 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5982 # Some systems cannot cope with colon-terminated $shlibpath_var
5983 # The second colon is a workaround for a bug in BeOS R4 sed
5984 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5986 export $shlibpath_var
5991 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5992 # Run the actual program with our arguments.
5993 func_exec_program \${1+\"\$@\"}
5996 # The program doesn't exist.
5997 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
5998 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
5999 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
6007 # func_emit_cwrapperexe_src
6008 # emit the source code for a wrapper executable on stdout
6009 # Must ONLY be called from within func_mode_link because
6010 # it depends on a number of variable set therein.
6011 func_emit_cwrapperexe_src ()
6015 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
6016 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
6018 The $output program cannot be directly executed until all the libtool
6019 libraries that it depends on are installed.
6021 This wrapper executable should never be moved out of the build directory.
6022 If it is, it will not operate correctly.
6027 # define _CRT_SECURE_NO_DEPRECATE 1
6032 # include <direct.h>
6033 # include <process.h>
6036 # include <unistd.h>
6037 # include <stdint.h>
6049 #include <sys/stat.h>
6051 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
6053 /* declarations of non-ANSI functions */
6054 #if defined __MINGW32__
6055 # ifdef __STRICT_ANSI__
6056 int _putenv (const char *);
6058 #elif defined __CYGWIN__
6059 # ifdef __STRICT_ANSI__
6060 char *realpath (const char *, char *);
6061 int putenv (char *);
6062 int setenv (const char *, const char *, int);
6064 /* #elif defined other_platform || defined ... */
6067 /* portability defines, excluding path handling macros */
6068 #if defined _MSC_VER
6069 # define setmode _setmode
6071 # define chmod _chmod
6072 # define getcwd _getcwd
6073 # define putenv _putenv
6074 # define S_IXUSR _S_IEXEC
6075 #elif defined __MINGW32__
6076 # define setmode _setmode
6078 # define chmod _chmod
6079 # define getcwd _getcwd
6080 # define putenv _putenv
6081 #elif defined __CYGWIN__
6082 # define HAVE_SETENV
6083 # define FOPEN_WB "wb"
6084 /* #elif defined other platforms ... */
6087 #if defined PATH_MAX
6088 # define LT_PATHMAX PATH_MAX
6089 #elif defined MAXPATHLEN
6090 # define LT_PATHMAX MAXPATHLEN
6092 # define LT_PATHMAX 1024
6102 /* path handling portability macros */
6103 #ifndef DIR_SEPARATOR
6104 # define DIR_SEPARATOR '/'
6105 # define PATH_SEPARATOR ':'
6108 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
6110 # define HAVE_DOS_BASED_FILE_SYSTEM
6111 # define FOPEN_WB "wb"
6112 # ifndef DIR_SEPARATOR_2
6113 # define DIR_SEPARATOR_2 '\\'
6115 # ifndef PATH_SEPARATOR_2
6116 # define PATH_SEPARATOR_2 ';'
6120 #ifndef DIR_SEPARATOR_2
6121 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
6122 #else /* DIR_SEPARATOR_2 */
6123 # define IS_DIR_SEPARATOR(ch) \
6124 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
6125 #endif /* DIR_SEPARATOR_2 */
6127 #ifndef PATH_SEPARATOR_2
6128 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
6129 #else /* PATH_SEPARATOR_2 */
6130 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
6131 #endif /* PATH_SEPARATOR_2 */
6134 # define FOPEN_WB "w"
6137 # define _O_BINARY 0
6140 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
6141 #define XFREE(stale) do { \
6142 if (stale) { free (stale); stale = 0; } \
6145 #if defined LT_DEBUGWRAPPER
6146 static int lt_debug = 1;
6148 static int lt_debug = 0;
6151 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
6153 void *xmalloc (size_t num);
6154 char *xstrdup (const char *string);
6155 const char *base_name (const char *name);
6156 char *find_executable (const char *wrapper);
6157 char *chase_symlinks (const char *pathspec);
6158 int make_executable (const char *path);
6159 int check_executable (const char *path);
6160 char *strendzap (char *str, const char *pat);
6161 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
6162 void lt_fatal (const char *file, int line, const char *message, ...);
6163 static const char *nonnull (const char *s);
6164 static const char *nonempty (const char *s);
6165 void lt_setenv (const char *name, const char *value);
6166 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
6167 void lt_update_exe_path (const char *name, const char *value);
6168 void lt_update_lib_path (const char *name, const char *value);
6169 char **prepare_spawn (char **argv);
6170 void lt_dump_script (FILE *f);
6174 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
6175 # define externally_visible volatile
6177 # define externally_visible __attribute__((externally_visible)) volatile
6179 externally_visible const char * MAGIC_EXE = "$magic_exe";
6180 const char * LIB_PATH_VARNAME = "$shlibpath_var";
6183 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
6184 func_to_host_path "$temp_rpath"
6186 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
6190 const char * LIB_PATH_VALUE = "";
6194 if test -n "$dllsearchpath"; then
6195 func_to_host_path "$dllsearchpath:"
6197 const char * EXE_PATH_VARNAME = "PATH";
6198 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
6202 const char * EXE_PATH_VARNAME = "";
6203 const char * EXE_PATH_VALUE = "";
6207 if test yes = "$fast_install"; then
6209 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
6213 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
6220 #define LTWRAPPER_OPTION_PREFIX "--lt-"
6222 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
6223 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
6224 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
6227 main (int argc, char *argv[])
6232 char *actual_cwrapper_path;
6233 char *actual_cwrapper_name;
6240 program_name = (char *) xstrdup (base_name (argv[0]));
6241 newargz = XMALLOC (char *, (size_t) argc + 1);
6243 /* very simple arg parsing; don't want to rely on getopt
6244 * also, copy all non cwrapper options to newargz, except
6245 * argz[0], which is handled differently
6248 for (i = 1; i < argc; i++)
6250 if (STREQ (argv[i], dumpscript_opt))
6254 *mingw* | *cygwin* )
6255 # make stdout use "unix" line endings
6256 echo " setmode(1,_O_BINARY);"
6261 lt_dump_script (stdout);
6264 if (STREQ (argv[i], debug_opt))
6269 if (STREQ (argv[i], ltwrapper_option_prefix))
6271 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
6272 namespace, but it is not one of the ones we know about and
6273 have already dealt with, above (inluding dump-script), then
6274 report an error. Otherwise, targets might begin to believe
6275 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
6276 namespace. The first time any user complains about this, we'll
6277 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
6278 or a configure.ac-settable value.
6280 lt_fatal (__FILE__, __LINE__,
6281 "unrecognized %s option: '%s'",
6282 ltwrapper_option_prefix, argv[i]);
6285 newargz[++newargc] = xstrdup (argv[i]);
6287 newargz[++newargc] = NULL;
6291 /* The GNU banner must be the first non-error debug message */
6292 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
6295 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
6296 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
6298 tmp_pathspec = find_executable (argv[0]);
6299 if (tmp_pathspec == NULL)
6300 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
6301 lt_debugprintf (__FILE__, __LINE__,
6302 "(main) found exe (before symlink chase) at: %s\n",
6305 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
6306 lt_debugprintf (__FILE__, __LINE__,
6307 "(main) found exe (after symlink chase) at: %s\n",
6308 actual_cwrapper_path);
6309 XFREE (tmp_pathspec);
6311 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
6312 strendzap (actual_cwrapper_path, actual_cwrapper_name);
6314 /* wrapper name transforms */
6315 strendzap (actual_cwrapper_name, ".exe");
6316 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
6317 XFREE (actual_cwrapper_name);
6318 actual_cwrapper_name = tmp_pathspec;
6321 /* target_name transforms -- use actual target program name; might have lt- prefix */
6322 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
6323 strendzap (target_name, ".exe");
6324 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
6325 XFREE (target_name);
6326 target_name = tmp_pathspec;
6329 lt_debugprintf (__FILE__, __LINE__,
6330 "(main) libtool target name: %s\n",
6336 XMALLOC (char, (strlen (actual_cwrapper_path) +
6337 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
6338 strcpy (newargz[0], actual_cwrapper_path);
6339 strcat (newargz[0], "$objdir");
6340 strcat (newargz[0], "/");
6344 /* stop here, and copy so we don't have to do this twice */
6345 tmp_pathspec = xstrdup (newargz[0]);
6347 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
6348 strcat (newargz[0], actual_cwrapper_name);
6350 /* DO want the lt- prefix here if it exists, so use target_name */
6351 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
6352 XFREE (tmp_pathspec);
6353 tmp_pathspec = NULL;
6361 while ((p = strchr (newargz[0], '\\')) != NULL)
6365 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
6375 XFREE (target_name);
6376 XFREE (actual_cwrapper_path);
6377 XFREE (actual_cwrapper_name);
6379 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
6380 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
6381 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
6382 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
6383 because on Windows, both *_VARNAMEs are PATH but uninstalled
6384 libraries must come first. */
6385 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
6386 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
6388 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
6389 nonnull (lt_argv_zero));
6390 for (i = 0; i < newargc; i++)
6392 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
6393 i, nonnull (newargz[i]));
6401 /* execv doesn't actually work on mingw as expected on unix */
6402 newargz = prepare_spawn (newargz);
6403 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
6406 /* failed to start process */
6407 lt_debugprintf (__FILE__, __LINE__,
6408 "(main) failed to launch target \"%s\": %s\n",
6409 lt_argv_zero, nonnull (strerror (errno)));
6417 execv (lt_argv_zero, newargz);
6418 return rval; /* =127, but avoids unused variable warning */
6427 xmalloc (size_t num)
6429 void *p = (void *) malloc (num);
6431 lt_fatal (__FILE__, __LINE__, "memory exhausted");
6437 xstrdup (const char *string)
6439 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
6444 base_name (const char *name)
6448 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6449 /* Skip over the disk name in MSDOS pathnames. */
6450 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
6454 for (base = name; *name; name++)
6455 if (IS_DIR_SEPARATOR (*name))
6461 check_executable (const char *path)
6465 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
6467 if ((!path) || (!*path))
6470 if ((stat (path, &st) >= 0)
6471 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
6478 make_executable (const char *path)
6483 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
6485 if ((!path) || (!*path))
6488 if (stat (path, &st) >= 0)
6490 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
6495 /* Searches for the full path of the wrapper. Returns
6496 newly allocated full path name if found, NULL otherwise
6497 Does not chase symlinks, even on platforms that support them.
6500 find_executable (const char *wrapper)
6505 /* static buffer for getcwd */
6506 char tmp[LT_PATHMAX + 1];
6510 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
6511 nonempty (wrapper));
6513 if ((wrapper == NULL) || (*wrapper == '\0'))
6516 /* Absolute path? */
6517 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6518 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
6520 concat_name = xstrdup (wrapper);
6521 if (check_executable (concat_name))
6523 XFREE (concat_name);
6528 if (IS_DIR_SEPARATOR (wrapper[0]))
6530 concat_name = xstrdup (wrapper);
6531 if (check_executable (concat_name))
6533 XFREE (concat_name);
6535 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6539 for (p = wrapper; *p; p++)
6547 /* no slashes; search PATH */
6548 const char *path = getenv ("PATH");
6551 for (p = path; *p; p = p_next)
6555 for (q = p; *q; q++)
6556 if (IS_PATH_SEPARATOR (*q))
6558 p_len = (size_t) (q - p);
6559 p_next = (*q == '\0' ? q : q + 1);
6562 /* empty path: current directory */
6563 if (getcwd (tmp, LT_PATHMAX) == NULL)
6564 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6565 nonnull (strerror (errno)));
6566 tmp_len = strlen (tmp);
6568 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6569 memcpy (concat_name, tmp, tmp_len);
6570 concat_name[tmp_len] = '/';
6571 strcpy (concat_name + tmp_len + 1, wrapper);
6576 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6577 memcpy (concat_name, p, p_len);
6578 concat_name[p_len] = '/';
6579 strcpy (concat_name + p_len + 1, wrapper);
6581 if (check_executable (concat_name))
6583 XFREE (concat_name);
6586 /* not found in PATH; assume curdir */
6588 /* Relative path | not found in path: prepend cwd */
6589 if (getcwd (tmp, LT_PATHMAX) == NULL)
6590 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6591 nonnull (strerror (errno)));
6592 tmp_len = strlen (tmp);
6593 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6594 memcpy (concat_name, tmp, tmp_len);
6595 concat_name[tmp_len] = '/';
6596 strcpy (concat_name + tmp_len + 1, wrapper);
6598 if (check_executable (concat_name))
6600 XFREE (concat_name);
6605 chase_symlinks (const char *pathspec)
6608 return xstrdup (pathspec);
6610 char buf[LT_PATHMAX];
6612 char *tmp_pathspec = xstrdup (pathspec);
6614 int has_symlinks = 0;
6615 while (strlen (tmp_pathspec) && !has_symlinks)
6617 lt_debugprintf (__FILE__, __LINE__,
6618 "checking path component for symlinks: %s\n",
6620 if (lstat (tmp_pathspec, &s) == 0)
6622 if (S_ISLNK (s.st_mode) != 0)
6628 /* search backwards for last DIR_SEPARATOR */
6629 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6630 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6632 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6634 /* no more DIR_SEPARATORS left */
6641 lt_fatal (__FILE__, __LINE__,
6642 "error accessing file \"%s\": %s",
6643 tmp_pathspec, nonnull (strerror (errno)));
6646 XFREE (tmp_pathspec);
6650 return xstrdup (pathspec);
6653 tmp_pathspec = realpath (pathspec, buf);
6654 if (tmp_pathspec == 0)
6656 lt_fatal (__FILE__, __LINE__,
6657 "could not follow symlinks for %s", pathspec);
6659 return xstrdup (tmp_pathspec);
6664 strendzap (char *str, const char *pat)
6668 assert (str != NULL);
6669 assert (pat != NULL);
6672 patlen = strlen (pat);
6676 str += len - patlen;
6677 if (STREQ (str, pat))
6684 lt_debugprintf (const char *file, int line, const char *fmt, ...)
6689 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6690 va_start (args, fmt);
6691 (void) vfprintf (stderr, fmt, args);
6697 lt_error_core (int exit_status, const char *file,
6698 int line, const char *mode,
6699 const char *message, va_list ap)
6701 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6702 vfprintf (stderr, message, ap);
6703 fprintf (stderr, ".\n");
6705 if (exit_status >= 0)
6710 lt_fatal (const char *file, int line, const char *message, ...)
6713 va_start (ap, message);
6714 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6719 nonnull (const char *s)
6721 return s ? s : "(null)";
6725 nonempty (const char *s)
6727 return (s && !*s) ? "(empty)" : nonnull (s);
6731 lt_setenv (const char *name, const char *value)
6733 lt_debugprintf (__FILE__, __LINE__,
6734 "(lt_setenv) setting '%s' to '%s'\n",
6735 nonnull (name), nonnull (value));
6738 /* always make a copy, for consistency with !HAVE_SETENV */
6739 char *str = xstrdup (value);
6740 setenv (name, str, 1);
6742 size_t len = strlen (name) + 1 + strlen (value) + 1;
6743 char *str = XMALLOC (char, len);
6744 sprintf (str, "%s=%s", name, value);
6745 if (putenv (str) != EXIT_SUCCESS)
6754 lt_extend_str (const char *orig_value, const char *add, int to_end)
6757 if (orig_value && *orig_value)
6759 size_t orig_value_len = strlen (orig_value);
6760 size_t add_len = strlen (add);
6761 new_value = XMALLOC (char, add_len + orig_value_len + 1);
6764 strcpy (new_value, orig_value);
6765 strcpy (new_value + orig_value_len, add);
6769 strcpy (new_value, add);
6770 strcpy (new_value + add_len, orig_value);
6775 new_value = xstrdup (add);
6781 lt_update_exe_path (const char *name, const char *value)
6783 lt_debugprintf (__FILE__, __LINE__,
6784 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6785 nonnull (name), nonnull (value));
6787 if (name && *name && value && *value)
6789 char *new_value = lt_extend_str (getenv (name), value, 0);
6790 /* some systems can't cope with a ':'-terminated path #' */
6791 size_t len = strlen (new_value);
6792 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
6794 new_value[--len] = '\0';
6796 lt_setenv (name, new_value);
6802 lt_update_lib_path (const char *name, const char *value)
6804 lt_debugprintf (__FILE__, __LINE__,
6805 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6806 nonnull (name), nonnull (value));
6808 if (name && *name && value && *value)
6810 char *new_value = lt_extend_str (getenv (name), value, 0);
6811 lt_setenv (name, new_value);
6821 /* Prepares an argument vector before calling spawn().
6822 Note that spawn() does not by itself call the command interpreter
6823 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6824 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6826 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6827 }) ? "cmd.exe" : "command.com").
6828 Instead it simply concatenates the arguments, separated by ' ', and calls
6829 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6830 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6832 - Space and tab are interpreted as delimiters. They are not treated as
6833 delimiters if they are surrounded by double quotes: "...".
6834 - Unescaped double quotes are removed from the input. Their only effect is
6835 that within double quotes, space and tab are treated like normal
6837 - Backslashes not followed by double quotes are not special.
6838 - But 2*n+1 backslashes followed by a double quote become
6839 n backslashes followed by a double quote (n >= 0):
6844 #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
6845 #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
6847 prepare_spawn (char **argv)
6853 /* Count number of arguments. */
6854 for (argc = 0; argv[argc] != NULL; argc++)
6857 /* Allocate new argument vector. */
6858 new_argv = XMALLOC (char *, argc + 1);
6860 /* Put quoted arguments into the new argument vector. */
6861 for (i = 0; i < argc; i++)
6863 const char *string = argv[i];
6865 if (string[0] == '\0')
6866 new_argv[i] = xstrdup ("\"\"");
6867 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6869 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6871 unsigned int backslashes;
6873 char *quoted_string;
6880 for (s = string; *s != '\0'; s++)
6884 length += backslashes + 1;
6892 length += backslashes + 1;
6894 quoted_string = XMALLOC (char, length + 1);
6900 for (s = string; *s != '\0'; s++)
6906 for (j = backslashes + 1; j > 0; j--)
6918 for (j = backslashes; j > 0; j--)
6924 new_argv[i] = quoted_string;
6927 new_argv[i] = (char *) string;
6929 new_argv[argc] = NULL;
6938 void lt_dump_script (FILE* f)
6941 func_emit_wrapper yes |
6943 s/^\(.\{79\}\)\(..*\)/\1\
6948 s/\([^\n]*\).*/ fputs ("\1", f);/p
6955 # end: func_emit_cwrapperexe_src
6957 # func_win32_import_lib_p ARG
6958 # True if ARG is an import lib, as indicated by $file_magic_cmd
6959 func_win32_import_lib_p ()
6963 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6969 # func_suncc_cstd_abi
6970 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6971 # Several compiler flags select an ABI that is incompatible with the
6972 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
6973 func_suncc_cstd_abi ()
6977 case " $compile_command " in
6978 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6979 suncc_use_cstd_abi=no
6982 suncc_use_cstd_abi=yes
6987 # func_mode_link arg...
6993 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6994 # It is impossible to link a dll without this setting, and
6995 # we shouldn't force the makefile maintainer to figure out
6996 # what system we are compiling for in order to pass an extra
6997 # flag for every libtool invocation.
6998 # allow_undefined=no
7000 # FIXME: Unfortunately, there are problems with the above when trying
7001 # to make a dll that has undefined symbols, in which case not
7002 # even a static library is built. For now, we need to specify
7003 # -no-undefined on the libtool link line when we can be certain
7004 # that all symbols are satisfied, otherwise we get a static library.
7011 libtool_args=$nonopt
7012 base_compile="$nonopt $@"
7013 compile_command=$nonopt
7014 finalize_command=$nonopt
7027 lib_search_path=`pwd`
7029 new_inherited_linker_flags=
7038 export_symbols_regex=
7047 precious_files_regex=
7048 prefer_static_libs=no
7061 single_module=$wl-single_module
7062 func_infer_tag $base_compile
7064 # We need to know -static, to get the right output filenames.
7069 test yes != "$build_libtool_libs" \
7070 && func_fatal_configuration "cannot build a shared library"
7074 -all-static | -static | -static-libtool-libs)
7077 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
7078 func_warning "complete static linking is impossible in this configuration"
7080 if test -n "$link_static_flag"; then
7081 dlopen_self=$dlopen_self_static
7083 prefer_static_libs=yes
7086 if test -z "$pic_flag" && test -n "$link_static_flag"; then
7087 dlopen_self=$dlopen_self_static
7089 prefer_static_libs=built
7091 -static-libtool-libs)
7092 if test -z "$pic_flag" && test -n "$link_static_flag"; then
7093 dlopen_self=$dlopen_self_static
7095 prefer_static_libs=yes
7098 build_libtool_libs=no
7105 # See if our shared archives depend on static archives.
7106 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
7108 # Go through the arguments, transforming them on the way.
7109 while test "$#" -gt 0; do
7112 func_quote_for_eval "$arg"
7113 qarg=$func_quote_for_eval_unquoted_result
7114 func_append libtool_args " $func_quote_for_eval_result"
7116 # If the previous option needs an argument, assign it.
7117 if test -n "$prev"; then
7120 func_append compile_command " @OUTPUT@"
7121 func_append finalize_command " @OUTPUT@"
7133 # Add the symbol object into the linking commands.
7134 func_append compile_command " @SYMFILE@"
7135 func_append finalize_command " @SYMFILE@"
7139 *.la | *.lo) ;; # We handle these cases below.
7141 if test no = "$dlself"; then
7149 if test dlprefiles = "$prev"; then
7151 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
7161 if test dlfiles = "$prev"; then
7162 func_append dlfiles " $arg"
7164 func_append dlprefiles " $arg"
7174 || func_fatal_error "symbol file '$arg' does not exist"
7179 export_symbols_regex=$arg
7187 *" $qarg.ltframework "*) ;;
7188 *) func_append deplibs " $qarg.ltframework" # this is fixed later
7197 inst_prefix_dir=$arg
7202 # Clang does not use LLVM to link, so we can simply discard any
7203 # '-mllvm $arg' options when doing the link step.
7208 if test -f "$arg"; then
7211 for fil in `cat "$save_arg"`
7213 # func_append moreargs " $fil"
7215 # A libtool-controlled object.
7217 # Check to see that this really is a libtool object.
7218 if func_lalib_unsafe_p "$arg"; then
7225 if test -z "$pic_object" ||
7226 test -z "$non_pic_object" ||
7227 test none = "$pic_object" &&
7228 test none = "$non_pic_object"; then
7229 func_fatal_error "cannot find name of object for '$arg'"
7232 # Extract subdirectory from the argument.
7233 func_dirname "$arg" "/" ""
7234 xdir=$func_dirname_result
7236 if test none != "$pic_object"; then
7237 # Prepend the subdirectory the object is found in.
7238 pic_object=$xdir$pic_object
7240 if test dlfiles = "$prev"; then
7241 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7242 func_append dlfiles " $pic_object"
7246 # If libtool objects are unsupported, then we need to preload.
7251 # CHECK ME: I think I busted this. -Ossama
7252 if test dlprefiles = "$prev"; then
7253 # Preload the old-style object.
7254 func_append dlprefiles " $pic_object"
7259 func_append libobjs " $pic_object"
7264 if test none != "$non_pic_object"; then
7265 # Prepend the subdirectory the object is found in.
7266 non_pic_object=$xdir$non_pic_object
7268 # A standard non-PIC object
7269 func_append non_pic_objects " $non_pic_object"
7270 if test -z "$pic_object" || test none = "$pic_object"; then
7274 # If the PIC object exists, use it instead.
7275 # $xdir was prepended to $pic_object above.
7276 non_pic_object=$pic_object
7277 func_append non_pic_objects " $non_pic_object"
7280 # Only an error if not doing a dry-run.
7281 if $opt_dry_run; then
7282 # Extract subdirectory from the argument.
7283 func_dirname "$arg" "/" ""
7284 xdir=$func_dirname_result
7287 pic_object=$xdir$objdir/$func_lo2o_result
7288 non_pic_object=$xdir$func_lo2o_result
7289 func_append libobjs " $pic_object"
7290 func_append non_pic_objects " $non_pic_object"
7292 func_fatal_error "'$arg' is not a valid libtool object"
7297 func_fatal_error "link input file '$arg' does not exist"
7309 precious_files_regex=$arg
7319 # We need an absolute path.
7321 [\\/]* | [A-Za-z]:[\\/]*) ;;
7323 func_fatal_error "only absolute run-paths are allowed"
7326 if test rpath = "$prev"; then
7329 *) func_append rpath " $arg" ;;
7334 *) func_append xrpath " $arg" ;;
7346 func_append weak_libs " $arg"
7351 func_append linker_flags " $qarg"
7352 func_append compiler_flags " $qarg"
7354 func_append compile_command " $qarg"
7355 func_append finalize_command " $qarg"
7359 func_append compiler_flags " $qarg"
7361 func_append compile_command " $qarg"
7362 func_append finalize_command " $qarg"
7366 func_append linker_flags " $qarg"
7367 func_append compiler_flags " $wl$qarg"
7369 func_append compile_command " $wl$qarg"
7370 func_append finalize_command " $wl$qarg"
7374 eval "$prev=\"\$arg\""
7379 fi # test -n "$prev"
7385 if test -n "$link_static_flag"; then
7386 # See comment for -static flag below, for more details.
7387 func_append compile_command " $link_static_flag"
7388 func_append finalize_command " $link_static_flag"
7394 # FIXME: remove this flag sometime in the future.
7395 func_fatal_error "'-allow-undefined' must not be used because it is the default"
7423 -export-symbols | -export-symbols-regex)
7424 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
7425 func_fatal_error "more than one -exported-symbols argument is not allowed"
7427 if test X-export-symbols = "X$arg"; then
7445 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
7446 # so, if we see these flags be careful not to treat them like -L
7448 case $with_gcc/$host in
7449 no/*-*-irix* | /*-*-irix*)
7450 func_append compile_command " $arg"
7451 func_append finalize_command " $arg"
7458 func_stripname "-L" '' "$arg"
7459 if test -z "$func_stripname_result"; then
7460 if test "$#" -gt 0; then
7461 func_fatal_error "require no space between '-L' and '$1'"
7463 func_fatal_error "need path for '-L' option"
7466 func_resolve_sysroot "$func_stripname_result"
7467 dir=$func_resolve_sysroot_result
7468 # We need an absolute path.
7470 [\\/]* | [A-Za-z]:[\\/]*) ;;
7472 absdir=`cd "$dir" && pwd`
7473 test -z "$absdir" && \
7474 func_fatal_error "cannot determine absolute directory name of '$dir'"
7479 *" -L$dir "* | *" $arg "*)
7480 # Will only happen for absolute or sysroot arguments
7483 # Preserve sysroot, but never include relative directories
7485 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
7486 *) func_append deplibs " -L$dir" ;;
7488 func_append lib_search_path " $dir"
7492 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7493 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
7494 case :$dllsearchpath: in
7496 ::) dllsearchpath=$dir;;
7497 *) func_append dllsearchpath ":$dir";;
7499 case :$dllsearchpath: in
7500 *":$testbindir:"*) ;;
7501 ::) dllsearchpath=$testbindir;;
7502 *) func_append dllsearchpath ":$testbindir";;
7510 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7512 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7513 # These systems don't actually have a C or math library (as such)
7517 # These systems don't actually have a C library (as such)
7518 test X-lc = "X$arg" && continue
7520 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7521 # Do not include libc due to us having libc/libc_r.
7522 test X-lc = "X$arg" && continue
7524 *-*-rhapsody* | *-*-darwin1.[012])
7525 # Rhapsody C and math libraries are in the System framework
7526 func_append deplibs " System.ltframework"
7529 *-*-sco3.2v5* | *-*-sco5v6*)
7530 # Causes problems with __ctype
7531 test X-lc = "X$arg" && continue
7533 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7534 # Compiler inserts libc in the correct place for threads to work
7535 test X-lc = "X$arg" && continue
7538 elif test X-lc_r = "X$arg"; then
7540 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7541 # Do not include libc_r directly, use -pthread flag.
7546 func_append deplibs " $arg"
7560 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7561 # classes, name mangling, and exception handling.
7562 # Darwin uses the -arch flag to determine output architecture.
7563 -model|-arch|-isysroot|--sysroot)
7564 func_append compiler_flags " $arg"
7565 func_append compile_command " $arg"
7566 func_append finalize_command " $arg"
7571 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7572 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7573 func_append compiler_flags " $arg"
7574 func_append compile_command " $arg"
7575 func_append finalize_command " $arg"
7576 case "$new_inherited_linker_flags " in
7578 * ) func_append new_inherited_linker_flags " $arg" ;;
7584 single_module=$wl-multi_module
7595 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7596 # The PATH hackery in wrapper scripts is required on Windows
7597 # and Darwin in order for the loader to find any dlls it needs.
7598 func_warning "'-no-install' is ignored for $host"
7599 func_warning "assuming '-no-fast-install' instead"
7602 *) no_install=yes ;;
7624 -precious-files-regex)
7645 func_stripname '-R' '' "$arg"
7646 dir=$func_stripname_result
7647 # We need an absolute path.
7649 [\\/]* | [A-Za-z]:[\\/]*) ;;
7651 func_stripname '=' '' "$dir"
7652 dir=$lt_sysroot$func_stripname_result
7655 func_fatal_error "only absolute run-paths are allowed"
7660 *) func_append xrpath " $dir" ;;
7666 # The effects of -shared are defined in a previous loop.
7675 -static | -static-libtool-libs)
7676 # The effects of -static are defined in a previous loop.
7677 # We used to do the same as -all-static on platforms that
7678 # didn't have a PIC flag, but the assumption that the effects
7679 # would be equivalent was wrong. It would break on at least
7680 # Digital Unix and AIX.
7706 func_stripname '-Wc,' '' "$arg"
7707 args=$func_stripname_result
7709 save_ifs=$IFS; IFS=,
7710 for flag in $args; do
7712 func_quote_for_eval "$flag"
7713 func_append arg " $func_quote_for_eval_result"
7714 func_append compiler_flags " $func_quote_for_eval_result"
7717 func_stripname ' ' '' "$arg"
7718 arg=$func_stripname_result
7722 func_stripname '-Wl,' '' "$arg"
7723 args=$func_stripname_result
7725 save_ifs=$IFS; IFS=,
7726 for flag in $args; do
7728 func_quote_for_eval "$flag"
7729 func_append arg " $wl$func_quote_for_eval_result"
7730 func_append compiler_flags " $wl$func_quote_for_eval_result"
7731 func_append linker_flags " $func_quote_for_eval_result"
7734 func_stripname ' ' '' "$arg"
7735 arg=$func_stripname_result
7755 func_quote_for_eval "$arg"
7756 arg=$func_quote_for_eval_result
7759 # Flags to be passed through unchanged, with rationale:
7760 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7761 # -r[0-9][0-9]* specify processor for the SGI compiler
7762 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7763 # +DA*, +DD* enable 64-bit mode for the HP compiler
7764 # -q* compiler args for the IBM compiler
7765 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7766 # -F/path path to uninstalled frameworks, gcc on darwin
7767 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7768 # -fstack-protector* stack protector flags for GCC
7769 # @file GCC response files
7770 # -tp=* Portland pgcc target processor selection
7771 # --sysroot=* for sysroot support
7772 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7773 # -specs=* GCC specs files
7774 # -stdlib=* select c++ std lib with clang
7775 # -fsanitize=* Clang/GCC memory and address sanitizer
7776 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7777 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7778 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7779 -specs=*|-fsanitize=*)
7780 func_quote_for_eval "$arg"
7781 arg=$func_quote_for_eval_result
7782 func_append compile_command " $arg"
7783 func_append finalize_command " $arg"
7784 func_append compiler_flags " $arg"
7789 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7790 # OS/2 uses -Zxxx to specify OS/2-specific options
7791 compiler_flags="$compiler_flags $arg"
7792 func_append compile_command " $arg"
7793 func_append finalize_command " $arg"
7801 # Otherwise treat like 'Some other compiler flag' below
7802 func_quote_for_eval "$arg"
7803 arg=$func_quote_for_eval_result
7807 # Some other compiler flag.
7809 func_quote_for_eval "$arg"
7810 arg=$func_quote_for_eval_result
7814 # A standard object.
7815 func_append objs " $arg"
7819 # A libtool-controlled object.
7821 # Check to see that this really is a libtool object.
7822 if func_lalib_unsafe_p "$arg"; then
7829 if test -z "$pic_object" ||
7830 test -z "$non_pic_object" ||
7831 test none = "$pic_object" &&
7832 test none = "$non_pic_object"; then
7833 func_fatal_error "cannot find name of object for '$arg'"
7836 # Extract subdirectory from the argument.
7837 func_dirname "$arg" "/" ""
7838 xdir=$func_dirname_result
7840 test none = "$pic_object" || {
7841 # Prepend the subdirectory the object is found in.
7842 pic_object=$xdir$pic_object
7844 if test dlfiles = "$prev"; then
7845 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7846 func_append dlfiles " $pic_object"
7850 # If libtool objects are unsupported, then we need to preload.
7855 # CHECK ME: I think I busted this. -Ossama
7856 if test dlprefiles = "$prev"; then
7857 # Preload the old-style object.
7858 func_append dlprefiles " $pic_object"
7863 func_append libobjs " $pic_object"
7868 if test none != "$non_pic_object"; then
7869 # Prepend the subdirectory the object is found in.
7870 non_pic_object=$xdir$non_pic_object
7872 # A standard non-PIC object
7873 func_append non_pic_objects " $non_pic_object"
7874 if test -z "$pic_object" || test none = "$pic_object"; then
7878 # If the PIC object exists, use it instead.
7879 # $xdir was prepended to $pic_object above.
7880 non_pic_object=$pic_object
7881 func_append non_pic_objects " $non_pic_object"
7884 # Only an error if not doing a dry-run.
7885 if $opt_dry_run; then
7886 # Extract subdirectory from the argument.
7887 func_dirname "$arg" "/" ""
7888 xdir=$func_dirname_result
7891 pic_object=$xdir$objdir/$func_lo2o_result
7892 non_pic_object=$xdir$func_lo2o_result
7893 func_append libobjs " $pic_object"
7894 func_append non_pic_objects " $non_pic_object"
7896 func_fatal_error "'$arg' is not a valid libtool object"
7903 func_append deplibs " $arg"
7904 func_append old_deplibs " $arg"
7909 # A libtool-controlled library.
7911 func_resolve_sysroot "$arg"
7912 if test dlfiles = "$prev"; then
7913 # This library was specified with -dlopen.
7914 func_append dlfiles " $func_resolve_sysroot_result"
7916 elif test dlprefiles = "$prev"; then
7917 # The library was specified with -dlpreopen.
7918 func_append dlprefiles " $func_resolve_sysroot_result"
7921 func_append deplibs " $func_resolve_sysroot_result"
7926 # Some other compiler argument.
7928 # Unknown arguments in both finalize_command and compile_command need
7929 # to be aesthetically quoted because they are evaled later.
7930 func_quote_for_eval "$arg"
7931 arg=$func_quote_for_eval_result
7935 # Now actually substitute the argument into the commands.
7936 if test -n "$arg"; then
7937 func_append compile_command " $arg"
7938 func_append finalize_command " $arg"
7940 done # argument parsing loop
7942 test -n "$prev" && \
7943 func_fatal_help "the '$prevarg' option requires an argument"
7945 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7946 eval arg=\"$export_dynamic_flag_spec\"
7947 func_append compile_command " $arg"
7948 func_append finalize_command " $arg"
7952 # calculate the name of the file, without its directory
7953 func_basename "$output"
7954 outputname=$func_basename_result
7955 libobjs_save=$libobjs
7957 if test -n "$shlibpath_var"; then
7958 # get the directories listed in $shlibpath_var
7959 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7963 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7964 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7966 # Definition is injected by LT_CONFIG during libtool generation.
7967 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7969 func_dirname "$output" "/" ""
7970 output_objdir=$func_dirname_result$objdir
7971 func_to_tool_file "$output_objdir/"
7972 tool_output_objdir=$func_to_tool_file_result
7973 # Create the object directory.
7974 func_mkdir_p "$output_objdir"
7976 # Determine the type of output
7979 func_fatal_help "you must specify an output file"
7981 *.$libext) linkmode=oldlib ;;
7982 *.lo | *.$objext) linkmode=obj ;;
7983 *.la) linkmode=lib ;;
7984 *) linkmode=prog ;; # Anything else should be a program.
7990 # Find all interdependent deplibs by searching for libraries
7991 # that are linked more than once (e.g. -la -lb -la)
7992 for deplib in $deplibs; do
7993 if $opt_preserve_dup_deps; then
7995 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7998 func_append libs " $deplib"
8001 if test lib = "$linkmode"; then
8002 libs="$predeps $libs $compiler_lib_search_path $postdeps"
8004 # Compute libraries that are listed more than once in $predeps
8005 # $postdeps and mark them as special (i.e., whose duplicates are
8006 # not to be eliminated).
8008 if $opt_duplicate_compiler_generated_deps; then
8009 for pre_post_dep in $predeps $postdeps; do
8010 case "$pre_post_deps " in
8011 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
8013 func_append pre_post_deps " $pre_post_dep"
8022 need_relink=no # whether we're linking any uninstalled libtool libraries
8023 notinst_deplibs= # not-installed libtool libraries
8024 notinst_path= # paths that contain not-installed libtool libraries
8028 passes="conv dlpreopen link"
8029 for file in $dlfiles $dlprefiles; do
8033 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
8044 passes="conv scan dlopen dlpreopen link"
8050 for pass in $passes; do
8051 # The preopen pass in lib mode reverses $deplibs; put it back here
8052 # so that -L comes before libs that need it for instance...
8053 if test lib,link = "$linkmode,$pass"; then
8054 ## FIXME: Find the place where the list is rebuilt in the wrong
8055 ## order, and fix it there properly
8057 for deplib in $deplibs; do
8058 tmp_deplibs="$deplib $tmp_deplibs"
8060 deplibs=$tmp_deplibs
8063 if test lib,link = "$linkmode,$pass" ||
8064 test prog,scan = "$linkmode,$pass"; then
8068 if test prog = "$linkmode"; then
8070 dlopen) libs=$dlfiles ;;
8071 dlpreopen) libs=$dlprefiles ;;
8073 libs="$deplibs %DEPLIBS%"
8074 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
8078 if test lib,dlpreopen = "$linkmode,$pass"; then
8079 # Collect and forward deplibs of preopened libtool libs
8080 for lib in $dlprefiles; do
8081 # Ignore non-libtool-libs
8083 func_resolve_sysroot "$lib"
8085 *.la) func_source "$func_resolve_sysroot_result" ;;
8088 # Collect preopened libtool deplibs, except any this library
8089 # has declared as weak libs
8090 for deplib in $dependency_libs; do
8091 func_basename "$deplib"
8092 deplib_base=$func_basename_result
8093 case " $weak_libs " in
8094 *" $deplib_base "*) ;;
8095 *) func_append deplibs " $deplib" ;;
8101 if test dlopen = "$pass"; then
8102 # Collect dlpreopened libraries
8103 save_deplibs=$deplibs
8107 for deplib in $libs; do
8111 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
8112 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
8113 if test prog,link = "$linkmode,$pass"; then
8114 compile_deplibs="$deplib $compile_deplibs"
8115 finalize_deplibs="$deplib $finalize_deplibs"
8117 func_append compiler_flags " $deplib"
8118 if test lib = "$linkmode"; then
8119 case "$new_inherited_linker_flags " in
8121 * ) func_append new_inherited_linker_flags " $deplib" ;;
8128 if test lib != "$linkmode" && test prog != "$linkmode"; then
8129 func_warning "'-l' is ignored for archives/objects"
8132 func_stripname '-l' '' "$deplib"
8133 name=$func_stripname_result
8134 if test lib = "$linkmode"; then
8135 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
8137 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
8139 for searchdir in $searchdirs; do
8140 for search_ext in .la $std_shrext .so .a; do
8141 # Search the libtool library
8142 lib=$searchdir/lib$name$search_ext
8143 if test -f "$lib"; then
8144 if test .la = "$search_ext"; then
8154 # deplib is a libtool library
8155 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
8156 # We need to do some special things here, and not later.
8157 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8158 case " $predeps $postdeps " in
8160 if func_lalib_p "$lib"; then
8164 for l in $old_library $library_names; do
8167 if test "X$ll" = "X$old_library"; then # only static version available
8169 func_dirname "$lib" "" "."
8170 ladir=$func_dirname_result
8171 lib=$ladir/$old_library
8172 if test prog,link = "$linkmode,$pass"; then
8173 compile_deplibs="$deplib $compile_deplibs"
8174 finalize_deplibs="$deplib $finalize_deplibs"
8176 deplibs="$deplib $deplibs"
8177 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8187 # deplib doesn't seem to be a libtool library
8188 if test prog,link = "$linkmode,$pass"; then
8189 compile_deplibs="$deplib $compile_deplibs"
8190 finalize_deplibs="$deplib $finalize_deplibs"
8192 deplibs="$deplib $deplibs"
8193 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8199 if test prog,link = "$linkmode,$pass"; then
8200 compile_deplibs="$deplib $compile_deplibs"
8201 finalize_deplibs="$deplib $finalize_deplibs"
8203 deplibs="$deplib $deplibs"
8204 if test lib = "$linkmode"; then
8205 case "$new_inherited_linker_flags " in
8207 * ) func_append new_inherited_linker_flags " $deplib" ;;
8216 deplibs="$deplib $deplibs"
8217 test conv = "$pass" && continue
8218 newdependency_libs="$deplib $newdependency_libs"
8219 func_stripname '-L' '' "$deplib"
8220 func_resolve_sysroot "$func_stripname_result"
8221 func_append newlib_search_path " $func_resolve_sysroot_result"
8224 if test conv = "$pass"; then
8225 deplibs="$deplib $deplibs"
8228 if test scan = "$pass"; then
8229 deplibs="$deplib $deplibs"
8231 compile_deplibs="$deplib $compile_deplibs"
8232 finalize_deplibs="$deplib $finalize_deplibs"
8234 func_stripname '-L' '' "$deplib"
8235 func_resolve_sysroot "$func_stripname_result"
8236 func_append newlib_search_path " $func_resolve_sysroot_result"
8239 func_warning "'-L' is ignored for archives/objects"
8245 if test link = "$pass"; then
8246 func_stripname '-R' '' "$deplib"
8247 func_resolve_sysroot "$func_stripname_result"
8248 dir=$func_resolve_sysroot_result
8249 # Make sure the xrpath contains only unique directories.
8252 *) func_append xrpath " $dir" ;;
8255 deplibs="$deplib $deplibs"
8259 func_resolve_sysroot "$deplib"
8260 lib=$func_resolve_sysroot_result
8263 if test conv = "$pass"; then
8264 deplibs="$deplib $deplibs"
8269 # Linking convenience modules into shared libraries is allowed,
8270 # but linking other static libraries is non-portable.
8271 case " $dlpreconveniencelibs " in
8275 case $deplibs_check_method in
8277 set dummy $deplibs_check_method; shift
8278 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8279 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
8280 | $EGREP "$match_pattern_regex" > /dev/null; then
8288 if $valid_a_lib; then
8290 $ECHO "*** Warning: Linking the shared library $output against the"
8291 $ECHO "*** static library $deplib is not portable!"
8292 deplibs="$deplib $deplibs"
8295 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
8296 echo "*** I have the capability to make that library automatically link in when"
8297 echo "*** you link to this library. But I can only do this if you have a"
8298 echo "*** shared version of the library, which you do not appear to have"
8299 echo "*** because the file extensions .$libext of this argument makes me believe"
8300 echo "*** that it is just a static archive that I should not use here."
8307 if test link != "$pass"; then
8308 deplibs="$deplib $deplibs"
8310 compile_deplibs="$deplib $compile_deplibs"
8311 finalize_deplibs="$deplib $finalize_deplibs"
8318 if test conv = "$pass"; then
8319 deplibs="$deplib $deplibs"
8320 elif test prog = "$linkmode"; then
8321 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
8322 # If there is no dlopen support or we're linking statically,
8323 # we need to preload.
8324 func_append newdlprefiles " $deplib"
8325 compile_deplibs="$deplib $compile_deplibs"
8326 finalize_deplibs="$deplib $finalize_deplibs"
8328 func_append newdlfiles " $deplib"
8339 $found || test -f "$lib" \
8340 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
8342 # Check to see that this really is a libtool archive.
8343 func_lalib_unsafe_p "$lib" \
8344 || func_fatal_error "'$lib' is not a valid libtool archive"
8346 func_dirname "$lib" "" "."
8347 ladir=$func_dirname_result
8355 inherited_linker_flags=
8356 # If the library was installed with an old release of libtool,
8357 # it will not redefine variables installed, or shouldnotlink
8366 # Convert "-framework foo" to "foo.ltframework"
8367 if test -n "$inherited_linker_flags"; then
8368 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
8369 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
8370 case " $new_inherited_linker_flags " in
8371 *" $tmp_inherited_linker_flag "*) ;;
8372 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
8376 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8377 if test lib,link = "$linkmode,$pass" ||
8378 test prog,scan = "$linkmode,$pass" ||
8379 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
8380 test -n "$dlopen" && func_append dlfiles " $dlopen"
8381 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
8384 if test conv = "$pass"; then
8385 # Only check for convenience libraries
8386 deplibs="$lib $deplibs"
8387 if test -z "$libdir"; then
8388 if test -z "$old_library"; then
8389 func_fatal_error "cannot find name of link library for '$lib'"
8391 # It is a libtool convenience library, so add in its objects.
8392 func_append convenience " $ladir/$objdir/$old_library"
8393 func_append old_convenience " $ladir/$objdir/$old_library"
8395 for deplib in $dependency_libs; do
8396 deplibs="$deplib $deplibs"
8397 if $opt_preserve_dup_deps; then
8398 case "$tmp_libs " in
8399 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8402 func_append tmp_libs " $deplib"
8404 elif test prog != "$linkmode" && test lib != "$linkmode"; then
8405 func_fatal_error "'$lib' is not a convenience library"
8411 # Get the name of the library we link against.
8413 if test -n "$old_library" &&
8414 { test yes = "$prefer_static_libs" ||
8415 test built,no = "$prefer_static_libs,$installed"; }; then
8416 linklib=$old_library
8418 for l in $old_library $library_names; do
8422 if test -z "$linklib"; then
8423 func_fatal_error "cannot find name of link library for '$lib'"
8426 # This library was specified with -dlopen.
8427 if test dlopen = "$pass"; then
8429 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8430 if test -z "$dlname" ||
8431 test yes != "$dlopen_support" ||
8432 test no = "$build_libtool_libs"
8434 # If there is no dlname, no dlopen support or we're linking
8435 # statically, we need to preload. We also need to preload any
8436 # dependent libraries so libltdl's deplib preloader doesn't
8437 # bomb out in the load deplibs phase.
8438 func_append dlprefiles " $lib $dependency_libs"
8440 func_append newdlfiles " $lib"
8445 # We need an absolute path.
8447 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8449 abs_ladir=`cd "$ladir" && pwd`
8450 if test -z "$abs_ladir"; then
8451 func_warning "cannot determine absolute directory name of '$ladir'"
8452 func_warning "passing it literally to the linker, although it might fail"
8457 func_basename "$lib"
8458 laname=$func_basename_result
8460 # Find the relevant object directory and library name.
8461 if test yes = "$installed"; then
8462 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8463 func_warning "library '$lib' was moved."
8468 dir=$lt_sysroot$libdir
8469 absdir=$lt_sysroot$libdir
8471 test yes = "$hardcode_automatic" && avoidtemprpath=yes
8473 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8476 # Remove this search path later
8477 func_append notinst_path " $abs_ladir"
8480 absdir=$abs_ladir/$objdir
8481 # Remove this search path later
8482 func_append notinst_path " $abs_ladir"
8484 fi # $installed = yes
8485 func_stripname 'lib' '.la' "$laname"
8486 name=$func_stripname_result
8488 # This library was specified with -dlpreopen.
8489 if test dlpreopen = "$pass"; then
8490 if test -z "$libdir" && test prog = "$linkmode"; then
8491 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8494 # special handling for platforms with PE-DLLs.
8495 *cygwin* | *mingw* | *cegcc* )
8496 # Linker will automatically link against shared library if both
8497 # static and shared are present. Therefore, ensure we extract
8498 # symbols from the import library if a shared library is present
8499 # (otherwise, the dlopen module name will be incorrect). We do
8500 # this by putting the import library name into $newdlprefiles.
8501 # We recover the dlopen module name by 'saving' the la file
8502 # name in a special purpose variable, and (later) extracting the
8503 # dlname from the la file.
8504 if test -n "$dlname"; then
8505 func_tr_sh "$dir/$linklib"
8506 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8507 func_append newdlprefiles " $dir/$linklib"
8509 func_append newdlprefiles " $dir/$old_library"
8510 # Keep a list of preopened convenience libraries to check
8511 # that they are being used correctly in the link pass.
8512 test -z "$libdir" && \
8513 func_append dlpreconveniencelibs " $dir/$old_library"
8517 # Prefer using a static library (so that no silly _DYNAMIC symbols
8518 # are required to link).
8519 if test -n "$old_library"; then
8520 func_append newdlprefiles " $dir/$old_library"
8521 # Keep a list of preopened convenience libraries to check
8522 # that they are being used correctly in the link pass.
8523 test -z "$libdir" && \
8524 func_append dlpreconveniencelibs " $dir/$old_library"
8525 # Otherwise, use the dlname, so that lt_dlopen finds it.
8526 elif test -n "$dlname"; then
8527 func_append newdlprefiles " $dir/$dlname"
8529 func_append newdlprefiles " $dir/$linklib"
8533 fi # $pass = dlpreopen
8535 if test -z "$libdir"; then
8536 # Link the convenience library
8537 if test lib = "$linkmode"; then
8538 deplibs="$dir/$old_library $deplibs"
8539 elif test prog,link = "$linkmode,$pass"; then
8540 compile_deplibs="$dir/$old_library $compile_deplibs"
8541 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8543 deplibs="$lib $deplibs" # used for prog,scan pass
8549 if test prog = "$linkmode" && test link != "$pass"; then
8550 func_append newlib_search_path " $ladir"
8551 deplibs="$lib $deplibs"
8553 linkalldeplibs=false
8554 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8555 test no = "$build_libtool_libs"; then
8560 for deplib in $dependency_libs; do
8562 -L*) func_stripname '-L' '' "$deplib"
8563 func_resolve_sysroot "$func_stripname_result"
8564 func_append newlib_search_path " $func_resolve_sysroot_result"
8567 # Need to link against all dependency_libs?
8568 if $linkalldeplibs; then
8569 deplibs="$deplib $deplibs"
8571 # Need to hardcode shared library paths
8572 # or/and link against static libraries
8573 newdependency_libs="$deplib $newdependency_libs"
8575 if $opt_preserve_dup_deps; then
8576 case "$tmp_libs " in
8577 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8580 func_append tmp_libs " $deplib"
8583 fi # $linkmode = prog...
8585 if test prog,link = "$linkmode,$pass"; then
8586 if test -n "$library_names" &&
8587 { { test no = "$prefer_static_libs" ||
8588 test built,yes = "$prefer_static_libs,$installed"; } ||
8589 test -z "$old_library"; }; then
8590 # We need to hardcode the library path
8591 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8592 # Make sure the rpath contains only unique directories.
8593 case $temp_rpath: in
8595 *) func_append temp_rpath "$absdir:" ;;
8599 # Hardcode the library path.
8600 # Skip directories that are in the system default run-time
8602 case " $sys_lib_dlsearch_path " in
8605 case "$compile_rpath " in
8607 *) func_append compile_rpath " $absdir" ;;
8611 case " $sys_lib_dlsearch_path " in
8614 case "$finalize_rpath " in
8616 *) func_append finalize_rpath " $libdir" ;;
8620 fi # $linkmode,$pass = prog,link...
8623 { test pass_all = "$deplibs_check_method" ||
8624 { test yes = "$build_libtool_libs" &&
8625 test -n "$library_names"; }; }; then
8626 # We only need to search for static libraries
8631 link_static=no # Whether the deplib will be linked statically
8632 use_static_libs=$prefer_static_libs
8633 if test built = "$use_static_libs" && test yes = "$installed"; then
8636 if test -n "$library_names" &&
8637 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8639 *cygwin* | *mingw* | *cegcc* | *os2*)
8640 # No point in relinking DLLs because paths are not encoded
8641 func_append notinst_deplibs " $lib"
8645 if test no = "$installed"; then
8646 func_append notinst_deplibs " $lib"
8651 # This is a shared library
8653 # Warn about portability, can't link against -module's on some
8654 # systems (darwin). Don't bleat about dlopened modules though!
8656 for dlpremoduletest in $dlprefiles; do
8657 if test "X$dlpremoduletest" = "X$lib"; then
8658 dlopenmodule=$dlpremoduletest
8662 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8664 if test prog = "$linkmode"; then
8665 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8667 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8669 $ECHO "*** $linklib is not portable!"
8671 if test lib = "$linkmode" &&
8672 test yes = "$hardcode_into_libs"; then
8673 # Hardcode the library path.
8674 # Skip directories that are in the system default run-time
8676 case " $sys_lib_dlsearch_path " in
8679 case "$compile_rpath " in
8681 *) func_append compile_rpath " $absdir" ;;
8685 case " $sys_lib_dlsearch_path " in
8688 case "$finalize_rpath " in
8690 *) func_append finalize_rpath " $libdir" ;;
8696 if test -n "$old_archive_from_expsyms_cmds"; then
8697 # figure out the soname
8698 set dummy $library_names
8702 libname=`eval "\\$ECHO \"$libname_spec\""`
8703 # use dlname if we got it. it's perfectly good, no?
8704 if test -n "$dlname"; then
8706 elif test -n "$soname_spec"; then
8709 *cygwin* | mingw* | *cegcc* | *os2*)
8710 func_arith $current - $age
8711 major=$func_arith_result
8715 eval soname=\"$soname_spec\"
8720 # Make a new name for the extract_expsyms_cmds to use
8722 func_basename "$soroot"
8723 soname=$func_basename_result
8724 func_stripname 'lib' '.dll' "$soname"
8725 newlib=libimp-$func_stripname_result.a
8727 # If the library has no export list, then create one now
8728 if test -f "$output_objdir/$soname-def"; then :
8730 func_verbose "extracting exported symbol list from '$soname'"
8731 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8735 if test -f "$output_objdir/$newlib"; then :; else
8736 func_verbose "generating import library for '$soname'"
8737 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8739 # make sure the library variables are pointing to the new library
8742 fi # test -n "$old_archive_from_expsyms_cmds"
8744 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8749 case $hardcode_action in
8750 immediate | unsupported)
8751 if test no = "$hardcode_direct"; then
8754 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8755 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8756 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8757 *-*-unixware7*) add_dir=-L$dir ;;
8759 # if the lib is a (non-dlopened) module then we cannot
8760 # link against it, someone is ignoring the earlier warnings
8761 if /usr/bin/file -L $add 2> /dev/null |
8762 $GREP ": [^:]* bundle" >/dev/null; then
8763 if test "X$dlopenmodule" != "X$lib"; then
8764 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8765 if test -z "$old_library"; then
8767 echo "*** And there doesn't seem to be a static archive available"
8768 echo "*** The link will probably fail, sorry"
8770 add=$dir/$old_library
8772 elif test -n "$old_library"; then
8773 add=$dir/$old_library
8777 elif test no = "$hardcode_minus_L"; then
8779 *-*-sunos*) add_shlibpath=$dir ;;
8783 elif test no = "$hardcode_shlibpath_var"; then
8791 if test yes = "$hardcode_direct" &&
8792 test no = "$hardcode_direct_absolute"; then
8794 elif test yes = "$hardcode_minus_L"; then
8796 # Try looking first in the location we're being installed to.
8797 if test -n "$inst_prefix_dir"; then
8800 func_append add_dir " -L$inst_prefix_dir$libdir"
8805 elif test yes = "$hardcode_shlibpath_var"; then
8815 if test yes != "$lib_linked"; then
8816 func_fatal_configuration "unsupported hardcode properties"
8819 if test -n "$add_shlibpath"; then
8820 case :$compile_shlibpath: in
8821 *":$add_shlibpath:"*) ;;
8822 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8825 if test prog = "$linkmode"; then
8826 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8827 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8829 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8830 test -n "$add" && deplibs="$add $deplibs"
8831 if test yes != "$hardcode_direct" &&
8832 test yes != "$hardcode_minus_L" &&
8833 test yes = "$hardcode_shlibpath_var"; then
8834 case :$finalize_shlibpath: in
8836 *) func_append finalize_shlibpath "$libdir:" ;;
8842 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8846 # Finalize command for both is simple: just hardcode it.
8847 if test yes = "$hardcode_direct" &&
8848 test no = "$hardcode_direct_absolute"; then
8849 add=$libdir/$linklib
8850 elif test yes = "$hardcode_minus_L"; then
8853 elif test yes = "$hardcode_shlibpath_var"; then
8854 case :$finalize_shlibpath: in
8856 *) func_append finalize_shlibpath "$libdir:" ;;
8859 elif test yes = "$hardcode_automatic"; then
8860 if test -n "$inst_prefix_dir" &&
8861 test -f "$inst_prefix_dir$libdir/$linklib"; then
8862 add=$inst_prefix_dir$libdir/$linklib
8864 add=$libdir/$linklib
8867 # We cannot seem to hardcode it, guess we'll fake it.
8869 # Try looking first in the location we're being installed to.
8870 if test -n "$inst_prefix_dir"; then
8873 func_append add_dir " -L$inst_prefix_dir$libdir"
8880 if test prog = "$linkmode"; then
8881 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8882 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8884 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8885 test -n "$add" && deplibs="$add $deplibs"
8888 elif test prog = "$linkmode"; then
8889 # Here we assume that one of hardcode_direct or hardcode_minus_L
8890 # is not unsupported. This is valid on all known static and
8892 if test unsupported != "$hardcode_direct"; then
8893 test -n "$old_library" && linklib=$old_library
8894 compile_deplibs="$dir/$linklib $compile_deplibs"
8895 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8897 compile_deplibs="-l$name -L$dir $compile_deplibs"
8898 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8900 elif test yes = "$build_libtool_libs"; then
8901 # Not a shared library
8902 if test pass_all != "$deplibs_check_method"; then
8903 # We're trying link a shared library against a static one
8904 # but the system doesn't support it.
8906 # Just print a warning and add the library to dependency_libs so
8907 # that the program can be linked against the static library.
8909 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8910 echo "*** I have the capability to make that library automatically link in when"
8911 echo "*** you link to this library. But I can only do this if you have a"
8912 echo "*** shared version of the library, which you do not appear to have."
8913 if test yes = "$module"; then
8914 echo "*** But as you try to build a module library, libtool will still create "
8915 echo "*** a static module, that should work as long as the dlopening application"
8916 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8917 if test -z "$global_symbol_pipe"; then
8919 echo "*** However, this would only work if libtool was able to extract symbol"
8920 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8921 echo "*** not find such a program. So, this module is probably useless."
8922 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8924 if test no = "$build_old_libs"; then
8925 build_libtool_libs=module
8928 build_libtool_libs=no
8932 deplibs="$dir/$old_library $deplibs"
8935 fi # link shared/static library?
8937 if test lib = "$linkmode"; then
8938 if test -n "$dependency_libs" &&
8939 { test yes != "$hardcode_into_libs" ||
8940 test yes = "$build_old_libs" ||
8941 test yes = "$link_static"; }; then
8942 # Extract -R from dependency_libs
8944 for libdir in $dependency_libs; do
8946 -R*) func_stripname '-R' '' "$libdir"
8947 temp_xrpath=$func_stripname_result
8949 *" $temp_xrpath "*) ;;
8950 *) func_append xrpath " $temp_xrpath";;
8952 *) func_append temp_deplibs " $libdir";;
8955 dependency_libs=$temp_deplibs
8958 func_append newlib_search_path " $absdir"
8959 # Link against this library
8960 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8961 # ... and its dependency_libs
8963 for deplib in $dependency_libs; do
8964 newdependency_libs="$deplib $newdependency_libs"
8966 -L*) func_stripname '-L' '' "$deplib"
8967 func_resolve_sysroot "$func_stripname_result";;
8968 *) func_resolve_sysroot "$deplib" ;;
8970 if $opt_preserve_dup_deps; then
8971 case "$tmp_libs " in
8972 *" $func_resolve_sysroot_result "*)
8973 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8976 func_append tmp_libs " $func_resolve_sysroot_result"
8979 if test no != "$link_all_deplibs"; then
8980 # Add the search paths of all dependency libraries
8981 for deplib in $dependency_libs; do
8984 -L*) path=$deplib ;;
8986 func_resolve_sysroot "$deplib"
8987 deplib=$func_resolve_sysroot_result
8988 func_dirname "$deplib" "" "."
8989 dir=$func_dirname_result
8990 # We need an absolute path.
8992 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8994 absdir=`cd "$dir" && pwd`
8995 if test -z "$absdir"; then
8996 func_warning "cannot determine absolute directory name of '$dir'"
9001 if $GREP "^installed=no" $deplib > /dev/null; then
9005 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
9006 if test -n "$deplibrary_names"; then
9007 for tmp in $deplibrary_names; do
9010 if test -f "$absdir/$objdir/$depdepl"; then
9011 depdepl=$absdir/$objdir/$depdepl
9012 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9013 if test -z "$darwin_install_name"; then
9014 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9016 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
9017 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
9023 path=-L$absdir/$objdir
9027 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
9028 test -z "$libdir" && \
9029 func_fatal_error "'$deplib' is not a valid libtool archive"
9030 test "$absdir" != "$libdir" && \
9031 func_warning "'$deplib' seems to be moved"
9037 case " $deplibs " in
9039 *) deplibs="$path $deplibs" ;;
9042 fi # link_all_deplibs != no
9044 done # for deplib in $libs
9045 if test link = "$pass"; then
9046 if test prog = "$linkmode"; then
9047 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
9048 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
9050 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9053 dependency_libs=$newdependency_libs
9054 if test dlpreopen = "$pass"; then
9055 # Link the dlpreopened libraries before other libraries
9056 for deplib in $save_deplibs; do
9057 deplibs="$deplib $deplibs"
9060 if test dlopen != "$pass"; then
9061 test conv = "$pass" || {
9062 # Make sure lib_search_path contains only unique directories.
9064 for dir in $newlib_search_path; do
9065 case "$lib_search_path " in
9067 *) func_append lib_search_path " $dir" ;;
9073 if test prog,link = "$linkmode,$pass"; then
9074 vars="compile_deplibs finalize_deplibs"
9078 for var in $vars dependency_libs; do
9079 # Add libraries to $var in reverse order
9080 eval tmp_libs=\"\$$var\"
9082 for deplib in $tmp_libs; do
9083 # FIXME: Pedantically, this is the right thing to do, so
9084 # that some nasty dependency loop isn't accidentally
9086 #new_libs="$deplib $new_libs"
9087 # Pragmatically, this seems to cause very few problems in
9090 -L*) new_libs="$deplib $new_libs" ;;
9093 # And here is the reason: when a library appears more
9094 # than once as an explicit dependence of a library, or
9095 # is implicitly linked in more than once by the
9096 # compiler, it is considered special, and multiple
9097 # occurrences thereof are not removed. Compare this
9098 # with having the same library being listed as a
9099 # dependency of multiple other libraries: in this case,
9100 # we know (pedantically, we assume) the library does not
9101 # need to be listed more than once, so we keep only the
9102 # last copy. This is not always right, but it is rare
9103 # enough that we require users that really mean to play
9104 # such unportable linking tricks to link the library
9105 # using -Wl,-lname, so that libtool does not consider it
9106 # for duplicate removal.
9107 case " $specialdeplibs " in
9108 *" $deplib "*) new_libs="$deplib $new_libs" ;;
9110 case " $new_libs " in
9112 *) new_libs="$deplib $new_libs" ;;
9120 for deplib in $new_libs; do
9123 case " $tmp_libs " in
9125 *) func_append tmp_libs " $deplib" ;;
9128 *) func_append tmp_libs " $deplib" ;;
9131 eval $var=\"$tmp_libs\"
9135 # Add Sun CC postdeps if required:
9136 test CXX = "$tagname" && {
9139 case `$CC -V 2>&1 | sed 5q` in
9140 *Sun\ C*) # Sun C++ 5.9
9143 if test no != "$suncc_use_cstd_abi"; then
9144 func_append postdeps ' -library=Cstd -library=Crun'
9151 func_cc_basename "$CC"
9152 case $func_cc_basename_result in
9156 if test no != "$suncc_use_cstd_abi"; then
9157 func_append postdeps ' -library=Cstd -library=Crun'
9165 # Last step: remove runtime libs from dependency_libs
9166 # (they stay in deplibs)
9168 for i in $dependency_libs; do
9169 case " $predeps $postdeps $compiler_lib_search_path " in
9174 if test -n "$i"; then
9175 func_append tmp_libs " $i"
9178 dependency_libs=$tmp_libs
9180 if test prog = "$linkmode"; then
9183 if test prog = "$linkmode" || test lib = "$linkmode"; then
9184 dlprefiles=$newdlprefiles
9189 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
9190 func_warning "'-dlopen' is ignored for archives"
9195 func_warning "'-l' and '-L' are ignored for archives" ;;
9198 test -n "$rpath" && \
9199 func_warning "'-rpath' is ignored for archives"
9201 test -n "$xrpath" && \
9202 func_warning "'-R' is ignored for archives"
9204 test -n "$vinfo" && \
9205 func_warning "'-version-info/-version-number' is ignored for archives"
9207 test -n "$release" && \
9208 func_warning "'-release' is ignored for archives"
9210 test -n "$export_symbols$export_symbols_regex" && \
9211 func_warning "'-export-symbols' is ignored for archives"
9213 # Now set the variables for building old libraries.
9214 build_libtool_libs=no
9216 func_append objs "$old_deplibs"
9220 # Make sure we only generate libraries of the form 'libNAME.la'.
9223 func_stripname 'lib' '.la' "$outputname"
9224 name=$func_stripname_result
9225 eval shared_ext=\"$shrext_cmds\"
9226 eval libname=\"$libname_spec\"
9229 test no = "$module" \
9230 && func_fatal_help "libtool library '$output' must begin with 'lib'"
9232 if test no != "$need_lib_prefix"; then
9233 # Add the "lib" prefix for modules if required
9234 func_stripname '' '.la' "$outputname"
9235 name=$func_stripname_result
9236 eval shared_ext=\"$shrext_cmds\"
9237 eval libname=\"$libname_spec\"
9239 func_stripname '' '.la' "$outputname"
9240 libname=$func_stripname_result
9245 if test -n "$objs"; then
9246 if test pass_all != "$deplibs_check_method"; then
9247 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
9250 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
9251 $ECHO "*** objects $objs is not portable!"
9252 func_append libobjs " $objs"
9256 test no = "$dlself" \
9257 || func_warning "'-dlopen self' is ignored for libtool libraries"
9262 && func_warning "ignoring multiple '-rpath's for a libtool library"
9267 if test -z "$rpath"; then
9268 if test yes = "$build_libtool_libs"; then
9269 # Building a libtool convenience library.
9270 # Some compilers have problems with a '.al' extension so
9271 # convenience libraries should have the same extension an
9272 # archive normally would.
9273 oldlibs="$output_objdir/$libname.$libext $oldlibs"
9274 build_libtool_libs=convenience
9278 test -n "$vinfo" && \
9279 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
9281 test -n "$release" && \
9282 func_warning "'-release' is ignored for convenience libraries"
9285 # Parse the version information argument.
9286 save_ifs=$IFS; IFS=:
9287 set dummy $vinfo 0 0 0
9292 func_fatal_help "too many parameters to '-version-info'"
9294 # convert absolute version numbers to libtool ages
9295 # this retains compatibility with .la files and attempts
9296 # to make the code below a bit more comprehensible
9298 case $vinfo_number in
9304 # There are really only two kinds -- those that
9305 # use the current revision as the major version
9306 # and those that subtract age and use age as
9307 # a minor version. But, then there is irix
9308 # that has an extra 1 added just for fun
9310 case $version_type in
9311 # correct linux to gnu/linux during the next big refactor
9312 darwin|freebsd-elf|linux|osf|windows|none)
9313 func_arith $number_major + $number_minor
9314 current=$func_arith_result
9316 revision=$number_revision
9318 freebsd-aout|qnx|sunos)
9319 current=$number_major
9320 revision=$number_minor
9324 func_arith $number_major + $number_minor
9325 current=$func_arith_result
9327 revision=$number_minor
9328 lt_irix_increment=no
9331 func_fatal_configuration "$modename: unknown library version type '$version_type'"
9342 # Check that each of the things are valid numbers.
9344 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]) ;;
9346 func_error "CURRENT '$current' must be a nonnegative integer"
9347 func_fatal_error "'$vinfo' is not valid version information"
9352 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]) ;;
9354 func_error "REVISION '$revision' must be a nonnegative integer"
9355 func_fatal_error "'$vinfo' is not valid version information"
9360 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]) ;;
9362 func_error "AGE '$age' must be a nonnegative integer"
9363 func_fatal_error "'$vinfo' is not valid version information"
9367 if test "$age" -gt "$current"; then
9368 func_error "AGE '$age' is greater than the current interface number '$current'"
9369 func_fatal_error "'$vinfo' is not valid version information"
9372 # Calculate the version variables.
9376 case $version_type in
9380 # Like Linux, but with the current version available in
9381 # verstring for coding it into the library header
9382 func_arith $current - $age
9383 major=.$func_arith_result
9384 versuffix=$major.$age.$revision
9385 # Darwin ld doesn't like 0 for these options...
9386 func_arith $current + 1
9387 minor_current=$func_arith_result
9388 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9389 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9390 # On Darwin other compilers
9393 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9396 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9403 versuffix=.$current.$revision
9407 func_arith $current - $age
9408 major=.$func_arith_result
9409 versuffix=$major.$age.$revision
9413 if test no = "$lt_irix_increment"; then
9414 func_arith $current - $age
9416 func_arith $current - $age + 1
9418 major=$func_arith_result
9420 case $version_type in
9421 nonstopux) verstring_prefix=nonstopux ;;
9422 *) verstring_prefix=sgi ;;
9424 verstring=$verstring_prefix$major.$revision
9426 # Add in all the interfaces that we are compatible with.
9428 while test 0 -ne "$loop"; do
9429 func_arith $revision - $loop
9430 iface=$func_arith_result
9431 func_arith $loop - 1
9432 loop=$func_arith_result
9433 verstring=$verstring_prefix$major.$iface:$verstring
9436 # Before this point, $major must not contain '.'.
9438 versuffix=$major.$revision
9441 linux) # correct to gnu/linux during the next big refactor
9442 func_arith $current - $age
9443 major=.$func_arith_result
9444 versuffix=$major.$age.$revision
9448 func_arith $current - $age
9449 major=.$func_arith_result
9450 versuffix=.$current.$age.$revision
9451 verstring=$current.$age.$revision
9453 # Add in all the interfaces that we are compatible with.
9455 while test 0 -ne "$loop"; do
9456 func_arith $current - $loop
9457 iface=$func_arith_result
9458 func_arith $loop - 1
9459 loop=$func_arith_result
9460 verstring=$verstring:$iface.0
9463 # Make executables depend on our current version.
9464 func_append verstring ":$current.0"
9479 versuffix=.$current.$revision
9483 # Use '-' rather than '.', since we only want one
9484 # extension on DOS 8.3 file systems.
9485 func_arith $current - $age
9486 major=$func_arith_result
9491 func_fatal_configuration "unknown library version type '$version_type'"
9495 # Clear the version info if we defaulted, and they specified a release.
9496 if test -z "$vinfo" && test -n "$release"; then
9498 case $version_type in
9500 # we can't check for "0.0" in archive_cmds due to quoting
9501 # problems, so we reset it completely
9508 if test no = "$need_version"; then
9515 # Remove version info from name if versioning should be avoided
9516 if test yes,no = "$avoid_version,$need_version"; then
9522 # Check to see if the archive will have undefined symbols.
9523 if test yes = "$allow_undefined"; then
9524 if test unsupported = "$allow_undefined_flag"; then
9525 if test yes = "$build_old_libs"; then
9526 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9527 build_libtool_libs=no
9529 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9533 # Don't allow undefined symbols.
9534 allow_undefined_flag=$no_undefined_flag
9539 func_generate_dlsyms "$libname" "$libname" :
9540 func_append libobjs " $symfileobj"
9541 test " " = "$libobjs" && libobjs=
9543 if test relink != "$opt_mode"; then
9544 # Remove our outputs, but don't remove object files since they
9545 # may have been created when compiling PIC objects.
9547 tempremovelist=`$ECHO "$output_objdir/*"`
9548 for p in $tempremovelist; do
9552 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9553 if test -n "$precious_files_regex"; then
9554 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9559 func_append removelist " $p"
9564 test -n "$removelist" && \
9565 func_show_eval "${RM}r \$removelist"
9568 # Now set the variables for building old libraries.
9569 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9570 func_append oldlibs " $output_objdir/$libname.$libext"
9572 # Transform .lo files to .o files.
9573 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9576 # Eliminate all temporary directories.
9577 #for path in $notinst_path; do
9578 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9579 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9580 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9583 if test -n "$xrpath"; then
9584 # If the user specified any rpath flags, then add them.
9586 for libdir in $xrpath; do
9587 func_replace_sysroot "$libdir"
9588 func_append temp_xrpath " -R$func_replace_sysroot_result"
9589 case "$finalize_rpath " in
9591 *) func_append finalize_rpath " $libdir" ;;
9594 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9595 dependency_libs="$temp_xrpath $dependency_libs"
9599 # Make sure dlfiles contains only unique files that won't be dlpreopened
9600 old_dlfiles=$dlfiles
9602 for lib in $old_dlfiles; do
9603 case " $dlprefiles $dlfiles " in
9605 *) func_append dlfiles " $lib" ;;
9609 # Make sure dlprefiles contains only unique files
9610 old_dlprefiles=$dlprefiles
9612 for lib in $old_dlprefiles; do
9613 case "$dlprefiles " in
9615 *) func_append dlprefiles " $lib" ;;
9619 if test yes = "$build_libtool_libs"; then
9620 if test -n "$rpath"; then
9622 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9623 # these systems don't actually have a c library (as such)!
9625 *-*-rhapsody* | *-*-darwin1.[012])
9626 # Rhapsody C library is in the System framework
9627 func_append deplibs " System.ltframework"
9630 # Don't link with libc until the a.out ld.so is fixed.
9632 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9633 # Do not include libc due to us having libc/libc_r.
9635 *-*-sco3.2v5* | *-*-sco5v6*)
9636 # Causes problems with __ctype
9638 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9639 # Compiler inserts libc in the correct place for threads to work
9642 # Add libc to deplibs on all other systems if necessary.
9643 if test yes = "$build_libtool_need_lc"; then
9644 func_append deplibs " -lc"
9650 # Transform deplibs into only deplibs that can be linked in shared.
9652 libname_save=$libname
9653 release_save=$release
9654 versuffix_save=$versuffix
9656 # I'm not sure if I'm treating the release correctly. I think
9657 # release should show up in the -l (ie -lgmp5) so we don't want to
9658 # add it in twice. Is that correct?
9664 case $deplibs_check_method in
9666 # Don't check for shared/static. Everything works.
9667 # This might be a little naive. We might want to check
9668 # whether the library exists or not. But this is on
9669 # osf3 & osf4 and I'm not really sure... Just
9670 # implementing what was already the behavior.
9674 # This code stresses the "libraries are programs" paradigm to its
9675 # limits. Maybe even breaks it. We compile a program, linking it
9676 # against the deplibs as a proxy for the library. Then we can check
9677 # whether they linked in statically or dynamically with ldd.
9678 $opt_dry_run || $RM conftest.c
9679 cat > conftest.c <<EOF
9680 int main() { return 0; }
9682 $opt_dry_run || $RM conftest
9683 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9684 ldd_output=`ldd conftest`
9685 for i in $deplibs; do
9688 func_stripname -l '' "$i"
9689 name=$func_stripname_result
9690 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9691 case " $predeps $postdeps " in
9693 func_append newdeplibs " $i"
9698 if test -n "$i"; then
9699 libname=`eval "\\$ECHO \"$libname_spec\""`
9700 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9701 set dummy $deplib_matches; shift
9703 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9704 func_append newdeplibs " $i"
9708 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9709 echo "*** I have the capability to make that library automatically link in when"
9710 echo "*** you link to this library. But I can only do this if you have a"
9711 echo "*** shared version of the library, which I believe you do not have"
9712 echo "*** because a test_compile did reveal that the linker did not use it for"
9713 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9718 func_append newdeplibs " $i"
9723 # Error occurred in the first compile. Let's try to salvage
9724 # the situation: Compile a separate program for each library.
9725 for i in $deplibs; do
9728 func_stripname -l '' "$i"
9729 name=$func_stripname_result
9730 $opt_dry_run || $RM conftest
9731 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9732 ldd_output=`ldd conftest`
9733 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9734 case " $predeps $postdeps " in
9736 func_append newdeplibs " $i"
9741 if test -n "$i"; then
9742 libname=`eval "\\$ECHO \"$libname_spec\""`
9743 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9744 set dummy $deplib_matches; shift
9746 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9747 func_append newdeplibs " $i"
9751 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9752 echo "*** I have the capability to make that library automatically link in when"
9753 echo "*** you link to this library. But I can only do this if you have a"
9754 echo "*** shared version of the library, which you do not appear to have"
9755 echo "*** because a test_compile did reveal that the linker did not use this one"
9756 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9762 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9763 echo "*** make it link in! You will probably need to install it or some"
9764 echo "*** library that it depends on before this library will be fully"
9765 echo "*** functional. Installing it before continuing would be even better."
9769 func_append newdeplibs " $i"
9776 set dummy $deplibs_check_method; shift
9777 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9778 for a_deplib in $deplibs; do
9781 func_stripname -l '' "$a_deplib"
9782 name=$func_stripname_result
9783 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9784 case " $predeps $postdeps " in
9786 func_append newdeplibs " $a_deplib"
9791 if test -n "$a_deplib"; then
9792 libname=`eval "\\$ECHO \"$libname_spec\""`
9793 if test -n "$file_magic_glob"; then
9794 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9796 libnameglob=$libname
9798 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9799 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9800 if test yes = "$want_nocaseglob"; then
9802 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9805 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9807 for potent_lib in $potential_libs; do
9808 # Follow soft links.
9809 if ls -lLd "$potent_lib" 2>/dev/null |
9810 $GREP " -> " >/dev/null; then
9813 # The statement above tries to avoid entering an
9814 # endless loop below, in case of cyclic links.
9815 # We might still enter an endless loop, since a link
9816 # loop can be closed while we follow links,
9819 while test -h "$potlib" 2>/dev/null; do
9820 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9822 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9823 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9826 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9828 $EGREP "$file_magic_regex" > /dev/null; then
9829 func_append newdeplibs " $a_deplib"
9836 if test -n "$a_deplib"; then
9839 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9840 echo "*** I have the capability to make that library automatically link in when"
9841 echo "*** you link to this library. But I can only do this if you have a"
9842 echo "*** shared version of the library, which you do not appear to have"
9843 echo "*** because I did check the linker path looking for a file starting"
9844 if test -z "$potlib"; then
9845 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9847 $ECHO "*** with $libname and none of the candidates passed a file format test"
9848 $ECHO "*** using a file magic. Last file checked: $potlib"
9853 # Add a -L argument.
9854 func_append newdeplibs " $a_deplib"
9857 done # Gone through all deplibs.
9860 set dummy $deplibs_check_method; shift
9861 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9862 for a_deplib in $deplibs; do
9865 func_stripname -l '' "$a_deplib"
9866 name=$func_stripname_result
9867 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9868 case " $predeps $postdeps " in
9870 func_append newdeplibs " $a_deplib"
9875 if test -n "$a_deplib"; then
9876 libname=`eval "\\$ECHO \"$libname_spec\""`
9877 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9878 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9879 for potent_lib in $potential_libs; do
9880 potlib=$potent_lib # see symlink-check above in file_magic test
9881 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9882 $EGREP "$match_pattern_regex" > /dev/null; then
9883 func_append newdeplibs " $a_deplib"
9890 if test -n "$a_deplib"; then
9893 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9894 echo "*** I have the capability to make that library automatically link in when"
9895 echo "*** you link to this library. But I can only do this if you have a"
9896 echo "*** shared version of the library, which you do not appear to have"
9897 echo "*** because I did check the linker path looking for a file starting"
9898 if test -z "$potlib"; then
9899 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9901 $ECHO "*** with $libname and none of the candidates passed a file format test"
9902 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9907 # Add a -L argument.
9908 func_append newdeplibs " $a_deplib"
9911 done # Gone through all deplibs.
9915 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9916 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9917 for i in $predeps $postdeps; do
9918 # can't use Xsed below, because $i might contain '/'
9919 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9922 case $tmp_deplibs in
9925 if test none = "$deplibs_check_method"; then
9926 echo "*** Warning: inter-library dependencies are not supported in this platform."
9928 echo "*** Warning: inter-library dependencies are not known to be supported."
9930 echo "*** All declared inter-library dependencies are being dropped."
9936 versuffix=$versuffix_save
9938 release=$release_save
9939 libname=$libname_save
9943 *-*-rhapsody* | *-*-darwin1.[012])
9944 # On Rhapsody replace the C library with the System framework
9945 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9949 if test yes = "$droppeddeps"; then
9950 if test yes = "$module"; then
9952 echo "*** Warning: libtool could not satisfy all declared inter-library"
9953 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9954 echo "*** a static module, that should work as long as the dlopening"
9955 echo "*** application is linked with the -dlopen flag."
9956 if test -z "$global_symbol_pipe"; then
9958 echo "*** However, this would only work if libtool was able to extract symbol"
9959 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9960 echo "*** not find such a program. So, this module is probably useless."
9961 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9963 if test no = "$build_old_libs"; then
9964 oldlibs=$output_objdir/$libname.$libext
9965 build_libtool_libs=module
9968 build_libtool_libs=no
9971 echo "*** The inter-library dependencies that have been dropped here will be"
9972 echo "*** automatically added whenever a program is linked with this library"
9973 echo "*** or is declared to -dlopen it."
9975 if test no = "$allow_undefined"; then
9977 echo "*** Since this library must not contain undefined symbols,"
9978 echo "*** because either the platform does not support them or"
9979 echo "*** it was explicitly requested with -no-undefined,"
9980 echo "*** libtool will only create a static version of it."
9981 if test no = "$build_old_libs"; then
9982 oldlibs=$output_objdir/$libname.$libext
9983 build_libtool_libs=module
9986 build_libtool_libs=no
9991 # Done checking deplibs!
9994 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9997 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9998 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9999 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10003 # move library search paths that coincide with paths to not yet
10004 # installed libraries to the beginning of the library search list
10006 for path in $notinst_path; do
10007 case " $new_libs " in
10008 *" -L$path/$objdir "*) ;;
10010 case " $deplibs " in
10011 *" -L$path/$objdir "*)
10012 func_append new_libs " -L$path/$objdir" ;;
10017 for deplib in $deplibs; do
10020 case " $new_libs " in
10022 *) func_append new_libs " $deplib" ;;
10025 *) func_append new_libs " $deplib" ;;
10030 # All the library-specific variables (install_libdir is set above).
10035 # Test again, we may have decided not to build it any more
10036 if test yes = "$build_libtool_libs"; then
10037 # Remove $wl instances when linking with ld.
10038 # FIXME: should test the right _cmds variable.
10039 case $archive_cmds in
10042 if test yes = "$hardcode_into_libs"; then
10043 # Hardcode the library paths
10046 rpath=$finalize_rpath
10047 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
10048 for libdir in $rpath; do
10049 if test -n "$hardcode_libdir_flag_spec"; then
10050 if test -n "$hardcode_libdir_separator"; then
10051 func_replace_sysroot "$libdir"
10052 libdir=$func_replace_sysroot_result
10053 if test -z "$hardcode_libdirs"; then
10054 hardcode_libdirs=$libdir
10056 # Just accumulate the unique libdirs.
10057 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10058 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10061 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10066 eval flag=\"$hardcode_libdir_flag_spec\"
10067 func_append dep_rpath " $flag"
10069 elif test -n "$runpath_var"; then
10070 case "$perm_rpath " in
10072 *) func_append perm_rpath " $libdir" ;;
10076 # Substitute the hardcoded libdirs into the rpath.
10077 if test -n "$hardcode_libdir_separator" &&
10078 test -n "$hardcode_libdirs"; then
10079 libdir=$hardcode_libdirs
10080 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
10082 if test -n "$runpath_var" && test -n "$perm_rpath"; then
10083 # We should set the runpath_var.
10085 for dir in $perm_rpath; do
10086 func_append rpath "$dir:"
10088 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
10090 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
10093 shlibpath=$finalize_shlibpath
10094 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
10095 if test -n "$shlibpath"; then
10096 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
10099 # Get the real and link names of the library.
10100 eval shared_ext=\"$shrext_cmds\"
10101 eval library_names=\"$library_names_spec\"
10102 set dummy $library_names
10107 if test -n "$soname_spec"; then
10108 eval soname=\"$soname_spec\"
10112 if test -z "$dlname"; then
10116 lib=$output_objdir/$realname
10120 func_append linknames " $link"
10123 # Use standard objects if they are pic
10124 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
10125 test "X$libobjs" = "X " && libobjs=
10128 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10129 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
10130 export_symbols=$output_objdir/$libname.uexp
10131 func_append delfiles " $export_symbols"
10134 orig_export_symbols=
10136 cygwin* | mingw* | cegcc*)
10137 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
10138 # exporting using user supplied symfile
10139 func_dll_def_p "$export_symbols" || {
10140 # and it's NOT already a .def file. Must figure out
10141 # which of the given symbols are data symbols and tag
10142 # them as such. So, trigger use of export_symbols_cmds.
10143 # export_symbols gets reassigned inside the "prepare
10144 # the list of exported symbols" if statement, so the
10145 # include_expsyms logic still works.
10146 orig_export_symbols=$export_symbols
10148 always_export_symbols=yes
10154 # Prepare the list of exported symbols
10155 if test -z "$export_symbols"; then
10156 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
10157 func_verbose "generating symbol list for '$libname.la'"
10158 export_symbols=$output_objdir/$libname.exp
10159 $opt_dry_run || $RM $export_symbols
10160 cmds=$export_symbols_cmds
10161 save_ifs=$IFS; IFS='~'
10162 for cmd1 in $cmds; do
10164 # Take the normal branch if the nm_file_list_spec branch
10165 # doesn't work or if tool conversion is not needed.
10166 case $nm_file_list_spec~$to_tool_file_cmd in
10167 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
10168 try_normal_branch=yes
10171 len=$func_len_result
10174 try_normal_branch=no
10177 if test yes = "$try_normal_branch" \
10178 && { test "$len" -lt "$max_cmd_len" \
10179 || test "$max_cmd_len" -le -1; }
10181 func_show_eval "$cmd" 'exit $?'
10182 skipped_export=false
10183 elif test -n "$nm_file_list_spec"; then
10184 func_basename "$output"
10185 output_la=$func_basename_result
10186 save_libobjs=$libobjs
10187 save_output=$output
10188 output=$output_objdir/$output_la.nm
10189 func_to_tool_file "$output"
10190 libobjs=$nm_file_list_spec$func_to_tool_file_result
10191 func_append delfiles " $output"
10192 func_verbose "creating $NM input file list: $output"
10193 for obj in $save_libobjs; do
10194 func_to_tool_file "$obj"
10195 $ECHO "$func_to_tool_file_result"
10198 func_show_eval "$cmd" 'exit $?'
10199 output=$save_output
10200 libobjs=$save_libobjs
10201 skipped_export=false
10203 # The command line is too long to execute in one step.
10204 func_verbose "using reloadable object file for export list..."
10206 # Break out early, otherwise skipped_export may be
10207 # set to false by a later but shorter cmd.
10212 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
10213 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10214 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10219 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10220 tmp_export_symbols=$export_symbols
10221 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10222 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10225 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
10226 # The given exports_symbols file has to be filtered, so filter it.
10227 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10228 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10229 # 's' commands, which not all seds can handle. GNU sed should be fine
10230 # though. Also, the filter scales superlinearly with the number of
10231 # global variables. join(1) would be nice here, but unfortunately
10232 # isn't a blessed tool.
10233 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10234 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10235 export_symbols=$output_objdir/$libname.def
10236 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10240 for test_deplib in $deplibs; do
10241 case " $convenience " in
10242 *" $test_deplib "*) ;;
10244 func_append tmp_deplibs " $test_deplib"
10248 deplibs=$tmp_deplibs
10250 if test -n "$convenience"; then
10251 if test -n "$whole_archive_flag_spec" &&
10252 test yes = "$compiler_needs_object" &&
10253 test -z "$libobjs"; then
10254 # extract the archives, so we have objects to list.
10255 # TODO: could optimize this to just extract one archive.
10256 whole_archive_flag_spec=
10258 if test -n "$whole_archive_flag_spec"; then
10259 save_libobjs=$libobjs
10260 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10261 test "X$libobjs" = "X " && libobjs=
10263 gentop=$output_objdir/${outputname}x
10264 func_append generated " $gentop"
10266 func_extract_archives $gentop $convenience
10267 func_append libobjs " $func_extract_archives_result"
10268 test "X$libobjs" = "X " && libobjs=
10272 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
10273 eval flag=\"$thread_safe_flag_spec\"
10274 func_append linker_flags " $flag"
10277 # Make a backup of the uninstalled library when relinking
10278 if test relink = "$opt_mode"; then
10279 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
10282 # Do each of the archive commands.
10283 if test yes = "$module" && test -n "$module_cmds"; then
10284 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10285 eval test_cmds=\"$module_expsym_cmds\"
10286 cmds=$module_expsym_cmds
10288 eval test_cmds=\"$module_cmds\"
10292 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10293 eval test_cmds=\"$archive_expsym_cmds\"
10294 cmds=$archive_expsym_cmds
10296 eval test_cmds=\"$archive_cmds\"
10301 if test : != "$skipped_export" &&
10302 func_len " $test_cmds" &&
10303 len=$func_len_result &&
10304 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10307 # The command line is too long to link in one step, link piecewise
10308 # or, if using GNU ld and skipped_export is not :, use a linker
10311 # Save the value of $output and $libobjs because we want to
10312 # use them later. If we have whole_archive_flag_spec, we
10313 # want to use save_libobjs as it was before
10314 # whole_archive_flag_spec was expanded, because we can't
10315 # assume the linker understands whole_archive_flag_spec.
10316 # This may have to be revisited, in case too many
10317 # convenience libraries get linked in and end up exceeding
10319 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
10320 save_libobjs=$libobjs
10322 save_output=$output
10323 func_basename "$output"
10324 output_la=$func_basename_result
10326 # Clear the reloadable object creation command queue and
10327 # initialize k to one.
10334 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
10335 output=$output_objdir/$output_la.lnkscript
10336 func_verbose "creating GNU ld script: $output"
10337 echo 'INPUT (' > $output
10338 for obj in $save_libobjs
10340 func_to_tool_file "$obj"
10341 $ECHO "$func_to_tool_file_result" >> $output
10343 echo ')' >> $output
10344 func_append delfiles " $output"
10345 func_to_tool_file "$output"
10346 output=$func_to_tool_file_result
10347 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
10348 output=$output_objdir/$output_la.lnk
10349 func_verbose "creating linker input file list: $output"
10351 set x $save_libobjs
10354 if test yes = "$compiler_needs_object"; then
10360 func_to_tool_file "$obj"
10361 $ECHO "$func_to_tool_file_result" >> $output
10363 func_append delfiles " $output"
10364 func_to_tool_file "$output"
10365 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
10367 if test -n "$save_libobjs"; then
10368 func_verbose "creating reloadable object files..."
10369 output=$output_objdir/$output_la-$k.$objext
10370 eval test_cmds=\"$reload_cmds\"
10371 func_len " $test_cmds"
10372 len0=$func_len_result
10375 # Loop over the list of objects to be linked.
10376 for obj in $save_libobjs
10379 func_arith $len + $func_len_result
10380 len=$func_arith_result
10381 if test -z "$objlist" ||
10382 test "$len" -lt "$max_cmd_len"; then
10383 func_append objlist " $obj"
10385 # The command $test_cmds is almost too long, add a
10386 # command to the queue.
10387 if test 1 -eq "$k"; then
10388 # The first file doesn't have a previous command to add.
10389 reload_objs=$objlist
10390 eval concat_cmds=\"$reload_cmds\"
10392 # All subsequent reloadable object files will link in
10393 # the last one created.
10394 reload_objs="$objlist $last_robj"
10395 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
10397 last_robj=$output_objdir/$output_la-$k.$objext
10399 k=$func_arith_result
10400 output=$output_objdir/$output_la-$k.$objext
10402 func_len " $last_robj"
10403 func_arith $len0 + $func_len_result
10404 len=$func_arith_result
10407 # Handle the remaining objects by creating one last
10408 # reloadable object file. All subsequent reloadable object
10409 # files will link in the last one created.
10410 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10411 reload_objs="$objlist $last_robj"
10412 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
10413 if test -n "$last_robj"; then
10414 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10416 func_append delfiles " $output"
10422 ${skipped_export-false} && {
10423 func_verbose "generating symbol list for '$libname.la'"
10424 export_symbols=$output_objdir/$libname.exp
10425 $opt_dry_run || $RM $export_symbols
10427 # Append the command to create the export file.
10428 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10429 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
10430 if test -n "$last_robj"; then
10431 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10435 test -n "$save_libobjs" &&
10436 func_verbose "creating a temporary reloadable object file: $output"
10438 # Loop through the commands generated above and execute them.
10439 save_ifs=$IFS; IFS='~'
10440 for cmd in $concat_cmds; do
10443 func_quote_for_expand "$cmd"
10444 eval "func_echo $func_quote_for_expand_result"
10446 $opt_dry_run || eval "$cmd" || {
10449 # Restore the uninstalled library and exit
10450 if test relink = "$opt_mode"; then
10451 ( cd "$output_objdir" && \
10452 $RM "${realname}T" && \
10453 $MV "${realname}U" "$realname" )
10461 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
10462 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10463 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10467 ${skipped_export-false} && {
10468 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10469 tmp_export_symbols=$export_symbols
10470 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10471 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10474 if test -n "$orig_export_symbols"; then
10475 # The given exports_symbols file has to be filtered, so filter it.
10476 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10477 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10478 # 's' commands, which not all seds can handle. GNU sed should be fine
10479 # though. Also, the filter scales superlinearly with the number of
10480 # global variables. join(1) would be nice here, but unfortunately
10481 # isn't a blessed tool.
10482 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10483 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10484 export_symbols=$output_objdir/$libname.def
10485 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10490 # Restore the value of output.
10491 output=$save_output
10493 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10494 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10495 test "X$libobjs" = "X " && libobjs=
10497 # Expand the library linking commands again to reset the
10498 # value of $libobjs for piecewise linking.
10500 # Do each of the archive commands.
10501 if test yes = "$module" && test -n "$module_cmds"; then
10502 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10503 cmds=$module_expsym_cmds
10508 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10509 cmds=$archive_expsym_cmds
10516 if test -n "$delfiles"; then
10517 # Append the command to remove temporary files to $cmds.
10518 eval cmds=\"\$cmds~\$RM $delfiles\"
10521 # Add any objects from preloaded convenience libraries
10522 if test -n "$dlprefiles"; then
10523 gentop=$output_objdir/${outputname}x
10524 func_append generated " $gentop"
10526 func_extract_archives $gentop $dlprefiles
10527 func_append libobjs " $func_extract_archives_result"
10528 test "X$libobjs" = "X " && libobjs=
10531 save_ifs=$IFS; IFS='~'
10532 for cmd in $cmds; do
10537 func_quote_for_expand "$cmd"
10538 eval "func_echo $func_quote_for_expand_result"
10540 $opt_dry_run || eval "$cmd" || {
10543 # Restore the uninstalled library and exit
10544 if test relink = "$opt_mode"; then
10545 ( cd "$output_objdir" && \
10546 $RM "${realname}T" && \
10547 $MV "${realname}U" "$realname" )
10555 # Restore the uninstalled library and exit
10556 if test relink = "$opt_mode"; then
10557 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10559 if test -n "$convenience"; then
10560 if test -z "$whole_archive_flag_spec"; then
10561 func_show_eval '${RM}r "$gentop"'
10568 # Create links to the real library.
10569 for linkname in $linknames; do
10570 if test "$realname" != "$linkname"; then
10571 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10575 # If -module or -export-dynamic was specified, set the dlname.
10576 if test yes = "$module" || test yes = "$export_dynamic"; then
10577 # On all known operating systems, these are identical.
10584 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10585 func_warning "'-dlopen' is ignored for objects"
10588 case " $deplibs" in
10590 func_warning "'-l' and '-L' are ignored for objects" ;;
10593 test -n "$rpath" && \
10594 func_warning "'-rpath' is ignored for objects"
10596 test -n "$xrpath" && \
10597 func_warning "'-R' is ignored for objects"
10599 test -n "$vinfo" && \
10600 func_warning "'-version-info' is ignored for objects"
10602 test -n "$release" && \
10603 func_warning "'-release' is ignored for objects"
10607 test -n "$objs$old_deplibs" && \
10608 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10611 func_lo2o "$libobj"
10612 obj=$func_lo2o_result
10620 # Delete the old objects.
10621 $opt_dry_run || $RM $obj $libobj
10623 # Objects from convenience libraries. This assumes
10624 # single-version convenience libraries. Whenever we create
10625 # different ones for PIC/non-PIC, this we'll have to duplicate
10629 # if reload_cmds runs $LD directly, get rid of -Wl from
10630 # whole_archive_flag_spec and hope we can get by with turning comma
10632 case $reload_cmds in
10633 *\$LD[\ \$]*) wl= ;;
10635 if test -n "$convenience"; then
10636 if test -n "$whole_archive_flag_spec"; then
10637 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10638 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10639 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10641 gentop=$output_objdir/${obj}x
10642 func_append generated " $gentop"
10644 func_extract_archives $gentop $convenience
10645 reload_conv_objs="$reload_objs $func_extract_archives_result"
10649 # If we're not building shared, we need to use non_pic_objs
10650 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10652 # Create the old-style object.
10653 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10656 func_execute_cmds "$reload_cmds" 'exit $?'
10658 # Exit if we aren't doing a library object file.
10659 if test -z "$libobj"; then
10660 if test -n "$gentop"; then
10661 func_show_eval '${RM}r "$gentop"'
10667 test yes = "$build_libtool_libs" || {
10668 if test -n "$gentop"; then
10669 func_show_eval '${RM}r "$gentop"'
10672 # Create an invalid libtool object if no PIC, so that we don't
10673 # accidentally link it into a program.
10674 # $show "echo timestamp > $libobj"
10675 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10679 if test -n "$pic_flag" || test default != "$pic_mode"; then
10680 # Only do commands if we really have different PIC objects.
10681 reload_objs="$libobjs $reload_conv_objs"
10683 func_execute_cmds "$reload_cmds" 'exit $?'
10686 if test -n "$gentop"; then
10687 func_show_eval '${RM}r "$gentop"'
10695 *cygwin*) func_stripname '' '.exe' "$output"
10696 output=$func_stripname_result.exe;;
10698 test -n "$vinfo" && \
10699 func_warning "'-version-info' is ignored for programs"
10701 test -n "$release" && \
10702 func_warning "'-release' is ignored for programs"
10705 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10706 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10709 *-*-rhapsody* | *-*-darwin1.[012])
10710 # On Rhapsody replace the C library is the System framework
10711 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10712 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10718 # Don't allow lazy linking, it breaks C++ global constructors
10719 # But is supposedly fixed on 10.4 or later (yay!).
10720 if test CXX = "$tagname"; then
10721 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10723 func_append compile_command " $wl-bind_at_load"
10724 func_append finalize_command " $wl-bind_at_load"
10728 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10729 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10730 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10735 # move library search paths that coincide with paths to not yet
10736 # installed libraries to the beginning of the library search list
10738 for path in $notinst_path; do
10739 case " $new_libs " in
10740 *" -L$path/$objdir "*) ;;
10742 case " $compile_deplibs " in
10743 *" -L$path/$objdir "*)
10744 func_append new_libs " -L$path/$objdir" ;;
10749 for deplib in $compile_deplibs; do
10752 case " $new_libs " in
10754 *) func_append new_libs " $deplib" ;;
10757 *) func_append new_libs " $deplib" ;;
10760 compile_deplibs=$new_libs
10763 func_append compile_command " $compile_deplibs"
10764 func_append finalize_command " $finalize_deplibs"
10766 if test -n "$rpath$xrpath"; then
10767 # If the user specified any rpath flags, then add them.
10768 for libdir in $rpath $xrpath; do
10769 # This is the magic to use -rpath.
10770 case "$finalize_rpath " in
10772 *) func_append finalize_rpath " $libdir" ;;
10777 # Now hardcode the library paths
10780 for libdir in $compile_rpath $finalize_rpath; do
10781 if test -n "$hardcode_libdir_flag_spec"; then
10782 if test -n "$hardcode_libdir_separator"; then
10783 if test -z "$hardcode_libdirs"; then
10784 hardcode_libdirs=$libdir
10786 # Just accumulate the unique libdirs.
10787 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10788 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10791 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10796 eval flag=\"$hardcode_libdir_flag_spec\"
10797 func_append rpath " $flag"
10799 elif test -n "$runpath_var"; then
10800 case "$perm_rpath " in
10802 *) func_append perm_rpath " $libdir" ;;
10806 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10807 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10808 case :$dllsearchpath: in
10810 ::) dllsearchpath=$libdir;;
10811 *) func_append dllsearchpath ":$libdir";;
10813 case :$dllsearchpath: in
10814 *":$testbindir:"*) ;;
10815 ::) dllsearchpath=$testbindir;;
10816 *) func_append dllsearchpath ":$testbindir";;
10821 # Substitute the hardcoded libdirs into the rpath.
10822 if test -n "$hardcode_libdir_separator" &&
10823 test -n "$hardcode_libdirs"; then
10824 libdir=$hardcode_libdirs
10825 eval rpath=\" $hardcode_libdir_flag_spec\"
10827 compile_rpath=$rpath
10831 for libdir in $finalize_rpath; do
10832 if test -n "$hardcode_libdir_flag_spec"; then
10833 if test -n "$hardcode_libdir_separator"; then
10834 if test -z "$hardcode_libdirs"; then
10835 hardcode_libdirs=$libdir
10837 # Just accumulate the unique libdirs.
10838 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10839 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10842 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10847 eval flag=\"$hardcode_libdir_flag_spec\"
10848 func_append rpath " $flag"
10850 elif test -n "$runpath_var"; then
10851 case "$finalize_perm_rpath " in
10853 *) func_append finalize_perm_rpath " $libdir" ;;
10857 # Substitute the hardcoded libdirs into the rpath.
10858 if test -n "$hardcode_libdir_separator" &&
10859 test -n "$hardcode_libdirs"; then
10860 libdir=$hardcode_libdirs
10861 eval rpath=\" $hardcode_libdir_flag_spec\"
10863 finalize_rpath=$rpath
10865 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10866 # Transform all the library objects into standard objects.
10867 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10868 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10871 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10873 # template prelinking step
10874 if test -n "$prelink_cmds"; then
10875 func_execute_cmds "$prelink_cmds" 'exit $?'
10878 wrappers_required=:
10880 *cegcc* | *mingw32ce*)
10881 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10882 wrappers_required=false
10884 *cygwin* | *mingw* )
10885 test yes = "$build_libtool_libs" || wrappers_required=false
10888 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10889 wrappers_required=false
10893 $wrappers_required || {
10894 # Replace the output file specification.
10895 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10896 link_command=$compile_command$compile_rpath
10898 # We have no uninstalled library dependencies, so finalize right now.
10900 func_show_eval "$link_command" 'exit_status=$?'
10902 if test -n "$postlink_cmds"; then
10903 func_to_tool_file "$output"
10904 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10905 func_execute_cmds "$postlink_cmds" 'exit $?'
10908 # Delete the generated files.
10909 if test -f "$output_objdir/${outputname}S.$objext"; then
10910 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10916 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10917 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10919 if test -n "$finalize_shlibpath"; then
10920 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10925 if test -n "$runpath_var"; then
10926 if test -n "$perm_rpath"; then
10927 # We should set the runpath_var.
10929 for dir in $perm_rpath; do
10930 func_append rpath "$dir:"
10932 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10934 if test -n "$finalize_perm_rpath"; then
10935 # We should set the runpath_var.
10937 for dir in $finalize_perm_rpath; do
10938 func_append rpath "$dir:"
10940 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10944 if test yes = "$no_install"; then
10945 # We don't need to create a wrapper script.
10946 link_command=$compile_var$compile_command$compile_rpath
10947 # Replace the output file specification.
10948 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10949 # Delete the old output file.
10950 $opt_dry_run || $RM $output
10951 # Link the executable and exit
10952 func_show_eval "$link_command" 'exit $?'
10954 if test -n "$postlink_cmds"; then
10955 func_to_tool_file "$output"
10956 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10957 func_execute_cmds "$postlink_cmds" 'exit $?'
10963 case $hardcode_action,$fast_install in
10965 # Fast installation is not supported
10966 link_command=$compile_var$compile_command$compile_rpath
10967 relink_command=$finalize_var$finalize_command$finalize_rpath
10969 func_warning "this platform does not like uninstalled shared libraries"
10970 func_warning "'$output' will be relinked during installation"
10973 link_command=$finalize_var$compile_command$finalize_rpath
10974 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10977 link_command=$compile_var$compile_command$compile_rpath
10978 relink_command=$finalize_var$finalize_command$finalize_rpath
10981 link_command=$finalize_var$compile_command$finalize_rpath
10986 # Replace the output file specification.
10987 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
10989 # Delete the old output files.
10990 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
10992 func_show_eval "$link_command" 'exit $?'
10994 if test -n "$postlink_cmds"; then
10995 func_to_tool_file "$output_objdir/$outputname"
10996 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10997 func_execute_cmds "$postlink_cmds" 'exit $?'
11000 # Now create the wrapper script.
11001 func_verbose "creating $output"
11003 # Quote the relink command for shipping.
11004 if test -n "$relink_command"; then
11005 # Preserve any variables that may affect compiler behavior
11006 for var in $variables_saved_for_relink; do
11007 if eval test -z \"\${$var+set}\"; then
11008 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11009 elif eval var_value=\$$var; test -z "$var_value"; then
11010 relink_command="$var=; export $var; $relink_command"
11012 func_quote_for_eval "$var_value"
11013 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
11016 relink_command="(cd `pwd`; $relink_command)"
11017 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
11020 # Only actually do things if not in dry run mode.
11022 # win32 will think the script is a binary if it has
11023 # a .exe suffix, so we strip it off here.
11025 *.exe) func_stripname '' '.exe' "$output"
11026 output=$func_stripname_result ;;
11028 # test for cygwin because mv fails w/o .exe extensions
11032 func_stripname '' '.exe' "$outputname"
11033 outputname=$func_stripname_result ;;
11037 *cygwin* | *mingw* )
11038 func_dirname_and_basename "$output" "" "."
11039 output_name=$func_basename_result
11040 output_path=$func_dirname_result
11041 cwrappersource=$output_path/$objdir/lt-$output_name.c
11042 cwrapper=$output_path/$output_name.exe
11043 $RM $cwrappersource $cwrapper
11044 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
11046 func_emit_cwrapperexe_src > $cwrappersource
11048 # The wrapper executable is built using the $host compiler,
11049 # because it contains $host paths and files. If cross-
11050 # compiling, it, like the target executable, must be
11051 # executed on the $host or under an emulation environment.
11053 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
11057 # Now, create the wrapper script for func_source use:
11058 func_ltwrapper_scriptname $cwrapper
11059 $RM $func_ltwrapper_scriptname_result
11060 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
11062 # note: this script will not be executed, so do not chmod.
11063 if test "x$build" = "x$host"; then
11064 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
11066 func_emit_wrapper no > $func_ltwrapper_scriptname_result
11072 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
11074 func_emit_wrapper no > $output
11083 # See if we need to build an old-fashioned archive.
11084 for oldlib in $oldlibs; do
11086 case $build_libtool_libs in
11088 oldobjs="$libobjs_save $symfileobj"
11089 addlibs=$convenience
11090 build_libtool_libs=no
11093 oldobjs=$libobjs_save
11094 addlibs=$old_convenience
11095 build_libtool_libs=no
11098 oldobjs="$old_deplibs $non_pic_objects"
11099 $preload && test -f "$symfileobj" \
11100 && func_append oldobjs " $symfileobj"
11101 addlibs=$old_convenience
11105 if test -n "$addlibs"; then
11106 gentop=$output_objdir/${outputname}x
11107 func_append generated " $gentop"
11109 func_extract_archives $gentop $addlibs
11110 func_append oldobjs " $func_extract_archives_result"
11113 # Do each command in the archive commands.
11114 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
11115 cmds=$old_archive_from_new_cmds
11118 # Add any objects from preloaded convenience libraries
11119 if test -n "$dlprefiles"; then
11120 gentop=$output_objdir/${outputname}x
11121 func_append generated " $gentop"
11123 func_extract_archives $gentop $dlprefiles
11124 func_append oldobjs " $func_extract_archives_result"
11127 # POSIX demands no paths to be encoded in archives. We have
11128 # to avoid creating archives with duplicate basenames if we
11129 # might have to extract them afterwards, e.g., when creating a
11130 # static archive out of a convenience library, or when linking
11131 # the entirety of a libtool archive into another (currently
11132 # not supported by libtool).
11133 if (for obj in $oldobjs
11135 func_basename "$obj"
11136 $ECHO "$func_basename_result"
11137 done | sort | sort -uc >/dev/null 2>&1); then
11140 echo "copying selected object files to avoid basename conflicts..."
11141 gentop=$output_objdir/${outputname}x
11142 func_append generated " $gentop"
11143 func_mkdir_p "$gentop"
11144 save_oldobjs=$oldobjs
11147 for obj in $save_oldobjs
11149 func_basename "$obj"
11150 objbase=$func_basename_result
11151 case " $oldobjs " in
11152 " ") oldobjs=$obj ;;
11153 *[\ /]"$objbase "*)
11155 # Make sure we don't pick an alternate name that also
11157 newobj=lt$counter-$objbase
11158 func_arith $counter + 1
11159 counter=$func_arith_result
11160 case " $oldobjs " in
11161 *[\ /]"$newobj "*) ;;
11162 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
11165 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
11166 func_append oldobjs " $gentop/$newobj"
11168 *) func_append oldobjs " $obj" ;;
11172 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
11173 tool_oldlib=$func_to_tool_file_result
11174 eval cmds=\"$old_archive_cmds\"
11177 len=$func_len_result
11178 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
11179 cmds=$old_archive_cmds
11180 elif test -n "$archiver_list_spec"; then
11181 func_verbose "using command file archive linking..."
11182 for obj in $oldobjs
11184 func_to_tool_file "$obj"
11185 $ECHO "$func_to_tool_file_result"
11186 done > $output_objdir/$libname.libcmd
11187 func_to_tool_file "$output_objdir/$libname.libcmd"
11188 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
11189 cmds=$old_archive_cmds
11191 # the command line is too long to link in one step, link in parts
11192 func_verbose "using piecewise archive linking..."
11193 save_RANLIB=$RANLIB
11197 save_oldobjs=$oldobjs
11199 # Is there a better way of finding the last object in the list?
11200 for obj in $save_oldobjs
11204 eval test_cmds=\"$old_archive_cmds\"
11205 func_len " $test_cmds"
11206 len0=$func_len_result
11208 for obj in $save_oldobjs
11211 func_arith $len + $func_len_result
11212 len=$func_arith_result
11213 func_append objlist " $obj"
11214 if test "$len" -lt "$max_cmd_len"; then
11217 # the above command should be used before it gets too long
11219 if test "$obj" = "$last_oldobj"; then
11220 RANLIB=$save_RANLIB
11222 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
11223 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
11228 RANLIB=$save_RANLIB
11230 if test -z "$oldobjs"; then
11231 eval cmds=\"\$concat_cmds\"
11233 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
11237 func_execute_cmds "$cmds" 'exit $?'
11240 test -n "$generated" && \
11241 func_show_eval "${RM}r$generated"
11243 # Now create the libtool archive.
11247 test yes = "$build_old_libs" && old_library=$libname.$libext
11248 func_verbose "creating $output"
11250 # Preserve any variables that may affect compiler behavior
11251 for var in $variables_saved_for_relink; do
11252 if eval test -z \"\${$var+set}\"; then
11253 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11254 elif eval var_value=\$$var; test -z "$var_value"; then
11255 relink_command="$var=; export $var; $relink_command"
11257 func_quote_for_eval "$var_value"
11258 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
11261 # Quote the link command for shipping.
11262 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
11263 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
11264 if test yes = "$hardcode_automatic"; then
11268 # Only create the output if not a dry run.
11270 for installed in no yes; do
11271 if test yes = "$installed"; then
11272 if test -z "$install_libdir"; then
11275 output=$output_objdir/${outputname}i
11276 # Replace all uninstalled libtool libraries with the installed ones
11277 newdependency_libs=
11278 for deplib in $dependency_libs; do
11281 func_basename "$deplib"
11282 name=$func_basename_result
11283 func_resolve_sysroot "$deplib"
11284 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
11285 test -z "$libdir" && \
11286 func_fatal_error "'$deplib' is not a valid libtool archive"
11287 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
11290 func_stripname -L '' "$deplib"
11291 func_replace_sysroot "$func_stripname_result"
11292 func_append newdependency_libs " -L$func_replace_sysroot_result"
11295 func_stripname -R '' "$deplib"
11296 func_replace_sysroot "$func_stripname_result"
11297 func_append newdependency_libs " -R$func_replace_sysroot_result"
11299 *) func_append newdependency_libs " $deplib" ;;
11302 dependency_libs=$newdependency_libs
11305 for lib in $dlfiles; do
11308 func_basename "$lib"
11309 name=$func_basename_result
11310 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11311 test -z "$libdir" && \
11312 func_fatal_error "'$lib' is not a valid libtool archive"
11313 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
11315 *) func_append newdlfiles " $lib" ;;
11318 dlfiles=$newdlfiles
11320 for lib in $dlprefiles; do
11323 # Only pass preopened files to the pseudo-archive (for
11324 # eventual linking with the app. that links it) if we
11325 # didn't already link the preopened objects directly into
11327 func_basename "$lib"
11328 name=$func_basename_result
11329 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11330 test -z "$libdir" && \
11331 func_fatal_error "'$lib' is not a valid libtool archive"
11332 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
11336 dlprefiles=$newdlprefiles
11339 for lib in $dlfiles; do
11341 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11342 *) abs=`pwd`"/$lib" ;;
11344 func_append newdlfiles " $abs"
11346 dlfiles=$newdlfiles
11348 for lib in $dlprefiles; do
11350 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11351 *) abs=`pwd`"/$lib" ;;
11353 func_append newdlprefiles " $abs"
11355 dlprefiles=$newdlprefiles
11358 # place dlname in correct position for cygwin
11359 # In fact, it would be nice if we could use this code for all target
11360 # systems that can't hard-code library paths into their executables
11361 # and that have no shared library path variable independent of PATH,
11362 # but it turns out we can't easily determine that from inspecting
11363 # libtool variables, so we have to hard-code the OSs to which it
11364 # applies here; at the moment, that means platforms that use the PE
11365 # object format with DLL files. See the long comment at the top of
11366 # tests/bindir.at for full details.
11368 case $host,$output,$installed,$module,$dlname in
11369 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
11370 # If a -bindir argument was supplied, place the dll there.
11371 if test -n "$bindir"; then
11372 func_relative_path "$install_libdir" "$bindir"
11373 tdlname=$func_relative_path_result/$dlname
11375 # Otherwise fall back on heuristic.
11376 tdlname=../bin/$dlname
11381 # $outputname - a libtool library file
11382 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
11384 # Please DO NOT delete this file!
11385 # It is necessary for linking the library.
11387 # The name that we can dlopen(3).
11390 # Names of this library.
11391 library_names='$library_names'
11393 # The name of the static archive.
11394 old_library='$old_library'
11396 # Linker flags that cannot go in dependency_libs.
11397 inherited_linker_flags='$new_inherited_linker_flags'
11399 # Libraries that this one depends upon.
11400 dependency_libs='$dependency_libs'
11402 # Names of additional weak libraries provided by this library
11403 weak_library_names='$weak_libs'
11405 # Version information for $libname.
11410 # Is this an already installed library?
11411 installed=$installed
11413 # Should we warn about portability when linking against -modules?
11414 shouldnotlink=$module
11416 # Files to dlopen/dlpreopen
11418 dlpreopen='$dlprefiles'
11420 # Directory that this library needs to be installed in:
11421 libdir='$install_libdir'"
11422 if test no,yes = "$installed,$need_relink"; then
11423 $ECHO >> $output "\
11424 relink_command=\"$relink_command\""
11429 # Do a symbolic link so that the libtool archive can be found in
11430 # LD_LIBRARY_PATH before the program is installed.
11431 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
11437 if test link = "$opt_mode" || test relink = "$opt_mode"; then
11438 func_mode_link ${1+"$@"}
11442 # func_mode_uninstall arg...
11443 func_mode_uninstall ()
11452 # This variable tells wrapper scripts just to set variables rather
11453 # than running their programs.
11454 libtool_install_magic=$magic
11459 -f) func_append RM " $arg"; rmforce=: ;;
11460 -*) func_append RM " $arg" ;;
11461 *) func_append files " $arg" ;;
11466 func_fatal_help "you must specify an RM program"
11470 for file in $files; do
11471 func_dirname "$file" "" "."
11472 dir=$func_dirname_result
11473 if test . = "$dir"; then
11478 func_basename "$file"
11479 name=$func_basename_result
11480 test uninstall = "$opt_mode" && odir=$dir
11482 # Remember odir for removal later, being careful to avoid duplicates
11483 if test clean = "$opt_mode"; then
11484 case " $rmdirs " in
11486 *) func_append rmdirs " $odir" ;;
11490 # Don't error if the file doesn't exist and rm -f was used.
11491 if { test -L "$file"; } >/dev/null 2>&1 ||
11492 { test -h "$file"; } >/dev/null 2>&1 ||
11493 test -f "$file"; then
11495 elif test -d "$file"; then
11498 elif $rmforce; then
11506 # Possibly a libtool archive, so verify it.
11507 if func_lalib_p "$file"; then
11508 func_source $dir/$name
11510 # Delete the libtool libraries and symlinks.
11511 for n in $library_names; do
11512 func_append rmfiles " $odir/$n"
11514 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11518 case " $library_names " in
11520 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11522 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11525 if test -n "$library_names"; then
11526 # Do each command in the postuninstall commands.
11527 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11530 if test -n "$old_library"; then
11531 # Do each command in the old_postuninstall commands.
11532 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11534 # FIXME: should reinstall the best remaining shared library.
11541 # Possibly a libtool object, so verify it.
11542 if func_lalib_p "$file"; then
11544 # Read the .lo file
11545 func_source $dir/$name
11547 # Add PIC object to the list of files to remove.
11548 if test -n "$pic_object" && test none != "$pic_object"; then
11549 func_append rmfiles " $dir/$pic_object"
11552 # Add non-PIC object to the list of files to remove.
11553 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11554 func_append rmfiles " $dir/$non_pic_object"
11560 if test clean = "$opt_mode"; then
11564 func_stripname '' '.exe' "$file"
11565 file=$func_stripname_result
11566 func_stripname '' '.exe' "$name"
11567 noexename=$func_stripname_result
11568 # $file with .exe has already been added to rmfiles,
11569 # add $file without .exe
11570 func_append rmfiles " $file"
11573 # Do a test to see if this is a libtool program.
11574 if func_ltwrapper_p "$file"; then
11575 if func_ltwrapper_executable_p "$file"; then
11576 func_ltwrapper_scriptname "$file"
11578 func_source $func_ltwrapper_scriptname_result
11579 func_append rmfiles " $func_ltwrapper_scriptname_result"
11582 func_source $dir/$noexename
11585 # note $name still contains .exe if it was in $file originally
11586 # as does the version of $file that was added into $rmfiles
11587 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11588 if test yes = "$fast_install" && test -n "$relink_command"; then
11589 func_append rmfiles " $odir/lt-$name"
11591 if test "X$noexename" != "X$name"; then
11592 func_append rmfiles " $odir/lt-$noexename.c"
11598 func_show_eval "$RM $rmfiles" 'exit_status=1'
11601 # Try to remove the $objdir's in the directories where we deleted files
11602 for dir in $rmdirs; do
11603 if test -d "$dir"; then
11604 func_show_eval "rmdir $dir >/dev/null 2>&1"
11611 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11612 func_mode_uninstall ${1+"$@"}
11615 test -z "$opt_mode" && {
11617 func_fatal_help "you must specify a MODE"
11620 test -z "$exec_cmd" && \
11621 func_fatal_help "invalid operation mode '$opt_mode'"
11623 if test -n "$exec_cmd"; then
11624 eval exec "$exec_cmd"
11631 # The TAGs below are defined such that we never get into a situation
11632 # where we disable both kinds of libraries. Given conflicting
11633 # choices, we go for a static library, that is the most portable,
11634 # since we can't tell whether shared libraries were disabled because
11635 # the user asked for that or because the platform doesn't support
11636 # them. This is particularly important on AIX, because we don't
11637 # support having both static and shared libraries enabled at the same
11638 # time on that platform, so we default to a shared-only configuration.
11639 # If a disable-shared tag is given, we'll fallback to a static-only
11640 # configuration. But we'll never go from static-only to shared-only.
11642 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11643 build_libtool_libs=no
11645 # ### END LIBTOOL TAG CONFIG: disable-shared
11647 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11648 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11649 # ### END LIBTOOL TAG CONFIG: disable-static
11652 # mode:shell-script