2 # Generated automatically by config.status (jerasure) 2.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?
43 # Whether or not to build static libraries.
46 # Whether or not to build shared libraries.
47 build_libtool_libs=yes
49 # What type of objects to build.
52 # Whether or not to optimize for fast installation.
55 # Shared archive member basename,for filename based shared library versioning on AIX.
56 shared_archive_member_spec=
58 # Shell to use when invoking shell scripts.
61 # An echo program that protects backslashes.
64 # The PATH separator for the build system.
69 host=x86_64-pc-linux-gnu
74 build=x86_64-pc-linux-gnu
77 # A sed program that does not truncate output.
80 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
81 Xsed="$SED -e 1s/^X//"
83 # A grep program that handles long lines.
89 # A literal string matcher.
92 # A BSD- or MS-compatible name lister.
95 # Whether we need soft or hard links.
98 # What is the maximum length of a command?
101 # Object file suffix (normally "o").
104 # Executable file suffix (normally "").
107 # whether the shell understands "unset".
110 # turn spaces into newlines.
111 SP2NL="tr \\040 \\012"
113 # turn newlines into spaces.
114 NL2SP="tr \\015\\012 \\040\\040"
116 # convert $build file names to $host format.
117 to_host_file_cmd=func_convert_file_noop
119 # convert $build files to toolchain format.
120 to_tool_file_cmd=func_convert_file_noop
122 # An object symbol dumper.
125 # Method to check whether dependent libraries are shared objects.
126 deplibs_check_method="pass_all"
128 # Command to use when deplibs_check_method = "file_magic".
129 file_magic_cmd="\$MAGIC_CMD"
131 # How to find potential files when deplibs_check_method = "file_magic".
134 # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
137 # DLL creation program.
140 # Command to associate shared and link libraries.
141 sharedlib_from_linklib_cmd="printf %s\\n"
146 # Flags to create an archive.
149 # How to feed a file listing to the archiver.
150 archiver_list_spec="@"
152 # A symbol stripping program.
155 # Commands used to install an old-style archive.
157 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
158 old_postuninstall_cmds=""
160 # Whether to use a lock for old archive extraction.
161 lock_old_archive_extraction=no
166 # LTCC compiler flags.
167 LTCFLAGS="-g -O3 -Wall"
169 # Take the output of nm and produce a listing of raw symbols and C names.
170 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
172 # Transform the output of nm in a proper C declaration.
173 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
175 # Transform the output of nm into a list of symbols to manually relocate.
176 global_symbol_to_import=""
178 # Transform the output of nm in a C name address pair.
179 global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'"
181 # Transform the output of nm in a C name address pair when lib prefix is needed.
182 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'"
184 # The name lister interface.
185 nm_interface="BSD nm"
187 # Specify filename containing input files for $NM.
188 nm_file_list_spec="@"
190 # The root where to search for dependent libraries,and where our libraries should be installed.
193 # Command to truncate a binary pipe.
194 lt_truncate_bin="/bin/dd bs=4096 count=1"
196 # The name of the directory that contains temporary libtool files.
199 # Used to examine libraries when file_magic_cmd begins with "file".
202 # Must we lock files when doing compilation?
208 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
211 # Tool to change global to local symbols on Mac OS X.
214 # Tool to manipulate fat objects and archives on Mac OS X.
217 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
220 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
223 # Old archive suffix (normally "a").
226 # Shared library suffix (normally ".so").
229 # The commands to extract the exported symbol list from a shared archive.
230 extract_expsyms_cmds=""
232 # Variables whose values should be saved in libtool wrapper scripts and
233 # restored at link time.
234 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
236 # Do we need the "lib" prefix for modules?
239 # Do we need a version for libraries?
242 # Library versioning type.
245 # Shared library runtime path variable.
246 runpath_var=LD_RUN_PATH
248 # Shared library path variable.
249 shlibpath_var=LD_LIBRARY_PATH
251 # Is shlibpath searched before the hard-coded library search path?
252 shlibpath_overrides_runpath=yes
254 # Format of library name prefix.
255 libname_spec="lib\$name"
257 # List of archive names. First name is the real one, the rest are links.
258 # The last name is the one that the linker finds with -lNAME
259 library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
261 # The coded name of the library, if different from the real name.
262 soname_spec="\$libname\$release\$shared_ext\$major"
264 # Permission mode override for installation of shared libraries.
265 install_override_mode=""
267 # Command to use after installation of a shared archive.
270 # Command to use after uninstallation of a shared archive.
271 postuninstall_cmds=""
273 # Commands used to finish a libtool library installation in a directory.
274 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
276 # As "finish_cmds", except a single script fragment to be evaled but
280 # Whether we should hardcode library paths into libraries.
281 hardcode_into_libs=yes
283 # Compile-time system search path for libraries.
284 sys_lib_search_path_spec="/home/couturie/TestU01-inst/lib /usr/lib/gcc/x86_64-linux-gnu/6 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib "
286 # Detected run-time system search path for libraries.
287 sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/lib32 /usr/local/lib /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu "
289 # Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
290 configure_time_lt_sys_library_path=""
292 # Whether dlopen is supported.
293 dlopen_support=unknown
295 # Whether dlopen of programs is supported.
298 # Whether dlopen of statically linked programs is supported.
299 dlopen_self_static=unknown
301 # Commands to strip libraries.
302 old_striplib="strip --strip-debug"
303 striplib="strip --strip-unneeded"
306 # The linker used to build libraries.
307 LD="/usr//bin//ld -m elf_x86_64"
309 # How to create reloadable object files.
311 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
313 # Commands used to build an old-style archive.
314 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
316 # A language specific compiler.
319 # Is the compiler the GNU compiler?
322 # Compiler flag to turn off builtin functions.
323 no_builtin_flag=" -fno-builtin"
325 # Additional compiler flags for building library objects.
326 pic_flag=" -fPIC -DPIC"
328 # How to pass a linker flag through the compiler.
331 # Compiler flag to prevent dynamic linking.
332 link_static_flag="-static"
334 # Does compiler simultaneously support -c and -o options?
337 # Whether or not to add -lc for building shared libraries.
338 build_libtool_need_lc=no
340 # Whether or not to disallow shared libs when runtime libs are static.
341 allow_libtool_libs_with_static_runtimes=no
343 # Compiler flag to allow reflexive dlopens.
344 export_dynamic_flag_spec="\$wl--export-dynamic"
346 # Compiler flag to generate shared objects directly from archives.
347 whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
349 # Whether the compiler copes with passing no objects directly.
350 compiler_needs_object="no"
352 # Create an old-style archive from a shared archive.
353 old_archive_from_new_cmds=""
355 # Create a temporary old-style archive to link instead of a shared archive.
356 old_archive_from_expsyms_cmds=""
358 # Commands used to build a shared archive.
359 archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
360 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
361 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
362 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
363 \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
365 # Commands used to build a loadable module if different from building
368 module_expsym_cmds=""
370 # Whether we are building with GNU ld or not.
373 # Flag that allows shared libraries with undefined symbols to be built.
374 allow_undefined_flag=""
376 # Flag that enforces no undefined symbols.
379 # Flag to hardcode $libdir into a binary during linking.
380 # This must work even if $libdir does not exist
381 hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
383 # Whether we need a single "-rpath" flag with a separated argument.
384 hardcode_libdir_separator=""
386 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
387 # DIR into the resulting binary.
390 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
391 # DIR into the resulting binary and the resulting library dependency is
392 # "absolute",i.e impossible to change by setting $shlibpath_var if the
393 # library is relocated.
394 hardcode_direct_absolute=no
396 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
397 # into the resulting binary.
400 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
401 # into the resulting binary.
402 hardcode_shlibpath_var=unsupported
404 # Set to "yes" if building a shared library automatically hardcodes DIR
405 # into the library and all subsequent libraries and executables linked
407 hardcode_automatic=no
409 # Set to yes if linker adds runtime paths of dependent libraries
410 # to runtime path list.
413 # Whether libtool must link a program against all its dependency libraries.
416 # Set to "yes" if exported symbols are required.
417 always_export_symbols=no
419 # The commands to list exported symbols.
420 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
422 # Symbols that should not be listed in the preloaded symbols.
423 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
425 # Symbols that must always be exported.
428 # Commands necessary for linking programs (against libraries) with templates.
431 # Commands necessary for finishing linking programs.
434 # Specify filename containing input files.
437 # How to hardcode a shared library path into an executable.
438 hardcode_action=immediate
440 # The directories searched by this compiler when creating a shared library.
441 compiler_lib_search_dirs=""
443 # Dependencies to place before and after the objects being linked to
444 # create a shared library.
450 # The library search path used internally by the compiler when linking
452 compiler_lib_search_path=""
454 # ### END LIBTOOL CONFIG
457 # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
459 # func_munge_path_list VARIABLE PATH
460 # -----------------------------------
461 # VARIABLE is name of variable containing _space_ separated list of
462 # directories to be munged by the contents of PATH, which is string
465 # string "DIR[ DIR]" will be prepended to VARIABLE
467 # string "DIR[ DIR]" will be appended to VARIABLE
468 # "DIRP[:DIRP]::[DIRA:]DIRA"
469 # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
470 # "DIRA[ DIRA]" will be appended to VARIABLE
472 # VARIABLE will be replaced by "DIR[ DIR]"
473 func_munge_path_list ()
479 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
482 eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
485 eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
486 eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
489 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
495 # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
498 for cc_temp in $*""; do
500 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
501 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
506 func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
510 # ### END FUNCTIONS SHARED WITH CONFIGURE
513 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
514 ## by inline-source v2014-01-03.01
516 # libtool (GNU libtool) 2.4.6
517 # Provide generalized library-building support services.
518 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
520 # Copyright (C) 1996-2015 Free Software Foundation, Inc.
521 # This is free software; see the source for copying conditions. There is NO
522 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
524 # GNU Libtool is free software; you can redistribute it and/or modify
525 # it under the terms of the GNU General Public License as published by
526 # the Free Software Foundation; either version 2 of the License, or
527 # (at your option) any later version.
529 # As a special exception to the GNU General Public License,
530 # if you distribute this file as part of a program or library that
531 # is built using GNU Libtool, you may include this file under the
532 # same distribution terms that you use for the rest of that program.
534 # GNU Libtool is distributed in the hope that it will be useful, but
535 # WITHOUT ANY WARRANTY; without even the implied warranty of
536 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
537 # General Public License for more details.
539 # You should have received a copy of the GNU General Public License
540 # along with this program. If not, see <http://www.gnu.org/licenses/>.
545 VERSION="2.4.6 Debian-2.4.6-2"
546 package_revision=2.4.6
553 # Run './libtool --help' for help with using this script from the
557 ## ------------------------------- ##
558 ## User overridable command paths. ##
559 ## ------------------------------- ##
561 # After configure completes, it has a better idea of some of the
562 # shell tools we need than the defaults used by the functions shared
563 # with bootstrap, so set those here where they can still be over-
564 # ridden by the user, but otherwise take precedence.
566 : ${AUTOCONF="autoconf"}
567 : ${AUTOMAKE="automake"}
570 ## -------------------------- ##
571 ## Source external libraries. ##
572 ## -------------------------- ##
574 # Much of our low-level functionality needs to be sourced from external
575 # libraries, which are installed to $pkgauxdir.
577 # Set a version string for this script.
578 scriptversion=2015-01-20.17; # UTC
580 # General shell script boiler plate, and helper functions.
581 # Written by Gary V. Vaughan, 2004
583 # Copyright (C) 2004-2015 Free Software Foundation, Inc.
584 # This is free software; see the source for copying conditions. There is NO
585 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
587 # This program is free software; you can redistribute it and/or modify
588 # it under the terms of the GNU General Public License as published by
589 # the Free Software Foundation; either version 3 of the License, or
590 # (at your option) any later version.
592 # As a special exception to the GNU General Public License, if you distribute
593 # this file as part of a program or library that is built using GNU Libtool,
594 # you may include this file under the same distribution terms that you use
595 # for the rest of that program.
597 # This program is distributed in the hope that it will be useful,
598 # but WITHOUT ANY WARRANTY; without even the implied warranty of
599 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
600 # General Public License for more details.
602 # You should have received a copy of the GNU General Public License
603 # along with this program. If not, see <http://www.gnu.org/licenses/>.
605 # Please report bugs or propose patches to gary@gnu.org.
612 # Evaluate this file near the top of your script to gain access to
613 # the functions and variables defined here:
615 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
617 # If you need to override any of the default environment variable
618 # settings, do that before evaluating this file.
621 ## -------------------- ##
622 ## Shell normalisation. ##
623 ## -------------------- ##
625 # Some shells need a little help to be as Bourne compatible as possible.
626 # Before doing anything else, make sure all that help has been provided!
628 DUALCASE=1; export DUALCASE # for MKS sh
629 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
632 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
633 # is contrary to our usage. Disable this feature.
634 alias -g '${1+"$@"}'='"$@"'
637 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
640 # NLS nuisances: We save the old values in case they are required later.
643 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
645 eval "if test set = \"\${$_G_var+set}\"; then
646 save_$_G_var=\$$_G_var
649 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
650 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
655 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
657 # Make sure IFS has a sensible default
663 # There are apparently some retarded systems that use ';' as a PATH separator!
664 if test "${PATH_SEPARATOR+set}" != set; then
666 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
667 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
674 ## ------------------------- ##
675 ## Locate command utilities. ##
676 ## ------------------------- ##
679 # func_executable_p FILE
680 # ----------------------
681 # Check that FILE is an executable regular file.
684 test -f "$1" && test -x "$1"
688 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
689 # --------------------------------------------
690 # Search for either a program that responds to --version with output
691 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
692 # trying all the directories in PATH with each of the elements of
695 # CHECK_FUNC should accept the path to a candidate program, and
696 # set $func_check_prog_result if it truncates its output less than
697 # $_G_path_prog_max characters.
705 _G_path_prog_found=false
706 _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
707 for _G_dir in $_G_PATH; do
709 test -z "$_G_dir" && _G_dir=.
710 for _G_prog_name in $_G_progs_list; do
711 for _exeext in '' .EXE; do
712 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
713 func_executable_p "$_G_path_prog" || continue
714 case `"$_G_path_prog" --version 2>&1` in
715 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
716 *) $_G_check_func $_G_path_prog
717 func_path_progs_result=$func_check_prog_result
720 $_G_path_prog_found && break 3
725 test -z "$func_path_progs_result" && {
726 echo "no acceptable sed could be found in \$PATH" >&2
732 # We want to be able to use the functions in this file before configure
733 # has figured out where the best binaries are kept, which means we have
734 # to search for them ourselves - except when the results are already set
735 # where we skip the searches.
737 # Unless the user overrides by setting SED, search the path for either GNU
738 # sed, or the sed that truncates its output the least.
740 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
741 for _G_i in 1 2 3 4 5 6 7; do
742 _G_sed_script=$_G_sed_script$nl$_G_sed_script
744 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
747 func_check_prog_sed ()
752 printf 0123456789 >conftest.in
755 cat conftest.in conftest.in >conftest.tmp
756 mv conftest.tmp conftest.in
757 cp conftest.in conftest.nl
758 echo '' >> conftest.nl
759 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
760 diff conftest.out conftest.nl >/dev/null 2>&1 || break
761 _G_count=`expr $_G_count + 1`
762 if test "$_G_count" -gt "$_G_path_prog_max"; then
763 # Best one so far, save it but keep looking for a better one
764 func_check_prog_result=$_G_path_prog
765 _G_path_prog_max=$_G_count
767 # 10*(2^10) chars as input seems more than enough
768 test 10 -lt "$_G_count" && break
770 rm -f conftest.in conftest.tmp conftest.nl conftest.out
773 func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
775 SED=$func_path_progs_result
779 # Unless the user overrides by setting GREP, search the path for either GNU
780 # grep, or the grep that truncates its output the least.
782 func_check_prog_grep ()
788 printf 0123456789 >conftest.in
791 cat conftest.in conftest.in >conftest.tmp
792 mv conftest.tmp conftest.in
793 cp conftest.in conftest.nl
794 echo 'GREP' >> conftest.nl
795 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
796 diff conftest.out conftest.nl >/dev/null 2>&1 || break
797 _G_count=`expr $_G_count + 1`
798 if test "$_G_count" -gt "$_G_path_prog_max"; then
799 # Best one so far, save it but keep looking for a better one
800 func_check_prog_result=$_G_path_prog
801 _G_path_prog_max=$_G_count
803 # 10*(2^10) chars as input seems more than enough
804 test 10 -lt "$_G_count" && break
806 rm -f conftest.in conftest.tmp conftest.nl conftest.out
809 func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
810 GREP=$func_path_progs_result
814 ## ------------------------------- ##
815 ## User overridable command paths. ##
816 ## ------------------------------- ##
818 # All uppercase variable names are used for environment variables. These
819 # variables can be overridden by the user before calling a script that
820 # uses them if a suitable command of that name is not already available
821 # in the command search PATH.
824 : ${ECHO="printf %s\n"}
825 : ${EGREP="$GREP -E"}
826 : ${FGREP="$GREP -F"}
832 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
835 ## -------------------- ##
836 ## Useful sed snippets. ##
837 ## -------------------- ##
839 sed_dirname='s|/[^/]*$||'
840 sed_basename='s|^.*/||'
842 # Sed substitution that helps us do robust quoting. It backslashifies
843 # metacharacters that are still active within double-quoted strings.
844 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
846 # Same as above, but do not quote variable references.
847 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
849 # Sed substitution that turns a string into a regex matching for the
851 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
853 # Sed substitution that converts a w32 file name or path
854 # that contains forward slashes, into one that contains
855 # (escaped) backslashes. A very naive implementation.
856 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
858 # Re-'\' parameter expansions in output of sed_double_quote_subst that
859 # were '\'-ed in input to the same. If an odd number of '\' preceded a
860 # '$' in input to sed_double_quote_subst, that '$' was protected from
861 # expansion. Since each input '\' is now two '\'s, look for any number
862 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
867 sed_double_backslash="\
870 s/^$_G_bs2$_G_dollar/$_G_bs&/
871 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
875 ## ----------------- ##
876 ## Global variables. ##
877 ## ----------------- ##
879 # Except for the global variables explicitly listed below, the following
880 # functions in the '^func_' namespace, and the '^require_' namespace
881 # variables initialised in the 'Resource management' section, sourcing
882 # this file will not pollute your global namespace with anything
883 # else. There's no portable way to scope variables in Bourne shell
884 # though, so actually running these functions will sometimes place
885 # results into a variable named after the function, and often use
886 # temporary variables in the '^_G_' namespace. If you are careful to
887 # avoid using those namespaces casually in your sourcing script, things
888 # should continue to work as you expect. And, of course, you can freely
889 # overwrite any of the functions or variables defined here before
890 # calling anything to customize them.
894 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
895 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
897 # Allow overriding, eg assuming that you follow the convention of
898 # putting '$debug_cmd' at the start of all your functions, you can get
899 # bash to show function call trace with:
901 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
902 debug_cmd=${debug_cmd-":"}
905 # By convention, finish your script with:
909 # so that you can set exit_status to non-zero if you want to indicate
910 # something went wrong during execution without actually bailing out at
911 # the point of failure.
912 exit_status=$EXIT_SUCCESS
914 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
915 # is ksh but when the shell is invoked as "sh" and the current value of
916 # the _XPG environment variable is not equal to 1 (one), the special
917 # positional parameter $0, within a function call, is the name of the
921 # The name of this program.
922 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
924 # Make sure we have an absolute progpath for reexecution:
926 [\\/]*|[A-Za-z]:\\*) ;;
928 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
929 progdir=`cd "$progdir" && pwd`
930 progpath=$progdir/$progname
934 IFS=${PATH_SEPARATOR-:}
935 for progdir in $PATH; do
937 test -x "$progdir/$progname" && break
940 test -n "$progdir" || progdir=`pwd`
941 progpath=$progdir/$progname
946 ## ----------------- ##
947 ## Standard options. ##
948 ## ----------------- ##
950 # The following options affect the operation of the functions defined
951 # below, and should be set appropriately depending on run-time para-
952 # meters passed on the command line.
958 # Categories 'all' and 'none' are always available. Append any others
959 # you will pass as the first argument to func_warning from your own
963 # By default, display warnings according to 'opt_warning_types'. Set
964 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
965 # treat the next displayed warning as a fatal error.
966 warning_func=func_warn_and_continue
968 # Set to 'all' to display all warnings, 'none' to suppress all
969 # warnings, or a space delimited list of some subset of
970 # 'warning_categories' to display only the listed warnings.
971 opt_warning_types=all
974 ## -------------------- ##
975 ## Resource management. ##
976 ## -------------------- ##
978 # This section contains definitions for functions that each ensure a
979 # particular resource (a file, or a non-empty configuration variable for
980 # example) is available, and if appropriate to extract default values
981 # from pertinent package files. Call them using their associated
982 # 'require_*' variable to ensure that they are executed, at most, once.
984 # It's entirely deliberate that calling these functions can set
985 # variables that don't obey the namespace limitations obeyed by the rest
986 # of this file, in order that that they be as useful as possible to
990 # require_term_colors
991 # -------------------
992 # Allow display of bold text on terminals that support it.
993 require_term_colors=func_require_term_colors
994 func_require_term_colors ()
999 # COLORTERM and USE_ANSI_COLORS environment variables take
1000 # precedence, because most terminfo databases neglect to describe
1001 # whether color sequences are supported.
1002 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
1004 if test 1 = "$USE_ANSI_COLORS"; then
1005 # Standard ANSI escape sequences
1007 tc_bold='
\e[1m'; tc_standout='
\e[7m'
1008 tc_red='
\e[31m'; tc_green='
\e[32m'
1009 tc_blue='
\e[34m'; tc_cyan='
\e[36m'
1011 # Otherwise trust the terminfo database after all.
1012 test -n "`tput sgr0 2>/dev/null`" && {
1013 tc_reset=`tput sgr0`
1014 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
1015 tc_standout=$tc_bold
1016 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
1017 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
1018 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
1019 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
1020 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
1025 require_term_colors=:
1029 ## ----------------- ##
1030 ## Function library. ##
1031 ## ----------------- ##
1033 # This section contains a variety of useful functions to call in your
1034 # scripts. Take note of the portable wrappers for features provided by
1035 # some modern shells, which will fall back to slower equivalents on
1036 # less featureful shells.
1039 # func_append VAR VALUE
1040 # ---------------------
1041 # Append VALUE onto the existing contents of VAR.
1043 # We should try to minimise forks, especially on Windows where they are
1044 # unreasonably slow, so skip the feature probes when bash or zsh are
1046 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
1047 : ${_G_HAVE_ARITH_OP="yes"}
1048 : ${_G_HAVE_XSI_OPS="yes"}
1049 # The += operator was introduced in bash 3.1
1050 case $BASH_VERSION in
1051 [12].* | 3.0 | 3.0*) ;;
1053 : ${_G_HAVE_PLUSEQ_OP="yes"}
1059 # Can be empty, in which case the shell is probed, "yes" if += is
1060 # useable or anything else if it does not work.
1061 test -z "$_G_HAVE_PLUSEQ_OP" \
1062 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
1063 && _G_HAVE_PLUSEQ_OP=yes
1065 if test yes = "$_G_HAVE_PLUSEQ_OP"
1067 # This is an XSI compatible shell, allowing a faster implementation...
1068 eval 'func_append ()
1075 # ...otherwise fall back to using expr, which is often a shell builtin.
1085 # func_append_quoted VAR VALUE
1086 # ----------------------------
1087 # Quote VALUE and append to the end of shell variable VAR, separated
1089 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
1090 eval 'func_append_quoted ()
1094 func_quote_for_eval "$2"
1095 eval "$1+=\\ \$func_quote_for_eval_result"
1098 func_append_quoted ()
1102 func_quote_for_eval "$2"
1103 eval "$1=\$$1\\ \$func_quote_for_eval_result"
1108 # func_append_uniq VAR VALUE
1109 # --------------------------
1110 # Append unique VALUE onto the existing contents of VAR, assuming
1111 # entries are delimited by the first character of VALUE. For example:
1113 # func_append_uniq options " --another-option option-argument"
1115 # will only append to $options if " --another-option option-argument "
1116 # is not already present somewhere in $options already (note spaces at
1117 # each end implied by leading space in second argument).
1122 eval _G_current_value='`$ECHO $'$1'`'
1123 _G_delim=`expr "$2" : '\(.\)'`
1125 case $_G_delim$_G_current_value$_G_delim in
1127 *) func_append "$@" ;;
1132 # func_arith TERM...
1133 # ------------------
1134 # Set func_arith_result to the result of evaluating TERMs.
1135 test -z "$_G_HAVE_ARITH_OP" \
1136 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
1137 && _G_HAVE_ARITH_OP=yes
1139 if test yes = "$_G_HAVE_ARITH_OP"; then
1144 func_arith_result=$(( $* ))
1151 func_arith_result=`expr "$@"`
1156 # func_basename FILE
1157 # ------------------
1158 # Set func_basename_result to FILE with everything up to and including
1159 # the last / stripped.
1160 if test yes = "$_G_HAVE_XSI_OPS"; then
1161 # If this shell supports suffix pattern removal, then use it to avoid
1162 # forking. Hide the definitions single quotes in case the shell chokes
1163 # on unsupported syntax...
1164 _b='func_basename_result=${1##*/}'
1166 */*) func_dirname_result=${1%/*}$2 ;;
1167 * ) func_dirname_result=$3 ;;
1171 # ...otherwise fall back to using sed.
1172 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
1173 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
1174 if test "X$func_dirname_result" = "X$1"; then
1175 func_dirname_result=$3
1177 func_append func_dirname_result "$2"
1181 eval 'func_basename ()
1189 # func_dirname FILE APPEND NONDIR_REPLACEMENT
1190 # -------------------------------------------
1191 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
1192 # otherwise set result to NONDIR_REPLACEMENT.
1193 eval 'func_dirname ()
1201 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
1202 # --------------------------------------------------------
1203 # Perform func_basename and func_dirname in a single function
1205 # dirname: Compute the dirname of FILE. If nonempty,
1206 # add APPEND to the result, otherwise set result
1207 # to NONDIR_REPLACEMENT.
1208 # value returned in "$func_dirname_result"
1209 # basename: Compute filename of FILE.
1210 # value retuned in "$func_basename_result"
1211 # For efficiency, we do not delegate to the functions above but instead
1212 # duplicate the functionality here.
1213 eval 'func_dirname_and_basename ()
1224 # Echo program name prefixed message.
1233 for _G_line in $_G_message; do
1235 $ECHO "$progname: $_G_line"
1241 # func_echo_all ARG...
1242 # --------------------
1243 # Invoke $ECHO with all args, space-separated.
1250 # func_echo_infix_1 INFIX ARG...
1251 # ------------------------------
1252 # Echo program name, followed by INFIX on the first line, with any
1253 # additional lines not showing INFIX.
1254 func_echo_infix_1 ()
1258 $require_term_colors
1262 _G_prefix="$progname: $_G_infix: "
1265 # Strip color escape sequences before counting printable length
1266 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
1268 test -n "$_G_tc" && {
1269 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
1270 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
1273 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
1275 func_echo_infix_1_IFS=$IFS
1277 for _G_line in $_G_message; do
1278 IFS=$func_echo_infix_1_IFS
1279 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
1280 _G_prefix=$_G_indent
1282 IFS=$func_echo_infix_1_IFS
1288 # Echo program name prefixed message to standard error.
1293 $require_term_colors
1295 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
1299 # func_fatal_error ARG...
1300 # -----------------------
1301 # Echo program name prefixed message to standard error, and exit.
1311 # func_grep EXPRESSION FILENAME
1312 # -----------------------------
1313 # Check whether EXPRESSION matches any line of FILENAME, without output.
1318 $GREP "$1" "$2" >/dev/null 2>&1
1324 # Set func_len_result to the length of STRING. STRING may not
1325 # start with a hyphen.
1326 test -z "$_G_HAVE_XSI_OPS" \
1328 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
1329 && _G_HAVE_XSI_OPS=yes
1331 if test yes = "$_G_HAVE_XSI_OPS"; then
1336 func_len_result=${#1}
1343 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
1348 # func_mkdir_p DIRECTORY-PATH
1349 # ---------------------------
1350 # Make sure the entire path to DIRECTORY-PATH is available.
1355 _G_directory_path=$1
1358 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
1360 # Protect directory names starting with '-'
1361 case $_G_directory_path in
1362 -*) _G_directory_path=./$_G_directory_path ;;
1365 # While some portion of DIR does not yet exist...
1366 while test ! -d "$_G_directory_path"; do
1367 # ...make a list in topmost first order. Use a colon delimited
1368 # list incase some portion of path contains whitespace.
1369 _G_dir_list=$_G_directory_path:$_G_dir_list
1371 # If the last portion added has no slash in it, the list is done
1372 case $_G_directory_path in */*) ;; *) break ;; esac
1374 # ...otherwise throw away the child directory and loop
1375 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
1377 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
1379 func_mkdir_p_IFS=$IFS; IFS=:
1380 for _G_dir in $_G_dir_list; do
1381 IFS=$func_mkdir_p_IFS
1382 # mkdir can fail with a 'File exist' error if two processes
1383 # try to create one of the directories concurrently. Don't
1384 # stop in that case!
1385 $MKDIR "$_G_dir" 2>/dev/null || :
1387 IFS=$func_mkdir_p_IFS
1389 # Bail out if we (or some other process) failed to create a directory.
1390 test -d "$_G_directory_path" || \
1391 func_fatal_error "Failed to create '$1'"
1396 # func_mktempdir [BASENAME]
1397 # -------------------------
1398 # Make a temporary directory that won't clash with other running
1399 # libtool processes, and avoids race conditions if possible. If
1400 # given, BASENAME is the basename for that directory.
1405 _G_template=${TMPDIR-/tmp}/${1-$progname}
1407 if test : = "$opt_dry_run"; then
1408 # Return a directory name, but don't create it in dry-run mode
1409 _G_tmpdir=$_G_template-$$
1412 # If mktemp works, use that first and foremost
1413 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
1415 if test ! -d "$_G_tmpdir"; then
1416 # Failing that, at least try and use $RANDOM to avoid a race
1417 _G_tmpdir=$_G_template-${RANDOM-0}$$
1419 func_mktempdir_umask=`umask`
1422 umask $func_mktempdir_umask
1425 # If we're not in dry-run mode, bomb out on failure
1426 test -d "$_G_tmpdir" || \
1427 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
1434 # func_normal_abspath PATH
1435 # ------------------------
1436 # Remove doubled-up and trailing slashes, "." path components,
1437 # and cancel out any ".." path components in PATH after making
1438 # it an absolute path.
1439 func_normal_abspath ()
1443 # These SED scripts presuppose an absolute path with a trailing slash.
1444 _G_pathcar='s|^/\([^/]*\).*$|\1|'
1445 _G_pathcdr='s|^/[^/]*||'
1446 _G_removedotparts=':dotsl
1450 _G_collapseslashes='s|/\{1,\}|/|g'
1451 _G_finalslash='s|/*$|/|'
1453 # Start from root dir and reassemble the path.
1454 func_normal_abspath_result=
1455 func_normal_abspath_tpath=$1
1456 func_normal_abspath_altnamespace=
1457 case $func_normal_abspath_tpath in
1459 # Empty path, that just means $cwd.
1460 func_stripname '' '/' "`pwd`"
1461 func_normal_abspath_result=$func_stripname_result
1464 # The next three entries are used to spot a run of precisely
1465 # two leading slashes without using negated character classes;
1466 # we take advantage of case's first-match behaviour.
1468 # Unusual form of absolute path, do nothing.
1471 # Not necessarily an ordinary path; POSIX reserves leading '//'
1472 # and for example Cygwin uses it to access remote file shares
1473 # over CIFS/SMB, so we conserve a leading double slash if found.
1474 func_normal_abspath_altnamespace=/
1477 # Absolute path, do nothing.
1480 # Relative path, prepend $cwd.
1481 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
1485 # Cancel out all the simple stuff to save iterations. We also want
1486 # the path to end with a slash for ease of parsing, so make sure
1487 # there is one (and only one) here.
1488 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1489 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
1491 # Processed it all yet?
1492 if test / = "$func_normal_abspath_tpath"; then
1493 # If we ascended to the root using ".." the result may be empty now.
1494 if test -z "$func_normal_abspath_result"; then
1495 func_normal_abspath_result=/
1499 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
1501 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1503 # Figure out what to do with it
1504 case $func_normal_abspath_tcomponent in
1506 # Trailing empty path component, ignore it.
1509 # Parent dir; strip last assembled component from result.
1510 func_dirname "$func_normal_abspath_result"
1511 func_normal_abspath_result=$func_dirname_result
1514 # Actual path component, append it.
1515 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1519 # Restore leading double-slash if one was found on entry.
1520 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1524 # func_notquiet ARG...
1525 # --------------------
1526 # Echo program name prefixed message only when not in quiet mode.
1531 $opt_quiet || func_echo ${1+"$@"}
1533 # A bug in bash halts the script if the last line of a function
1534 # fails when set -e is in force, so we need another command to
1540 # func_relative_path SRCDIR DSTDIR
1541 # --------------------------------
1542 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1543 func_relative_path ()
1547 func_relative_path_result=
1548 func_normal_abspath "$1"
1549 func_relative_path_tlibdir=$func_normal_abspath_result
1550 func_normal_abspath "$2"
1551 func_relative_path_tbindir=$func_normal_abspath_result
1553 # Ascend the tree starting from libdir
1555 # check if we have found a prefix of bindir
1556 case $func_relative_path_tbindir in
1557 $func_relative_path_tlibdir)
1558 # found an exact match
1559 func_relative_path_tcancelled=
1562 $func_relative_path_tlibdir*)
1563 # found a matching prefix
1564 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1565 func_relative_path_tcancelled=$func_stripname_result
1566 if test -z "$func_relative_path_result"; then
1567 func_relative_path_result=.
1572 func_dirname $func_relative_path_tlibdir
1573 func_relative_path_tlibdir=$func_dirname_result
1574 if test -z "$func_relative_path_tlibdir"; then
1575 # Have to descend all the way to the root!
1576 func_relative_path_result=../$func_relative_path_result
1577 func_relative_path_tcancelled=$func_relative_path_tbindir
1580 func_relative_path_result=../$func_relative_path_result
1585 # Now calculate path; take care to avoid doubling-up slashes.
1586 func_stripname '' '/' "$func_relative_path_result"
1587 func_relative_path_result=$func_stripname_result
1588 func_stripname '/' '/' "$func_relative_path_tcancelled"
1589 if test -n "$func_stripname_result"; then
1590 func_append func_relative_path_result "/$func_stripname_result"
1593 # Normalisation. If bindir is libdir, return '.' else relative path.
1594 if test -n "$func_relative_path_result"; then
1595 func_stripname './' '' "$func_relative_path_result"
1596 func_relative_path_result=$func_stripname_result
1599 test -n "$func_relative_path_result" || func_relative_path_result=.
1605 # func_quote_for_eval ARG...
1606 # --------------------------
1607 # Aesthetically quote ARGs to be evaled later.
1608 # This function returns two values:
1609 # i) func_quote_for_eval_result
1610 # double-quoted, suitable for a subsequent eval
1611 # ii) func_quote_for_eval_unquoted_result
1612 # has all characters that are still active within double
1613 # quotes backslashified.
1614 func_quote_for_eval ()
1618 func_quote_for_eval_unquoted_result=
1619 func_quote_for_eval_result=
1620 while test 0 -lt $#; do
1623 _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
1625 _G_unquoted_arg=$1 ;;
1627 if test -n "$func_quote_for_eval_unquoted_result"; then
1628 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
1630 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
1633 case $_G_unquoted_arg in
1634 # Double-quote args containing shell metacharacters to delay
1635 # word splitting, command substitution and variable expansion
1636 # for a subsequent eval.
1637 # Many Bourne shells cannot handle close brackets correctly
1638 # in scan sets, so we specify it separately.
1639 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1640 _G_quoted_arg=\"$_G_unquoted_arg\"
1643 _G_quoted_arg=$_G_unquoted_arg
1647 if test -n "$func_quote_for_eval_result"; then
1648 func_append func_quote_for_eval_result " $_G_quoted_arg"
1650 func_append func_quote_for_eval_result "$_G_quoted_arg"
1657 # func_quote_for_expand ARG
1658 # -------------------------
1659 # Aesthetically quote ARG to be evaled later; same as above,
1660 # but do not quote variable references.
1661 func_quote_for_expand ()
1667 _G_arg=`$ECHO "$1" | $SED \
1668 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
1674 # Double-quote args containing shell metacharacters to delay
1675 # word splitting and command substitution for a subsequent eval.
1676 # Many Bourne shells cannot handle close brackets correctly
1677 # in scan sets, so we specify it separately.
1678 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1683 func_quote_for_expand_result=$_G_arg
1687 # func_stripname PREFIX SUFFIX NAME
1688 # ---------------------------------
1689 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1690 # PREFIX and SUFFIX must not contain globbing or regex special
1691 # characters, hashes, percent signs, but SUFFIX may contain a leading
1692 # dot (in which case that matches only a dot).
1693 if test yes = "$_G_HAVE_XSI_OPS"; then
1694 eval 'func_stripname ()
1698 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1699 # positional parameters, so assign one to ordinary variable first.
1700 func_stripname_result=$3
1701 func_stripname_result=${func_stripname_result#"$1"}
1702 func_stripname_result=${func_stripname_result%"$2"}
1710 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1711 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1717 # func_show_eval CMD [FAIL_EXP]
1718 # -----------------------------
1719 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1720 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1721 # is given, then evaluate it.
1727 _G_fail_exp=${2-':'}
1729 func_quote_for_expand "$_G_cmd"
1730 eval "func_notquiet $func_quote_for_expand_result"
1735 if test 0 -ne "$_G_status"; then
1736 eval "(exit $_G_status); $_G_fail_exp"
1742 # func_show_eval_locale CMD [FAIL_EXP]
1743 # ------------------------------------
1744 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1745 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1746 # is given, then evaluate it. Use the saved locale for evaluation.
1747 func_show_eval_locale ()
1752 _G_fail_exp=${2-':'}
1755 func_quote_for_expand "$_G_cmd"
1756 eval "func_echo $func_quote_for_expand_result"
1760 eval "$_G_user_locale
1763 eval "$_G_safe_locale"
1764 if test 0 -ne "$_G_status"; then
1765 eval "(exit $_G_status); $_G_fail_exp"
1773 # Turn $1 into a string suitable for a shell variable name.
1774 # Result is stored in $func_tr_sh_result. All characters
1775 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1776 # if $1 begins with a digit, a '_' is prepended as well.
1782 [0-9]* | *[!a-zA-Z0-9_]*)
1783 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1786 func_tr_sh_result=$1
1792 # func_verbose ARG...
1793 # -------------------
1794 # Echo program name prefixed message in verbose mode only.
1799 $opt_verbose && func_echo "$*"
1805 # func_warn_and_continue ARG...
1806 # -----------------------------
1807 # Echo program name prefixed warning message to standard error.
1808 func_warn_and_continue ()
1812 $require_term_colors
1814 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1818 # func_warning CATEGORY ARG...
1819 # ----------------------------
1820 # Echo program name prefixed warning message to standard error. Warning
1821 # messages can be filtered according to CATEGORY, where this function
1822 # elides messages where CATEGORY is not listed in the global variable
1823 # 'opt_warning_types'.
1828 # CATEGORY must be in the warning_categories list!
1829 case " $warning_categories " in
1831 *) func_internal_error "invalid warning category '$1'" ;;
1837 case " $opt_warning_types " in
1838 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1843 # func_sort_ver VER1 VER2
1844 # -----------------------
1845 # 'sort -V' is not generally available.
1846 # Note this deviates from the version comparison in automake
1847 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1848 # but this should suffice as we won't be specifying old
1849 # version formats or redundant trailing .0 in bootstrap.conf.
1850 # If we did want full compatibility then we should probably
1851 # use m4_version_compare from autoconf.
1856 printf '%s\n%s\n' "$1" "$2" \
1857 | 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
1860 # func_lt_ver PREV CURR
1861 # ---------------------
1862 # Return true if PREV and CURR are in the correct order according to
1863 # func_sort_ver, otherwise false. Use it like this:
1865 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1870 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1875 # mode: shell-script
1877 # eval: (add-hook 'before-save-hook 'time-stamp)
1878 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1879 # time-stamp-time-zone: "UTC"
1883 # Set a version string for this script.
1884 scriptversion=2014-01-07.03; # UTC
1886 # A portable, pluggable option parser for Bourne shell.
1887 # Written by Gary V. Vaughan, 2010
1889 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
1890 # This is free software; see the source for copying conditions. There is NO
1891 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1893 # This program is free software: you can redistribute it and/or modify
1894 # it under the terms of the GNU General Public License as published by
1895 # the Free Software Foundation, either version 3 of the License, or
1896 # (at your option) any later version.
1898 # This program is distributed in the hope that it will be useful,
1899 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1900 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1901 # GNU General Public License for more details.
1903 # You should have received a copy of the GNU General Public License
1904 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1906 # Please report bugs or propose patches to gary@gnu.org.
1913 # This file is a library for parsing options in your shell scripts along
1914 # with assorted other useful supporting features that you can make use
1917 # For the simplest scripts you might need only:
1920 # . relative/path/to/funclib.sh
1921 # . relative/path/to/options-parser
1923 # func_options ${1+"$@"}
1924 # eval set dummy "$func_options_result"; shift
1925 # ...rest of your script...
1927 # In order for the '--version' option to work, you will need to have a
1928 # suitably formatted comment like the one at the top of this file
1929 # starting with '# Written by ' and ending with '# warranty; '.
1931 # For '-h' and '--help' to work, you will also need a one line
1932 # description of your script's purpose in a comment directly above the
1933 # '# Written by ' line, like the one at the top of this file.
1935 # The default options also support '--debug', which will turn on shell
1936 # execution tracing (see the comment above debug_cmd below for another
1937 # use), and '--verbose' and the func_verbose function to allow your script
1938 # to display verbose messages only when your user has specified
1941 # After sourcing this file, you can plug processing for additional
1942 # options by amending the variables from the 'Configuration' section
1943 # below, and following the instructions in the 'Option parsing'
1944 # section further down.
1946 ## -------------- ##
1947 ## Configuration. ##
1948 ## -------------- ##
1950 # You should override these variables in your script after sourcing this
1951 # file so that they reflect the customisations you have added to the
1954 # The usage line for option parsing errors and the start of '-h' and
1955 # '--help' output messages. You can embed shell variables for delayed
1956 # expansion at the time the message is displayed, but you will need to
1957 # quote other shell meta-characters carefully to prevent them being
1958 # expanded when the contents are evaled.
1959 usage='$progpath [OPTION]...'
1961 # Short help message in response to '-h' and '--help'. Add to this or
1962 # override it after sourcing this library to reflect the full set of
1963 # options your script accepts.
1965 --debug enable verbose shell tracing
1966 -W, --warnings=CATEGORY
1967 report the warnings falling in CATEGORY [all]
1968 -v, --verbose verbosely report processing
1969 --version print version information and exit
1970 -h, --help print short or long help message and exit
1973 # Additional text appended to 'usage_message' in response to '--help'.
1975 Warning categories include:
1976 'all' show all warnings
1977 'none' turn off all the warnings
1978 'error' warnings are treated as fatal errors"
1980 # Help message printed before fatal option parsing errors.
1981 fatal_help="Try '\$progname --help' for more information."
1985 ## ------------------------- ##
1986 ## Hook function management. ##
1987 ## ------------------------- ##
1989 # This section contains functions for adding, removing, and running hooks
1990 # to the main code. A hook is just a named list of of function, that can
1991 # be run in order later on.
1993 # func_hookable FUNC_NAME
1994 # -----------------------
1995 # Declare that FUNC_NAME will run hooks added with
1996 # 'func_add_hook FUNC_NAME ...'.
2001 func_append hookable_fns " $1"
2005 # func_add_hook FUNC_NAME HOOK_FUNC
2006 # ---------------------------------
2007 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
2008 # first have been declared "hookable" by a call to 'func_hookable'.
2013 case " $hookable_fns " in
2015 *) func_fatal_error "'$1' does not accept hook functions." ;;
2018 eval func_append ${1}_hooks '" $2"'
2022 # func_remove_hook FUNC_NAME HOOK_FUNC
2023 # ------------------------------------
2024 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
2029 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
2033 # func_run_hooks FUNC_NAME [ARG]...
2034 # ---------------------------------
2035 # Run all hook functions registered to FUNC_NAME.
2036 # It is assumed that the list of hook functions contains nothing more
2037 # than a whitespace-delimited list of legal shell function names, and
2038 # no effort is wasted trying to catch shell meta-characters or preserve
2044 case " $hookable_fns " in
2046 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
2049 eval _G_hook_fns=\$$1_hooks; shift
2051 for _G_hook in $_G_hook_fns; do
2052 eval $_G_hook '"$@"'
2054 # store returned options list back into positional
2055 # parameters for next 'cmd' execution.
2056 eval _G_hook_result=\$${_G_hook}_result
2057 eval set dummy "$_G_hook_result"; shift
2060 func_quote_for_eval ${1+"$@"}
2061 func_run_hooks_result=$func_quote_for_eval_result
2066 ## --------------- ##
2067 ## Option parsing. ##
2068 ## --------------- ##
2070 # In order to add your own option parsing hooks, you must accept the
2071 # full positional parameter list in your hook function, remove any
2072 # options that you action, and then pass back the remaining unprocessed
2073 # options in '<hooked_function_name>_result', escaped suitably for
2074 # 'eval'. Like this:
2076 # my_options_prep ()
2080 # # Extend the existing usage message.
2081 # usage_message=$usage_message'
2082 # -s, --silent don'\''t print informational messages
2085 # func_quote_for_eval ${1+"$@"}
2086 # my_options_prep_result=$func_quote_for_eval_result
2088 # func_add_hook func_options_prep my_options_prep
2091 # my_silent_option ()
2095 # # Note that for efficiency, we parse as many options as we can
2096 # # recognise in a loop before passing the remainder back to the
2097 # # caller on the first unrecognised argument we encounter.
2098 # while test $# -gt 0; do
2101 # --silent|-s) opt_silent=: ;;
2102 # # Separate non-argument short options:
2103 # -s*) func_split_short_opt "$_G_opt"
2104 # set dummy "$func_split_short_opt_name" \
2105 # "-$func_split_short_opt_arg" ${1+"$@"}
2108 # *) set dummy "$_G_opt" "$*"; shift; break ;;
2112 # func_quote_for_eval ${1+"$@"}
2113 # my_silent_option_result=$func_quote_for_eval_result
2115 # func_add_hook func_parse_options my_silent_option
2118 # my_option_validation ()
2122 # $opt_silent && $opt_verbose && func_fatal_help "\
2123 # '--silent' and '--verbose' options are mutually exclusive."
2125 # func_quote_for_eval ${1+"$@"}
2126 # my_option_validation_result=$func_quote_for_eval_result
2128 # func_add_hook func_validate_options my_option_validation
2130 # You'll alse need to manually amend $usage_message to reflect the extra
2131 # options you parse. It's preferable to append if you can, so that
2132 # multiple option parsing hooks can be added safely.
2135 # func_options [ARG]...
2136 # ---------------------
2137 # All the functions called inside func_options are hookable. See the
2138 # individual implementations for details.
2139 func_hookable func_options
2144 func_options_prep ${1+"$@"}
2145 eval func_parse_options \
2146 ${func_options_prep_result+"$func_options_prep_result"}
2147 eval func_validate_options \
2148 ${func_parse_options_result+"$func_parse_options_result"}
2150 eval func_run_hooks func_options \
2151 ${func_validate_options_result+"$func_validate_options_result"}
2153 # save modified positional parameters for caller
2154 func_options_result=$func_run_hooks_result
2158 # func_options_prep [ARG]...
2159 # --------------------------
2160 # All initialisations required before starting the option parse loop.
2161 # Note that when calling hook functions, we pass through the list of
2162 # positional parameters. If a hook function modifies that list, and
2163 # needs to propogate that back to rest of this script, then the complete
2164 # modified list must be put in 'func_run_hooks_result' before
2166 func_hookable func_options_prep
2167 func_options_prep ()
2175 func_run_hooks func_options_prep ${1+"$@"}
2177 # save modified positional parameters for caller
2178 func_options_prep_result=$func_run_hooks_result
2182 # func_parse_options [ARG]...
2183 # ---------------------------
2184 # The main option parsing loop.
2185 func_hookable func_parse_options
2186 func_parse_options ()
2190 func_parse_options_result=
2192 # this just eases exit handling
2193 while test $# -gt 0; do
2194 # Defer to hook functions for initial option parsing, so they
2195 # get priority in the event of reusing an option name.
2196 func_run_hooks func_parse_options ${1+"$@"}
2198 # Adjust func_parse_options positional parameters to match
2199 eval set dummy "$func_run_hooks_result"; shift
2201 # Break out of the loop if we already parsed every option.
2202 test $# -gt 0 || break
2207 --debug|-x) debug_cmd='set -x'
2208 func_echo "enabling shell trace mode"
2212 --no-warnings|--no-warning|--no-warn)
2213 set dummy --warnings none ${1+"$@"}
2217 --warnings|--warning|-W)
2218 test $# = 0 && func_missing_arg $_G_opt && break
2219 case " $warning_categories $1" in
2221 # trailing space prevents matching last $1 above
2222 func_append_uniq opt_warning_types " $1"
2225 opt_warning_types=$warning_categories
2228 opt_warning_types=none
2232 opt_warning_types=$warning_categories
2233 warning_func=func_fatal_error
2237 "unsupported warning category: '$1'"
2243 --verbose|-v) opt_verbose=: ;;
2244 --version) func_version ;;
2245 -\?|-h) func_usage ;;
2246 --help) func_help ;;
2248 # Separate optargs to long options (plugins may need this):
2249 --*=*) func_split_equals "$_G_opt"
2250 set dummy "$func_split_equals_lhs" \
2251 "$func_split_equals_rhs" ${1+"$@"}
2255 # Separate optargs to short options:
2257 func_split_short_opt "$_G_opt"
2258 set dummy "$func_split_short_opt_name" \
2259 "$func_split_short_opt_arg" ${1+"$@"}
2263 # Separate non-argument short options:
2265 func_split_short_opt "$_G_opt"
2266 set dummy "$func_split_short_opt_name" \
2267 "-$func_split_short_opt_arg" ${1+"$@"}
2272 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
2273 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2277 # save modified positional parameters for caller
2278 func_quote_for_eval ${1+"$@"}
2279 func_parse_options_result=$func_quote_for_eval_result
2283 # func_validate_options [ARG]...
2284 # ------------------------------
2285 # Perform any sanity checks on option settings and/or unconsumed
2287 func_hookable func_validate_options
2288 func_validate_options ()
2292 # Display all warnings if -W was not given.
2293 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
2295 func_run_hooks func_validate_options ${1+"$@"}
2297 # Bail if the options were screwed!
2298 $exit_cmd $EXIT_FAILURE
2300 # save modified positional parameters for caller
2301 func_validate_options_result=$func_run_hooks_result
2306 ## ----------------- ##
2307 ## Helper functions. ##
2308 ## ----------------- ##
2310 # This section contains the helper functions used by the rest of the
2311 # hookable option parser framework in ascii-betical order.
2314 # func_fatal_help ARG...
2315 # ----------------------
2316 # Echo program name prefixed message to standard error, followed by
2317 # a help hint, and exit.
2322 eval \$ECHO \""Usage: $usage"\"
2323 eval \$ECHO \""$fatal_help"\"
2324 func_error ${1+"$@"}
2331 # Echo long help message to standard output and exit.
2337 $ECHO "$long_help_message"
2342 # func_missing_arg ARGNAME
2343 # ------------------------
2344 # Echo program name prefixed message to standard error and set global
2350 func_error "Missing argument for '$1'."
2355 # func_split_equals STRING
2356 # ------------------------
2357 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
2358 # splitting STRING at the '=' sign.
2359 test -z "$_G_HAVE_XSI_OPS" \
2361 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
2362 && _G_HAVE_XSI_OPS=yes
2364 if test yes = "$_G_HAVE_XSI_OPS"
2366 # This is an XSI compatible shell, allowing a faster implementation...
2367 eval 'func_split_equals ()
2371 func_split_equals_lhs=${1%%=*}
2372 func_split_equals_rhs=${1#*=}
2373 test "x$func_split_equals_lhs" = "x$1" \
2374 && func_split_equals_rhs=
2377 # ...otherwise fall back to using expr, which is often a shell builtin.
2378 func_split_equals ()
2382 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
2383 func_split_equals_rhs=
2384 test "x$func_split_equals_lhs" = "x$1" \
2385 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
2387 fi #func_split_equals
2390 # func_split_short_opt SHORTOPT
2391 # -----------------------------
2392 # Set func_split_short_opt_name and func_split_short_opt_arg shell
2393 # variables after splitting SHORTOPT after the 2nd character.
2394 if test yes = "$_G_HAVE_XSI_OPS"
2396 # This is an XSI compatible shell, allowing a faster implementation...
2397 eval 'func_split_short_opt ()
2401 func_split_short_opt_arg=${1#??}
2402 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
2405 # ...otherwise fall back to using expr, which is often a shell builtin.
2406 func_split_short_opt ()
2410 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
2411 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
2413 fi #func_split_short_opt
2418 # Echo short help message to standard output and exit.
2424 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
2429 # func_usage_message
2430 # ------------------
2431 # Echo short help message to standard output.
2432 func_usage_message ()
2436 eval \$ECHO \""Usage: $usage"\"
2443 /^Written by/q' < "$progpath"
2445 eval \$ECHO \""$usage_message"\"
2451 # Echo version message to standard output and exit.
2456 printf '%s\n' "$progname $scriptversion"
2466 /^# Written by /,/# warranty; / {
2469 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2476 /^warranty; /q' < "$progpath"
2483 # mode: shell-script
2485 # eval: (add-hook 'before-save-hook 'time-stamp)
2486 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2487 # time-stamp-time-zone: "UTC"
2490 # Set a version string.
2491 scriptversion='(GNU libtool) 2.4.6'
2496 # Libtool also displays the current mode in messages, so override
2497 # funclib.sh func_echo with this custom definition.
2506 for _G_line in $_G_message; do
2508 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2514 # func_warning ARG...
2515 # -------------------
2516 # Libtool warnings are not categorized, so override funclib.sh
2517 # func_warning with this simpler definition.
2522 $warning_func ${1+"$@"}
2526 ## ---------------- ##
2527 ## Options parsing. ##
2528 ## ---------------- ##
2530 # Hook in the functions to make sure our own options are parsed during
2531 # the option parsing loop.
2533 usage='$progpath [OPTION]... [MODE-ARG]...'
2535 # Short help message in response to '-h'.
2536 usage_message="Options:
2537 --config show all configuration variables
2538 --debug enable verbose shell tracing
2539 -n, --dry-run display commands without modifying any files
2540 --features display basic configuration information and exit
2541 --mode=MODE use operation mode MODE
2542 --no-warnings equivalent to '-Wnone'
2543 --preserve-dup-deps don't remove duplicate dependency libraries
2544 --quiet, --silent don't print informational messages
2545 --tag=TAG use configuration variables from tag TAG
2546 -v, --verbose print more informational messages than default
2547 --version print version information
2548 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2549 -h, --help, --help-all print short, long, or detailed help message
2552 # Additional text appended to 'usage_message' in response to '--help'.
2558 $ECHO "$long_help_message
2560 MODE must be one of the following:
2562 clean remove files from the build directory
2563 compile compile a source file into a libtool object
2564 execute automatically set library path, then run a program
2565 finish complete the installation of libtool libraries
2566 install install libraries or executables
2567 link create a library or an executable
2568 uninstall remove libraries from an installed directory
2570 MODE-ARGS vary depending on the MODE. When passed as first option,
2571 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2572 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2574 When reporting a bug, please describe a test case to reproduce it and
2575 include the following information:
2580 compiler flags: $LTCFLAGS
2581 linker: $LD (gnu? $with_gnu_ld)
2582 version: $progname $scriptversion Debian-2.4.6-2
2583 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2584 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2586 Report bugs to <bug-libtool@gnu.org>.
2587 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2588 General help using GNU software: <http://www.gnu.org/gethelp/>."
2593 # func_lo2o OBJECT-NAME
2594 # ---------------------
2595 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2598 lo2o=s/\\.lo\$/.$objext/
2599 o2lo=s/\\.$objext\$/.lo/
2601 if test yes = "$_G_HAVE_XSI_OPS"; then
2605 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2606 * ) func_lo2o_result=$1 ;;
2610 # func_xform LIBOBJ-OR-SOURCE
2611 # ---------------------------
2612 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2613 # suffix to a '.lo' libtool-object suffix.
2616 func_xform_result=${1%.*}.lo
2619 # ...otherwise fall back to using sed.
2622 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2627 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2632 # func_fatal_configuration ARG...
2633 # -------------------------------
2634 # Echo program name prefixed message to standard error, followed by
2635 # a configuration failure hint, and exit.
2636 func_fatal_configuration ()
2638 func__fatal_error ${1+"$@"} \
2639 "See the $PACKAGE documentation for more information." \
2640 "Fatal configuration error."
2646 # Display the configuration for all the tags in this script.
2649 re_begincf='^# ### BEGIN LIBTOOL'
2650 re_endcf='^# ### END LIBTOOL'
2652 # Default configuration.
2653 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2655 # Now print the configurations for the tags.
2656 for tagname in $taglist; do
2657 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2666 # Display the features supported by this script.
2670 if test yes = "$build_libtool_libs"; then
2671 echo "enable shared libraries"
2673 echo "disable shared libraries"
2675 if test yes = "$build_old_libs"; then
2676 echo "enable static libraries"
2678 echo "disable static libraries"
2685 # func_enable_tag TAGNAME
2686 # -----------------------
2687 # Verify that TAGNAME is valid, and either flag an error and exit, or
2688 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2695 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2696 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2697 sed_extractcf=/$re_begincf/,/$re_endcf/p
2702 func_fatal_error "invalid tag name: $tagname"
2706 # Don't test for the "default" C tag, as we know it's
2707 # there but not specially marked.
2711 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2712 taglist="$taglist $tagname"
2714 # Evaluate the configuration. Be careful to quote the path
2715 # and the sed script, to avoid splitting on whitespace, but
2716 # also don't use non-portable quotes within backquotes within
2717 # quotes we have to do it in 2 steps:
2718 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2721 func_error "ignoring unknown tag $tagname"
2728 # func_check_version_match
2729 # ------------------------
2730 # Ensure that we are using m4 macros, and libtool script from the same
2731 # release of libtool.
2732 func_check_version_match ()
2734 if test "$package_revision" != "$macro_revision"; then
2735 if test "$VERSION" != "$macro_version"; then
2736 if test -z "$macro_version"; then
2738 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2739 $progname: definition of this LT_INIT comes from an older release.
2740 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2741 $progname: and run autoconf again.
2745 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2746 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2747 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2748 $progname: and run autoconf again.
2753 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2754 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2755 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2756 $progname: of $PACKAGE $VERSION and run autoconf again.
2765 # libtool_options_prep [ARG]...
2766 # -----------------------------
2767 # Preparation for options parsed by libtool.
2768 libtool_options_prep ()
2778 opt_preserve_dup_deps=false
2784 # Shorthand for --mode=foo, only valid as the first argument
2787 shift; set dummy --mode clean ${1+"$@"}; shift
2789 compile|compil|compi|comp|com|co|c)
2790 shift; set dummy --mode compile ${1+"$@"}; shift
2792 execute|execut|execu|exec|exe|ex|e)
2793 shift; set dummy --mode execute ${1+"$@"}; shift
2795 finish|finis|fini|fin|fi|f)
2796 shift; set dummy --mode finish ${1+"$@"}; shift
2798 install|instal|insta|inst|ins|in|i)
2799 shift; set dummy --mode install ${1+"$@"}; shift
2802 shift; set dummy --mode link ${1+"$@"}; shift
2804 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2805 shift; set dummy --mode uninstall ${1+"$@"}; shift
2809 # Pass back the list of options.
2810 func_quote_for_eval ${1+"$@"}
2811 libtool_options_prep_result=$func_quote_for_eval_result
2813 func_add_hook func_options_prep libtool_options_prep
2816 # libtool_parse_options [ARG]...
2817 # ---------------------------------
2818 # Provide handling for libtool specific options.
2819 libtool_parse_options ()
2823 # Perform our own loop to consume as many options as possible in
2825 while test $# -gt 0; do
2829 --dry-run|--dryrun|-n)
2833 --config) func_config ;;
2836 opt_dlopen="${opt_dlopen+$opt_dlopen
2841 --preserve-dup-deps)
2842 opt_preserve_dup_deps=: ;;
2844 --features) func_features ;;
2846 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2848 --help) opt_help=: ;;
2850 --help-all) opt_help=': help-all' ;;
2852 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2855 # Valid mode arguments:
2856 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2858 # Catch anything else as an error
2859 *) func_error "invalid argument for $_G_opt"
2867 --no-silent|--no-quiet)
2869 func_append preserve_args " $_G_opt"
2872 --no-warnings|--no-warning|--no-warn)
2874 func_append preserve_args " $_G_opt"
2879 func_append preserve_args " $_G_opt"
2885 func_append preserve_args " $_G_opt"
2888 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2890 func_append preserve_args " $_G_opt $1"
2891 func_enable_tag "$1"
2895 --verbose|-v) opt_quiet=false
2897 func_append preserve_args " $_G_opt"
2900 # An option not handled by this hook function:
2901 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2906 # save modified positional parameters for caller
2907 func_quote_for_eval ${1+"$@"}
2908 libtool_parse_options_result=$func_quote_for_eval_result
2910 func_add_hook func_parse_options libtool_parse_options
2914 # libtool_validate_options [ARG]...
2915 # ---------------------------------
2916 # Perform any sanity checks on option settings and/or unconsumed
2918 libtool_validate_options ()
2920 # save first non-option argument
2921 if test 0 -lt $#; then
2927 test : = "$debug_cmd" || func_append preserve_args " --debug"
2930 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2931 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2932 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
2933 # don't eliminate duplications in $postdeps and $predeps
2934 opt_duplicate_compiler_generated_deps=:
2937 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2942 # Sanity checks first:
2943 func_check_version_match
2945 test yes != "$build_libtool_libs" \
2946 && test yes != "$build_old_libs" \
2947 && func_fatal_configuration "not configured to build any kind of library"
2950 eval std_shrext=\"$shrext_cmds\"
2952 # Only execute mode is allowed to have -dlopen flags.
2953 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2954 func_error "unrecognized option '-dlopen'"
2959 # Change the help message to a mode-specific one.
2961 help="Try '$progname --help --mode=$opt_mode' for more information."
2964 # Pass back the unparsed argument list
2965 func_quote_for_eval ${1+"$@"}
2966 libtool_validate_options_result=$func_quote_for_eval_result
2968 func_add_hook func_validate_options libtool_validate_options
2971 # Process options as early as possible so that --help and --version
2972 # can return quickly.
2973 func_options ${1+"$@"}
2974 eval set dummy "$func_options_result"; shift
2982 magic='%%%MAGIC variable%%%'
2983 magic_exe='%%%MAGIC EXE variable%%%'
2989 # If this variable is set in any of the actions, the command in it
2990 # will be execed at the end. This prevents here-documents from being
2991 # left over by shells.
2995 # A function that is used when there is no print builtin or printf.
2996 func_fallback_echo ()
2998 eval 'cat <<_LTECHO_EOF
3003 # func_generated_by_libtool
3004 # True iff stdin has been generated by Libtool. This function is only
3005 # a basic sanity check; it will hardly flush out determined imposters.
3006 func_generated_by_libtool_p ()
3008 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
3012 # True iff FILE is a libtool '.la' library or '.lo' object file.
3013 # This function is only a basic sanity check; it will hardly flush out
3014 # determined imposters.
3018 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
3021 # func_lalib_unsafe_p file
3022 # True iff FILE is a libtool '.la' library or '.lo' object file.
3023 # This function implements the same check as func_lalib_p without
3024 # resorting to external programs. To this end, it redirects stdin and
3025 # closes it afterwards, without saving the original file descriptor.
3026 # As a safety measure, use it only where a negative result would be
3027 # fatal anyway. Works if 'file' does not exist.
3028 func_lalib_unsafe_p ()
3031 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
3032 for lalib_p_l in 1 2 3 4
3035 case $lalib_p_line in
3036 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
3041 test yes = "$lalib_p"
3044 # func_ltwrapper_script_p file
3045 # True iff FILE is a libtool wrapper script
3046 # This function is only a basic sanity check; it will hardly flush out
3047 # determined imposters.
3048 func_ltwrapper_script_p ()
3051 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
3054 # func_ltwrapper_executable_p file
3055 # True iff FILE is a libtool wrapper executable
3056 # This function is only a basic sanity check; it will hardly flush out
3057 # determined imposters.
3058 func_ltwrapper_executable_p ()
3060 func_ltwrapper_exec_suffix=
3063 *) func_ltwrapper_exec_suffix=.exe ;;
3065 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
3068 # func_ltwrapper_scriptname file
3069 # Assumes file is an ltwrapper_executable
3070 # uses $file to determine the appropriate filename for a
3071 # temporary ltwrapper_script.
3072 func_ltwrapper_scriptname ()
3074 func_dirname_and_basename "$1" "" "."
3075 func_stripname '' '.exe' "$func_basename_result"
3076 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
3079 # func_ltwrapper_p file
3080 # True iff FILE is a libtool wrapper script or wrapper executable
3081 # This function is only a basic sanity check; it will hardly flush out
3082 # determined imposters.
3085 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
3089 # func_execute_cmds commands fail_cmd
3090 # Execute tilde-delimited COMMANDS.
3091 # If FAIL_CMD is given, eval that upon failure.
3092 # FAIL_CMD may read-access the current command in variable CMD!
3093 func_execute_cmds ()
3097 save_ifs=$IFS; IFS='~'
3102 func_show_eval "$cmd" "${2-:}"
3109 # Source FILE, adding directory component if necessary.
3110 # Note that it is not necessary on cygwin/mingw to append a dot to
3111 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
3112 # behavior happens only for exec(3), not for open(2)! Also, sourcing
3113 # 'FILE.' does not work on cygwin managed mounts.
3119 */* | *\\*) . "$1" ;;
3125 # func_resolve_sysroot PATH
3126 # Replace a leading = in PATH with a sysroot. Store the result into
3127 # func_resolve_sysroot_result
3128 func_resolve_sysroot ()
3130 func_resolve_sysroot_result=$1
3131 case $func_resolve_sysroot_result in
3133 func_stripname '=' '' "$func_resolve_sysroot_result"
3134 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
3139 # func_replace_sysroot PATH
3140 # If PATH begins with the sysroot, replace it with = and
3141 # store the result into func_replace_sysroot_result.
3142 func_replace_sysroot ()
3144 case $lt_sysroot:$1 in
3146 func_stripname "$lt_sysroot" '' "$1"
3147 func_replace_sysroot_result='='$func_stripname_result
3150 # Including no sysroot.
3151 func_replace_sysroot_result=$1
3156 # func_infer_tag arg
3157 # Infer tagged configuration to use if any are available and
3158 # if one wasn't chosen via the "--tag" command line option.
3159 # Only attempt this if the compiler in the base compile
3160 # command doesn't match the default compiler.
3161 # arg is usually of the form 'gcc ...'
3166 if test -n "$available_tags" && test -z "$tagname"; then
3169 func_append_quoted CC_quoted "$arg"
3171 CC_expanded=`func_echo_all $CC`
3172 CC_quoted_expanded=`func_echo_all $CC_quoted`
3174 # Blanks in the command may have been stripped by the calling shell,
3175 # but not from the CC environment variable when configure was run.
3176 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
3177 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
3178 # Blanks at the start of $base_compile will cause this to fail
3179 # if we don't check for them as well.
3181 for z in $available_tags; do
3182 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
3183 # Evaluate the configuration.
3184 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
3187 # Double-quote args containing other shell metacharacters.
3188 func_append_quoted CC_quoted "$arg"
3190 CC_expanded=`func_echo_all $CC`
3191 CC_quoted_expanded=`func_echo_all $CC_quoted`
3193 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
3194 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
3195 # The compiler in the base compile command matches
3196 # the one in the tagged configuration.
3197 # Assume this is the tagged configuration we want.
3204 # If $tagname still isn't set, then no tagged configuration
3205 # was found and let the user know that the "--tag" command
3206 # line option must be used.
3207 if test -z "$tagname"; then
3208 func_echo "unable to infer tagged configuration"
3209 func_fatal_error "specify a tag with '--tag'"
3211 # func_verbose "using $tagname tagged configuration"
3220 # func_write_libtool_object output_name pic_name nonpic_name
3221 # Create a libtool object file (analogous to a ".la" file),
3222 # but don't create it if we're doing a dry run.
3223 func_write_libtool_object ()
3226 if test yes = "$build_libtool_libs"; then
3232 if test yes = "$build_old_libs"; then
3239 cat >${write_libobj}T <<EOF
3240 # $write_libobj - a libtool object file
3241 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
3243 # Please DO NOT delete this file!
3244 # It is necessary for linking the library.
3246 # Name of the PIC object.
3247 pic_object=$write_lobj
3249 # Name of the non-PIC object
3250 non_pic_object=$write_oldobj
3253 $MV "${write_libobj}T" "$write_libobj"
3258 ##################################################
3259 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
3260 ##################################################
3262 # func_convert_core_file_wine_to_w32 ARG
3263 # Helper function used by file name conversion functions when $build is *nix,
3264 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
3265 # correctly configured wine environment available, with the winepath program
3266 # in $build's $PATH.
3268 # ARG is the $build file name to be converted to w32 format.
3269 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
3270 # be empty on error (or when ARG is empty)
3271 func_convert_core_file_wine_to_w32 ()
3275 func_convert_core_file_wine_to_w32_result=$1
3276 if test -n "$1"; then
3277 # Unfortunately, winepath does not exit with a non-zero error code, so we
3278 # are forced to check the contents of stdout. On the other hand, if the
3279 # command is not found, the shell will set an exit code of 127 and print
3280 # *an error message* to stdout. So we must check for both error code of
3281 # zero AND non-empty stdout, which explains the odd construction:
3282 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
3283 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
3284 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
3285 $SED -e "$sed_naive_backslashify"`
3287 func_convert_core_file_wine_to_w32_result=
3291 # end: func_convert_core_file_wine_to_w32
3294 # func_convert_core_path_wine_to_w32 ARG
3295 # Helper function used by path conversion functions when $build is *nix, and
3296 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
3297 # configured wine environment available, with the winepath program in $build's
3298 # $PATH. Assumes ARG has no leading or trailing path separator characters.
3300 # ARG is path to be converted from $build format to win32.
3301 # Result is available in $func_convert_core_path_wine_to_w32_result.
3302 # Unconvertible file (directory) names in ARG are skipped; if no directory names
3303 # are convertible, then the result may be empty.
3304 func_convert_core_path_wine_to_w32 ()
3308 # unfortunately, winepath doesn't convert paths, only file names
3309 func_convert_core_path_wine_to_w32_result=
3310 if test -n "$1"; then
3313 for func_convert_core_path_wine_to_w32_f in $1; do
3315 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
3316 if test -n "$func_convert_core_file_wine_to_w32_result"; then
3317 if test -z "$func_convert_core_path_wine_to_w32_result"; then
3318 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
3320 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
3327 # end: func_convert_core_path_wine_to_w32
3330 # func_cygpath ARGS...
3331 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
3332 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
3333 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
3334 # (2), returns the Cygwin file name or path in func_cygpath_result (input
3335 # file name or path is assumed to be in w32 format, as previously converted
3336 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
3337 # or path in func_cygpath_result (input file name or path is assumed to be in
3338 # Cygwin format). Returns an empty string on error.
3340 # ARGS are passed to cygpath, with the last one being the file name or path to
3343 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
3344 # environment variable; do not put it in $PATH.
3349 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
3350 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
3351 if test "$?" -ne 0; then
3352 # on failure, ensure result is empty
3353 func_cygpath_result=
3356 func_cygpath_result=
3357 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
3363 # func_convert_core_msys_to_w32 ARG
3364 # Convert file name or path ARG from MSYS format to w32 format. Return
3365 # result in func_convert_core_msys_to_w32_result.
3366 func_convert_core_msys_to_w32 ()
3370 # awkward: cmd appends spaces to result
3371 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
3372 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
3374 #end: func_convert_core_msys_to_w32
3377 # func_convert_file_check ARG1 ARG2
3378 # Verify that ARG1 (a file name in $build format) was converted to $host
3379 # format in ARG2. Otherwise, emit an error message, but continue (resetting
3380 # func_to_host_file_result to ARG1).
3381 func_convert_file_check ()
3385 if test -z "$2" && test -n "$1"; then
3386 func_error "Could not determine host file name corresponding to"
3388 func_error "Continuing, but uninstalled executables may not work."
3390 func_to_host_file_result=$1
3393 # end func_convert_file_check
3396 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
3397 # Verify that FROM_PATH (a path in $build format) was converted to $host
3398 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
3399 # func_to_host_file_result to a simplistic fallback value (see below).
3400 func_convert_path_check ()
3404 if test -z "$4" && test -n "$3"; then
3405 func_error "Could not determine the host path corresponding to"
3407 func_error "Continuing, but uninstalled executables may not work."
3408 # Fallback. This is a deliberately simplistic "conversion" and
3409 # should not be "improved". See libtool.info.
3410 if test "x$1" != "x$2"; then
3411 lt_replace_pathsep_chars="s|$1|$2|g"
3412 func_to_host_path_result=`echo "$3" |
3413 $SED -e "$lt_replace_pathsep_chars"`
3415 func_to_host_path_result=$3
3419 # end func_convert_path_check
3422 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
3423 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
3424 # and appending REPL if ORIG matches BACKPAT.
3425 func_convert_path_front_back_pathsep ()
3430 $1 ) func_to_host_path_result=$3$func_to_host_path_result
3434 $2 ) func_append func_to_host_path_result "$3"
3438 # end func_convert_path_front_back_pathsep
3441 ##################################################
3442 # $build to $host FILE NAME CONVERSION FUNCTIONS #
3443 ##################################################
3444 # invoked via '$to_host_file_cmd ARG'
3446 # In each case, ARG is the path to be converted from $build to $host format.
3447 # Result will be available in $func_to_host_file_result.
3450 # func_to_host_file ARG
3451 # Converts the file name ARG from $build format to $host format. Return result
3452 # in func_to_host_file_result.
3453 func_to_host_file ()
3457 $to_host_file_cmd "$1"
3459 # end func_to_host_file
3462 # func_to_tool_file ARG LAZY
3463 # converts the file name ARG from $build format to toolchain format. Return
3464 # result in func_to_tool_file_result. If the conversion in use is listed
3465 # in (the comma separated) LAZY, no conversion takes place.
3466 func_to_tool_file ()
3471 *,"$to_tool_file_cmd",*)
3472 func_to_tool_file_result=$1
3475 $to_tool_file_cmd "$1"
3476 func_to_tool_file_result=$func_to_host_file_result
3480 # end func_to_tool_file
3483 # func_convert_file_noop ARG
3484 # Copy ARG to func_to_host_file_result.
3485 func_convert_file_noop ()
3487 func_to_host_file_result=$1
3489 # end func_convert_file_noop
3492 # func_convert_file_msys_to_w32 ARG
3493 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
3494 # conversion to w32 is not available inside the cwrapper. Returns result in
3495 # func_to_host_file_result.
3496 func_convert_file_msys_to_w32 ()
3500 func_to_host_file_result=$1
3501 if test -n "$1"; then
3502 func_convert_core_msys_to_w32 "$1"
3503 func_to_host_file_result=$func_convert_core_msys_to_w32_result
3505 func_convert_file_check "$1" "$func_to_host_file_result"
3507 # end func_convert_file_msys_to_w32
3510 # func_convert_file_cygwin_to_w32 ARG
3511 # Convert file name ARG from Cygwin to w32 format. Returns result in
3512 # func_to_host_file_result.
3513 func_convert_file_cygwin_to_w32 ()
3517 func_to_host_file_result=$1
3518 if test -n "$1"; then
3519 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3520 # LT_CYGPATH in this case.
3521 func_to_host_file_result=`cygpath -m "$1"`
3523 func_convert_file_check "$1" "$func_to_host_file_result"
3525 # end func_convert_file_cygwin_to_w32
3528 # func_convert_file_nix_to_w32 ARG
3529 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3530 # and a working winepath. Returns result in func_to_host_file_result.
3531 func_convert_file_nix_to_w32 ()
3535 func_to_host_file_result=$1
3536 if test -n "$1"; then
3537 func_convert_core_file_wine_to_w32 "$1"
3538 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3540 func_convert_file_check "$1" "$func_to_host_file_result"
3542 # end func_convert_file_nix_to_w32
3545 # func_convert_file_msys_to_cygwin ARG
3546 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3547 # Returns result in func_to_host_file_result.
3548 func_convert_file_msys_to_cygwin ()
3552 func_to_host_file_result=$1
3553 if test -n "$1"; then
3554 func_convert_core_msys_to_w32 "$1"
3555 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3556 func_to_host_file_result=$func_cygpath_result
3558 func_convert_file_check "$1" "$func_to_host_file_result"
3560 # end func_convert_file_msys_to_cygwin
3563 # func_convert_file_nix_to_cygwin ARG
3564 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3565 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3566 # in func_to_host_file_result.
3567 func_convert_file_nix_to_cygwin ()
3571 func_to_host_file_result=$1
3572 if test -n "$1"; then
3573 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3574 func_convert_core_file_wine_to_w32 "$1"
3575 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3576 func_to_host_file_result=$func_cygpath_result
3578 func_convert_file_check "$1" "$func_to_host_file_result"
3580 # end func_convert_file_nix_to_cygwin
3583 #############################################
3584 # $build to $host PATH CONVERSION FUNCTIONS #
3585 #############################################
3586 # invoked via '$to_host_path_cmd ARG'
3588 # In each case, ARG is the path to be converted from $build to $host format.
3589 # The result will be available in $func_to_host_path_result.
3591 # Path separators are also converted from $build format to $host format. If
3592 # ARG begins or ends with a path separator character, it is preserved (but
3593 # converted to $host format) on output.
3595 # All path conversion functions are named using the following convention:
3596 # file name conversion function : func_convert_file_X_to_Y ()
3597 # path conversion function : func_convert_path_X_to_Y ()
3598 # where, for any given $build/$host combination the 'X_to_Y' value is the
3599 # same. If conversion functions are added for new $build/$host combinations,
3600 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3604 # func_init_to_host_path_cmd
3605 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3606 # appropriate value, based on the value of $to_host_file_cmd.
3608 func_init_to_host_path_cmd ()
3612 if test -z "$to_host_path_cmd"; then
3613 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3614 to_host_path_cmd=func_convert_path_$func_stripname_result
3619 # func_to_host_path ARG
3620 # Converts the path ARG from $build format to $host format. Return result
3621 # in func_to_host_path_result.
3622 func_to_host_path ()
3626 func_init_to_host_path_cmd
3627 $to_host_path_cmd "$1"
3629 # end func_to_host_path
3632 # func_convert_path_noop ARG
3633 # Copy ARG to func_to_host_path_result.
3634 func_convert_path_noop ()
3636 func_to_host_path_result=$1
3638 # end func_convert_path_noop
3641 # func_convert_path_msys_to_w32 ARG
3642 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3643 # conversion to w32 is not available inside the cwrapper. Returns result in
3644 # func_to_host_path_result.
3645 func_convert_path_msys_to_w32 ()
3649 func_to_host_path_result=$1
3650 if test -n "$1"; then
3651 # Remove leading and trailing path separator characters from ARG. MSYS
3652 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3653 # and winepath ignores them completely.
3654 func_stripname : : "$1"
3655 func_to_host_path_tmp1=$func_stripname_result
3656 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3657 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3658 func_convert_path_check : ";" \
3659 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3660 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3663 # end func_convert_path_msys_to_w32
3666 # func_convert_path_cygwin_to_w32 ARG
3667 # Convert path ARG from Cygwin to w32 format. Returns result in
3668 # func_to_host_file_result.
3669 func_convert_path_cygwin_to_w32 ()
3673 func_to_host_path_result=$1
3674 if test -n "$1"; then
3675 # See func_convert_path_msys_to_w32:
3676 func_stripname : : "$1"
3677 func_to_host_path_tmp1=$func_stripname_result
3678 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3679 func_convert_path_check : ";" \
3680 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3681 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3684 # end func_convert_path_cygwin_to_w32
3687 # func_convert_path_nix_to_w32 ARG
3688 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3689 # a working winepath. Returns result in func_to_host_file_result.
3690 func_convert_path_nix_to_w32 ()
3694 func_to_host_path_result=$1
3695 if test -n "$1"; then
3696 # See func_convert_path_msys_to_w32:
3697 func_stripname : : "$1"
3698 func_to_host_path_tmp1=$func_stripname_result
3699 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3700 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3701 func_convert_path_check : ";" \
3702 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3703 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3706 # end func_convert_path_nix_to_w32
3709 # func_convert_path_msys_to_cygwin ARG
3710 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3711 # Returns result in func_to_host_file_result.
3712 func_convert_path_msys_to_cygwin ()
3716 func_to_host_path_result=$1
3717 if test -n "$1"; then
3718 # See func_convert_path_msys_to_w32:
3719 func_stripname : : "$1"
3720 func_to_host_path_tmp1=$func_stripname_result
3721 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3722 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3723 func_to_host_path_result=$func_cygpath_result
3724 func_convert_path_check : : \
3725 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3726 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3729 # end func_convert_path_msys_to_cygwin
3732 # func_convert_path_nix_to_cygwin ARG
3733 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3734 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3735 # func_to_host_file_result.
3736 func_convert_path_nix_to_cygwin ()
3740 func_to_host_path_result=$1
3741 if test -n "$1"; then
3742 # Remove leading and trailing path separator characters from
3743 # ARG. msys behavior is inconsistent here, cygpath turns them
3744 # into '.;' and ';.', and winepath ignores them completely.
3745 func_stripname : : "$1"
3746 func_to_host_path_tmp1=$func_stripname_result
3747 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3748 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3749 func_to_host_path_result=$func_cygpath_result
3750 func_convert_path_check : : \
3751 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3752 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3755 # end func_convert_path_nix_to_cygwin
3758 # func_dll_def_p FILE
3759 # True iff FILE is a Windows DLL '.def' file.
3760 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3765 func_dll_def_p_tmp=`$SED -n \
3767 -e '/^\(;.*\)*$/d' \
3768 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3771 test DEF = "$func_dll_def_p_tmp"
3775 # func_mode_compile arg...
3776 func_mode_compile ()
3780 # Get the compilation command and the source file.
3782 srcfile=$nonopt # always keep a non-empty value in "srcfile"
3794 # do not "continue". Instead, add this to base_compile
3806 # Accept any command-line options.
3809 test -n "$libobj" && \
3810 func_fatal_error "you cannot specify '-o' more than once"
3815 -pie | -fpie | -fPIE)
3816 func_append pie_flag " $arg"
3820 -shared | -static | -prefer-pic | -prefer-non-pic)
3821 func_append later " $arg"
3831 arg_mode=arg # the next one goes into the "base_compile" arg list
3832 continue # The current "srcfile" will either be retained or
3833 ;; # replaced later. I would guess that would be a bug.
3836 func_stripname '-Wc,' '' "$arg"
3837 args=$func_stripname_result
3839 save_ifs=$IFS; IFS=,
3840 for arg in $args; do
3842 func_append_quoted lastarg "$arg"
3845 func_stripname ' ' '' "$lastarg"
3846 lastarg=$func_stripname_result
3848 # Add the arguments to base_compile.
3849 func_append base_compile " $lastarg"
3854 # Accept the current argument as the source file.
3855 # The previous "srcfile" becomes the current argument.
3862 esac # case $arg_mode
3864 # Aesthetically quote the previous argument.
3865 func_append_quoted base_compile "$lastarg"
3870 func_fatal_error "you must specify an argument for -Xcompile"
3873 func_fatal_error "you must specify a target with '-o'"
3876 # Get the name of the library object.
3877 test -z "$libobj" && {
3878 func_basename "$srcfile"
3879 libobj=$func_basename_result
3884 # Recognize several different file suffixes.
3885 # If the user specifies -o file.o, it is replaced with file.lo
3888 *.ada | *.adb | *.ads | *.asm | \
3889 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3890 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3891 func_xform "$libobj"
3892 libobj=$func_xform_result
3897 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3899 func_fatal_error "cannot determine name of library object from '$libobj'"
3903 func_infer_tag $base_compile
3905 for arg in $later; do
3908 test yes = "$build_libtool_libs" \
3909 || func_fatal_configuration "cannot build a shared library"
3915 build_libtool_libs=no
3932 func_quote_for_eval "$libobj"
3933 test "X$libobj" != "X$func_quote_for_eval_result" \
3934 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3935 && func_warning "libobj name '$libobj' may not contain shell special characters."
3936 func_dirname_and_basename "$obj" "/" ""
3937 objname=$func_basename_result
3938 xdir=$func_dirname_result
3939 lobj=$xdir$objdir/$objname
3941 test -z "$base_compile" && \
3942 func_fatal_help "you must specify a compilation command"
3944 # Delete any leftover library objects.
3945 if test yes = "$build_old_libs"; then
3946 removelist="$obj $lobj $libobj ${libobj}T"
3948 removelist="$lobj $libobj ${libobj}T"
3951 # On Cygwin there's no "real" PIC flag so we must build both object types
3953 cygwin* | mingw* | pw32* | os2* | cegcc*)
3957 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3958 # non-PIC code in shared libraries is not supported
3962 # Calculate the filename of the output object if compiler does
3963 # not support -o with -c
3964 if test no = "$compiler_c_o"; then
3965 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3966 lockfile=$output_obj.lock
3973 # Lock this critical section if it is needed
3974 # We use this script file to make the link, it avoids creating a new file
3975 if test yes = "$need_locks"; then
3976 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3977 func_echo "Waiting for $lockfile to be removed"
3980 elif test warn = "$need_locks"; then
3981 if test -f "$lockfile"; then
3983 *** ERROR, $lockfile exists and contains:
3984 `cat $lockfile 2>/dev/null`
3986 This indicates that another process is trying to use the same
3987 temporary object file, and libtool could not work around it because
3988 your compiler does not support '-c' and '-o' together. If you
3989 repeat this compilation, it may succeed, by chance, but you had better
3990 avoid parallel builds (make -j) in this platform, or get a better
3993 $opt_dry_run || $RM $removelist
3996 func_append removelist " $output_obj"
3997 $ECHO "$srcfile" > "$lockfile"
4000 $opt_dry_run || $RM $removelist
4001 func_append removelist " $lockfile"
4002 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
4004 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
4005 srcfile=$func_to_tool_file_result
4006 func_quote_for_eval "$srcfile"
4007 qsrcfile=$func_quote_for_eval_result
4009 # Only build a PIC object if we are building libtool libraries.
4010 if test yes = "$build_libtool_libs"; then
4011 # Without this assignment, base_compile gets emptied.
4012 fbsd_hideous_sh_bug=$base_compile
4014 if test no != "$pic_mode"; then
4015 command="$base_compile $qsrcfile $pic_flag"
4017 # Don't build PIC code
4018 command="$base_compile $qsrcfile"
4021 func_mkdir_p "$xdir$objdir"
4023 if test -z "$output_obj"; then
4024 # Place PIC objects in $objdir
4025 func_append command " -o $lobj"
4028 func_show_eval_locale "$command" \
4029 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
4031 if test warn = "$need_locks" &&
4032 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
4034 *** ERROR, $lockfile contains:
4035 `cat $lockfile 2>/dev/null`
4037 but it should contain:
4040 This indicates that another process is trying to use the same
4041 temporary object file, and libtool could not work around it because
4042 your compiler does not support '-c' and '-o' together. If you
4043 repeat this compilation, it may succeed, by chance, but you had better
4044 avoid parallel builds (make -j) in this platform, or get a better
4047 $opt_dry_run || $RM $removelist
4051 # Just move the object if needed, then go on to compile the next one
4052 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
4053 func_show_eval '$MV "$output_obj" "$lobj"' \
4054 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
4057 # Allow error messages only from the first compilation.
4058 if test yes = "$suppress_opt"; then
4059 suppress_output=' >/dev/null 2>&1'
4063 # Only build a position-dependent object if we build old libraries.
4064 if test yes = "$build_old_libs"; then
4065 if test yes != "$pic_mode"; then
4066 # Don't build PIC code
4067 command="$base_compile $qsrcfile$pie_flag"
4069 command="$base_compile $qsrcfile $pic_flag"
4071 if test yes = "$compiler_c_o"; then
4072 func_append command " -o $obj"
4075 # Suppress compiler output if we already did a PIC compilation.
4076 func_append command "$suppress_output"
4077 func_show_eval_locale "$command" \
4078 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
4080 if test warn = "$need_locks" &&
4081 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
4083 *** ERROR, $lockfile contains:
4084 `cat $lockfile 2>/dev/null`
4086 but it should contain:
4089 This indicates that another process is trying to use the same
4090 temporary object file, and libtool could not work around it because
4091 your compiler does not support '-c' and '-o' together. If you
4092 repeat this compilation, it may succeed, by chance, but you had better
4093 avoid parallel builds (make -j) in this platform, or get a better
4096 $opt_dry_run || $RM $removelist
4100 # Just move the object if needed
4101 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
4102 func_show_eval '$MV "$output_obj" "$obj"' \
4103 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
4108 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
4110 # Unlock the critical section if it was locked
4111 if test no != "$need_locks"; then
4112 removelist=$lockfile
4121 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
4126 # We need to display help for each of the modes.
4129 # Generic help is extracted from the usage comments
4130 # at the start of this file.
4136 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4138 Remove files from the build directory.
4140 RM is the name of the program to use to delete files associated with each FILE
4141 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4144 If FILE is a libtool library, object or program, all the files associated
4145 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4150 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4152 Compile a source file into a libtool library object.
4154 This mode accepts the following additional options:
4156 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4157 -no-suppress do not suppress compiler output for multiple passes
4158 -prefer-pic try to build PIC objects only
4159 -prefer-non-pic try to build non-PIC objects only
4160 -shared do not build a '.o' file suitable for static linking
4161 -static only build a '.o' file suitable for static linking
4162 -Wc,FLAG pass FLAG directly to the compiler
4164 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
4165 from the given SOURCEFILE.
4167 The output file name is determined by removing the directory component from
4168 SOURCEFILE, then substituting the C source code suffix '.c' with the
4169 library object suffix, '.lo'."
4174 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
4176 Automatically set library path, then run a program.
4178 This mode accepts the following additional options:
4180 -dlopen FILE add the directory containing FILE to the library path
4182 This mode sets the library path environment variable according to '-dlopen'
4185 If any of the ARGS are libtool executable wrappers, then they are translated
4186 into their corresponding uninstalled binary, and any of their required library
4187 directories are added to the library path.
4189 Then, COMMAND is executed, with ARGS as arguments."
4194 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
4196 Complete the installation of libtool libraries.
4198 Each LIBDIR is a directory that contains libtool libraries.
4200 The commands that this mode executes may require superuser privileges. Use
4201 the '--dry-run' option if you just want to see what would be executed."
4206 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
4208 Install executables or libraries.
4210 INSTALL-COMMAND is the installation command. The first component should be
4211 either the 'install' or 'cp' program.
4213 The following components of INSTALL-COMMAND are treated specially:
4215 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
4217 The rest of the components are interpreted as arguments to that command (only
4218 BSD-compatible install options are recognized)."
4223 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
4225 Link object files or libraries together to form another library, or to
4226 create an executable program.
4228 LINK-COMMAND is a command using the C compiler that you would use to create
4229 a program from several object files.
4231 The following components of LINK-COMMAND are treated specially:
4233 -all-static do not do any dynamic linking at all
4234 -avoid-version do not add a version suffix if possible
4235 -bindir BINDIR specify path to binaries directory (for systems where
4236 libraries must be found in the PATH setting at runtime)
4237 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
4238 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4239 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4240 -export-symbols SYMFILE
4241 try to export only the symbols listed in SYMFILE
4242 -export-symbols-regex REGEX
4243 try to export only the symbols matching REGEX
4244 -LLIBDIR search LIBDIR for required installed libraries
4245 -lNAME OUTPUT-FILE requires the installed library libNAME
4246 -module build a library that can dlopened
4247 -no-fast-install disable the fast-install mode
4248 -no-install link a not-installable executable
4249 -no-undefined declare that a library does not refer to external symbols
4250 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4251 -objectlist FILE use a list of object files found in FILE to specify objects
4252 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
4253 -precious-files-regex REGEX
4254 don't remove output files matching REGEX
4255 -release RELEASE specify package release information
4256 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4257 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4258 -shared only do dynamic linking of libtool libraries
4259 -shrext SUFFIX override the standard shared library file extension
4260 -static do not do any dynamic linking of uninstalled libtool libraries
4261 -static-libtool-libs
4262 do not do any dynamic linking of libtool libraries
4263 -version-info CURRENT[:REVISION[:AGE]]
4264 specify library version info [each variable defaults to 0]
4265 -weak LIBNAME declare that the target provides the LIBNAME interface
4267 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
4269 -Xlinker FLAG pass linker-specific FLAG directly to the linker
4270 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
4272 All other options (arguments beginning with '-') are ignored.
4274 Every other argument is treated as a filename. Files ending in '.la' are
4275 treated as uninstalled libtool libraries, other files are standard or library
4278 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
4279 only library objects ('.lo' files) may be specified, and '-rpath' is
4280 required, except when creating a convenience library.
4282 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
4283 using 'ar' and 'ranlib', or on Windows using 'lib'.
4285 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
4286 is created, otherwise an executable program is created."
4291 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4293 Remove libraries from an installation directory.
4295 RM is the name of the program to use to delete files associated with each FILE
4296 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4299 If FILE is a libtool library, all the files associated with it are deleted.
4300 Otherwise, only FILE itself is deleted using RM."
4304 func_fatal_help "invalid operation mode '$opt_mode'"
4309 $ECHO "Try '$progname --help' for more information about other modes."
4312 # Now that we've collected a possible --mode arg, show help if necessary
4314 if test : = "$opt_help"; then
4319 for opt_mode in compile link execute install finish uninstall clean; do
4322 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
4325 for opt_mode in compile link execute install finish uninstall clean; do
4331 /^When reporting/,/^Report/{
4336 /information about other modes/d
4337 /more detailed .*MODE/d
4338 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
4344 # func_mode_execute arg...
4345 func_mode_execute ()
4349 # The first argument is the command name.
4352 func_fatal_help "you must specify a COMMAND"
4354 # Handle -dlopen flags immediately.
4355 for file in $opt_dlopen; do
4357 || func_fatal_help "'$file' is not a file"
4362 func_resolve_sysroot "$file"
4363 file=$func_resolve_sysroot_result
4365 # Check to see that this really is a libtool archive.
4366 func_lalib_unsafe_p "$file" \
4367 || func_fatal_help "'$lib' is not a valid libtool archive"
4369 # Read the libtool library.
4374 # Skip this library if it cannot be dlopened.
4375 if test -z "$dlname"; then
4376 # Warn if it was a shared library.
4377 test -n "$library_names" && \
4378 func_warning "'$file' was not linked with '-export-dynamic'"
4382 func_dirname "$file" "" "."
4383 dir=$func_dirname_result
4385 if test -f "$dir/$objdir/$dlname"; then
4386 func_append dir "/$objdir"
4388 if test ! -f "$dir/$dlname"; then
4389 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
4395 # Just add the directory containing the .lo file.
4396 func_dirname "$file" "" "."
4397 dir=$func_dirname_result
4401 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
4406 # Get the absolute pathname.
4407 absdir=`cd "$dir" && pwd`
4408 test -n "$absdir" && dir=$absdir
4410 # Now add the directory to shlibpath_var.
4411 if eval "test -z \"\$$shlibpath_var\""; then
4412 eval "$shlibpath_var=\"\$dir\""
4414 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4418 # This variable tells wrapper scripts just to set shlibpath_var
4419 # rather than running their programs.
4420 libtool_execute_magic=$magic
4422 # Check if any of the arguments is a wrapper script.
4427 -* | *.la | *.lo ) ;;
4429 # Do a test to see if this is really a libtool program.
4430 if func_ltwrapper_script_p "$file"; then
4432 # Transform arg to wrapped name.
4433 file=$progdir/$program
4434 elif func_ltwrapper_executable_p "$file"; then
4435 func_ltwrapper_scriptname "$file"
4436 func_source "$func_ltwrapper_scriptname_result"
4437 # Transform arg to wrapped name.
4438 file=$progdir/$program
4442 # Quote arguments (to preserve shell metacharacters).
4443 func_append_quoted args "$file"
4446 if $opt_dry_run; then
4447 # Display what would be done.
4448 if test -n "$shlibpath_var"; then
4449 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
4450 echo "export $shlibpath_var"
4455 if test -n "$shlibpath_var"; then
4456 # Export the shlibpath_var.
4457 eval "export $shlibpath_var"
4460 # Restore saved environment variables
4461 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
4463 eval "if test \"\${save_$lt_var+set}\" = set; then
4464 $lt_var=\$save_$lt_var; export $lt_var
4470 # Now prepare to actually exec the command.
4475 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
4478 # func_mode_finish arg...
4487 for opt in "$nonopt" ${1+"$@"}
4489 if test -d "$opt"; then
4490 func_append libdirs " $opt"
4492 elif test -f "$opt"; then
4493 if func_lalib_unsafe_p "$opt"; then
4494 func_append libs " $opt"
4496 func_warning "'$opt' is not a valid libtool archive"
4500 func_fatal_error "invalid argument '$opt'"
4504 if test -n "$libs"; then
4505 if test -n "$lt_sysroot"; then
4506 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
4507 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
4512 # Remove sysroot references
4513 if $opt_dry_run; then
4514 for lib in $libs; do
4515 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4518 tmpdir=`func_mktempdir`
4519 for lib in $libs; do
4520 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4522 mv -f $tmpdir/tmp-la $lib
4528 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4529 for libdir in $libdirs; do
4530 if test -n "$finish_cmds"; then
4531 # Do each command in the finish commands.
4532 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4535 if test -n "$finish_eval"; then
4536 # Do the single finish_eval.
4537 eval cmds=\"$finish_eval\"
4538 $opt_dry_run || eval "$cmds" || func_append admincmds "
4544 # Exit here if they wanted silent mode.
4545 $opt_quiet && exit $EXIT_SUCCESS
4547 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4548 echo "----------------------------------------------------------------------"
4549 echo "Libraries have been installed in:"
4550 for libdir in $libdirs; do
4554 echo "If you ever happen to want to link against installed libraries"
4555 echo "in a given directory, LIBDIR, you must either use libtool, and"
4556 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4557 echo "flag during linking and do at least one of the following:"
4558 if test -n "$shlibpath_var"; then
4559 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4560 echo " during execution"
4562 if test -n "$runpath_var"; then
4563 echo " - add LIBDIR to the '$runpath_var' environment variable"
4564 echo " during linking"
4566 if test -n "$hardcode_libdir_flag_spec"; then
4568 eval flag=\"$hardcode_libdir_flag_spec\"
4570 $ECHO " - use the '$flag' linker flag"
4572 if test -n "$admincmds"; then
4573 $ECHO " - have your system administrator run these commands:$admincmds"
4575 if test -f /etc/ld.so.conf; then
4576 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4580 echo "See any operating system documentation about shared libraries for"
4582 solaris2.[6789]|solaris2.1[0-9])
4583 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4587 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4590 echo "----------------------------------------------------------------------"
4595 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4598 # func_mode_install arg...
4599 func_mode_install ()
4603 # There may be an optional sh(1) argument at the beginning of
4604 # install_prog (especially on Windows NT).
4605 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4606 # Allow the use of GNU shtool's install command.
4607 case $nonopt in *shtool*) :;; *) false;; esac
4609 # Aesthetically quote it.
4610 func_quote_for_eval "$nonopt"
4611 install_prog="$func_quote_for_eval_result "
4619 # The real first argument should be the name of the installation program.
4620 # Aesthetically quote it.
4621 func_quote_for_eval "$arg"
4622 func_append install_prog "$func_quote_for_eval_result"
4623 install_shared_prog=$install_prog
4624 case " $install_prog " in
4625 *[\\\ /]cp\ *) install_cp=: ;;
4626 *) install_cp=false ;;
4629 # We need to accept at least all the BSD install flags.
4641 if test -n "$dest"; then
4642 func_append files " $dest"
4650 if $install_cp; then :; else
4664 # If the previous option needed an argument, then skip it.
4665 if test -n "$prev"; then
4666 if test X-m = "X$prev" && test -n "$install_override_mode"; then
4667 arg2=$install_override_mode
4678 # Aesthetically quote the argument.
4679 func_quote_for_eval "$arg"
4680 func_append install_prog " $func_quote_for_eval_result"
4681 if test -n "$arg2"; then
4682 func_quote_for_eval "$arg2"
4684 func_append install_shared_prog " $func_quote_for_eval_result"
4687 test -z "$install_prog" && \
4688 func_fatal_help "you must specify an install program"
4690 test -n "$prev" && \
4691 func_fatal_help "the '$prev' option requires an argument"
4693 if test -n "$install_override_mode" && $no_mode; then
4694 if $install_cp; then :; else
4695 func_quote_for_eval "$install_override_mode"
4696 func_append install_shared_prog " -m $func_quote_for_eval_result"
4700 if test -z "$files"; then
4701 if test -z "$dest"; then
4702 func_fatal_help "no file or destination specified"
4704 func_fatal_help "you must specify a destination"
4708 # Strip any trailing slash from the destination.
4709 func_stripname '' '/' "$dest"
4710 dest=$func_stripname_result
4712 # Check to see that the destination is a directory.
4713 test -d "$dest" && isdir=:
4718 func_dirname_and_basename "$dest" "" "."
4719 destdir=$func_dirname_result
4720 destname=$func_basename_result
4722 # Not a directory, so check to see that there is only one file specified.
4723 set dummy $files; shift
4724 test "$#" -gt 1 && \
4725 func_fatal_help "'$dest' is not a directory"
4728 [\\/]* | [A-Za-z]:[\\/]*) ;;
4730 for file in $files; do
4734 func_fatal_help "'$destdir' must be an absolute directory name"
4741 # This variable tells wrapper scripts just to set variables rather
4742 # than running their programs.
4743 libtool_install_magic=$magic
4748 for file in $files; do
4750 # Do each installation.
4753 # Do the static libraries later.
4754 func_append staticlibs " $file"
4758 func_resolve_sysroot "$file"
4759 file=$func_resolve_sysroot_result
4761 # Check to see that this really is a libtool archive.
4762 func_lalib_unsafe_p "$file" \
4763 || func_fatal_help "'$file' is not a valid libtool archive"
4770 # Add the libdir to current_libdirs if it is the destination.
4771 if test "X$destdir" = "X$libdir"; then
4772 case "$current_libdirs " in
4774 *) func_append current_libdirs " $libdir" ;;
4777 # Note the libdir as a future libdir.
4778 case "$future_libdirs " in
4780 *) func_append future_libdirs " $libdir" ;;
4784 func_dirname "$file" "/" ""
4785 dir=$func_dirname_result
4786 func_append dir "$objdir"
4788 if test -n "$relink_command"; then
4789 # Determine the prefix the user has applied to our future dir.
4790 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4792 # Don't allow the user to place us outside of our expected
4793 # location b/c this prevents finding dependent libraries that
4794 # are installed to the same prefix.
4795 # At present, this check doesn't affect windows .dll's that
4796 # are installed into $libdir/../bin (currently, that works fine)
4797 # but it's something to keep an eye on.
4798 test "$inst_prefix_dir" = "$destdir" && \
4799 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
4801 if test -n "$inst_prefix_dir"; then
4802 # Stick the inst_prefix_dir data into the link command.
4803 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4805 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4808 func_warning "relinking '$file'"
4809 func_show_eval "$relink_command" \
4810 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4813 # See the names of the shared library.
4814 set dummy $library_names; shift
4815 if test -n "$1"; then
4820 test -n "$relink_command" && srcname=${realname}T
4822 # Install the shared library and build the symlinks.
4823 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
4827 cygwin* | mingw* | pw32* | cegcc*)
4842 if test -n "$tstripme" && test -n "$striplib"; then
4843 func_show_eval "$striplib $destdir/$realname" 'exit $?'
4846 if test "$#" -gt 0; then
4847 # Delete the old symlinks, and create new ones.
4848 # Try 'ln -sf' first, because the 'ln' binary might depend on
4849 # the symlink we replace! Solaris /bin/ln does not understand -f,
4850 # so we also need to try rm && ln -s.
4853 test "$linkname" != "$realname" \
4854 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4858 # Do each command in the postinstall commands.
4859 lib=$destdir/$realname
4860 func_execute_cmds "$postinstall_cmds" 'exit $?'
4863 # Install the pseudo-library for information purposes.
4864 func_basename "$file"
4865 name=$func_basename_result
4866 instname=$dir/${name}i
4867 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
4869 # Maybe install the static library, too.
4870 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
4874 # Install (i.e. copy) a libtool object.
4876 # Figure out destination file name, if it wasn't already specified.
4877 if test -n "$destname"; then
4878 destfile=$destdir/$destname
4880 func_basename "$file"
4881 destfile=$func_basename_result
4882 destfile=$destdir/$destfile
4885 # Deduce the name of the destination old-style object file.
4888 func_lo2o "$destfile"
4889 staticdest=$func_lo2o_result
4892 staticdest=$destfile
4896 func_fatal_help "cannot copy a libtool object to '$destfile'"
4900 # Install the libtool object if requested.
4901 test -n "$destfile" && \
4902 func_show_eval "$install_prog $file $destfile" 'exit $?'
4904 # Install the old object if enabled.
4905 if test yes = "$build_old_libs"; then
4906 # Deduce the name of the old-style object file.
4908 staticobj=$func_lo2o_result
4909 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
4915 # Figure out destination file name, if it wasn't already specified.
4916 if test -n "$destname"; then
4917 destfile=$destdir/$destname
4919 func_basename "$file"
4920 destfile=$func_basename_result
4921 destfile=$destdir/$destfile
4924 # If the file is missing, and there is a .exe on the end, strip it
4925 # because it is most likely a libtool script we actually want to
4930 if test ! -f "$file"; then
4931 func_stripname '' '.exe' "$file"
4932 file=$func_stripname_result
4938 # Do a test to see if this is really a libtool program.
4941 if func_ltwrapper_executable_p "$file"; then
4942 func_ltwrapper_scriptname "$file"
4943 wrapper=$func_ltwrapper_scriptname_result
4945 func_stripname '' '.exe' "$file"
4946 wrapper=$func_stripname_result
4953 if func_ltwrapper_script_p "$wrapper"; then
4957 func_source "$wrapper"
4959 # Check the variables that should have been set.
4960 test -z "$generated_by_libtool_version" && \
4961 func_fatal_error "invalid libtool wrapper script '$wrapper'"
4964 for lib in $notinst_deplibs; do
4965 # Check to see that each library is installed.
4967 if test -f "$lib"; then
4970 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4971 if test -n "$libdir" && test ! -f "$libfile"; then
4972 func_warning "'$lib' has not been installed in '$libdir'"
4978 func_source "$wrapper"
4981 if test no = "$fast_install" && test -n "$relink_command"; then
4984 tmpdir=`func_mktempdir`
4985 func_basename "$file$stripped_ext"
4986 file=$func_basename_result
4987 outputname=$tmpdir/$file
4988 # Replace the output file specification.
4989 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4992 func_quote_for_expand "$relink_command"
4993 eval "func_echo $func_quote_for_expand_result"
4995 if eval "$relink_command"; then :
4997 func_error "error: relink '$file' with the above command before installing it"
4998 $opt_dry_run || ${RM}r "$tmpdir"
5003 func_warning "cannot relink '$file'"
5007 # Install the binary that we compiled earlier.
5008 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
5012 # remove .exe since cygwin /usr/bin/install will append another
5014 case $install_prog,$host in
5015 */usr/bin/install*,*cygwin*)
5016 case $file:$destfile in
5021 destfile=$destfile.exe
5024 func_stripname '' '.exe' "$destfile"
5025 destfile=$func_stripname_result
5030 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
5031 $opt_dry_run || if test -n "$outputname"; then
5038 for file in $staticlibs; do
5039 func_basename "$file"
5040 name=$func_basename_result
5042 # Set up the ranlib parameters.
5043 oldlib=$destdir/$name
5044 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
5045 tool_oldlib=$func_to_tool_file_result
5047 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
5049 if test -n "$stripme" && test -n "$old_striplib"; then
5050 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
5053 # Do each command in the postinstall commands.
5054 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
5057 test -n "$future_libdirs" && \
5058 func_warning "remember to run '$progname --finish$future_libdirs'"
5060 if test -n "$current_libdirs"; then
5061 # Maybe just do a dry run.
5062 $opt_dry_run && current_libdirs=" -n$current_libdirs"
5063 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
5069 test install = "$opt_mode" && func_mode_install ${1+"$@"}
5072 # func_generate_dlsyms outputname originator pic_p
5073 # Extract symbols from dlprefiles and create ${outputname}S.o with
5074 # a dlpreopen symbol table.
5075 func_generate_dlsyms ()
5082 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
5085 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
5086 if test -n "$NM" && test -n "$global_symbol_pipe"; then
5087 my_dlsyms=${my_outputname}S.c
5089 func_error "not configured to extract global symbols from dlpreopened files"
5093 if test -n "$my_dlsyms"; then
5097 # Discover the nlist of each of the dlfiles.
5098 nlist=$output_objdir/$my_outputname.nm
5100 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
5102 # Parse the name list into a source file.
5103 func_verbose "creating $output_objdir/$my_dlsyms"
5105 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
5106 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
5107 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
5113 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
5114 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
5117 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
5118 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
5119 /* DATA imports from DLLs on WIN32 can't be const, because runtime
5120 relocations are performed -- see ld's documentation on pseudo-relocs. */
5121 # define LT_DLSYM_CONST
5122 #elif defined __osf__
5123 /* This system does not cope well with relocations in const data. */
5124 # define LT_DLSYM_CONST
5126 # define LT_DLSYM_CONST const
5129 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5131 /* External symbol declarations for the compiler. */\
5134 if test yes = "$dlself"; then
5135 func_verbose "generating symbol list for '$output'"
5137 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
5139 # Add our own program objects to the symbol list.
5140 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
5141 for progfile in $progfiles; do
5142 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
5143 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
5144 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
5147 if test -n "$exclude_expsyms"; then
5149 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
5150 eval '$MV "$nlist"T "$nlist"'
5154 if test -n "$export_symbols_regex"; then
5156 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
5157 eval '$MV "$nlist"T "$nlist"'
5161 # Prepare the list of exported symbols
5162 if test -z "$export_symbols"; then
5163 export_symbols=$output_objdir/$outputname.exp
5166 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
5168 *cygwin* | *mingw* | *cegcc* )
5169 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5170 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
5176 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
5177 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
5178 eval '$MV "$nlist"T "$nlist"'
5180 *cygwin* | *mingw* | *cegcc* )
5181 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5182 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
5189 for dlprefile in $dlprefiles; do
5190 func_verbose "extracting global C symbols from '$dlprefile'"
5191 func_basename "$dlprefile"
5192 name=$func_basename_result
5194 *cygwin* | *mingw* | *cegcc* )
5195 # if an import library, we need to obtain dlname
5196 if func_win32_import_lib_p "$dlprefile"; then
5197 func_tr_sh "$dlprefile"
5198 eval "curr_lafile=\$libfile_$func_tr_sh_result"
5199 dlprefile_dlbasename=
5200 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
5201 # Use subshell, to avoid clobbering current variable values
5202 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
5203 if test -n "$dlprefile_dlname"; then
5204 func_basename "$dlprefile_dlname"
5205 dlprefile_dlbasename=$func_basename_result
5207 # no lafile. user explicitly requested -dlpreopen <import library>.
5208 $sharedlib_from_linklib_cmd "$dlprefile"
5209 dlprefile_dlbasename=$sharedlib_from_linklib_result
5213 if test -n "$dlprefile_dlbasename"; then
5214 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
5216 func_warning "Could not compute DLL name from $name"
5217 eval '$ECHO ": $name " >> "$nlist"'
5219 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5220 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
5221 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
5223 else # not an import lib
5225 eval '$ECHO ": $name " >> "$nlist"'
5226 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5227 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5233 eval '$ECHO ": $name " >> "$nlist"'
5234 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5235 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5242 # Make sure we have at least an empty file.
5243 test -f "$nlist" || : > "$nlist"
5245 if test -n "$exclude_expsyms"; then
5246 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
5247 $MV "$nlist"T "$nlist"
5250 # Try sorting and uniquifying the output.
5251 if $GREP -v "^: " < "$nlist" |
5252 if sort -k 3 </dev/null >/dev/null 2>&1; then
5257 uniq > "$nlist"S; then
5260 $GREP -v "^: " < "$nlist" > "$nlist"S
5263 if test -f "$nlist"S; then
5264 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
5266 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
5269 func_show_eval '$RM "${nlist}I"'
5270 if test -n "$global_symbol_to_import"; then
5271 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
5274 echo >> "$output_objdir/$my_dlsyms" "\
5276 /* The mapping between symbol names and symbols. */
5281 extern LT_DLSYM_CONST lt_dlsymlist
5282 lt_${my_prefix}_LTX_preloaded_symbols[];\
5285 if test -s "$nlist"I; then
5286 echo >> "$output_objdir/$my_dlsyms" "\
5287 static void lt_syminit(void)
5289 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
5290 for (; symbol->name; ++symbol)
5292 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
5293 echo >> "$output_objdir/$my_dlsyms" "\
5297 echo >> "$output_objdir/$my_dlsyms" "\
5298 LT_DLSYM_CONST lt_dlsymlist
5299 lt_${my_prefix}_LTX_preloaded_symbols[] =
5300 { {\"$my_originator\", (void *) 0},"
5302 if test -s "$nlist"I; then
5303 echo >> "$output_objdir/$my_dlsyms" "\
5304 {\"@INIT@\", (void *) <_syminit},"
5307 case $need_lib_prefix in
5309 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
5312 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
5315 echo >> "$output_objdir/$my_dlsyms" "\
5319 /* This works around a problem in FreeBSD linker */
5320 #ifdef FREEBSD_WORKAROUND
5321 static const void *lt_preloaded_setup() {
5322 return lt_${my_prefix}_LTX_preloaded_symbols;
5332 pic_flag_for_symtable=
5333 case "$compile_command " in
5337 # compiling the symbol table file with pic_flag works around
5338 # a FreeBSD bug that causes programs to crash when -lm is
5339 # linked before any other PIC object. But we must not use
5340 # pic_flag when linking with -static. The problem exists in
5341 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
5342 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
5343 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
5345 pic_flag_for_symtable=" $pic_flag" ;;
5347 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
5353 for arg in $LTCFLAGS; do
5355 -pie | -fpie | -fPIE) ;;
5356 *) func_append symtab_cflags " $arg" ;;
5360 # Now compile the dynamic symbol file.
5361 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
5363 # Clean up the generated files.
5364 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
5366 # Transform the symbol file into the correct name.
5367 symfileobj=$output_objdir/${my_outputname}S.$objext
5369 *cygwin* | *mingw* | *cegcc* )
5370 if test -f "$output_objdir/$my_outputname.def"; then
5371 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5372 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5374 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5375 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5379 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5380 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5385 func_fatal_error "unknown suffix for '$my_dlsyms'"
5389 # We keep going just in case the user didn't refer to
5390 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
5391 # really was required.
5393 # Nullify the symbol file.
5394 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
5395 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
5399 # func_cygming_gnu_implib_p ARG
5400 # This predicate returns with zero status (TRUE) if
5401 # ARG is a GNU/binutils-style import library. Returns
5402 # with nonzero status (FALSE) otherwise.
5403 func_cygming_gnu_implib_p ()
5407 func_to_tool_file "$1" func_convert_file_msys_to_w32
5408 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)$'`
5409 test -n "$func_cygming_gnu_implib_tmp"
5412 # func_cygming_ms_implib_p ARG
5413 # This predicate returns with zero status (TRUE) if
5414 # ARG is an MS-style import library. Returns
5415 # with nonzero status (FALSE) otherwise.
5416 func_cygming_ms_implib_p ()
5420 func_to_tool_file "$1" func_convert_file_msys_to_w32
5421 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
5422 test -n "$func_cygming_ms_implib_tmp"
5425 # func_win32_libid arg
5426 # return the library type of file 'arg'
5428 # Need a lot of goo to handle *both* DLLs and import libs
5429 # Has to be a shell function in order to 'eat' the argument
5430 # that is supplied when $file_magic_command is called.
5431 # Despite the name, also deal with 64 bit binaries.
5436 win32_libid_type=unknown
5437 win32_fileres=`file -L $1 2>/dev/null`
5438 case $win32_fileres in
5439 *ar\ archive\ import\ library*) # definitely import
5440 win32_libid_type="x86 archive import"
5442 *ar\ archive*) # could be an import, or static
5443 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
5444 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
5445 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
5446 case $nm_interface in
5448 if func_cygming_ms_implib_p "$1" ||
5449 func_cygming_gnu_implib_p "$1"
5457 func_to_tool_file "$1" func_convert_file_msys_to_w32
5458 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
5469 case $win32_nmres in
5470 import*) win32_libid_type="x86 archive import";;
5471 *) win32_libid_type="x86 archive static";;
5476 win32_libid_type="x86 DLL"
5478 *executable*) # but shell scripts are "executable" too...
5479 case $win32_fileres in
5480 *MS\ Windows\ PE\ Intel*)
5481 win32_libid_type="x86 DLL"
5486 $ECHO "$win32_libid_type"
5489 # func_cygming_dll_for_implib ARG
5491 # Platform-specific function to extract the
5492 # name of the DLL associated with the specified
5493 # import library ARG.
5494 # Invoked by eval'ing the libtool variable
5495 # $sharedlib_from_linklib_cmd
5496 # Result is available in the variable
5497 # $sharedlib_from_linklib_result
5498 func_cygming_dll_for_implib ()
5502 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
5505 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
5507 # The is the core of a fallback implementation of a
5508 # platform-specific function to extract the name of the
5509 # DLL associated with the specified import library LIBNAME.
5511 # SECTION_NAME is either .idata$6 or .idata$7, depending
5512 # on the platform and compiler that created the implib.
5514 # Echos the name of the DLL associated with the
5515 # specified import library.
5516 func_cygming_dll_for_implib_fallback_core ()
5520 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5521 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5522 $SED '/^Contents of section '"$match_literal"':/{
5523 # Place marker at beginning of archive member dllname section
5528 # These lines can sometimes be longer than 43 characters, but
5529 # are always uninteresting
5530 /:[ ]*file format pe[i]\{,1\}-/d
5531 /^In archive [^:]*:/d
5532 # Ensure marker is printed
5534 # Remove all lines with less than 43 characters
5536 # From remaining lines, remove first 43 characters
5539 # Join marker and all lines until next marker into a single line
5540 /^====MARK====/ b para
5549 # Remove trailing dots and whitespace
5553 # we now have a list, one entry per line, of the stringified
5554 # contents of the appropriate section of all members of the
5555 # archive that possess that section. Heuristic: eliminate
5556 # all those that have a first or second character that is
5557 # a '.' (that is, objdump's representation of an unprintable
5558 # character.) This should work for all archives with less than
5559 # 0x302f exports -- but will fail for DLLs whose name actually
5560 # begins with a literal '.' or a single character followed by
5563 # Of those that remain, print the first one.
5564 $SED -e '/^\./d;/^.\./d;q'
5567 # func_cygming_dll_for_implib_fallback ARG
5568 # Platform-specific function to extract the
5569 # name of the DLL associated with the specified
5570 # import library ARG.
5572 # This fallback implementation is for use when $DLLTOOL
5573 # does not support the --identify-strict option.
5574 # Invoked by eval'ing the libtool variable
5575 # $sharedlib_from_linklib_cmd
5576 # Result is available in the variable
5577 # $sharedlib_from_linklib_result
5578 func_cygming_dll_for_implib_fallback ()
5582 if func_cygming_gnu_implib_p "$1"; then
5583 # binutils import library
5584 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5585 elif func_cygming_ms_implib_p "$1"; then
5586 # ms-generated import library
5587 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5590 sharedlib_from_linklib_result=
5595 # func_extract_an_archive dir oldlib
5596 func_extract_an_archive ()
5600 f_ex_an_ar_dir=$1; shift
5601 f_ex_an_ar_oldlib=$1
5602 if test yes = "$lock_old_archive_extraction"; then
5603 lockfile=$f_ex_an_ar_oldlib.lock
5604 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5605 func_echo "Waiting for $lockfile to be removed"
5609 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5610 'stat=$?; rm -f "$lockfile"; exit $stat'
5611 if test yes = "$lock_old_archive_extraction"; then
5612 $opt_dry_run || rm -f "$lockfile"
5614 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5617 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5622 # func_extract_archives gentop oldlib ...
5623 func_extract_archives ()
5628 my_oldlibs=${1+"$@"}
5634 for my_xlib in $my_oldlibs; do
5635 # Extract the objects.
5637 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5638 *) my_xabs=`pwd`"/$my_xlib" ;;
5640 func_basename "$my_xlib"
5641 my_xlib=$func_basename_result
5644 case " $extracted_archives " in
5646 func_arith $extracted_serial + 1
5647 extracted_serial=$func_arith_result
5648 my_xlib_u=lt$extracted_serial-$my_xlib ;;
5652 extracted_archives="$extracted_archives $my_xlib_u"
5653 my_xdir=$my_gentop/$my_xlib_u
5655 func_mkdir_p "$my_xdir"
5659 func_verbose "Extracting $my_xabs"
5660 # Do not bother doing anything if just a dry run
5662 darwin_orig_dir=`pwd`
5663 cd $my_xdir || exit $?
5664 darwin_archive=$my_xabs
5666 func_basename "$darwin_archive"
5667 darwin_base_archive=$func_basename_result
5668 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5669 if test -n "$darwin_arches"; then
5670 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5672 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5673 for darwin_arch in $darwin_arches; do
5674 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5675 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5676 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5677 func_extract_an_archive "`pwd`" "$darwin_base_archive"
5679 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5680 done # $darwin_arches
5681 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5682 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5685 for darwin_file in $darwin_filelist; do
5686 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5687 $LIPO -create -output "$darwin_file" $darwin_files
5688 done # $darwin_filelist
5690 cd "$darwin_orig_dir"
5693 func_extract_an_archive "$my_xdir" "$my_xabs"
5698 func_extract_an_archive "$my_xdir" "$my_xabs"
5701 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5704 func_extract_archives_result=$my_oldobjs
5708 # func_emit_wrapper [arg=no]
5710 # Emit a libtool wrapper script on stdout.
5711 # Don't directly open a file because we may want to
5712 # incorporate the script contents within a cygwin/mingw
5713 # wrapper executable. Must ONLY be called from within
5714 # func_mode_link because it depends on a number of variables
5717 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5718 # variable will take. If 'yes', then the emitted script
5719 # will assume that the directory where it is stored is
5720 # the $objdir directory. This is a cygwin/mingw-specific
5722 func_emit_wrapper ()
5724 func_emit_wrapper_arg1=${1-no}
5729 # $output - temporary wrapper script for $objdir/$outputname
5730 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5732 # The $output program cannot be directly executed until all the libtool
5733 # libraries that it depends on are installed.
5735 # This wrapper script should never be moved out of the build directory.
5736 # If it is, it will not operate correctly.
5738 # Sed substitution that helps us do robust quoting. It backslashifies
5739 # metacharacters that are still active within double-quoted strings.
5740 sed_quote_subst='$sed_quote_subst'
5742 # Be Bourne compatible
5743 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5746 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5747 # is contrary to our usage. Disable this feature.
5748 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5749 setopt NO_GLOB_SUBST
5751 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5753 BIN_SH=xpg4; export BIN_SH # for Tru64
5754 DUALCASE=1; export DUALCASE # for MKS sh
5756 # The HP-UX ksh and POSIX shell print the target directory to stdout
5758 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5760 relink_command=\"$relink_command\"
5762 # This environment variable determines our operation mode.
5763 if test \"\$libtool_install_magic\" = \"$magic\"; then
5764 # install mode needs the following variables:
5765 generated_by_libtool_version='$macro_version'
5766 notinst_deplibs='$notinst_deplibs'
5768 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5769 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5772 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
5775 # A function that is used when there is no print builtin or printf.
5776 func_fallback_echo ()
5778 eval 'cat <<_LTECHO_EOF
5785 # Very basic option parsing. These options are (a) specific to
5786 # the libtool wrapper, (b) are identical between the wrapper
5787 # /script/ and the wrapper /executable/ that is used only on
5788 # windows platforms, and (c) all begin with the string "--lt-"
5789 # (application programs are unlikely to have options that match
5792 # There are only two supported options: --lt-debug and
5793 # --lt-dump-script. There is, deliberately, no --lt-help.
5795 # The first argument to this parsing function should be the
5796 # script's $0 value, followed by "$@".
5798 func_parse_lt_options ()
5804 case \"\$lt_opt\" in
5805 --lt-debug) lt_option_debug=1 ;;
5807 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5808 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5809 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5810 cat \"\$lt_dump_D/\$lt_dump_F\"
5814 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5820 # Print the debug banner immediately:
5821 if test -n \"\$lt_option_debug\"; then
5822 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5826 # Used when --lt-debug. Prints its arguments to stdout
5827 # (redirection is the responsibility of the caller)
5828 func_lt_dump_args ()
5833 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5834 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5838 # Core function for launching the target application
5839 func_exec_program_core ()
5843 # Backslashes separate directories on plain windows
5844 *-*-mingw | *-*-os2* | *-cegcc*)
5846 if test -n \"\$lt_option_debug\"; then
5847 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5848 func_lt_dump_args \${1+\"\$@\"} 1>&2
5850 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5856 if test -n \"\$lt_option_debug\"; then
5857 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5858 func_lt_dump_args \${1+\"\$@\"} 1>&2
5860 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5865 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5869 # A function to encapsulate launching the target application
5870 # Strips options in the --lt-* namespace from \$@ and
5871 # launches target application with the remaining arguments.
5872 func_exec_program ()
5880 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5885 func_exec_program_core \${1+\"\$@\"}
5889 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5891 # Find the directory that this script lives in.
5892 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5893 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5895 # Follow symbolic links until we get to the real thisdir.
5896 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5897 while test -n \"\$file\"; do
5898 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5900 # If there was a directory component, then change thisdir.
5901 if test \"x\$destdir\" != \"x\$file\"; then
5902 case \"\$destdir\" in
5903 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5904 *) thisdir=\"\$thisdir/\$destdir\" ;;
5908 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5909 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5912 # Usually 'no', except on cygwin/mingw when embedded into
5914 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5915 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5916 # special case for '.'
5917 if test \"\$thisdir\" = \".\"; then
5920 # remove .libs from thisdir
5921 case \"\$thisdir\" in
5922 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5923 $objdir ) thisdir=. ;;
5927 # Try to get the absolute directory name.
5928 absdir=\`cd \"\$thisdir\" && pwd\`
5929 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5932 if test yes = "$fast_install"; then
5934 program=lt-'$outputname'$exeext
5935 progdir=\"\$thisdir/$objdir\"
5937 if test ! -f \"\$progdir/\$program\" ||
5938 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5939 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5941 file=\"\$\$-\$program\"
5943 if test ! -d \"\$progdir\"; then
5944 $MKDIR \"\$progdir\"
5946 $RM \"\$progdir/\$file\"
5951 # relink executable if necessary
5952 if test -n \"\$relink_command\"; then
5953 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5955 \$ECHO \"\$relink_command_output\" >&2
5956 $RM \"\$progdir/\$file\"
5961 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5962 { $RM \"\$progdir/\$program\";
5963 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5964 $RM \"\$progdir/\$file\"
5968 program='$outputname'
5969 progdir=\"\$thisdir/$objdir\"
5975 if test -f \"\$progdir/\$program\"; then"
5977 # fixup the dll searchpath if we need to.
5979 # Fix the DLL searchpath if we need to. Do this before prepending
5980 # to shlibpath, because on Windows, both are PATH and uninstalled
5981 # libraries must come first.
5982 if test -n "$dllsearchpath"; then
5984 # Add the dll search path components to the executable PATH
5985 PATH=$dllsearchpath:\$PATH
5989 # Export our shlibpath_var if we have one.
5990 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5992 # Add our own library path to $shlibpath_var
5993 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5995 # Some systems cannot cope with colon-terminated $shlibpath_var
5996 # The second colon is a workaround for a bug in BeOS R4 sed
5997 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5999 export $shlibpath_var
6004 if test \"\$libtool_execute_magic\" != \"$magic\"; then
6005 # Run the actual program with our arguments.
6006 func_exec_program \${1+\"\$@\"}
6009 # The program doesn't exist.
6010 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
6011 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
6012 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
6020 # func_emit_cwrapperexe_src
6021 # emit the source code for a wrapper executable on stdout
6022 # Must ONLY be called from within func_mode_link because
6023 # it depends on a number of variable set therein.
6024 func_emit_cwrapperexe_src ()
6028 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
6029 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
6031 The $output program cannot be directly executed until all the libtool
6032 libraries that it depends on are installed.
6034 This wrapper executable should never be moved out of the build directory.
6035 If it is, it will not operate correctly.
6040 # define _CRT_SECURE_NO_DEPRECATE 1
6045 # include <direct.h>
6046 # include <process.h>
6049 # include <unistd.h>
6050 # include <stdint.h>
6062 #include <sys/stat.h>
6064 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
6066 /* declarations of non-ANSI functions */
6067 #if defined __MINGW32__
6068 # ifdef __STRICT_ANSI__
6069 int _putenv (const char *);
6071 #elif defined __CYGWIN__
6072 # ifdef __STRICT_ANSI__
6073 char *realpath (const char *, char *);
6074 int putenv (char *);
6075 int setenv (const char *, const char *, int);
6077 /* #elif defined other_platform || defined ... */
6080 /* portability defines, excluding path handling macros */
6081 #if defined _MSC_VER
6082 # define setmode _setmode
6084 # define chmod _chmod
6085 # define getcwd _getcwd
6086 # define putenv _putenv
6087 # define S_IXUSR _S_IEXEC
6088 #elif defined __MINGW32__
6089 # define setmode _setmode
6091 # define chmod _chmod
6092 # define getcwd _getcwd
6093 # define putenv _putenv
6094 #elif defined __CYGWIN__
6095 # define HAVE_SETENV
6096 # define FOPEN_WB "wb"
6097 /* #elif defined other platforms ... */
6100 #if defined PATH_MAX
6101 # define LT_PATHMAX PATH_MAX
6102 #elif defined MAXPATHLEN
6103 # define LT_PATHMAX MAXPATHLEN
6105 # define LT_PATHMAX 1024
6115 /* path handling portability macros */
6116 #ifndef DIR_SEPARATOR
6117 # define DIR_SEPARATOR '/'
6118 # define PATH_SEPARATOR ':'
6121 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
6123 # define HAVE_DOS_BASED_FILE_SYSTEM
6124 # define FOPEN_WB "wb"
6125 # ifndef DIR_SEPARATOR_2
6126 # define DIR_SEPARATOR_2 '\\'
6128 # ifndef PATH_SEPARATOR_2
6129 # define PATH_SEPARATOR_2 ';'
6133 #ifndef DIR_SEPARATOR_2
6134 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
6135 #else /* DIR_SEPARATOR_2 */
6136 # define IS_DIR_SEPARATOR(ch) \
6137 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
6138 #endif /* DIR_SEPARATOR_2 */
6140 #ifndef PATH_SEPARATOR_2
6141 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
6142 #else /* PATH_SEPARATOR_2 */
6143 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
6144 #endif /* PATH_SEPARATOR_2 */
6147 # define FOPEN_WB "w"
6150 # define _O_BINARY 0
6153 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
6154 #define XFREE(stale) do { \
6155 if (stale) { free (stale); stale = 0; } \
6158 #if defined LT_DEBUGWRAPPER
6159 static int lt_debug = 1;
6161 static int lt_debug = 0;
6164 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
6166 void *xmalloc (size_t num);
6167 char *xstrdup (const char *string);
6168 const char *base_name (const char *name);
6169 char *find_executable (const char *wrapper);
6170 char *chase_symlinks (const char *pathspec);
6171 int make_executable (const char *path);
6172 int check_executable (const char *path);
6173 char *strendzap (char *str, const char *pat);
6174 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
6175 void lt_fatal (const char *file, int line, const char *message, ...);
6176 static const char *nonnull (const char *s);
6177 static const char *nonempty (const char *s);
6178 void lt_setenv (const char *name, const char *value);
6179 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
6180 void lt_update_exe_path (const char *name, const char *value);
6181 void lt_update_lib_path (const char *name, const char *value);
6182 char **prepare_spawn (char **argv);
6183 void lt_dump_script (FILE *f);
6187 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
6188 # define externally_visible volatile
6190 # define externally_visible __attribute__((externally_visible)) volatile
6192 externally_visible const char * MAGIC_EXE = "$magic_exe";
6193 const char * LIB_PATH_VARNAME = "$shlibpath_var";
6196 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
6197 func_to_host_path "$temp_rpath"
6199 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
6203 const char * LIB_PATH_VALUE = "";
6207 if test -n "$dllsearchpath"; then
6208 func_to_host_path "$dllsearchpath:"
6210 const char * EXE_PATH_VARNAME = "PATH";
6211 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
6215 const char * EXE_PATH_VARNAME = "";
6216 const char * EXE_PATH_VALUE = "";
6220 if test yes = "$fast_install"; then
6222 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
6226 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
6233 #define LTWRAPPER_OPTION_PREFIX "--lt-"
6235 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
6236 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
6237 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
6240 main (int argc, char *argv[])
6245 char *actual_cwrapper_path;
6246 char *actual_cwrapper_name;
6253 program_name = (char *) xstrdup (base_name (argv[0]));
6254 newargz = XMALLOC (char *, (size_t) argc + 1);
6256 /* very simple arg parsing; don't want to rely on getopt
6257 * also, copy all non cwrapper options to newargz, except
6258 * argz[0], which is handled differently
6261 for (i = 1; i < argc; i++)
6263 if (STREQ (argv[i], dumpscript_opt))
6267 *mingw* | *cygwin* )
6268 # make stdout use "unix" line endings
6269 echo " setmode(1,_O_BINARY);"
6274 lt_dump_script (stdout);
6277 if (STREQ (argv[i], debug_opt))
6282 if (STREQ (argv[i], ltwrapper_option_prefix))
6284 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
6285 namespace, but it is not one of the ones we know about and
6286 have already dealt with, above (inluding dump-script), then
6287 report an error. Otherwise, targets might begin to believe
6288 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
6289 namespace. The first time any user complains about this, we'll
6290 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
6291 or a configure.ac-settable value.
6293 lt_fatal (__FILE__, __LINE__,
6294 "unrecognized %s option: '%s'",
6295 ltwrapper_option_prefix, argv[i]);
6298 newargz[++newargc] = xstrdup (argv[i]);
6300 newargz[++newargc] = NULL;
6304 /* The GNU banner must be the first non-error debug message */
6305 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
6308 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
6309 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
6311 tmp_pathspec = find_executable (argv[0]);
6312 if (tmp_pathspec == NULL)
6313 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
6314 lt_debugprintf (__FILE__, __LINE__,
6315 "(main) found exe (before symlink chase) at: %s\n",
6318 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
6319 lt_debugprintf (__FILE__, __LINE__,
6320 "(main) found exe (after symlink chase) at: %s\n",
6321 actual_cwrapper_path);
6322 XFREE (tmp_pathspec);
6324 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
6325 strendzap (actual_cwrapper_path, actual_cwrapper_name);
6327 /* wrapper name transforms */
6328 strendzap (actual_cwrapper_name, ".exe");
6329 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
6330 XFREE (actual_cwrapper_name);
6331 actual_cwrapper_name = tmp_pathspec;
6334 /* target_name transforms -- use actual target program name; might have lt- prefix */
6335 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
6336 strendzap (target_name, ".exe");
6337 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
6338 XFREE (target_name);
6339 target_name = tmp_pathspec;
6342 lt_debugprintf (__FILE__, __LINE__,
6343 "(main) libtool target name: %s\n",
6349 XMALLOC (char, (strlen (actual_cwrapper_path) +
6350 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
6351 strcpy (newargz[0], actual_cwrapper_path);
6352 strcat (newargz[0], "$objdir");
6353 strcat (newargz[0], "/");
6357 /* stop here, and copy so we don't have to do this twice */
6358 tmp_pathspec = xstrdup (newargz[0]);
6360 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
6361 strcat (newargz[0], actual_cwrapper_name);
6363 /* DO want the lt- prefix here if it exists, so use target_name */
6364 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
6365 XFREE (tmp_pathspec);
6366 tmp_pathspec = NULL;
6374 while ((p = strchr (newargz[0], '\\')) != NULL)
6378 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
6388 XFREE (target_name);
6389 XFREE (actual_cwrapper_path);
6390 XFREE (actual_cwrapper_name);
6392 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
6393 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
6394 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
6395 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
6396 because on Windows, both *_VARNAMEs are PATH but uninstalled
6397 libraries must come first. */
6398 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
6399 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
6401 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
6402 nonnull (lt_argv_zero));
6403 for (i = 0; i < newargc; i++)
6405 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
6406 i, nonnull (newargz[i]));
6414 /* execv doesn't actually work on mingw as expected on unix */
6415 newargz = prepare_spawn (newargz);
6416 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
6419 /* failed to start process */
6420 lt_debugprintf (__FILE__, __LINE__,
6421 "(main) failed to launch target \"%s\": %s\n",
6422 lt_argv_zero, nonnull (strerror (errno)));
6430 execv (lt_argv_zero, newargz);
6431 return rval; /* =127, but avoids unused variable warning */
6440 xmalloc (size_t num)
6442 void *p = (void *) malloc (num);
6444 lt_fatal (__FILE__, __LINE__, "memory exhausted");
6450 xstrdup (const char *string)
6452 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
6457 base_name (const char *name)
6461 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6462 /* Skip over the disk name in MSDOS pathnames. */
6463 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
6467 for (base = name; *name; name++)
6468 if (IS_DIR_SEPARATOR (*name))
6474 check_executable (const char *path)
6478 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
6480 if ((!path) || (!*path))
6483 if ((stat (path, &st) >= 0)
6484 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
6491 make_executable (const char *path)
6496 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
6498 if ((!path) || (!*path))
6501 if (stat (path, &st) >= 0)
6503 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
6508 /* Searches for the full path of the wrapper. Returns
6509 newly allocated full path name if found, NULL otherwise
6510 Does not chase symlinks, even on platforms that support them.
6513 find_executable (const char *wrapper)
6518 /* static buffer for getcwd */
6519 char tmp[LT_PATHMAX + 1];
6523 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
6524 nonempty (wrapper));
6526 if ((wrapper == NULL) || (*wrapper == '\0'))
6529 /* Absolute path? */
6530 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6531 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
6533 concat_name = xstrdup (wrapper);
6534 if (check_executable (concat_name))
6536 XFREE (concat_name);
6541 if (IS_DIR_SEPARATOR (wrapper[0]))
6543 concat_name = xstrdup (wrapper);
6544 if (check_executable (concat_name))
6546 XFREE (concat_name);
6548 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6552 for (p = wrapper; *p; p++)
6560 /* no slashes; search PATH */
6561 const char *path = getenv ("PATH");
6564 for (p = path; *p; p = p_next)
6568 for (q = p; *q; q++)
6569 if (IS_PATH_SEPARATOR (*q))
6571 p_len = (size_t) (q - p);
6572 p_next = (*q == '\0' ? q : q + 1);
6575 /* empty path: current directory */
6576 if (getcwd (tmp, LT_PATHMAX) == NULL)
6577 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6578 nonnull (strerror (errno)));
6579 tmp_len = strlen (tmp);
6581 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6582 memcpy (concat_name, tmp, tmp_len);
6583 concat_name[tmp_len] = '/';
6584 strcpy (concat_name + tmp_len + 1, wrapper);
6589 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6590 memcpy (concat_name, p, p_len);
6591 concat_name[p_len] = '/';
6592 strcpy (concat_name + p_len + 1, wrapper);
6594 if (check_executable (concat_name))
6596 XFREE (concat_name);
6599 /* not found in PATH; assume curdir */
6601 /* Relative path | not found in path: prepend cwd */
6602 if (getcwd (tmp, LT_PATHMAX) == NULL)
6603 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6604 nonnull (strerror (errno)));
6605 tmp_len = strlen (tmp);
6606 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6607 memcpy (concat_name, tmp, tmp_len);
6608 concat_name[tmp_len] = '/';
6609 strcpy (concat_name + tmp_len + 1, wrapper);
6611 if (check_executable (concat_name))
6613 XFREE (concat_name);
6618 chase_symlinks (const char *pathspec)
6621 return xstrdup (pathspec);
6623 char buf[LT_PATHMAX];
6625 char *tmp_pathspec = xstrdup (pathspec);
6627 int has_symlinks = 0;
6628 while (strlen (tmp_pathspec) && !has_symlinks)
6630 lt_debugprintf (__FILE__, __LINE__,
6631 "checking path component for symlinks: %s\n",
6633 if (lstat (tmp_pathspec, &s) == 0)
6635 if (S_ISLNK (s.st_mode) != 0)
6641 /* search backwards for last DIR_SEPARATOR */
6642 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6643 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6645 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6647 /* no more DIR_SEPARATORS left */
6654 lt_fatal (__FILE__, __LINE__,
6655 "error accessing file \"%s\": %s",
6656 tmp_pathspec, nonnull (strerror (errno)));
6659 XFREE (tmp_pathspec);
6663 return xstrdup (pathspec);
6666 tmp_pathspec = realpath (pathspec, buf);
6667 if (tmp_pathspec == 0)
6669 lt_fatal (__FILE__, __LINE__,
6670 "could not follow symlinks for %s", pathspec);
6672 return xstrdup (tmp_pathspec);
6677 strendzap (char *str, const char *pat)
6681 assert (str != NULL);
6682 assert (pat != NULL);
6685 patlen = strlen (pat);
6689 str += len - patlen;
6690 if (STREQ (str, pat))
6697 lt_debugprintf (const char *file, int line, const char *fmt, ...)
6702 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6703 va_start (args, fmt);
6704 (void) vfprintf (stderr, fmt, args);
6710 lt_error_core (int exit_status, const char *file,
6711 int line, const char *mode,
6712 const char *message, va_list ap)
6714 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6715 vfprintf (stderr, message, ap);
6716 fprintf (stderr, ".\n");
6718 if (exit_status >= 0)
6723 lt_fatal (const char *file, int line, const char *message, ...)
6726 va_start (ap, message);
6727 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6732 nonnull (const char *s)
6734 return s ? s : "(null)";
6738 nonempty (const char *s)
6740 return (s && !*s) ? "(empty)" : nonnull (s);
6744 lt_setenv (const char *name, const char *value)
6746 lt_debugprintf (__FILE__, __LINE__,
6747 "(lt_setenv) setting '%s' to '%s'\n",
6748 nonnull (name), nonnull (value));
6751 /* always make a copy, for consistency with !HAVE_SETENV */
6752 char *str = xstrdup (value);
6753 setenv (name, str, 1);
6755 size_t len = strlen (name) + 1 + strlen (value) + 1;
6756 char *str = XMALLOC (char, len);
6757 sprintf (str, "%s=%s", name, value);
6758 if (putenv (str) != EXIT_SUCCESS)
6767 lt_extend_str (const char *orig_value, const char *add, int to_end)
6770 if (orig_value && *orig_value)
6772 size_t orig_value_len = strlen (orig_value);
6773 size_t add_len = strlen (add);
6774 new_value = XMALLOC (char, add_len + orig_value_len + 1);
6777 strcpy (new_value, orig_value);
6778 strcpy (new_value + orig_value_len, add);
6782 strcpy (new_value, add);
6783 strcpy (new_value + add_len, orig_value);
6788 new_value = xstrdup (add);
6794 lt_update_exe_path (const char *name, const char *value)
6796 lt_debugprintf (__FILE__, __LINE__,
6797 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6798 nonnull (name), nonnull (value));
6800 if (name && *name && value && *value)
6802 char *new_value = lt_extend_str (getenv (name), value, 0);
6803 /* some systems can't cope with a ':'-terminated path #' */
6804 size_t len = strlen (new_value);
6805 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
6807 new_value[--len] = '\0';
6809 lt_setenv (name, new_value);
6815 lt_update_lib_path (const char *name, const char *value)
6817 lt_debugprintf (__FILE__, __LINE__,
6818 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6819 nonnull (name), nonnull (value));
6821 if (name && *name && value && *value)
6823 char *new_value = lt_extend_str (getenv (name), value, 0);
6824 lt_setenv (name, new_value);
6834 /* Prepares an argument vector before calling spawn().
6835 Note that spawn() does not by itself call the command interpreter
6836 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6837 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6839 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6840 }) ? "cmd.exe" : "command.com").
6841 Instead it simply concatenates the arguments, separated by ' ', and calls
6842 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6843 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6845 - Space and tab are interpreted as delimiters. They are not treated as
6846 delimiters if they are surrounded by double quotes: "...".
6847 - Unescaped double quotes are removed from the input. Their only effect is
6848 that within double quotes, space and tab are treated like normal
6850 - Backslashes not followed by double quotes are not special.
6851 - But 2*n+1 backslashes followed by a double quote become
6852 n backslashes followed by a double quote (n >= 0):
6857 #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"
6858 #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"
6860 prepare_spawn (char **argv)
6866 /* Count number of arguments. */
6867 for (argc = 0; argv[argc] != NULL; argc++)
6870 /* Allocate new argument vector. */
6871 new_argv = XMALLOC (char *, argc + 1);
6873 /* Put quoted arguments into the new argument vector. */
6874 for (i = 0; i < argc; i++)
6876 const char *string = argv[i];
6878 if (string[0] == '\0')
6879 new_argv[i] = xstrdup ("\"\"");
6880 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6882 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6884 unsigned int backslashes;
6886 char *quoted_string;
6893 for (s = string; *s != '\0'; s++)
6897 length += backslashes + 1;
6905 length += backslashes + 1;
6907 quoted_string = XMALLOC (char, length + 1);
6913 for (s = string; *s != '\0'; s++)
6919 for (j = backslashes + 1; j > 0; j--)
6931 for (j = backslashes; j > 0; j--)
6937 new_argv[i] = quoted_string;
6940 new_argv[i] = (char *) string;
6942 new_argv[argc] = NULL;
6951 void lt_dump_script (FILE* f)
6954 func_emit_wrapper yes |
6956 s/^\(.\{79\}\)\(..*\)/\1\
6961 s/\([^\n]*\).*/ fputs ("\1", f);/p
6968 # end: func_emit_cwrapperexe_src
6970 # func_win32_import_lib_p ARG
6971 # True if ARG is an import lib, as indicated by $file_magic_cmd
6972 func_win32_import_lib_p ()
6976 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6982 # func_suncc_cstd_abi
6983 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6984 # Several compiler flags select an ABI that is incompatible with the
6985 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
6986 func_suncc_cstd_abi ()
6990 case " $compile_command " in
6991 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6992 suncc_use_cstd_abi=no
6995 suncc_use_cstd_abi=yes
7000 # func_mode_link arg...
7006 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7007 # It is impossible to link a dll without this setting, and
7008 # we shouldn't force the makefile maintainer to figure out
7009 # what system we are compiling for in order to pass an extra
7010 # flag for every libtool invocation.
7011 # allow_undefined=no
7013 # FIXME: Unfortunately, there are problems with the above when trying
7014 # to make a dll that has undefined symbols, in which case not
7015 # even a static library is built. For now, we need to specify
7016 # -no-undefined on the libtool link line when we can be certain
7017 # that all symbols are satisfied, otherwise we get a static library.
7024 libtool_args=$nonopt
7025 base_compile="$nonopt $@"
7026 compile_command=$nonopt
7027 finalize_command=$nonopt
7040 lib_search_path=`pwd`
7042 new_inherited_linker_flags=
7051 export_symbols_regex=
7060 precious_files_regex=
7061 prefer_static_libs=no
7074 single_module=$wl-single_module
7075 func_infer_tag $base_compile
7077 # We need to know -static, to get the right output filenames.
7082 test yes != "$build_libtool_libs" \
7083 && func_fatal_configuration "cannot build a shared library"
7087 -all-static | -static | -static-libtool-libs)
7090 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
7091 func_warning "complete static linking is impossible in this configuration"
7093 if test -n "$link_static_flag"; then
7094 dlopen_self=$dlopen_self_static
7096 prefer_static_libs=yes
7099 if test -z "$pic_flag" && test -n "$link_static_flag"; then
7100 dlopen_self=$dlopen_self_static
7102 prefer_static_libs=built
7104 -static-libtool-libs)
7105 if test -z "$pic_flag" && test -n "$link_static_flag"; then
7106 dlopen_self=$dlopen_self_static
7108 prefer_static_libs=yes
7111 build_libtool_libs=no
7118 # See if our shared archives depend on static archives.
7119 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
7121 # Go through the arguments, transforming them on the way.
7122 while test "$#" -gt 0; do
7125 func_quote_for_eval "$arg"
7126 qarg=$func_quote_for_eval_unquoted_result
7127 func_append libtool_args " $func_quote_for_eval_result"
7129 # If the previous option needs an argument, assign it.
7130 if test -n "$prev"; then
7133 func_append compile_command " @OUTPUT@"
7134 func_append finalize_command " @OUTPUT@"
7146 # Add the symbol object into the linking commands.
7147 func_append compile_command " @SYMFILE@"
7148 func_append finalize_command " @SYMFILE@"
7152 *.la | *.lo) ;; # We handle these cases below.
7154 if test no = "$dlself"; then
7162 if test dlprefiles = "$prev"; then
7164 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
7174 if test dlfiles = "$prev"; then
7175 func_append dlfiles " $arg"
7177 func_append dlprefiles " $arg"
7187 || func_fatal_error "symbol file '$arg' does not exist"
7192 export_symbols_regex=$arg
7200 *" $qarg.ltframework "*) ;;
7201 *) func_append deplibs " $qarg.ltframework" # this is fixed later
7210 inst_prefix_dir=$arg
7215 # Clang does not use LLVM to link, so we can simply discard any
7216 # '-mllvm $arg' options when doing the link step.
7221 if test -f "$arg"; then
7224 for fil in `cat "$save_arg"`
7226 # func_append moreargs " $fil"
7228 # A libtool-controlled object.
7230 # Check to see that this really is a libtool object.
7231 if func_lalib_unsafe_p "$arg"; then
7238 if test -z "$pic_object" ||
7239 test -z "$non_pic_object" ||
7240 test none = "$pic_object" &&
7241 test none = "$non_pic_object"; then
7242 func_fatal_error "cannot find name of object for '$arg'"
7245 # Extract subdirectory from the argument.
7246 func_dirname "$arg" "/" ""
7247 xdir=$func_dirname_result
7249 if test none != "$pic_object"; then
7250 # Prepend the subdirectory the object is found in.
7251 pic_object=$xdir$pic_object
7253 if test dlfiles = "$prev"; then
7254 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7255 func_append dlfiles " $pic_object"
7259 # If libtool objects are unsupported, then we need to preload.
7264 # CHECK ME: I think I busted this. -Ossama
7265 if test dlprefiles = "$prev"; then
7266 # Preload the old-style object.
7267 func_append dlprefiles " $pic_object"
7272 func_append libobjs " $pic_object"
7277 if test none != "$non_pic_object"; then
7278 # Prepend the subdirectory the object is found in.
7279 non_pic_object=$xdir$non_pic_object
7281 # A standard non-PIC object
7282 func_append non_pic_objects " $non_pic_object"
7283 if test -z "$pic_object" || test none = "$pic_object"; then
7287 # If the PIC object exists, use it instead.
7288 # $xdir was prepended to $pic_object above.
7289 non_pic_object=$pic_object
7290 func_append non_pic_objects " $non_pic_object"
7293 # Only an error if not doing a dry-run.
7294 if $opt_dry_run; then
7295 # Extract subdirectory from the argument.
7296 func_dirname "$arg" "/" ""
7297 xdir=$func_dirname_result
7300 pic_object=$xdir$objdir/$func_lo2o_result
7301 non_pic_object=$xdir$func_lo2o_result
7302 func_append libobjs " $pic_object"
7303 func_append non_pic_objects " $non_pic_object"
7305 func_fatal_error "'$arg' is not a valid libtool object"
7310 func_fatal_error "link input file '$arg' does not exist"
7322 precious_files_regex=$arg
7332 # We need an absolute path.
7334 [\\/]* | [A-Za-z]:[\\/]*) ;;
7336 func_fatal_error "only absolute run-paths are allowed"
7339 if test rpath = "$prev"; then
7342 *) func_append rpath " $arg" ;;
7347 *) func_append xrpath " $arg" ;;
7359 func_append weak_libs " $arg"
7364 func_append linker_flags " $qarg"
7365 func_append compiler_flags " $qarg"
7367 func_append compile_command " $qarg"
7368 func_append finalize_command " $qarg"
7372 func_append compiler_flags " $qarg"
7374 func_append compile_command " $qarg"
7375 func_append finalize_command " $qarg"
7379 func_append linker_flags " $qarg"
7380 func_append compiler_flags " $wl$qarg"
7382 func_append compile_command " $wl$qarg"
7383 func_append finalize_command " $wl$qarg"
7387 eval "$prev=\"\$arg\""
7392 fi # test -n "$prev"
7398 if test -n "$link_static_flag"; then
7399 # See comment for -static flag below, for more details.
7400 func_append compile_command " $link_static_flag"
7401 func_append finalize_command " $link_static_flag"
7407 # FIXME: remove this flag sometime in the future.
7408 func_fatal_error "'-allow-undefined' must not be used because it is the default"
7436 -export-symbols | -export-symbols-regex)
7437 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
7438 func_fatal_error "more than one -exported-symbols argument is not allowed"
7440 if test X-export-symbols = "X$arg"; then
7458 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
7459 # so, if we see these flags be careful not to treat them like -L
7461 case $with_gcc/$host in
7462 no/*-*-irix* | /*-*-irix*)
7463 func_append compile_command " $arg"
7464 func_append finalize_command " $arg"
7471 func_stripname "-L" '' "$arg"
7472 if test -z "$func_stripname_result"; then
7473 if test "$#" -gt 0; then
7474 func_fatal_error "require no space between '-L' and '$1'"
7476 func_fatal_error "need path for '-L' option"
7479 func_resolve_sysroot "$func_stripname_result"
7480 dir=$func_resolve_sysroot_result
7481 # We need an absolute path.
7483 [\\/]* | [A-Za-z]:[\\/]*) ;;
7485 absdir=`cd "$dir" && pwd`
7486 test -z "$absdir" && \
7487 func_fatal_error "cannot determine absolute directory name of '$dir'"
7492 *" -L$dir "* | *" $arg "*)
7493 # Will only happen for absolute or sysroot arguments
7496 # Preserve sysroot, but never include relative directories
7498 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
7499 *) func_append deplibs " -L$dir" ;;
7501 func_append lib_search_path " $dir"
7505 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7506 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
7507 case :$dllsearchpath: in
7509 ::) dllsearchpath=$dir;;
7510 *) func_append dllsearchpath ":$dir";;
7512 case :$dllsearchpath: in
7513 *":$testbindir:"*) ;;
7514 ::) dllsearchpath=$testbindir;;
7515 *) func_append dllsearchpath ":$testbindir";;
7523 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7525 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7526 # These systems don't actually have a C or math library (as such)
7530 # These systems don't actually have a C library (as such)
7531 test X-lc = "X$arg" && continue
7533 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7534 # Do not include libc due to us having libc/libc_r.
7535 test X-lc = "X$arg" && continue
7537 *-*-rhapsody* | *-*-darwin1.[012])
7538 # Rhapsody C and math libraries are in the System framework
7539 func_append deplibs " System.ltframework"
7542 *-*-sco3.2v5* | *-*-sco5v6*)
7543 # Causes problems with __ctype
7544 test X-lc = "X$arg" && continue
7546 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7547 # Compiler inserts libc in the correct place for threads to work
7548 test X-lc = "X$arg" && continue
7551 elif test X-lc_r = "X$arg"; then
7553 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7554 # Do not include libc_r directly, use -pthread flag.
7559 func_append deplibs " $arg"
7573 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7574 # classes, name mangling, and exception handling.
7575 # Darwin uses the -arch flag to determine output architecture.
7576 -model|-arch|-isysroot|--sysroot)
7577 func_append compiler_flags " $arg"
7578 func_append compile_command " $arg"
7579 func_append finalize_command " $arg"
7584 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7585 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7586 func_append compiler_flags " $arg"
7587 func_append compile_command " $arg"
7588 func_append finalize_command " $arg"
7589 case "$new_inherited_linker_flags " in
7591 * ) func_append new_inherited_linker_flags " $arg" ;;
7597 single_module=$wl-multi_module
7608 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7609 # The PATH hackery in wrapper scripts is required on Windows
7610 # and Darwin in order for the loader to find any dlls it needs.
7611 func_warning "'-no-install' is ignored for $host"
7612 func_warning "assuming '-no-fast-install' instead"
7615 *) no_install=yes ;;
7637 -precious-files-regex)
7658 func_stripname '-R' '' "$arg"
7659 dir=$func_stripname_result
7660 # We need an absolute path.
7662 [\\/]* | [A-Za-z]:[\\/]*) ;;
7664 func_stripname '=' '' "$dir"
7665 dir=$lt_sysroot$func_stripname_result
7668 func_fatal_error "only absolute run-paths are allowed"
7673 *) func_append xrpath " $dir" ;;
7679 # The effects of -shared are defined in a previous loop.
7688 -static | -static-libtool-libs)
7689 # The effects of -static are defined in a previous loop.
7690 # We used to do the same as -all-static on platforms that
7691 # didn't have a PIC flag, but the assumption that the effects
7692 # would be equivalent was wrong. It would break on at least
7693 # Digital Unix and AIX.
7719 func_stripname '-Wc,' '' "$arg"
7720 args=$func_stripname_result
7722 save_ifs=$IFS; IFS=,
7723 for flag in $args; do
7725 func_quote_for_eval "$flag"
7726 func_append arg " $func_quote_for_eval_result"
7727 func_append compiler_flags " $func_quote_for_eval_result"
7730 func_stripname ' ' '' "$arg"
7731 arg=$func_stripname_result
7735 func_stripname '-Wl,' '' "$arg"
7736 args=$func_stripname_result
7738 save_ifs=$IFS; IFS=,
7739 for flag in $args; do
7741 func_quote_for_eval "$flag"
7742 func_append arg " $wl$func_quote_for_eval_result"
7743 func_append compiler_flags " $wl$func_quote_for_eval_result"
7744 func_append linker_flags " $func_quote_for_eval_result"
7747 func_stripname ' ' '' "$arg"
7748 arg=$func_stripname_result
7768 func_quote_for_eval "$arg"
7769 arg=$func_quote_for_eval_result
7772 # Flags to be passed through unchanged, with rationale:
7773 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7774 # -r[0-9][0-9]* specify processor for the SGI compiler
7775 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7776 # +DA*, +DD* enable 64-bit mode for the HP compiler
7777 # -q* compiler args for the IBM compiler
7778 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7779 # -F/path path to uninstalled frameworks, gcc on darwin
7780 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7781 # -fstack-protector* stack protector flags for GCC
7782 # @file GCC response files
7783 # -tp=* Portland pgcc target processor selection
7784 # --sysroot=* for sysroot support
7785 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7786 # -specs=* GCC specs files
7787 # -stdlib=* select c++ std lib with clang
7788 # -fsanitize=* Clang/GCC memory and address sanitizer
7789 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7790 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7791 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7792 -specs=*|-fsanitize=*)
7793 func_quote_for_eval "$arg"
7794 arg=$func_quote_for_eval_result
7795 func_append compile_command " $arg"
7796 func_append finalize_command " $arg"
7797 func_append compiler_flags " $arg"
7802 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7803 # OS/2 uses -Zxxx to specify OS/2-specific options
7804 compiler_flags="$compiler_flags $arg"
7805 func_append compile_command " $arg"
7806 func_append finalize_command " $arg"
7814 # Otherwise treat like 'Some other compiler flag' below
7815 func_quote_for_eval "$arg"
7816 arg=$func_quote_for_eval_result
7820 # Some other compiler flag.
7822 func_quote_for_eval "$arg"
7823 arg=$func_quote_for_eval_result
7827 # A standard object.
7828 func_append objs " $arg"
7832 # A libtool-controlled object.
7834 # Check to see that this really is a libtool object.
7835 if func_lalib_unsafe_p "$arg"; then
7842 if test -z "$pic_object" ||
7843 test -z "$non_pic_object" ||
7844 test none = "$pic_object" &&
7845 test none = "$non_pic_object"; then
7846 func_fatal_error "cannot find name of object for '$arg'"
7849 # Extract subdirectory from the argument.
7850 func_dirname "$arg" "/" ""
7851 xdir=$func_dirname_result
7853 test none = "$pic_object" || {
7854 # Prepend the subdirectory the object is found in.
7855 pic_object=$xdir$pic_object
7857 if test dlfiles = "$prev"; then
7858 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7859 func_append dlfiles " $pic_object"
7863 # If libtool objects are unsupported, then we need to preload.
7868 # CHECK ME: I think I busted this. -Ossama
7869 if test dlprefiles = "$prev"; then
7870 # Preload the old-style object.
7871 func_append dlprefiles " $pic_object"
7876 func_append libobjs " $pic_object"
7881 if test none != "$non_pic_object"; then
7882 # Prepend the subdirectory the object is found in.
7883 non_pic_object=$xdir$non_pic_object
7885 # A standard non-PIC object
7886 func_append non_pic_objects " $non_pic_object"
7887 if test -z "$pic_object" || test none = "$pic_object"; then
7891 # If the PIC object exists, use it instead.
7892 # $xdir was prepended to $pic_object above.
7893 non_pic_object=$pic_object
7894 func_append non_pic_objects " $non_pic_object"
7897 # Only an error if not doing a dry-run.
7898 if $opt_dry_run; then
7899 # Extract subdirectory from the argument.
7900 func_dirname "$arg" "/" ""
7901 xdir=$func_dirname_result
7904 pic_object=$xdir$objdir/$func_lo2o_result
7905 non_pic_object=$xdir$func_lo2o_result
7906 func_append libobjs " $pic_object"
7907 func_append non_pic_objects " $non_pic_object"
7909 func_fatal_error "'$arg' is not a valid libtool object"
7916 func_append deplibs " $arg"
7917 func_append old_deplibs " $arg"
7922 # A libtool-controlled library.
7924 func_resolve_sysroot "$arg"
7925 if test dlfiles = "$prev"; then
7926 # This library was specified with -dlopen.
7927 func_append dlfiles " $func_resolve_sysroot_result"
7929 elif test dlprefiles = "$prev"; then
7930 # The library was specified with -dlpreopen.
7931 func_append dlprefiles " $func_resolve_sysroot_result"
7934 func_append deplibs " $func_resolve_sysroot_result"
7939 # Some other compiler argument.
7941 # Unknown arguments in both finalize_command and compile_command need
7942 # to be aesthetically quoted because they are evaled later.
7943 func_quote_for_eval "$arg"
7944 arg=$func_quote_for_eval_result
7948 # Now actually substitute the argument into the commands.
7949 if test -n "$arg"; then
7950 func_append compile_command " $arg"
7951 func_append finalize_command " $arg"
7953 done # argument parsing loop
7955 test -n "$prev" && \
7956 func_fatal_help "the '$prevarg' option requires an argument"
7958 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7959 eval arg=\"$export_dynamic_flag_spec\"
7960 func_append compile_command " $arg"
7961 func_append finalize_command " $arg"
7965 # calculate the name of the file, without its directory
7966 func_basename "$output"
7967 outputname=$func_basename_result
7968 libobjs_save=$libobjs
7970 if test -n "$shlibpath_var"; then
7971 # get the directories listed in $shlibpath_var
7972 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7976 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7977 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7979 # Definition is injected by LT_CONFIG during libtool generation.
7980 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7982 func_dirname "$output" "/" ""
7983 output_objdir=$func_dirname_result$objdir
7984 func_to_tool_file "$output_objdir/"
7985 tool_output_objdir=$func_to_tool_file_result
7986 # Create the object directory.
7987 func_mkdir_p "$output_objdir"
7989 # Determine the type of output
7992 func_fatal_help "you must specify an output file"
7994 *.$libext) linkmode=oldlib ;;
7995 *.lo | *.$objext) linkmode=obj ;;
7996 *.la) linkmode=lib ;;
7997 *) linkmode=prog ;; # Anything else should be a program.
8003 # Find all interdependent deplibs by searching for libraries
8004 # that are linked more than once (e.g. -la -lb -la)
8005 for deplib in $deplibs; do
8006 if $opt_preserve_dup_deps; then
8008 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8011 func_append libs " $deplib"
8014 if test lib = "$linkmode"; then
8015 libs="$predeps $libs $compiler_lib_search_path $postdeps"
8017 # Compute libraries that are listed more than once in $predeps
8018 # $postdeps and mark them as special (i.e., whose duplicates are
8019 # not to be eliminated).
8021 if $opt_duplicate_compiler_generated_deps; then
8022 for pre_post_dep in $predeps $postdeps; do
8023 case "$pre_post_deps " in
8024 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
8026 func_append pre_post_deps " $pre_post_dep"
8035 need_relink=no # whether we're linking any uninstalled libtool libraries
8036 notinst_deplibs= # not-installed libtool libraries
8037 notinst_path= # paths that contain not-installed libtool libraries
8041 passes="conv dlpreopen link"
8042 for file in $dlfiles $dlprefiles; do
8046 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
8057 passes="conv scan dlopen dlpreopen link"
8063 for pass in $passes; do
8064 # The preopen pass in lib mode reverses $deplibs; put it back here
8065 # so that -L comes before libs that need it for instance...
8066 if test lib,link = "$linkmode,$pass"; then
8067 ## FIXME: Find the place where the list is rebuilt in the wrong
8068 ## order, and fix it there properly
8070 for deplib in $deplibs; do
8071 tmp_deplibs="$deplib $tmp_deplibs"
8073 deplibs=$tmp_deplibs
8076 if test lib,link = "$linkmode,$pass" ||
8077 test prog,scan = "$linkmode,$pass"; then
8081 if test prog = "$linkmode"; then
8083 dlopen) libs=$dlfiles ;;
8084 dlpreopen) libs=$dlprefiles ;;
8086 libs="$deplibs %DEPLIBS%"
8087 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
8091 if test lib,dlpreopen = "$linkmode,$pass"; then
8092 # Collect and forward deplibs of preopened libtool libs
8093 for lib in $dlprefiles; do
8094 # Ignore non-libtool-libs
8096 func_resolve_sysroot "$lib"
8098 *.la) func_source "$func_resolve_sysroot_result" ;;
8101 # Collect preopened libtool deplibs, except any this library
8102 # has declared as weak libs
8103 for deplib in $dependency_libs; do
8104 func_basename "$deplib"
8105 deplib_base=$func_basename_result
8106 case " $weak_libs " in
8107 *" $deplib_base "*) ;;
8108 *) func_append deplibs " $deplib" ;;
8114 if test dlopen = "$pass"; then
8115 # Collect dlpreopened libraries
8116 save_deplibs=$deplibs
8120 for deplib in $libs; do
8124 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
8125 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
8126 if test prog,link = "$linkmode,$pass"; then
8127 compile_deplibs="$deplib $compile_deplibs"
8128 finalize_deplibs="$deplib $finalize_deplibs"
8130 func_append compiler_flags " $deplib"
8131 if test lib = "$linkmode"; then
8132 case "$new_inherited_linker_flags " in
8134 * ) func_append new_inherited_linker_flags " $deplib" ;;
8141 if test lib != "$linkmode" && test prog != "$linkmode"; then
8142 func_warning "'-l' is ignored for archives/objects"
8145 func_stripname '-l' '' "$deplib"
8146 name=$func_stripname_result
8147 if test lib = "$linkmode"; then
8148 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
8150 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
8152 for searchdir in $searchdirs; do
8153 for search_ext in .la $std_shrext .so .a; do
8154 # Search the libtool library
8155 lib=$searchdir/lib$name$search_ext
8156 if test -f "$lib"; then
8157 if test .la = "$search_ext"; then
8167 # deplib is a libtool library
8168 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
8169 # We need to do some special things here, and not later.
8170 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8171 case " $predeps $postdeps " in
8173 if func_lalib_p "$lib"; then
8177 for l in $old_library $library_names; do
8180 if test "X$ll" = "X$old_library"; then # only static version available
8182 func_dirname "$lib" "" "."
8183 ladir=$func_dirname_result
8184 lib=$ladir/$old_library
8185 if test prog,link = "$linkmode,$pass"; then
8186 compile_deplibs="$deplib $compile_deplibs"
8187 finalize_deplibs="$deplib $finalize_deplibs"
8189 deplibs="$deplib $deplibs"
8190 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8200 # deplib doesn't seem to be a libtool library
8201 if test prog,link = "$linkmode,$pass"; then
8202 compile_deplibs="$deplib $compile_deplibs"
8203 finalize_deplibs="$deplib $finalize_deplibs"
8205 deplibs="$deplib $deplibs"
8206 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8212 if test prog,link = "$linkmode,$pass"; then
8213 compile_deplibs="$deplib $compile_deplibs"
8214 finalize_deplibs="$deplib $finalize_deplibs"
8216 deplibs="$deplib $deplibs"
8217 if test lib = "$linkmode"; then
8218 case "$new_inherited_linker_flags " in
8220 * ) func_append new_inherited_linker_flags " $deplib" ;;
8229 deplibs="$deplib $deplibs"
8230 test conv = "$pass" && continue
8231 newdependency_libs="$deplib $newdependency_libs"
8232 func_stripname '-L' '' "$deplib"
8233 func_resolve_sysroot "$func_stripname_result"
8234 func_append newlib_search_path " $func_resolve_sysroot_result"
8237 if test conv = "$pass"; then
8238 deplibs="$deplib $deplibs"
8241 if test scan = "$pass"; then
8242 deplibs="$deplib $deplibs"
8244 compile_deplibs="$deplib $compile_deplibs"
8245 finalize_deplibs="$deplib $finalize_deplibs"
8247 func_stripname '-L' '' "$deplib"
8248 func_resolve_sysroot "$func_stripname_result"
8249 func_append newlib_search_path " $func_resolve_sysroot_result"
8252 func_warning "'-L' is ignored for archives/objects"
8258 if test link = "$pass"; then
8259 func_stripname '-R' '' "$deplib"
8260 func_resolve_sysroot "$func_stripname_result"
8261 dir=$func_resolve_sysroot_result
8262 # Make sure the xrpath contains only unique directories.
8265 *) func_append xrpath " $dir" ;;
8268 deplibs="$deplib $deplibs"
8272 func_resolve_sysroot "$deplib"
8273 lib=$func_resolve_sysroot_result
8276 if test conv = "$pass"; then
8277 deplibs="$deplib $deplibs"
8282 # Linking convenience modules into shared libraries is allowed,
8283 # but linking other static libraries is non-portable.
8284 case " $dlpreconveniencelibs " in
8288 case $deplibs_check_method in
8290 set dummy $deplibs_check_method; shift
8291 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8292 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
8293 | $EGREP "$match_pattern_regex" > /dev/null; then
8301 if $valid_a_lib; then
8303 $ECHO "*** Warning: Linking the shared library $output against the"
8304 $ECHO "*** static library $deplib is not portable!"
8305 deplibs="$deplib $deplibs"
8308 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
8309 echo "*** I have the capability to make that library automatically link in when"
8310 echo "*** you link to this library. But I can only do this if you have a"
8311 echo "*** shared version of the library, which you do not appear to have"
8312 echo "*** because the file extensions .$libext of this argument makes me believe"
8313 echo "*** that it is just a static archive that I should not use here."
8320 if test link != "$pass"; then
8321 deplibs="$deplib $deplibs"
8323 compile_deplibs="$deplib $compile_deplibs"
8324 finalize_deplibs="$deplib $finalize_deplibs"
8331 if test conv = "$pass"; then
8332 deplibs="$deplib $deplibs"
8333 elif test prog = "$linkmode"; then
8334 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
8335 # If there is no dlopen support or we're linking statically,
8336 # we need to preload.
8337 func_append newdlprefiles " $deplib"
8338 compile_deplibs="$deplib $compile_deplibs"
8339 finalize_deplibs="$deplib $finalize_deplibs"
8341 func_append newdlfiles " $deplib"
8352 $found || test -f "$lib" \
8353 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
8355 # Check to see that this really is a libtool archive.
8356 func_lalib_unsafe_p "$lib" \
8357 || func_fatal_error "'$lib' is not a valid libtool archive"
8359 func_dirname "$lib" "" "."
8360 ladir=$func_dirname_result
8368 inherited_linker_flags=
8369 # If the library was installed with an old release of libtool,
8370 # it will not redefine variables installed, or shouldnotlink
8379 # Convert "-framework foo" to "foo.ltframework"
8380 if test -n "$inherited_linker_flags"; then
8381 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
8382 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
8383 case " $new_inherited_linker_flags " in
8384 *" $tmp_inherited_linker_flag "*) ;;
8385 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
8389 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8390 if test lib,link = "$linkmode,$pass" ||
8391 test prog,scan = "$linkmode,$pass" ||
8392 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
8393 test -n "$dlopen" && func_append dlfiles " $dlopen"
8394 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
8397 if test conv = "$pass"; then
8398 # Only check for convenience libraries
8399 deplibs="$lib $deplibs"
8400 if test -z "$libdir"; then
8401 if test -z "$old_library"; then
8402 func_fatal_error "cannot find name of link library for '$lib'"
8404 # It is a libtool convenience library, so add in its objects.
8405 func_append convenience " $ladir/$objdir/$old_library"
8406 func_append old_convenience " $ladir/$objdir/$old_library"
8408 for deplib in $dependency_libs; do
8409 deplibs="$deplib $deplibs"
8410 if $opt_preserve_dup_deps; then
8411 case "$tmp_libs " in
8412 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8415 func_append tmp_libs " $deplib"
8417 elif test prog != "$linkmode" && test lib != "$linkmode"; then
8418 func_fatal_error "'$lib' is not a convenience library"
8424 # Get the name of the library we link against.
8426 if test -n "$old_library" &&
8427 { test yes = "$prefer_static_libs" ||
8428 test built,no = "$prefer_static_libs,$installed"; }; then
8429 linklib=$old_library
8431 for l in $old_library $library_names; do
8435 if test -z "$linklib"; then
8436 func_fatal_error "cannot find name of link library for '$lib'"
8439 # This library was specified with -dlopen.
8440 if test dlopen = "$pass"; then
8442 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8443 if test -z "$dlname" ||
8444 test yes != "$dlopen_support" ||
8445 test no = "$build_libtool_libs"
8447 # If there is no dlname, no dlopen support or we're linking
8448 # statically, we need to preload. We also need to preload any
8449 # dependent libraries so libltdl's deplib preloader doesn't
8450 # bomb out in the load deplibs phase.
8451 func_append dlprefiles " $lib $dependency_libs"
8453 func_append newdlfiles " $lib"
8458 # We need an absolute path.
8460 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8462 abs_ladir=`cd "$ladir" && pwd`
8463 if test -z "$abs_ladir"; then
8464 func_warning "cannot determine absolute directory name of '$ladir'"
8465 func_warning "passing it literally to the linker, although it might fail"
8470 func_basename "$lib"
8471 laname=$func_basename_result
8473 # Find the relevant object directory and library name.
8474 if test yes = "$installed"; then
8475 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8476 func_warning "library '$lib' was moved."
8481 dir=$lt_sysroot$libdir
8482 absdir=$lt_sysroot$libdir
8484 test yes = "$hardcode_automatic" && avoidtemprpath=yes
8486 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8489 # Remove this search path later
8490 func_append notinst_path " $abs_ladir"
8493 absdir=$abs_ladir/$objdir
8494 # Remove this search path later
8495 func_append notinst_path " $abs_ladir"
8497 fi # $installed = yes
8498 func_stripname 'lib' '.la' "$laname"
8499 name=$func_stripname_result
8501 # This library was specified with -dlpreopen.
8502 if test dlpreopen = "$pass"; then
8503 if test -z "$libdir" && test prog = "$linkmode"; then
8504 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8507 # special handling for platforms with PE-DLLs.
8508 *cygwin* | *mingw* | *cegcc* )
8509 # Linker will automatically link against shared library if both
8510 # static and shared are present. Therefore, ensure we extract
8511 # symbols from the import library if a shared library is present
8512 # (otherwise, the dlopen module name will be incorrect). We do
8513 # this by putting the import library name into $newdlprefiles.
8514 # We recover the dlopen module name by 'saving' the la file
8515 # name in a special purpose variable, and (later) extracting the
8516 # dlname from the la file.
8517 if test -n "$dlname"; then
8518 func_tr_sh "$dir/$linklib"
8519 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8520 func_append newdlprefiles " $dir/$linklib"
8522 func_append newdlprefiles " $dir/$old_library"
8523 # Keep a list of preopened convenience libraries to check
8524 # that they are being used correctly in the link pass.
8525 test -z "$libdir" && \
8526 func_append dlpreconveniencelibs " $dir/$old_library"
8530 # Prefer using a static library (so that no silly _DYNAMIC symbols
8531 # are required to link).
8532 if test -n "$old_library"; then
8533 func_append newdlprefiles " $dir/$old_library"
8534 # Keep a list of preopened convenience libraries to check
8535 # that they are being used correctly in the link pass.
8536 test -z "$libdir" && \
8537 func_append dlpreconveniencelibs " $dir/$old_library"
8538 # Otherwise, use the dlname, so that lt_dlopen finds it.
8539 elif test -n "$dlname"; then
8540 func_append newdlprefiles " $dir/$dlname"
8542 func_append newdlprefiles " $dir/$linklib"
8546 fi # $pass = dlpreopen
8548 if test -z "$libdir"; then
8549 # Link the convenience library
8550 if test lib = "$linkmode"; then
8551 deplibs="$dir/$old_library $deplibs"
8552 elif test prog,link = "$linkmode,$pass"; then
8553 compile_deplibs="$dir/$old_library $compile_deplibs"
8554 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8556 deplibs="$lib $deplibs" # used for prog,scan pass
8562 if test prog = "$linkmode" && test link != "$pass"; then
8563 func_append newlib_search_path " $ladir"
8564 deplibs="$lib $deplibs"
8566 linkalldeplibs=false
8567 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8568 test no = "$build_libtool_libs"; then
8573 for deplib in $dependency_libs; do
8575 -L*) func_stripname '-L' '' "$deplib"
8576 func_resolve_sysroot "$func_stripname_result"
8577 func_append newlib_search_path " $func_resolve_sysroot_result"
8580 # Need to link against all dependency_libs?
8581 if $linkalldeplibs; then
8582 deplibs="$deplib $deplibs"
8584 # Need to hardcode shared library paths
8585 # or/and link against static libraries
8586 newdependency_libs="$deplib $newdependency_libs"
8588 if $opt_preserve_dup_deps; then
8589 case "$tmp_libs " in
8590 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8593 func_append tmp_libs " $deplib"
8596 fi # $linkmode = prog...
8598 if test prog,link = "$linkmode,$pass"; then
8599 if test -n "$library_names" &&
8600 { { test no = "$prefer_static_libs" ||
8601 test built,yes = "$prefer_static_libs,$installed"; } ||
8602 test -z "$old_library"; }; then
8603 # We need to hardcode the library path
8604 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8605 # Make sure the rpath contains only unique directories.
8606 case $temp_rpath: in
8608 *) func_append temp_rpath "$absdir:" ;;
8612 # Hardcode the library path.
8613 # Skip directories that are in the system default run-time
8615 case " $sys_lib_dlsearch_path " in
8618 case "$compile_rpath " in
8620 *) func_append compile_rpath " $absdir" ;;
8624 case " $sys_lib_dlsearch_path " in
8627 case "$finalize_rpath " in
8629 *) func_append finalize_rpath " $libdir" ;;
8633 fi # $linkmode,$pass = prog,link...
8636 { test pass_all = "$deplibs_check_method" ||
8637 { test yes = "$build_libtool_libs" &&
8638 test -n "$library_names"; }; }; then
8639 # We only need to search for static libraries
8644 link_static=no # Whether the deplib will be linked statically
8645 use_static_libs=$prefer_static_libs
8646 if test built = "$use_static_libs" && test yes = "$installed"; then
8649 if test -n "$library_names" &&
8650 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8652 *cygwin* | *mingw* | *cegcc* | *os2*)
8653 # No point in relinking DLLs because paths are not encoded
8654 func_append notinst_deplibs " $lib"
8658 if test no = "$installed"; then
8659 func_append notinst_deplibs " $lib"
8664 # This is a shared library
8666 # Warn about portability, can't link against -module's on some
8667 # systems (darwin). Don't bleat about dlopened modules though!
8669 for dlpremoduletest in $dlprefiles; do
8670 if test "X$dlpremoduletest" = "X$lib"; then
8671 dlopenmodule=$dlpremoduletest
8675 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8677 if test prog = "$linkmode"; then
8678 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8680 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8682 $ECHO "*** $linklib is not portable!"
8684 if test lib = "$linkmode" &&
8685 test yes = "$hardcode_into_libs"; then
8686 # Hardcode the library path.
8687 # Skip directories that are in the system default run-time
8689 case " $sys_lib_dlsearch_path " in
8692 case "$compile_rpath " in
8694 *) func_append compile_rpath " $absdir" ;;
8698 case " $sys_lib_dlsearch_path " in
8701 case "$finalize_rpath " in
8703 *) func_append finalize_rpath " $libdir" ;;
8709 if test -n "$old_archive_from_expsyms_cmds"; then
8710 # figure out the soname
8711 set dummy $library_names
8715 libname=`eval "\\$ECHO \"$libname_spec\""`
8716 # use dlname if we got it. it's perfectly good, no?
8717 if test -n "$dlname"; then
8719 elif test -n "$soname_spec"; then
8722 *cygwin* | mingw* | *cegcc* | *os2*)
8723 func_arith $current - $age
8724 major=$func_arith_result
8728 eval soname=\"$soname_spec\"
8733 # Make a new name for the extract_expsyms_cmds to use
8735 func_basename "$soroot"
8736 soname=$func_basename_result
8737 func_stripname 'lib' '.dll' "$soname"
8738 newlib=libimp-$func_stripname_result.a
8740 # If the library has no export list, then create one now
8741 if test -f "$output_objdir/$soname-def"; then :
8743 func_verbose "extracting exported symbol list from '$soname'"
8744 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8748 if test -f "$output_objdir/$newlib"; then :; else
8749 func_verbose "generating import library for '$soname'"
8750 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8752 # make sure the library variables are pointing to the new library
8755 fi # test -n "$old_archive_from_expsyms_cmds"
8757 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8762 case $hardcode_action in
8763 immediate | unsupported)
8764 if test no = "$hardcode_direct"; then
8767 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8768 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8769 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8770 *-*-unixware7*) add_dir=-L$dir ;;
8772 # if the lib is a (non-dlopened) module then we cannot
8773 # link against it, someone is ignoring the earlier warnings
8774 if /usr/bin/file -L $add 2> /dev/null |
8775 $GREP ": [^:]* bundle" >/dev/null; then
8776 if test "X$dlopenmodule" != "X$lib"; then
8777 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8778 if test -z "$old_library"; then
8780 echo "*** And there doesn't seem to be a static archive available"
8781 echo "*** The link will probably fail, sorry"
8783 add=$dir/$old_library
8785 elif test -n "$old_library"; then
8786 add=$dir/$old_library
8790 elif test no = "$hardcode_minus_L"; then
8792 *-*-sunos*) add_shlibpath=$dir ;;
8796 elif test no = "$hardcode_shlibpath_var"; then
8804 if test yes = "$hardcode_direct" &&
8805 test no = "$hardcode_direct_absolute"; then
8807 elif test yes = "$hardcode_minus_L"; then
8809 # Try looking first in the location we're being installed to.
8810 if test -n "$inst_prefix_dir"; then
8813 func_append add_dir " -L$inst_prefix_dir$libdir"
8818 elif test yes = "$hardcode_shlibpath_var"; then
8828 if test yes != "$lib_linked"; then
8829 func_fatal_configuration "unsupported hardcode properties"
8832 if test -n "$add_shlibpath"; then
8833 case :$compile_shlibpath: in
8834 *":$add_shlibpath:"*) ;;
8835 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8838 if test prog = "$linkmode"; then
8839 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8840 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8842 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8843 test -n "$add" && deplibs="$add $deplibs"
8844 if test yes != "$hardcode_direct" &&
8845 test yes != "$hardcode_minus_L" &&
8846 test yes = "$hardcode_shlibpath_var"; then
8847 case :$finalize_shlibpath: in
8849 *) func_append finalize_shlibpath "$libdir:" ;;
8855 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8859 # Finalize command for both is simple: just hardcode it.
8860 if test yes = "$hardcode_direct" &&
8861 test no = "$hardcode_direct_absolute"; then
8862 add=$libdir/$linklib
8863 elif test yes = "$hardcode_minus_L"; then
8866 elif test yes = "$hardcode_shlibpath_var"; then
8867 case :$finalize_shlibpath: in
8869 *) func_append finalize_shlibpath "$libdir:" ;;
8872 elif test yes = "$hardcode_automatic"; then
8873 if test -n "$inst_prefix_dir" &&
8874 test -f "$inst_prefix_dir$libdir/$linklib"; then
8875 add=$inst_prefix_dir$libdir/$linklib
8877 add=$libdir/$linklib
8880 # We cannot seem to hardcode it, guess we'll fake it.
8882 # Try looking first in the location we're being installed to.
8883 if test -n "$inst_prefix_dir"; then
8886 func_append add_dir " -L$inst_prefix_dir$libdir"
8893 if test prog = "$linkmode"; then
8894 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8895 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8897 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8898 test -n "$add" && deplibs="$add $deplibs"
8901 elif test prog = "$linkmode"; then
8902 # Here we assume that one of hardcode_direct or hardcode_minus_L
8903 # is not unsupported. This is valid on all known static and
8905 if test unsupported != "$hardcode_direct"; then
8906 test -n "$old_library" && linklib=$old_library
8907 compile_deplibs="$dir/$linklib $compile_deplibs"
8908 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8910 compile_deplibs="-l$name -L$dir $compile_deplibs"
8911 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8913 elif test yes = "$build_libtool_libs"; then
8914 # Not a shared library
8915 if test pass_all != "$deplibs_check_method"; then
8916 # We're trying link a shared library against a static one
8917 # but the system doesn't support it.
8919 # Just print a warning and add the library to dependency_libs so
8920 # that the program can be linked against the static library.
8922 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8923 echo "*** I have the capability to make that library automatically link in when"
8924 echo "*** you link to this library. But I can only do this if you have a"
8925 echo "*** shared version of the library, which you do not appear to have."
8926 if test yes = "$module"; then
8927 echo "*** But as you try to build a module library, libtool will still create "
8928 echo "*** a static module, that should work as long as the dlopening application"
8929 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8930 if test -z "$global_symbol_pipe"; then
8932 echo "*** However, this would only work if libtool was able to extract symbol"
8933 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8934 echo "*** not find such a program. So, this module is probably useless."
8935 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8937 if test no = "$build_old_libs"; then
8938 build_libtool_libs=module
8941 build_libtool_libs=no
8945 deplibs="$dir/$old_library $deplibs"
8948 fi # link shared/static library?
8950 if test lib = "$linkmode"; then
8951 if test -n "$dependency_libs" &&
8952 { test yes != "$hardcode_into_libs" ||
8953 test yes = "$build_old_libs" ||
8954 test yes = "$link_static"; }; then
8955 # Extract -R from dependency_libs
8957 for libdir in $dependency_libs; do
8959 -R*) func_stripname '-R' '' "$libdir"
8960 temp_xrpath=$func_stripname_result
8962 *" $temp_xrpath "*) ;;
8963 *) func_append xrpath " $temp_xrpath";;
8965 *) func_append temp_deplibs " $libdir";;
8968 dependency_libs=$temp_deplibs
8971 func_append newlib_search_path " $absdir"
8972 # Link against this library
8973 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8974 # ... and its dependency_libs
8976 for deplib in $dependency_libs; do
8977 newdependency_libs="$deplib $newdependency_libs"
8979 -L*) func_stripname '-L' '' "$deplib"
8980 func_resolve_sysroot "$func_stripname_result";;
8981 *) func_resolve_sysroot "$deplib" ;;
8983 if $opt_preserve_dup_deps; then
8984 case "$tmp_libs " in
8985 *" $func_resolve_sysroot_result "*)
8986 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8989 func_append tmp_libs " $func_resolve_sysroot_result"
8992 if test no != "$link_all_deplibs"; then
8993 # Add the search paths of all dependency libraries
8994 for deplib in $dependency_libs; do
8997 -L*) path=$deplib ;;
8999 func_resolve_sysroot "$deplib"
9000 deplib=$func_resolve_sysroot_result
9001 func_dirname "$deplib" "" "."
9002 dir=$func_dirname_result
9003 # We need an absolute path.
9005 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
9007 absdir=`cd "$dir" && pwd`
9008 if test -z "$absdir"; then
9009 func_warning "cannot determine absolute directory name of '$dir'"
9014 if $GREP "^installed=no" $deplib > /dev/null; then
9018 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
9019 if test -n "$deplibrary_names"; then
9020 for tmp in $deplibrary_names; do
9023 if test -f "$absdir/$objdir/$depdepl"; then
9024 depdepl=$absdir/$objdir/$depdepl
9025 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9026 if test -z "$darwin_install_name"; then
9027 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9029 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
9030 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
9036 path=-L$absdir/$objdir
9040 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
9041 test -z "$libdir" && \
9042 func_fatal_error "'$deplib' is not a valid libtool archive"
9043 test "$absdir" != "$libdir" && \
9044 func_warning "'$deplib' seems to be moved"
9050 case " $deplibs " in
9052 *) deplibs="$path $deplibs" ;;
9055 fi # link_all_deplibs != no
9057 done # for deplib in $libs
9058 if test link = "$pass"; then
9059 if test prog = "$linkmode"; then
9060 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
9061 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
9063 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9066 dependency_libs=$newdependency_libs
9067 if test dlpreopen = "$pass"; then
9068 # Link the dlpreopened libraries before other libraries
9069 for deplib in $save_deplibs; do
9070 deplibs="$deplib $deplibs"
9073 if test dlopen != "$pass"; then
9074 test conv = "$pass" || {
9075 # Make sure lib_search_path contains only unique directories.
9077 for dir in $newlib_search_path; do
9078 case "$lib_search_path " in
9080 *) func_append lib_search_path " $dir" ;;
9086 if test prog,link = "$linkmode,$pass"; then
9087 vars="compile_deplibs finalize_deplibs"
9091 for var in $vars dependency_libs; do
9092 # Add libraries to $var in reverse order
9093 eval tmp_libs=\"\$$var\"
9095 for deplib in $tmp_libs; do
9096 # FIXME: Pedantically, this is the right thing to do, so
9097 # that some nasty dependency loop isn't accidentally
9099 #new_libs="$deplib $new_libs"
9100 # Pragmatically, this seems to cause very few problems in
9103 -L*) new_libs="$deplib $new_libs" ;;
9106 # And here is the reason: when a library appears more
9107 # than once as an explicit dependence of a library, or
9108 # is implicitly linked in more than once by the
9109 # compiler, it is considered special, and multiple
9110 # occurrences thereof are not removed. Compare this
9111 # with having the same library being listed as a
9112 # dependency of multiple other libraries: in this case,
9113 # we know (pedantically, we assume) the library does not
9114 # need to be listed more than once, so we keep only the
9115 # last copy. This is not always right, but it is rare
9116 # enough that we require users that really mean to play
9117 # such unportable linking tricks to link the library
9118 # using -Wl,-lname, so that libtool does not consider it
9119 # for duplicate removal.
9120 case " $specialdeplibs " in
9121 *" $deplib "*) new_libs="$deplib $new_libs" ;;
9123 case " $new_libs " in
9125 *) new_libs="$deplib $new_libs" ;;
9133 for deplib in $new_libs; do
9136 case " $tmp_libs " in
9138 *) func_append tmp_libs " $deplib" ;;
9141 *) func_append tmp_libs " $deplib" ;;
9144 eval $var=\"$tmp_libs\"
9148 # Add Sun CC postdeps if required:
9149 test CXX = "$tagname" && {
9152 case `$CC -V 2>&1 | sed 5q` in
9153 *Sun\ C*) # Sun C++ 5.9
9156 if test no != "$suncc_use_cstd_abi"; then
9157 func_append postdeps ' -library=Cstd -library=Crun'
9164 func_cc_basename "$CC"
9165 case $func_cc_basename_result in
9169 if test no != "$suncc_use_cstd_abi"; then
9170 func_append postdeps ' -library=Cstd -library=Crun'
9178 # Last step: remove runtime libs from dependency_libs
9179 # (they stay in deplibs)
9181 for i in $dependency_libs; do
9182 case " $predeps $postdeps $compiler_lib_search_path " in
9187 if test -n "$i"; then
9188 func_append tmp_libs " $i"
9191 dependency_libs=$tmp_libs
9193 if test prog = "$linkmode"; then
9196 if test prog = "$linkmode" || test lib = "$linkmode"; then
9197 dlprefiles=$newdlprefiles
9202 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
9203 func_warning "'-dlopen' is ignored for archives"
9208 func_warning "'-l' and '-L' are ignored for archives" ;;
9211 test -n "$rpath" && \
9212 func_warning "'-rpath' is ignored for archives"
9214 test -n "$xrpath" && \
9215 func_warning "'-R' is ignored for archives"
9217 test -n "$vinfo" && \
9218 func_warning "'-version-info/-version-number' is ignored for archives"
9220 test -n "$release" && \
9221 func_warning "'-release' is ignored for archives"
9223 test -n "$export_symbols$export_symbols_regex" && \
9224 func_warning "'-export-symbols' is ignored for archives"
9226 # Now set the variables for building old libraries.
9227 build_libtool_libs=no
9229 func_append objs "$old_deplibs"
9233 # Make sure we only generate libraries of the form 'libNAME.la'.
9236 func_stripname 'lib' '.la' "$outputname"
9237 name=$func_stripname_result
9238 eval shared_ext=\"$shrext_cmds\"
9239 eval libname=\"$libname_spec\"
9242 test no = "$module" \
9243 && func_fatal_help "libtool library '$output' must begin with 'lib'"
9245 if test no != "$need_lib_prefix"; then
9246 # Add the "lib" prefix for modules if required
9247 func_stripname '' '.la' "$outputname"
9248 name=$func_stripname_result
9249 eval shared_ext=\"$shrext_cmds\"
9250 eval libname=\"$libname_spec\"
9252 func_stripname '' '.la' "$outputname"
9253 libname=$func_stripname_result
9258 if test -n "$objs"; then
9259 if test pass_all != "$deplibs_check_method"; then
9260 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
9263 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
9264 $ECHO "*** objects $objs is not portable!"
9265 func_append libobjs " $objs"
9269 test no = "$dlself" \
9270 || func_warning "'-dlopen self' is ignored for libtool libraries"
9275 && func_warning "ignoring multiple '-rpath's for a libtool library"
9280 if test -z "$rpath"; then
9281 if test yes = "$build_libtool_libs"; then
9282 # Building a libtool convenience library.
9283 # Some compilers have problems with a '.al' extension so
9284 # convenience libraries should have the same extension an
9285 # archive normally would.
9286 oldlibs="$output_objdir/$libname.$libext $oldlibs"
9287 build_libtool_libs=convenience
9291 test -n "$vinfo" && \
9292 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
9294 test -n "$release" && \
9295 func_warning "'-release' is ignored for convenience libraries"
9298 # Parse the version information argument.
9299 save_ifs=$IFS; IFS=:
9300 set dummy $vinfo 0 0 0
9305 func_fatal_help "too many parameters to '-version-info'"
9307 # convert absolute version numbers to libtool ages
9308 # this retains compatibility with .la files and attempts
9309 # to make the code below a bit more comprehensible
9311 case $vinfo_number in
9317 # There are really only two kinds -- those that
9318 # use the current revision as the major version
9319 # and those that subtract age and use age as
9320 # a minor version. But, then there is irix
9321 # that has an extra 1 added just for fun
9323 case $version_type in
9324 # correct linux to gnu/linux during the next big refactor
9325 darwin|freebsd-elf|linux|osf|windows|none)
9326 func_arith $number_major + $number_minor
9327 current=$func_arith_result
9329 revision=$number_revision
9331 freebsd-aout|qnx|sunos)
9332 current=$number_major
9333 revision=$number_minor
9337 func_arith $number_major + $number_minor
9338 current=$func_arith_result
9340 revision=$number_minor
9341 lt_irix_increment=no
9344 func_fatal_configuration "$modename: unknown library version type '$version_type'"
9355 # Check that each of the things are valid numbers.
9357 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]) ;;
9359 func_error "CURRENT '$current' must be a nonnegative integer"
9360 func_fatal_error "'$vinfo' is not valid version information"
9365 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]) ;;
9367 func_error "REVISION '$revision' must be a nonnegative integer"
9368 func_fatal_error "'$vinfo' is not valid version information"
9373 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]) ;;
9375 func_error "AGE '$age' must be a nonnegative integer"
9376 func_fatal_error "'$vinfo' is not valid version information"
9380 if test "$age" -gt "$current"; then
9381 func_error "AGE '$age' is greater than the current interface number '$current'"
9382 func_fatal_error "'$vinfo' is not valid version information"
9385 # Calculate the version variables.
9389 case $version_type in
9393 # Like Linux, but with the current version available in
9394 # verstring for coding it into the library header
9395 func_arith $current - $age
9396 major=.$func_arith_result
9397 versuffix=$major.$age.$revision
9398 # Darwin ld doesn't like 0 for these options...
9399 func_arith $current + 1
9400 minor_current=$func_arith_result
9401 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9402 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9403 # On Darwin other compilers
9406 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9409 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9416 versuffix=.$current.$revision
9420 func_arith $current - $age
9421 major=.$func_arith_result
9422 versuffix=$major.$age.$revision
9426 if test no = "$lt_irix_increment"; then
9427 func_arith $current - $age
9429 func_arith $current - $age + 1
9431 major=$func_arith_result
9433 case $version_type in
9434 nonstopux) verstring_prefix=nonstopux ;;
9435 *) verstring_prefix=sgi ;;
9437 verstring=$verstring_prefix$major.$revision
9439 # Add in all the interfaces that we are compatible with.
9441 while test 0 -ne "$loop"; do
9442 func_arith $revision - $loop
9443 iface=$func_arith_result
9444 func_arith $loop - 1
9445 loop=$func_arith_result
9446 verstring=$verstring_prefix$major.$iface:$verstring
9449 # Before this point, $major must not contain '.'.
9451 versuffix=$major.$revision
9454 linux) # correct to gnu/linux during the next big refactor
9455 func_arith $current - $age
9456 major=.$func_arith_result
9457 versuffix=$major.$age.$revision
9461 func_arith $current - $age
9462 major=.$func_arith_result
9463 versuffix=.$current.$age.$revision
9464 verstring=$current.$age.$revision
9466 # Add in all the interfaces that we are compatible with.
9468 while test 0 -ne "$loop"; do
9469 func_arith $current - $loop
9470 iface=$func_arith_result
9471 func_arith $loop - 1
9472 loop=$func_arith_result
9473 verstring=$verstring:$iface.0
9476 # Make executables depend on our current version.
9477 func_append verstring ":$current.0"
9492 versuffix=.$current.$revision
9496 # Use '-' rather than '.', since we only want one
9497 # extension on DOS 8.3 file systems.
9498 func_arith $current - $age
9499 major=$func_arith_result
9504 func_fatal_configuration "unknown library version type '$version_type'"
9508 # Clear the version info if we defaulted, and they specified a release.
9509 if test -z "$vinfo" && test -n "$release"; then
9511 case $version_type in
9513 # we can't check for "0.0" in archive_cmds due to quoting
9514 # problems, so we reset it completely
9521 if test no = "$need_version"; then
9528 # Remove version info from name if versioning should be avoided
9529 if test yes,no = "$avoid_version,$need_version"; then
9535 # Check to see if the archive will have undefined symbols.
9536 if test yes = "$allow_undefined"; then
9537 if test unsupported = "$allow_undefined_flag"; then
9538 if test yes = "$build_old_libs"; then
9539 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9540 build_libtool_libs=no
9542 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9546 # Don't allow undefined symbols.
9547 allow_undefined_flag=$no_undefined_flag
9552 func_generate_dlsyms "$libname" "$libname" :
9553 func_append libobjs " $symfileobj"
9554 test " " = "$libobjs" && libobjs=
9556 if test relink != "$opt_mode"; then
9557 # Remove our outputs, but don't remove object files since they
9558 # may have been created when compiling PIC objects.
9560 tempremovelist=`$ECHO "$output_objdir/*"`
9561 for p in $tempremovelist; do
9565 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9566 if test -n "$precious_files_regex"; then
9567 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9572 func_append removelist " $p"
9577 test -n "$removelist" && \
9578 func_show_eval "${RM}r \$removelist"
9581 # Now set the variables for building old libraries.
9582 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9583 func_append oldlibs " $output_objdir/$libname.$libext"
9585 # Transform .lo files to .o files.
9586 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9589 # Eliminate all temporary directories.
9590 #for path in $notinst_path; do
9591 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9592 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9593 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9596 if test -n "$xrpath"; then
9597 # If the user specified any rpath flags, then add them.
9599 for libdir in $xrpath; do
9600 func_replace_sysroot "$libdir"
9601 func_append temp_xrpath " -R$func_replace_sysroot_result"
9602 case "$finalize_rpath " in
9604 *) func_append finalize_rpath " $libdir" ;;
9607 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9608 dependency_libs="$temp_xrpath $dependency_libs"
9612 # Make sure dlfiles contains only unique files that won't be dlpreopened
9613 old_dlfiles=$dlfiles
9615 for lib in $old_dlfiles; do
9616 case " $dlprefiles $dlfiles " in
9618 *) func_append dlfiles " $lib" ;;
9622 # Make sure dlprefiles contains only unique files
9623 old_dlprefiles=$dlprefiles
9625 for lib in $old_dlprefiles; do
9626 case "$dlprefiles " in
9628 *) func_append dlprefiles " $lib" ;;
9632 if test yes = "$build_libtool_libs"; then
9633 if test -n "$rpath"; then
9635 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9636 # these systems don't actually have a c library (as such)!
9638 *-*-rhapsody* | *-*-darwin1.[012])
9639 # Rhapsody C library is in the System framework
9640 func_append deplibs " System.ltframework"
9643 # Don't link with libc until the a.out ld.so is fixed.
9645 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9646 # Do not include libc due to us having libc/libc_r.
9648 *-*-sco3.2v5* | *-*-sco5v6*)
9649 # Causes problems with __ctype
9651 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9652 # Compiler inserts libc in the correct place for threads to work
9655 # Add libc to deplibs on all other systems if necessary.
9656 if test yes = "$build_libtool_need_lc"; then
9657 func_append deplibs " -lc"
9663 # Transform deplibs into only deplibs that can be linked in shared.
9665 libname_save=$libname
9666 release_save=$release
9667 versuffix_save=$versuffix
9669 # I'm not sure if I'm treating the release correctly. I think
9670 # release should show up in the -l (ie -lgmp5) so we don't want to
9671 # add it in twice. Is that correct?
9677 case $deplibs_check_method in
9679 # Don't check for shared/static. Everything works.
9680 # This might be a little naive. We might want to check
9681 # whether the library exists or not. But this is on
9682 # osf3 & osf4 and I'm not really sure... Just
9683 # implementing what was already the behavior.
9687 # This code stresses the "libraries are programs" paradigm to its
9688 # limits. Maybe even breaks it. We compile a program, linking it
9689 # against the deplibs as a proxy for the library. Then we can check
9690 # whether they linked in statically or dynamically with ldd.
9691 $opt_dry_run || $RM conftest.c
9692 cat > conftest.c <<EOF
9693 int main() { return 0; }
9695 $opt_dry_run || $RM conftest
9696 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9697 ldd_output=`ldd conftest`
9698 for i in $deplibs; do
9701 func_stripname -l '' "$i"
9702 name=$func_stripname_result
9703 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9704 case " $predeps $postdeps " in
9706 func_append newdeplibs " $i"
9711 if test -n "$i"; then
9712 libname=`eval "\\$ECHO \"$libname_spec\""`
9713 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9714 set dummy $deplib_matches; shift
9716 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9717 func_append newdeplibs " $i"
9721 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9722 echo "*** I have the capability to make that library automatically link in when"
9723 echo "*** you link to this library. But I can only do this if you have a"
9724 echo "*** shared version of the library, which I believe you do not have"
9725 echo "*** because a test_compile did reveal that the linker did not use it for"
9726 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9731 func_append newdeplibs " $i"
9736 # Error occurred in the first compile. Let's try to salvage
9737 # the situation: Compile a separate program for each library.
9738 for i in $deplibs; do
9741 func_stripname -l '' "$i"
9742 name=$func_stripname_result
9743 $opt_dry_run || $RM conftest
9744 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9745 ldd_output=`ldd conftest`
9746 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9747 case " $predeps $postdeps " in
9749 func_append newdeplibs " $i"
9754 if test -n "$i"; then
9755 libname=`eval "\\$ECHO \"$libname_spec\""`
9756 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9757 set dummy $deplib_matches; shift
9759 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9760 func_append newdeplibs " $i"
9764 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9765 echo "*** I have the capability to make that library automatically link in when"
9766 echo "*** you link to this library. But I can only do this if you have a"
9767 echo "*** shared version of the library, which you do not appear to have"
9768 echo "*** because a test_compile did reveal that the linker did not use this one"
9769 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9775 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9776 echo "*** make it link in! You will probably need to install it or some"
9777 echo "*** library that it depends on before this library will be fully"
9778 echo "*** functional. Installing it before continuing would be even better."
9782 func_append newdeplibs " $i"
9789 set dummy $deplibs_check_method; shift
9790 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9791 for a_deplib in $deplibs; do
9794 func_stripname -l '' "$a_deplib"
9795 name=$func_stripname_result
9796 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9797 case " $predeps $postdeps " in
9799 func_append newdeplibs " $a_deplib"
9804 if test -n "$a_deplib"; then
9805 libname=`eval "\\$ECHO \"$libname_spec\""`
9806 if test -n "$file_magic_glob"; then
9807 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9809 libnameglob=$libname
9811 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9812 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9813 if test yes = "$want_nocaseglob"; then
9815 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9818 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9820 for potent_lib in $potential_libs; do
9821 # Follow soft links.
9822 if ls -lLd "$potent_lib" 2>/dev/null |
9823 $GREP " -> " >/dev/null; then
9826 # The statement above tries to avoid entering an
9827 # endless loop below, in case of cyclic links.
9828 # We might still enter an endless loop, since a link
9829 # loop can be closed while we follow links,
9832 while test -h "$potlib" 2>/dev/null; do
9833 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9835 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9836 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9839 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9841 $EGREP "$file_magic_regex" > /dev/null; then
9842 func_append newdeplibs " $a_deplib"
9849 if test -n "$a_deplib"; then
9852 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9853 echo "*** I have the capability to make that library automatically link in when"
9854 echo "*** you link to this library. But I can only do this if you have a"
9855 echo "*** shared version of the library, which you do not appear to have"
9856 echo "*** because I did check the linker path looking for a file starting"
9857 if test -z "$potlib"; then
9858 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9860 $ECHO "*** with $libname and none of the candidates passed a file format test"
9861 $ECHO "*** using a file magic. Last file checked: $potlib"
9866 # Add a -L argument.
9867 func_append newdeplibs " $a_deplib"
9870 done # Gone through all deplibs.
9873 set dummy $deplibs_check_method; shift
9874 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9875 for a_deplib in $deplibs; do
9878 func_stripname -l '' "$a_deplib"
9879 name=$func_stripname_result
9880 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9881 case " $predeps $postdeps " in
9883 func_append newdeplibs " $a_deplib"
9888 if test -n "$a_deplib"; then
9889 libname=`eval "\\$ECHO \"$libname_spec\""`
9890 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9891 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9892 for potent_lib in $potential_libs; do
9893 potlib=$potent_lib # see symlink-check above in file_magic test
9894 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9895 $EGREP "$match_pattern_regex" > /dev/null; then
9896 func_append newdeplibs " $a_deplib"
9903 if test -n "$a_deplib"; then
9906 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9907 echo "*** I have the capability to make that library automatically link in when"
9908 echo "*** you link to this library. But I can only do this if you have a"
9909 echo "*** shared version of the library, which you do not appear to have"
9910 echo "*** because I did check the linker path looking for a file starting"
9911 if test -z "$potlib"; then
9912 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9914 $ECHO "*** with $libname and none of the candidates passed a file format test"
9915 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9920 # Add a -L argument.
9921 func_append newdeplibs " $a_deplib"
9924 done # Gone through all deplibs.
9928 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9929 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9930 for i in $predeps $postdeps; do
9931 # can't use Xsed below, because $i might contain '/'
9932 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9935 case $tmp_deplibs in
9938 if test none = "$deplibs_check_method"; then
9939 echo "*** Warning: inter-library dependencies are not supported in this platform."
9941 echo "*** Warning: inter-library dependencies are not known to be supported."
9943 echo "*** All declared inter-library dependencies are being dropped."
9949 versuffix=$versuffix_save
9951 release=$release_save
9952 libname=$libname_save
9956 *-*-rhapsody* | *-*-darwin1.[012])
9957 # On Rhapsody replace the C library with the System framework
9958 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9962 if test yes = "$droppeddeps"; then
9963 if test yes = "$module"; then
9965 echo "*** Warning: libtool could not satisfy all declared inter-library"
9966 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9967 echo "*** a static module, that should work as long as the dlopening"
9968 echo "*** application is linked with the -dlopen flag."
9969 if test -z "$global_symbol_pipe"; then
9971 echo "*** However, this would only work if libtool was able to extract symbol"
9972 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9973 echo "*** not find such a program. So, this module is probably useless."
9974 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9976 if test no = "$build_old_libs"; then
9977 oldlibs=$output_objdir/$libname.$libext
9978 build_libtool_libs=module
9981 build_libtool_libs=no
9984 echo "*** The inter-library dependencies that have been dropped here will be"
9985 echo "*** automatically added whenever a program is linked with this library"
9986 echo "*** or is declared to -dlopen it."
9988 if test no = "$allow_undefined"; then
9990 echo "*** Since this library must not contain undefined symbols,"
9991 echo "*** because either the platform does not support them or"
9992 echo "*** it was explicitly requested with -no-undefined,"
9993 echo "*** libtool will only create a static version of it."
9994 if test no = "$build_old_libs"; then
9995 oldlibs=$output_objdir/$libname.$libext
9996 build_libtool_libs=module
9999 build_libtool_libs=no
10004 # Done checking deplibs!
10005 deplibs=$newdeplibs
10007 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10010 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10011 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10012 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10016 # move library search paths that coincide with paths to not yet
10017 # installed libraries to the beginning of the library search list
10019 for path in $notinst_path; do
10020 case " $new_libs " in
10021 *" -L$path/$objdir "*) ;;
10023 case " $deplibs " in
10024 *" -L$path/$objdir "*)
10025 func_append new_libs " -L$path/$objdir" ;;
10030 for deplib in $deplibs; do
10033 case " $new_libs " in
10035 *) func_append new_libs " $deplib" ;;
10038 *) func_append new_libs " $deplib" ;;
10043 # All the library-specific variables (install_libdir is set above).
10048 # Test again, we may have decided not to build it any more
10049 if test yes = "$build_libtool_libs"; then
10050 # Remove $wl instances when linking with ld.
10051 # FIXME: should test the right _cmds variable.
10052 case $archive_cmds in
10055 if test yes = "$hardcode_into_libs"; then
10056 # Hardcode the library paths
10059 rpath=$finalize_rpath
10060 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
10061 for libdir in $rpath; do
10062 if test -n "$hardcode_libdir_flag_spec"; then
10063 if test -n "$hardcode_libdir_separator"; then
10064 func_replace_sysroot "$libdir"
10065 libdir=$func_replace_sysroot_result
10066 if test -z "$hardcode_libdirs"; then
10067 hardcode_libdirs=$libdir
10069 # Just accumulate the unique libdirs.
10070 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10071 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10074 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10079 eval flag=\"$hardcode_libdir_flag_spec\"
10080 func_append dep_rpath " $flag"
10082 elif test -n "$runpath_var"; then
10083 case "$perm_rpath " in
10085 *) func_append perm_rpath " $libdir" ;;
10089 # Substitute the hardcoded libdirs into the rpath.
10090 if test -n "$hardcode_libdir_separator" &&
10091 test -n "$hardcode_libdirs"; then
10092 libdir=$hardcode_libdirs
10093 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
10095 if test -n "$runpath_var" && test -n "$perm_rpath"; then
10096 # We should set the runpath_var.
10098 for dir in $perm_rpath; do
10099 func_append rpath "$dir:"
10101 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
10103 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
10106 shlibpath=$finalize_shlibpath
10107 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
10108 if test -n "$shlibpath"; then
10109 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
10112 # Get the real and link names of the library.
10113 eval shared_ext=\"$shrext_cmds\"
10114 eval library_names=\"$library_names_spec\"
10115 set dummy $library_names
10120 if test -n "$soname_spec"; then
10121 eval soname=\"$soname_spec\"
10125 if test -z "$dlname"; then
10129 lib=$output_objdir/$realname
10133 func_append linknames " $link"
10136 # Use standard objects if they are pic
10137 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
10138 test "X$libobjs" = "X " && libobjs=
10141 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10142 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
10143 export_symbols=$output_objdir/$libname.uexp
10144 func_append delfiles " $export_symbols"
10147 orig_export_symbols=
10149 cygwin* | mingw* | cegcc*)
10150 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
10151 # exporting using user supplied symfile
10152 func_dll_def_p "$export_symbols" || {
10153 # and it's NOT already a .def file. Must figure out
10154 # which of the given symbols are data symbols and tag
10155 # them as such. So, trigger use of export_symbols_cmds.
10156 # export_symbols gets reassigned inside the "prepare
10157 # the list of exported symbols" if statement, so the
10158 # include_expsyms logic still works.
10159 orig_export_symbols=$export_symbols
10161 always_export_symbols=yes
10167 # Prepare the list of exported symbols
10168 if test -z "$export_symbols"; then
10169 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
10170 func_verbose "generating symbol list for '$libname.la'"
10171 export_symbols=$output_objdir/$libname.exp
10172 $opt_dry_run || $RM $export_symbols
10173 cmds=$export_symbols_cmds
10174 save_ifs=$IFS; IFS='~'
10175 for cmd1 in $cmds; do
10177 # Take the normal branch if the nm_file_list_spec branch
10178 # doesn't work or if tool conversion is not needed.
10179 case $nm_file_list_spec~$to_tool_file_cmd in
10180 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
10181 try_normal_branch=yes
10184 len=$func_len_result
10187 try_normal_branch=no
10190 if test yes = "$try_normal_branch" \
10191 && { test "$len" -lt "$max_cmd_len" \
10192 || test "$max_cmd_len" -le -1; }
10194 func_show_eval "$cmd" 'exit $?'
10195 skipped_export=false
10196 elif test -n "$nm_file_list_spec"; then
10197 func_basename "$output"
10198 output_la=$func_basename_result
10199 save_libobjs=$libobjs
10200 save_output=$output
10201 output=$output_objdir/$output_la.nm
10202 func_to_tool_file "$output"
10203 libobjs=$nm_file_list_spec$func_to_tool_file_result
10204 func_append delfiles " $output"
10205 func_verbose "creating $NM input file list: $output"
10206 for obj in $save_libobjs; do
10207 func_to_tool_file "$obj"
10208 $ECHO "$func_to_tool_file_result"
10211 func_show_eval "$cmd" 'exit $?'
10212 output=$save_output
10213 libobjs=$save_libobjs
10214 skipped_export=false
10216 # The command line is too long to execute in one step.
10217 func_verbose "using reloadable object file for export list..."
10219 # Break out early, otherwise skipped_export may be
10220 # set to false by a later but shorter cmd.
10225 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
10226 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10227 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10232 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10233 tmp_export_symbols=$export_symbols
10234 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10235 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10238 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
10239 # The given exports_symbols file has to be filtered, so filter it.
10240 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10241 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10242 # 's' commands, which not all seds can handle. GNU sed should be fine
10243 # though. Also, the filter scales superlinearly with the number of
10244 # global variables. join(1) would be nice here, but unfortunately
10245 # isn't a blessed tool.
10246 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10247 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10248 export_symbols=$output_objdir/$libname.def
10249 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10253 for test_deplib in $deplibs; do
10254 case " $convenience " in
10255 *" $test_deplib "*) ;;
10257 func_append tmp_deplibs " $test_deplib"
10261 deplibs=$tmp_deplibs
10263 if test -n "$convenience"; then
10264 if test -n "$whole_archive_flag_spec" &&
10265 test yes = "$compiler_needs_object" &&
10266 test -z "$libobjs"; then
10267 # extract the archives, so we have objects to list.
10268 # TODO: could optimize this to just extract one archive.
10269 whole_archive_flag_spec=
10271 if test -n "$whole_archive_flag_spec"; then
10272 save_libobjs=$libobjs
10273 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10274 test "X$libobjs" = "X " && libobjs=
10276 gentop=$output_objdir/${outputname}x
10277 func_append generated " $gentop"
10279 func_extract_archives $gentop $convenience
10280 func_append libobjs " $func_extract_archives_result"
10281 test "X$libobjs" = "X " && libobjs=
10285 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
10286 eval flag=\"$thread_safe_flag_spec\"
10287 func_append linker_flags " $flag"
10290 # Make a backup of the uninstalled library when relinking
10291 if test relink = "$opt_mode"; then
10292 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
10295 # Do each of the archive commands.
10296 if test yes = "$module" && test -n "$module_cmds"; then
10297 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10298 eval test_cmds=\"$module_expsym_cmds\"
10299 cmds=$module_expsym_cmds
10301 eval test_cmds=\"$module_cmds\"
10305 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10306 eval test_cmds=\"$archive_expsym_cmds\"
10307 cmds=$archive_expsym_cmds
10309 eval test_cmds=\"$archive_cmds\"
10314 if test : != "$skipped_export" &&
10315 func_len " $test_cmds" &&
10316 len=$func_len_result &&
10317 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10320 # The command line is too long to link in one step, link piecewise
10321 # or, if using GNU ld and skipped_export is not :, use a linker
10324 # Save the value of $output and $libobjs because we want to
10325 # use them later. If we have whole_archive_flag_spec, we
10326 # want to use save_libobjs as it was before
10327 # whole_archive_flag_spec was expanded, because we can't
10328 # assume the linker understands whole_archive_flag_spec.
10329 # This may have to be revisited, in case too many
10330 # convenience libraries get linked in and end up exceeding
10332 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
10333 save_libobjs=$libobjs
10335 save_output=$output
10336 func_basename "$output"
10337 output_la=$func_basename_result
10339 # Clear the reloadable object creation command queue and
10340 # initialize k to one.
10347 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
10348 output=$output_objdir/$output_la.lnkscript
10349 func_verbose "creating GNU ld script: $output"
10350 echo 'INPUT (' > $output
10351 for obj in $save_libobjs
10353 func_to_tool_file "$obj"
10354 $ECHO "$func_to_tool_file_result" >> $output
10356 echo ')' >> $output
10357 func_append delfiles " $output"
10358 func_to_tool_file "$output"
10359 output=$func_to_tool_file_result
10360 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
10361 output=$output_objdir/$output_la.lnk
10362 func_verbose "creating linker input file list: $output"
10364 set x $save_libobjs
10367 if test yes = "$compiler_needs_object"; then
10373 func_to_tool_file "$obj"
10374 $ECHO "$func_to_tool_file_result" >> $output
10376 func_append delfiles " $output"
10377 func_to_tool_file "$output"
10378 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
10380 if test -n "$save_libobjs"; then
10381 func_verbose "creating reloadable object files..."
10382 output=$output_objdir/$output_la-$k.$objext
10383 eval test_cmds=\"$reload_cmds\"
10384 func_len " $test_cmds"
10385 len0=$func_len_result
10388 # Loop over the list of objects to be linked.
10389 for obj in $save_libobjs
10392 func_arith $len + $func_len_result
10393 len=$func_arith_result
10394 if test -z "$objlist" ||
10395 test "$len" -lt "$max_cmd_len"; then
10396 func_append objlist " $obj"
10398 # The command $test_cmds is almost too long, add a
10399 # command to the queue.
10400 if test 1 -eq "$k"; then
10401 # The first file doesn't have a previous command to add.
10402 reload_objs=$objlist
10403 eval concat_cmds=\"$reload_cmds\"
10405 # All subsequent reloadable object files will link in
10406 # the last one created.
10407 reload_objs="$objlist $last_robj"
10408 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
10410 last_robj=$output_objdir/$output_la-$k.$objext
10412 k=$func_arith_result
10413 output=$output_objdir/$output_la-$k.$objext
10415 func_len " $last_robj"
10416 func_arith $len0 + $func_len_result
10417 len=$func_arith_result
10420 # Handle the remaining objects by creating one last
10421 # reloadable object file. All subsequent reloadable object
10422 # files will link in the last one created.
10423 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10424 reload_objs="$objlist $last_robj"
10425 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
10426 if test -n "$last_robj"; then
10427 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10429 func_append delfiles " $output"
10435 ${skipped_export-false} && {
10436 func_verbose "generating symbol list for '$libname.la'"
10437 export_symbols=$output_objdir/$libname.exp
10438 $opt_dry_run || $RM $export_symbols
10440 # Append the command to create the export file.
10441 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10442 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
10443 if test -n "$last_robj"; then
10444 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10448 test -n "$save_libobjs" &&
10449 func_verbose "creating a temporary reloadable object file: $output"
10451 # Loop through the commands generated above and execute them.
10452 save_ifs=$IFS; IFS='~'
10453 for cmd in $concat_cmds; do
10456 func_quote_for_expand "$cmd"
10457 eval "func_echo $func_quote_for_expand_result"
10459 $opt_dry_run || eval "$cmd" || {
10462 # Restore the uninstalled library and exit
10463 if test relink = "$opt_mode"; then
10464 ( cd "$output_objdir" && \
10465 $RM "${realname}T" && \
10466 $MV "${realname}U" "$realname" )
10474 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
10475 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10476 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10480 ${skipped_export-false} && {
10481 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10482 tmp_export_symbols=$export_symbols
10483 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10484 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10487 if test -n "$orig_export_symbols"; then
10488 # The given exports_symbols file has to be filtered, so filter it.
10489 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10490 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10491 # 's' commands, which not all seds can handle. GNU sed should be fine
10492 # though. Also, the filter scales superlinearly with the number of
10493 # global variables. join(1) would be nice here, but unfortunately
10494 # isn't a blessed tool.
10495 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10496 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10497 export_symbols=$output_objdir/$libname.def
10498 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10503 # Restore the value of output.
10504 output=$save_output
10506 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10507 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10508 test "X$libobjs" = "X " && libobjs=
10510 # Expand the library linking commands again to reset the
10511 # value of $libobjs for piecewise linking.
10513 # Do each of the archive commands.
10514 if test yes = "$module" && test -n "$module_cmds"; then
10515 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10516 cmds=$module_expsym_cmds
10521 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10522 cmds=$archive_expsym_cmds
10529 if test -n "$delfiles"; then
10530 # Append the command to remove temporary files to $cmds.
10531 eval cmds=\"\$cmds~\$RM $delfiles\"
10534 # Add any objects from preloaded convenience libraries
10535 if test -n "$dlprefiles"; then
10536 gentop=$output_objdir/${outputname}x
10537 func_append generated " $gentop"
10539 func_extract_archives $gentop $dlprefiles
10540 func_append libobjs " $func_extract_archives_result"
10541 test "X$libobjs" = "X " && libobjs=
10544 save_ifs=$IFS; IFS='~'
10545 for cmd in $cmds; do
10550 func_quote_for_expand "$cmd"
10551 eval "func_echo $func_quote_for_expand_result"
10553 $opt_dry_run || eval "$cmd" || {
10556 # Restore the uninstalled library and exit
10557 if test relink = "$opt_mode"; then
10558 ( cd "$output_objdir" && \
10559 $RM "${realname}T" && \
10560 $MV "${realname}U" "$realname" )
10568 # Restore the uninstalled library and exit
10569 if test relink = "$opt_mode"; then
10570 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10572 if test -n "$convenience"; then
10573 if test -z "$whole_archive_flag_spec"; then
10574 func_show_eval '${RM}r "$gentop"'
10581 # Create links to the real library.
10582 for linkname in $linknames; do
10583 if test "$realname" != "$linkname"; then
10584 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10588 # If -module or -export-dynamic was specified, set the dlname.
10589 if test yes = "$module" || test yes = "$export_dynamic"; then
10590 # On all known operating systems, these are identical.
10597 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10598 func_warning "'-dlopen' is ignored for objects"
10601 case " $deplibs" in
10603 func_warning "'-l' and '-L' are ignored for objects" ;;
10606 test -n "$rpath" && \
10607 func_warning "'-rpath' is ignored for objects"
10609 test -n "$xrpath" && \
10610 func_warning "'-R' is ignored for objects"
10612 test -n "$vinfo" && \
10613 func_warning "'-version-info' is ignored for objects"
10615 test -n "$release" && \
10616 func_warning "'-release' is ignored for objects"
10620 test -n "$objs$old_deplibs" && \
10621 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10624 func_lo2o "$libobj"
10625 obj=$func_lo2o_result
10633 # Delete the old objects.
10634 $opt_dry_run || $RM $obj $libobj
10636 # Objects from convenience libraries. This assumes
10637 # single-version convenience libraries. Whenever we create
10638 # different ones for PIC/non-PIC, this we'll have to duplicate
10642 # if reload_cmds runs $LD directly, get rid of -Wl from
10643 # whole_archive_flag_spec and hope we can get by with turning comma
10645 case $reload_cmds in
10646 *\$LD[\ \$]*) wl= ;;
10648 if test -n "$convenience"; then
10649 if test -n "$whole_archive_flag_spec"; then
10650 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10651 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10652 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10654 gentop=$output_objdir/${obj}x
10655 func_append generated " $gentop"
10657 func_extract_archives $gentop $convenience
10658 reload_conv_objs="$reload_objs $func_extract_archives_result"
10662 # If we're not building shared, we need to use non_pic_objs
10663 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10665 # Create the old-style object.
10666 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10669 func_execute_cmds "$reload_cmds" 'exit $?'
10671 # Exit if we aren't doing a library object file.
10672 if test -z "$libobj"; then
10673 if test -n "$gentop"; then
10674 func_show_eval '${RM}r "$gentop"'
10680 test yes = "$build_libtool_libs" || {
10681 if test -n "$gentop"; then
10682 func_show_eval '${RM}r "$gentop"'
10685 # Create an invalid libtool object if no PIC, so that we don't
10686 # accidentally link it into a program.
10687 # $show "echo timestamp > $libobj"
10688 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10692 if test -n "$pic_flag" || test default != "$pic_mode"; then
10693 # Only do commands if we really have different PIC objects.
10694 reload_objs="$libobjs $reload_conv_objs"
10696 func_execute_cmds "$reload_cmds" 'exit $?'
10699 if test -n "$gentop"; then
10700 func_show_eval '${RM}r "$gentop"'
10708 *cygwin*) func_stripname '' '.exe' "$output"
10709 output=$func_stripname_result.exe;;
10711 test -n "$vinfo" && \
10712 func_warning "'-version-info' is ignored for programs"
10714 test -n "$release" && \
10715 func_warning "'-release' is ignored for programs"
10718 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10719 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10722 *-*-rhapsody* | *-*-darwin1.[012])
10723 # On Rhapsody replace the C library is the System framework
10724 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10725 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10731 # Don't allow lazy linking, it breaks C++ global constructors
10732 # But is supposedly fixed on 10.4 or later (yay!).
10733 if test CXX = "$tagname"; then
10734 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10736 func_append compile_command " $wl-bind_at_load"
10737 func_append finalize_command " $wl-bind_at_load"
10741 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10742 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10743 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10748 # move library search paths that coincide with paths to not yet
10749 # installed libraries to the beginning of the library search list
10751 for path in $notinst_path; do
10752 case " $new_libs " in
10753 *" -L$path/$objdir "*) ;;
10755 case " $compile_deplibs " in
10756 *" -L$path/$objdir "*)
10757 func_append new_libs " -L$path/$objdir" ;;
10762 for deplib in $compile_deplibs; do
10765 case " $new_libs " in
10767 *) func_append new_libs " $deplib" ;;
10770 *) func_append new_libs " $deplib" ;;
10773 compile_deplibs=$new_libs
10776 func_append compile_command " $compile_deplibs"
10777 func_append finalize_command " $finalize_deplibs"
10779 if test -n "$rpath$xrpath"; then
10780 # If the user specified any rpath flags, then add them.
10781 for libdir in $rpath $xrpath; do
10782 # This is the magic to use -rpath.
10783 case "$finalize_rpath " in
10785 *) func_append finalize_rpath " $libdir" ;;
10790 # Now hardcode the library paths
10793 for libdir in $compile_rpath $finalize_rpath; do
10794 if test -n "$hardcode_libdir_flag_spec"; then
10795 if test -n "$hardcode_libdir_separator"; then
10796 if test -z "$hardcode_libdirs"; then
10797 hardcode_libdirs=$libdir
10799 # Just accumulate the unique libdirs.
10800 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10801 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10804 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10809 eval flag=\"$hardcode_libdir_flag_spec\"
10810 func_append rpath " $flag"
10812 elif test -n "$runpath_var"; then
10813 case "$perm_rpath " in
10815 *) func_append perm_rpath " $libdir" ;;
10819 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10820 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10821 case :$dllsearchpath: in
10823 ::) dllsearchpath=$libdir;;
10824 *) func_append dllsearchpath ":$libdir";;
10826 case :$dllsearchpath: in
10827 *":$testbindir:"*) ;;
10828 ::) dllsearchpath=$testbindir;;
10829 *) func_append dllsearchpath ":$testbindir";;
10834 # Substitute the hardcoded libdirs into the rpath.
10835 if test -n "$hardcode_libdir_separator" &&
10836 test -n "$hardcode_libdirs"; then
10837 libdir=$hardcode_libdirs
10838 eval rpath=\" $hardcode_libdir_flag_spec\"
10840 compile_rpath=$rpath
10844 for libdir in $finalize_rpath; do
10845 if test -n "$hardcode_libdir_flag_spec"; then
10846 if test -n "$hardcode_libdir_separator"; then
10847 if test -z "$hardcode_libdirs"; then
10848 hardcode_libdirs=$libdir
10850 # Just accumulate the unique libdirs.
10851 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10852 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10855 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10860 eval flag=\"$hardcode_libdir_flag_spec\"
10861 func_append rpath " $flag"
10863 elif test -n "$runpath_var"; then
10864 case "$finalize_perm_rpath " in
10866 *) func_append finalize_perm_rpath " $libdir" ;;
10870 # Substitute the hardcoded libdirs into the rpath.
10871 if test -n "$hardcode_libdir_separator" &&
10872 test -n "$hardcode_libdirs"; then
10873 libdir=$hardcode_libdirs
10874 eval rpath=\" $hardcode_libdir_flag_spec\"
10876 finalize_rpath=$rpath
10878 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10879 # Transform all the library objects into standard objects.
10880 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10881 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10884 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10886 # template prelinking step
10887 if test -n "$prelink_cmds"; then
10888 func_execute_cmds "$prelink_cmds" 'exit $?'
10891 wrappers_required=:
10893 *cegcc* | *mingw32ce*)
10894 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10895 wrappers_required=false
10897 *cygwin* | *mingw* )
10898 test yes = "$build_libtool_libs" || wrappers_required=false
10901 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10902 wrappers_required=false
10906 $wrappers_required || {
10907 # Replace the output file specification.
10908 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10909 link_command=$compile_command$compile_rpath
10911 # We have no uninstalled library dependencies, so finalize right now.
10913 func_show_eval "$link_command" 'exit_status=$?'
10915 if test -n "$postlink_cmds"; then
10916 func_to_tool_file "$output"
10917 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10918 func_execute_cmds "$postlink_cmds" 'exit $?'
10921 # Delete the generated files.
10922 if test -f "$output_objdir/${outputname}S.$objext"; then
10923 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10929 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10930 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10932 if test -n "$finalize_shlibpath"; then
10933 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10938 if test -n "$runpath_var"; then
10939 if test -n "$perm_rpath"; then
10940 # We should set the runpath_var.
10942 for dir in $perm_rpath; do
10943 func_append rpath "$dir:"
10945 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10947 if test -n "$finalize_perm_rpath"; then
10948 # We should set the runpath_var.
10950 for dir in $finalize_perm_rpath; do
10951 func_append rpath "$dir:"
10953 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10957 if test yes = "$no_install"; then
10958 # We don't need to create a wrapper script.
10959 link_command=$compile_var$compile_command$compile_rpath
10960 # Replace the output file specification.
10961 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10962 # Delete the old output file.
10963 $opt_dry_run || $RM $output
10964 # Link the executable and exit
10965 func_show_eval "$link_command" 'exit $?'
10967 if test -n "$postlink_cmds"; then
10968 func_to_tool_file "$output"
10969 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10970 func_execute_cmds "$postlink_cmds" 'exit $?'
10976 case $hardcode_action,$fast_install in
10978 # Fast installation is not supported
10979 link_command=$compile_var$compile_command$compile_rpath
10980 relink_command=$finalize_var$finalize_command$finalize_rpath
10982 func_warning "this platform does not like uninstalled shared libraries"
10983 func_warning "'$output' will be relinked during installation"
10986 link_command=$finalize_var$compile_command$finalize_rpath
10987 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10990 link_command=$compile_var$compile_command$compile_rpath
10991 relink_command=$finalize_var$finalize_command$finalize_rpath
10994 link_command=$finalize_var$compile_command$finalize_rpath
10999 # Replace the output file specification.
11000 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
11002 # Delete the old output files.
11003 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
11005 func_show_eval "$link_command" 'exit $?'
11007 if test -n "$postlink_cmds"; then
11008 func_to_tool_file "$output_objdir/$outputname"
11009 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'`
11010 func_execute_cmds "$postlink_cmds" 'exit $?'
11013 # Now create the wrapper script.
11014 func_verbose "creating $output"
11016 # Quote the relink command for shipping.
11017 if test -n "$relink_command"; then
11018 # Preserve any variables that may affect compiler behavior
11019 for var in $variables_saved_for_relink; do
11020 if eval test -z \"\${$var+set}\"; then
11021 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11022 elif eval var_value=\$$var; test -z "$var_value"; then
11023 relink_command="$var=; export $var; $relink_command"
11025 func_quote_for_eval "$var_value"
11026 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
11029 relink_command="(cd `pwd`; $relink_command)"
11030 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
11033 # Only actually do things if not in dry run mode.
11035 # win32 will think the script is a binary if it has
11036 # a .exe suffix, so we strip it off here.
11038 *.exe) func_stripname '' '.exe' "$output"
11039 output=$func_stripname_result ;;
11041 # test for cygwin because mv fails w/o .exe extensions
11045 func_stripname '' '.exe' "$outputname"
11046 outputname=$func_stripname_result ;;
11050 *cygwin* | *mingw* )
11051 func_dirname_and_basename "$output" "" "."
11052 output_name=$func_basename_result
11053 output_path=$func_dirname_result
11054 cwrappersource=$output_path/$objdir/lt-$output_name.c
11055 cwrapper=$output_path/$output_name.exe
11056 $RM $cwrappersource $cwrapper
11057 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
11059 func_emit_cwrapperexe_src > $cwrappersource
11061 # The wrapper executable is built using the $host compiler,
11062 # because it contains $host paths and files. If cross-
11063 # compiling, it, like the target executable, must be
11064 # executed on the $host or under an emulation environment.
11066 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
11070 # Now, create the wrapper script for func_source use:
11071 func_ltwrapper_scriptname $cwrapper
11072 $RM $func_ltwrapper_scriptname_result
11073 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
11075 # note: this script will not be executed, so do not chmod.
11076 if test "x$build" = "x$host"; then
11077 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
11079 func_emit_wrapper no > $func_ltwrapper_scriptname_result
11085 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
11087 func_emit_wrapper no > $output
11096 # See if we need to build an old-fashioned archive.
11097 for oldlib in $oldlibs; do
11099 case $build_libtool_libs in
11101 oldobjs="$libobjs_save $symfileobj"
11102 addlibs=$convenience
11103 build_libtool_libs=no
11106 oldobjs=$libobjs_save
11107 addlibs=$old_convenience
11108 build_libtool_libs=no
11111 oldobjs="$old_deplibs $non_pic_objects"
11112 $preload && test -f "$symfileobj" \
11113 && func_append oldobjs " $symfileobj"
11114 addlibs=$old_convenience
11118 if test -n "$addlibs"; then
11119 gentop=$output_objdir/${outputname}x
11120 func_append generated " $gentop"
11122 func_extract_archives $gentop $addlibs
11123 func_append oldobjs " $func_extract_archives_result"
11126 # Do each command in the archive commands.
11127 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
11128 cmds=$old_archive_from_new_cmds
11131 # Add any objects from preloaded convenience libraries
11132 if test -n "$dlprefiles"; then
11133 gentop=$output_objdir/${outputname}x
11134 func_append generated " $gentop"
11136 func_extract_archives $gentop $dlprefiles
11137 func_append oldobjs " $func_extract_archives_result"
11140 # POSIX demands no paths to be encoded in archives. We have
11141 # to avoid creating archives with duplicate basenames if we
11142 # might have to extract them afterwards, e.g., when creating a
11143 # static archive out of a convenience library, or when linking
11144 # the entirety of a libtool archive into another (currently
11145 # not supported by libtool).
11146 if (for obj in $oldobjs
11148 func_basename "$obj"
11149 $ECHO "$func_basename_result"
11150 done | sort | sort -uc >/dev/null 2>&1); then
11153 echo "copying selected object files to avoid basename conflicts..."
11154 gentop=$output_objdir/${outputname}x
11155 func_append generated " $gentop"
11156 func_mkdir_p "$gentop"
11157 save_oldobjs=$oldobjs
11160 for obj in $save_oldobjs
11162 func_basename "$obj"
11163 objbase=$func_basename_result
11164 case " $oldobjs " in
11165 " ") oldobjs=$obj ;;
11166 *[\ /]"$objbase "*)
11168 # Make sure we don't pick an alternate name that also
11170 newobj=lt$counter-$objbase
11171 func_arith $counter + 1
11172 counter=$func_arith_result
11173 case " $oldobjs " in
11174 *[\ /]"$newobj "*) ;;
11175 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
11178 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
11179 func_append oldobjs " $gentop/$newobj"
11181 *) func_append oldobjs " $obj" ;;
11185 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
11186 tool_oldlib=$func_to_tool_file_result
11187 eval cmds=\"$old_archive_cmds\"
11190 len=$func_len_result
11191 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
11192 cmds=$old_archive_cmds
11193 elif test -n "$archiver_list_spec"; then
11194 func_verbose "using command file archive linking..."
11195 for obj in $oldobjs
11197 func_to_tool_file "$obj"
11198 $ECHO "$func_to_tool_file_result"
11199 done > $output_objdir/$libname.libcmd
11200 func_to_tool_file "$output_objdir/$libname.libcmd"
11201 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
11202 cmds=$old_archive_cmds
11204 # the command line is too long to link in one step, link in parts
11205 func_verbose "using piecewise archive linking..."
11206 save_RANLIB=$RANLIB
11210 save_oldobjs=$oldobjs
11212 # Is there a better way of finding the last object in the list?
11213 for obj in $save_oldobjs
11217 eval test_cmds=\"$old_archive_cmds\"
11218 func_len " $test_cmds"
11219 len0=$func_len_result
11221 for obj in $save_oldobjs
11224 func_arith $len + $func_len_result
11225 len=$func_arith_result
11226 func_append objlist " $obj"
11227 if test "$len" -lt "$max_cmd_len"; then
11230 # the above command should be used before it gets too long
11232 if test "$obj" = "$last_oldobj"; then
11233 RANLIB=$save_RANLIB
11235 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
11236 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
11241 RANLIB=$save_RANLIB
11243 if test -z "$oldobjs"; then
11244 eval cmds=\"\$concat_cmds\"
11246 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
11250 func_execute_cmds "$cmds" 'exit $?'
11253 test -n "$generated" && \
11254 func_show_eval "${RM}r$generated"
11256 # Now create the libtool archive.
11260 test yes = "$build_old_libs" && old_library=$libname.$libext
11261 func_verbose "creating $output"
11263 # Preserve any variables that may affect compiler behavior
11264 for var in $variables_saved_for_relink; do
11265 if eval test -z \"\${$var+set}\"; then
11266 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11267 elif eval var_value=\$$var; test -z "$var_value"; then
11268 relink_command="$var=; export $var; $relink_command"
11270 func_quote_for_eval "$var_value"
11271 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
11274 # Quote the link command for shipping.
11275 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
11276 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
11277 if test yes = "$hardcode_automatic"; then
11281 # Only create the output if not a dry run.
11283 for installed in no yes; do
11284 if test yes = "$installed"; then
11285 if test -z "$install_libdir"; then
11288 output=$output_objdir/${outputname}i
11289 # Replace all uninstalled libtool libraries with the installed ones
11290 newdependency_libs=
11291 for deplib in $dependency_libs; do
11294 func_basename "$deplib"
11295 name=$func_basename_result
11296 func_resolve_sysroot "$deplib"
11297 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
11298 test -z "$libdir" && \
11299 func_fatal_error "'$deplib' is not a valid libtool archive"
11300 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
11303 func_stripname -L '' "$deplib"
11304 func_replace_sysroot "$func_stripname_result"
11305 func_append newdependency_libs " -L$func_replace_sysroot_result"
11308 func_stripname -R '' "$deplib"
11309 func_replace_sysroot "$func_stripname_result"
11310 func_append newdependency_libs " -R$func_replace_sysroot_result"
11312 *) func_append newdependency_libs " $deplib" ;;
11315 dependency_libs=$newdependency_libs
11318 for lib in $dlfiles; do
11321 func_basename "$lib"
11322 name=$func_basename_result
11323 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11324 test -z "$libdir" && \
11325 func_fatal_error "'$lib' is not a valid libtool archive"
11326 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
11328 *) func_append newdlfiles " $lib" ;;
11331 dlfiles=$newdlfiles
11333 for lib in $dlprefiles; do
11336 # Only pass preopened files to the pseudo-archive (for
11337 # eventual linking with the app. that links it) if we
11338 # didn't already link the preopened objects directly into
11340 func_basename "$lib"
11341 name=$func_basename_result
11342 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11343 test -z "$libdir" && \
11344 func_fatal_error "'$lib' is not a valid libtool archive"
11345 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
11349 dlprefiles=$newdlprefiles
11352 for lib in $dlfiles; do
11354 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11355 *) abs=`pwd`"/$lib" ;;
11357 func_append newdlfiles " $abs"
11359 dlfiles=$newdlfiles
11361 for lib in $dlprefiles; do
11363 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11364 *) abs=`pwd`"/$lib" ;;
11366 func_append newdlprefiles " $abs"
11368 dlprefiles=$newdlprefiles
11371 # place dlname in correct position for cygwin
11372 # In fact, it would be nice if we could use this code for all target
11373 # systems that can't hard-code library paths into their executables
11374 # and that have no shared library path variable independent of PATH,
11375 # but it turns out we can't easily determine that from inspecting
11376 # libtool variables, so we have to hard-code the OSs to which it
11377 # applies here; at the moment, that means platforms that use the PE
11378 # object format with DLL files. See the long comment at the top of
11379 # tests/bindir.at for full details.
11381 case $host,$output,$installed,$module,$dlname in
11382 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
11383 # If a -bindir argument was supplied, place the dll there.
11384 if test -n "$bindir"; then
11385 func_relative_path "$install_libdir" "$bindir"
11386 tdlname=$func_relative_path_result/$dlname
11388 # Otherwise fall back on heuristic.
11389 tdlname=../bin/$dlname
11394 # $outputname - a libtool library file
11395 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
11397 # Please DO NOT delete this file!
11398 # It is necessary for linking the library.
11400 # The name that we can dlopen(3).
11403 # Names of this library.
11404 library_names='$library_names'
11406 # The name of the static archive.
11407 old_library='$old_library'
11409 # Linker flags that cannot go in dependency_libs.
11410 inherited_linker_flags='$new_inherited_linker_flags'
11412 # Libraries that this one depends upon.
11413 dependency_libs='$dependency_libs'
11415 # Names of additional weak libraries provided by this library
11416 weak_library_names='$weak_libs'
11418 # Version information for $libname.
11423 # Is this an already installed library?
11424 installed=$installed
11426 # Should we warn about portability when linking against -modules?
11427 shouldnotlink=$module
11429 # Files to dlopen/dlpreopen
11431 dlpreopen='$dlprefiles'
11433 # Directory that this library needs to be installed in:
11434 libdir='$install_libdir'"
11435 if test no,yes = "$installed,$need_relink"; then
11436 $ECHO >> $output "\
11437 relink_command=\"$relink_command\""
11442 # Do a symbolic link so that the libtool archive can be found in
11443 # LD_LIBRARY_PATH before the program is installed.
11444 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
11450 if test link = "$opt_mode" || test relink = "$opt_mode"; then
11451 func_mode_link ${1+"$@"}
11455 # func_mode_uninstall arg...
11456 func_mode_uninstall ()
11465 # This variable tells wrapper scripts just to set variables rather
11466 # than running their programs.
11467 libtool_install_magic=$magic
11472 -f) func_append RM " $arg"; rmforce=: ;;
11473 -*) func_append RM " $arg" ;;
11474 *) func_append files " $arg" ;;
11479 func_fatal_help "you must specify an RM program"
11483 for file in $files; do
11484 func_dirname "$file" "" "."
11485 dir=$func_dirname_result
11486 if test . = "$dir"; then
11491 func_basename "$file"
11492 name=$func_basename_result
11493 test uninstall = "$opt_mode" && odir=$dir
11495 # Remember odir for removal later, being careful to avoid duplicates
11496 if test clean = "$opt_mode"; then
11497 case " $rmdirs " in
11499 *) func_append rmdirs " $odir" ;;
11503 # Don't error if the file doesn't exist and rm -f was used.
11504 if { test -L "$file"; } >/dev/null 2>&1 ||
11505 { test -h "$file"; } >/dev/null 2>&1 ||
11506 test -f "$file"; then
11508 elif test -d "$file"; then
11511 elif $rmforce; then
11519 # Possibly a libtool archive, so verify it.
11520 if func_lalib_p "$file"; then
11521 func_source $dir/$name
11523 # Delete the libtool libraries and symlinks.
11524 for n in $library_names; do
11525 func_append rmfiles " $odir/$n"
11527 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11531 case " $library_names " in
11533 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11535 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11538 if test -n "$library_names"; then
11539 # Do each command in the postuninstall commands.
11540 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11543 if test -n "$old_library"; then
11544 # Do each command in the old_postuninstall commands.
11545 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11547 # FIXME: should reinstall the best remaining shared library.
11554 # Possibly a libtool object, so verify it.
11555 if func_lalib_p "$file"; then
11557 # Read the .lo file
11558 func_source $dir/$name
11560 # Add PIC object to the list of files to remove.
11561 if test -n "$pic_object" && test none != "$pic_object"; then
11562 func_append rmfiles " $dir/$pic_object"
11565 # Add non-PIC object to the list of files to remove.
11566 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11567 func_append rmfiles " $dir/$non_pic_object"
11573 if test clean = "$opt_mode"; then
11577 func_stripname '' '.exe' "$file"
11578 file=$func_stripname_result
11579 func_stripname '' '.exe' "$name"
11580 noexename=$func_stripname_result
11581 # $file with .exe has already been added to rmfiles,
11582 # add $file without .exe
11583 func_append rmfiles " $file"
11586 # Do a test to see if this is a libtool program.
11587 if func_ltwrapper_p "$file"; then
11588 if func_ltwrapper_executable_p "$file"; then
11589 func_ltwrapper_scriptname "$file"
11591 func_source $func_ltwrapper_scriptname_result
11592 func_append rmfiles " $func_ltwrapper_scriptname_result"
11595 func_source $dir/$noexename
11598 # note $name still contains .exe if it was in $file originally
11599 # as does the version of $file that was added into $rmfiles
11600 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11601 if test yes = "$fast_install" && test -n "$relink_command"; then
11602 func_append rmfiles " $odir/lt-$name"
11604 if test "X$noexename" != "X$name"; then
11605 func_append rmfiles " $odir/lt-$noexename.c"
11611 func_show_eval "$RM $rmfiles" 'exit_status=1'
11614 # Try to remove the $objdir's in the directories where we deleted files
11615 for dir in $rmdirs; do
11616 if test -d "$dir"; then
11617 func_show_eval "rmdir $dir >/dev/null 2>&1"
11624 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11625 func_mode_uninstall ${1+"$@"}
11628 test -z "$opt_mode" && {
11630 func_fatal_help "you must specify a MODE"
11633 test -z "$exec_cmd" && \
11634 func_fatal_help "invalid operation mode '$opt_mode'"
11636 if test -n "$exec_cmd"; then
11637 eval exec "$exec_cmd"
11644 # The TAGs below are defined such that we never get into a situation
11645 # where we disable both kinds of libraries. Given conflicting
11646 # choices, we go for a static library, that is the most portable,
11647 # since we can't tell whether shared libraries were disabled because
11648 # the user asked for that or because the platform doesn't support
11649 # them. This is particularly important on AIX, because we don't
11650 # support having both static and shared libraries enabled at the same
11651 # time on that platform, so we default to a shared-only configuration.
11652 # If a disable-shared tag is given, we'll fallback to a static-only
11653 # configuration. But we'll never go from static-only to shared-only.
11655 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11656 build_libtool_libs=no
11658 # ### END LIBTOOL TAG CONFIG: disable-shared
11660 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11661 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11662 # ### END LIBTOOL TAG CONFIG: disable-static
11665 # mode:shell-script
11669 # ### BEGIN LIBTOOL TAG CONFIG: CXX
11671 # The linker used to build libraries.
11672 LD="/usr//bin//ld -m elf_x86_64"
11674 # How to create reloadable object files.
11676 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
11678 # Commands used to build an old-style archive.
11679 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
11681 # A language specific compiler.
11684 # Is the compiler the GNU compiler?
11687 # Compiler flag to turn off builtin functions.
11688 no_builtin_flag=" -fno-builtin"
11690 # Additional compiler flags for building library objects.
11691 pic_flag=" -fPIC -DPIC"
11693 # How to pass a linker flag through the compiler.
11696 # Compiler flag to prevent dynamic linking.
11697 link_static_flag="-static"
11699 # Does compiler simultaneously support -c and -o options?
11702 # Whether or not to add -lc for building shared libraries.
11703 build_libtool_need_lc=no
11705 # Whether or not to disallow shared libs when runtime libs are static.
11706 allow_libtool_libs_with_static_runtimes=no
11708 # Compiler flag to allow reflexive dlopens.
11709 export_dynamic_flag_spec="\$wl--export-dynamic"
11711 # Compiler flag to generate shared objects directly from archives.
11712 whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
11714 # Whether the compiler copes with passing no objects directly.
11715 compiler_needs_object="no"
11717 # Create an old-style archive from a shared archive.
11718 old_archive_from_new_cmds=""
11720 # Create a temporary old-style archive to link instead of a shared archive.
11721 old_archive_from_expsyms_cmds=""
11723 # Commands used to build a shared archive.
11724 archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
11725 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"
11727 # Commands used to build a loadable module if different from building
11728 # a shared archive.
11730 module_expsym_cmds=""
11732 # Whether we are building with GNU ld or not.
11735 # Flag that allows shared libraries with undefined symbols to be built.
11736 allow_undefined_flag=""
11738 # Flag that enforces no undefined symbols.
11739 no_undefined_flag=""
11741 # Flag to hardcode $libdir into a binary during linking.
11742 # This must work even if $libdir does not exist
11743 hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
11745 # Whether we need a single "-rpath" flag with a separated argument.
11746 hardcode_libdir_separator=""
11748 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
11749 # DIR into the resulting binary.
11752 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
11753 # DIR into the resulting binary and the resulting library dependency is
11754 # "absolute",i.e impossible to change by setting $shlibpath_var if the
11755 # library is relocated.
11756 hardcode_direct_absolute=no
11758 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
11759 # into the resulting binary.
11760 hardcode_minus_L=no
11762 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
11763 # into the resulting binary.
11764 hardcode_shlibpath_var=unsupported
11766 # Set to "yes" if building a shared library automatically hardcodes DIR
11767 # into the library and all subsequent libraries and executables linked
11769 hardcode_automatic=no
11771 # Set to yes if linker adds runtime paths of dependent libraries
11772 # to runtime path list.
11775 # Whether libtool must link a program against all its dependency libraries.
11776 link_all_deplibs=no
11778 # Set to "yes" if exported symbols are required.
11779 always_export_symbols=no
11781 # The commands to list exported symbols.
11782 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
11784 # Symbols that should not be listed in the preloaded symbols.
11785 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
11787 # Symbols that must always be exported.
11790 # Commands necessary for linking programs (against libraries) with templates.
11793 # Commands necessary for finishing linking programs.
11796 # Specify filename containing input files.
11799 # How to hardcode a shared library path into an executable.
11800 hardcode_action=immediate
11802 # The directories searched by this compiler when creating a shared library.
11803 compiler_lib_search_dirs="/home/couturie/TestU01-inst//lib/../lib /usr/lib/gcc/x86_64-linux-gnu/6 /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu /usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /home/couturie/TestU01-inst//lib . /usr/lib/gcc/x86_64-linux-gnu/6/../../.."
11805 # Dependencies to place before and after the objects being linked to
11806 # create a shared library.
11807 predep_objects="/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/6/crtbeginS.o"
11808 postdep_objects="/usr/lib/gcc/x86_64-linux-gnu/6/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/crtn.o"
11810 postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
11812 # The library search path used internally by the compiler when linking
11813 # a shared library.
11814 compiler_lib_search_path="-L/home/couturie/TestU01-inst//lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/6 -L/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/home/couturie/TestU01-inst//lib -L. -L/usr/lib/gcc/x86_64-linux-gnu/6/../../.."
11816 # ### END LIBTOOL TAG CONFIG: CXX