2 # Generated automatically by config.status (rtaudio) 5.0.0
3 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
5 # Provide generalized library-building support services.
6 # Written by Gordon Matzigkeit, 1996
8 # Copyright (C) 2014 Free Software Foundation, Inc.
9 # This is free software; see the source for copying conditions. There is NO
10 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 # GNU Libtool is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of of the License, or
15 # (at your option) any later version.
17 # As a special exception to the GNU General Public License, if you
18 # distribute this file as part of a program or library that is built
19 # using GNU Libtool, you may include this file under the same
20 # distribution terms that you use for the rest of that program.
22 # GNU Libtool is distributed in the hope that it will be useful, but
23 # WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
27 # You should have received a copy of the GNU General Public License
28 # along with this program. If not, see <http://www.gnu.org/licenses/>.
31 # The names of the tagged configurations supported by this script.
34 # Configured defaults for sys_lib_dlsearch_path munging.
35 : ${LT_SYS_LIBRARY_PATH=""}
37 # ### BEGIN LIBTOOL CONFIG
39 # Which release of libtool.m4 was used?
46 # DLL creation program.
49 # Object dumper program.
52 # Whether or not to build shared libraries.
53 build_libtool_libs=yes
55 # Whether or not to build static libraries.
58 # What type of objects to build.
61 # Whether or not to optimize for fast installation.
64 # Shared archive member basename,for filename based shared library versioning on AIX.
65 shared_archive_member_spec=
67 # Shell to use when invoking shell scripts.
70 # An echo program that protects backslashes.
73 # The PATH separator for the build system.
78 host=x86_64-pc-linux-gnu
83 build=x86_64-pc-linux-gnu
86 # A sed program that does not truncate output.
89 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
90 Xsed="$SED -e 1s/^X//"
92 # A grep program that handles long lines.
98 # A literal string matcher.
101 # A BSD- or MS-compatible name lister.
104 # Whether we need soft or hard links.
107 # What is the maximum length of a command?
110 # Object file suffix (normally "o").
113 # Executable file suffix (normally "").
116 # whether the shell understands "unset".
119 # turn spaces into newlines.
120 SP2NL="tr \\040 \\012"
122 # turn newlines into spaces.
123 NL2SP="tr \\015\\012 \\040\\040"
125 # convert $build file names to $host format.
126 to_host_file_cmd=func_convert_file_noop
128 # convert $build files to toolchain format.
129 to_tool_file_cmd=func_convert_file_noop
131 # Method to check whether dependent libraries are shared objects.
132 deplibs_check_method="pass_all"
134 # Command to use when deplibs_check_method = "file_magic".
135 file_magic_cmd="\$MAGIC_CMD"
137 # How to find potential files when deplibs_check_method = "file_magic".
140 # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
143 # Command to associate shared and link libraries.
144 sharedlib_from_linklib_cmd="printf %s\\n"
149 # Flags to create an archive.
152 # How to feed a file listing to the archiver.
153 archiver_list_spec="@"
155 # A symbol stripping program.
158 # Commands used to install an old-style archive.
160 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
161 old_postuninstall_cmds=""
163 # Whether to use a lock for old archive extraction.
164 lock_old_archive_extraction=no
169 # LTCC compiler flags.
172 # Take the output of nm and produce a listing of raw symbols and C names.
173 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
175 # Transform the output of nm in a proper C declaration.
176 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
178 # Transform the output of nm into a list of symbols to manually relocate.
179 global_symbol_to_import=""
181 # Transform the output of nm in a C name address pair.
182 global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'"
184 # Transform the output of nm in a C name address pair when lib prefix is needed.
185 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'"
187 # The name lister interface.
188 nm_interface="BSD nm"
190 # Specify filename containing input files for $NM.
191 nm_file_list_spec="@"
193 # The root where to search for dependent libraries,and where our libraries should be installed.
196 # Command to truncate a binary pipe.
197 lt_truncate_bin="/bin/dd bs=4096 count=1"
199 # The name of the directory that contains temporary libtool files.
202 # Used to examine libraries when file_magic_cmd begins with "file".
205 # Must we lock files when doing compilation?
211 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
214 # Tool to change global to local symbols on Mac OS X.
217 # Tool to manipulate fat objects and archives on Mac OS X.
220 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
223 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
226 # Old archive suffix (normally "a").
229 # Shared library suffix (normally ".so").
232 # The commands to extract the exported symbol list from a shared archive.
233 extract_expsyms_cmds=""
235 # Variables whose values should be saved in libtool wrapper scripts and
236 # restored at link time.
237 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
239 # Do we need the "lib" prefix for modules?
242 # Do we need a version for libraries?
245 # Library versioning type.
248 # Shared library runtime path variable.
249 runpath_var=LD_RUN_PATH
251 # Shared library path variable.
252 shlibpath_var=LD_LIBRARY_PATH
254 # Is shlibpath searched before the hard-coded library search path?
255 shlibpath_overrides_runpath=yes
257 # Format of library name prefix.
258 libname_spec="lib\$name"
260 # List of archive names. First name is the real one, the rest are links.
261 # The last name is the one that the linker finds with -lNAME
262 library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
264 # The coded name of the library, if different from the real name.
265 soname_spec="\$libname\$release\$shared_ext\$major"
267 # Permission mode override for installation of shared libraries.
268 install_override_mode=""
270 # Command to use after installation of a shared archive.
273 # Command to use after uninstallation of a shared archive.
274 postuninstall_cmds=""
276 # Commands used to finish a libtool library installation in a directory.
277 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
279 # As "finish_cmds", except a single script fragment to be evaled but
283 # Whether we should hardcode library paths into libraries.
284 hardcode_into_libs=yes
286 # Compile-time system search path for libraries.
287 sys_lib_search_path_spec="/usr/lib/gcc/x86_64-linux-gnu/7 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib "
289 # Detected run-time system search path for libraries.
290 sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib /opt/picoscope/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu "
292 # Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
293 configure_time_lt_sys_library_path=""
295 # Whether dlopen is supported.
296 dlopen_support=unknown
298 # Whether dlopen of programs is supported.
301 # Whether dlopen of statically linked programs is supported.
302 dlopen_self_static=unknown
304 # Commands to strip libraries.
305 old_striplib="strip --strip-debug"
306 striplib="strip --strip-unneeded"
309 # The linker used to build libraries.
310 LD="/usr/bin/ld -m elf_x86_64"
312 # How to create reloadable object files.
314 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
316 # Commands used to build an old-style archive.
317 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
319 # A language specific compiler.
322 # Is the compiler the GNU compiler?
325 # Compiler flag to turn off builtin functions.
326 no_builtin_flag=" -fno-builtin"
328 # Additional compiler flags for building library objects.
329 pic_flag=" -fPIC -DPIC"
331 # How to pass a linker flag through the compiler.
334 # Compiler flag to prevent dynamic linking.
335 link_static_flag="-static"
337 # Does compiler simultaneously support -c and -o options?
340 # Whether or not to add -lc for building shared libraries.
341 build_libtool_need_lc=no
343 # Whether or not to disallow shared libs when runtime libs are static.
344 allow_libtool_libs_with_static_runtimes=no
346 # Compiler flag to allow reflexive dlopens.
347 export_dynamic_flag_spec="\$wl--export-dynamic"
349 # Compiler flag to generate shared objects directly from archives.
350 whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
352 # Whether the compiler copes with passing no objects directly.
353 compiler_needs_object="no"
355 # Create an old-style archive from a shared archive.
356 old_archive_from_new_cmds=""
358 # Create a temporary old-style archive to link instead of a shared archive.
359 old_archive_from_expsyms_cmds=""
361 # Commands used to build a shared archive.
362 archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
363 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
364 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
365 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
366 \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
368 # Commands used to build a loadable module if different from building
371 module_expsym_cmds=""
373 # Whether we are building with GNU ld or not.
376 # Flag that allows shared libraries with undefined symbols to be built.
377 allow_undefined_flag=""
379 # Flag that enforces no undefined symbols.
382 # Flag to hardcode $libdir into a binary during linking.
383 # This must work even if $libdir does not exist
384 hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
386 # Whether we need a single "-rpath" flag with a separated argument.
387 hardcode_libdir_separator=""
389 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
390 # DIR into the resulting binary.
393 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
394 # DIR into the resulting binary and the resulting library dependency is
395 # "absolute",i.e impossible to change by setting $shlibpath_var if the
396 # library is relocated.
397 hardcode_direct_absolute=no
399 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
400 # into the resulting binary.
403 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
404 # into the resulting binary.
405 hardcode_shlibpath_var=unsupported
407 # Set to "yes" if building a shared library automatically hardcodes DIR
408 # into the library and all subsequent libraries and executables linked
410 hardcode_automatic=no
412 # Set to yes if linker adds runtime paths of dependent libraries
413 # to runtime path list.
416 # Whether libtool must link a program against all its dependency libraries.
419 # Set to "yes" if exported symbols are required.
420 always_export_symbols=no
422 # The commands to list exported symbols.
423 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
425 # Symbols that should not be listed in the preloaded symbols.
426 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
428 # Symbols that must always be exported.
431 # Commands necessary for linking programs (against libraries) with templates.
434 # Commands necessary for finishing linking programs.
437 # Specify filename containing input files.
440 # How to hardcode a shared library path into an executable.
441 hardcode_action=immediate
443 # The directories searched by this compiler when creating a shared library.
444 compiler_lib_search_dirs=""
446 # Dependencies to place before and after the objects being linked to
447 # create a shared library.
453 # The library search path used internally by the compiler when linking
455 compiler_lib_search_path=""
457 # ### END LIBTOOL CONFIG
460 # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
462 # func_munge_path_list VARIABLE PATH
463 # -----------------------------------
464 # VARIABLE is name of variable containing _space_ separated list of
465 # directories to be munged by the contents of PATH, which is string
468 # string "DIR[ DIR]" will be prepended to VARIABLE
470 # string "DIR[ DIR]" will be appended to VARIABLE
471 # "DIRP[:DIRP]::[DIRA:]DIRA"
472 # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
473 # "DIRA[ DIRA]" will be appended to VARIABLE
475 # VARIABLE will be replaced by "DIR[ DIR]"
476 func_munge_path_list ()
482 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
485 eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
488 eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
489 eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
492 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
498 # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
501 for cc_temp in $*""; do
503 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
504 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
509 func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
513 # ### END FUNCTIONS SHARED WITH CONFIGURE
516 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
517 ## by inline-source v2014-01-03.01
519 # libtool (GNU libtool) 2.4.6
520 # Provide generalized library-building support services.
521 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
523 # Copyright (C) 1996-2015 Free Software Foundation, Inc.
524 # This is free software; see the source for copying conditions. There is NO
525 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
527 # GNU Libtool is free software; you can redistribute it and/or modify
528 # it under the terms of the GNU General Public License as published by
529 # the Free Software Foundation; either version 2 of the License, or
530 # (at your option) any later version.
532 # As a special exception to the GNU General Public License,
533 # if you distribute this file as part of a program or library that
534 # is built using GNU Libtool, you may include this file under the
535 # same distribution terms that you use for the rest of that program.
537 # GNU Libtool is distributed in the hope that it will be useful, but
538 # WITHOUT ANY WARRANTY; without even the implied warranty of
539 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
540 # General Public License for more details.
542 # You should have received a copy of the GNU General Public License
543 # along with this program. If not, see <http://www.gnu.org/licenses/>.
548 VERSION="2.4.6 Debian-2.4.6-2"
549 package_revision=2.4.6
556 # Run './libtool --help' for help with using this script from the
560 ## ------------------------------- ##
561 ## User overridable command paths. ##
562 ## ------------------------------- ##
564 # After configure completes, it has a better idea of some of the
565 # shell tools we need than the defaults used by the functions shared
566 # with bootstrap, so set those here where they can still be over-
567 # ridden by the user, but otherwise take precedence.
569 : ${AUTOCONF="autoconf"}
570 : ${AUTOMAKE="automake"}
573 ## -------------------------- ##
574 ## Source external libraries. ##
575 ## -------------------------- ##
577 # Much of our low-level functionality needs to be sourced from external
578 # libraries, which are installed to $pkgauxdir.
580 # Set a version string for this script.
581 scriptversion=2015-01-20.17; # UTC
583 # General shell script boiler plate, and helper functions.
584 # Written by Gary V. Vaughan, 2004
586 # Copyright (C) 2004-2015 Free Software Foundation, Inc.
587 # This is free software; see the source for copying conditions. There is NO
588 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
590 # This program is free software; you can redistribute it and/or modify
591 # it under the terms of the GNU General Public License as published by
592 # the Free Software Foundation; either version 3 of the License, or
593 # (at your option) any later version.
595 # As a special exception to the GNU General Public License, if you distribute
596 # this file as part of a program or library that is built using GNU Libtool,
597 # you may include this file under the same distribution terms that you use
598 # for the rest of that program.
600 # This program is distributed in the hope that it will be useful,
601 # but WITHOUT ANY WARRANTY; without even the implied warranty of
602 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
603 # General Public License for more details.
605 # You should have received a copy of the GNU General Public License
606 # along with this program. If not, see <http://www.gnu.org/licenses/>.
608 # Please report bugs or propose patches to gary@gnu.org.
615 # Evaluate this file near the top of your script to gain access to
616 # the functions and variables defined here:
618 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
620 # If you need to override any of the default environment variable
621 # settings, do that before evaluating this file.
624 ## -------------------- ##
625 ## Shell normalisation. ##
626 ## -------------------- ##
628 # Some shells need a little help to be as Bourne compatible as possible.
629 # Before doing anything else, make sure all that help has been provided!
631 DUALCASE=1; export DUALCASE # for MKS sh
632 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
635 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
636 # is contrary to our usage. Disable this feature.
637 alias -g '${1+"$@"}'='"$@"'
640 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
643 # NLS nuisances: We save the old values in case they are required later.
646 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
648 eval "if test set = \"\${$_G_var+set}\"; then
649 save_$_G_var=\$$_G_var
652 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
653 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
658 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
660 # Make sure IFS has a sensible default
666 # There are apparently some retarded systems that use ';' as a PATH separator!
667 if test "${PATH_SEPARATOR+set}" != set; then
669 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
670 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
677 ## ------------------------- ##
678 ## Locate command utilities. ##
679 ## ------------------------- ##
682 # func_executable_p FILE
683 # ----------------------
684 # Check that FILE is an executable regular file.
687 test -f "$1" && test -x "$1"
691 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
692 # --------------------------------------------
693 # Search for either a program that responds to --version with output
694 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
695 # trying all the directories in PATH with each of the elements of
698 # CHECK_FUNC should accept the path to a candidate program, and
699 # set $func_check_prog_result if it truncates its output less than
700 # $_G_path_prog_max characters.
708 _G_path_prog_found=false
709 _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
710 for _G_dir in $_G_PATH; do
712 test -z "$_G_dir" && _G_dir=.
713 for _G_prog_name in $_G_progs_list; do
714 for _exeext in '' .EXE; do
715 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
716 func_executable_p "$_G_path_prog" || continue
717 case `"$_G_path_prog" --version 2>&1` in
718 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
719 *) $_G_check_func $_G_path_prog
720 func_path_progs_result=$func_check_prog_result
723 $_G_path_prog_found && break 3
728 test -z "$func_path_progs_result" && {
729 echo "no acceptable sed could be found in \$PATH" >&2
735 # We want to be able to use the functions in this file before configure
736 # has figured out where the best binaries are kept, which means we have
737 # to search for them ourselves - except when the results are already set
738 # where we skip the searches.
740 # Unless the user overrides by setting SED, search the path for either GNU
741 # sed, or the sed that truncates its output the least.
743 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
744 for _G_i in 1 2 3 4 5 6 7; do
745 _G_sed_script=$_G_sed_script$nl$_G_sed_script
747 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
750 func_check_prog_sed ()
755 printf 0123456789 >conftest.in
758 cat conftest.in conftest.in >conftest.tmp
759 mv conftest.tmp conftest.in
760 cp conftest.in conftest.nl
761 echo '' >> conftest.nl
762 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
763 diff conftest.out conftest.nl >/dev/null 2>&1 || break
764 _G_count=`expr $_G_count + 1`
765 if test "$_G_count" -gt "$_G_path_prog_max"; then
766 # Best one so far, save it but keep looking for a better one
767 func_check_prog_result=$_G_path_prog
768 _G_path_prog_max=$_G_count
770 # 10*(2^10) chars as input seems more than enough
771 test 10 -lt "$_G_count" && break
773 rm -f conftest.in conftest.tmp conftest.nl conftest.out
776 func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
778 SED=$func_path_progs_result
782 # Unless the user overrides by setting GREP, search the path for either GNU
783 # grep, or the grep that truncates its output the least.
785 func_check_prog_grep ()
791 printf 0123456789 >conftest.in
794 cat conftest.in conftest.in >conftest.tmp
795 mv conftest.tmp conftest.in
796 cp conftest.in conftest.nl
797 echo 'GREP' >> conftest.nl
798 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
799 diff conftest.out conftest.nl >/dev/null 2>&1 || break
800 _G_count=`expr $_G_count + 1`
801 if test "$_G_count" -gt "$_G_path_prog_max"; then
802 # Best one so far, save it but keep looking for a better one
803 func_check_prog_result=$_G_path_prog
804 _G_path_prog_max=$_G_count
806 # 10*(2^10) chars as input seems more than enough
807 test 10 -lt "$_G_count" && break
809 rm -f conftest.in conftest.tmp conftest.nl conftest.out
812 func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
813 GREP=$func_path_progs_result
817 ## ------------------------------- ##
818 ## User overridable command paths. ##
819 ## ------------------------------- ##
821 # All uppercase variable names are used for environment variables. These
822 # variables can be overridden by the user before calling a script that
823 # uses them if a suitable command of that name is not already available
824 # in the command search PATH.
827 : ${ECHO="printf %s\n"}
828 : ${EGREP="$GREP -E"}
829 : ${FGREP="$GREP -F"}
835 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
838 ## -------------------- ##
839 ## Useful sed snippets. ##
840 ## -------------------- ##
842 sed_dirname='s|/[^/]*$||'
843 sed_basename='s|^.*/||'
845 # Sed substitution that helps us do robust quoting. It backslashifies
846 # metacharacters that are still active within double-quoted strings.
847 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
849 # Same as above, but do not quote variable references.
850 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
852 # Sed substitution that turns a string into a regex matching for the
854 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
856 # Sed substitution that converts a w32 file name or path
857 # that contains forward slashes, into one that contains
858 # (escaped) backslashes. A very naive implementation.
859 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
861 # Re-'\' parameter expansions in output of sed_double_quote_subst that
862 # were '\'-ed in input to the same. If an odd number of '\' preceded a
863 # '$' in input to sed_double_quote_subst, that '$' was protected from
864 # expansion. Since each input '\' is now two '\'s, look for any number
865 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
870 sed_double_backslash="\
873 s/^$_G_bs2$_G_dollar/$_G_bs&/
874 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
878 ## ----------------- ##
879 ## Global variables. ##
880 ## ----------------- ##
882 # Except for the global variables explicitly listed below, the following
883 # functions in the '^func_' namespace, and the '^require_' namespace
884 # variables initialised in the 'Resource management' section, sourcing
885 # this file will not pollute your global namespace with anything
886 # else. There's no portable way to scope variables in Bourne shell
887 # though, so actually running these functions will sometimes place
888 # results into a variable named after the function, and often use
889 # temporary variables in the '^_G_' namespace. If you are careful to
890 # avoid using those namespaces casually in your sourcing script, things
891 # should continue to work as you expect. And, of course, you can freely
892 # overwrite any of the functions or variables defined here before
893 # calling anything to customize them.
897 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
898 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
900 # Allow overriding, eg assuming that you follow the convention of
901 # putting '$debug_cmd' at the start of all your functions, you can get
902 # bash to show function call trace with:
904 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
905 debug_cmd=${debug_cmd-":"}
908 # By convention, finish your script with:
912 # so that you can set exit_status to non-zero if you want to indicate
913 # something went wrong during execution without actually bailing out at
914 # the point of failure.
915 exit_status=$EXIT_SUCCESS
917 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
918 # is ksh but when the shell is invoked as "sh" and the current value of
919 # the _XPG environment variable is not equal to 1 (one), the special
920 # positional parameter $0, within a function call, is the name of the
924 # The name of this program.
925 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
927 # Make sure we have an absolute progpath for reexecution:
929 [\\/]*|[A-Za-z]:\\*) ;;
931 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
932 progdir=`cd "$progdir" && pwd`
933 progpath=$progdir/$progname
937 IFS=${PATH_SEPARATOR-:}
938 for progdir in $PATH; do
940 test -x "$progdir/$progname" && break
943 test -n "$progdir" || progdir=`pwd`
944 progpath=$progdir/$progname
949 ## ----------------- ##
950 ## Standard options. ##
951 ## ----------------- ##
953 # The following options affect the operation of the functions defined
954 # below, and should be set appropriately depending on run-time para-
955 # meters passed on the command line.
961 # Categories 'all' and 'none' are always available. Append any others
962 # you will pass as the first argument to func_warning from your own
966 # By default, display warnings according to 'opt_warning_types'. Set
967 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
968 # treat the next displayed warning as a fatal error.
969 warning_func=func_warn_and_continue
971 # Set to 'all' to display all warnings, 'none' to suppress all
972 # warnings, or a space delimited list of some subset of
973 # 'warning_categories' to display only the listed warnings.
974 opt_warning_types=all
977 ## -------------------- ##
978 ## Resource management. ##
979 ## -------------------- ##
981 # This section contains definitions for functions that each ensure a
982 # particular resource (a file, or a non-empty configuration variable for
983 # example) is available, and if appropriate to extract default values
984 # from pertinent package files. Call them using their associated
985 # 'require_*' variable to ensure that they are executed, at most, once.
987 # It's entirely deliberate that calling these functions can set
988 # variables that don't obey the namespace limitations obeyed by the rest
989 # of this file, in order that that they be as useful as possible to
993 # require_term_colors
994 # -------------------
995 # Allow display of bold text on terminals that support it.
996 require_term_colors=func_require_term_colors
997 func_require_term_colors ()
1002 # COLORTERM and USE_ANSI_COLORS environment variables take
1003 # precedence, because most terminfo databases neglect to describe
1004 # whether color sequences are supported.
1005 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
1007 if test 1 = "$USE_ANSI_COLORS"; then
1008 # Standard ANSI escape sequences
1010 tc_bold='
\e[1m'; tc_standout='
\e[7m'
1011 tc_red='
\e[31m'; tc_green='
\e[32m'
1012 tc_blue='
\e[34m'; tc_cyan='
\e[36m'
1014 # Otherwise trust the terminfo database after all.
1015 test -n "`tput sgr0 2>/dev/null`" && {
1016 tc_reset=`tput sgr0`
1017 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
1018 tc_standout=$tc_bold
1019 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
1020 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
1021 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
1022 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
1023 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
1028 require_term_colors=:
1032 ## ----------------- ##
1033 ## Function library. ##
1034 ## ----------------- ##
1036 # This section contains a variety of useful functions to call in your
1037 # scripts. Take note of the portable wrappers for features provided by
1038 # some modern shells, which will fall back to slower equivalents on
1039 # less featureful shells.
1042 # func_append VAR VALUE
1043 # ---------------------
1044 # Append VALUE onto the existing contents of VAR.
1046 # We should try to minimise forks, especially on Windows where they are
1047 # unreasonably slow, so skip the feature probes when bash or zsh are
1049 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
1050 : ${_G_HAVE_ARITH_OP="yes"}
1051 : ${_G_HAVE_XSI_OPS="yes"}
1052 # The += operator was introduced in bash 3.1
1053 case $BASH_VERSION in
1054 [12].* | 3.0 | 3.0*) ;;
1056 : ${_G_HAVE_PLUSEQ_OP="yes"}
1062 # Can be empty, in which case the shell is probed, "yes" if += is
1063 # useable or anything else if it does not work.
1064 test -z "$_G_HAVE_PLUSEQ_OP" \
1065 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
1066 && _G_HAVE_PLUSEQ_OP=yes
1068 if test yes = "$_G_HAVE_PLUSEQ_OP"
1070 # This is an XSI compatible shell, allowing a faster implementation...
1071 eval 'func_append ()
1078 # ...otherwise fall back to using expr, which is often a shell builtin.
1088 # func_append_quoted VAR VALUE
1089 # ----------------------------
1090 # Quote VALUE and append to the end of shell variable VAR, separated
1092 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
1093 eval 'func_append_quoted ()
1097 func_quote_for_eval "$2"
1098 eval "$1+=\\ \$func_quote_for_eval_result"
1101 func_append_quoted ()
1105 func_quote_for_eval "$2"
1106 eval "$1=\$$1\\ \$func_quote_for_eval_result"
1111 # func_append_uniq VAR VALUE
1112 # --------------------------
1113 # Append unique VALUE onto the existing contents of VAR, assuming
1114 # entries are delimited by the first character of VALUE. For example:
1116 # func_append_uniq options " --another-option option-argument"
1118 # will only append to $options if " --another-option option-argument "
1119 # is not already present somewhere in $options already (note spaces at
1120 # each end implied by leading space in second argument).
1125 eval _G_current_value='`$ECHO $'$1'`'
1126 _G_delim=`expr "$2" : '\(.\)'`
1128 case $_G_delim$_G_current_value$_G_delim in
1130 *) func_append "$@" ;;
1135 # func_arith TERM...
1136 # ------------------
1137 # Set func_arith_result to the result of evaluating TERMs.
1138 test -z "$_G_HAVE_ARITH_OP" \
1139 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
1140 && _G_HAVE_ARITH_OP=yes
1142 if test yes = "$_G_HAVE_ARITH_OP"; then
1147 func_arith_result=$(( $* ))
1154 func_arith_result=`expr "$@"`
1159 # func_basename FILE
1160 # ------------------
1161 # Set func_basename_result to FILE with everything up to and including
1162 # the last / stripped.
1163 if test yes = "$_G_HAVE_XSI_OPS"; then
1164 # If this shell supports suffix pattern removal, then use it to avoid
1165 # forking. Hide the definitions single quotes in case the shell chokes
1166 # on unsupported syntax...
1167 _b='func_basename_result=${1##*/}'
1169 */*) func_dirname_result=${1%/*}$2 ;;
1170 * ) func_dirname_result=$3 ;;
1174 # ...otherwise fall back to using sed.
1175 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
1176 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
1177 if test "X$func_dirname_result" = "X$1"; then
1178 func_dirname_result=$3
1180 func_append func_dirname_result "$2"
1184 eval 'func_basename ()
1192 # func_dirname FILE APPEND NONDIR_REPLACEMENT
1193 # -------------------------------------------
1194 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
1195 # otherwise set result to NONDIR_REPLACEMENT.
1196 eval 'func_dirname ()
1204 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
1205 # --------------------------------------------------------
1206 # Perform func_basename and func_dirname in a single function
1208 # dirname: Compute the dirname of FILE. If nonempty,
1209 # add APPEND to the result, otherwise set result
1210 # to NONDIR_REPLACEMENT.
1211 # value returned in "$func_dirname_result"
1212 # basename: Compute filename of FILE.
1213 # value retuned in "$func_basename_result"
1214 # For efficiency, we do not delegate to the functions above but instead
1215 # duplicate the functionality here.
1216 eval 'func_dirname_and_basename ()
1227 # Echo program name prefixed message.
1236 for _G_line in $_G_message; do
1238 $ECHO "$progname: $_G_line"
1244 # func_echo_all ARG...
1245 # --------------------
1246 # Invoke $ECHO with all args, space-separated.
1253 # func_echo_infix_1 INFIX ARG...
1254 # ------------------------------
1255 # Echo program name, followed by INFIX on the first line, with any
1256 # additional lines not showing INFIX.
1257 func_echo_infix_1 ()
1261 $require_term_colors
1265 _G_prefix="$progname: $_G_infix: "
1268 # Strip color escape sequences before counting printable length
1269 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
1271 test -n "$_G_tc" && {
1272 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
1273 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
1276 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
1278 func_echo_infix_1_IFS=$IFS
1280 for _G_line in $_G_message; do
1281 IFS=$func_echo_infix_1_IFS
1282 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
1283 _G_prefix=$_G_indent
1285 IFS=$func_echo_infix_1_IFS
1291 # Echo program name prefixed message to standard error.
1296 $require_term_colors
1298 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
1302 # func_fatal_error ARG...
1303 # -----------------------
1304 # Echo program name prefixed message to standard error, and exit.
1314 # func_grep EXPRESSION FILENAME
1315 # -----------------------------
1316 # Check whether EXPRESSION matches any line of FILENAME, without output.
1321 $GREP "$1" "$2" >/dev/null 2>&1
1327 # Set func_len_result to the length of STRING. STRING may not
1328 # start with a hyphen.
1329 test -z "$_G_HAVE_XSI_OPS" \
1331 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
1332 && _G_HAVE_XSI_OPS=yes
1334 if test yes = "$_G_HAVE_XSI_OPS"; then
1339 func_len_result=${#1}
1346 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
1351 # func_mkdir_p DIRECTORY-PATH
1352 # ---------------------------
1353 # Make sure the entire path to DIRECTORY-PATH is available.
1358 _G_directory_path=$1
1361 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
1363 # Protect directory names starting with '-'
1364 case $_G_directory_path in
1365 -*) _G_directory_path=./$_G_directory_path ;;
1368 # While some portion of DIR does not yet exist...
1369 while test ! -d "$_G_directory_path"; do
1370 # ...make a list in topmost first order. Use a colon delimited
1371 # list incase some portion of path contains whitespace.
1372 _G_dir_list=$_G_directory_path:$_G_dir_list
1374 # If the last portion added has no slash in it, the list is done
1375 case $_G_directory_path in */*) ;; *) break ;; esac
1377 # ...otherwise throw away the child directory and loop
1378 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
1380 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
1382 func_mkdir_p_IFS=$IFS; IFS=:
1383 for _G_dir in $_G_dir_list; do
1384 IFS=$func_mkdir_p_IFS
1385 # mkdir can fail with a 'File exist' error if two processes
1386 # try to create one of the directories concurrently. Don't
1387 # stop in that case!
1388 $MKDIR "$_G_dir" 2>/dev/null || :
1390 IFS=$func_mkdir_p_IFS
1392 # Bail out if we (or some other process) failed to create a directory.
1393 test -d "$_G_directory_path" || \
1394 func_fatal_error "Failed to create '$1'"
1399 # func_mktempdir [BASENAME]
1400 # -------------------------
1401 # Make a temporary directory that won't clash with other running
1402 # libtool processes, and avoids race conditions if possible. If
1403 # given, BASENAME is the basename for that directory.
1408 _G_template=${TMPDIR-/tmp}/${1-$progname}
1410 if test : = "$opt_dry_run"; then
1411 # Return a directory name, but don't create it in dry-run mode
1412 _G_tmpdir=$_G_template-$$
1415 # If mktemp works, use that first and foremost
1416 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
1418 if test ! -d "$_G_tmpdir"; then
1419 # Failing that, at least try and use $RANDOM to avoid a race
1420 _G_tmpdir=$_G_template-${RANDOM-0}$$
1422 func_mktempdir_umask=`umask`
1425 umask $func_mktempdir_umask
1428 # If we're not in dry-run mode, bomb out on failure
1429 test -d "$_G_tmpdir" || \
1430 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
1437 # func_normal_abspath PATH
1438 # ------------------------
1439 # Remove doubled-up and trailing slashes, "." path components,
1440 # and cancel out any ".." path components in PATH after making
1441 # it an absolute path.
1442 func_normal_abspath ()
1446 # These SED scripts presuppose an absolute path with a trailing slash.
1447 _G_pathcar='s|^/\([^/]*\).*$|\1|'
1448 _G_pathcdr='s|^/[^/]*||'
1449 _G_removedotparts=':dotsl
1453 _G_collapseslashes='s|/\{1,\}|/|g'
1454 _G_finalslash='s|/*$|/|'
1456 # Start from root dir and reassemble the path.
1457 func_normal_abspath_result=
1458 func_normal_abspath_tpath=$1
1459 func_normal_abspath_altnamespace=
1460 case $func_normal_abspath_tpath in
1462 # Empty path, that just means $cwd.
1463 func_stripname '' '/' "`pwd`"
1464 func_normal_abspath_result=$func_stripname_result
1467 # The next three entries are used to spot a run of precisely
1468 # two leading slashes without using negated character classes;
1469 # we take advantage of case's first-match behaviour.
1471 # Unusual form of absolute path, do nothing.
1474 # Not necessarily an ordinary path; POSIX reserves leading '//'
1475 # and for example Cygwin uses it to access remote file shares
1476 # over CIFS/SMB, so we conserve a leading double slash if found.
1477 func_normal_abspath_altnamespace=/
1480 # Absolute path, do nothing.
1483 # Relative path, prepend $cwd.
1484 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
1488 # Cancel out all the simple stuff to save iterations. We also want
1489 # the path to end with a slash for ease of parsing, so make sure
1490 # there is one (and only one) here.
1491 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1492 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
1494 # Processed it all yet?
1495 if test / = "$func_normal_abspath_tpath"; then
1496 # If we ascended to the root using ".." the result may be empty now.
1497 if test -z "$func_normal_abspath_result"; then
1498 func_normal_abspath_result=/
1502 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
1504 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1506 # Figure out what to do with it
1507 case $func_normal_abspath_tcomponent in
1509 # Trailing empty path component, ignore it.
1512 # Parent dir; strip last assembled component from result.
1513 func_dirname "$func_normal_abspath_result"
1514 func_normal_abspath_result=$func_dirname_result
1517 # Actual path component, append it.
1518 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1522 # Restore leading double-slash if one was found on entry.
1523 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1527 # func_notquiet ARG...
1528 # --------------------
1529 # Echo program name prefixed message only when not in quiet mode.
1534 $opt_quiet || func_echo ${1+"$@"}
1536 # A bug in bash halts the script if the last line of a function
1537 # fails when set -e is in force, so we need another command to
1543 # func_relative_path SRCDIR DSTDIR
1544 # --------------------------------
1545 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1546 func_relative_path ()
1550 func_relative_path_result=
1551 func_normal_abspath "$1"
1552 func_relative_path_tlibdir=$func_normal_abspath_result
1553 func_normal_abspath "$2"
1554 func_relative_path_tbindir=$func_normal_abspath_result
1556 # Ascend the tree starting from libdir
1558 # check if we have found a prefix of bindir
1559 case $func_relative_path_tbindir in
1560 $func_relative_path_tlibdir)
1561 # found an exact match
1562 func_relative_path_tcancelled=
1565 $func_relative_path_tlibdir*)
1566 # found a matching prefix
1567 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1568 func_relative_path_tcancelled=$func_stripname_result
1569 if test -z "$func_relative_path_result"; then
1570 func_relative_path_result=.
1575 func_dirname $func_relative_path_tlibdir
1576 func_relative_path_tlibdir=$func_dirname_result
1577 if test -z "$func_relative_path_tlibdir"; then
1578 # Have to descend all the way to the root!
1579 func_relative_path_result=../$func_relative_path_result
1580 func_relative_path_tcancelled=$func_relative_path_tbindir
1583 func_relative_path_result=../$func_relative_path_result
1588 # Now calculate path; take care to avoid doubling-up slashes.
1589 func_stripname '' '/' "$func_relative_path_result"
1590 func_relative_path_result=$func_stripname_result
1591 func_stripname '/' '/' "$func_relative_path_tcancelled"
1592 if test -n "$func_stripname_result"; then
1593 func_append func_relative_path_result "/$func_stripname_result"
1596 # Normalisation. If bindir is libdir, return '.' else relative path.
1597 if test -n "$func_relative_path_result"; then
1598 func_stripname './' '' "$func_relative_path_result"
1599 func_relative_path_result=$func_stripname_result
1602 test -n "$func_relative_path_result" || func_relative_path_result=.
1608 # func_quote_for_eval ARG...
1609 # --------------------------
1610 # Aesthetically quote ARGs to be evaled later.
1611 # This function returns two values:
1612 # i) func_quote_for_eval_result
1613 # double-quoted, suitable for a subsequent eval
1614 # ii) func_quote_for_eval_unquoted_result
1615 # has all characters that are still active within double
1616 # quotes backslashified.
1617 func_quote_for_eval ()
1621 func_quote_for_eval_unquoted_result=
1622 func_quote_for_eval_result=
1623 while test 0 -lt $#; do
1626 _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
1628 _G_unquoted_arg=$1 ;;
1630 if test -n "$func_quote_for_eval_unquoted_result"; then
1631 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
1633 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
1636 case $_G_unquoted_arg in
1637 # Double-quote args containing shell metacharacters to delay
1638 # word splitting, command substitution and variable expansion
1639 # for a subsequent eval.
1640 # Many Bourne shells cannot handle close brackets correctly
1641 # in scan sets, so we specify it separately.
1642 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1643 _G_quoted_arg=\"$_G_unquoted_arg\"
1646 _G_quoted_arg=$_G_unquoted_arg
1650 if test -n "$func_quote_for_eval_result"; then
1651 func_append func_quote_for_eval_result " $_G_quoted_arg"
1653 func_append func_quote_for_eval_result "$_G_quoted_arg"
1660 # func_quote_for_expand ARG
1661 # -------------------------
1662 # Aesthetically quote ARG to be evaled later; same as above,
1663 # but do not quote variable references.
1664 func_quote_for_expand ()
1670 _G_arg=`$ECHO "$1" | $SED \
1671 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
1677 # Double-quote args containing shell metacharacters to delay
1678 # word splitting and command substitution for a subsequent eval.
1679 # Many Bourne shells cannot handle close brackets correctly
1680 # in scan sets, so we specify it separately.
1681 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1686 func_quote_for_expand_result=$_G_arg
1690 # func_stripname PREFIX SUFFIX NAME
1691 # ---------------------------------
1692 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1693 # PREFIX and SUFFIX must not contain globbing or regex special
1694 # characters, hashes, percent signs, but SUFFIX may contain a leading
1695 # dot (in which case that matches only a dot).
1696 if test yes = "$_G_HAVE_XSI_OPS"; then
1697 eval 'func_stripname ()
1701 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1702 # positional parameters, so assign one to ordinary variable first.
1703 func_stripname_result=$3
1704 func_stripname_result=${func_stripname_result#"$1"}
1705 func_stripname_result=${func_stripname_result%"$2"}
1713 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1714 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1720 # func_show_eval CMD [FAIL_EXP]
1721 # -----------------------------
1722 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1723 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1724 # is given, then evaluate it.
1730 _G_fail_exp=${2-':'}
1732 func_quote_for_expand "$_G_cmd"
1733 eval "func_notquiet $func_quote_for_expand_result"
1738 if test 0 -ne "$_G_status"; then
1739 eval "(exit $_G_status); $_G_fail_exp"
1745 # func_show_eval_locale CMD [FAIL_EXP]
1746 # ------------------------------------
1747 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1748 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1749 # is given, then evaluate it. Use the saved locale for evaluation.
1750 func_show_eval_locale ()
1755 _G_fail_exp=${2-':'}
1758 func_quote_for_expand "$_G_cmd"
1759 eval "func_echo $func_quote_for_expand_result"
1763 eval "$_G_user_locale
1766 eval "$_G_safe_locale"
1767 if test 0 -ne "$_G_status"; then
1768 eval "(exit $_G_status); $_G_fail_exp"
1776 # Turn $1 into a string suitable for a shell variable name.
1777 # Result is stored in $func_tr_sh_result. All characters
1778 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1779 # if $1 begins with a digit, a '_' is prepended as well.
1785 [0-9]* | *[!a-zA-Z0-9_]*)
1786 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1789 func_tr_sh_result=$1
1795 # func_verbose ARG...
1796 # -------------------
1797 # Echo program name prefixed message in verbose mode only.
1802 $opt_verbose && func_echo "$*"
1808 # func_warn_and_continue ARG...
1809 # -----------------------------
1810 # Echo program name prefixed warning message to standard error.
1811 func_warn_and_continue ()
1815 $require_term_colors
1817 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1821 # func_warning CATEGORY ARG...
1822 # ----------------------------
1823 # Echo program name prefixed warning message to standard error. Warning
1824 # messages can be filtered according to CATEGORY, where this function
1825 # elides messages where CATEGORY is not listed in the global variable
1826 # 'opt_warning_types'.
1831 # CATEGORY must be in the warning_categories list!
1832 case " $warning_categories " in
1834 *) func_internal_error "invalid warning category '$1'" ;;
1840 case " $opt_warning_types " in
1841 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1846 # func_sort_ver VER1 VER2
1847 # -----------------------
1848 # 'sort -V' is not generally available.
1849 # Note this deviates from the version comparison in automake
1850 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1851 # but this should suffice as we won't be specifying old
1852 # version formats or redundant trailing .0 in bootstrap.conf.
1853 # If we did want full compatibility then we should probably
1854 # use m4_version_compare from autoconf.
1859 printf '%s\n%s\n' "$1" "$2" \
1860 | 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
1863 # func_lt_ver PREV CURR
1864 # ---------------------
1865 # Return true if PREV and CURR are in the correct order according to
1866 # func_sort_ver, otherwise false. Use it like this:
1868 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1873 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1878 # mode: shell-script
1880 # eval: (add-hook 'before-save-hook 'time-stamp)
1881 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1882 # time-stamp-time-zone: "UTC"
1886 # Set a version string for this script.
1887 scriptversion=2014-01-07.03; # UTC
1889 # A portable, pluggable option parser for Bourne shell.
1890 # Written by Gary V. Vaughan, 2010
1892 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
1893 # This is free software; see the source for copying conditions. There is NO
1894 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1896 # This program is free software: you can redistribute it and/or modify
1897 # it under the terms of the GNU General Public License as published by
1898 # the Free Software Foundation, either version 3 of the License, or
1899 # (at your option) any later version.
1901 # This program is distributed in the hope that it will be useful,
1902 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1903 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1904 # GNU General Public License for more details.
1906 # You should have received a copy of the GNU General Public License
1907 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1909 # Please report bugs or propose patches to gary@gnu.org.
1916 # This file is a library for parsing options in your shell scripts along
1917 # with assorted other useful supporting features that you can make use
1920 # For the simplest scripts you might need only:
1923 # . relative/path/to/funclib.sh
1924 # . relative/path/to/options-parser
1926 # func_options ${1+"$@"}
1927 # eval set dummy "$func_options_result"; shift
1928 # ...rest of your script...
1930 # In order for the '--version' option to work, you will need to have a
1931 # suitably formatted comment like the one at the top of this file
1932 # starting with '# Written by ' and ending with '# warranty; '.
1934 # For '-h' and '--help' to work, you will also need a one line
1935 # description of your script's purpose in a comment directly above the
1936 # '# Written by ' line, like the one at the top of this file.
1938 # The default options also support '--debug', which will turn on shell
1939 # execution tracing (see the comment above debug_cmd below for another
1940 # use), and '--verbose' and the func_verbose function to allow your script
1941 # to display verbose messages only when your user has specified
1944 # After sourcing this file, you can plug processing for additional
1945 # options by amending the variables from the 'Configuration' section
1946 # below, and following the instructions in the 'Option parsing'
1947 # section further down.
1949 ## -------------- ##
1950 ## Configuration. ##
1951 ## -------------- ##
1953 # You should override these variables in your script after sourcing this
1954 # file so that they reflect the customisations you have added to the
1957 # The usage line for option parsing errors and the start of '-h' and
1958 # '--help' output messages. You can embed shell variables for delayed
1959 # expansion at the time the message is displayed, but you will need to
1960 # quote other shell meta-characters carefully to prevent them being
1961 # expanded when the contents are evaled.
1962 usage='$progpath [OPTION]...'
1964 # Short help message in response to '-h' and '--help'. Add to this or
1965 # override it after sourcing this library to reflect the full set of
1966 # options your script accepts.
1968 --debug enable verbose shell tracing
1969 -W, --warnings=CATEGORY
1970 report the warnings falling in CATEGORY [all]
1971 -v, --verbose verbosely report processing
1972 --version print version information and exit
1973 -h, --help print short or long help message and exit
1976 # Additional text appended to 'usage_message' in response to '--help'.
1978 Warning categories include:
1979 'all' show all warnings
1980 'none' turn off all the warnings
1981 'error' warnings are treated as fatal errors"
1983 # Help message printed before fatal option parsing errors.
1984 fatal_help="Try '\$progname --help' for more information."
1988 ## ------------------------- ##
1989 ## Hook function management. ##
1990 ## ------------------------- ##
1992 # This section contains functions for adding, removing, and running hooks
1993 # to the main code. A hook is just a named list of of function, that can
1994 # be run in order later on.
1996 # func_hookable FUNC_NAME
1997 # -----------------------
1998 # Declare that FUNC_NAME will run hooks added with
1999 # 'func_add_hook FUNC_NAME ...'.
2004 func_append hookable_fns " $1"
2008 # func_add_hook FUNC_NAME HOOK_FUNC
2009 # ---------------------------------
2010 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
2011 # first have been declared "hookable" by a call to 'func_hookable'.
2016 case " $hookable_fns " in
2018 *) func_fatal_error "'$1' does not accept hook functions." ;;
2021 eval func_append ${1}_hooks '" $2"'
2025 # func_remove_hook FUNC_NAME HOOK_FUNC
2026 # ------------------------------------
2027 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
2032 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
2036 # func_run_hooks FUNC_NAME [ARG]...
2037 # ---------------------------------
2038 # Run all hook functions registered to FUNC_NAME.
2039 # It is assumed that the list of hook functions contains nothing more
2040 # than a whitespace-delimited list of legal shell function names, and
2041 # no effort is wasted trying to catch shell meta-characters or preserve
2047 case " $hookable_fns " in
2049 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
2052 eval _G_hook_fns=\$$1_hooks; shift
2054 for _G_hook in $_G_hook_fns; do
2055 eval $_G_hook '"$@"'
2057 # store returned options list back into positional
2058 # parameters for next 'cmd' execution.
2059 eval _G_hook_result=\$${_G_hook}_result
2060 eval set dummy "$_G_hook_result"; shift
2063 func_quote_for_eval ${1+"$@"}
2064 func_run_hooks_result=$func_quote_for_eval_result
2069 ## --------------- ##
2070 ## Option parsing. ##
2071 ## --------------- ##
2073 # In order to add your own option parsing hooks, you must accept the
2074 # full positional parameter list in your hook function, remove any
2075 # options that you action, and then pass back the remaining unprocessed
2076 # options in '<hooked_function_name>_result', escaped suitably for
2077 # 'eval'. Like this:
2079 # my_options_prep ()
2083 # # Extend the existing usage message.
2084 # usage_message=$usage_message'
2085 # -s, --silent don'\''t print informational messages
2088 # func_quote_for_eval ${1+"$@"}
2089 # my_options_prep_result=$func_quote_for_eval_result
2091 # func_add_hook func_options_prep my_options_prep
2094 # my_silent_option ()
2098 # # Note that for efficiency, we parse as many options as we can
2099 # # recognise in a loop before passing the remainder back to the
2100 # # caller on the first unrecognised argument we encounter.
2101 # while test $# -gt 0; do
2104 # --silent|-s) opt_silent=: ;;
2105 # # Separate non-argument short options:
2106 # -s*) func_split_short_opt "$_G_opt"
2107 # set dummy "$func_split_short_opt_name" \
2108 # "-$func_split_short_opt_arg" ${1+"$@"}
2111 # *) set dummy "$_G_opt" "$*"; shift; break ;;
2115 # func_quote_for_eval ${1+"$@"}
2116 # my_silent_option_result=$func_quote_for_eval_result
2118 # func_add_hook func_parse_options my_silent_option
2121 # my_option_validation ()
2125 # $opt_silent && $opt_verbose && func_fatal_help "\
2126 # '--silent' and '--verbose' options are mutually exclusive."
2128 # func_quote_for_eval ${1+"$@"}
2129 # my_option_validation_result=$func_quote_for_eval_result
2131 # func_add_hook func_validate_options my_option_validation
2133 # You'll alse need to manually amend $usage_message to reflect the extra
2134 # options you parse. It's preferable to append if you can, so that
2135 # multiple option parsing hooks can be added safely.
2138 # func_options [ARG]...
2139 # ---------------------
2140 # All the functions called inside func_options are hookable. See the
2141 # individual implementations for details.
2142 func_hookable func_options
2147 func_options_prep ${1+"$@"}
2148 eval func_parse_options \
2149 ${func_options_prep_result+"$func_options_prep_result"}
2150 eval func_validate_options \
2151 ${func_parse_options_result+"$func_parse_options_result"}
2153 eval func_run_hooks func_options \
2154 ${func_validate_options_result+"$func_validate_options_result"}
2156 # save modified positional parameters for caller
2157 func_options_result=$func_run_hooks_result
2161 # func_options_prep [ARG]...
2162 # --------------------------
2163 # All initialisations required before starting the option parse loop.
2164 # Note that when calling hook functions, we pass through the list of
2165 # positional parameters. If a hook function modifies that list, and
2166 # needs to propogate that back to rest of this script, then the complete
2167 # modified list must be put in 'func_run_hooks_result' before
2169 func_hookable func_options_prep
2170 func_options_prep ()
2178 func_run_hooks func_options_prep ${1+"$@"}
2180 # save modified positional parameters for caller
2181 func_options_prep_result=$func_run_hooks_result
2185 # func_parse_options [ARG]...
2186 # ---------------------------
2187 # The main option parsing loop.
2188 func_hookable func_parse_options
2189 func_parse_options ()
2193 func_parse_options_result=
2195 # this just eases exit handling
2196 while test $# -gt 0; do
2197 # Defer to hook functions for initial option parsing, so they
2198 # get priority in the event of reusing an option name.
2199 func_run_hooks func_parse_options ${1+"$@"}
2201 # Adjust func_parse_options positional parameters to match
2202 eval set dummy "$func_run_hooks_result"; shift
2204 # Break out of the loop if we already parsed every option.
2205 test $# -gt 0 || break
2210 --debug|-x) debug_cmd='set -x'
2211 func_echo "enabling shell trace mode"
2215 --no-warnings|--no-warning|--no-warn)
2216 set dummy --warnings none ${1+"$@"}
2220 --warnings|--warning|-W)
2221 test $# = 0 && func_missing_arg $_G_opt && break
2222 case " $warning_categories $1" in
2224 # trailing space prevents matching last $1 above
2225 func_append_uniq opt_warning_types " $1"
2228 opt_warning_types=$warning_categories
2231 opt_warning_types=none
2235 opt_warning_types=$warning_categories
2236 warning_func=func_fatal_error
2240 "unsupported warning category: '$1'"
2246 --verbose|-v) opt_verbose=: ;;
2247 --version) func_version ;;
2248 -\?|-h) func_usage ;;
2249 --help) func_help ;;
2251 # Separate optargs to long options (plugins may need this):
2252 --*=*) func_split_equals "$_G_opt"
2253 set dummy "$func_split_equals_lhs" \
2254 "$func_split_equals_rhs" ${1+"$@"}
2258 # Separate optargs to short options:
2260 func_split_short_opt "$_G_opt"
2261 set dummy "$func_split_short_opt_name" \
2262 "$func_split_short_opt_arg" ${1+"$@"}
2266 # Separate non-argument short options:
2268 func_split_short_opt "$_G_opt"
2269 set dummy "$func_split_short_opt_name" \
2270 "-$func_split_short_opt_arg" ${1+"$@"}
2275 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
2276 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2280 # save modified positional parameters for caller
2281 func_quote_for_eval ${1+"$@"}
2282 func_parse_options_result=$func_quote_for_eval_result
2286 # func_validate_options [ARG]...
2287 # ------------------------------
2288 # Perform any sanity checks on option settings and/or unconsumed
2290 func_hookable func_validate_options
2291 func_validate_options ()
2295 # Display all warnings if -W was not given.
2296 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
2298 func_run_hooks func_validate_options ${1+"$@"}
2300 # Bail if the options were screwed!
2301 $exit_cmd $EXIT_FAILURE
2303 # save modified positional parameters for caller
2304 func_validate_options_result=$func_run_hooks_result
2309 ## ----------------- ##
2310 ## Helper functions. ##
2311 ## ----------------- ##
2313 # This section contains the helper functions used by the rest of the
2314 # hookable option parser framework in ascii-betical order.
2317 # func_fatal_help ARG...
2318 # ----------------------
2319 # Echo program name prefixed message to standard error, followed by
2320 # a help hint, and exit.
2325 eval \$ECHO \""Usage: $usage"\"
2326 eval \$ECHO \""$fatal_help"\"
2327 func_error ${1+"$@"}
2334 # Echo long help message to standard output and exit.
2340 $ECHO "$long_help_message"
2345 # func_missing_arg ARGNAME
2346 # ------------------------
2347 # Echo program name prefixed message to standard error and set global
2353 func_error "Missing argument for '$1'."
2358 # func_split_equals STRING
2359 # ------------------------
2360 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
2361 # splitting STRING at the '=' sign.
2362 test -z "$_G_HAVE_XSI_OPS" \
2364 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
2365 && _G_HAVE_XSI_OPS=yes
2367 if test yes = "$_G_HAVE_XSI_OPS"
2369 # This is an XSI compatible shell, allowing a faster implementation...
2370 eval 'func_split_equals ()
2374 func_split_equals_lhs=${1%%=*}
2375 func_split_equals_rhs=${1#*=}
2376 test "x$func_split_equals_lhs" = "x$1" \
2377 && func_split_equals_rhs=
2380 # ...otherwise fall back to using expr, which is often a shell builtin.
2381 func_split_equals ()
2385 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
2386 func_split_equals_rhs=
2387 test "x$func_split_equals_lhs" = "x$1" \
2388 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
2390 fi #func_split_equals
2393 # func_split_short_opt SHORTOPT
2394 # -----------------------------
2395 # Set func_split_short_opt_name and func_split_short_opt_arg shell
2396 # variables after splitting SHORTOPT after the 2nd character.
2397 if test yes = "$_G_HAVE_XSI_OPS"
2399 # This is an XSI compatible shell, allowing a faster implementation...
2400 eval 'func_split_short_opt ()
2404 func_split_short_opt_arg=${1#??}
2405 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
2408 # ...otherwise fall back to using expr, which is often a shell builtin.
2409 func_split_short_opt ()
2413 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
2414 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
2416 fi #func_split_short_opt
2421 # Echo short help message to standard output and exit.
2427 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
2432 # func_usage_message
2433 # ------------------
2434 # Echo short help message to standard output.
2435 func_usage_message ()
2439 eval \$ECHO \""Usage: $usage"\"
2446 /^Written by/q' < "$progpath"
2448 eval \$ECHO \""$usage_message"\"
2454 # Echo version message to standard output and exit.
2459 printf '%s\n' "$progname $scriptversion"
2469 /^# Written by /,/# warranty; / {
2472 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2479 /^warranty; /q' < "$progpath"
2486 # mode: shell-script
2488 # eval: (add-hook 'before-save-hook 'time-stamp)
2489 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2490 # time-stamp-time-zone: "UTC"
2493 # Set a version string.
2494 scriptversion='(GNU libtool) 2.4.6'
2499 # Libtool also displays the current mode in messages, so override
2500 # funclib.sh func_echo with this custom definition.
2509 for _G_line in $_G_message; do
2511 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2517 # func_warning ARG...
2518 # -------------------
2519 # Libtool warnings are not categorized, so override funclib.sh
2520 # func_warning with this simpler definition.
2525 $warning_func ${1+"$@"}
2529 ## ---------------- ##
2530 ## Options parsing. ##
2531 ## ---------------- ##
2533 # Hook in the functions to make sure our own options are parsed during
2534 # the option parsing loop.
2536 usage='$progpath [OPTION]... [MODE-ARG]...'
2538 # Short help message in response to '-h'.
2539 usage_message="Options:
2540 --config show all configuration variables
2541 --debug enable verbose shell tracing
2542 -n, --dry-run display commands without modifying any files
2543 --features display basic configuration information and exit
2544 --mode=MODE use operation mode MODE
2545 --no-warnings equivalent to '-Wnone'
2546 --preserve-dup-deps don't remove duplicate dependency libraries
2547 --quiet, --silent don't print informational messages
2548 --tag=TAG use configuration variables from tag TAG
2549 -v, --verbose print more informational messages than default
2550 --version print version information
2551 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2552 -h, --help, --help-all print short, long, or detailed help message
2555 # Additional text appended to 'usage_message' in response to '--help'.
2561 $ECHO "$long_help_message
2563 MODE must be one of the following:
2565 clean remove files from the build directory
2566 compile compile a source file into a libtool object
2567 execute automatically set library path, then run a program
2568 finish complete the installation of libtool libraries
2569 install install libraries or executables
2570 link create a library or an executable
2571 uninstall remove libraries from an installed directory
2573 MODE-ARGS vary depending on the MODE. When passed as first option,
2574 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2575 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2577 When reporting a bug, please describe a test case to reproduce it and
2578 include the following information:
2583 compiler flags: $LTCFLAGS
2584 linker: $LD (gnu? $with_gnu_ld)
2585 version: $progname $scriptversion Debian-2.4.6-2
2586 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2587 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2589 Report bugs to <bug-libtool@gnu.org>.
2590 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2591 General help using GNU software: <http://www.gnu.org/gethelp/>."
2596 # func_lo2o OBJECT-NAME
2597 # ---------------------
2598 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2601 lo2o=s/\\.lo\$/.$objext/
2602 o2lo=s/\\.$objext\$/.lo/
2604 if test yes = "$_G_HAVE_XSI_OPS"; then
2608 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2609 * ) func_lo2o_result=$1 ;;
2613 # func_xform LIBOBJ-OR-SOURCE
2614 # ---------------------------
2615 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2616 # suffix to a '.lo' libtool-object suffix.
2619 func_xform_result=${1%.*}.lo
2622 # ...otherwise fall back to using sed.
2625 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2630 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2635 # func_fatal_configuration ARG...
2636 # -------------------------------
2637 # Echo program name prefixed message to standard error, followed by
2638 # a configuration failure hint, and exit.
2639 func_fatal_configuration ()
2641 func__fatal_error ${1+"$@"} \
2642 "See the $PACKAGE documentation for more information." \
2643 "Fatal configuration error."
2649 # Display the configuration for all the tags in this script.
2652 re_begincf='^# ### BEGIN LIBTOOL'
2653 re_endcf='^# ### END LIBTOOL'
2655 # Default configuration.
2656 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2658 # Now print the configurations for the tags.
2659 for tagname in $taglist; do
2660 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2669 # Display the features supported by this script.
2673 if test yes = "$build_libtool_libs"; then
2674 echo "enable shared libraries"
2676 echo "disable shared libraries"
2678 if test yes = "$build_old_libs"; then
2679 echo "enable static libraries"
2681 echo "disable static libraries"
2688 # func_enable_tag TAGNAME
2689 # -----------------------
2690 # Verify that TAGNAME is valid, and either flag an error and exit, or
2691 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2698 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2699 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2700 sed_extractcf=/$re_begincf/,/$re_endcf/p
2705 func_fatal_error "invalid tag name: $tagname"
2709 # Don't test for the "default" C tag, as we know it's
2710 # there but not specially marked.
2714 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2715 taglist="$taglist $tagname"
2717 # Evaluate the configuration. Be careful to quote the path
2718 # and the sed script, to avoid splitting on whitespace, but
2719 # also don't use non-portable quotes within backquotes within
2720 # quotes we have to do it in 2 steps:
2721 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2724 func_error "ignoring unknown tag $tagname"
2731 # func_check_version_match
2732 # ------------------------
2733 # Ensure that we are using m4 macros, and libtool script from the same
2734 # release of libtool.
2735 func_check_version_match ()
2737 if test "$package_revision" != "$macro_revision"; then
2738 if test "$VERSION" != "$macro_version"; then
2739 if test -z "$macro_version"; then
2741 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2742 $progname: definition of this LT_INIT comes from an older release.
2743 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2744 $progname: and run autoconf again.
2748 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2749 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2750 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2751 $progname: and run autoconf again.
2756 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2757 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2758 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2759 $progname: of $PACKAGE $VERSION and run autoconf again.
2768 # libtool_options_prep [ARG]...
2769 # -----------------------------
2770 # Preparation for options parsed by libtool.
2771 libtool_options_prep ()
2781 opt_preserve_dup_deps=false
2787 # Shorthand for --mode=foo, only valid as the first argument
2790 shift; set dummy --mode clean ${1+"$@"}; shift
2792 compile|compil|compi|comp|com|co|c)
2793 shift; set dummy --mode compile ${1+"$@"}; shift
2795 execute|execut|execu|exec|exe|ex|e)
2796 shift; set dummy --mode execute ${1+"$@"}; shift
2798 finish|finis|fini|fin|fi|f)
2799 shift; set dummy --mode finish ${1+"$@"}; shift
2801 install|instal|insta|inst|ins|in|i)
2802 shift; set dummy --mode install ${1+"$@"}; shift
2805 shift; set dummy --mode link ${1+"$@"}; shift
2807 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2808 shift; set dummy --mode uninstall ${1+"$@"}; shift
2812 # Pass back the list of options.
2813 func_quote_for_eval ${1+"$@"}
2814 libtool_options_prep_result=$func_quote_for_eval_result
2816 func_add_hook func_options_prep libtool_options_prep
2819 # libtool_parse_options [ARG]...
2820 # ---------------------------------
2821 # Provide handling for libtool specific options.
2822 libtool_parse_options ()
2826 # Perform our own loop to consume as many options as possible in
2828 while test $# -gt 0; do
2832 --dry-run|--dryrun|-n)
2836 --config) func_config ;;
2839 opt_dlopen="${opt_dlopen+$opt_dlopen
2844 --preserve-dup-deps)
2845 opt_preserve_dup_deps=: ;;
2847 --features) func_features ;;
2849 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2851 --help) opt_help=: ;;
2853 --help-all) opt_help=': help-all' ;;
2855 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2858 # Valid mode arguments:
2859 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2861 # Catch anything else as an error
2862 *) func_error "invalid argument for $_G_opt"
2870 --no-silent|--no-quiet)
2872 func_append preserve_args " $_G_opt"
2875 --no-warnings|--no-warning|--no-warn)
2877 func_append preserve_args " $_G_opt"
2882 func_append preserve_args " $_G_opt"
2888 func_append preserve_args " $_G_opt"
2891 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2893 func_append preserve_args " $_G_opt $1"
2894 func_enable_tag "$1"
2898 --verbose|-v) opt_quiet=false
2900 func_append preserve_args " $_G_opt"
2903 # An option not handled by this hook function:
2904 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2909 # save modified positional parameters for caller
2910 func_quote_for_eval ${1+"$@"}
2911 libtool_parse_options_result=$func_quote_for_eval_result
2913 func_add_hook func_parse_options libtool_parse_options
2917 # libtool_validate_options [ARG]...
2918 # ---------------------------------
2919 # Perform any sanity checks on option settings and/or unconsumed
2921 libtool_validate_options ()
2923 # save first non-option argument
2924 if test 0 -lt $#; then
2930 test : = "$debug_cmd" || func_append preserve_args " --debug"
2933 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2934 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2935 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
2936 # don't eliminate duplications in $postdeps and $predeps
2937 opt_duplicate_compiler_generated_deps=:
2940 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2945 # Sanity checks first:
2946 func_check_version_match
2948 test yes != "$build_libtool_libs" \
2949 && test yes != "$build_old_libs" \
2950 && func_fatal_configuration "not configured to build any kind of library"
2953 eval std_shrext=\"$shrext_cmds\"
2955 # Only execute mode is allowed to have -dlopen flags.
2956 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2957 func_error "unrecognized option '-dlopen'"
2962 # Change the help message to a mode-specific one.
2964 help="Try '$progname --help --mode=$opt_mode' for more information."
2967 # Pass back the unparsed argument list
2968 func_quote_for_eval ${1+"$@"}
2969 libtool_validate_options_result=$func_quote_for_eval_result
2971 func_add_hook func_validate_options libtool_validate_options
2974 # Process options as early as possible so that --help and --version
2975 # can return quickly.
2976 func_options ${1+"$@"}
2977 eval set dummy "$func_options_result"; shift
2985 magic='%%%MAGIC variable%%%'
2986 magic_exe='%%%MAGIC EXE variable%%%'
2992 # If this variable is set in any of the actions, the command in it
2993 # will be execed at the end. This prevents here-documents from being
2994 # left over by shells.
2998 # A function that is used when there is no print builtin or printf.
2999 func_fallback_echo ()
3001 eval 'cat <<_LTECHO_EOF
3006 # func_generated_by_libtool
3007 # True iff stdin has been generated by Libtool. This function is only
3008 # a basic sanity check; it will hardly flush out determined imposters.
3009 func_generated_by_libtool_p ()
3011 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
3015 # True iff FILE is a libtool '.la' library or '.lo' object file.
3016 # This function is only a basic sanity check; it will hardly flush out
3017 # determined imposters.
3021 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
3024 # func_lalib_unsafe_p file
3025 # True iff FILE is a libtool '.la' library or '.lo' object file.
3026 # This function implements the same check as func_lalib_p without
3027 # resorting to external programs. To this end, it redirects stdin and
3028 # closes it afterwards, without saving the original file descriptor.
3029 # As a safety measure, use it only where a negative result would be
3030 # fatal anyway. Works if 'file' does not exist.
3031 func_lalib_unsafe_p ()
3034 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
3035 for lalib_p_l in 1 2 3 4
3038 case $lalib_p_line in
3039 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
3044 test yes = "$lalib_p"
3047 # func_ltwrapper_script_p file
3048 # True iff FILE is a libtool wrapper script
3049 # This function is only a basic sanity check; it will hardly flush out
3050 # determined imposters.
3051 func_ltwrapper_script_p ()
3054 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
3057 # func_ltwrapper_executable_p file
3058 # True iff FILE is a libtool wrapper executable
3059 # This function is only a basic sanity check; it will hardly flush out
3060 # determined imposters.
3061 func_ltwrapper_executable_p ()
3063 func_ltwrapper_exec_suffix=
3066 *) func_ltwrapper_exec_suffix=.exe ;;
3068 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
3071 # func_ltwrapper_scriptname file
3072 # Assumes file is an ltwrapper_executable
3073 # uses $file to determine the appropriate filename for a
3074 # temporary ltwrapper_script.
3075 func_ltwrapper_scriptname ()
3077 func_dirname_and_basename "$1" "" "."
3078 func_stripname '' '.exe' "$func_basename_result"
3079 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
3082 # func_ltwrapper_p file
3083 # True iff FILE is a libtool wrapper script or wrapper executable
3084 # This function is only a basic sanity check; it will hardly flush out
3085 # determined imposters.
3088 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
3092 # func_execute_cmds commands fail_cmd
3093 # Execute tilde-delimited COMMANDS.
3094 # If FAIL_CMD is given, eval that upon failure.
3095 # FAIL_CMD may read-access the current command in variable CMD!
3096 func_execute_cmds ()
3100 save_ifs=$IFS; IFS='~'
3105 func_show_eval "$cmd" "${2-:}"
3112 # Source FILE, adding directory component if necessary.
3113 # Note that it is not necessary on cygwin/mingw to append a dot to
3114 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
3115 # behavior happens only for exec(3), not for open(2)! Also, sourcing
3116 # 'FILE.' does not work on cygwin managed mounts.
3122 */* | *\\*) . "$1" ;;
3128 # func_resolve_sysroot PATH
3129 # Replace a leading = in PATH with a sysroot. Store the result into
3130 # func_resolve_sysroot_result
3131 func_resolve_sysroot ()
3133 func_resolve_sysroot_result=$1
3134 case $func_resolve_sysroot_result in
3136 func_stripname '=' '' "$func_resolve_sysroot_result"
3137 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
3142 # func_replace_sysroot PATH
3143 # If PATH begins with the sysroot, replace it with = and
3144 # store the result into func_replace_sysroot_result.
3145 func_replace_sysroot ()
3147 case $lt_sysroot:$1 in
3149 func_stripname "$lt_sysroot" '' "$1"
3150 func_replace_sysroot_result='='$func_stripname_result
3153 # Including no sysroot.
3154 func_replace_sysroot_result=$1
3159 # func_infer_tag arg
3160 # Infer tagged configuration to use if any are available and
3161 # if one wasn't chosen via the "--tag" command line option.
3162 # Only attempt this if the compiler in the base compile
3163 # command doesn't match the default compiler.
3164 # arg is usually of the form 'gcc ...'
3169 if test -n "$available_tags" && test -z "$tagname"; then
3172 func_append_quoted CC_quoted "$arg"
3174 CC_expanded=`func_echo_all $CC`
3175 CC_quoted_expanded=`func_echo_all $CC_quoted`
3177 # Blanks in the command may have been stripped by the calling shell,
3178 # but not from the CC environment variable when configure was run.
3179 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
3180 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
3181 # Blanks at the start of $base_compile will cause this to fail
3182 # if we don't check for them as well.
3184 for z in $available_tags; do
3185 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
3186 # Evaluate the configuration.
3187 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
3190 # Double-quote args containing other shell metacharacters.
3191 func_append_quoted CC_quoted "$arg"
3193 CC_expanded=`func_echo_all $CC`
3194 CC_quoted_expanded=`func_echo_all $CC_quoted`
3196 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
3197 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
3198 # The compiler in the base compile command matches
3199 # the one in the tagged configuration.
3200 # Assume this is the tagged configuration we want.
3207 # If $tagname still isn't set, then no tagged configuration
3208 # was found and let the user know that the "--tag" command
3209 # line option must be used.
3210 if test -z "$tagname"; then
3211 func_echo "unable to infer tagged configuration"
3212 func_fatal_error "specify a tag with '--tag'"
3214 # func_verbose "using $tagname tagged configuration"
3223 # func_write_libtool_object output_name pic_name nonpic_name
3224 # Create a libtool object file (analogous to a ".la" file),
3225 # but don't create it if we're doing a dry run.
3226 func_write_libtool_object ()
3229 if test yes = "$build_libtool_libs"; then
3235 if test yes = "$build_old_libs"; then
3242 cat >${write_libobj}T <<EOF
3243 # $write_libobj - a libtool object file
3244 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
3246 # Please DO NOT delete this file!
3247 # It is necessary for linking the library.
3249 # Name of the PIC object.
3250 pic_object=$write_lobj
3252 # Name of the non-PIC object
3253 non_pic_object=$write_oldobj
3256 $MV "${write_libobj}T" "$write_libobj"
3261 ##################################################
3262 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
3263 ##################################################
3265 # func_convert_core_file_wine_to_w32 ARG
3266 # Helper function used by file name conversion functions when $build is *nix,
3267 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
3268 # correctly configured wine environment available, with the winepath program
3269 # in $build's $PATH.
3271 # ARG is the $build file name to be converted to w32 format.
3272 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
3273 # be empty on error (or when ARG is empty)
3274 func_convert_core_file_wine_to_w32 ()
3278 func_convert_core_file_wine_to_w32_result=$1
3279 if test -n "$1"; then
3280 # Unfortunately, winepath does not exit with a non-zero error code, so we
3281 # are forced to check the contents of stdout. On the other hand, if the
3282 # command is not found, the shell will set an exit code of 127 and print
3283 # *an error message* to stdout. So we must check for both error code of
3284 # zero AND non-empty stdout, which explains the odd construction:
3285 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
3286 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
3287 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
3288 $SED -e "$sed_naive_backslashify"`
3290 func_convert_core_file_wine_to_w32_result=
3294 # end: func_convert_core_file_wine_to_w32
3297 # func_convert_core_path_wine_to_w32 ARG
3298 # Helper function used by path conversion functions when $build is *nix, and
3299 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
3300 # configured wine environment available, with the winepath program in $build's
3301 # $PATH. Assumes ARG has no leading or trailing path separator characters.
3303 # ARG is path to be converted from $build format to win32.
3304 # Result is available in $func_convert_core_path_wine_to_w32_result.
3305 # Unconvertible file (directory) names in ARG are skipped; if no directory names
3306 # are convertible, then the result may be empty.
3307 func_convert_core_path_wine_to_w32 ()
3311 # unfortunately, winepath doesn't convert paths, only file names
3312 func_convert_core_path_wine_to_w32_result=
3313 if test -n "$1"; then
3316 for func_convert_core_path_wine_to_w32_f in $1; do
3318 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
3319 if test -n "$func_convert_core_file_wine_to_w32_result"; then
3320 if test -z "$func_convert_core_path_wine_to_w32_result"; then
3321 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
3323 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
3330 # end: func_convert_core_path_wine_to_w32
3333 # func_cygpath ARGS...
3334 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
3335 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
3336 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
3337 # (2), returns the Cygwin file name or path in func_cygpath_result (input
3338 # file name or path is assumed to be in w32 format, as previously converted
3339 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
3340 # or path in func_cygpath_result (input file name or path is assumed to be in
3341 # Cygwin format). Returns an empty string on error.
3343 # ARGS are passed to cygpath, with the last one being the file name or path to
3346 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
3347 # environment variable; do not put it in $PATH.
3352 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
3353 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
3354 if test "$?" -ne 0; then
3355 # on failure, ensure result is empty
3356 func_cygpath_result=
3359 func_cygpath_result=
3360 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
3366 # func_convert_core_msys_to_w32 ARG
3367 # Convert file name or path ARG from MSYS format to w32 format. Return
3368 # result in func_convert_core_msys_to_w32_result.
3369 func_convert_core_msys_to_w32 ()
3373 # awkward: cmd appends spaces to result
3374 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
3375 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
3377 #end: func_convert_core_msys_to_w32
3380 # func_convert_file_check ARG1 ARG2
3381 # Verify that ARG1 (a file name in $build format) was converted to $host
3382 # format in ARG2. Otherwise, emit an error message, but continue (resetting
3383 # func_to_host_file_result to ARG1).
3384 func_convert_file_check ()
3388 if test -z "$2" && test -n "$1"; then
3389 func_error "Could not determine host file name corresponding to"
3391 func_error "Continuing, but uninstalled executables may not work."
3393 func_to_host_file_result=$1
3396 # end func_convert_file_check
3399 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
3400 # Verify that FROM_PATH (a path in $build format) was converted to $host
3401 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
3402 # func_to_host_file_result to a simplistic fallback value (see below).
3403 func_convert_path_check ()
3407 if test -z "$4" && test -n "$3"; then
3408 func_error "Could not determine the host path corresponding to"
3410 func_error "Continuing, but uninstalled executables may not work."
3411 # Fallback. This is a deliberately simplistic "conversion" and
3412 # should not be "improved". See libtool.info.
3413 if test "x$1" != "x$2"; then
3414 lt_replace_pathsep_chars="s|$1|$2|g"
3415 func_to_host_path_result=`echo "$3" |
3416 $SED -e "$lt_replace_pathsep_chars"`
3418 func_to_host_path_result=$3
3422 # end func_convert_path_check
3425 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
3426 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
3427 # and appending REPL if ORIG matches BACKPAT.
3428 func_convert_path_front_back_pathsep ()
3433 $1 ) func_to_host_path_result=$3$func_to_host_path_result
3437 $2 ) func_append func_to_host_path_result "$3"
3441 # end func_convert_path_front_back_pathsep
3444 ##################################################
3445 # $build to $host FILE NAME CONVERSION FUNCTIONS #
3446 ##################################################
3447 # invoked via '$to_host_file_cmd ARG'
3449 # In each case, ARG is the path to be converted from $build to $host format.
3450 # Result will be available in $func_to_host_file_result.
3453 # func_to_host_file ARG
3454 # Converts the file name ARG from $build format to $host format. Return result
3455 # in func_to_host_file_result.
3456 func_to_host_file ()
3460 $to_host_file_cmd "$1"
3462 # end func_to_host_file
3465 # func_to_tool_file ARG LAZY
3466 # converts the file name ARG from $build format to toolchain format. Return
3467 # result in func_to_tool_file_result. If the conversion in use is listed
3468 # in (the comma separated) LAZY, no conversion takes place.
3469 func_to_tool_file ()
3474 *,"$to_tool_file_cmd",*)
3475 func_to_tool_file_result=$1
3478 $to_tool_file_cmd "$1"
3479 func_to_tool_file_result=$func_to_host_file_result
3483 # end func_to_tool_file
3486 # func_convert_file_noop ARG
3487 # Copy ARG to func_to_host_file_result.
3488 func_convert_file_noop ()
3490 func_to_host_file_result=$1
3492 # end func_convert_file_noop
3495 # func_convert_file_msys_to_w32 ARG
3496 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
3497 # conversion to w32 is not available inside the cwrapper. Returns result in
3498 # func_to_host_file_result.
3499 func_convert_file_msys_to_w32 ()
3503 func_to_host_file_result=$1
3504 if test -n "$1"; then
3505 func_convert_core_msys_to_w32 "$1"
3506 func_to_host_file_result=$func_convert_core_msys_to_w32_result
3508 func_convert_file_check "$1" "$func_to_host_file_result"
3510 # end func_convert_file_msys_to_w32
3513 # func_convert_file_cygwin_to_w32 ARG
3514 # Convert file name ARG from Cygwin to w32 format. Returns result in
3515 # func_to_host_file_result.
3516 func_convert_file_cygwin_to_w32 ()
3520 func_to_host_file_result=$1
3521 if test -n "$1"; then
3522 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3523 # LT_CYGPATH in this case.
3524 func_to_host_file_result=`cygpath -m "$1"`
3526 func_convert_file_check "$1" "$func_to_host_file_result"
3528 # end func_convert_file_cygwin_to_w32
3531 # func_convert_file_nix_to_w32 ARG
3532 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3533 # and a working winepath. Returns result in func_to_host_file_result.
3534 func_convert_file_nix_to_w32 ()
3538 func_to_host_file_result=$1
3539 if test -n "$1"; then
3540 func_convert_core_file_wine_to_w32 "$1"
3541 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3543 func_convert_file_check "$1" "$func_to_host_file_result"
3545 # end func_convert_file_nix_to_w32
3548 # func_convert_file_msys_to_cygwin ARG
3549 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3550 # Returns result in func_to_host_file_result.
3551 func_convert_file_msys_to_cygwin ()
3555 func_to_host_file_result=$1
3556 if test -n "$1"; then
3557 func_convert_core_msys_to_w32 "$1"
3558 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3559 func_to_host_file_result=$func_cygpath_result
3561 func_convert_file_check "$1" "$func_to_host_file_result"
3563 # end func_convert_file_msys_to_cygwin
3566 # func_convert_file_nix_to_cygwin ARG
3567 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3568 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3569 # in func_to_host_file_result.
3570 func_convert_file_nix_to_cygwin ()
3574 func_to_host_file_result=$1
3575 if test -n "$1"; then
3576 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3577 func_convert_core_file_wine_to_w32 "$1"
3578 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3579 func_to_host_file_result=$func_cygpath_result
3581 func_convert_file_check "$1" "$func_to_host_file_result"
3583 # end func_convert_file_nix_to_cygwin
3586 #############################################
3587 # $build to $host PATH CONVERSION FUNCTIONS #
3588 #############################################
3589 # invoked via '$to_host_path_cmd ARG'
3591 # In each case, ARG is the path to be converted from $build to $host format.
3592 # The result will be available in $func_to_host_path_result.
3594 # Path separators are also converted from $build format to $host format. If
3595 # ARG begins or ends with a path separator character, it is preserved (but
3596 # converted to $host format) on output.
3598 # All path conversion functions are named using the following convention:
3599 # file name conversion function : func_convert_file_X_to_Y ()
3600 # path conversion function : func_convert_path_X_to_Y ()
3601 # where, for any given $build/$host combination the 'X_to_Y' value is the
3602 # same. If conversion functions are added for new $build/$host combinations,
3603 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3607 # func_init_to_host_path_cmd
3608 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3609 # appropriate value, based on the value of $to_host_file_cmd.
3611 func_init_to_host_path_cmd ()
3615 if test -z "$to_host_path_cmd"; then
3616 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3617 to_host_path_cmd=func_convert_path_$func_stripname_result
3622 # func_to_host_path ARG
3623 # Converts the path ARG from $build format to $host format. Return result
3624 # in func_to_host_path_result.
3625 func_to_host_path ()
3629 func_init_to_host_path_cmd
3630 $to_host_path_cmd "$1"
3632 # end func_to_host_path
3635 # func_convert_path_noop ARG
3636 # Copy ARG to func_to_host_path_result.
3637 func_convert_path_noop ()
3639 func_to_host_path_result=$1
3641 # end func_convert_path_noop
3644 # func_convert_path_msys_to_w32 ARG
3645 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3646 # conversion to w32 is not available inside the cwrapper. Returns result in
3647 # func_to_host_path_result.
3648 func_convert_path_msys_to_w32 ()
3652 func_to_host_path_result=$1
3653 if test -n "$1"; then
3654 # Remove leading and trailing path separator characters from ARG. MSYS
3655 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3656 # and winepath ignores them completely.
3657 func_stripname : : "$1"
3658 func_to_host_path_tmp1=$func_stripname_result
3659 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3660 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3661 func_convert_path_check : ";" \
3662 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3663 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3666 # end func_convert_path_msys_to_w32
3669 # func_convert_path_cygwin_to_w32 ARG
3670 # Convert path ARG from Cygwin to w32 format. Returns result in
3671 # func_to_host_file_result.
3672 func_convert_path_cygwin_to_w32 ()
3676 func_to_host_path_result=$1
3677 if test -n "$1"; then
3678 # See func_convert_path_msys_to_w32:
3679 func_stripname : : "$1"
3680 func_to_host_path_tmp1=$func_stripname_result
3681 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3682 func_convert_path_check : ";" \
3683 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3684 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3687 # end func_convert_path_cygwin_to_w32
3690 # func_convert_path_nix_to_w32 ARG
3691 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3692 # a working winepath. Returns result in func_to_host_file_result.
3693 func_convert_path_nix_to_w32 ()
3697 func_to_host_path_result=$1
3698 if test -n "$1"; then
3699 # See func_convert_path_msys_to_w32:
3700 func_stripname : : "$1"
3701 func_to_host_path_tmp1=$func_stripname_result
3702 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3703 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3704 func_convert_path_check : ";" \
3705 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3706 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3709 # end func_convert_path_nix_to_w32
3712 # func_convert_path_msys_to_cygwin ARG
3713 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3714 # Returns result in func_to_host_file_result.
3715 func_convert_path_msys_to_cygwin ()
3719 func_to_host_path_result=$1
3720 if test -n "$1"; then
3721 # See func_convert_path_msys_to_w32:
3722 func_stripname : : "$1"
3723 func_to_host_path_tmp1=$func_stripname_result
3724 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3725 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3726 func_to_host_path_result=$func_cygpath_result
3727 func_convert_path_check : : \
3728 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3729 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3732 # end func_convert_path_msys_to_cygwin
3735 # func_convert_path_nix_to_cygwin ARG
3736 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3737 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3738 # func_to_host_file_result.
3739 func_convert_path_nix_to_cygwin ()
3743 func_to_host_path_result=$1
3744 if test -n "$1"; then
3745 # Remove leading and trailing path separator characters from
3746 # ARG. msys behavior is inconsistent here, cygpath turns them
3747 # into '.;' and ';.', and winepath ignores them completely.
3748 func_stripname : : "$1"
3749 func_to_host_path_tmp1=$func_stripname_result
3750 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3751 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3752 func_to_host_path_result=$func_cygpath_result
3753 func_convert_path_check : : \
3754 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3755 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3758 # end func_convert_path_nix_to_cygwin
3761 # func_dll_def_p FILE
3762 # True iff FILE is a Windows DLL '.def' file.
3763 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3768 func_dll_def_p_tmp=`$SED -n \
3770 -e '/^\(;.*\)*$/d' \
3771 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3774 test DEF = "$func_dll_def_p_tmp"
3778 # func_mode_compile arg...
3779 func_mode_compile ()
3783 # Get the compilation command and the source file.
3785 srcfile=$nonopt # always keep a non-empty value in "srcfile"
3797 # do not "continue". Instead, add this to base_compile
3809 # Accept any command-line options.
3812 test -n "$libobj" && \
3813 func_fatal_error "you cannot specify '-o' more than once"
3818 -pie | -fpie | -fPIE)
3819 func_append pie_flag " $arg"
3823 -shared | -static | -prefer-pic | -prefer-non-pic)
3824 func_append later " $arg"
3834 arg_mode=arg # the next one goes into the "base_compile" arg list
3835 continue # The current "srcfile" will either be retained or
3836 ;; # replaced later. I would guess that would be a bug.
3839 func_stripname '-Wc,' '' "$arg"
3840 args=$func_stripname_result
3842 save_ifs=$IFS; IFS=,
3843 for arg in $args; do
3845 func_append_quoted lastarg "$arg"
3848 func_stripname ' ' '' "$lastarg"
3849 lastarg=$func_stripname_result
3851 # Add the arguments to base_compile.
3852 func_append base_compile " $lastarg"
3857 # Accept the current argument as the source file.
3858 # The previous "srcfile" becomes the current argument.
3865 esac # case $arg_mode
3867 # Aesthetically quote the previous argument.
3868 func_append_quoted base_compile "$lastarg"
3873 func_fatal_error "you must specify an argument for -Xcompile"
3876 func_fatal_error "you must specify a target with '-o'"
3879 # Get the name of the library object.
3880 test -z "$libobj" && {
3881 func_basename "$srcfile"
3882 libobj=$func_basename_result
3887 # Recognize several different file suffixes.
3888 # If the user specifies -o file.o, it is replaced with file.lo
3891 *.ada | *.adb | *.ads | *.asm | \
3892 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3893 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3894 func_xform "$libobj"
3895 libobj=$func_xform_result
3900 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3902 func_fatal_error "cannot determine name of library object from '$libobj'"
3906 func_infer_tag $base_compile
3908 for arg in $later; do
3911 test yes = "$build_libtool_libs" \
3912 || func_fatal_configuration "cannot build a shared library"
3918 build_libtool_libs=no
3935 func_quote_for_eval "$libobj"
3936 test "X$libobj" != "X$func_quote_for_eval_result" \
3937 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3938 && func_warning "libobj name '$libobj' may not contain shell special characters."
3939 func_dirname_and_basename "$obj" "/" ""
3940 objname=$func_basename_result
3941 xdir=$func_dirname_result
3942 lobj=$xdir$objdir/$objname
3944 test -z "$base_compile" && \
3945 func_fatal_help "you must specify a compilation command"
3947 # Delete any leftover library objects.
3948 if test yes = "$build_old_libs"; then
3949 removelist="$obj $lobj $libobj ${libobj}T"
3951 removelist="$lobj $libobj ${libobj}T"
3954 # On Cygwin there's no "real" PIC flag so we must build both object types
3956 cygwin* | mingw* | pw32* | os2* | cegcc*)
3960 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3961 # non-PIC code in shared libraries is not supported
3965 # Calculate the filename of the output object if compiler does
3966 # not support -o with -c
3967 if test no = "$compiler_c_o"; then
3968 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3969 lockfile=$output_obj.lock
3976 # Lock this critical section if it is needed
3977 # We use this script file to make the link, it avoids creating a new file
3978 if test yes = "$need_locks"; then
3979 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3980 func_echo "Waiting for $lockfile to be removed"
3983 elif test warn = "$need_locks"; then
3984 if test -f "$lockfile"; then
3986 *** ERROR, $lockfile exists and contains:
3987 `cat $lockfile 2>/dev/null`
3989 This indicates that another process is trying to use the same
3990 temporary object file, and libtool could not work around it because
3991 your compiler does not support '-c' and '-o' together. If you
3992 repeat this compilation, it may succeed, by chance, but you had better
3993 avoid parallel builds (make -j) in this platform, or get a better
3996 $opt_dry_run || $RM $removelist
3999 func_append removelist " $output_obj"
4000 $ECHO "$srcfile" > "$lockfile"
4003 $opt_dry_run || $RM $removelist
4004 func_append removelist " $lockfile"
4005 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
4007 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
4008 srcfile=$func_to_tool_file_result
4009 func_quote_for_eval "$srcfile"
4010 qsrcfile=$func_quote_for_eval_result
4012 # Only build a PIC object if we are building libtool libraries.
4013 if test yes = "$build_libtool_libs"; then
4014 # Without this assignment, base_compile gets emptied.
4015 fbsd_hideous_sh_bug=$base_compile
4017 if test no != "$pic_mode"; then
4018 command="$base_compile $qsrcfile $pic_flag"
4020 # Don't build PIC code
4021 command="$base_compile $qsrcfile"
4024 func_mkdir_p "$xdir$objdir"
4026 if test -z "$output_obj"; then
4027 # Place PIC objects in $objdir
4028 func_append command " -o $lobj"
4031 func_show_eval_locale "$command" \
4032 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
4034 if test warn = "$need_locks" &&
4035 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
4037 *** ERROR, $lockfile contains:
4038 `cat $lockfile 2>/dev/null`
4040 but it should contain:
4043 This indicates that another process is trying to use the same
4044 temporary object file, and libtool could not work around it because
4045 your compiler does not support '-c' and '-o' together. If you
4046 repeat this compilation, it may succeed, by chance, but you had better
4047 avoid parallel builds (make -j) in this platform, or get a better
4050 $opt_dry_run || $RM $removelist
4054 # Just move the object if needed, then go on to compile the next one
4055 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
4056 func_show_eval '$MV "$output_obj" "$lobj"' \
4057 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
4060 # Allow error messages only from the first compilation.
4061 if test yes = "$suppress_opt"; then
4062 suppress_output=' >/dev/null 2>&1'
4066 # Only build a position-dependent object if we build old libraries.
4067 if test yes = "$build_old_libs"; then
4068 if test yes != "$pic_mode"; then
4069 # Don't build PIC code
4070 command="$base_compile $qsrcfile$pie_flag"
4072 command="$base_compile $qsrcfile $pic_flag"
4074 if test yes = "$compiler_c_o"; then
4075 func_append command " -o $obj"
4078 # Suppress compiler output if we already did a PIC compilation.
4079 func_append command "$suppress_output"
4080 func_show_eval_locale "$command" \
4081 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
4083 if test warn = "$need_locks" &&
4084 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
4086 *** ERROR, $lockfile contains:
4087 `cat $lockfile 2>/dev/null`
4089 but it should contain:
4092 This indicates that another process is trying to use the same
4093 temporary object file, and libtool could not work around it because
4094 your compiler does not support '-c' and '-o' together. If you
4095 repeat this compilation, it may succeed, by chance, but you had better
4096 avoid parallel builds (make -j) in this platform, or get a better
4099 $opt_dry_run || $RM $removelist
4103 # Just move the object if needed
4104 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
4105 func_show_eval '$MV "$output_obj" "$obj"' \
4106 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
4111 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
4113 # Unlock the critical section if it was locked
4114 if test no != "$need_locks"; then
4115 removelist=$lockfile
4124 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
4129 # We need to display help for each of the modes.
4132 # Generic help is extracted from the usage comments
4133 # at the start of this file.
4139 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4141 Remove files from the build directory.
4143 RM is the name of the program to use to delete files associated with each FILE
4144 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4147 If FILE is a libtool library, object or program, all the files associated
4148 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4153 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4155 Compile a source file into a libtool library object.
4157 This mode accepts the following additional options:
4159 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4160 -no-suppress do not suppress compiler output for multiple passes
4161 -prefer-pic try to build PIC objects only
4162 -prefer-non-pic try to build non-PIC objects only
4163 -shared do not build a '.o' file suitable for static linking
4164 -static only build a '.o' file suitable for static linking
4165 -Wc,FLAG pass FLAG directly to the compiler
4167 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
4168 from the given SOURCEFILE.
4170 The output file name is determined by removing the directory component from
4171 SOURCEFILE, then substituting the C source code suffix '.c' with the
4172 library object suffix, '.lo'."
4177 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
4179 Automatically set library path, then run a program.
4181 This mode accepts the following additional options:
4183 -dlopen FILE add the directory containing FILE to the library path
4185 This mode sets the library path environment variable according to '-dlopen'
4188 If any of the ARGS are libtool executable wrappers, then they are translated
4189 into their corresponding uninstalled binary, and any of their required library
4190 directories are added to the library path.
4192 Then, COMMAND is executed, with ARGS as arguments."
4197 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
4199 Complete the installation of libtool libraries.
4201 Each LIBDIR is a directory that contains libtool libraries.
4203 The commands that this mode executes may require superuser privileges. Use
4204 the '--dry-run' option if you just want to see what would be executed."
4209 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
4211 Install executables or libraries.
4213 INSTALL-COMMAND is the installation command. The first component should be
4214 either the 'install' or 'cp' program.
4216 The following components of INSTALL-COMMAND are treated specially:
4218 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
4220 The rest of the components are interpreted as arguments to that command (only
4221 BSD-compatible install options are recognized)."
4226 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
4228 Link object files or libraries together to form another library, or to
4229 create an executable program.
4231 LINK-COMMAND is a command using the C compiler that you would use to create
4232 a program from several object files.
4234 The following components of LINK-COMMAND are treated specially:
4236 -all-static do not do any dynamic linking at all
4237 -avoid-version do not add a version suffix if possible
4238 -bindir BINDIR specify path to binaries directory (for systems where
4239 libraries must be found in the PATH setting at runtime)
4240 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
4241 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4242 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4243 -export-symbols SYMFILE
4244 try to export only the symbols listed in SYMFILE
4245 -export-symbols-regex REGEX
4246 try to export only the symbols matching REGEX
4247 -LLIBDIR search LIBDIR for required installed libraries
4248 -lNAME OUTPUT-FILE requires the installed library libNAME
4249 -module build a library that can dlopened
4250 -no-fast-install disable the fast-install mode
4251 -no-install link a not-installable executable
4252 -no-undefined declare that a library does not refer to external symbols
4253 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4254 -objectlist FILE use a list of object files found in FILE to specify objects
4255 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
4256 -precious-files-regex REGEX
4257 don't remove output files matching REGEX
4258 -release RELEASE specify package release information
4259 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4260 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4261 -shared only do dynamic linking of libtool libraries
4262 -shrext SUFFIX override the standard shared library file extension
4263 -static do not do any dynamic linking of uninstalled libtool libraries
4264 -static-libtool-libs
4265 do not do any dynamic linking of libtool libraries
4266 -version-info CURRENT[:REVISION[:AGE]]
4267 specify library version info [each variable defaults to 0]
4268 -weak LIBNAME declare that the target provides the LIBNAME interface
4270 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
4272 -Xlinker FLAG pass linker-specific FLAG directly to the linker
4273 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
4275 All other options (arguments beginning with '-') are ignored.
4277 Every other argument is treated as a filename. Files ending in '.la' are
4278 treated as uninstalled libtool libraries, other files are standard or library
4281 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
4282 only library objects ('.lo' files) may be specified, and '-rpath' is
4283 required, except when creating a convenience library.
4285 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
4286 using 'ar' and 'ranlib', or on Windows using 'lib'.
4288 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
4289 is created, otherwise an executable program is created."
4294 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4296 Remove libraries from an installation directory.
4298 RM is the name of the program to use to delete files associated with each FILE
4299 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4302 If FILE is a libtool library, all the files associated with it are deleted.
4303 Otherwise, only FILE itself is deleted using RM."
4307 func_fatal_help "invalid operation mode '$opt_mode'"
4312 $ECHO "Try '$progname --help' for more information about other modes."
4315 # Now that we've collected a possible --mode arg, show help if necessary
4317 if test : = "$opt_help"; then
4322 for opt_mode in compile link execute install finish uninstall clean; do
4325 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
4328 for opt_mode in compile link execute install finish uninstall clean; do
4334 /^When reporting/,/^Report/{
4339 /information about other modes/d
4340 /more detailed .*MODE/d
4341 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
4347 # func_mode_execute arg...
4348 func_mode_execute ()
4352 # The first argument is the command name.
4355 func_fatal_help "you must specify a COMMAND"
4357 # Handle -dlopen flags immediately.
4358 for file in $opt_dlopen; do
4360 || func_fatal_help "'$file' is not a file"
4365 func_resolve_sysroot "$file"
4366 file=$func_resolve_sysroot_result
4368 # Check to see that this really is a libtool archive.
4369 func_lalib_unsafe_p "$file" \
4370 || func_fatal_help "'$lib' is not a valid libtool archive"
4372 # Read the libtool library.
4377 # Skip this library if it cannot be dlopened.
4378 if test -z "$dlname"; then
4379 # Warn if it was a shared library.
4380 test -n "$library_names" && \
4381 func_warning "'$file' was not linked with '-export-dynamic'"
4385 func_dirname "$file" "" "."
4386 dir=$func_dirname_result
4388 if test -f "$dir/$objdir/$dlname"; then
4389 func_append dir "/$objdir"
4391 if test ! -f "$dir/$dlname"; then
4392 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
4398 # Just add the directory containing the .lo file.
4399 func_dirname "$file" "" "."
4400 dir=$func_dirname_result
4404 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
4409 # Get the absolute pathname.
4410 absdir=`cd "$dir" && pwd`
4411 test -n "$absdir" && dir=$absdir
4413 # Now add the directory to shlibpath_var.
4414 if eval "test -z \"\$$shlibpath_var\""; then
4415 eval "$shlibpath_var=\"\$dir\""
4417 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4421 # This variable tells wrapper scripts just to set shlibpath_var
4422 # rather than running their programs.
4423 libtool_execute_magic=$magic
4425 # Check if any of the arguments is a wrapper script.
4430 -* | *.la | *.lo ) ;;
4432 # Do a test to see if this is really a libtool program.
4433 if func_ltwrapper_script_p "$file"; then
4435 # Transform arg to wrapped name.
4436 file=$progdir/$program
4437 elif func_ltwrapper_executable_p "$file"; then
4438 func_ltwrapper_scriptname "$file"
4439 func_source "$func_ltwrapper_scriptname_result"
4440 # Transform arg to wrapped name.
4441 file=$progdir/$program
4445 # Quote arguments (to preserve shell metacharacters).
4446 func_append_quoted args "$file"
4449 if $opt_dry_run; then
4450 # Display what would be done.
4451 if test -n "$shlibpath_var"; then
4452 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
4453 echo "export $shlibpath_var"
4458 if test -n "$shlibpath_var"; then
4459 # Export the shlibpath_var.
4460 eval "export $shlibpath_var"
4463 # Restore saved environment variables
4464 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
4466 eval "if test \"\${save_$lt_var+set}\" = set; then
4467 $lt_var=\$save_$lt_var; export $lt_var
4473 # Now prepare to actually exec the command.
4478 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
4481 # func_mode_finish arg...
4490 for opt in "$nonopt" ${1+"$@"}
4492 if test -d "$opt"; then
4493 func_append libdirs " $opt"
4495 elif test -f "$opt"; then
4496 if func_lalib_unsafe_p "$opt"; then
4497 func_append libs " $opt"
4499 func_warning "'$opt' is not a valid libtool archive"
4503 func_fatal_error "invalid argument '$opt'"
4507 if test -n "$libs"; then
4508 if test -n "$lt_sysroot"; then
4509 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
4510 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
4515 # Remove sysroot references
4516 if $opt_dry_run; then
4517 for lib in $libs; do
4518 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4521 tmpdir=`func_mktempdir`
4522 for lib in $libs; do
4523 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4525 mv -f $tmpdir/tmp-la $lib
4531 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4532 for libdir in $libdirs; do
4533 if test -n "$finish_cmds"; then
4534 # Do each command in the finish commands.
4535 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4538 if test -n "$finish_eval"; then
4539 # Do the single finish_eval.
4540 eval cmds=\"$finish_eval\"
4541 $opt_dry_run || eval "$cmds" || func_append admincmds "
4547 # Exit here if they wanted silent mode.
4548 $opt_quiet && exit $EXIT_SUCCESS
4550 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4551 echo "----------------------------------------------------------------------"
4552 echo "Libraries have been installed in:"
4553 for libdir in $libdirs; do
4557 echo "If you ever happen to want to link against installed libraries"
4558 echo "in a given directory, LIBDIR, you must either use libtool, and"
4559 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4560 echo "flag during linking and do at least one of the following:"
4561 if test -n "$shlibpath_var"; then
4562 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4563 echo " during execution"
4565 if test -n "$runpath_var"; then
4566 echo " - add LIBDIR to the '$runpath_var' environment variable"
4567 echo " during linking"
4569 if test -n "$hardcode_libdir_flag_spec"; then
4571 eval flag=\"$hardcode_libdir_flag_spec\"
4573 $ECHO " - use the '$flag' linker flag"
4575 if test -n "$admincmds"; then
4576 $ECHO " - have your system administrator run these commands:$admincmds"
4578 if test -f /etc/ld.so.conf; then
4579 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4583 echo "See any operating system documentation about shared libraries for"
4585 solaris2.[6789]|solaris2.1[0-9])
4586 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4590 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4593 echo "----------------------------------------------------------------------"
4598 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4601 # func_mode_install arg...
4602 func_mode_install ()
4606 # There may be an optional sh(1) argument at the beginning of
4607 # install_prog (especially on Windows NT).
4608 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4609 # Allow the use of GNU shtool's install command.
4610 case $nonopt in *shtool*) :;; *) false;; esac
4612 # Aesthetically quote it.
4613 func_quote_for_eval "$nonopt"
4614 install_prog="$func_quote_for_eval_result "
4622 # The real first argument should be the name of the installation program.
4623 # Aesthetically quote it.
4624 func_quote_for_eval "$arg"
4625 func_append install_prog "$func_quote_for_eval_result"
4626 install_shared_prog=$install_prog
4627 case " $install_prog " in
4628 *[\\\ /]cp\ *) install_cp=: ;;
4629 *) install_cp=false ;;
4632 # We need to accept at least all the BSD install flags.
4644 if test -n "$dest"; then
4645 func_append files " $dest"
4653 if $install_cp; then :; else
4667 # If the previous option needed an argument, then skip it.
4668 if test -n "$prev"; then
4669 if test X-m = "X$prev" && test -n "$install_override_mode"; then
4670 arg2=$install_override_mode
4681 # Aesthetically quote the argument.
4682 func_quote_for_eval "$arg"
4683 func_append install_prog " $func_quote_for_eval_result"
4684 if test -n "$arg2"; then
4685 func_quote_for_eval "$arg2"
4687 func_append install_shared_prog " $func_quote_for_eval_result"
4690 test -z "$install_prog" && \
4691 func_fatal_help "you must specify an install program"
4693 test -n "$prev" && \
4694 func_fatal_help "the '$prev' option requires an argument"
4696 if test -n "$install_override_mode" && $no_mode; then
4697 if $install_cp; then :; else
4698 func_quote_for_eval "$install_override_mode"
4699 func_append install_shared_prog " -m $func_quote_for_eval_result"
4703 if test -z "$files"; then
4704 if test -z "$dest"; then
4705 func_fatal_help "no file or destination specified"
4707 func_fatal_help "you must specify a destination"
4711 # Strip any trailing slash from the destination.
4712 func_stripname '' '/' "$dest"
4713 dest=$func_stripname_result
4715 # Check to see that the destination is a directory.
4716 test -d "$dest" && isdir=:
4721 func_dirname_and_basename "$dest" "" "."
4722 destdir=$func_dirname_result
4723 destname=$func_basename_result
4725 # Not a directory, so check to see that there is only one file specified.
4726 set dummy $files; shift
4727 test "$#" -gt 1 && \
4728 func_fatal_help "'$dest' is not a directory"
4731 [\\/]* | [A-Za-z]:[\\/]*) ;;
4733 for file in $files; do
4737 func_fatal_help "'$destdir' must be an absolute directory name"
4744 # This variable tells wrapper scripts just to set variables rather
4745 # than running their programs.
4746 libtool_install_magic=$magic
4751 for file in $files; do
4753 # Do each installation.
4756 # Do the static libraries later.
4757 func_append staticlibs " $file"
4761 func_resolve_sysroot "$file"
4762 file=$func_resolve_sysroot_result
4764 # Check to see that this really is a libtool archive.
4765 func_lalib_unsafe_p "$file" \
4766 || func_fatal_help "'$file' is not a valid libtool archive"
4773 # Add the libdir to current_libdirs if it is the destination.
4774 if test "X$destdir" = "X$libdir"; then
4775 case "$current_libdirs " in
4777 *) func_append current_libdirs " $libdir" ;;
4780 # Note the libdir as a future libdir.
4781 case "$future_libdirs " in
4783 *) func_append future_libdirs " $libdir" ;;
4787 func_dirname "$file" "/" ""
4788 dir=$func_dirname_result
4789 func_append dir "$objdir"
4791 if test -n "$relink_command"; then
4792 # Determine the prefix the user has applied to our future dir.
4793 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4795 # Don't allow the user to place us outside of our expected
4796 # location b/c this prevents finding dependent libraries that
4797 # are installed to the same prefix.
4798 # At present, this check doesn't affect windows .dll's that
4799 # are installed into $libdir/../bin (currently, that works fine)
4800 # but it's something to keep an eye on.
4801 test "$inst_prefix_dir" = "$destdir" && \
4802 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
4804 if test -n "$inst_prefix_dir"; then
4805 # Stick the inst_prefix_dir data into the link command.
4806 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4808 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4811 func_warning "relinking '$file'"
4812 func_show_eval "$relink_command" \
4813 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4816 # See the names of the shared library.
4817 set dummy $library_names; shift
4818 if test -n "$1"; then
4823 test -n "$relink_command" && srcname=${realname}T
4825 # Install the shared library and build the symlinks.
4826 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
4830 cygwin* | mingw* | pw32* | cegcc*)
4845 if test -n "$tstripme" && test -n "$striplib"; then
4846 func_show_eval "$striplib $destdir/$realname" 'exit $?'
4849 if test "$#" -gt 0; then
4850 # Delete the old symlinks, and create new ones.
4851 # Try 'ln -sf' first, because the 'ln' binary might depend on
4852 # the symlink we replace! Solaris /bin/ln does not understand -f,
4853 # so we also need to try rm && ln -s.
4856 test "$linkname" != "$realname" \
4857 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4861 # Do each command in the postinstall commands.
4862 lib=$destdir/$realname
4863 func_execute_cmds "$postinstall_cmds" 'exit $?'
4866 # Install the pseudo-library for information purposes.
4867 func_basename "$file"
4868 name=$func_basename_result
4869 instname=$dir/${name}i
4870 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
4872 # Maybe install the static library, too.
4873 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
4877 # Install (i.e. copy) a libtool object.
4879 # Figure out destination file name, if it wasn't already specified.
4880 if test -n "$destname"; then
4881 destfile=$destdir/$destname
4883 func_basename "$file"
4884 destfile=$func_basename_result
4885 destfile=$destdir/$destfile
4888 # Deduce the name of the destination old-style object file.
4891 func_lo2o "$destfile"
4892 staticdest=$func_lo2o_result
4895 staticdest=$destfile
4899 func_fatal_help "cannot copy a libtool object to '$destfile'"
4903 # Install the libtool object if requested.
4904 test -n "$destfile" && \
4905 func_show_eval "$install_prog $file $destfile" 'exit $?'
4907 # Install the old object if enabled.
4908 if test yes = "$build_old_libs"; then
4909 # Deduce the name of the old-style object file.
4911 staticobj=$func_lo2o_result
4912 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
4918 # Figure out destination file name, if it wasn't already specified.
4919 if test -n "$destname"; then
4920 destfile=$destdir/$destname
4922 func_basename "$file"
4923 destfile=$func_basename_result
4924 destfile=$destdir/$destfile
4927 # If the file is missing, and there is a .exe on the end, strip it
4928 # because it is most likely a libtool script we actually want to
4933 if test ! -f "$file"; then
4934 func_stripname '' '.exe' "$file"
4935 file=$func_stripname_result
4941 # Do a test to see if this is really a libtool program.
4944 if func_ltwrapper_executable_p "$file"; then
4945 func_ltwrapper_scriptname "$file"
4946 wrapper=$func_ltwrapper_scriptname_result
4948 func_stripname '' '.exe' "$file"
4949 wrapper=$func_stripname_result
4956 if func_ltwrapper_script_p "$wrapper"; then
4960 func_source "$wrapper"
4962 # Check the variables that should have been set.
4963 test -z "$generated_by_libtool_version" && \
4964 func_fatal_error "invalid libtool wrapper script '$wrapper'"
4967 for lib in $notinst_deplibs; do
4968 # Check to see that each library is installed.
4970 if test -f "$lib"; then
4973 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4974 if test -n "$libdir" && test ! -f "$libfile"; then
4975 func_warning "'$lib' has not been installed in '$libdir'"
4981 func_source "$wrapper"
4984 if test no = "$fast_install" && test -n "$relink_command"; then
4987 tmpdir=`func_mktempdir`
4988 func_basename "$file$stripped_ext"
4989 file=$func_basename_result
4990 outputname=$tmpdir/$file
4991 # Replace the output file specification.
4992 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4995 func_quote_for_expand "$relink_command"
4996 eval "func_echo $func_quote_for_expand_result"
4998 if eval "$relink_command"; then :
5000 func_error "error: relink '$file' with the above command before installing it"
5001 $opt_dry_run || ${RM}r "$tmpdir"
5006 func_warning "cannot relink '$file'"
5010 # Install the binary that we compiled earlier.
5011 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
5015 # remove .exe since cygwin /usr/bin/install will append another
5017 case $install_prog,$host in
5018 */usr/bin/install*,*cygwin*)
5019 case $file:$destfile in
5024 destfile=$destfile.exe
5027 func_stripname '' '.exe' "$destfile"
5028 destfile=$func_stripname_result
5033 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
5034 $opt_dry_run || if test -n "$outputname"; then
5041 for file in $staticlibs; do
5042 func_basename "$file"
5043 name=$func_basename_result
5045 # Set up the ranlib parameters.
5046 oldlib=$destdir/$name
5047 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
5048 tool_oldlib=$func_to_tool_file_result
5050 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
5052 if test -n "$stripme" && test -n "$old_striplib"; then
5053 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
5056 # Do each command in the postinstall commands.
5057 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
5060 test -n "$future_libdirs" && \
5061 func_warning "remember to run '$progname --finish$future_libdirs'"
5063 if test -n "$current_libdirs"; then
5064 # Maybe just do a dry run.
5065 $opt_dry_run && current_libdirs=" -n$current_libdirs"
5066 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
5072 test install = "$opt_mode" && func_mode_install ${1+"$@"}
5075 # func_generate_dlsyms outputname originator pic_p
5076 # Extract symbols from dlprefiles and create ${outputname}S.o with
5077 # a dlpreopen symbol table.
5078 func_generate_dlsyms ()
5085 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
5088 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
5089 if test -n "$NM" && test -n "$global_symbol_pipe"; then
5090 my_dlsyms=${my_outputname}S.c
5092 func_error "not configured to extract global symbols from dlpreopened files"
5096 if test -n "$my_dlsyms"; then
5100 # Discover the nlist of each of the dlfiles.
5101 nlist=$output_objdir/$my_outputname.nm
5103 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
5105 # Parse the name list into a source file.
5106 func_verbose "creating $output_objdir/$my_dlsyms"
5108 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
5109 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
5110 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
5116 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
5117 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
5120 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
5121 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
5122 /* DATA imports from DLLs on WIN32 can't be const, because runtime
5123 relocations are performed -- see ld's documentation on pseudo-relocs. */
5124 # define LT_DLSYM_CONST
5125 #elif defined __osf__
5126 /* This system does not cope well with relocations in const data. */
5127 # define LT_DLSYM_CONST
5129 # define LT_DLSYM_CONST const
5132 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5134 /* External symbol declarations for the compiler. */\
5137 if test yes = "$dlself"; then
5138 func_verbose "generating symbol list for '$output'"
5140 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
5142 # Add our own program objects to the symbol list.
5143 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
5144 for progfile in $progfiles; do
5145 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
5146 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
5147 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
5150 if test -n "$exclude_expsyms"; then
5152 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
5153 eval '$MV "$nlist"T "$nlist"'
5157 if test -n "$export_symbols_regex"; then
5159 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
5160 eval '$MV "$nlist"T "$nlist"'
5164 # Prepare the list of exported symbols
5165 if test -z "$export_symbols"; then
5166 export_symbols=$output_objdir/$outputname.exp
5169 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
5171 *cygwin* | *mingw* | *cegcc* )
5172 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5173 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
5179 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
5180 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
5181 eval '$MV "$nlist"T "$nlist"'
5183 *cygwin* | *mingw* | *cegcc* )
5184 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5185 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
5192 for dlprefile in $dlprefiles; do
5193 func_verbose "extracting global C symbols from '$dlprefile'"
5194 func_basename "$dlprefile"
5195 name=$func_basename_result
5197 *cygwin* | *mingw* | *cegcc* )
5198 # if an import library, we need to obtain dlname
5199 if func_win32_import_lib_p "$dlprefile"; then
5200 func_tr_sh "$dlprefile"
5201 eval "curr_lafile=\$libfile_$func_tr_sh_result"
5202 dlprefile_dlbasename=
5203 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
5204 # Use subshell, to avoid clobbering current variable values
5205 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
5206 if test -n "$dlprefile_dlname"; then
5207 func_basename "$dlprefile_dlname"
5208 dlprefile_dlbasename=$func_basename_result
5210 # no lafile. user explicitly requested -dlpreopen <import library>.
5211 $sharedlib_from_linklib_cmd "$dlprefile"
5212 dlprefile_dlbasename=$sharedlib_from_linklib_result
5216 if test -n "$dlprefile_dlbasename"; then
5217 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
5219 func_warning "Could not compute DLL name from $name"
5220 eval '$ECHO ": $name " >> "$nlist"'
5222 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5223 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
5224 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
5226 else # not an import lib
5228 eval '$ECHO ": $name " >> "$nlist"'
5229 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5230 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5236 eval '$ECHO ": $name " >> "$nlist"'
5237 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5238 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5245 # Make sure we have at least an empty file.
5246 test -f "$nlist" || : > "$nlist"
5248 if test -n "$exclude_expsyms"; then
5249 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
5250 $MV "$nlist"T "$nlist"
5253 # Try sorting and uniquifying the output.
5254 if $GREP -v "^: " < "$nlist" |
5255 if sort -k 3 </dev/null >/dev/null 2>&1; then
5260 uniq > "$nlist"S; then
5263 $GREP -v "^: " < "$nlist" > "$nlist"S
5266 if test -f "$nlist"S; then
5267 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
5269 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
5272 func_show_eval '$RM "${nlist}I"'
5273 if test -n "$global_symbol_to_import"; then
5274 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
5277 echo >> "$output_objdir/$my_dlsyms" "\
5279 /* The mapping between symbol names and symbols. */
5284 extern LT_DLSYM_CONST lt_dlsymlist
5285 lt_${my_prefix}_LTX_preloaded_symbols[];\
5288 if test -s "$nlist"I; then
5289 echo >> "$output_objdir/$my_dlsyms" "\
5290 static void lt_syminit(void)
5292 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
5293 for (; symbol->name; ++symbol)
5295 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
5296 echo >> "$output_objdir/$my_dlsyms" "\
5300 echo >> "$output_objdir/$my_dlsyms" "\
5301 LT_DLSYM_CONST lt_dlsymlist
5302 lt_${my_prefix}_LTX_preloaded_symbols[] =
5303 { {\"$my_originator\", (void *) 0},"
5305 if test -s "$nlist"I; then
5306 echo >> "$output_objdir/$my_dlsyms" "\
5307 {\"@INIT@\", (void *) <_syminit},"
5310 case $need_lib_prefix in
5312 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
5315 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
5318 echo >> "$output_objdir/$my_dlsyms" "\
5322 /* This works around a problem in FreeBSD linker */
5323 #ifdef FREEBSD_WORKAROUND
5324 static const void *lt_preloaded_setup() {
5325 return lt_${my_prefix}_LTX_preloaded_symbols;
5335 pic_flag_for_symtable=
5336 case "$compile_command " in
5340 # compiling the symbol table file with pic_flag works around
5341 # a FreeBSD bug that causes programs to crash when -lm is
5342 # linked before any other PIC object. But we must not use
5343 # pic_flag when linking with -static. The problem exists in
5344 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
5345 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
5346 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
5348 pic_flag_for_symtable=" $pic_flag" ;;
5350 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
5356 for arg in $LTCFLAGS; do
5358 -pie | -fpie | -fPIE) ;;
5359 *) func_append symtab_cflags " $arg" ;;
5363 # Now compile the dynamic symbol file.
5364 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
5366 # Clean up the generated files.
5367 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
5369 # Transform the symbol file into the correct name.
5370 symfileobj=$output_objdir/${my_outputname}S.$objext
5372 *cygwin* | *mingw* | *cegcc* )
5373 if test -f "$output_objdir/$my_outputname.def"; then
5374 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5375 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5377 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5378 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5382 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5383 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5388 func_fatal_error "unknown suffix for '$my_dlsyms'"
5392 # We keep going just in case the user didn't refer to
5393 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
5394 # really was required.
5396 # Nullify the symbol file.
5397 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
5398 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
5402 # func_cygming_gnu_implib_p ARG
5403 # This predicate returns with zero status (TRUE) if
5404 # ARG is a GNU/binutils-style import library. Returns
5405 # with nonzero status (FALSE) otherwise.
5406 func_cygming_gnu_implib_p ()
5410 func_to_tool_file "$1" func_convert_file_msys_to_w32
5411 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)$'`
5412 test -n "$func_cygming_gnu_implib_tmp"
5415 # func_cygming_ms_implib_p ARG
5416 # This predicate returns with zero status (TRUE) if
5417 # ARG is an MS-style import library. Returns
5418 # with nonzero status (FALSE) otherwise.
5419 func_cygming_ms_implib_p ()
5423 func_to_tool_file "$1" func_convert_file_msys_to_w32
5424 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
5425 test -n "$func_cygming_ms_implib_tmp"
5428 # func_win32_libid arg
5429 # return the library type of file 'arg'
5431 # Need a lot of goo to handle *both* DLLs and import libs
5432 # Has to be a shell function in order to 'eat' the argument
5433 # that is supplied when $file_magic_command is called.
5434 # Despite the name, also deal with 64 bit binaries.
5439 win32_libid_type=unknown
5440 win32_fileres=`file -L $1 2>/dev/null`
5441 case $win32_fileres in
5442 *ar\ archive\ import\ library*) # definitely import
5443 win32_libid_type="x86 archive import"
5445 *ar\ archive*) # could be an import, or static
5446 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
5447 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
5448 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
5449 case $nm_interface in
5451 if func_cygming_ms_implib_p "$1" ||
5452 func_cygming_gnu_implib_p "$1"
5460 func_to_tool_file "$1" func_convert_file_msys_to_w32
5461 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
5472 case $win32_nmres in
5473 import*) win32_libid_type="x86 archive import";;
5474 *) win32_libid_type="x86 archive static";;
5479 win32_libid_type="x86 DLL"
5481 *executable*) # but shell scripts are "executable" too...
5482 case $win32_fileres in
5483 *MS\ Windows\ PE\ Intel*)
5484 win32_libid_type="x86 DLL"
5489 $ECHO "$win32_libid_type"
5492 # func_cygming_dll_for_implib ARG
5494 # Platform-specific function to extract the
5495 # name of the DLL associated with the specified
5496 # import library ARG.
5497 # Invoked by eval'ing the libtool variable
5498 # $sharedlib_from_linklib_cmd
5499 # Result is available in the variable
5500 # $sharedlib_from_linklib_result
5501 func_cygming_dll_for_implib ()
5505 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
5508 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
5510 # The is the core of a fallback implementation of a
5511 # platform-specific function to extract the name of the
5512 # DLL associated with the specified import library LIBNAME.
5514 # SECTION_NAME is either .idata$6 or .idata$7, depending
5515 # on the platform and compiler that created the implib.
5517 # Echos the name of the DLL associated with the
5518 # specified import library.
5519 func_cygming_dll_for_implib_fallback_core ()
5523 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5524 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5525 $SED '/^Contents of section '"$match_literal"':/{
5526 # Place marker at beginning of archive member dllname section
5531 # These lines can sometimes be longer than 43 characters, but
5532 # are always uninteresting
5533 /:[ ]*file format pe[i]\{,1\}-/d
5534 /^In archive [^:]*:/d
5535 # Ensure marker is printed
5537 # Remove all lines with less than 43 characters
5539 # From remaining lines, remove first 43 characters
5542 # Join marker and all lines until next marker into a single line
5543 /^====MARK====/ b para
5552 # Remove trailing dots and whitespace
5556 # we now have a list, one entry per line, of the stringified
5557 # contents of the appropriate section of all members of the
5558 # archive that possess that section. Heuristic: eliminate
5559 # all those that have a first or second character that is
5560 # a '.' (that is, objdump's representation of an unprintable
5561 # character.) This should work for all archives with less than
5562 # 0x302f exports -- but will fail for DLLs whose name actually
5563 # begins with a literal '.' or a single character followed by
5566 # Of those that remain, print the first one.
5567 $SED -e '/^\./d;/^.\./d;q'
5570 # func_cygming_dll_for_implib_fallback ARG
5571 # Platform-specific function to extract the
5572 # name of the DLL associated with the specified
5573 # import library ARG.
5575 # This fallback implementation is for use when $DLLTOOL
5576 # does not support the --identify-strict option.
5577 # Invoked by eval'ing the libtool variable
5578 # $sharedlib_from_linklib_cmd
5579 # Result is available in the variable
5580 # $sharedlib_from_linklib_result
5581 func_cygming_dll_for_implib_fallback ()
5585 if func_cygming_gnu_implib_p "$1"; then
5586 # binutils import library
5587 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5588 elif func_cygming_ms_implib_p "$1"; then
5589 # ms-generated import library
5590 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5593 sharedlib_from_linklib_result=
5598 # func_extract_an_archive dir oldlib
5599 func_extract_an_archive ()
5603 f_ex_an_ar_dir=$1; shift
5604 f_ex_an_ar_oldlib=$1
5605 if test yes = "$lock_old_archive_extraction"; then
5606 lockfile=$f_ex_an_ar_oldlib.lock
5607 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5608 func_echo "Waiting for $lockfile to be removed"
5612 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5613 'stat=$?; rm -f "$lockfile"; exit $stat'
5614 if test yes = "$lock_old_archive_extraction"; then
5615 $opt_dry_run || rm -f "$lockfile"
5617 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5620 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5625 # func_extract_archives gentop oldlib ...
5626 func_extract_archives ()
5631 my_oldlibs=${1+"$@"}
5637 for my_xlib in $my_oldlibs; do
5638 # Extract the objects.
5640 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5641 *) my_xabs=`pwd`"/$my_xlib" ;;
5643 func_basename "$my_xlib"
5644 my_xlib=$func_basename_result
5647 case " $extracted_archives " in
5649 func_arith $extracted_serial + 1
5650 extracted_serial=$func_arith_result
5651 my_xlib_u=lt$extracted_serial-$my_xlib ;;
5655 extracted_archives="$extracted_archives $my_xlib_u"
5656 my_xdir=$my_gentop/$my_xlib_u
5658 func_mkdir_p "$my_xdir"
5662 func_verbose "Extracting $my_xabs"
5663 # Do not bother doing anything if just a dry run
5665 darwin_orig_dir=`pwd`
5666 cd $my_xdir || exit $?
5667 darwin_archive=$my_xabs
5669 func_basename "$darwin_archive"
5670 darwin_base_archive=$func_basename_result
5671 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5672 if test -n "$darwin_arches"; then
5673 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5675 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5676 for darwin_arch in $darwin_arches; do
5677 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5678 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5679 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5680 func_extract_an_archive "`pwd`" "$darwin_base_archive"
5682 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5683 done # $darwin_arches
5684 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5685 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5688 for darwin_file in $darwin_filelist; do
5689 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5690 $LIPO -create -output "$darwin_file" $darwin_files
5691 done # $darwin_filelist
5693 cd "$darwin_orig_dir"
5696 func_extract_an_archive "$my_xdir" "$my_xabs"
5701 func_extract_an_archive "$my_xdir" "$my_xabs"
5704 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5707 func_extract_archives_result=$my_oldobjs
5711 # func_emit_wrapper [arg=no]
5713 # Emit a libtool wrapper script on stdout.
5714 # Don't directly open a file because we may want to
5715 # incorporate the script contents within a cygwin/mingw
5716 # wrapper executable. Must ONLY be called from within
5717 # func_mode_link because it depends on a number of variables
5720 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5721 # variable will take. If 'yes', then the emitted script
5722 # will assume that the directory where it is stored is
5723 # the $objdir directory. This is a cygwin/mingw-specific
5725 func_emit_wrapper ()
5727 func_emit_wrapper_arg1=${1-no}
5732 # $output - temporary wrapper script for $objdir/$outputname
5733 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5735 # The $output program cannot be directly executed until all the libtool
5736 # libraries that it depends on are installed.
5738 # This wrapper script should never be moved out of the build directory.
5739 # If it is, it will not operate correctly.
5741 # Sed substitution that helps us do robust quoting. It backslashifies
5742 # metacharacters that are still active within double-quoted strings.
5743 sed_quote_subst='$sed_quote_subst'
5745 # Be Bourne compatible
5746 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5749 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5750 # is contrary to our usage. Disable this feature.
5751 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5752 setopt NO_GLOB_SUBST
5754 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5756 BIN_SH=xpg4; export BIN_SH # for Tru64
5757 DUALCASE=1; export DUALCASE # for MKS sh
5759 # The HP-UX ksh and POSIX shell print the target directory to stdout
5761 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5763 relink_command=\"$relink_command\"
5765 # This environment variable determines our operation mode.
5766 if test \"\$libtool_install_magic\" = \"$magic\"; then
5767 # install mode needs the following variables:
5768 generated_by_libtool_version='$macro_version'
5769 notinst_deplibs='$notinst_deplibs'
5771 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5772 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5775 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
5778 # A function that is used when there is no print builtin or printf.
5779 func_fallback_echo ()
5781 eval 'cat <<_LTECHO_EOF
5788 # Very basic option parsing. These options are (a) specific to
5789 # the libtool wrapper, (b) are identical between the wrapper
5790 # /script/ and the wrapper /executable/ that is used only on
5791 # windows platforms, and (c) all begin with the string "--lt-"
5792 # (application programs are unlikely to have options that match
5795 # There are only two supported options: --lt-debug and
5796 # --lt-dump-script. There is, deliberately, no --lt-help.
5798 # The first argument to this parsing function should be the
5799 # script's $0 value, followed by "$@".
5801 func_parse_lt_options ()
5807 case \"\$lt_opt\" in
5808 --lt-debug) lt_option_debug=1 ;;
5810 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5811 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5812 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5813 cat \"\$lt_dump_D/\$lt_dump_F\"
5817 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5823 # Print the debug banner immediately:
5824 if test -n \"\$lt_option_debug\"; then
5825 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5829 # Used when --lt-debug. Prints its arguments to stdout
5830 # (redirection is the responsibility of the caller)
5831 func_lt_dump_args ()
5836 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5837 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5841 # Core function for launching the target application
5842 func_exec_program_core ()
5846 # Backslashes separate directories on plain windows
5847 *-*-mingw | *-*-os2* | *-cegcc*)
5849 if test -n \"\$lt_option_debug\"; then
5850 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5851 func_lt_dump_args \${1+\"\$@\"} 1>&2
5853 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5859 if test -n \"\$lt_option_debug\"; then
5860 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5861 func_lt_dump_args \${1+\"\$@\"} 1>&2
5863 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5868 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5872 # A function to encapsulate launching the target application
5873 # Strips options in the --lt-* namespace from \$@ and
5874 # launches target application with the remaining arguments.
5875 func_exec_program ()
5883 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5888 func_exec_program_core \${1+\"\$@\"}
5892 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5894 # Find the directory that this script lives in.
5895 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5896 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5898 # Follow symbolic links until we get to the real thisdir.
5899 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5900 while test -n \"\$file\"; do
5901 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5903 # If there was a directory component, then change thisdir.
5904 if test \"x\$destdir\" != \"x\$file\"; then
5905 case \"\$destdir\" in
5906 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5907 *) thisdir=\"\$thisdir/\$destdir\" ;;
5911 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5912 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5915 # Usually 'no', except on cygwin/mingw when embedded into
5917 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5918 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5919 # special case for '.'
5920 if test \"\$thisdir\" = \".\"; then
5923 # remove .libs from thisdir
5924 case \"\$thisdir\" in
5925 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5926 $objdir ) thisdir=. ;;
5930 # Try to get the absolute directory name.
5931 absdir=\`cd \"\$thisdir\" && pwd\`
5932 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5935 if test yes = "$fast_install"; then
5937 program=lt-'$outputname'$exeext
5938 progdir=\"\$thisdir/$objdir\"
5940 if test ! -f \"\$progdir/\$program\" ||
5941 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5942 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5944 file=\"\$\$-\$program\"
5946 if test ! -d \"\$progdir\"; then
5947 $MKDIR \"\$progdir\"
5949 $RM \"\$progdir/\$file\"
5954 # relink executable if necessary
5955 if test -n \"\$relink_command\"; then
5956 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5958 \$ECHO \"\$relink_command_output\" >&2
5959 $RM \"\$progdir/\$file\"
5964 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5965 { $RM \"\$progdir/\$program\";
5966 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5967 $RM \"\$progdir/\$file\"
5971 program='$outputname'
5972 progdir=\"\$thisdir/$objdir\"
5978 if test -f \"\$progdir/\$program\"; then"
5980 # fixup the dll searchpath if we need to.
5982 # Fix the DLL searchpath if we need to. Do this before prepending
5983 # to shlibpath, because on Windows, both are PATH and uninstalled
5984 # libraries must come first.
5985 if test -n "$dllsearchpath"; then
5987 # Add the dll search path components to the executable PATH
5988 PATH=$dllsearchpath:\$PATH
5992 # Export our shlibpath_var if we have one.
5993 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5995 # Add our own library path to $shlibpath_var
5996 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5998 # Some systems cannot cope with colon-terminated $shlibpath_var
5999 # The second colon is a workaround for a bug in BeOS R4 sed
6000 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
6002 export $shlibpath_var
6007 if test \"\$libtool_execute_magic\" != \"$magic\"; then
6008 # Run the actual program with our arguments.
6009 func_exec_program \${1+\"\$@\"}
6012 # The program doesn't exist.
6013 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
6014 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
6015 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
6023 # func_emit_cwrapperexe_src
6024 # emit the source code for a wrapper executable on stdout
6025 # Must ONLY be called from within func_mode_link because
6026 # it depends on a number of variable set therein.
6027 func_emit_cwrapperexe_src ()
6031 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
6032 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
6034 The $output program cannot be directly executed until all the libtool
6035 libraries that it depends on are installed.
6037 This wrapper executable should never be moved out of the build directory.
6038 If it is, it will not operate correctly.
6043 # define _CRT_SECURE_NO_DEPRECATE 1
6048 # include <direct.h>
6049 # include <process.h>
6052 # include <unistd.h>
6053 # include <stdint.h>
6065 #include <sys/stat.h>
6067 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
6069 /* declarations of non-ANSI functions */
6070 #if defined __MINGW32__
6071 # ifdef __STRICT_ANSI__
6072 int _putenv (const char *);
6074 #elif defined __CYGWIN__
6075 # ifdef __STRICT_ANSI__
6076 char *realpath (const char *, char *);
6077 int putenv (char *);
6078 int setenv (const char *, const char *, int);
6080 /* #elif defined other_platform || defined ... */
6083 /* portability defines, excluding path handling macros */
6084 #if defined _MSC_VER
6085 # define setmode _setmode
6087 # define chmod _chmod
6088 # define getcwd _getcwd
6089 # define putenv _putenv
6090 # define S_IXUSR _S_IEXEC
6091 #elif defined __MINGW32__
6092 # define setmode _setmode
6094 # define chmod _chmod
6095 # define getcwd _getcwd
6096 # define putenv _putenv
6097 #elif defined __CYGWIN__
6098 # define HAVE_SETENV
6099 # define FOPEN_WB "wb"
6100 /* #elif defined other platforms ... */
6103 #if defined PATH_MAX
6104 # define LT_PATHMAX PATH_MAX
6105 #elif defined MAXPATHLEN
6106 # define LT_PATHMAX MAXPATHLEN
6108 # define LT_PATHMAX 1024
6118 /* path handling portability macros */
6119 #ifndef DIR_SEPARATOR
6120 # define DIR_SEPARATOR '/'
6121 # define PATH_SEPARATOR ':'
6124 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
6126 # define HAVE_DOS_BASED_FILE_SYSTEM
6127 # define FOPEN_WB "wb"
6128 # ifndef DIR_SEPARATOR_2
6129 # define DIR_SEPARATOR_2 '\\'
6131 # ifndef PATH_SEPARATOR_2
6132 # define PATH_SEPARATOR_2 ';'
6136 #ifndef DIR_SEPARATOR_2
6137 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
6138 #else /* DIR_SEPARATOR_2 */
6139 # define IS_DIR_SEPARATOR(ch) \
6140 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
6141 #endif /* DIR_SEPARATOR_2 */
6143 #ifndef PATH_SEPARATOR_2
6144 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
6145 #else /* PATH_SEPARATOR_2 */
6146 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
6147 #endif /* PATH_SEPARATOR_2 */
6150 # define FOPEN_WB "w"
6153 # define _O_BINARY 0
6156 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
6157 #define XFREE(stale) do { \
6158 if (stale) { free (stale); stale = 0; } \
6161 #if defined LT_DEBUGWRAPPER
6162 static int lt_debug = 1;
6164 static int lt_debug = 0;
6167 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
6169 void *xmalloc (size_t num);
6170 char *xstrdup (const char *string);
6171 const char *base_name (const char *name);
6172 char *find_executable (const char *wrapper);
6173 char *chase_symlinks (const char *pathspec);
6174 int make_executable (const char *path);
6175 int check_executable (const char *path);
6176 char *strendzap (char *str, const char *pat);
6177 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
6178 void lt_fatal (const char *file, int line, const char *message, ...);
6179 static const char *nonnull (const char *s);
6180 static const char *nonempty (const char *s);
6181 void lt_setenv (const char *name, const char *value);
6182 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
6183 void lt_update_exe_path (const char *name, const char *value);
6184 void lt_update_lib_path (const char *name, const char *value);
6185 char **prepare_spawn (char **argv);
6186 void lt_dump_script (FILE *f);
6190 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
6191 # define externally_visible volatile
6193 # define externally_visible __attribute__((externally_visible)) volatile
6195 externally_visible const char * MAGIC_EXE = "$magic_exe";
6196 const char * LIB_PATH_VARNAME = "$shlibpath_var";
6199 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
6200 func_to_host_path "$temp_rpath"
6202 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
6206 const char * LIB_PATH_VALUE = "";
6210 if test -n "$dllsearchpath"; then
6211 func_to_host_path "$dllsearchpath:"
6213 const char * EXE_PATH_VARNAME = "PATH";
6214 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
6218 const char * EXE_PATH_VARNAME = "";
6219 const char * EXE_PATH_VALUE = "";
6223 if test yes = "$fast_install"; then
6225 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
6229 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
6236 #define LTWRAPPER_OPTION_PREFIX "--lt-"
6238 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
6239 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
6240 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
6243 main (int argc, char *argv[])
6248 char *actual_cwrapper_path;
6249 char *actual_cwrapper_name;
6256 program_name = (char *) xstrdup (base_name (argv[0]));
6257 newargz = XMALLOC (char *, (size_t) argc + 1);
6259 /* very simple arg parsing; don't want to rely on getopt
6260 * also, copy all non cwrapper options to newargz, except
6261 * argz[0], which is handled differently
6264 for (i = 1; i < argc; i++)
6266 if (STREQ (argv[i], dumpscript_opt))
6270 *mingw* | *cygwin* )
6271 # make stdout use "unix" line endings
6272 echo " setmode(1,_O_BINARY);"
6277 lt_dump_script (stdout);
6280 if (STREQ (argv[i], debug_opt))
6285 if (STREQ (argv[i], ltwrapper_option_prefix))
6287 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
6288 namespace, but it is not one of the ones we know about and
6289 have already dealt with, above (inluding dump-script), then
6290 report an error. Otherwise, targets might begin to believe
6291 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
6292 namespace. The first time any user complains about this, we'll
6293 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
6294 or a configure.ac-settable value.
6296 lt_fatal (__FILE__, __LINE__,
6297 "unrecognized %s option: '%s'",
6298 ltwrapper_option_prefix, argv[i]);
6301 newargz[++newargc] = xstrdup (argv[i]);
6303 newargz[++newargc] = NULL;
6307 /* The GNU banner must be the first non-error debug message */
6308 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
6311 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
6312 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
6314 tmp_pathspec = find_executable (argv[0]);
6315 if (tmp_pathspec == NULL)
6316 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
6317 lt_debugprintf (__FILE__, __LINE__,
6318 "(main) found exe (before symlink chase) at: %s\n",
6321 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
6322 lt_debugprintf (__FILE__, __LINE__,
6323 "(main) found exe (after symlink chase) at: %s\n",
6324 actual_cwrapper_path);
6325 XFREE (tmp_pathspec);
6327 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
6328 strendzap (actual_cwrapper_path, actual_cwrapper_name);
6330 /* wrapper name transforms */
6331 strendzap (actual_cwrapper_name, ".exe");
6332 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
6333 XFREE (actual_cwrapper_name);
6334 actual_cwrapper_name = tmp_pathspec;
6337 /* target_name transforms -- use actual target program name; might have lt- prefix */
6338 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
6339 strendzap (target_name, ".exe");
6340 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
6341 XFREE (target_name);
6342 target_name = tmp_pathspec;
6345 lt_debugprintf (__FILE__, __LINE__,
6346 "(main) libtool target name: %s\n",
6352 XMALLOC (char, (strlen (actual_cwrapper_path) +
6353 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
6354 strcpy (newargz[0], actual_cwrapper_path);
6355 strcat (newargz[0], "$objdir");
6356 strcat (newargz[0], "/");
6360 /* stop here, and copy so we don't have to do this twice */
6361 tmp_pathspec = xstrdup (newargz[0]);
6363 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
6364 strcat (newargz[0], actual_cwrapper_name);
6366 /* DO want the lt- prefix here if it exists, so use target_name */
6367 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
6368 XFREE (tmp_pathspec);
6369 tmp_pathspec = NULL;
6377 while ((p = strchr (newargz[0], '\\')) != NULL)
6381 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
6391 XFREE (target_name);
6392 XFREE (actual_cwrapper_path);
6393 XFREE (actual_cwrapper_name);
6395 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
6396 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
6397 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
6398 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
6399 because on Windows, both *_VARNAMEs are PATH but uninstalled
6400 libraries must come first. */
6401 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
6402 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
6404 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
6405 nonnull (lt_argv_zero));
6406 for (i = 0; i < newargc; i++)
6408 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
6409 i, nonnull (newargz[i]));
6417 /* execv doesn't actually work on mingw as expected on unix */
6418 newargz = prepare_spawn (newargz);
6419 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
6422 /* failed to start process */
6423 lt_debugprintf (__FILE__, __LINE__,
6424 "(main) failed to launch target \"%s\": %s\n",
6425 lt_argv_zero, nonnull (strerror (errno)));
6433 execv (lt_argv_zero, newargz);
6434 return rval; /* =127, but avoids unused variable warning */
6443 xmalloc (size_t num)
6445 void *p = (void *) malloc (num);
6447 lt_fatal (__FILE__, __LINE__, "memory exhausted");
6453 xstrdup (const char *string)
6455 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
6460 base_name (const char *name)
6464 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6465 /* Skip over the disk name in MSDOS pathnames. */
6466 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
6470 for (base = name; *name; name++)
6471 if (IS_DIR_SEPARATOR (*name))
6477 check_executable (const char *path)
6481 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
6483 if ((!path) || (!*path))
6486 if ((stat (path, &st) >= 0)
6487 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
6494 make_executable (const char *path)
6499 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
6501 if ((!path) || (!*path))
6504 if (stat (path, &st) >= 0)
6506 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
6511 /* Searches for the full path of the wrapper. Returns
6512 newly allocated full path name if found, NULL otherwise
6513 Does not chase symlinks, even on platforms that support them.
6516 find_executable (const char *wrapper)
6521 /* static buffer for getcwd */
6522 char tmp[LT_PATHMAX + 1];
6526 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
6527 nonempty (wrapper));
6529 if ((wrapper == NULL) || (*wrapper == '\0'))
6532 /* Absolute path? */
6533 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6534 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
6536 concat_name = xstrdup (wrapper);
6537 if (check_executable (concat_name))
6539 XFREE (concat_name);
6544 if (IS_DIR_SEPARATOR (wrapper[0]))
6546 concat_name = xstrdup (wrapper);
6547 if (check_executable (concat_name))
6549 XFREE (concat_name);
6551 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6555 for (p = wrapper; *p; p++)
6563 /* no slashes; search PATH */
6564 const char *path = getenv ("PATH");
6567 for (p = path; *p; p = p_next)
6571 for (q = p; *q; q++)
6572 if (IS_PATH_SEPARATOR (*q))
6574 p_len = (size_t) (q - p);
6575 p_next = (*q == '\0' ? q : q + 1);
6578 /* empty path: current directory */
6579 if (getcwd (tmp, LT_PATHMAX) == NULL)
6580 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6581 nonnull (strerror (errno)));
6582 tmp_len = strlen (tmp);
6584 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6585 memcpy (concat_name, tmp, tmp_len);
6586 concat_name[tmp_len] = '/';
6587 strcpy (concat_name + tmp_len + 1, wrapper);
6592 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6593 memcpy (concat_name, p, p_len);
6594 concat_name[p_len] = '/';
6595 strcpy (concat_name + p_len + 1, wrapper);
6597 if (check_executable (concat_name))
6599 XFREE (concat_name);
6602 /* not found in PATH; assume curdir */
6604 /* Relative path | not found in path: prepend cwd */
6605 if (getcwd (tmp, LT_PATHMAX) == NULL)
6606 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6607 nonnull (strerror (errno)));
6608 tmp_len = strlen (tmp);
6609 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6610 memcpy (concat_name, tmp, tmp_len);
6611 concat_name[tmp_len] = '/';
6612 strcpy (concat_name + tmp_len + 1, wrapper);
6614 if (check_executable (concat_name))
6616 XFREE (concat_name);
6621 chase_symlinks (const char *pathspec)
6624 return xstrdup (pathspec);
6626 char buf[LT_PATHMAX];
6628 char *tmp_pathspec = xstrdup (pathspec);
6630 int has_symlinks = 0;
6631 while (strlen (tmp_pathspec) && !has_symlinks)
6633 lt_debugprintf (__FILE__, __LINE__,
6634 "checking path component for symlinks: %s\n",
6636 if (lstat (tmp_pathspec, &s) == 0)
6638 if (S_ISLNK (s.st_mode) != 0)
6644 /* search backwards for last DIR_SEPARATOR */
6645 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6646 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6648 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6650 /* no more DIR_SEPARATORS left */
6657 lt_fatal (__FILE__, __LINE__,
6658 "error accessing file \"%s\": %s",
6659 tmp_pathspec, nonnull (strerror (errno)));
6662 XFREE (tmp_pathspec);
6666 return xstrdup (pathspec);
6669 tmp_pathspec = realpath (pathspec, buf);
6670 if (tmp_pathspec == 0)
6672 lt_fatal (__FILE__, __LINE__,
6673 "could not follow symlinks for %s", pathspec);
6675 return xstrdup (tmp_pathspec);
6680 strendzap (char *str, const char *pat)
6684 assert (str != NULL);
6685 assert (pat != NULL);
6688 patlen = strlen (pat);
6692 str += len - patlen;
6693 if (STREQ (str, pat))
6700 lt_debugprintf (const char *file, int line, const char *fmt, ...)
6705 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6706 va_start (args, fmt);
6707 (void) vfprintf (stderr, fmt, args);
6713 lt_error_core (int exit_status, const char *file,
6714 int line, const char *mode,
6715 const char *message, va_list ap)
6717 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6718 vfprintf (stderr, message, ap);
6719 fprintf (stderr, ".\n");
6721 if (exit_status >= 0)
6726 lt_fatal (const char *file, int line, const char *message, ...)
6729 va_start (ap, message);
6730 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6735 nonnull (const char *s)
6737 return s ? s : "(null)";
6741 nonempty (const char *s)
6743 return (s && !*s) ? "(empty)" : nonnull (s);
6747 lt_setenv (const char *name, const char *value)
6749 lt_debugprintf (__FILE__, __LINE__,
6750 "(lt_setenv) setting '%s' to '%s'\n",
6751 nonnull (name), nonnull (value));
6754 /* always make a copy, for consistency with !HAVE_SETENV */
6755 char *str = xstrdup (value);
6756 setenv (name, str, 1);
6758 size_t len = strlen (name) + 1 + strlen (value) + 1;
6759 char *str = XMALLOC (char, len);
6760 sprintf (str, "%s=%s", name, value);
6761 if (putenv (str) != EXIT_SUCCESS)
6770 lt_extend_str (const char *orig_value, const char *add, int to_end)
6773 if (orig_value && *orig_value)
6775 size_t orig_value_len = strlen (orig_value);
6776 size_t add_len = strlen (add);
6777 new_value = XMALLOC (char, add_len + orig_value_len + 1);
6780 strcpy (new_value, orig_value);
6781 strcpy (new_value + orig_value_len, add);
6785 strcpy (new_value, add);
6786 strcpy (new_value + add_len, orig_value);
6791 new_value = xstrdup (add);
6797 lt_update_exe_path (const char *name, const char *value)
6799 lt_debugprintf (__FILE__, __LINE__,
6800 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6801 nonnull (name), nonnull (value));
6803 if (name && *name && value && *value)
6805 char *new_value = lt_extend_str (getenv (name), value, 0);
6806 /* some systems can't cope with a ':'-terminated path #' */
6807 size_t len = strlen (new_value);
6808 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
6810 new_value[--len] = '\0';
6812 lt_setenv (name, new_value);
6818 lt_update_lib_path (const char *name, const char *value)
6820 lt_debugprintf (__FILE__, __LINE__,
6821 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6822 nonnull (name), nonnull (value));
6824 if (name && *name && value && *value)
6826 char *new_value = lt_extend_str (getenv (name), value, 0);
6827 lt_setenv (name, new_value);
6837 /* Prepares an argument vector before calling spawn().
6838 Note that spawn() does not by itself call the command interpreter
6839 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6840 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6842 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6843 }) ? "cmd.exe" : "command.com").
6844 Instead it simply concatenates the arguments, separated by ' ', and calls
6845 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6846 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6848 - Space and tab are interpreted as delimiters. They are not treated as
6849 delimiters if they are surrounded by double quotes: "...".
6850 - Unescaped double quotes are removed from the input. Their only effect is
6851 that within double quotes, space and tab are treated like normal
6853 - Backslashes not followed by double quotes are not special.
6854 - But 2*n+1 backslashes followed by a double quote become
6855 n backslashes followed by a double quote (n >= 0):
6860 #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"
6861 #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"
6863 prepare_spawn (char **argv)
6869 /* Count number of arguments. */
6870 for (argc = 0; argv[argc] != NULL; argc++)
6873 /* Allocate new argument vector. */
6874 new_argv = XMALLOC (char *, argc + 1);
6876 /* Put quoted arguments into the new argument vector. */
6877 for (i = 0; i < argc; i++)
6879 const char *string = argv[i];
6881 if (string[0] == '\0')
6882 new_argv[i] = xstrdup ("\"\"");
6883 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6885 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6887 unsigned int backslashes;
6889 char *quoted_string;
6896 for (s = string; *s != '\0'; s++)
6900 length += backslashes + 1;
6908 length += backslashes + 1;
6910 quoted_string = XMALLOC (char, length + 1);
6916 for (s = string; *s != '\0'; s++)
6922 for (j = backslashes + 1; j > 0; j--)
6934 for (j = backslashes; j > 0; j--)
6940 new_argv[i] = quoted_string;
6943 new_argv[i] = (char *) string;
6945 new_argv[argc] = NULL;
6954 void lt_dump_script (FILE* f)
6957 func_emit_wrapper yes |
6959 s/^\(.\{79\}\)\(..*\)/\1\
6964 s/\([^\n]*\).*/ fputs ("\1", f);/p
6971 # end: func_emit_cwrapperexe_src
6973 # func_win32_import_lib_p ARG
6974 # True if ARG is an import lib, as indicated by $file_magic_cmd
6975 func_win32_import_lib_p ()
6979 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6985 # func_suncc_cstd_abi
6986 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6987 # Several compiler flags select an ABI that is incompatible with the
6988 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
6989 func_suncc_cstd_abi ()
6993 case " $compile_command " in
6994 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6995 suncc_use_cstd_abi=no
6998 suncc_use_cstd_abi=yes
7003 # func_mode_link arg...
7009 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7010 # It is impossible to link a dll without this setting, and
7011 # we shouldn't force the makefile maintainer to figure out
7012 # what system we are compiling for in order to pass an extra
7013 # flag for every libtool invocation.
7014 # allow_undefined=no
7016 # FIXME: Unfortunately, there are problems with the above when trying
7017 # to make a dll that has undefined symbols, in which case not
7018 # even a static library is built. For now, we need to specify
7019 # -no-undefined on the libtool link line when we can be certain
7020 # that all symbols are satisfied, otherwise we get a static library.
7027 libtool_args=$nonopt
7028 base_compile="$nonopt $@"
7029 compile_command=$nonopt
7030 finalize_command=$nonopt
7043 lib_search_path=`pwd`
7045 new_inherited_linker_flags=
7054 export_symbols_regex=
7063 precious_files_regex=
7064 prefer_static_libs=no
7077 single_module=$wl-single_module
7078 func_infer_tag $base_compile
7080 # We need to know -static, to get the right output filenames.
7085 test yes != "$build_libtool_libs" \
7086 && func_fatal_configuration "cannot build a shared library"
7090 -all-static | -static | -static-libtool-libs)
7093 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
7094 func_warning "complete static linking is impossible in this configuration"
7096 if test -n "$link_static_flag"; then
7097 dlopen_self=$dlopen_self_static
7099 prefer_static_libs=yes
7102 if test -z "$pic_flag" && test -n "$link_static_flag"; then
7103 dlopen_self=$dlopen_self_static
7105 prefer_static_libs=built
7107 -static-libtool-libs)
7108 if test -z "$pic_flag" && test -n "$link_static_flag"; then
7109 dlopen_self=$dlopen_self_static
7111 prefer_static_libs=yes
7114 build_libtool_libs=no
7121 # See if our shared archives depend on static archives.
7122 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
7124 # Go through the arguments, transforming them on the way.
7125 while test "$#" -gt 0; do
7128 func_quote_for_eval "$arg"
7129 qarg=$func_quote_for_eval_unquoted_result
7130 func_append libtool_args " $func_quote_for_eval_result"
7132 # If the previous option needs an argument, assign it.
7133 if test -n "$prev"; then
7136 func_append compile_command " @OUTPUT@"
7137 func_append finalize_command " @OUTPUT@"
7149 # Add the symbol object into the linking commands.
7150 func_append compile_command " @SYMFILE@"
7151 func_append finalize_command " @SYMFILE@"
7155 *.la | *.lo) ;; # We handle these cases below.
7157 if test no = "$dlself"; then
7165 if test dlprefiles = "$prev"; then
7167 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
7177 if test dlfiles = "$prev"; then
7178 func_append dlfiles " $arg"
7180 func_append dlprefiles " $arg"
7190 || func_fatal_error "symbol file '$arg' does not exist"
7195 export_symbols_regex=$arg
7203 *" $qarg.ltframework "*) ;;
7204 *) func_append deplibs " $qarg.ltframework" # this is fixed later
7213 inst_prefix_dir=$arg
7218 # Clang does not use LLVM to link, so we can simply discard any
7219 # '-mllvm $arg' options when doing the link step.
7224 if test -f "$arg"; then
7227 for fil in `cat "$save_arg"`
7229 # func_append moreargs " $fil"
7231 # A libtool-controlled object.
7233 # Check to see that this really is a libtool object.
7234 if func_lalib_unsafe_p "$arg"; then
7241 if test -z "$pic_object" ||
7242 test -z "$non_pic_object" ||
7243 test none = "$pic_object" &&
7244 test none = "$non_pic_object"; then
7245 func_fatal_error "cannot find name of object for '$arg'"
7248 # Extract subdirectory from the argument.
7249 func_dirname "$arg" "/" ""
7250 xdir=$func_dirname_result
7252 if test none != "$pic_object"; then
7253 # Prepend the subdirectory the object is found in.
7254 pic_object=$xdir$pic_object
7256 if test dlfiles = "$prev"; then
7257 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7258 func_append dlfiles " $pic_object"
7262 # If libtool objects are unsupported, then we need to preload.
7267 # CHECK ME: I think I busted this. -Ossama
7268 if test dlprefiles = "$prev"; then
7269 # Preload the old-style object.
7270 func_append dlprefiles " $pic_object"
7275 func_append libobjs " $pic_object"
7280 if test none != "$non_pic_object"; then
7281 # Prepend the subdirectory the object is found in.
7282 non_pic_object=$xdir$non_pic_object
7284 # A standard non-PIC object
7285 func_append non_pic_objects " $non_pic_object"
7286 if test -z "$pic_object" || test none = "$pic_object"; then
7290 # If the PIC object exists, use it instead.
7291 # $xdir was prepended to $pic_object above.
7292 non_pic_object=$pic_object
7293 func_append non_pic_objects " $non_pic_object"
7296 # Only an error if not doing a dry-run.
7297 if $opt_dry_run; then
7298 # Extract subdirectory from the argument.
7299 func_dirname "$arg" "/" ""
7300 xdir=$func_dirname_result
7303 pic_object=$xdir$objdir/$func_lo2o_result
7304 non_pic_object=$xdir$func_lo2o_result
7305 func_append libobjs " $pic_object"
7306 func_append non_pic_objects " $non_pic_object"
7308 func_fatal_error "'$arg' is not a valid libtool object"
7313 func_fatal_error "link input file '$arg' does not exist"
7325 precious_files_regex=$arg
7335 # We need an absolute path.
7337 [\\/]* | [A-Za-z]:[\\/]*) ;;
7339 func_fatal_error "only absolute run-paths are allowed"
7342 if test rpath = "$prev"; then
7345 *) func_append rpath " $arg" ;;
7350 *) func_append xrpath " $arg" ;;
7362 func_append weak_libs " $arg"
7367 func_append linker_flags " $qarg"
7368 func_append compiler_flags " $qarg"
7370 func_append compile_command " $qarg"
7371 func_append finalize_command " $qarg"
7375 func_append compiler_flags " $qarg"
7377 func_append compile_command " $qarg"
7378 func_append finalize_command " $qarg"
7382 func_append linker_flags " $qarg"
7383 func_append compiler_flags " $wl$qarg"
7385 func_append compile_command " $wl$qarg"
7386 func_append finalize_command " $wl$qarg"
7390 eval "$prev=\"\$arg\""
7395 fi # test -n "$prev"
7401 if test -n "$link_static_flag"; then
7402 # See comment for -static flag below, for more details.
7403 func_append compile_command " $link_static_flag"
7404 func_append finalize_command " $link_static_flag"
7410 # FIXME: remove this flag sometime in the future.
7411 func_fatal_error "'-allow-undefined' must not be used because it is the default"
7439 -export-symbols | -export-symbols-regex)
7440 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
7441 func_fatal_error "more than one -exported-symbols argument is not allowed"
7443 if test X-export-symbols = "X$arg"; then
7461 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
7462 # so, if we see these flags be careful not to treat them like -L
7464 case $with_gcc/$host in
7465 no/*-*-irix* | /*-*-irix*)
7466 func_append compile_command " $arg"
7467 func_append finalize_command " $arg"
7474 func_stripname "-L" '' "$arg"
7475 if test -z "$func_stripname_result"; then
7476 if test "$#" -gt 0; then
7477 func_fatal_error "require no space between '-L' and '$1'"
7479 func_fatal_error "need path for '-L' option"
7482 func_resolve_sysroot "$func_stripname_result"
7483 dir=$func_resolve_sysroot_result
7484 # We need an absolute path.
7486 [\\/]* | [A-Za-z]:[\\/]*) ;;
7488 absdir=`cd "$dir" && pwd`
7489 test -z "$absdir" && \
7490 func_fatal_error "cannot determine absolute directory name of '$dir'"
7495 *" -L$dir "* | *" $arg "*)
7496 # Will only happen for absolute or sysroot arguments
7499 # Preserve sysroot, but never include relative directories
7501 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
7502 *) func_append deplibs " -L$dir" ;;
7504 func_append lib_search_path " $dir"
7508 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7509 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
7510 case :$dllsearchpath: in
7512 ::) dllsearchpath=$dir;;
7513 *) func_append dllsearchpath ":$dir";;
7515 case :$dllsearchpath: in
7516 *":$testbindir:"*) ;;
7517 ::) dllsearchpath=$testbindir;;
7518 *) func_append dllsearchpath ":$testbindir";;
7526 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7528 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7529 # These systems don't actually have a C or math library (as such)
7533 # These systems don't actually have a C library (as such)
7534 test X-lc = "X$arg" && continue
7536 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7537 # Do not include libc due to us having libc/libc_r.
7538 test X-lc = "X$arg" && continue
7540 *-*-rhapsody* | *-*-darwin1.[012])
7541 # Rhapsody C and math libraries are in the System framework
7542 func_append deplibs " System.ltframework"
7545 *-*-sco3.2v5* | *-*-sco5v6*)
7546 # Causes problems with __ctype
7547 test X-lc = "X$arg" && continue
7549 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7550 # Compiler inserts libc in the correct place for threads to work
7551 test X-lc = "X$arg" && continue
7554 elif test X-lc_r = "X$arg"; then
7556 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7557 # Do not include libc_r directly, use -pthread flag.
7562 func_append deplibs " $arg"
7576 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7577 # classes, name mangling, and exception handling.
7578 # Darwin uses the -arch flag to determine output architecture.
7579 -model|-arch|-isysroot|--sysroot)
7580 func_append compiler_flags " $arg"
7581 func_append compile_command " $arg"
7582 func_append finalize_command " $arg"
7587 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7588 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7589 func_append compiler_flags " $arg"
7590 func_append compile_command " $arg"
7591 func_append finalize_command " $arg"
7592 case "$new_inherited_linker_flags " in
7594 * ) func_append new_inherited_linker_flags " $arg" ;;
7600 single_module=$wl-multi_module
7611 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7612 # The PATH hackery in wrapper scripts is required on Windows
7613 # and Darwin in order for the loader to find any dlls it needs.
7614 func_warning "'-no-install' is ignored for $host"
7615 func_warning "assuming '-no-fast-install' instead"
7618 *) no_install=yes ;;
7640 -precious-files-regex)
7661 func_stripname '-R' '' "$arg"
7662 dir=$func_stripname_result
7663 # We need an absolute path.
7665 [\\/]* | [A-Za-z]:[\\/]*) ;;
7667 func_stripname '=' '' "$dir"
7668 dir=$lt_sysroot$func_stripname_result
7671 func_fatal_error "only absolute run-paths are allowed"
7676 *) func_append xrpath " $dir" ;;
7682 # The effects of -shared are defined in a previous loop.
7691 -static | -static-libtool-libs)
7692 # The effects of -static are defined in a previous loop.
7693 # We used to do the same as -all-static on platforms that
7694 # didn't have a PIC flag, but the assumption that the effects
7695 # would be equivalent was wrong. It would break on at least
7696 # Digital Unix and AIX.
7722 func_stripname '-Wc,' '' "$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 " $func_quote_for_eval_result"
7730 func_append compiler_flags " $func_quote_for_eval_result"
7733 func_stripname ' ' '' "$arg"
7734 arg=$func_stripname_result
7738 func_stripname '-Wl,' '' "$arg"
7739 args=$func_stripname_result
7741 save_ifs=$IFS; IFS=,
7742 for flag in $args; do
7744 func_quote_for_eval "$flag"
7745 func_append arg " $wl$func_quote_for_eval_result"
7746 func_append compiler_flags " $wl$func_quote_for_eval_result"
7747 func_append linker_flags " $func_quote_for_eval_result"
7750 func_stripname ' ' '' "$arg"
7751 arg=$func_stripname_result
7771 func_quote_for_eval "$arg"
7772 arg=$func_quote_for_eval_result
7775 # Flags to be passed through unchanged, with rationale:
7776 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7777 # -r[0-9][0-9]* specify processor for the SGI compiler
7778 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7779 # +DA*, +DD* enable 64-bit mode for the HP compiler
7780 # -q* compiler args for the IBM compiler
7781 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7782 # -F/path path to uninstalled frameworks, gcc on darwin
7783 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7784 # -fstack-protector* stack protector flags for GCC
7785 # @file GCC response files
7786 # -tp=* Portland pgcc target processor selection
7787 # --sysroot=* for sysroot support
7788 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7789 # -specs=* GCC specs files
7790 # -stdlib=* select c++ std lib with clang
7791 # -fsanitize=* Clang/GCC memory and address sanitizer
7792 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7793 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7794 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7795 -specs=*|-fsanitize=*)
7796 func_quote_for_eval "$arg"
7797 arg=$func_quote_for_eval_result
7798 func_append compile_command " $arg"
7799 func_append finalize_command " $arg"
7800 func_append compiler_flags " $arg"
7805 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7806 # OS/2 uses -Zxxx to specify OS/2-specific options
7807 compiler_flags="$compiler_flags $arg"
7808 func_append compile_command " $arg"
7809 func_append finalize_command " $arg"
7817 # Otherwise treat like 'Some other compiler flag' below
7818 func_quote_for_eval "$arg"
7819 arg=$func_quote_for_eval_result
7823 # Some other compiler flag.
7825 func_quote_for_eval "$arg"
7826 arg=$func_quote_for_eval_result
7830 # A standard object.
7831 func_append objs " $arg"
7835 # A libtool-controlled object.
7837 # Check to see that this really is a libtool object.
7838 if func_lalib_unsafe_p "$arg"; then
7845 if test -z "$pic_object" ||
7846 test -z "$non_pic_object" ||
7847 test none = "$pic_object" &&
7848 test none = "$non_pic_object"; then
7849 func_fatal_error "cannot find name of object for '$arg'"
7852 # Extract subdirectory from the argument.
7853 func_dirname "$arg" "/" ""
7854 xdir=$func_dirname_result
7856 test none = "$pic_object" || {
7857 # Prepend the subdirectory the object is found in.
7858 pic_object=$xdir$pic_object
7860 if test dlfiles = "$prev"; then
7861 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7862 func_append dlfiles " $pic_object"
7866 # If libtool objects are unsupported, then we need to preload.
7871 # CHECK ME: I think I busted this. -Ossama
7872 if test dlprefiles = "$prev"; then
7873 # Preload the old-style object.
7874 func_append dlprefiles " $pic_object"
7879 func_append libobjs " $pic_object"
7884 if test none != "$non_pic_object"; then
7885 # Prepend the subdirectory the object is found in.
7886 non_pic_object=$xdir$non_pic_object
7888 # A standard non-PIC object
7889 func_append non_pic_objects " $non_pic_object"
7890 if test -z "$pic_object" || test none = "$pic_object"; then
7894 # If the PIC object exists, use it instead.
7895 # $xdir was prepended to $pic_object above.
7896 non_pic_object=$pic_object
7897 func_append non_pic_objects " $non_pic_object"
7900 # Only an error if not doing a dry-run.
7901 if $opt_dry_run; then
7902 # Extract subdirectory from the argument.
7903 func_dirname "$arg" "/" ""
7904 xdir=$func_dirname_result
7907 pic_object=$xdir$objdir/$func_lo2o_result
7908 non_pic_object=$xdir$func_lo2o_result
7909 func_append libobjs " $pic_object"
7910 func_append non_pic_objects " $non_pic_object"
7912 func_fatal_error "'$arg' is not a valid libtool object"
7919 func_append deplibs " $arg"
7920 func_append old_deplibs " $arg"
7925 # A libtool-controlled library.
7927 func_resolve_sysroot "$arg"
7928 if test dlfiles = "$prev"; then
7929 # This library was specified with -dlopen.
7930 func_append dlfiles " $func_resolve_sysroot_result"
7932 elif test dlprefiles = "$prev"; then
7933 # The library was specified with -dlpreopen.
7934 func_append dlprefiles " $func_resolve_sysroot_result"
7937 func_append deplibs " $func_resolve_sysroot_result"
7942 # Some other compiler argument.
7944 # Unknown arguments in both finalize_command and compile_command need
7945 # to be aesthetically quoted because they are evaled later.
7946 func_quote_for_eval "$arg"
7947 arg=$func_quote_for_eval_result
7951 # Now actually substitute the argument into the commands.
7952 if test -n "$arg"; then
7953 func_append compile_command " $arg"
7954 func_append finalize_command " $arg"
7956 done # argument parsing loop
7958 test -n "$prev" && \
7959 func_fatal_help "the '$prevarg' option requires an argument"
7961 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7962 eval arg=\"$export_dynamic_flag_spec\"
7963 func_append compile_command " $arg"
7964 func_append finalize_command " $arg"
7968 # calculate the name of the file, without its directory
7969 func_basename "$output"
7970 outputname=$func_basename_result
7971 libobjs_save=$libobjs
7973 if test -n "$shlibpath_var"; then
7974 # get the directories listed in $shlibpath_var
7975 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7979 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7980 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7982 # Definition is injected by LT_CONFIG during libtool generation.
7983 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7985 func_dirname "$output" "/" ""
7986 output_objdir=$func_dirname_result$objdir
7987 func_to_tool_file "$output_objdir/"
7988 tool_output_objdir=$func_to_tool_file_result
7989 # Create the object directory.
7990 func_mkdir_p "$output_objdir"
7992 # Determine the type of output
7995 func_fatal_help "you must specify an output file"
7997 *.$libext) linkmode=oldlib ;;
7998 *.lo | *.$objext) linkmode=obj ;;
7999 *.la) linkmode=lib ;;
8000 *) linkmode=prog ;; # Anything else should be a program.
8006 # Find all interdependent deplibs by searching for libraries
8007 # that are linked more than once (e.g. -la -lb -la)
8008 for deplib in $deplibs; do
8009 if $opt_preserve_dup_deps; then
8011 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8014 func_append libs " $deplib"
8017 if test lib = "$linkmode"; then
8018 libs="$predeps $libs $compiler_lib_search_path $postdeps"
8020 # Compute libraries that are listed more than once in $predeps
8021 # $postdeps and mark them as special (i.e., whose duplicates are
8022 # not to be eliminated).
8024 if $opt_duplicate_compiler_generated_deps; then
8025 for pre_post_dep in $predeps $postdeps; do
8026 case "$pre_post_deps " in
8027 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
8029 func_append pre_post_deps " $pre_post_dep"
8038 need_relink=no # whether we're linking any uninstalled libtool libraries
8039 notinst_deplibs= # not-installed libtool libraries
8040 notinst_path= # paths that contain not-installed libtool libraries
8044 passes="conv dlpreopen link"
8045 for file in $dlfiles $dlprefiles; do
8049 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
8060 passes="conv scan dlopen dlpreopen link"
8066 for pass in $passes; do
8067 # The preopen pass in lib mode reverses $deplibs; put it back here
8068 # so that -L comes before libs that need it for instance...
8069 if test lib,link = "$linkmode,$pass"; then
8070 ## FIXME: Find the place where the list is rebuilt in the wrong
8071 ## order, and fix it there properly
8073 for deplib in $deplibs; do
8074 tmp_deplibs="$deplib $tmp_deplibs"
8076 deplibs=$tmp_deplibs
8079 if test lib,link = "$linkmode,$pass" ||
8080 test prog,scan = "$linkmode,$pass"; then
8084 if test prog = "$linkmode"; then
8086 dlopen) libs=$dlfiles ;;
8087 dlpreopen) libs=$dlprefiles ;;
8089 libs="$deplibs %DEPLIBS%"
8090 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
8094 if test lib,dlpreopen = "$linkmode,$pass"; then
8095 # Collect and forward deplibs of preopened libtool libs
8096 for lib in $dlprefiles; do
8097 # Ignore non-libtool-libs
8099 func_resolve_sysroot "$lib"
8101 *.la) func_source "$func_resolve_sysroot_result" ;;
8104 # Collect preopened libtool deplibs, except any this library
8105 # has declared as weak libs
8106 for deplib in $dependency_libs; do
8107 func_basename "$deplib"
8108 deplib_base=$func_basename_result
8109 case " $weak_libs " in
8110 *" $deplib_base "*) ;;
8111 *) func_append deplibs " $deplib" ;;
8117 if test dlopen = "$pass"; then
8118 # Collect dlpreopened libraries
8119 save_deplibs=$deplibs
8123 for deplib in $libs; do
8127 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
8128 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
8129 if test prog,link = "$linkmode,$pass"; then
8130 compile_deplibs="$deplib $compile_deplibs"
8131 finalize_deplibs="$deplib $finalize_deplibs"
8133 func_append compiler_flags " $deplib"
8134 if test lib = "$linkmode"; then
8135 case "$new_inherited_linker_flags " in
8137 * ) func_append new_inherited_linker_flags " $deplib" ;;
8144 if test lib != "$linkmode" && test prog != "$linkmode"; then
8145 func_warning "'-l' is ignored for archives/objects"
8148 func_stripname '-l' '' "$deplib"
8149 name=$func_stripname_result
8150 if test lib = "$linkmode"; then
8151 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
8153 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
8155 for searchdir in $searchdirs; do
8156 for search_ext in .la $std_shrext .so .a; do
8157 # Search the libtool library
8158 lib=$searchdir/lib$name$search_ext
8159 if test -f "$lib"; then
8160 if test .la = "$search_ext"; then
8170 # deplib is a libtool library
8171 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
8172 # We need to do some special things here, and not later.
8173 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8174 case " $predeps $postdeps " in
8176 if func_lalib_p "$lib"; then
8180 for l in $old_library $library_names; do
8183 if test "X$ll" = "X$old_library"; then # only static version available
8185 func_dirname "$lib" "" "."
8186 ladir=$func_dirname_result
8187 lib=$ladir/$old_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"
8203 # deplib doesn't seem to be a libtool library
8204 if test prog,link = "$linkmode,$pass"; then
8205 compile_deplibs="$deplib $compile_deplibs"
8206 finalize_deplibs="$deplib $finalize_deplibs"
8208 deplibs="$deplib $deplibs"
8209 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8215 if test prog,link = "$linkmode,$pass"; then
8216 compile_deplibs="$deplib $compile_deplibs"
8217 finalize_deplibs="$deplib $finalize_deplibs"
8219 deplibs="$deplib $deplibs"
8220 if test lib = "$linkmode"; then
8221 case "$new_inherited_linker_flags " in
8223 * ) func_append new_inherited_linker_flags " $deplib" ;;
8232 deplibs="$deplib $deplibs"
8233 test conv = "$pass" && continue
8234 newdependency_libs="$deplib $newdependency_libs"
8235 func_stripname '-L' '' "$deplib"
8236 func_resolve_sysroot "$func_stripname_result"
8237 func_append newlib_search_path " $func_resolve_sysroot_result"
8240 if test conv = "$pass"; then
8241 deplibs="$deplib $deplibs"
8244 if test scan = "$pass"; then
8245 deplibs="$deplib $deplibs"
8247 compile_deplibs="$deplib $compile_deplibs"
8248 finalize_deplibs="$deplib $finalize_deplibs"
8250 func_stripname '-L' '' "$deplib"
8251 func_resolve_sysroot "$func_stripname_result"
8252 func_append newlib_search_path " $func_resolve_sysroot_result"
8255 func_warning "'-L' is ignored for archives/objects"
8261 if test link = "$pass"; then
8262 func_stripname '-R' '' "$deplib"
8263 func_resolve_sysroot "$func_stripname_result"
8264 dir=$func_resolve_sysroot_result
8265 # Make sure the xrpath contains only unique directories.
8268 *) func_append xrpath " $dir" ;;
8271 deplibs="$deplib $deplibs"
8275 func_resolve_sysroot "$deplib"
8276 lib=$func_resolve_sysroot_result
8279 if test conv = "$pass"; then
8280 deplibs="$deplib $deplibs"
8285 # Linking convenience modules into shared libraries is allowed,
8286 # but linking other static libraries is non-portable.
8287 case " $dlpreconveniencelibs " in
8291 case $deplibs_check_method in
8293 set dummy $deplibs_check_method; shift
8294 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8295 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
8296 | $EGREP "$match_pattern_regex" > /dev/null; then
8304 if $valid_a_lib; then
8306 $ECHO "*** Warning: Linking the shared library $output against the"
8307 $ECHO "*** static library $deplib is not portable!"
8308 deplibs="$deplib $deplibs"
8311 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
8312 echo "*** I have the capability to make that library automatically link in when"
8313 echo "*** you link to this library. But I can only do this if you have a"
8314 echo "*** shared version of the library, which you do not appear to have"
8315 echo "*** because the file extensions .$libext of this argument makes me believe"
8316 echo "*** that it is just a static archive that I should not use here."
8323 if test link != "$pass"; then
8324 deplibs="$deplib $deplibs"
8326 compile_deplibs="$deplib $compile_deplibs"
8327 finalize_deplibs="$deplib $finalize_deplibs"
8334 if test conv = "$pass"; then
8335 deplibs="$deplib $deplibs"
8336 elif test prog = "$linkmode"; then
8337 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
8338 # If there is no dlopen support or we're linking statically,
8339 # we need to preload.
8340 func_append newdlprefiles " $deplib"
8341 compile_deplibs="$deplib $compile_deplibs"
8342 finalize_deplibs="$deplib $finalize_deplibs"
8344 func_append newdlfiles " $deplib"
8355 $found || test -f "$lib" \
8356 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
8358 # Check to see that this really is a libtool archive.
8359 func_lalib_unsafe_p "$lib" \
8360 || func_fatal_error "'$lib' is not a valid libtool archive"
8362 func_dirname "$lib" "" "."
8363 ladir=$func_dirname_result
8371 inherited_linker_flags=
8372 # If the library was installed with an old release of libtool,
8373 # it will not redefine variables installed, or shouldnotlink
8382 # Convert "-framework foo" to "foo.ltframework"
8383 if test -n "$inherited_linker_flags"; then
8384 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
8385 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
8386 case " $new_inherited_linker_flags " in
8387 *" $tmp_inherited_linker_flag "*) ;;
8388 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
8392 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8393 if test lib,link = "$linkmode,$pass" ||
8394 test prog,scan = "$linkmode,$pass" ||
8395 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
8396 test -n "$dlopen" && func_append dlfiles " $dlopen"
8397 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
8400 if test conv = "$pass"; then
8401 # Only check for convenience libraries
8402 deplibs="$lib $deplibs"
8403 if test -z "$libdir"; then
8404 if test -z "$old_library"; then
8405 func_fatal_error "cannot find name of link library for '$lib'"
8407 # It is a libtool convenience library, so add in its objects.
8408 func_append convenience " $ladir/$objdir/$old_library"
8409 func_append old_convenience " $ladir/$objdir/$old_library"
8411 for deplib in $dependency_libs; do
8412 deplibs="$deplib $deplibs"
8413 if $opt_preserve_dup_deps; then
8414 case "$tmp_libs " in
8415 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8418 func_append tmp_libs " $deplib"
8420 elif test prog != "$linkmode" && test lib != "$linkmode"; then
8421 func_fatal_error "'$lib' is not a convenience library"
8427 # Get the name of the library we link against.
8429 if test -n "$old_library" &&
8430 { test yes = "$prefer_static_libs" ||
8431 test built,no = "$prefer_static_libs,$installed"; }; then
8432 linklib=$old_library
8434 for l in $old_library $library_names; do
8438 if test -z "$linklib"; then
8439 func_fatal_error "cannot find name of link library for '$lib'"
8442 # This library was specified with -dlopen.
8443 if test dlopen = "$pass"; then
8445 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8446 if test -z "$dlname" ||
8447 test yes != "$dlopen_support" ||
8448 test no = "$build_libtool_libs"
8450 # If there is no dlname, no dlopen support or we're linking
8451 # statically, we need to preload. We also need to preload any
8452 # dependent libraries so libltdl's deplib preloader doesn't
8453 # bomb out in the load deplibs phase.
8454 func_append dlprefiles " $lib $dependency_libs"
8456 func_append newdlfiles " $lib"
8461 # We need an absolute path.
8463 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8465 abs_ladir=`cd "$ladir" && pwd`
8466 if test -z "$abs_ladir"; then
8467 func_warning "cannot determine absolute directory name of '$ladir'"
8468 func_warning "passing it literally to the linker, although it might fail"
8473 func_basename "$lib"
8474 laname=$func_basename_result
8476 # Find the relevant object directory and library name.
8477 if test yes = "$installed"; then
8478 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8479 func_warning "library '$lib' was moved."
8484 dir=$lt_sysroot$libdir
8485 absdir=$lt_sysroot$libdir
8487 test yes = "$hardcode_automatic" && avoidtemprpath=yes
8489 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8492 # Remove this search path later
8493 func_append notinst_path " $abs_ladir"
8496 absdir=$abs_ladir/$objdir
8497 # Remove this search path later
8498 func_append notinst_path " $abs_ladir"
8500 fi # $installed = yes
8501 func_stripname 'lib' '.la' "$laname"
8502 name=$func_stripname_result
8504 # This library was specified with -dlpreopen.
8505 if test dlpreopen = "$pass"; then
8506 if test -z "$libdir" && test prog = "$linkmode"; then
8507 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8510 # special handling for platforms with PE-DLLs.
8511 *cygwin* | *mingw* | *cegcc* )
8512 # Linker will automatically link against shared library if both
8513 # static and shared are present. Therefore, ensure we extract
8514 # symbols from the import library if a shared library is present
8515 # (otherwise, the dlopen module name will be incorrect). We do
8516 # this by putting the import library name into $newdlprefiles.
8517 # We recover the dlopen module name by 'saving' the la file
8518 # name in a special purpose variable, and (later) extracting the
8519 # dlname from the la file.
8520 if test -n "$dlname"; then
8521 func_tr_sh "$dir/$linklib"
8522 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8523 func_append newdlprefiles " $dir/$linklib"
8525 func_append newdlprefiles " $dir/$old_library"
8526 # Keep a list of preopened convenience libraries to check
8527 # that they are being used correctly in the link pass.
8528 test -z "$libdir" && \
8529 func_append dlpreconveniencelibs " $dir/$old_library"
8533 # Prefer using a static library (so that no silly _DYNAMIC symbols
8534 # are required to link).
8535 if test -n "$old_library"; then
8536 func_append newdlprefiles " $dir/$old_library"
8537 # Keep a list of preopened convenience libraries to check
8538 # that they are being used correctly in the link pass.
8539 test -z "$libdir" && \
8540 func_append dlpreconveniencelibs " $dir/$old_library"
8541 # Otherwise, use the dlname, so that lt_dlopen finds it.
8542 elif test -n "$dlname"; then
8543 func_append newdlprefiles " $dir/$dlname"
8545 func_append newdlprefiles " $dir/$linklib"
8549 fi # $pass = dlpreopen
8551 if test -z "$libdir"; then
8552 # Link the convenience library
8553 if test lib = "$linkmode"; then
8554 deplibs="$dir/$old_library $deplibs"
8555 elif test prog,link = "$linkmode,$pass"; then
8556 compile_deplibs="$dir/$old_library $compile_deplibs"
8557 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8559 deplibs="$lib $deplibs" # used for prog,scan pass
8565 if test prog = "$linkmode" && test link != "$pass"; then
8566 func_append newlib_search_path " $ladir"
8567 deplibs="$lib $deplibs"
8569 linkalldeplibs=false
8570 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8571 test no = "$build_libtool_libs"; then
8576 for deplib in $dependency_libs; do
8578 -L*) func_stripname '-L' '' "$deplib"
8579 func_resolve_sysroot "$func_stripname_result"
8580 func_append newlib_search_path " $func_resolve_sysroot_result"
8583 # Need to link against all dependency_libs?
8584 if $linkalldeplibs; then
8585 deplibs="$deplib $deplibs"
8587 # Need to hardcode shared library paths
8588 # or/and link against static libraries
8589 newdependency_libs="$deplib $newdependency_libs"
8591 if $opt_preserve_dup_deps; then
8592 case "$tmp_libs " in
8593 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8596 func_append tmp_libs " $deplib"
8599 fi # $linkmode = prog...
8601 if test prog,link = "$linkmode,$pass"; then
8602 if test -n "$library_names" &&
8603 { { test no = "$prefer_static_libs" ||
8604 test built,yes = "$prefer_static_libs,$installed"; } ||
8605 test -z "$old_library"; }; then
8606 # We need to hardcode the library path
8607 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8608 # Make sure the rpath contains only unique directories.
8609 case $temp_rpath: in
8611 *) func_append temp_rpath "$absdir:" ;;
8615 # Hardcode the library path.
8616 # Skip directories that are in the system default run-time
8618 case " $sys_lib_dlsearch_path " in
8621 case "$compile_rpath " in
8623 *) func_append compile_rpath " $absdir" ;;
8627 case " $sys_lib_dlsearch_path " in
8630 case "$finalize_rpath " in
8632 *) func_append finalize_rpath " $libdir" ;;
8636 fi # $linkmode,$pass = prog,link...
8639 { test pass_all = "$deplibs_check_method" ||
8640 { test yes = "$build_libtool_libs" &&
8641 test -n "$library_names"; }; }; then
8642 # We only need to search for static libraries
8647 link_static=no # Whether the deplib will be linked statically
8648 use_static_libs=$prefer_static_libs
8649 if test built = "$use_static_libs" && test yes = "$installed"; then
8652 if test -n "$library_names" &&
8653 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8655 *cygwin* | *mingw* | *cegcc* | *os2*)
8656 # No point in relinking DLLs because paths are not encoded
8657 func_append notinst_deplibs " $lib"
8661 if test no = "$installed"; then
8662 func_append notinst_deplibs " $lib"
8667 # This is a shared library
8669 # Warn about portability, can't link against -module's on some
8670 # systems (darwin). Don't bleat about dlopened modules though!
8672 for dlpremoduletest in $dlprefiles; do
8673 if test "X$dlpremoduletest" = "X$lib"; then
8674 dlopenmodule=$dlpremoduletest
8678 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8680 if test prog = "$linkmode"; then
8681 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8683 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8685 $ECHO "*** $linklib is not portable!"
8687 if test lib = "$linkmode" &&
8688 test yes = "$hardcode_into_libs"; then
8689 # Hardcode the library path.
8690 # Skip directories that are in the system default run-time
8692 case " $sys_lib_dlsearch_path " in
8695 case "$compile_rpath " in
8697 *) func_append compile_rpath " $absdir" ;;
8701 case " $sys_lib_dlsearch_path " in
8704 case "$finalize_rpath " in
8706 *) func_append finalize_rpath " $libdir" ;;
8712 if test -n "$old_archive_from_expsyms_cmds"; then
8713 # figure out the soname
8714 set dummy $library_names
8718 libname=`eval "\\$ECHO \"$libname_spec\""`
8719 # use dlname if we got it. it's perfectly good, no?
8720 if test -n "$dlname"; then
8722 elif test -n "$soname_spec"; then
8725 *cygwin* | mingw* | *cegcc* | *os2*)
8726 func_arith $current - $age
8727 major=$func_arith_result
8731 eval soname=\"$soname_spec\"
8736 # Make a new name for the extract_expsyms_cmds to use
8738 func_basename "$soroot"
8739 soname=$func_basename_result
8740 func_stripname 'lib' '.dll' "$soname"
8741 newlib=libimp-$func_stripname_result.a
8743 # If the library has no export list, then create one now
8744 if test -f "$output_objdir/$soname-def"; then :
8746 func_verbose "extracting exported symbol list from '$soname'"
8747 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8751 if test -f "$output_objdir/$newlib"; then :; else
8752 func_verbose "generating import library for '$soname'"
8753 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8755 # make sure the library variables are pointing to the new library
8758 fi # test -n "$old_archive_from_expsyms_cmds"
8760 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8765 case $hardcode_action in
8766 immediate | unsupported)
8767 if test no = "$hardcode_direct"; then
8770 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8771 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8772 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8773 *-*-unixware7*) add_dir=-L$dir ;;
8775 # if the lib is a (non-dlopened) module then we cannot
8776 # link against it, someone is ignoring the earlier warnings
8777 if /usr/bin/file -L $add 2> /dev/null |
8778 $GREP ": [^:]* bundle" >/dev/null; then
8779 if test "X$dlopenmodule" != "X$lib"; then
8780 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8781 if test -z "$old_library"; then
8783 echo "*** And there doesn't seem to be a static archive available"
8784 echo "*** The link will probably fail, sorry"
8786 add=$dir/$old_library
8788 elif test -n "$old_library"; then
8789 add=$dir/$old_library
8793 elif test no = "$hardcode_minus_L"; then
8795 *-*-sunos*) add_shlibpath=$dir ;;
8799 elif test no = "$hardcode_shlibpath_var"; then
8807 if test yes = "$hardcode_direct" &&
8808 test no = "$hardcode_direct_absolute"; then
8810 elif test yes = "$hardcode_minus_L"; then
8812 # Try looking first in the location we're being installed to.
8813 if test -n "$inst_prefix_dir"; then
8816 func_append add_dir " -L$inst_prefix_dir$libdir"
8821 elif test yes = "$hardcode_shlibpath_var"; then
8831 if test yes != "$lib_linked"; then
8832 func_fatal_configuration "unsupported hardcode properties"
8835 if test -n "$add_shlibpath"; then
8836 case :$compile_shlibpath: in
8837 *":$add_shlibpath:"*) ;;
8838 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8841 if test prog = "$linkmode"; then
8842 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8843 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8845 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8846 test -n "$add" && deplibs="$add $deplibs"
8847 if test yes != "$hardcode_direct" &&
8848 test yes != "$hardcode_minus_L" &&
8849 test yes = "$hardcode_shlibpath_var"; then
8850 case :$finalize_shlibpath: in
8852 *) func_append finalize_shlibpath "$libdir:" ;;
8858 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8862 # Finalize command for both is simple: just hardcode it.
8863 if test yes = "$hardcode_direct" &&
8864 test no = "$hardcode_direct_absolute"; then
8865 add=$libdir/$linklib
8866 elif test yes = "$hardcode_minus_L"; then
8869 elif test yes = "$hardcode_shlibpath_var"; then
8870 case :$finalize_shlibpath: in
8872 *) func_append finalize_shlibpath "$libdir:" ;;
8875 elif test yes = "$hardcode_automatic"; then
8876 if test -n "$inst_prefix_dir" &&
8877 test -f "$inst_prefix_dir$libdir/$linklib"; then
8878 add=$inst_prefix_dir$libdir/$linklib
8880 add=$libdir/$linklib
8883 # We cannot seem to hardcode it, guess we'll fake it.
8885 # Try looking first in the location we're being installed to.
8886 if test -n "$inst_prefix_dir"; then
8889 func_append add_dir " -L$inst_prefix_dir$libdir"
8896 if test prog = "$linkmode"; then
8897 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8898 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8900 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8901 test -n "$add" && deplibs="$add $deplibs"
8904 elif test prog = "$linkmode"; then
8905 # Here we assume that one of hardcode_direct or hardcode_minus_L
8906 # is not unsupported. This is valid on all known static and
8908 if test unsupported != "$hardcode_direct"; then
8909 test -n "$old_library" && linklib=$old_library
8910 compile_deplibs="$dir/$linklib $compile_deplibs"
8911 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8913 compile_deplibs="-l$name -L$dir $compile_deplibs"
8914 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8916 elif test yes = "$build_libtool_libs"; then
8917 # Not a shared library
8918 if test pass_all != "$deplibs_check_method"; then
8919 # We're trying link a shared library against a static one
8920 # but the system doesn't support it.
8922 # Just print a warning and add the library to dependency_libs so
8923 # that the program can be linked against the static library.
8925 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8926 echo "*** I have the capability to make that library automatically link in when"
8927 echo "*** you link to this library. But I can only do this if you have a"
8928 echo "*** shared version of the library, which you do not appear to have."
8929 if test yes = "$module"; then
8930 echo "*** But as you try to build a module library, libtool will still create "
8931 echo "*** a static module, that should work as long as the dlopening application"
8932 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8933 if test -z "$global_symbol_pipe"; then
8935 echo "*** However, this would only work if libtool was able to extract symbol"
8936 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8937 echo "*** not find such a program. So, this module is probably useless."
8938 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8940 if test no = "$build_old_libs"; then
8941 build_libtool_libs=module
8944 build_libtool_libs=no
8948 deplibs="$dir/$old_library $deplibs"
8951 fi # link shared/static library?
8953 if test lib = "$linkmode"; then
8954 if test -n "$dependency_libs" &&
8955 { test yes != "$hardcode_into_libs" ||
8956 test yes = "$build_old_libs" ||
8957 test yes = "$link_static"; }; then
8958 # Extract -R from dependency_libs
8960 for libdir in $dependency_libs; do
8962 -R*) func_stripname '-R' '' "$libdir"
8963 temp_xrpath=$func_stripname_result
8965 *" $temp_xrpath "*) ;;
8966 *) func_append xrpath " $temp_xrpath";;
8968 *) func_append temp_deplibs " $libdir";;
8971 dependency_libs=$temp_deplibs
8974 func_append newlib_search_path " $absdir"
8975 # Link against this library
8976 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8977 # ... and its dependency_libs
8979 for deplib in $dependency_libs; do
8980 newdependency_libs="$deplib $newdependency_libs"
8982 -L*) func_stripname '-L' '' "$deplib"
8983 func_resolve_sysroot "$func_stripname_result";;
8984 *) func_resolve_sysroot "$deplib" ;;
8986 if $opt_preserve_dup_deps; then
8987 case "$tmp_libs " in
8988 *" $func_resolve_sysroot_result "*)
8989 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8992 func_append tmp_libs " $func_resolve_sysroot_result"
8995 if test no != "$link_all_deplibs"; then
8996 # Add the search paths of all dependency libraries
8997 for deplib in $dependency_libs; do
9000 -L*) path=$deplib ;;
9002 func_resolve_sysroot "$deplib"
9003 deplib=$func_resolve_sysroot_result
9004 func_dirname "$deplib" "" "."
9005 dir=$func_dirname_result
9006 # We need an absolute path.
9008 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
9010 absdir=`cd "$dir" && pwd`
9011 if test -z "$absdir"; then
9012 func_warning "cannot determine absolute directory name of '$dir'"
9017 if $GREP "^installed=no" $deplib > /dev/null; then
9021 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
9022 if test -n "$deplibrary_names"; then
9023 for tmp in $deplibrary_names; do
9026 if test -f "$absdir/$objdir/$depdepl"; then
9027 depdepl=$absdir/$objdir/$depdepl
9028 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9029 if test -z "$darwin_install_name"; then
9030 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9032 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
9033 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
9039 path=-L$absdir/$objdir
9043 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
9044 test -z "$libdir" && \
9045 func_fatal_error "'$deplib' is not a valid libtool archive"
9046 test "$absdir" != "$libdir" && \
9047 func_warning "'$deplib' seems to be moved"
9053 case " $deplibs " in
9055 *) deplibs="$path $deplibs" ;;
9058 fi # link_all_deplibs != no
9060 done # for deplib in $libs
9061 if test link = "$pass"; then
9062 if test prog = "$linkmode"; then
9063 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
9064 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
9066 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9069 dependency_libs=$newdependency_libs
9070 if test dlpreopen = "$pass"; then
9071 # Link the dlpreopened libraries before other libraries
9072 for deplib in $save_deplibs; do
9073 deplibs="$deplib $deplibs"
9076 if test dlopen != "$pass"; then
9077 test conv = "$pass" || {
9078 # Make sure lib_search_path contains only unique directories.
9080 for dir in $newlib_search_path; do
9081 case "$lib_search_path " in
9083 *) func_append lib_search_path " $dir" ;;
9089 if test prog,link = "$linkmode,$pass"; then
9090 vars="compile_deplibs finalize_deplibs"
9094 for var in $vars dependency_libs; do
9095 # Add libraries to $var in reverse order
9096 eval tmp_libs=\"\$$var\"
9098 for deplib in $tmp_libs; do
9099 # FIXME: Pedantically, this is the right thing to do, so
9100 # that some nasty dependency loop isn't accidentally
9102 #new_libs="$deplib $new_libs"
9103 # Pragmatically, this seems to cause very few problems in
9106 -L*) new_libs="$deplib $new_libs" ;;
9109 # And here is the reason: when a library appears more
9110 # than once as an explicit dependence of a library, or
9111 # is implicitly linked in more than once by the
9112 # compiler, it is considered special, and multiple
9113 # occurrences thereof are not removed. Compare this
9114 # with having the same library being listed as a
9115 # dependency of multiple other libraries: in this case,
9116 # we know (pedantically, we assume) the library does not
9117 # need to be listed more than once, so we keep only the
9118 # last copy. This is not always right, but it is rare
9119 # enough that we require users that really mean to play
9120 # such unportable linking tricks to link the library
9121 # using -Wl,-lname, so that libtool does not consider it
9122 # for duplicate removal.
9123 case " $specialdeplibs " in
9124 *" $deplib "*) new_libs="$deplib $new_libs" ;;
9126 case " $new_libs " in
9128 *) new_libs="$deplib $new_libs" ;;
9136 for deplib in $new_libs; do
9139 case " $tmp_libs " in
9141 *) func_append tmp_libs " $deplib" ;;
9144 *) func_append tmp_libs " $deplib" ;;
9147 eval $var=\"$tmp_libs\"
9151 # Add Sun CC postdeps if required:
9152 test CXX = "$tagname" && {
9155 case `$CC -V 2>&1 | sed 5q` in
9156 *Sun\ C*) # Sun C++ 5.9
9159 if test no != "$suncc_use_cstd_abi"; then
9160 func_append postdeps ' -library=Cstd -library=Crun'
9167 func_cc_basename "$CC"
9168 case $func_cc_basename_result in
9172 if test no != "$suncc_use_cstd_abi"; then
9173 func_append postdeps ' -library=Cstd -library=Crun'
9181 # Last step: remove runtime libs from dependency_libs
9182 # (they stay in deplibs)
9184 for i in $dependency_libs; do
9185 case " $predeps $postdeps $compiler_lib_search_path " in
9190 if test -n "$i"; then
9191 func_append tmp_libs " $i"
9194 dependency_libs=$tmp_libs
9196 if test prog = "$linkmode"; then
9199 if test prog = "$linkmode" || test lib = "$linkmode"; then
9200 dlprefiles=$newdlprefiles
9205 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
9206 func_warning "'-dlopen' is ignored for archives"
9211 func_warning "'-l' and '-L' are ignored for archives" ;;
9214 test -n "$rpath" && \
9215 func_warning "'-rpath' is ignored for archives"
9217 test -n "$xrpath" && \
9218 func_warning "'-R' is ignored for archives"
9220 test -n "$vinfo" && \
9221 func_warning "'-version-info/-version-number' is ignored for archives"
9223 test -n "$release" && \
9224 func_warning "'-release' is ignored for archives"
9226 test -n "$export_symbols$export_symbols_regex" && \
9227 func_warning "'-export-symbols' is ignored for archives"
9229 # Now set the variables for building old libraries.
9230 build_libtool_libs=no
9232 func_append objs "$old_deplibs"
9236 # Make sure we only generate libraries of the form 'libNAME.la'.
9239 func_stripname 'lib' '.la' "$outputname"
9240 name=$func_stripname_result
9241 eval shared_ext=\"$shrext_cmds\"
9242 eval libname=\"$libname_spec\"
9245 test no = "$module" \
9246 && func_fatal_help "libtool library '$output' must begin with 'lib'"
9248 if test no != "$need_lib_prefix"; then
9249 # Add the "lib" prefix for modules if required
9250 func_stripname '' '.la' "$outputname"
9251 name=$func_stripname_result
9252 eval shared_ext=\"$shrext_cmds\"
9253 eval libname=\"$libname_spec\"
9255 func_stripname '' '.la' "$outputname"
9256 libname=$func_stripname_result
9261 if test -n "$objs"; then
9262 if test pass_all != "$deplibs_check_method"; then
9263 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
9266 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
9267 $ECHO "*** objects $objs is not portable!"
9268 func_append libobjs " $objs"
9272 test no = "$dlself" \
9273 || func_warning "'-dlopen self' is ignored for libtool libraries"
9278 && func_warning "ignoring multiple '-rpath's for a libtool library"
9283 if test -z "$rpath"; then
9284 if test yes = "$build_libtool_libs"; then
9285 # Building a libtool convenience library.
9286 # Some compilers have problems with a '.al' extension so
9287 # convenience libraries should have the same extension an
9288 # archive normally would.
9289 oldlibs="$output_objdir/$libname.$libext $oldlibs"
9290 build_libtool_libs=convenience
9294 test -n "$vinfo" && \
9295 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
9297 test -n "$release" && \
9298 func_warning "'-release' is ignored for convenience libraries"
9301 # Parse the version information argument.
9302 save_ifs=$IFS; IFS=:
9303 set dummy $vinfo 0 0 0
9308 func_fatal_help "too many parameters to '-version-info'"
9310 # convert absolute version numbers to libtool ages
9311 # this retains compatibility with .la files and attempts
9312 # to make the code below a bit more comprehensible
9314 case $vinfo_number in
9320 # There are really only two kinds -- those that
9321 # use the current revision as the major version
9322 # and those that subtract age and use age as
9323 # a minor version. But, then there is irix
9324 # that has an extra 1 added just for fun
9326 case $version_type in
9327 # correct linux to gnu/linux during the next big refactor
9328 darwin|freebsd-elf|linux|osf|windows|none)
9329 func_arith $number_major + $number_minor
9330 current=$func_arith_result
9332 revision=$number_revision
9334 freebsd-aout|qnx|sunos)
9335 current=$number_major
9336 revision=$number_minor
9340 func_arith $number_major + $number_minor
9341 current=$func_arith_result
9343 revision=$number_minor
9344 lt_irix_increment=no
9347 func_fatal_configuration "$modename: unknown library version type '$version_type'"
9358 # Check that each of the things are valid numbers.
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 "CURRENT '$current' must be a nonnegative integer"
9363 func_fatal_error "'$vinfo' is not valid version information"
9368 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]) ;;
9370 func_error "REVISION '$revision' must be a nonnegative integer"
9371 func_fatal_error "'$vinfo' is not valid version information"
9376 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]) ;;
9378 func_error "AGE '$age' must be a nonnegative integer"
9379 func_fatal_error "'$vinfo' is not valid version information"
9383 if test "$age" -gt "$current"; then
9384 func_error "AGE '$age' is greater than the current interface number '$current'"
9385 func_fatal_error "'$vinfo' is not valid version information"
9388 # Calculate the version variables.
9392 case $version_type in
9396 # Like Linux, but with the current version available in
9397 # verstring for coding it into the library header
9398 func_arith $current - $age
9399 major=.$func_arith_result
9400 versuffix=$major.$age.$revision
9401 # Darwin ld doesn't like 0 for these options...
9402 func_arith $current + 1
9403 minor_current=$func_arith_result
9404 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9405 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9406 # On Darwin other compilers
9409 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9412 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9419 versuffix=.$current.$revision
9423 func_arith $current - $age
9424 major=.$func_arith_result
9425 versuffix=$major.$age.$revision
9429 if test no = "$lt_irix_increment"; then
9430 func_arith $current - $age
9432 func_arith $current - $age + 1
9434 major=$func_arith_result
9436 case $version_type in
9437 nonstopux) verstring_prefix=nonstopux ;;
9438 *) verstring_prefix=sgi ;;
9440 verstring=$verstring_prefix$major.$revision
9442 # Add in all the interfaces that we are compatible with.
9444 while test 0 -ne "$loop"; do
9445 func_arith $revision - $loop
9446 iface=$func_arith_result
9447 func_arith $loop - 1
9448 loop=$func_arith_result
9449 verstring=$verstring_prefix$major.$iface:$verstring
9452 # Before this point, $major must not contain '.'.
9454 versuffix=$major.$revision
9457 linux) # correct to gnu/linux during the next big refactor
9458 func_arith $current - $age
9459 major=.$func_arith_result
9460 versuffix=$major.$age.$revision
9464 func_arith $current - $age
9465 major=.$func_arith_result
9466 versuffix=.$current.$age.$revision
9467 verstring=$current.$age.$revision
9469 # Add in all the interfaces that we are compatible with.
9471 while test 0 -ne "$loop"; do
9472 func_arith $current - $loop
9473 iface=$func_arith_result
9474 func_arith $loop - 1
9475 loop=$func_arith_result
9476 verstring=$verstring:$iface.0
9479 # Make executables depend on our current version.
9480 func_append verstring ":$current.0"
9495 versuffix=.$current.$revision
9499 # Use '-' rather than '.', since we only want one
9500 # extension on DOS 8.3 file systems.
9501 func_arith $current - $age
9502 major=$func_arith_result
9507 func_fatal_configuration "unknown library version type '$version_type'"
9511 # Clear the version info if we defaulted, and they specified a release.
9512 if test -z "$vinfo" && test -n "$release"; then
9514 case $version_type in
9516 # we can't check for "0.0" in archive_cmds due to quoting
9517 # problems, so we reset it completely
9524 if test no = "$need_version"; then
9531 # Remove version info from name if versioning should be avoided
9532 if test yes,no = "$avoid_version,$need_version"; then
9538 # Check to see if the archive will have undefined symbols.
9539 if test yes = "$allow_undefined"; then
9540 if test unsupported = "$allow_undefined_flag"; then
9541 if test yes = "$build_old_libs"; then
9542 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9543 build_libtool_libs=no
9545 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9549 # Don't allow undefined symbols.
9550 allow_undefined_flag=$no_undefined_flag
9555 func_generate_dlsyms "$libname" "$libname" :
9556 func_append libobjs " $symfileobj"
9557 test " " = "$libobjs" && libobjs=
9559 if test relink != "$opt_mode"; then
9560 # Remove our outputs, but don't remove object files since they
9561 # may have been created when compiling PIC objects.
9563 tempremovelist=`$ECHO "$output_objdir/*"`
9564 for p in $tempremovelist; do
9568 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9569 if test -n "$precious_files_regex"; then
9570 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9575 func_append removelist " $p"
9580 test -n "$removelist" && \
9581 func_show_eval "${RM}r \$removelist"
9584 # Now set the variables for building old libraries.
9585 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9586 func_append oldlibs " $output_objdir/$libname.$libext"
9588 # Transform .lo files to .o files.
9589 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9592 # Eliminate all temporary directories.
9593 #for path in $notinst_path; do
9594 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9595 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9596 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9599 if test -n "$xrpath"; then
9600 # If the user specified any rpath flags, then add them.
9602 for libdir in $xrpath; do
9603 func_replace_sysroot "$libdir"
9604 func_append temp_xrpath " -R$func_replace_sysroot_result"
9605 case "$finalize_rpath " in
9607 *) func_append finalize_rpath " $libdir" ;;
9610 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9611 dependency_libs="$temp_xrpath $dependency_libs"
9615 # Make sure dlfiles contains only unique files that won't be dlpreopened
9616 old_dlfiles=$dlfiles
9618 for lib in $old_dlfiles; do
9619 case " $dlprefiles $dlfiles " in
9621 *) func_append dlfiles " $lib" ;;
9625 # Make sure dlprefiles contains only unique files
9626 old_dlprefiles=$dlprefiles
9628 for lib in $old_dlprefiles; do
9629 case "$dlprefiles " in
9631 *) func_append dlprefiles " $lib" ;;
9635 if test yes = "$build_libtool_libs"; then
9636 if test -n "$rpath"; then
9638 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9639 # these systems don't actually have a c library (as such)!
9641 *-*-rhapsody* | *-*-darwin1.[012])
9642 # Rhapsody C library is in the System framework
9643 func_append deplibs " System.ltframework"
9646 # Don't link with libc until the a.out ld.so is fixed.
9648 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9649 # Do not include libc due to us having libc/libc_r.
9651 *-*-sco3.2v5* | *-*-sco5v6*)
9652 # Causes problems with __ctype
9654 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9655 # Compiler inserts libc in the correct place for threads to work
9658 # Add libc to deplibs on all other systems if necessary.
9659 if test yes = "$build_libtool_need_lc"; then
9660 func_append deplibs " -lc"
9666 # Transform deplibs into only deplibs that can be linked in shared.
9668 libname_save=$libname
9669 release_save=$release
9670 versuffix_save=$versuffix
9672 # I'm not sure if I'm treating the release correctly. I think
9673 # release should show up in the -l (ie -lgmp5) so we don't want to
9674 # add it in twice. Is that correct?
9680 case $deplibs_check_method in
9682 # Don't check for shared/static. Everything works.
9683 # This might be a little naive. We might want to check
9684 # whether the library exists or not. But this is on
9685 # osf3 & osf4 and I'm not really sure... Just
9686 # implementing what was already the behavior.
9690 # This code stresses the "libraries are programs" paradigm to its
9691 # limits. Maybe even breaks it. We compile a program, linking it
9692 # against the deplibs as a proxy for the library. Then we can check
9693 # whether they linked in statically or dynamically with ldd.
9694 $opt_dry_run || $RM conftest.c
9695 cat > conftest.c <<EOF
9696 int main() { return 0; }
9698 $opt_dry_run || $RM conftest
9699 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9700 ldd_output=`ldd conftest`
9701 for i in $deplibs; do
9704 func_stripname -l '' "$i"
9705 name=$func_stripname_result
9706 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9707 case " $predeps $postdeps " in
9709 func_append newdeplibs " $i"
9714 if test -n "$i"; then
9715 libname=`eval "\\$ECHO \"$libname_spec\""`
9716 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9717 set dummy $deplib_matches; shift
9719 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9720 func_append newdeplibs " $i"
9724 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9725 echo "*** I have the capability to make that library automatically link in when"
9726 echo "*** you link to this library. But I can only do this if you have a"
9727 echo "*** shared version of the library, which I believe you do not have"
9728 echo "*** because a test_compile did reveal that the linker did not use it for"
9729 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9734 func_append newdeplibs " $i"
9739 # Error occurred in the first compile. Let's try to salvage
9740 # the situation: Compile a separate program for each library.
9741 for i in $deplibs; do
9744 func_stripname -l '' "$i"
9745 name=$func_stripname_result
9746 $opt_dry_run || $RM conftest
9747 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9748 ldd_output=`ldd conftest`
9749 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9750 case " $predeps $postdeps " in
9752 func_append newdeplibs " $i"
9757 if test -n "$i"; then
9758 libname=`eval "\\$ECHO \"$libname_spec\""`
9759 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9760 set dummy $deplib_matches; shift
9762 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9763 func_append newdeplibs " $i"
9767 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9768 echo "*** I have the capability to make that library automatically link in when"
9769 echo "*** you link to this library. But I can only do this if you have a"
9770 echo "*** shared version of the library, which you do not appear to have"
9771 echo "*** because a test_compile did reveal that the linker did not use this one"
9772 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9778 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9779 echo "*** make it link in! You will probably need to install it or some"
9780 echo "*** library that it depends on before this library will be fully"
9781 echo "*** functional. Installing it before continuing would be even better."
9785 func_append newdeplibs " $i"
9792 set dummy $deplibs_check_method; shift
9793 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9794 for a_deplib in $deplibs; do
9797 func_stripname -l '' "$a_deplib"
9798 name=$func_stripname_result
9799 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9800 case " $predeps $postdeps " in
9802 func_append newdeplibs " $a_deplib"
9807 if test -n "$a_deplib"; then
9808 libname=`eval "\\$ECHO \"$libname_spec\""`
9809 if test -n "$file_magic_glob"; then
9810 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9812 libnameglob=$libname
9814 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9815 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9816 if test yes = "$want_nocaseglob"; then
9818 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9821 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9823 for potent_lib in $potential_libs; do
9824 # Follow soft links.
9825 if ls -lLd "$potent_lib" 2>/dev/null |
9826 $GREP " -> " >/dev/null; then
9829 # The statement above tries to avoid entering an
9830 # endless loop below, in case of cyclic links.
9831 # We might still enter an endless loop, since a link
9832 # loop can be closed while we follow links,
9835 while test -h "$potlib" 2>/dev/null; do
9836 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9838 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9839 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9842 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9844 $EGREP "$file_magic_regex" > /dev/null; then
9845 func_append newdeplibs " $a_deplib"
9852 if test -n "$a_deplib"; then
9855 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9856 echo "*** I have the capability to make that library automatically link in when"
9857 echo "*** you link to this library. But I can only do this if you have a"
9858 echo "*** shared version of the library, which you do not appear to have"
9859 echo "*** because I did check the linker path looking for a file starting"
9860 if test -z "$potlib"; then
9861 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9863 $ECHO "*** with $libname and none of the candidates passed a file format test"
9864 $ECHO "*** using a file magic. Last file checked: $potlib"
9869 # Add a -L argument.
9870 func_append newdeplibs " $a_deplib"
9873 done # Gone through all deplibs.
9876 set dummy $deplibs_check_method; shift
9877 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9878 for a_deplib in $deplibs; do
9881 func_stripname -l '' "$a_deplib"
9882 name=$func_stripname_result
9883 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9884 case " $predeps $postdeps " in
9886 func_append newdeplibs " $a_deplib"
9891 if test -n "$a_deplib"; then
9892 libname=`eval "\\$ECHO \"$libname_spec\""`
9893 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9894 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9895 for potent_lib in $potential_libs; do
9896 potlib=$potent_lib # see symlink-check above in file_magic test
9897 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9898 $EGREP "$match_pattern_regex" > /dev/null; then
9899 func_append newdeplibs " $a_deplib"
9906 if test -n "$a_deplib"; then
9909 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9910 echo "*** I have the capability to make that library automatically link in when"
9911 echo "*** you link to this library. But I can only do this if you have a"
9912 echo "*** shared version of the library, which you do not appear to have"
9913 echo "*** because I did check the linker path looking for a file starting"
9914 if test -z "$potlib"; then
9915 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9917 $ECHO "*** with $libname and none of the candidates passed a file format test"
9918 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9923 # Add a -L argument.
9924 func_append newdeplibs " $a_deplib"
9927 done # Gone through all deplibs.
9931 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9932 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9933 for i in $predeps $postdeps; do
9934 # can't use Xsed below, because $i might contain '/'
9935 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9938 case $tmp_deplibs in
9941 if test none = "$deplibs_check_method"; then
9942 echo "*** Warning: inter-library dependencies are not supported in this platform."
9944 echo "*** Warning: inter-library dependencies are not known to be supported."
9946 echo "*** All declared inter-library dependencies are being dropped."
9952 versuffix=$versuffix_save
9954 release=$release_save
9955 libname=$libname_save
9959 *-*-rhapsody* | *-*-darwin1.[012])
9960 # On Rhapsody replace the C library with the System framework
9961 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9965 if test yes = "$droppeddeps"; then
9966 if test yes = "$module"; then
9968 echo "*** Warning: libtool could not satisfy all declared inter-library"
9969 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9970 echo "*** a static module, that should work as long as the dlopening"
9971 echo "*** application is linked with the -dlopen flag."
9972 if test -z "$global_symbol_pipe"; then
9974 echo "*** However, this would only work if libtool was able to extract symbol"
9975 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9976 echo "*** not find such a program. So, this module is probably useless."
9977 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9979 if test no = "$build_old_libs"; then
9980 oldlibs=$output_objdir/$libname.$libext
9981 build_libtool_libs=module
9984 build_libtool_libs=no
9987 echo "*** The inter-library dependencies that have been dropped here will be"
9988 echo "*** automatically added whenever a program is linked with this library"
9989 echo "*** or is declared to -dlopen it."
9991 if test no = "$allow_undefined"; then
9993 echo "*** Since this library must not contain undefined symbols,"
9994 echo "*** because either the platform does not support them or"
9995 echo "*** it was explicitly requested with -no-undefined,"
9996 echo "*** libtool will only create a static version of it."
9997 if test no = "$build_old_libs"; then
9998 oldlibs=$output_objdir/$libname.$libext
9999 build_libtool_libs=module
10002 build_libtool_libs=no
10007 # Done checking deplibs!
10008 deplibs=$newdeplibs
10010 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10013 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10014 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10015 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10019 # move library search paths that coincide with paths to not yet
10020 # installed libraries to the beginning of the library search list
10022 for path in $notinst_path; do
10023 case " $new_libs " in
10024 *" -L$path/$objdir "*) ;;
10026 case " $deplibs " in
10027 *" -L$path/$objdir "*)
10028 func_append new_libs " -L$path/$objdir" ;;
10033 for deplib in $deplibs; do
10036 case " $new_libs " in
10038 *) func_append new_libs " $deplib" ;;
10041 *) func_append new_libs " $deplib" ;;
10046 # All the library-specific variables (install_libdir is set above).
10051 # Test again, we may have decided not to build it any more
10052 if test yes = "$build_libtool_libs"; then
10053 # Remove $wl instances when linking with ld.
10054 # FIXME: should test the right _cmds variable.
10055 case $archive_cmds in
10058 if test yes = "$hardcode_into_libs"; then
10059 # Hardcode the library paths
10062 rpath=$finalize_rpath
10063 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
10064 for libdir in $rpath; do
10065 if test -n "$hardcode_libdir_flag_spec"; then
10066 if test -n "$hardcode_libdir_separator"; then
10067 func_replace_sysroot "$libdir"
10068 libdir=$func_replace_sysroot_result
10069 if test -z "$hardcode_libdirs"; then
10070 hardcode_libdirs=$libdir
10072 # Just accumulate the unique libdirs.
10073 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10074 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10077 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10082 eval flag=\"$hardcode_libdir_flag_spec\"
10083 func_append dep_rpath " $flag"
10085 elif test -n "$runpath_var"; then
10086 case "$perm_rpath " in
10088 *) func_append perm_rpath " $libdir" ;;
10092 # Substitute the hardcoded libdirs into the rpath.
10093 if test -n "$hardcode_libdir_separator" &&
10094 test -n "$hardcode_libdirs"; then
10095 libdir=$hardcode_libdirs
10096 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
10098 if test -n "$runpath_var" && test -n "$perm_rpath"; then
10099 # We should set the runpath_var.
10101 for dir in $perm_rpath; do
10102 func_append rpath "$dir:"
10104 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
10106 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
10109 shlibpath=$finalize_shlibpath
10110 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
10111 if test -n "$shlibpath"; then
10112 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
10115 # Get the real and link names of the library.
10116 eval shared_ext=\"$shrext_cmds\"
10117 eval library_names=\"$library_names_spec\"
10118 set dummy $library_names
10123 if test -n "$soname_spec"; then
10124 eval soname=\"$soname_spec\"
10128 if test -z "$dlname"; then
10132 lib=$output_objdir/$realname
10136 func_append linknames " $link"
10139 # Use standard objects if they are pic
10140 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
10141 test "X$libobjs" = "X " && libobjs=
10144 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10145 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
10146 export_symbols=$output_objdir/$libname.uexp
10147 func_append delfiles " $export_symbols"
10150 orig_export_symbols=
10152 cygwin* | mingw* | cegcc*)
10153 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
10154 # exporting using user supplied symfile
10155 func_dll_def_p "$export_symbols" || {
10156 # and it's NOT already a .def file. Must figure out
10157 # which of the given symbols are data symbols and tag
10158 # them as such. So, trigger use of export_symbols_cmds.
10159 # export_symbols gets reassigned inside the "prepare
10160 # the list of exported symbols" if statement, so the
10161 # include_expsyms logic still works.
10162 orig_export_symbols=$export_symbols
10164 always_export_symbols=yes
10170 # Prepare the list of exported symbols
10171 if test -z "$export_symbols"; then
10172 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
10173 func_verbose "generating symbol list for '$libname.la'"
10174 export_symbols=$output_objdir/$libname.exp
10175 $opt_dry_run || $RM $export_symbols
10176 cmds=$export_symbols_cmds
10177 save_ifs=$IFS; IFS='~'
10178 for cmd1 in $cmds; do
10180 # Take the normal branch if the nm_file_list_spec branch
10181 # doesn't work or if tool conversion is not needed.
10182 case $nm_file_list_spec~$to_tool_file_cmd in
10183 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
10184 try_normal_branch=yes
10187 len=$func_len_result
10190 try_normal_branch=no
10193 if test yes = "$try_normal_branch" \
10194 && { test "$len" -lt "$max_cmd_len" \
10195 || test "$max_cmd_len" -le -1; }
10197 func_show_eval "$cmd" 'exit $?'
10198 skipped_export=false
10199 elif test -n "$nm_file_list_spec"; then
10200 func_basename "$output"
10201 output_la=$func_basename_result
10202 save_libobjs=$libobjs
10203 save_output=$output
10204 output=$output_objdir/$output_la.nm
10205 func_to_tool_file "$output"
10206 libobjs=$nm_file_list_spec$func_to_tool_file_result
10207 func_append delfiles " $output"
10208 func_verbose "creating $NM input file list: $output"
10209 for obj in $save_libobjs; do
10210 func_to_tool_file "$obj"
10211 $ECHO "$func_to_tool_file_result"
10214 func_show_eval "$cmd" 'exit $?'
10215 output=$save_output
10216 libobjs=$save_libobjs
10217 skipped_export=false
10219 # The command line is too long to execute in one step.
10220 func_verbose "using reloadable object file for export list..."
10222 # Break out early, otherwise skipped_export may be
10223 # set to false by a later but shorter cmd.
10228 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
10229 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10230 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10235 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10236 tmp_export_symbols=$export_symbols
10237 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10238 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10241 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
10242 # The given exports_symbols file has to be filtered, so filter it.
10243 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10244 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10245 # 's' commands, which not all seds can handle. GNU sed should be fine
10246 # though. Also, the filter scales superlinearly with the number of
10247 # global variables. join(1) would be nice here, but unfortunately
10248 # isn't a blessed tool.
10249 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10250 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10251 export_symbols=$output_objdir/$libname.def
10252 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10256 for test_deplib in $deplibs; do
10257 case " $convenience " in
10258 *" $test_deplib "*) ;;
10260 func_append tmp_deplibs " $test_deplib"
10264 deplibs=$tmp_deplibs
10266 if test -n "$convenience"; then
10267 if test -n "$whole_archive_flag_spec" &&
10268 test yes = "$compiler_needs_object" &&
10269 test -z "$libobjs"; then
10270 # extract the archives, so we have objects to list.
10271 # TODO: could optimize this to just extract one archive.
10272 whole_archive_flag_spec=
10274 if test -n "$whole_archive_flag_spec"; then
10275 save_libobjs=$libobjs
10276 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10277 test "X$libobjs" = "X " && libobjs=
10279 gentop=$output_objdir/${outputname}x
10280 func_append generated " $gentop"
10282 func_extract_archives $gentop $convenience
10283 func_append libobjs " $func_extract_archives_result"
10284 test "X$libobjs" = "X " && libobjs=
10288 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
10289 eval flag=\"$thread_safe_flag_spec\"
10290 func_append linker_flags " $flag"
10293 # Make a backup of the uninstalled library when relinking
10294 if test relink = "$opt_mode"; then
10295 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
10298 # Do each of the archive commands.
10299 if test yes = "$module" && test -n "$module_cmds"; then
10300 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10301 eval test_cmds=\"$module_expsym_cmds\"
10302 cmds=$module_expsym_cmds
10304 eval test_cmds=\"$module_cmds\"
10308 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10309 eval test_cmds=\"$archive_expsym_cmds\"
10310 cmds=$archive_expsym_cmds
10312 eval test_cmds=\"$archive_cmds\"
10317 if test : != "$skipped_export" &&
10318 func_len " $test_cmds" &&
10319 len=$func_len_result &&
10320 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10323 # The command line is too long to link in one step, link piecewise
10324 # or, if using GNU ld and skipped_export is not :, use a linker
10327 # Save the value of $output and $libobjs because we want to
10328 # use them later. If we have whole_archive_flag_spec, we
10329 # want to use save_libobjs as it was before
10330 # whole_archive_flag_spec was expanded, because we can't
10331 # assume the linker understands whole_archive_flag_spec.
10332 # This may have to be revisited, in case too many
10333 # convenience libraries get linked in and end up exceeding
10335 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
10336 save_libobjs=$libobjs
10338 save_output=$output
10339 func_basename "$output"
10340 output_la=$func_basename_result
10342 # Clear the reloadable object creation command queue and
10343 # initialize k to one.
10350 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
10351 output=$output_objdir/$output_la.lnkscript
10352 func_verbose "creating GNU ld script: $output"
10353 echo 'INPUT (' > $output
10354 for obj in $save_libobjs
10356 func_to_tool_file "$obj"
10357 $ECHO "$func_to_tool_file_result" >> $output
10359 echo ')' >> $output
10360 func_append delfiles " $output"
10361 func_to_tool_file "$output"
10362 output=$func_to_tool_file_result
10363 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
10364 output=$output_objdir/$output_la.lnk
10365 func_verbose "creating linker input file list: $output"
10367 set x $save_libobjs
10370 if test yes = "$compiler_needs_object"; then
10376 func_to_tool_file "$obj"
10377 $ECHO "$func_to_tool_file_result" >> $output
10379 func_append delfiles " $output"
10380 func_to_tool_file "$output"
10381 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
10383 if test -n "$save_libobjs"; then
10384 func_verbose "creating reloadable object files..."
10385 output=$output_objdir/$output_la-$k.$objext
10386 eval test_cmds=\"$reload_cmds\"
10387 func_len " $test_cmds"
10388 len0=$func_len_result
10391 # Loop over the list of objects to be linked.
10392 for obj in $save_libobjs
10395 func_arith $len + $func_len_result
10396 len=$func_arith_result
10397 if test -z "$objlist" ||
10398 test "$len" -lt "$max_cmd_len"; then
10399 func_append objlist " $obj"
10401 # The command $test_cmds is almost too long, add a
10402 # command to the queue.
10403 if test 1 -eq "$k"; then
10404 # The first file doesn't have a previous command to add.
10405 reload_objs=$objlist
10406 eval concat_cmds=\"$reload_cmds\"
10408 # All subsequent reloadable object files will link in
10409 # the last one created.
10410 reload_objs="$objlist $last_robj"
10411 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
10413 last_robj=$output_objdir/$output_la-$k.$objext
10415 k=$func_arith_result
10416 output=$output_objdir/$output_la-$k.$objext
10418 func_len " $last_robj"
10419 func_arith $len0 + $func_len_result
10420 len=$func_arith_result
10423 # Handle the remaining objects by creating one last
10424 # reloadable object file. All subsequent reloadable object
10425 # files will link in the last one created.
10426 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10427 reload_objs="$objlist $last_robj"
10428 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
10429 if test -n "$last_robj"; then
10430 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10432 func_append delfiles " $output"
10438 ${skipped_export-false} && {
10439 func_verbose "generating symbol list for '$libname.la'"
10440 export_symbols=$output_objdir/$libname.exp
10441 $opt_dry_run || $RM $export_symbols
10443 # Append the command to create the export file.
10444 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10445 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
10446 if test -n "$last_robj"; then
10447 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10451 test -n "$save_libobjs" &&
10452 func_verbose "creating a temporary reloadable object file: $output"
10454 # Loop through the commands generated above and execute them.
10455 save_ifs=$IFS; IFS='~'
10456 for cmd in $concat_cmds; do
10459 func_quote_for_expand "$cmd"
10460 eval "func_echo $func_quote_for_expand_result"
10462 $opt_dry_run || eval "$cmd" || {
10465 # Restore the uninstalled library and exit
10466 if test relink = "$opt_mode"; then
10467 ( cd "$output_objdir" && \
10468 $RM "${realname}T" && \
10469 $MV "${realname}U" "$realname" )
10477 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
10478 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10479 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10483 ${skipped_export-false} && {
10484 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10485 tmp_export_symbols=$export_symbols
10486 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10487 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10490 if test -n "$orig_export_symbols"; then
10491 # The given exports_symbols file has to be filtered, so filter it.
10492 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10493 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10494 # 's' commands, which not all seds can handle. GNU sed should be fine
10495 # though. Also, the filter scales superlinearly with the number of
10496 # global variables. join(1) would be nice here, but unfortunately
10497 # isn't a blessed tool.
10498 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10499 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10500 export_symbols=$output_objdir/$libname.def
10501 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10506 # Restore the value of output.
10507 output=$save_output
10509 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10510 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10511 test "X$libobjs" = "X " && libobjs=
10513 # Expand the library linking commands again to reset the
10514 # value of $libobjs for piecewise linking.
10516 # Do each of the archive commands.
10517 if test yes = "$module" && test -n "$module_cmds"; then
10518 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10519 cmds=$module_expsym_cmds
10524 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10525 cmds=$archive_expsym_cmds
10532 if test -n "$delfiles"; then
10533 # Append the command to remove temporary files to $cmds.
10534 eval cmds=\"\$cmds~\$RM $delfiles\"
10537 # Add any objects from preloaded convenience libraries
10538 if test -n "$dlprefiles"; then
10539 gentop=$output_objdir/${outputname}x
10540 func_append generated " $gentop"
10542 func_extract_archives $gentop $dlprefiles
10543 func_append libobjs " $func_extract_archives_result"
10544 test "X$libobjs" = "X " && libobjs=
10547 save_ifs=$IFS; IFS='~'
10548 for cmd in $cmds; do
10553 func_quote_for_expand "$cmd"
10554 eval "func_echo $func_quote_for_expand_result"
10556 $opt_dry_run || eval "$cmd" || {
10559 # Restore the uninstalled library and exit
10560 if test relink = "$opt_mode"; then
10561 ( cd "$output_objdir" && \
10562 $RM "${realname}T" && \
10563 $MV "${realname}U" "$realname" )
10571 # Restore the uninstalled library and exit
10572 if test relink = "$opt_mode"; then
10573 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10575 if test -n "$convenience"; then
10576 if test -z "$whole_archive_flag_spec"; then
10577 func_show_eval '${RM}r "$gentop"'
10584 # Create links to the real library.
10585 for linkname in $linknames; do
10586 if test "$realname" != "$linkname"; then
10587 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10591 # If -module or -export-dynamic was specified, set the dlname.
10592 if test yes = "$module" || test yes = "$export_dynamic"; then
10593 # On all known operating systems, these are identical.
10600 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10601 func_warning "'-dlopen' is ignored for objects"
10604 case " $deplibs" in
10606 func_warning "'-l' and '-L' are ignored for objects" ;;
10609 test -n "$rpath" && \
10610 func_warning "'-rpath' is ignored for objects"
10612 test -n "$xrpath" && \
10613 func_warning "'-R' is ignored for objects"
10615 test -n "$vinfo" && \
10616 func_warning "'-version-info' is ignored for objects"
10618 test -n "$release" && \
10619 func_warning "'-release' is ignored for objects"
10623 test -n "$objs$old_deplibs" && \
10624 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10627 func_lo2o "$libobj"
10628 obj=$func_lo2o_result
10636 # Delete the old objects.
10637 $opt_dry_run || $RM $obj $libobj
10639 # Objects from convenience libraries. This assumes
10640 # single-version convenience libraries. Whenever we create
10641 # different ones for PIC/non-PIC, this we'll have to duplicate
10645 # if reload_cmds runs $LD directly, get rid of -Wl from
10646 # whole_archive_flag_spec and hope we can get by with turning comma
10648 case $reload_cmds in
10649 *\$LD[\ \$]*) wl= ;;
10651 if test -n "$convenience"; then
10652 if test -n "$whole_archive_flag_spec"; then
10653 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10654 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10655 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10657 gentop=$output_objdir/${obj}x
10658 func_append generated " $gentop"
10660 func_extract_archives $gentop $convenience
10661 reload_conv_objs="$reload_objs $func_extract_archives_result"
10665 # If we're not building shared, we need to use non_pic_objs
10666 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10668 # Create the old-style object.
10669 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10672 func_execute_cmds "$reload_cmds" 'exit $?'
10674 # Exit if we aren't doing a library object file.
10675 if test -z "$libobj"; then
10676 if test -n "$gentop"; then
10677 func_show_eval '${RM}r "$gentop"'
10683 test yes = "$build_libtool_libs" || {
10684 if test -n "$gentop"; then
10685 func_show_eval '${RM}r "$gentop"'
10688 # Create an invalid libtool object if no PIC, so that we don't
10689 # accidentally link it into a program.
10690 # $show "echo timestamp > $libobj"
10691 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10695 if test -n "$pic_flag" || test default != "$pic_mode"; then
10696 # Only do commands if we really have different PIC objects.
10697 reload_objs="$libobjs $reload_conv_objs"
10699 func_execute_cmds "$reload_cmds" 'exit $?'
10702 if test -n "$gentop"; then
10703 func_show_eval '${RM}r "$gentop"'
10711 *cygwin*) func_stripname '' '.exe' "$output"
10712 output=$func_stripname_result.exe;;
10714 test -n "$vinfo" && \
10715 func_warning "'-version-info' is ignored for programs"
10717 test -n "$release" && \
10718 func_warning "'-release' is ignored for programs"
10721 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10722 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10725 *-*-rhapsody* | *-*-darwin1.[012])
10726 # On Rhapsody replace the C library is the System framework
10727 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10728 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10734 # Don't allow lazy linking, it breaks C++ global constructors
10735 # But is supposedly fixed on 10.4 or later (yay!).
10736 if test CXX = "$tagname"; then
10737 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10739 func_append compile_command " $wl-bind_at_load"
10740 func_append finalize_command " $wl-bind_at_load"
10744 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10745 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10746 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10751 # move library search paths that coincide with paths to not yet
10752 # installed libraries to the beginning of the library search list
10754 for path in $notinst_path; do
10755 case " $new_libs " in
10756 *" -L$path/$objdir "*) ;;
10758 case " $compile_deplibs " in
10759 *" -L$path/$objdir "*)
10760 func_append new_libs " -L$path/$objdir" ;;
10765 for deplib in $compile_deplibs; do
10768 case " $new_libs " in
10770 *) func_append new_libs " $deplib" ;;
10773 *) func_append new_libs " $deplib" ;;
10776 compile_deplibs=$new_libs
10779 func_append compile_command " $compile_deplibs"
10780 func_append finalize_command " $finalize_deplibs"
10782 if test -n "$rpath$xrpath"; then
10783 # If the user specified any rpath flags, then add them.
10784 for libdir in $rpath $xrpath; do
10785 # This is the magic to use -rpath.
10786 case "$finalize_rpath " in
10788 *) func_append finalize_rpath " $libdir" ;;
10793 # Now hardcode the library paths
10796 for libdir in $compile_rpath $finalize_rpath; do
10797 if test -n "$hardcode_libdir_flag_spec"; then
10798 if test -n "$hardcode_libdir_separator"; then
10799 if test -z "$hardcode_libdirs"; then
10800 hardcode_libdirs=$libdir
10802 # Just accumulate the unique libdirs.
10803 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10804 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10807 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10812 eval flag=\"$hardcode_libdir_flag_spec\"
10813 func_append rpath " $flag"
10815 elif test -n "$runpath_var"; then
10816 case "$perm_rpath " in
10818 *) func_append perm_rpath " $libdir" ;;
10822 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10823 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10824 case :$dllsearchpath: in
10826 ::) dllsearchpath=$libdir;;
10827 *) func_append dllsearchpath ":$libdir";;
10829 case :$dllsearchpath: in
10830 *":$testbindir:"*) ;;
10831 ::) dllsearchpath=$testbindir;;
10832 *) func_append dllsearchpath ":$testbindir";;
10837 # Substitute the hardcoded libdirs into the rpath.
10838 if test -n "$hardcode_libdir_separator" &&
10839 test -n "$hardcode_libdirs"; then
10840 libdir=$hardcode_libdirs
10841 eval rpath=\" $hardcode_libdir_flag_spec\"
10843 compile_rpath=$rpath
10847 for libdir in $finalize_rpath; do
10848 if test -n "$hardcode_libdir_flag_spec"; then
10849 if test -n "$hardcode_libdir_separator"; then
10850 if test -z "$hardcode_libdirs"; then
10851 hardcode_libdirs=$libdir
10853 # Just accumulate the unique libdirs.
10854 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10855 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10858 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10863 eval flag=\"$hardcode_libdir_flag_spec\"
10864 func_append rpath " $flag"
10866 elif test -n "$runpath_var"; then
10867 case "$finalize_perm_rpath " in
10869 *) func_append finalize_perm_rpath " $libdir" ;;
10873 # Substitute the hardcoded libdirs into the rpath.
10874 if test -n "$hardcode_libdir_separator" &&
10875 test -n "$hardcode_libdirs"; then
10876 libdir=$hardcode_libdirs
10877 eval rpath=\" $hardcode_libdir_flag_spec\"
10879 finalize_rpath=$rpath
10881 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10882 # Transform all the library objects into standard objects.
10883 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10884 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10887 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10889 # template prelinking step
10890 if test -n "$prelink_cmds"; then
10891 func_execute_cmds "$prelink_cmds" 'exit $?'
10894 wrappers_required=:
10896 *cegcc* | *mingw32ce*)
10897 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10898 wrappers_required=false
10900 *cygwin* | *mingw* )
10901 test yes = "$build_libtool_libs" || wrappers_required=false
10904 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10905 wrappers_required=false
10909 $wrappers_required || {
10910 # Replace the output file specification.
10911 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10912 link_command=$compile_command$compile_rpath
10914 # We have no uninstalled library dependencies, so finalize right now.
10916 func_show_eval "$link_command" 'exit_status=$?'
10918 if test -n "$postlink_cmds"; then
10919 func_to_tool_file "$output"
10920 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10921 func_execute_cmds "$postlink_cmds" 'exit $?'
10924 # Delete the generated files.
10925 if test -f "$output_objdir/${outputname}S.$objext"; then
10926 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10932 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10933 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10935 if test -n "$finalize_shlibpath"; then
10936 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10941 if test -n "$runpath_var"; then
10942 if test -n "$perm_rpath"; then
10943 # We should set the runpath_var.
10945 for dir in $perm_rpath; do
10946 func_append rpath "$dir:"
10948 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10950 if test -n "$finalize_perm_rpath"; then
10951 # We should set the runpath_var.
10953 for dir in $finalize_perm_rpath; do
10954 func_append rpath "$dir:"
10956 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10960 if test yes = "$no_install"; then
10961 # We don't need to create a wrapper script.
10962 link_command=$compile_var$compile_command$compile_rpath
10963 # Replace the output file specification.
10964 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10965 # Delete the old output file.
10966 $opt_dry_run || $RM $output
10967 # Link the executable and exit
10968 func_show_eval "$link_command" 'exit $?'
10970 if test -n "$postlink_cmds"; then
10971 func_to_tool_file "$output"
10972 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10973 func_execute_cmds "$postlink_cmds" 'exit $?'
10979 case $hardcode_action,$fast_install in
10981 # Fast installation is not supported
10982 link_command=$compile_var$compile_command$compile_rpath
10983 relink_command=$finalize_var$finalize_command$finalize_rpath
10985 func_warning "this platform does not like uninstalled shared libraries"
10986 func_warning "'$output' will be relinked during installation"
10989 link_command=$finalize_var$compile_command$finalize_rpath
10990 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10993 link_command=$compile_var$compile_command$compile_rpath
10994 relink_command=$finalize_var$finalize_command$finalize_rpath
10997 link_command=$finalize_var$compile_command$finalize_rpath
11002 # Replace the output file specification.
11003 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
11005 # Delete the old output files.
11006 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
11008 func_show_eval "$link_command" 'exit $?'
11010 if test -n "$postlink_cmds"; then
11011 func_to_tool_file "$output_objdir/$outputname"
11012 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'`
11013 func_execute_cmds "$postlink_cmds" 'exit $?'
11016 # Now create the wrapper script.
11017 func_verbose "creating $output"
11019 # Quote the relink command for shipping.
11020 if test -n "$relink_command"; then
11021 # Preserve any variables that may affect compiler behavior
11022 for var in $variables_saved_for_relink; do
11023 if eval test -z \"\${$var+set}\"; then
11024 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11025 elif eval var_value=\$$var; test -z "$var_value"; then
11026 relink_command="$var=; export $var; $relink_command"
11028 func_quote_for_eval "$var_value"
11029 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
11032 relink_command="(cd `pwd`; $relink_command)"
11033 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
11036 # Only actually do things if not in dry run mode.
11038 # win32 will think the script is a binary if it has
11039 # a .exe suffix, so we strip it off here.
11041 *.exe) func_stripname '' '.exe' "$output"
11042 output=$func_stripname_result ;;
11044 # test for cygwin because mv fails w/o .exe extensions
11048 func_stripname '' '.exe' "$outputname"
11049 outputname=$func_stripname_result ;;
11053 *cygwin* | *mingw* )
11054 func_dirname_and_basename "$output" "" "."
11055 output_name=$func_basename_result
11056 output_path=$func_dirname_result
11057 cwrappersource=$output_path/$objdir/lt-$output_name.c
11058 cwrapper=$output_path/$output_name.exe
11059 $RM $cwrappersource $cwrapper
11060 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
11062 func_emit_cwrapperexe_src > $cwrappersource
11064 # The wrapper executable is built using the $host compiler,
11065 # because it contains $host paths and files. If cross-
11066 # compiling, it, like the target executable, must be
11067 # executed on the $host or under an emulation environment.
11069 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
11073 # Now, create the wrapper script for func_source use:
11074 func_ltwrapper_scriptname $cwrapper
11075 $RM $func_ltwrapper_scriptname_result
11076 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
11078 # note: this script will not be executed, so do not chmod.
11079 if test "x$build" = "x$host"; then
11080 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
11082 func_emit_wrapper no > $func_ltwrapper_scriptname_result
11088 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
11090 func_emit_wrapper no > $output
11099 # See if we need to build an old-fashioned archive.
11100 for oldlib in $oldlibs; do
11102 case $build_libtool_libs in
11104 oldobjs="$libobjs_save $symfileobj"
11105 addlibs=$convenience
11106 build_libtool_libs=no
11109 oldobjs=$libobjs_save
11110 addlibs=$old_convenience
11111 build_libtool_libs=no
11114 oldobjs="$old_deplibs $non_pic_objects"
11115 $preload && test -f "$symfileobj" \
11116 && func_append oldobjs " $symfileobj"
11117 addlibs=$old_convenience
11121 if test -n "$addlibs"; then
11122 gentop=$output_objdir/${outputname}x
11123 func_append generated " $gentop"
11125 func_extract_archives $gentop $addlibs
11126 func_append oldobjs " $func_extract_archives_result"
11129 # Do each command in the archive commands.
11130 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
11131 cmds=$old_archive_from_new_cmds
11134 # Add any objects from preloaded convenience libraries
11135 if test -n "$dlprefiles"; then
11136 gentop=$output_objdir/${outputname}x
11137 func_append generated " $gentop"
11139 func_extract_archives $gentop $dlprefiles
11140 func_append oldobjs " $func_extract_archives_result"
11143 # POSIX demands no paths to be encoded in archives. We have
11144 # to avoid creating archives with duplicate basenames if we
11145 # might have to extract them afterwards, e.g., when creating a
11146 # static archive out of a convenience library, or when linking
11147 # the entirety of a libtool archive into another (currently
11148 # not supported by libtool).
11149 if (for obj in $oldobjs
11151 func_basename "$obj"
11152 $ECHO "$func_basename_result"
11153 done | sort | sort -uc >/dev/null 2>&1); then
11156 echo "copying selected object files to avoid basename conflicts..."
11157 gentop=$output_objdir/${outputname}x
11158 func_append generated " $gentop"
11159 func_mkdir_p "$gentop"
11160 save_oldobjs=$oldobjs
11163 for obj in $save_oldobjs
11165 func_basename "$obj"
11166 objbase=$func_basename_result
11167 case " $oldobjs " in
11168 " ") oldobjs=$obj ;;
11169 *[\ /]"$objbase "*)
11171 # Make sure we don't pick an alternate name that also
11173 newobj=lt$counter-$objbase
11174 func_arith $counter + 1
11175 counter=$func_arith_result
11176 case " $oldobjs " in
11177 *[\ /]"$newobj "*) ;;
11178 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
11181 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
11182 func_append oldobjs " $gentop/$newobj"
11184 *) func_append oldobjs " $obj" ;;
11188 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
11189 tool_oldlib=$func_to_tool_file_result
11190 eval cmds=\"$old_archive_cmds\"
11193 len=$func_len_result
11194 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
11195 cmds=$old_archive_cmds
11196 elif test -n "$archiver_list_spec"; then
11197 func_verbose "using command file archive linking..."
11198 for obj in $oldobjs
11200 func_to_tool_file "$obj"
11201 $ECHO "$func_to_tool_file_result"
11202 done > $output_objdir/$libname.libcmd
11203 func_to_tool_file "$output_objdir/$libname.libcmd"
11204 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
11205 cmds=$old_archive_cmds
11207 # the command line is too long to link in one step, link in parts
11208 func_verbose "using piecewise archive linking..."
11209 save_RANLIB=$RANLIB
11213 save_oldobjs=$oldobjs
11215 # Is there a better way of finding the last object in the list?
11216 for obj in $save_oldobjs
11220 eval test_cmds=\"$old_archive_cmds\"
11221 func_len " $test_cmds"
11222 len0=$func_len_result
11224 for obj in $save_oldobjs
11227 func_arith $len + $func_len_result
11228 len=$func_arith_result
11229 func_append objlist " $obj"
11230 if test "$len" -lt "$max_cmd_len"; then
11233 # the above command should be used before it gets too long
11235 if test "$obj" = "$last_oldobj"; then
11236 RANLIB=$save_RANLIB
11238 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
11239 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
11244 RANLIB=$save_RANLIB
11246 if test -z "$oldobjs"; then
11247 eval cmds=\"\$concat_cmds\"
11249 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
11253 func_execute_cmds "$cmds" 'exit $?'
11256 test -n "$generated" && \
11257 func_show_eval "${RM}r$generated"
11259 # Now create the libtool archive.
11263 test yes = "$build_old_libs" && old_library=$libname.$libext
11264 func_verbose "creating $output"
11266 # Preserve any variables that may affect compiler behavior
11267 for var in $variables_saved_for_relink; do
11268 if eval test -z \"\${$var+set}\"; then
11269 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11270 elif eval var_value=\$$var; test -z "$var_value"; then
11271 relink_command="$var=; export $var; $relink_command"
11273 func_quote_for_eval "$var_value"
11274 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
11277 # Quote the link command for shipping.
11278 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
11279 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
11280 if test yes = "$hardcode_automatic"; then
11284 # Only create the output if not a dry run.
11286 for installed in no yes; do
11287 if test yes = "$installed"; then
11288 if test -z "$install_libdir"; then
11291 output=$output_objdir/${outputname}i
11292 # Replace all uninstalled libtool libraries with the installed ones
11293 newdependency_libs=
11294 for deplib in $dependency_libs; do
11297 func_basename "$deplib"
11298 name=$func_basename_result
11299 func_resolve_sysroot "$deplib"
11300 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
11301 test -z "$libdir" && \
11302 func_fatal_error "'$deplib' is not a valid libtool archive"
11303 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
11306 func_stripname -L '' "$deplib"
11307 func_replace_sysroot "$func_stripname_result"
11308 func_append newdependency_libs " -L$func_replace_sysroot_result"
11311 func_stripname -R '' "$deplib"
11312 func_replace_sysroot "$func_stripname_result"
11313 func_append newdependency_libs " -R$func_replace_sysroot_result"
11315 *) func_append newdependency_libs " $deplib" ;;
11318 dependency_libs=$newdependency_libs
11321 for lib in $dlfiles; do
11324 func_basename "$lib"
11325 name=$func_basename_result
11326 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11327 test -z "$libdir" && \
11328 func_fatal_error "'$lib' is not a valid libtool archive"
11329 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
11331 *) func_append newdlfiles " $lib" ;;
11334 dlfiles=$newdlfiles
11336 for lib in $dlprefiles; do
11339 # Only pass preopened files to the pseudo-archive (for
11340 # eventual linking with the app. that links it) if we
11341 # didn't already link the preopened objects directly into
11343 func_basename "$lib"
11344 name=$func_basename_result
11345 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11346 test -z "$libdir" && \
11347 func_fatal_error "'$lib' is not a valid libtool archive"
11348 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
11352 dlprefiles=$newdlprefiles
11355 for lib in $dlfiles; do
11357 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11358 *) abs=`pwd`"/$lib" ;;
11360 func_append newdlfiles " $abs"
11362 dlfiles=$newdlfiles
11364 for lib in $dlprefiles; do
11366 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11367 *) abs=`pwd`"/$lib" ;;
11369 func_append newdlprefiles " $abs"
11371 dlprefiles=$newdlprefiles
11374 # place dlname in correct position for cygwin
11375 # In fact, it would be nice if we could use this code for all target
11376 # systems that can't hard-code library paths into their executables
11377 # and that have no shared library path variable independent of PATH,
11378 # but it turns out we can't easily determine that from inspecting
11379 # libtool variables, so we have to hard-code the OSs to which it
11380 # applies here; at the moment, that means platforms that use the PE
11381 # object format with DLL files. See the long comment at the top of
11382 # tests/bindir.at for full details.
11384 case $host,$output,$installed,$module,$dlname in
11385 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
11386 # If a -bindir argument was supplied, place the dll there.
11387 if test -n "$bindir"; then
11388 func_relative_path "$install_libdir" "$bindir"
11389 tdlname=$func_relative_path_result/$dlname
11391 # Otherwise fall back on heuristic.
11392 tdlname=../bin/$dlname
11397 # $outputname - a libtool library file
11398 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
11400 # Please DO NOT delete this file!
11401 # It is necessary for linking the library.
11403 # The name that we can dlopen(3).
11406 # Names of this library.
11407 library_names='$library_names'
11409 # The name of the static archive.
11410 old_library='$old_library'
11412 # Linker flags that cannot go in dependency_libs.
11413 inherited_linker_flags='$new_inherited_linker_flags'
11415 # Libraries that this one depends upon.
11416 dependency_libs='$dependency_libs'
11418 # Names of additional weak libraries provided by this library
11419 weak_library_names='$weak_libs'
11421 # Version information for $libname.
11426 # Is this an already installed library?
11427 installed=$installed
11429 # Should we warn about portability when linking against -modules?
11430 shouldnotlink=$module
11432 # Files to dlopen/dlpreopen
11434 dlpreopen='$dlprefiles'
11436 # Directory that this library needs to be installed in:
11437 libdir='$install_libdir'"
11438 if test no,yes = "$installed,$need_relink"; then
11439 $ECHO >> $output "\
11440 relink_command=\"$relink_command\""
11445 # Do a symbolic link so that the libtool archive can be found in
11446 # LD_LIBRARY_PATH before the program is installed.
11447 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
11453 if test link = "$opt_mode" || test relink = "$opt_mode"; then
11454 func_mode_link ${1+"$@"}
11458 # func_mode_uninstall arg...
11459 func_mode_uninstall ()
11468 # This variable tells wrapper scripts just to set variables rather
11469 # than running their programs.
11470 libtool_install_magic=$magic
11475 -f) func_append RM " $arg"; rmforce=: ;;
11476 -*) func_append RM " $arg" ;;
11477 *) func_append files " $arg" ;;
11482 func_fatal_help "you must specify an RM program"
11486 for file in $files; do
11487 func_dirname "$file" "" "."
11488 dir=$func_dirname_result
11489 if test . = "$dir"; then
11494 func_basename "$file"
11495 name=$func_basename_result
11496 test uninstall = "$opt_mode" && odir=$dir
11498 # Remember odir for removal later, being careful to avoid duplicates
11499 if test clean = "$opt_mode"; then
11500 case " $rmdirs " in
11502 *) func_append rmdirs " $odir" ;;
11506 # Don't error if the file doesn't exist and rm -f was used.
11507 if { test -L "$file"; } >/dev/null 2>&1 ||
11508 { test -h "$file"; } >/dev/null 2>&1 ||
11509 test -f "$file"; then
11511 elif test -d "$file"; then
11514 elif $rmforce; then
11522 # Possibly a libtool archive, so verify it.
11523 if func_lalib_p "$file"; then
11524 func_source $dir/$name
11526 # Delete the libtool libraries and symlinks.
11527 for n in $library_names; do
11528 func_append rmfiles " $odir/$n"
11530 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11534 case " $library_names " in
11536 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11538 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11541 if test -n "$library_names"; then
11542 # Do each command in the postuninstall commands.
11543 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11546 if test -n "$old_library"; then
11547 # Do each command in the old_postuninstall commands.
11548 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11550 # FIXME: should reinstall the best remaining shared library.
11557 # Possibly a libtool object, so verify it.
11558 if func_lalib_p "$file"; then
11560 # Read the .lo file
11561 func_source $dir/$name
11563 # Add PIC object to the list of files to remove.
11564 if test -n "$pic_object" && test none != "$pic_object"; then
11565 func_append rmfiles " $dir/$pic_object"
11568 # Add non-PIC object to the list of files to remove.
11569 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11570 func_append rmfiles " $dir/$non_pic_object"
11576 if test clean = "$opt_mode"; then
11580 func_stripname '' '.exe' "$file"
11581 file=$func_stripname_result
11582 func_stripname '' '.exe' "$name"
11583 noexename=$func_stripname_result
11584 # $file with .exe has already been added to rmfiles,
11585 # add $file without .exe
11586 func_append rmfiles " $file"
11589 # Do a test to see if this is a libtool program.
11590 if func_ltwrapper_p "$file"; then
11591 if func_ltwrapper_executable_p "$file"; then
11592 func_ltwrapper_scriptname "$file"
11594 func_source $func_ltwrapper_scriptname_result
11595 func_append rmfiles " $func_ltwrapper_scriptname_result"
11598 func_source $dir/$noexename
11601 # note $name still contains .exe if it was in $file originally
11602 # as does the version of $file that was added into $rmfiles
11603 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11604 if test yes = "$fast_install" && test -n "$relink_command"; then
11605 func_append rmfiles " $odir/lt-$name"
11607 if test "X$noexename" != "X$name"; then
11608 func_append rmfiles " $odir/lt-$noexename.c"
11614 func_show_eval "$RM $rmfiles" 'exit_status=1'
11617 # Try to remove the $objdir's in the directories where we deleted files
11618 for dir in $rmdirs; do
11619 if test -d "$dir"; then
11620 func_show_eval "rmdir $dir >/dev/null 2>&1"
11627 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11628 func_mode_uninstall ${1+"$@"}
11631 test -z "$opt_mode" && {
11633 func_fatal_help "you must specify a MODE"
11636 test -z "$exec_cmd" && \
11637 func_fatal_help "invalid operation mode '$opt_mode'"
11639 if test -n "$exec_cmd"; then
11640 eval exec "$exec_cmd"
11647 # The TAGs below are defined such that we never get into a situation
11648 # where we disable both kinds of libraries. Given conflicting
11649 # choices, we go for a static library, that is the most portable,
11650 # since we can't tell whether shared libraries were disabled because
11651 # the user asked for that or because the platform doesn't support
11652 # them. This is particularly important on AIX, because we don't
11653 # support having both static and shared libraries enabled at the same
11654 # time on that platform, so we default to a shared-only configuration.
11655 # If a disable-shared tag is given, we'll fallback to a static-only
11656 # configuration. But we'll never go from static-only to shared-only.
11658 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11659 build_libtool_libs=no
11661 # ### END LIBTOOL TAG CONFIG: disable-shared
11663 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11664 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11665 # ### END LIBTOOL TAG CONFIG: disable-static
11668 # mode:shell-script
11672 # ### BEGIN LIBTOOL TAG CONFIG: CXX
11674 # The linker used to build libraries.
11675 LD="/usr/bin/ld -m elf_x86_64"
11677 # How to create reloadable object files.
11679 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
11681 # Commands used to build an old-style archive.
11682 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
11684 # A language specific compiler.
11687 # Is the compiler the GNU compiler?
11690 # Compiler flag to turn off builtin functions.
11691 no_builtin_flag=" -fno-builtin"
11693 # Additional compiler flags for building library objects.
11694 pic_flag=" -fPIC -DPIC"
11696 # How to pass a linker flag through the compiler.
11699 # Compiler flag to prevent dynamic linking.
11700 link_static_flag="-static"
11702 # Does compiler simultaneously support -c and -o options?
11705 # Whether or not to add -lc for building shared libraries.
11706 build_libtool_need_lc=no
11708 # Whether or not to disallow shared libs when runtime libs are static.
11709 allow_libtool_libs_with_static_runtimes=no
11711 # Compiler flag to allow reflexive dlopens.
11712 export_dynamic_flag_spec="\$wl--export-dynamic"
11714 # Compiler flag to generate shared objects directly from archives.
11715 whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
11717 # Whether the compiler copes with passing no objects directly.
11718 compiler_needs_object="no"
11720 # Create an old-style archive from a shared archive.
11721 old_archive_from_new_cmds=""
11723 # Create a temporary old-style archive to link instead of a shared archive.
11724 old_archive_from_expsyms_cmds=""
11726 # Commands used to build a shared archive.
11727 archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
11728 archive_expsym_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \$wl-soname \$wl\$soname \$wl-retain-symbols-file \$wl\$export_symbols -o \$lib"
11730 # Commands used to build a loadable module if different from building
11731 # a shared archive.
11733 module_expsym_cmds=""
11735 # Whether we are building with GNU ld or not.
11738 # Flag that allows shared libraries with undefined symbols to be built.
11739 allow_undefined_flag=""
11741 # Flag that enforces no undefined symbols.
11742 no_undefined_flag=""
11744 # Flag to hardcode $libdir into a binary during linking.
11745 # This must work even if $libdir does not exist
11746 hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
11748 # Whether we need a single "-rpath" flag with a separated argument.
11749 hardcode_libdir_separator=""
11751 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
11752 # DIR into the resulting binary.
11755 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
11756 # DIR into the resulting binary and the resulting library dependency is
11757 # "absolute",i.e impossible to change by setting $shlibpath_var if the
11758 # library is relocated.
11759 hardcode_direct_absolute=no
11761 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
11762 # into the resulting binary.
11763 hardcode_minus_L=no
11765 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
11766 # into the resulting binary.
11767 hardcode_shlibpath_var=unsupported
11769 # Set to "yes" if building a shared library automatically hardcodes DIR
11770 # into the library and all subsequent libraries and executables linked
11772 hardcode_automatic=no
11774 # Set to yes if linker adds runtime paths of dependent libraries
11775 # to runtime path list.
11778 # Whether libtool must link a program against all its dependency libraries.
11779 link_all_deplibs=no
11781 # Set to "yes" if exported symbols are required.
11782 always_export_symbols=no
11784 # The commands to list exported symbols.
11785 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
11787 # Symbols that should not be listed in the preloaded symbols.
11788 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
11790 # Symbols that must always be exported.
11793 # Commands necessary for linking programs (against libraries) with templates.
11796 # Commands necessary for finishing linking programs.
11799 # Specify filename containing input files.
11802 # How to hardcode a shared library path into an executable.
11803 hardcode_action=immediate
11805 # The directories searched by this compiler when creating a shared library.
11806 compiler_lib_search_dirs="/usr/lib/gcc/x86_64-linux-gnu/7 /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /usr/lib/gcc/x86_64-linux-gnu/7/../../.."
11808 # Dependencies to place before and after the objects being linked to
11809 # create a shared library.
11810 predep_objects="/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o"
11811 postdep_objects="/usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o"
11813 postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
11815 # The library search path used internally by the compiler when linking
11816 # a shared library.
11817 compiler_lib_search_path="-L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.."
11819 # ### END LIBTOOL TAG CONFIG: CXX