2 # Generated automatically by config.status (pcre2) 10.32
3 # Libtool was configured on host bagan:
4 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
6 # Provide generalized library-building support services.
7 # Written by Gordon Matzigkeit, 1996
9 # Copyright (C) 2014 Free Software Foundation, Inc.
10 # This is free software; see the source for copying conditions. There is NO
11 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 # GNU Libtool is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of of the License, or
16 # (at your option) any later version.
18 # As a special exception to the GNU General Public License, if you
19 # distribute this file as part of a program or library that is built
20 # using GNU Libtool, you may include this file under the same
21 # distribution terms that you use for the rest of that program.
23 # GNU Libtool is distributed in the hope that it will be useful, but
24 # WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 # GNU General Public License for more details.
28 # You should have received a copy of the GNU General Public License
29 # along with this program. If not, see <http://www.gnu.org/licenses/>.
32 # The names of the tagged configurations supported by this script.
35 # Configured defaults for sys_lib_dlsearch_path munging.
36 : ${LT_SYS_LIBRARY_PATH=""}
38 # ### BEGIN LIBTOOL CONFIG
43 # DLL creation program.
46 # Object dumper program.
49 # Which release of libtool.m4 was used?
50 macro_version=2.4.6.40-6ca5-dirty
51 macro_revision=2.4.6.40
53 # Whether or not to build shared libraries.
56 # Whether or not to build static libraries.
59 # What type of objects to build.
62 # Whether or not to optimize for fast installation.
65 # Shared archive member basename,for filename based shared library versioning on AIX.
66 shared_archive_member_spec=
68 # Shell to use when invoking shell scripts.
71 # An echo program that protects backslashes.
74 # The PATH separator for the build system.
79 host=x86_64-pc-linux-gnu
84 build=x86_64-pc-linux-gnu
87 # A sed program that does not truncate output.
90 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
91 Xsed="$SED -e 1s/^X//"
93 # A grep program that handles long lines.
99 # A literal string matcher.
102 # A BSD- or MS-compatible name lister.
105 # Whether we need soft or hard links.
108 # What is the maximum length of a command?
111 # Object file suffix (normally "o").
114 # Executable file suffix (normally "").
117 # whether the shell understands "unset".
120 # turn spaces into newlines.
121 SP2NL="tr \\040 \\012"
123 # turn newlines into spaces.
124 NL2SP="tr \\015\\012 \\040\\040"
126 # convert $build file names to $host format.
127 to_host_file_cmd=func_convert_file_noop
129 # convert $build files to toolchain format.
130 to_tool_file_cmd=func_convert_file_noop
132 # Method to check whether dependent libraries are shared objects.
133 deplibs_check_method="pass_all"
135 # Command to use when deplibs_check_method = "file_magic".
136 file_magic_cmd="\$MAGIC_CMD"
138 # How to find potential files when deplibs_check_method = "file_magic".
141 # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
144 # Command to associate shared and link libraries.
145 sharedlib_from_linklib_cmd="printf %s\\n"
150 # Flags to create an archive (by configure).
153 # Flags to create an archive.
154 AR_FLAGS=${ARFLAGS-"$lt_ar_flags"}
156 # How to feed a file listing to the archiver.
157 archiver_list_spec="@"
159 # A symbol stripping program.
162 # Commands used to install an old-style archive.
164 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
165 old_postuninstall_cmds=""
167 # Whether to use a lock for old archive extraction.
168 lock_old_archive_extraction=no
173 # LTCC compiler flags.
174 LTCFLAGS="-pthread -O2"
176 # Take the output of nm and produce a listing of raw symbols and C names.
177 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
179 # Transform the output of nm in a proper C declaration.
180 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
182 # Transform the output of nm into a list of symbols to manually relocate.
183 global_symbol_to_import=""
185 # Transform the output of nm in a C name address pair.
186 global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'"
188 # Transform the output of nm in a C name address pair when lib prefix is needed.
189 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'"
191 # The name lister interface.
192 nm_interface="BSD nm"
194 # Specify filename containing input files for $NM.
195 nm_file_list_spec="@"
197 # The root where to search for dependent libraries,and where our libraries should be installed.
200 # Command to truncate a binary pipe.
201 lt_truncate_bin="/bin/dd bs=4096 count=1"
203 # The name of the directory that contains temporary libtool files.
206 # Used to examine libraries when file_magic_cmd begins with "file".
209 # Must we lock files when doing compilation?
215 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
218 # Tool to change global to local symbols on Mac OS X.
221 # Tool to manipulate fat objects and archives on Mac OS X.
224 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
227 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
230 # Old archive suffix (normally "a").
233 # Shared library suffix (normally ".so").
236 # The commands to extract the exported symbol list from a shared archive.
237 extract_expsyms_cmds=""
239 # Variables whose values should be saved in libtool wrapper scripts and
240 # restored at link time.
241 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
243 # Do we need the "lib" prefix for modules?
246 # Do we need a version for libraries?
249 # Library versioning type.
252 # Shared library runtime path variable.
253 runpath_var=LD_RUN_PATH
255 # Shared library path variable.
256 shlibpath_var=LD_LIBRARY_PATH
258 # Is shlibpath searched before the hard-coded library search path?
259 shlibpath_overrides_runpath=yes
261 # Format of library name prefix.
262 libname_spec="lib\$name"
264 # List of archive names. First name is the real one, the rest are links.
265 # The last name is the one that the linker finds with -lNAME
266 library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
268 # The coded name of the library, if different from the real name.
269 soname_spec="\$libname\$release\$shared_ext\$major"
271 # Permission mode override for installation of shared libraries.
272 install_override_mode=""
274 # Command to use after installation of a shared archive.
277 # Command to use after uninstallation of a shared archive.
278 postuninstall_cmds=""
280 # Commands used to finish a libtool library installation in a directory.
281 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
283 # As "finish_cmds", except a single script fragment to be evaled but
287 # Whether we should hardcode library paths into libraries.
288 hardcode_into_libs=yes
290 # Compile-time system search path for libraries.
291 sys_lib_search_path_spec="/usr/lib/gcc/x86_64-linux-gnu/6 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib "
293 # Detected run-time system search path for libraries.
294 sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib /usr/lib/gsk8_64/lib64 /usr/lib/tsm-client/api/bin /usr/lib/tsm-client/api/bin64 /usr/lib/tsm-client/lib /usr/lib/tsm-client/lib64 /usr/lib/vmware-tools/lib32/libvmGuestLib.so /usr/lib/vmware-tools/lib64/libvmGuestLib.so /usr/lib/vmware-tools/lib32/libvmGuestLibJava.so /usr/lib/vmware-tools/lib64/libvmGuestLibJava.so /usr/lib/vmware-tools/lib32/libDeployPkg.so /usr/lib/vmware-tools/lib64/libDeployPkg.so /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu "
296 # Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
297 configure_time_lt_sys_library_path=""
299 # Whether dlopen is supported.
300 dlopen_support=unknown
302 # Whether dlopen of programs is supported.
305 # Whether dlopen of statically linked programs is supported.
306 dlopen_self_static=unknown
308 # Commands to strip libraries.
309 old_striplib="strip --strip-debug"
310 striplib="strip --strip-unneeded"
313 # The linker used to build libraries.
314 LD="/usr/bin/ld -m elf_x86_64"
316 # How to create reloadable object files.
318 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
320 # Commands used to build an old-style archive.
321 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
323 # A language specific compiler.
326 # Is the compiler the GNU compiler?
329 # Compiler flag to turn off builtin functions.
330 no_builtin_flag=" -fno-builtin"
332 # Additional compiler flags for building library objects.
333 pic_flag=" -fPIC -DPIC"
335 # How to pass a linker flag through the compiler.
338 # Compiler flag to prevent dynamic linking.
339 link_static_flag="-static"
341 # Does compiler simultaneously support -c and -o options?
344 # Whether or not to add -lc for building shared libraries.
345 build_libtool_need_lc=yes
347 # Whether or not to disallow shared libs when runtime libs are static.
348 allow_libtool_libs_with_static_runtimes=no
350 # Compiler flag to allow reflexive dlopens.
351 export_dynamic_flag_spec="\$wl--export-dynamic"
353 # Compiler flag to generate shared objects directly from archives.
354 whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
356 # Whether the compiler copes with passing no objects directly.
357 compiler_needs_object="no"
359 # Create an old-style archive from a shared archive.
360 old_archive_from_new_cmds=""
362 # Create a temporary old-style archive to link instead of a shared archive.
363 old_archive_from_expsyms_cmds=""
365 # Commands used to build a shared archive.
366 archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
367 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
368 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
369 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
370 \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
372 # Commands used to build a loadable module if different from building
375 module_expsym_cmds=""
377 # Whether we are building with GNU ld or not.
380 # Flag that allows shared libraries with undefined symbols to be built.
381 allow_undefined_flag=""
383 # Flag that enforces no undefined symbols.
386 # Flag to hardcode $libdir into a binary during linking.
387 # This must work even if $libdir does not exist
388 hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
390 # Whether we need a single "-rpath" flag with a separated argument.
391 hardcode_libdir_separator=""
393 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
394 # DIR into the resulting binary.
397 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
398 # DIR into the resulting binary and the resulting library dependency is
399 # "absolute",i.e impossible to change by setting $shlibpath_var if the
400 # library is relocated.
401 hardcode_direct_absolute=no
403 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
404 # into the resulting binary.
407 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
408 # into the resulting binary.
409 hardcode_shlibpath_var=unsupported
411 # Set to "yes" if building a shared library automatically hardcodes DIR
412 # into the library and all subsequent libraries and executables linked
414 hardcode_automatic=no
416 # Set to yes if linker adds runtime paths of dependent libraries
417 # to runtime path list.
420 # Whether libtool must link a program against all its dependency libraries.
421 link_all_deplibs=unknown
423 # Set to "yes" if exported symbols are required.
424 always_export_symbols=no
426 # The commands to list exported symbols.
427 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
429 # Symbols that should not be listed in the preloaded symbols.
430 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
432 # Symbols that must always be exported.
435 # Commands necessary for linking programs (against libraries) with templates.
438 # Commands necessary for finishing linking programs.
441 # Specify filename containing input files.
444 # How to hardcode a shared library path into an executable.
445 hardcode_action=immediate
447 # ### END LIBTOOL CONFIG
450 # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
452 # func_munge_path_list VARIABLE PATH
453 # -----------------------------------
454 # VARIABLE is name of variable containing _space_ separated list of
455 # directories to be munged by the contents of PATH, which is string
458 # string "DIR[ DIR]" will be prepended to VARIABLE
460 # string "DIR[ DIR]" will be appended to VARIABLE
461 # "DIRP[:DIRP]::[DIRA:]DIRA"
462 # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
463 # "DIRA[ DIRA]" will be appended to VARIABLE
465 # VARIABLE will be replaced by "DIR[ DIR]"
466 func_munge_path_list ()
472 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
475 eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
478 eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
479 eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
482 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
488 # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
491 for cc_temp in $*""; do
493 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
494 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
499 func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
503 # ### END FUNCTIONS SHARED WITH CONFIGURE
506 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
507 ## by inline-source v2016-02-21.11
509 # libtool (GNU libtool) 2.4.6.40-6ca5-dirty
510 # Provide generalized library-building support services.
511 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
513 # Copyright (C) 1996-2017 Free Software Foundation, Inc.
514 # This is free software; see the source for copying conditions. There is NO
515 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
517 # GNU Libtool is free software; you can redistribute it and/or modify
518 # it under the terms of the GNU General Public License as published by
519 # the Free Software Foundation; either version 2 of the License, or
520 # (at your option) any later version.
522 # As a special exception to the GNU General Public License,
523 # if you distribute this file as part of a program or library that
524 # is built using GNU Libtool, you may include this file under the
525 # same distribution terms that you use for the rest of that program.
527 # GNU Libtool is distributed in the hope that it will be useful, but
528 # WITHOUT ANY WARRANTY; without even the implied warranty of
529 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
530 # General Public License for more details.
532 # You should have received a copy of the GNU General Public License
533 # along with this program. If not, see <http://www.gnu.org/licenses/>.
538 VERSION=2.4.6.40-6ca5-dirty
539 package_revision=2.4.6.40
546 # Run './libtool --help' for help with using this script from the
550 ## ------------------------------- ##
551 ## User overridable command paths. ##
552 ## ------------------------------- ##
554 # After configure completes, it has a better idea of some of the
555 # shell tools we need than the defaults used by the functions shared
556 # with bootstrap, so set those here where they can still be over-
557 # ridden by the user, but otherwise take precedence.
559 : ${AUTOCONF="autoconf"}
560 : ${AUTOMAKE="automake"}
563 ## -------------------------- ##
564 ## Source external libraries. ##
565 ## -------------------------- ##
567 # Much of our low-level functionality needs to be sourced from external
568 # libraries, which are installed to $pkgauxdir.
570 # Set a version string for this script.
571 scriptversion=2017-04-19.12; # UTC
573 # General shell script boiler plate, and helper functions.
574 # Written by Gary V. Vaughan, 2004
576 # This is free software. There is NO warranty; not even for
577 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
579 # Copyright (C) 2004-2017 Bootstrap Authors
581 # This file is dual licensed under the terms of the MIT license
582 # <https://opensource.org/license/MIT>, and GPL version 3 or later
583 # <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
584 # these licenses when using or redistributing this software or any of
585 # the files within it. See the URLs above, or the file `LICENSE`
586 # included in the Bootstrap distribution for the full license texts.
588 # Please report bugs or propose patches to:
589 # <https://github.com/gnulib-modules/bootstrap/issues>
596 # Evaluate this file near the top of your script to gain access to
597 # the functions and variables defined here:
599 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
601 # If you need to override any of the default environment variable
602 # settings, do that before evaluating this file.
605 ## -------------------- ##
606 ## Shell normalisation. ##
607 ## -------------------- ##
609 # Some shells need a little help to be as Bourne compatible as possible.
610 # Before doing anything else, make sure all that help has been provided!
612 DUALCASE=1; export DUALCASE # for MKS sh
613 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
616 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
617 # is contrary to our usage. Disable this feature.
618 alias -g '${1+"$@"}'='"$@"'
621 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
624 # NLS nuisances: We save the old values in case they are required later.
627 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
629 eval "if test set = \"\${$_G_var+set}\"; then
630 save_$_G_var=\$$_G_var
633 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
634 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
638 # Make sure IFS has a sensible default
644 # There are apparently some retarded systems that use ';' as a PATH separator!
645 if test "${PATH_SEPARATOR+set}" != set; then
647 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
648 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
656 # Portably unset VAR.
657 # In some shells, an 'unset VAR' statement leaves a non-zero return
658 # status if VAR is already unset, which might be problematic if the
659 # statement is used at the end of a function (thus poisoning its return
660 # value) or when 'set -e' is active (causing even a spurious abort of
661 # the script in this case).
664 { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; }
668 # Make sure CDPATH doesn't cause `cd` commands to output the target dir.
671 # Make sure ${,E,F}GREP behave sanely.
672 func_unset GREP_OPTIONS
675 ## ------------------------- ##
676 ## Locate command utilities. ##
677 ## ------------------------- ##
680 # func_executable_p FILE
681 # ----------------------
682 # Check that FILE is an executable regular file.
685 test -f "$1" && test -x "$1"
689 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
690 # --------------------------------------------
691 # Search for either a program that responds to --version with output
692 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
693 # trying all the directories in PATH with each of the elements of
696 # CHECK_FUNC should accept the path to a candidate program, and
697 # set $func_check_prog_result if it truncates its output less than
698 # $_G_path_prog_max characters.
706 _G_path_prog_found=false
707 _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
708 for _G_dir in $_G_PATH; do
710 test -z "$_G_dir" && _G_dir=.
711 for _G_prog_name in $_G_progs_list; do
712 for _exeext in '' .EXE; do
713 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
714 func_executable_p "$_G_path_prog" || continue
715 case `"$_G_path_prog" --version 2>&1` in
716 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
717 *) $_G_check_func $_G_path_prog
718 func_path_progs_result=$func_check_prog_result
721 $_G_path_prog_found && break 3
726 test -z "$func_path_progs_result" && {
727 echo "no acceptable sed could be found in \$PATH" >&2
733 # We want to be able to use the functions in this file before configure
734 # has figured out where the best binaries are kept, which means we have
735 # to search for them ourselves - except when the results are already set
736 # where we skip the searches.
738 # Unless the user overrides by setting SED, search the path for either GNU
739 # sed, or the sed that truncates its output the least.
741 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
742 for _G_i in 1 2 3 4 5 6 7; do
743 _G_sed_script=$_G_sed_script$nl$_G_sed_script
745 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
748 func_check_prog_sed ()
753 printf 0123456789 >conftest.in
756 cat conftest.in conftest.in >conftest.tmp
757 mv conftest.tmp conftest.in
758 cp conftest.in conftest.nl
759 echo '' >> conftest.nl
760 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
761 diff conftest.out conftest.nl >/dev/null 2>&1 || break
762 _G_count=`expr $_G_count + 1`
763 if test "$_G_count" -gt "$_G_path_prog_max"; then
764 # Best one so far, save it but keep looking for a better one
765 func_check_prog_result=$_G_path_prog
766 _G_path_prog_max=$_G_count
768 # 10*(2^10) chars as input seems more than enough
769 test 10 -lt "$_G_count" && break
771 rm -f conftest.in conftest.tmp conftest.nl conftest.out
774 func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin"
776 SED=$func_path_progs_result
780 # Unless the user overrides by setting GREP, search the path for either GNU
781 # grep, or the grep that truncates its output the least.
783 func_check_prog_grep ()
789 printf 0123456789 >conftest.in
792 cat conftest.in conftest.in >conftest.tmp
793 mv conftest.tmp conftest.in
794 cp conftest.in conftest.nl
795 echo 'GREP' >> conftest.nl
796 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
797 diff conftest.out conftest.nl >/dev/null 2>&1 || break
798 _G_count=`expr $_G_count + 1`
799 if test "$_G_count" -gt "$_G_path_prog_max"; then
800 # Best one so far, save it but keep looking for a better one
801 func_check_prog_result=$_G_path_prog
802 _G_path_prog_max=$_G_count
804 # 10*(2^10) chars as input seems more than enough
805 test 10 -lt "$_G_count" && break
807 rm -f conftest.in conftest.tmp conftest.nl conftest.out
810 func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin"
811 GREP=$func_path_progs_result
815 ## ------------------------------- ##
816 ## User overridable command paths. ##
817 ## ------------------------------- ##
819 # All uppercase variable names are used for environment variables. These
820 # variables can be overridden by the user before calling a script that
821 # uses them if a suitable command of that name is not already available
822 # in the command search PATH.
825 : ${ECHO="printf %s\n"}
826 : ${EGREP="$GREP -E"}
827 : ${FGREP="$GREP -F"}
833 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
836 ## -------------------- ##
837 ## Useful sed snippets. ##
838 ## -------------------- ##
840 sed_dirname='s|/[^/]*$||'
841 sed_basename='s|^.*/||'
843 # Sed substitution that helps us do robust quoting. It backslashifies
844 # metacharacters that are still active within double-quoted strings.
845 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
847 # Same as above, but do not quote variable references.
848 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
850 # Sed substitution that turns a string into a regex matching for the
852 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
854 # Sed substitution that converts a w32 file name or path
855 # that contains forward slashes, into one that contains
856 # (escaped) backslashes. A very naive implementation.
857 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
859 # Re-'\' parameter expansions in output of sed_double_quote_subst that
860 # were '\'-ed in input to the same. If an odd number of '\' preceded a
861 # '$' in input to sed_double_quote_subst, that '$' was protected from
862 # expansion. Since each input '\' is now two '\'s, look for any number
863 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
868 sed_double_backslash="\
871 s/^$_G_bs2$_G_dollar/$_G_bs&/
872 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
876 ## ----------------- ##
877 ## Global variables. ##
878 ## ----------------- ##
880 # Except for the global variables explicitly listed below, the following
881 # functions in the '^func_' namespace, and the '^require_' namespace
882 # variables initialised in the 'Resource management' section, sourcing
883 # this file will not pollute your global namespace with anything
884 # else. There's no portable way to scope variables in Bourne shell
885 # though, so actually running these functions will sometimes place
886 # results into a variable named after the function, and often use
887 # temporary variables in the '^_G_' namespace. If you are careful to
888 # avoid using those namespaces casually in your sourcing script, things
889 # should continue to work as you expect. And, of course, you can freely
890 # overwrite any of the functions or variables defined here before
891 # calling anything to customize them.
895 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
896 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
898 # Allow overriding, eg assuming that you follow the convention of
899 # putting '$debug_cmd' at the start of all your functions, you can get
900 # bash to show function call trace with:
902 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
903 debug_cmd=${debug_cmd-":"}
906 # By convention, finish your script with:
910 # so that you can set exit_status to non-zero if you want to indicate
911 # something went wrong during execution without actually bailing out at
912 # the point of failure.
913 exit_status=$EXIT_SUCCESS
915 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
916 # is ksh but when the shell is invoked as "sh" and the current value of
917 # the _XPG environment variable is not equal to 1 (one), the special
918 # positional parameter $0, within a function call, is the name of the
922 # The name of this program.
923 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
925 # Make sure we have an absolute progpath for reexecution:
927 [\\/]*|[A-Za-z]:\\*) ;;
929 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
930 progdir=`cd "$progdir" && pwd`
931 progpath=$progdir/$progname
935 IFS=${PATH_SEPARATOR-:}
936 for progdir in $PATH; do
938 test -x "$progdir/$progname" && break
941 test -n "$progdir" || progdir=`pwd`
942 progpath=$progdir/$progname
947 ## ----------------- ##
948 ## Standard options. ##
949 ## ----------------- ##
951 # The following options affect the operation of the functions defined
952 # below, and should be set appropriately depending on run-time para-
953 # meters passed on the command line.
959 # Categories 'all' and 'none' are always available. Append any others
960 # you will pass as the first argument to func_warning from your own
964 # By default, display warnings according to 'opt_warning_types'. Set
965 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
966 # treat the next displayed warning as a fatal error.
967 warning_func=func_warn_and_continue
969 # Set to 'all' to display all warnings, 'none' to suppress all
970 # warnings, or a space delimited list of some subset of
971 # 'warning_categories' to display only the listed warnings.
972 opt_warning_types=all
975 ## -------------------- ##
976 ## Resource management. ##
977 ## -------------------- ##
979 # This section contains definitions for functions that each ensure a
980 # particular resource (a file, or a non-empty configuration variable for
981 # example) is available, and if appropriate to extract default values
982 # from pertinent package files. Call them using their associated
983 # 'require_*' variable to ensure that they are executed, at most, once.
985 # It's entirely deliberate that calling these functions can set
986 # variables that don't obey the namespace limitations obeyed by the rest
987 # of this file, in order that that they be as useful as possible to
991 # require_term_colors
992 # -------------------
993 # Allow display of bold text on terminals that support it.
994 require_term_colors=func_require_term_colors
995 func_require_term_colors ()
1000 # COLORTERM and USE_ANSI_COLORS environment variables take
1001 # precedence, because most terminfo databases neglect to describe
1002 # whether color sequences are supported.
1003 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
1005 if test 1 = "$USE_ANSI_COLORS"; then
1006 # Standard ANSI escape sequences
1008 tc_bold='
\e[1m'; tc_standout='
\e[7m'
1009 tc_red='
\e[31m'; tc_green='
\e[32m'
1010 tc_blue='
\e[34m'; tc_cyan='
\e[36m'
1012 # Otherwise trust the terminfo database after all.
1013 test -n "`tput sgr0 2>/dev/null`" && {
1014 tc_reset=`tput sgr0`
1015 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
1016 tc_standout=$tc_bold
1017 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
1018 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
1019 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
1020 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
1021 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
1026 require_term_colors=:
1030 ## ----------------- ##
1031 ## Function library. ##
1032 ## ----------------- ##
1034 # This section contains a variety of useful functions to call in your
1035 # scripts. Take note of the portable wrappers for features provided by
1036 # some modern shells, which will fall back to slower equivalents on
1037 # less featureful shells.
1040 # func_append VAR VALUE
1041 # ---------------------
1042 # Append VALUE onto the existing contents of VAR.
1044 # We should try to minimise forks, especially on Windows where they are
1045 # unreasonably slow, so skip the feature probes when bash or zsh are
1047 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
1048 : ${_G_HAVE_ARITH_OP="yes"}
1049 : ${_G_HAVE_XSI_OPS="yes"}
1050 # The += operator was introduced in bash 3.1
1051 case $BASH_VERSION in
1052 [12].* | 3.0 | 3.0*) ;;
1054 : ${_G_HAVE_PLUSEQ_OP="yes"}
1060 # Can be empty, in which case the shell is probed, "yes" if += is
1061 # useable or anything else if it does not work.
1062 test -z "$_G_HAVE_PLUSEQ_OP" \
1063 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
1064 && _G_HAVE_PLUSEQ_OP=yes
1066 if test yes = "$_G_HAVE_PLUSEQ_OP"
1068 # This is an XSI compatible shell, allowing a faster implementation...
1069 eval 'func_append ()
1076 # ...otherwise fall back to using expr, which is often a shell builtin.
1086 # func_append_quoted VAR VALUE
1087 # ----------------------------
1088 # Quote VALUE and append to the end of shell variable VAR, separated
1090 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
1091 eval 'func_append_quoted ()
1095 func_quote_arg pretty "$2"
1096 eval "$1+=\\ \$func_quote_arg_result"
1099 func_append_quoted ()
1103 func_quote_arg pretty "$2"
1104 eval "$1=\$$1\\ \$func_quote_arg_result"
1109 # func_append_uniq VAR VALUE
1110 # --------------------------
1111 # Append unique VALUE onto the existing contents of VAR, assuming
1112 # entries are delimited by the first character of VALUE. For example:
1114 # func_append_uniq options " --another-option option-argument"
1116 # will only append to $options if " --another-option option-argument "
1117 # is not already present somewhere in $options already (note spaces at
1118 # each end implied by leading space in second argument).
1123 eval _G_current_value='`$ECHO $'$1'`'
1124 _G_delim=`expr "$2" : '\(.\)'`
1126 case $_G_delim$_G_current_value$_G_delim in
1128 *) func_append "$@" ;;
1133 # func_arith TERM...
1134 # ------------------
1135 # Set func_arith_result to the result of evaluating TERMs.
1136 test -z "$_G_HAVE_ARITH_OP" \
1137 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
1138 && _G_HAVE_ARITH_OP=yes
1140 if test yes = "$_G_HAVE_ARITH_OP"; then
1145 func_arith_result=$(( $* ))
1152 func_arith_result=`expr "$@"`
1157 # func_basename FILE
1158 # ------------------
1159 # Set func_basename_result to FILE with everything up to and including
1160 # the last / stripped.
1161 if test yes = "$_G_HAVE_XSI_OPS"; then
1162 # If this shell supports suffix pattern removal, then use it to avoid
1163 # forking. Hide the definitions single quotes in case the shell chokes
1164 # on unsupported syntax...
1165 _b='func_basename_result=${1##*/}'
1167 */*) func_dirname_result=${1%/*}$2 ;;
1168 * ) func_dirname_result=$3 ;;
1172 # ...otherwise fall back to using sed.
1173 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
1174 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
1175 if test "X$func_dirname_result" = "X$1"; then
1176 func_dirname_result=$3
1178 func_append func_dirname_result "$2"
1182 eval 'func_basename ()
1190 # func_dirname FILE APPEND NONDIR_REPLACEMENT
1191 # -------------------------------------------
1192 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
1193 # otherwise set result to NONDIR_REPLACEMENT.
1194 eval 'func_dirname ()
1202 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
1203 # --------------------------------------------------------
1204 # Perform func_basename and func_dirname in a single function
1206 # dirname: Compute the dirname of FILE. If nonempty,
1207 # add APPEND to the result, otherwise set result
1208 # to NONDIR_REPLACEMENT.
1209 # value returned in "$func_dirname_result"
1210 # basename: Compute filename of FILE.
1211 # value retuned in "$func_basename_result"
1212 # For efficiency, we do not delegate to the functions above but instead
1213 # duplicate the functionality here.
1214 eval 'func_dirname_and_basename ()
1225 # Echo program name prefixed message.
1234 for _G_line in $_G_message; do
1236 $ECHO "$progname: $_G_line"
1242 # func_echo_all ARG...
1243 # --------------------
1244 # Invoke $ECHO with all args, space-separated.
1251 # func_echo_infix_1 INFIX ARG...
1252 # ------------------------------
1253 # Echo program name, followed by INFIX on the first line, with any
1254 # additional lines not showing INFIX.
1255 func_echo_infix_1 ()
1259 $require_term_colors
1263 _G_prefix="$progname: $_G_infix: "
1266 # Strip color escape sequences before counting printable length
1267 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
1269 test -n "$_G_tc" && {
1270 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
1271 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
1274 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
1276 func_echo_infix_1_IFS=$IFS
1278 for _G_line in $_G_message; do
1279 IFS=$func_echo_infix_1_IFS
1280 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
1281 _G_prefix=$_G_indent
1283 IFS=$func_echo_infix_1_IFS
1289 # Echo program name prefixed message to standard error.
1294 $require_term_colors
1296 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
1300 # func_fatal_error ARG...
1301 # -----------------------
1302 # Echo program name prefixed message to standard error, and exit.
1312 # func_grep EXPRESSION FILENAME
1313 # -----------------------------
1314 # Check whether EXPRESSION matches any line of FILENAME, without output.
1319 $GREP "$1" "$2" >/dev/null 2>&1
1325 # Set func_len_result to the length of STRING. STRING may not
1326 # start with a hyphen.
1327 test -z "$_G_HAVE_XSI_OPS" \
1329 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
1330 && _G_HAVE_XSI_OPS=yes
1332 if test yes = "$_G_HAVE_XSI_OPS"; then
1337 func_len_result=${#1}
1344 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
1349 # func_mkdir_p DIRECTORY-PATH
1350 # ---------------------------
1351 # Make sure the entire path to DIRECTORY-PATH is available.
1356 _G_directory_path=$1
1359 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
1361 # Protect directory names starting with '-'
1362 case $_G_directory_path in
1363 -*) _G_directory_path=./$_G_directory_path ;;
1366 # While some portion of DIR does not yet exist...
1367 while test ! -d "$_G_directory_path"; do
1368 # ...make a list in topmost first order. Use a colon delimited
1369 # list incase some portion of path contains whitespace.
1370 _G_dir_list=$_G_directory_path:$_G_dir_list
1372 # If the last portion added has no slash in it, the list is done
1373 case $_G_directory_path in */*) ;; *) break ;; esac
1375 # ...otherwise throw away the child directory and loop
1376 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
1378 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
1380 func_mkdir_p_IFS=$IFS; IFS=:
1381 for _G_dir in $_G_dir_list; do
1382 IFS=$func_mkdir_p_IFS
1383 # mkdir can fail with a 'File exist' error if two processes
1384 # try to create one of the directories concurrently. Don't
1385 # stop in that case!
1386 $MKDIR "$_G_dir" 2>/dev/null || :
1388 IFS=$func_mkdir_p_IFS
1390 # Bail out if we (or some other process) failed to create a directory.
1391 test -d "$_G_directory_path" || \
1392 func_fatal_error "Failed to create '$1'"
1397 # func_mktempdir [BASENAME]
1398 # -------------------------
1399 # Make a temporary directory that won't clash with other running
1400 # libtool processes, and avoids race conditions if possible. If
1401 # given, BASENAME is the basename for that directory.
1406 _G_template=${TMPDIR-/tmp}/${1-$progname}
1408 if test : = "$opt_dry_run"; then
1409 # Return a directory name, but don't create it in dry-run mode
1410 _G_tmpdir=$_G_template-$$
1413 # If mktemp works, use that first and foremost
1414 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
1416 if test ! -d "$_G_tmpdir"; then
1417 # Failing that, at least try and use $RANDOM to avoid a race
1418 _G_tmpdir=$_G_template-${RANDOM-0}$$
1420 func_mktempdir_umask=`umask`
1423 umask $func_mktempdir_umask
1426 # If we're not in dry-run mode, bomb out on failure
1427 test -d "$_G_tmpdir" || \
1428 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
1435 # func_normal_abspath PATH
1436 # ------------------------
1437 # Remove doubled-up and trailing slashes, "." path components,
1438 # and cancel out any ".." path components in PATH after making
1439 # it an absolute path.
1440 func_normal_abspath ()
1444 # These SED scripts presuppose an absolute path with a trailing slash.
1445 _G_pathcar='s|^/\([^/]*\).*$|\1|'
1446 _G_pathcdr='s|^/[^/]*||'
1447 _G_removedotparts=':dotsl
1451 _G_collapseslashes='s|/\{1,\}|/|g'
1452 _G_finalslash='s|/*$|/|'
1454 # Start from root dir and reassemble the path.
1455 func_normal_abspath_result=
1456 func_normal_abspath_tpath=$1
1457 func_normal_abspath_altnamespace=
1458 case $func_normal_abspath_tpath in
1460 # Empty path, that just means $cwd.
1461 func_stripname '' '/' "`pwd`"
1462 func_normal_abspath_result=$func_stripname_result
1465 # The next three entries are used to spot a run of precisely
1466 # two leading slashes without using negated character classes;
1467 # we take advantage of case's first-match behaviour.
1469 # Unusual form of absolute path, do nothing.
1472 # Not necessarily an ordinary path; POSIX reserves leading '//'
1473 # and for example Cygwin uses it to access remote file shares
1474 # over CIFS/SMB, so we conserve a leading double slash if found.
1475 func_normal_abspath_altnamespace=/
1478 # Absolute path, do nothing.
1481 # Relative path, prepend $cwd.
1482 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
1486 # Cancel out all the simple stuff to save iterations. We also want
1487 # the path to end with a slash for ease of parsing, so make sure
1488 # there is one (and only one) here.
1489 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1490 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
1492 # Processed it all yet?
1493 if test / = "$func_normal_abspath_tpath"; then
1494 # If we ascended to the root using ".." the result may be empty now.
1495 if test -z "$func_normal_abspath_result"; then
1496 func_normal_abspath_result=/
1500 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
1502 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1504 # Figure out what to do with it
1505 case $func_normal_abspath_tcomponent in
1507 # Trailing empty path component, ignore it.
1510 # Parent dir; strip last assembled component from result.
1511 func_dirname "$func_normal_abspath_result"
1512 func_normal_abspath_result=$func_dirname_result
1515 # Actual path component, append it.
1516 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1520 # Restore leading double-slash if one was found on entry.
1521 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1525 # func_notquiet ARG...
1526 # --------------------
1527 # Echo program name prefixed message only when not in quiet mode.
1532 $opt_quiet || func_echo ${1+"$@"}
1534 # A bug in bash halts the script if the last line of a function
1535 # fails when set -e is in force, so we need another command to
1541 # func_relative_path SRCDIR DSTDIR
1542 # --------------------------------
1543 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1544 func_relative_path ()
1548 func_relative_path_result=
1549 func_normal_abspath "$1"
1550 func_relative_path_tlibdir=$func_normal_abspath_result
1551 func_normal_abspath "$2"
1552 func_relative_path_tbindir=$func_normal_abspath_result
1554 # Ascend the tree starting from libdir
1556 # check if we have found a prefix of bindir
1557 case $func_relative_path_tbindir in
1558 $func_relative_path_tlibdir)
1559 # found an exact match
1560 func_relative_path_tcancelled=
1563 $func_relative_path_tlibdir*)
1564 # found a matching prefix
1565 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1566 func_relative_path_tcancelled=$func_stripname_result
1567 if test -z "$func_relative_path_result"; then
1568 func_relative_path_result=.
1573 func_dirname $func_relative_path_tlibdir
1574 func_relative_path_tlibdir=$func_dirname_result
1575 if test -z "$func_relative_path_tlibdir"; then
1576 # Have to descend all the way to the root!
1577 func_relative_path_result=../$func_relative_path_result
1578 func_relative_path_tcancelled=$func_relative_path_tbindir
1581 func_relative_path_result=../$func_relative_path_result
1586 # Now calculate path; take care to avoid doubling-up slashes.
1587 func_stripname '' '/' "$func_relative_path_result"
1588 func_relative_path_result=$func_stripname_result
1589 func_stripname '/' '/' "$func_relative_path_tcancelled"
1590 if test -n "$func_stripname_result"; then
1591 func_append func_relative_path_result "/$func_stripname_result"
1594 # Normalisation. If bindir is libdir, return '.' else relative path.
1595 if test -n "$func_relative_path_result"; then
1596 func_stripname './' '' "$func_relative_path_result"
1597 func_relative_path_result=$func_stripname_result
1600 test -n "$func_relative_path_result" || func_relative_path_result=.
1606 # func_quote_portable EVAL ARG
1607 # ----------------------------
1608 # Internal function to portably implement func_quote_arg. Note that we still
1609 # keep attention to performance here so we as much as possible try to avoid
1610 # calling sed binary (so far O(N) complexity as long as func_append is O(1)).
1611 func_quote_portable ()
1615 func_quote_portable_result=$2
1617 # one-time-loop (easy break)
1621 func_quote_portable_result=`$ECHO "$2" | $SED \
1622 -e "$sed_double_quote_subst" -e "$sed_double_backslash"`
1627 case $func_quote_portable_result in
1629 case $func_quote_portable_result in
1631 func_quote_portable_result=`$ECHO "$func_quote_portable_result" \
1632 | $SED "$sed_quote_subst"`
1637 func_quote_portable_old_IFS=$IFS
1638 for _G_char in '\' '`' '"' '$'
1640 # STATE($1) PREV($2) SEPARATOR($3)
1642 func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy
1644 for _G_part in $func_quote_portable_result
1648 func_append func_quote_portable_result "$3$2"
1649 set quote "$_G_part" "\\$_G_char"
1653 func_quote_portable_result=
1656 set quote "$_G_part" ""
1661 IFS=$func_quote_portable_old_IFS
1668 func_quote_portable_unquoted_result=$func_quote_portable_result
1669 case $func_quote_portable_result in
1670 # double-quote args containing shell metacharacters to delay
1671 # word splitting, command substitution and variable expansion
1672 # for a subsequent eval.
1673 # many bourne shells cannot handle close brackets correctly
1674 # in scan sets, so we specify it separately.
1675 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1676 func_quote_portable_result=\"$func_quote_portable_result\"
1682 # func_quotefast_eval ARG
1683 # -----------------------
1684 # Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG',
1685 # but optimized for speed. Result is stored in $func_quotefast_eval.
1686 if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then
1687 printf -v _GL_test_printf_tilde %q '~'
1688 if test '\~' = "$_GL_test_printf_tilde"; then
1689 func_quotefast_eval ()
1691 printf -v func_quotefast_eval_result %q "$1"
1694 # Broken older Bash implementations. Make those faster too if possible.
1695 func_quotefast_eval ()
1699 func_quote_portable false "$1"
1700 func_quotefast_eval_result=$func_quote_portable_result
1703 printf -v func_quotefast_eval_result %q "$1"
1709 func_quotefast_eval ()
1711 func_quote_portable false "$1"
1712 func_quotefast_eval_result=$func_quote_portable_result
1717 # func_quote_arg MODEs ARG
1718 # ------------------------
1719 # Quote one ARG to be evaled later. MODEs argument may contain zero or more
1720 # specifiers listed below separated by ',' character. This function returns two
1722 # i) func_quote_arg_result
1723 # double-quoted (when needed), suitable for a subsequent eval
1724 # ii) func_quote_arg_unquoted_result
1725 # has all characters that are still active within double
1726 # quotes backslashified. Available only if 'unquoted' is specified.
1731 # - escape shell special characters
1733 # - the same as 'eval'; but do not quote variable references
1735 # - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might
1736 # be used later in func_quote to get output like: 'echo "a b"' instead
1737 # of 'echo a\ b'. This is slower than default on some shells.
1739 # - produce also $func_quote_arg_unquoted_result which does not contain
1740 # wrapping double-quotes.
1742 # Examples for 'func_quote_arg pretty,unquoted string':
1744 # string | *_result | *_unquoted_result
1745 # ------------+-----------------------+-------------------
1748 # "a b" | "\"a b\"" | \"a b\"
1750 # z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\"
1752 # Examples for 'func_quote_arg pretty,unquoted,expand string':
1754 # string | *_result | *_unquoted_result
1755 # --------------+---------------------+--------------------
1756 # z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\"
1759 _G_quote_expand=false
1767 *,pretty,*|*,expand,*|*,unquoted,*)
1768 func_quote_portable $_G_quote_expand "$2"
1769 func_quote_arg_result=$func_quote_portable_result
1770 func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result
1773 # Faster quote-for-eval for some shells.
1774 func_quotefast_eval "$2"
1775 func_quote_arg_result=$func_quotefast_eval_result
1781 # func_quote MODEs ARGs...
1782 # ------------------------
1783 # Quote all ARGs to be evaled later and join them into single command. See
1784 # func_quote_arg's description for more info.
1788 _G_func_quote_mode=$1 ; shift
1790 while test 0 -lt $#; do
1791 func_quote_arg "$_G_func_quote_mode" "$1"
1792 if test -n "$func_quote_result"; then
1793 func_append func_quote_result " $func_quote_arg_result"
1795 func_append func_quote_result "$func_quote_arg_result"
1802 # func_stripname PREFIX SUFFIX NAME
1803 # ---------------------------------
1804 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1805 # PREFIX and SUFFIX must not contain globbing or regex special
1806 # characters, hashes, percent signs, but SUFFIX may contain a leading
1807 # dot (in which case that matches only a dot).
1808 if test yes = "$_G_HAVE_XSI_OPS"; then
1809 eval 'func_stripname ()
1813 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1814 # positional parameters, so assign one to ordinary variable first.
1815 func_stripname_result=$3
1816 func_stripname_result=${func_stripname_result#"$1"}
1817 func_stripname_result=${func_stripname_result%"$2"}
1825 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1826 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1832 # func_show_eval CMD [FAIL_EXP]
1833 # -----------------------------
1834 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1835 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1836 # is given, then evaluate it.
1842 _G_fail_exp=${2-':'}
1844 func_quote_arg pretty,expand "$_G_cmd"
1845 eval "func_notquiet $func_quote_arg_result"
1850 if test 0 -ne "$_G_status"; then
1851 eval "(exit $_G_status); $_G_fail_exp"
1857 # func_show_eval_locale CMD [FAIL_EXP]
1858 # ------------------------------------
1859 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1860 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1861 # is given, then evaluate it. Use the saved locale for evaluation.
1862 func_show_eval_locale ()
1867 _G_fail_exp=${2-':'}
1870 func_quote_arg expand,pretty "$_G_cmd"
1871 eval "func_echo $func_quote_arg_result"
1875 eval "$_G_user_locale
1878 eval "$_G_safe_locale"
1879 if test 0 -ne "$_G_status"; then
1880 eval "(exit $_G_status); $_G_fail_exp"
1888 # Turn $1 into a string suitable for a shell variable name.
1889 # Result is stored in $func_tr_sh_result. All characters
1890 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1891 # if $1 begins with a digit, a '_' is prepended as well.
1897 [0-9]* | *[!a-zA-Z0-9_]*)
1898 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1901 func_tr_sh_result=$1
1907 # func_verbose ARG...
1908 # -------------------
1909 # Echo program name prefixed message in verbose mode only.
1914 $opt_verbose && func_echo "$*"
1920 # func_warn_and_continue ARG...
1921 # -----------------------------
1922 # Echo program name prefixed warning message to standard error.
1923 func_warn_and_continue ()
1927 $require_term_colors
1929 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1933 # func_warning CATEGORY ARG...
1934 # ----------------------------
1935 # Echo program name prefixed warning message to standard error. Warning
1936 # messages can be filtered according to CATEGORY, where this function
1937 # elides messages where CATEGORY is not listed in the global variable
1938 # 'opt_warning_types'.
1943 # CATEGORY must be in the warning_categories list!
1944 case " $warning_categories " in
1946 *) func_internal_error "invalid warning category '$1'" ;;
1952 case " $opt_warning_types " in
1953 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1958 # func_sort_ver VER1 VER2
1959 # -----------------------
1960 # 'sort -V' is not generally available.
1961 # Note this deviates from the version comparison in automake
1962 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1963 # but this should suffice as we won't be specifying old
1964 # version formats or redundant trailing .0 in bootstrap.conf.
1965 # If we did want full compatibility then we should probably
1966 # use m4_version_compare from autoconf.
1971 printf '%s\n%s\n' "$1" "$2" \
1972 | 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
1975 # func_lt_ver PREV CURR
1976 # ---------------------
1977 # Return true if PREV and CURR are in the correct order according to
1978 # func_sort_ver, otherwise false. Use it like this:
1980 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1985 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1990 # mode: shell-script
1992 # eval: (add-hook 'before-save-hook 'time-stamp)
1993 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1994 # time-stamp-time-zone: "UTC"
1998 # A portable, pluggable option parser for Bourne shell.
1999 # Written by Gary V. Vaughan, 2010
2001 # This is free software. There is NO warranty; not even for
2002 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2004 # Copyright (C) 2010-2017 Bootstrap Authors
2006 # This file is dual licensed under the terms of the MIT license
2007 # <https://opensource.org/license/MIT>, and GPL version 3 or later
2008 # <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
2009 # these licenses when using or redistributing this software or any of
2010 # the files within it. See the URLs above, or the file `LICENSE`
2011 # included in the Bootstrap distribution for the full license texts.
2013 # Please report bugs or propose patches to:
2014 # <https://github.com/gnulib-modules/bootstrap/issues>
2016 # Set a version string for this script.
2017 scriptversion=2016-03-06.01; # UTC
2024 # This file is a library for parsing options in your shell scripts along
2025 # with assorted other useful supporting features that you can make use
2028 # For the simplest scripts you might need only:
2031 # . relative/path/to/funclib.sh
2032 # . relative/path/to/options-parser
2034 # func_options ${1+"$@"}
2035 # eval set dummy "$func_options_result"; shift
2036 # ...rest of your script...
2038 # In order for the '--version' option to work, you will need to have a
2039 # suitably formatted comment like the one at the top of this file
2040 # starting with '# Written by ' and ending with '# Copyright'.
2042 # For '-h' and '--help' to work, you will also need a one line
2043 # description of your script's purpose in a comment directly above the
2044 # '# Written by ' line, like the one at the top of this file.
2046 # The default options also support '--debug', which will turn on shell
2047 # execution tracing (see the comment above debug_cmd below for another
2048 # use), and '--verbose' and the func_verbose function to allow your script
2049 # to display verbose messages only when your user has specified
2052 # After sourcing this file, you can plug in processing for additional
2053 # options by amending the variables from the 'Configuration' section
2054 # below, and following the instructions in the 'Option parsing'
2055 # section further down.
2057 ## -------------- ##
2058 ## Configuration. ##
2059 ## -------------- ##
2061 # You should override these variables in your script after sourcing this
2062 # file so that they reflect the customisations you have added to the
2065 # The usage line for option parsing errors and the start of '-h' and
2066 # '--help' output messages. You can embed shell variables for delayed
2067 # expansion at the time the message is displayed, but you will need to
2068 # quote other shell meta-characters carefully to prevent them being
2069 # expanded when the contents are evaled.
2070 usage='$progpath [OPTION]...'
2072 # Short help message in response to '-h' and '--help'. Add to this or
2073 # override it after sourcing this library to reflect the full set of
2074 # options your script accepts.
2076 --debug enable verbose shell tracing
2077 -W, --warnings=CATEGORY
2078 report the warnings falling in CATEGORY [all]
2079 -v, --verbose verbosely report processing
2080 --version print version information and exit
2081 -h, --help print short or long help message and exit
2084 # Additional text appended to 'usage_message' in response to '--help'.
2086 Warning categories include:
2087 'all' show all warnings
2088 'none' turn off all the warnings
2089 'error' warnings are treated as fatal errors"
2091 # Help message printed before fatal option parsing errors.
2092 fatal_help="Try '\$progname --help' for more information."
2096 ## ------------------------- ##
2097 ## Hook function management. ##
2098 ## ------------------------- ##
2100 # This section contains functions for adding, removing, and running hooks
2101 # in the main code. A hook is just a list of function names that can be
2102 # run in order later on.
2104 # func_hookable FUNC_NAME
2105 # -----------------------
2106 # Declare that FUNC_NAME will run hooks added with
2107 # 'func_add_hook FUNC_NAME ...'.
2112 func_append hookable_fns " $1"
2116 # func_add_hook FUNC_NAME HOOK_FUNC
2117 # ---------------------------------
2118 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
2119 # first have been declared "hookable" by a call to 'func_hookable'.
2124 case " $hookable_fns " in
2126 *) func_fatal_error "'$1' does not accept hook functions." ;;
2129 eval func_append ${1}_hooks '" $2"'
2133 # func_remove_hook FUNC_NAME HOOK_FUNC
2134 # ------------------------------------
2135 # Remove HOOK_FUNC from the list of hook functions to be called by
2141 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
2145 # func_propagate_result FUNC_NAME_A FUNC_NAME_B
2146 # ---------------------------------------------
2147 # If the *_result variable of FUNC_NAME_A _is set_, assign its value to
2148 # *_result variable of FUNC_NAME_B.
2149 func_propagate_result ()
2153 func_propagate_result_result=:
2154 if eval "test \"\${${1}_result+set}\" = set"
2156 eval "${2}_result=\$${1}_result"
2158 func_propagate_result_result=false
2163 # func_run_hooks FUNC_NAME [ARG]...
2164 # ---------------------------------
2165 # Run all hook functions registered to FUNC_NAME.
2166 # It's assumed that the list of hook functions contains nothing more
2167 # than a whitespace-delimited list of legal shell function names, and
2168 # no effort is wasted trying to catch shell meta-characters or preserve
2174 case " $hookable_fns " in
2176 *) func_fatal_error "'$1' does not support hook functions." ;;
2179 eval _G_hook_fns=\$$1_hooks; shift
2181 for _G_hook in $_G_hook_fns; do
2182 func_unset "${_G_hook}_result"
2183 eval $_G_hook '${1+"$@"}'
2184 func_propagate_result $_G_hook func_run_hooks
2185 if $func_propagate_result_result; then
2186 eval set dummy "$func_run_hooks_result"; shift
2193 ## --------------- ##
2194 ## Option parsing. ##
2195 ## --------------- ##
2197 # In order to add your own option parsing hooks, you must accept the
2198 # full positional parameter list from your hook function. You may remove
2199 # or edit any options that you action, and then pass back the remaining
2200 # unprocessed options in '<hooked_function_name>_result', escaped
2201 # suitably for 'eval'.
2203 # The '<hooked_function_name>_result' variable is automatically unset
2204 # before your hook gets called; for best performance, only set the
2205 # *_result variable when necessary (i.e. don't call the 'func_quote'
2206 # function unnecessarily because it can be an expensive operation on some
2211 # my_options_prep ()
2215 # # Extend the existing usage message.
2216 # usage_message=$usage_message'
2217 # -s, --silent don'\''t print informational messages
2219 # # No change in '$@' (ignored completely by this hook). Leave
2220 # # my_options_prep_result variable intact.
2222 # func_add_hook func_options_prep my_options_prep
2225 # my_silent_option ()
2229 # args_changed=false
2231 # # Note that, for efficiency, we parse as many options as we can
2232 # # recognise in a loop before passing the remainder back to the
2233 # # caller on the first unrecognised argument we encounter.
2234 # while test $# -gt 0; do
2237 # --silent|-s) opt_silent=:
2240 # # Separate non-argument short options:
2241 # -s*) func_split_short_opt "$_G_opt"
2242 # set dummy "$func_split_short_opt_name" \
2243 # "-$func_split_short_opt_arg" ${1+"$@"}
2247 # *) # Make sure the first unrecognised option "$_G_opt"
2248 # # is added back to "$@" in case we need it later,
2249 # # if $args_changed was set to 'true'.
2250 # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2254 # # Only call 'func_quote' here if we processed at least one argument.
2255 # if $args_changed; then
2256 # func_quote eval ${1+"$@"}
2257 # my_silent_option_result=$func_quote_result
2260 # func_add_hook func_parse_options my_silent_option
2263 # my_option_validation ()
2267 # $opt_silent && $opt_verbose && func_fatal_help "\
2268 # '--silent' and '--verbose' options are mutually exclusive."
2270 # func_add_hook func_validate_options my_option_validation
2272 # You'll also need to manually amend $usage_message to reflect the extra
2273 # options you parse. It's preferable to append if you can, so that
2274 # multiple option parsing hooks can be added safely.
2277 # func_options_finish [ARG]...
2278 # ----------------------------
2279 # Finishing the option parse loop (call 'func_options' hooks ATM).
2280 func_options_finish ()
2284 func_run_hooks func_options ${1+"$@"}
2285 func_propagate_result func_run_hooks func_options_finish
2289 # func_options [ARG]...
2290 # ---------------------
2291 # All the functions called inside func_options are hookable. See the
2292 # individual implementations for details.
2293 func_hookable func_options
2298 _G_options_quoted=false
2300 for my_func in options_prep parse_options validate_options options_finish
2302 func_unset func_${my_func}_result
2303 func_unset func_run_hooks_result
2304 eval func_$my_func '${1+"$@"}'
2305 func_propagate_result func_$my_func func_options
2306 if $func_propagate_result_result; then
2307 eval set dummy "$func_options_result"; shift
2312 $_G_options_quoted || {
2313 # As we (func_options) are top-level options-parser function and
2314 # nobody quoted "$@" for us yet, we need to do it explicitly for
2316 func_quote eval ${1+"$@"}
2317 func_options_result=$func_quote_result
2322 # func_options_prep [ARG]...
2323 # --------------------------
2324 # All initialisations required before starting the option parse loop.
2325 # Note that when calling hook functions, we pass through the list of
2326 # positional parameters. If a hook function modifies that list, and
2327 # needs to propagate that back to rest of this script, then the complete
2328 # modified list must be put in 'func_run_hooks_result' before returning.
2329 func_hookable func_options_prep
2330 func_options_prep ()
2338 func_run_hooks func_options_prep ${1+"$@"}
2339 func_propagate_result func_run_hooks func_options_prep
2343 # func_parse_options [ARG]...
2344 # ---------------------------
2345 # The main option parsing loop.
2346 func_hookable func_parse_options
2347 func_parse_options ()
2351 _G_parse_options_requote=false
2352 # this just eases exit handling
2353 while test $# -gt 0; do
2354 # Defer to hook functions for initial option parsing, so they
2355 # get priority in the event of reusing an option name.
2356 func_run_hooks func_parse_options ${1+"$@"}
2357 func_propagate_result func_run_hooks func_parse_options
2358 if $func_propagate_result_result; then
2359 eval set dummy "$func_parse_options_result"; shift
2360 # Even though we may have changed "$@", we passed the "$@" array
2361 # down into the hook and it quoted it for us (because we are in
2362 # this if-branch). No need to quote it again.
2363 _G_parse_options_requote=false
2366 # Break out of the loop if we already parsed every option.
2367 test $# -gt 0 || break
2369 # We expect that one of the options parsed in this function matches
2370 # and thus we remove _G_opt from "$@" and need to re-quote.
2371 _G_match_parse_options=:
2375 --debug|-x) debug_cmd='set -x'
2376 func_echo "enabling shell trace mode" >&2
2380 --no-warnings|--no-warning|--no-warn)
2381 set dummy --warnings none ${1+"$@"}
2385 --warnings|--warning|-W)
2386 if test $# = 0 && func_missing_arg $_G_opt; then
2387 _G_parse_options_requote=:
2390 case " $warning_categories $1" in
2392 # trailing space prevents matching last $1 above
2393 func_append_uniq opt_warning_types " $1"
2396 opt_warning_types=$warning_categories
2399 opt_warning_types=none
2403 opt_warning_types=$warning_categories
2404 warning_func=func_fatal_error
2408 "unsupported warning category: '$1'"
2414 --verbose|-v) opt_verbose=: ;;
2415 --version) func_version ;;
2416 -\?|-h) func_usage ;;
2417 --help) func_help ;;
2419 # Separate optargs to long options (plugins may need this):
2420 --*=*) func_split_equals "$_G_opt"
2421 set dummy "$func_split_equals_lhs" \
2422 "$func_split_equals_rhs" ${1+"$@"}
2426 # Separate optargs to short options:
2428 func_split_short_opt "$_G_opt"
2429 set dummy "$func_split_short_opt_name" \
2430 "$func_split_short_opt_arg" ${1+"$@"}
2434 # Separate non-argument short options:
2436 func_split_short_opt "$_G_opt"
2437 set dummy "$func_split_short_opt_name" \
2438 "-$func_split_short_opt_arg" ${1+"$@"}
2442 --) _G_parse_options_requote=: ; break ;;
2443 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
2444 *) set dummy "$_G_opt" ${1+"$@"}; shift
2445 _G_match_parse_options=false
2450 if $_G_match_parse_options; then
2451 _G_parse_options_requote=:
2455 if $_G_parse_options_requote; then
2456 # save modified positional parameters for caller
2457 func_quote eval ${1+"$@"}
2458 func_parse_options_result=$func_quote_result
2463 # func_validate_options [ARG]...
2464 # ------------------------------
2465 # Perform any sanity checks on option settings and/or unconsumed
2467 func_hookable func_validate_options
2468 func_validate_options ()
2472 # Display all warnings if -W was not given.
2473 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
2475 func_run_hooks func_validate_options ${1+"$@"}
2476 func_propagate_result func_run_hooks func_validate_options
2478 # Bail if the options were screwed!
2479 $exit_cmd $EXIT_FAILURE
2484 ## ----------------- ##
2485 ## Helper functions. ##
2486 ## ----------------- ##
2488 # This section contains the helper functions used by the rest of the
2489 # hookable option parser framework in ascii-betical order.
2492 # func_fatal_help ARG...
2493 # ----------------------
2494 # Echo program name prefixed message to standard error, followed by
2495 # a help hint, and exit.
2500 eval \$ECHO \""Usage: $usage"\"
2501 eval \$ECHO \""$fatal_help"\"
2502 func_error ${1+"$@"}
2509 # Echo long help message to standard output and exit.
2515 $ECHO "$long_help_message"
2520 # func_missing_arg ARGNAME
2521 # ------------------------
2522 # Echo program name prefixed message to standard error and set global
2528 func_error "Missing argument for '$1'."
2533 # func_split_equals STRING
2534 # ------------------------
2535 # Set func_split_equals_lhs and func_split_equals_rhs shell variables
2536 # after splitting STRING at the '=' sign.
2537 test -z "$_G_HAVE_XSI_OPS" \
2539 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
2540 && _G_HAVE_XSI_OPS=yes
2542 if test yes = "$_G_HAVE_XSI_OPS"
2544 # This is an XSI compatible shell, allowing a faster implementation...
2545 eval 'func_split_equals ()
2549 func_split_equals_lhs=${1%%=*}
2550 func_split_equals_rhs=${1#*=}
2551 if test "x$func_split_equals_lhs" = "x$1"; then
2552 func_split_equals_rhs=
2556 # ...otherwise fall back to using expr, which is often a shell builtin.
2557 func_split_equals ()
2561 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
2562 func_split_equals_rhs=
2563 test "x$func_split_equals_lhs" = "x$1" \
2564 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
2566 fi #func_split_equals
2569 # func_split_short_opt SHORTOPT
2570 # -----------------------------
2571 # Set func_split_short_opt_name and func_split_short_opt_arg shell
2572 # variables after splitting SHORTOPT after the 2nd character.
2573 if test yes = "$_G_HAVE_XSI_OPS"
2575 # This is an XSI compatible shell, allowing a faster implementation...
2576 eval 'func_split_short_opt ()
2580 func_split_short_opt_arg=${1#??}
2581 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
2584 # ...otherwise fall back to using expr, which is often a shell builtin.
2585 func_split_short_opt ()
2589 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
2590 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
2592 fi #func_split_short_opt
2597 # Echo short help message to standard output and exit.
2603 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
2608 # func_usage_message
2609 # ------------------
2610 # Echo short help message to standard output.
2611 func_usage_message ()
2615 eval \$ECHO \""Usage: $usage"\"
2622 /^Written by/q' < "$progpath"
2624 eval \$ECHO \""$usage_message"\"
2630 # Echo version message to standard output and exit.
2631 # The version message is extracted from the calling file's header
2632 # comments, with leading '# ' stripped:
2633 # 1. First display the progname and version
2634 # 2. Followed by the header comment line matching /^# Written by /
2635 # 3. Then a blank line followed by the first following line matching
2637 # 4. Immediately followed by any lines between the previous matches,
2638 # except lines preceding the intervening completely blank line.
2639 # For example, see the header comments of this file.
2644 printf '%s\n' "$progname $scriptversion"
2665 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2675 # mode: shell-script
2677 # eval: (add-hook 'before-save-hook 'time-stamp)
2678 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2679 # time-stamp-time-zone: "UTC"
2682 # Set a version string.
2683 scriptversion='(GNU libtool) 2.4.6.40-6ca5-dirty'
2688 # Libtool also displays the current mode in messages, so override
2689 # funclib.sh func_echo with this custom definition.
2698 for _G_line in $_G_message; do
2700 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2706 # func_warning ARG...
2707 # -------------------
2708 # Libtool warnings are not categorized, so override funclib.sh
2709 # func_warning with this simpler definition.
2714 $warning_func ${1+"$@"}
2718 ## ---------------- ##
2719 ## Options parsing. ##
2720 ## ---------------- ##
2722 # Hook in the functions to make sure our own options are parsed during
2723 # the option parsing loop.
2725 usage='$progpath [OPTION]... [MODE-ARG]...'
2727 # Short help message in response to '-h'.
2728 usage_message="Options:
2729 --config show all configuration variables
2730 --debug enable verbose shell tracing
2731 -n, --dry-run display commands without modifying any files
2732 --features display basic configuration information and exit
2733 --mode=MODE use operation mode MODE
2734 --no-warnings equivalent to '-Wnone'
2735 --preserve-dup-deps don't remove duplicate dependency libraries
2736 --quiet, --silent don't print informational messages
2737 --tag=TAG use configuration variables from tag TAG
2738 -v, --verbose print more informational messages than default
2739 --version print version information
2740 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2741 -h, --help, --help-all print short, long, or detailed help message
2744 # Additional text appended to 'usage_message' in response to '--help'.
2750 $ECHO "$long_help_message
2752 MODE must be one of the following:
2754 clean remove files from the build directory
2755 compile compile a source file into a libtool object
2756 execute automatically set library path, then run a program
2757 finish complete the installation of libtool libraries
2758 install install libraries or executables
2759 link create a library or an executable
2760 uninstall remove libraries from an installed directory
2762 MODE-ARGS vary depending on the MODE. When passed as first option,
2763 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2764 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2766 When reporting a bug, please describe a test case to reproduce it and
2767 include the following information:
2772 compiler flags: $LTCFLAGS
2773 linker: $LD (gnu? $with_gnu_ld)
2774 version: $progname (GNU libtool) 2.4.6.40-6ca5-dirty
2775 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2776 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2778 Report bugs to <bug-libtool@gnu.org>.
2779 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2780 General help using GNU software: <http://www.gnu.org/gethelp/>."
2785 # func_lo2o OBJECT-NAME
2786 # ---------------------
2787 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2790 lo2o=s/\\.lo\$/.$objext/
2791 o2lo=s/\\.$objext\$/.lo/
2793 if test yes = "$_G_HAVE_XSI_OPS"; then
2797 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2798 * ) func_lo2o_result=$1 ;;
2802 # func_xform LIBOBJ-OR-SOURCE
2803 # ---------------------------
2804 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2805 # suffix to a '.lo' libtool-object suffix.
2808 func_xform_result=${1%.*}.lo
2811 # ...otherwise fall back to using sed.
2814 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2819 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2824 # func_fatal_configuration ARG...
2825 # -------------------------------
2826 # Echo program name prefixed message to standard error, followed by
2827 # a configuration failure hint, and exit.
2828 func_fatal_configuration ()
2830 func_fatal_error ${1+"$@"} \
2831 "See the $PACKAGE documentation for more information." \
2832 "Fatal configuration error."
2838 # Display the configuration for all the tags in this script.
2841 re_begincf='^# ### BEGIN LIBTOOL'
2842 re_endcf='^# ### END LIBTOOL'
2844 # Default configuration.
2845 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2847 # Now print the configurations for the tags.
2848 for tagname in $taglist; do
2849 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2858 # Display the features supported by this script.
2862 if test yes = "$build_libtool_libs"; then
2863 echo "enable shared libraries"
2865 echo "disable shared libraries"
2867 if test yes = "$build_old_libs"; then
2868 echo "enable static libraries"
2870 echo "disable static libraries"
2877 # func_enable_tag TAGNAME
2878 # -----------------------
2879 # Verify that TAGNAME is valid, and either flag an error and exit, or
2880 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2887 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2888 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2889 sed_extractcf=/$re_begincf/,/$re_endcf/p
2894 func_fatal_error "invalid tag name: $tagname"
2898 # Don't test for the "default" C tag, as we know it's
2899 # there but not specially marked.
2903 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2904 taglist="$taglist $tagname"
2906 # Evaluate the configuration. Be careful to quote the path
2907 # and the sed script, to avoid splitting on whitespace, but
2908 # also don't use non-portable quotes within backquotes within
2909 # quotes we have to do it in 2 steps:
2910 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2913 func_error "ignoring unknown tag $tagname"
2920 # func_check_version_match
2921 # ------------------------
2922 # Ensure that we are using m4 macros, and libtool script from the same
2923 # release of libtool.
2924 func_check_version_match ()
2926 if test "$package_revision" != "$macro_revision"; then
2927 if test "$VERSION" != "$macro_version"; then
2928 if test -z "$macro_version"; then
2930 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2931 $progname: definition of this LT_INIT comes from an older release.
2932 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2933 $progname: and run autoconf again.
2937 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2938 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2939 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2940 $progname: and run autoconf again.
2945 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2946 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2947 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2948 $progname: of $PACKAGE $VERSION and run autoconf again.
2957 # libtool_options_prep [ARG]...
2958 # -----------------------------
2959 # Preparation for options parsed by libtool.
2960 libtool_options_prep ()
2970 opt_preserve_dup_deps=false
2976 _G_rc_lt_options_prep=:
2978 # Shorthand for --mode=foo, only valid as the first argument
2981 shift; set dummy --mode clean ${1+"$@"}; shift
2983 compile|compil|compi|comp|com|co|c)
2984 shift; set dummy --mode compile ${1+"$@"}; shift
2986 execute|execut|execu|exec|exe|ex|e)
2987 shift; set dummy --mode execute ${1+"$@"}; shift
2989 finish|finis|fini|fin|fi|f)
2990 shift; set dummy --mode finish ${1+"$@"}; shift
2992 install|instal|insta|inst|ins|in|i)
2993 shift; set dummy --mode install ${1+"$@"}; shift
2996 shift; set dummy --mode link ${1+"$@"}; shift
2998 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2999 shift; set dummy --mode uninstall ${1+"$@"}; shift
3002 _G_rc_lt_options_prep=false
3006 if $_G_rc_lt_options_prep; then
3007 # Pass back the list of options.
3008 func_quote eval ${1+"$@"}
3009 libtool_options_prep_result=$func_quote_result
3012 func_add_hook func_options_prep libtool_options_prep
3015 # libtool_parse_options [ARG]...
3016 # ---------------------------------
3017 # Provide handling for libtool specific options.
3018 libtool_parse_options ()
3022 _G_rc_lt_parse_options=false
3024 # Perform our own loop to consume as many options as possible in
3026 while test $# -gt 0; do
3027 _G_match_lt_parse_options=:
3031 --dry-run|--dryrun|-n)
3035 --config) func_config ;;
3038 opt_dlopen="${opt_dlopen+$opt_dlopen
3043 --preserve-dup-deps)
3044 opt_preserve_dup_deps=: ;;
3046 --features) func_features ;;
3048 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
3050 --help) opt_help=: ;;
3052 --help-all) opt_help=': help-all' ;;
3054 --mode) test $# = 0 && func_missing_arg $_G_opt && break
3057 # Valid mode arguments:
3058 clean|compile|execute|finish|install|link|relink|uninstall) ;;
3060 # Catch anything else as an error
3061 *) func_error "invalid argument for $_G_opt"
3069 --no-silent|--no-quiet)
3071 func_append preserve_args " $_G_opt"
3074 --no-warnings|--no-warning|--no-warn)
3076 func_append preserve_args " $_G_opt"
3081 func_append preserve_args " $_G_opt"
3087 func_append preserve_args " $_G_opt"
3090 --tag) test $# = 0 && func_missing_arg $_G_opt && break
3092 func_append preserve_args " $_G_opt $1"
3093 func_enable_tag "$1"
3097 --verbose|-v) opt_quiet=false
3099 func_append preserve_args " $_G_opt"
3102 # An option not handled by this hook function:
3103 *) set dummy "$_G_opt" ${1+"$@"} ; shift
3104 _G_match_lt_parse_options=false
3108 $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
3111 if $_G_rc_lt_parse_options; then
3112 # save modified positional parameters for caller
3113 func_quote eval ${1+"$@"}
3114 libtool_parse_options_result=$func_quote_result
3117 func_add_hook func_parse_options libtool_parse_options
3121 # libtool_validate_options [ARG]...
3122 # ---------------------------------
3123 # Perform any sanity checks on option settings and/or unconsumed
3125 libtool_validate_options ()
3127 # save first non-option argument
3128 if test 0 -lt $#; then
3134 test : = "$debug_cmd" || func_append preserve_args " --debug"
3137 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
3138 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
3139 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
3140 # don't eliminate duplications in $postdeps and $predeps
3141 opt_duplicate_compiler_generated_deps=:
3144 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
3149 # Sanity checks first:
3150 func_check_version_match
3152 test yes != "$build_libtool_libs" \
3153 && test yes != "$build_old_libs" \
3154 && func_fatal_configuration "not configured to build any kind of library"
3157 eval std_shrext=\"$shrext_cmds\"
3159 # Only execute mode is allowed to have -dlopen flags.
3160 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
3161 func_error "unrecognized option '-dlopen'"
3166 # Change the help message to a mode-specific one.
3168 help="Try '$progname --help --mode=$opt_mode' for more information."
3171 # Pass back the unparsed argument list
3172 func_quote eval ${1+"$@"}
3173 libtool_validate_options_result=$func_quote_result
3175 func_add_hook func_validate_options libtool_validate_options
3178 # Process options as early as possible so that --help and --version
3179 # can return quickly.
3180 func_options ${1+"$@"}
3181 eval set dummy "$func_options_result"; shift
3189 magic='%%%MAGIC variable%%%'
3190 magic_exe='%%%MAGIC EXE variable%%%'
3196 # If this variable is set in any of the actions, the command in it
3197 # will be execed at the end. This prevents here-documents from being
3198 # left over by shells.
3202 # A function that is used when there is no print builtin or printf.
3203 func_fallback_echo ()
3205 eval 'cat <<_LTECHO_EOF
3210 # func_generated_by_libtool
3211 # True iff stdin has been generated by Libtool. This function is only
3212 # a basic sanity check; it will hardly flush out determined imposters.
3213 func_generated_by_libtool_p ()
3215 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
3219 # True iff FILE is a libtool '.la' library or '.lo' object file.
3220 # This function is only a basic sanity check; it will hardly flush out
3221 # determined imposters.
3225 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
3228 # func_lalib_unsafe_p file
3229 # True iff FILE is a libtool '.la' library or '.lo' object file.
3230 # This function implements the same check as func_lalib_p without
3231 # resorting to external programs. To this end, it redirects stdin and
3232 # closes it afterwards, without saving the original file descriptor.
3233 # As a safety measure, use it only where a negative result would be
3234 # fatal anyway. Works if 'file' does not exist.
3235 func_lalib_unsafe_p ()
3238 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
3239 for lalib_p_l in 1 2 3 4
3242 case $lalib_p_line in
3243 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
3248 test yes = "$lalib_p"
3251 # func_ltwrapper_script_p file
3252 # True iff FILE is a libtool wrapper script
3253 # This function is only a basic sanity check; it will hardly flush out
3254 # determined imposters.
3255 func_ltwrapper_script_p ()
3258 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
3261 # func_ltwrapper_executable_p file
3262 # True iff FILE is a libtool wrapper executable
3263 # This function is only a basic sanity check; it will hardly flush out
3264 # determined imposters.
3265 func_ltwrapper_executable_p ()
3267 func_ltwrapper_exec_suffix=
3270 *) func_ltwrapper_exec_suffix=.exe ;;
3272 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
3275 # func_ltwrapper_scriptname file
3276 # Assumes file is an ltwrapper_executable
3277 # uses $file to determine the appropriate filename for a
3278 # temporary ltwrapper_script.
3279 func_ltwrapper_scriptname ()
3281 func_dirname_and_basename "$1" "" "."
3282 func_stripname '' '.exe' "$func_basename_result"
3283 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
3286 # func_ltwrapper_p file
3287 # True iff FILE is a libtool wrapper script or wrapper executable
3288 # This function is only a basic sanity check; it will hardly flush out
3289 # determined imposters.
3292 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
3296 # func_execute_cmds commands fail_cmd
3297 # Execute tilde-delimited COMMANDS.
3298 # If FAIL_CMD is given, eval that upon failure.
3299 # FAIL_CMD may read-access the current command in variable CMD!
3300 func_execute_cmds ()
3304 save_ifs=$IFS; IFS='~'
3309 func_show_eval "$cmd" "${2-:}"
3316 # Source FILE, adding directory component if necessary.
3317 # Note that it is not necessary on cygwin/mingw to append a dot to
3318 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
3319 # behavior happens only for exec(3), not for open(2)! Also, sourcing
3320 # 'FILE.' does not work on cygwin managed mounts.
3326 */* | *\\*) . "$1" ;;
3332 # func_resolve_sysroot PATH
3333 # Replace a leading = in PATH with a sysroot. Store the result into
3334 # func_resolve_sysroot_result
3335 func_resolve_sysroot ()
3337 func_resolve_sysroot_result=$1
3338 case $func_resolve_sysroot_result in
3340 func_stripname '=' '' "$func_resolve_sysroot_result"
3341 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
3346 # func_replace_sysroot PATH
3347 # If PATH begins with the sysroot, replace it with = and
3348 # store the result into func_replace_sysroot_result.
3349 func_replace_sysroot ()
3351 case $lt_sysroot:$1 in
3353 func_stripname "$lt_sysroot" '' "$1"
3354 func_replace_sysroot_result='='$func_stripname_result
3357 # Including no sysroot.
3358 func_replace_sysroot_result=$1
3363 # func_infer_tag arg
3364 # Infer tagged configuration to use if any are available and
3365 # if one wasn't chosen via the "--tag" command line option.
3366 # Only attempt this if the compiler in the base compile
3367 # command doesn't match the default compiler.
3368 # arg is usually of the form 'gcc ...'
3373 if test -n "$available_tags" && test -z "$tagname"; then
3376 func_append_quoted CC_quoted "$arg"
3378 CC_expanded=`func_echo_all $CC`
3379 CC_quoted_expanded=`func_echo_all $CC_quoted`
3381 # Blanks in the command may have been stripped by the calling shell,
3382 # but not from the CC environment variable when configure was run.
3383 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
3384 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
3385 # Blanks at the start of $base_compile will cause this to fail
3386 # if we don't check for them as well.
3388 for z in $available_tags; do
3389 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
3390 # Evaluate the configuration.
3391 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
3394 # Double-quote args containing other shell metacharacters.
3395 func_append_quoted CC_quoted "$arg"
3397 CC_expanded=`func_echo_all $CC`
3398 CC_quoted_expanded=`func_echo_all $CC_quoted`
3400 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
3401 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
3402 # The compiler in the base compile command matches
3403 # the one in the tagged configuration.
3404 # Assume this is the tagged configuration we want.
3411 # If $tagname still isn't set, then no tagged configuration
3412 # was found and let the user know that the "--tag" command
3413 # line option must be used.
3414 if test -z "$tagname"; then
3415 func_echo "unable to infer tagged configuration"
3416 func_fatal_error "specify a tag with '--tag'"
3418 # func_verbose "using $tagname tagged configuration"
3427 # func_write_libtool_object output_name pic_name nonpic_name
3428 # Create a libtool object file (analogous to a ".la" file),
3429 # but don't create it if we're doing a dry run.
3430 func_write_libtool_object ()
3433 if test yes = "$build_libtool_libs"; then
3439 if test yes = "$build_old_libs"; then
3446 cat >${write_libobj}T <<EOF
3447 # $write_libobj - a libtool object file
3448 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
3450 # Please DO NOT delete this file!
3451 # It is necessary for linking the library.
3453 # Name of the PIC object.
3454 pic_object=$write_lobj
3456 # Name of the non-PIC object
3457 non_pic_object=$write_oldobj
3460 $MV "${write_libobj}T" "$write_libobj"
3465 ##################################################
3466 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
3467 ##################################################
3469 # func_convert_core_file_wine_to_w32 ARG
3470 # Helper function used by file name conversion functions when $build is *nix,
3471 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
3472 # correctly configured wine environment available, with the winepath program
3473 # in $build's $PATH.
3475 # ARG is the $build file name to be converted to w32 format.
3476 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
3477 # be empty on error (or when ARG is empty)
3478 func_convert_core_file_wine_to_w32 ()
3482 func_convert_core_file_wine_to_w32_result=$1
3483 if test -n "$1"; then
3484 # Unfortunately, winepath does not exit with a non-zero error code, so we
3485 # are forced to check the contents of stdout. On the other hand, if the
3486 # command is not found, the shell will set an exit code of 127 and print
3487 # *an error message* to stdout. So we must check for both error code of
3488 # zero AND non-empty stdout, which explains the odd construction:
3489 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
3490 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
3491 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
3492 $SED -e "$sed_naive_backslashify"`
3494 func_convert_core_file_wine_to_w32_result=
3498 # end: func_convert_core_file_wine_to_w32
3501 # func_convert_core_path_wine_to_w32 ARG
3502 # Helper function used by path conversion functions when $build is *nix, and
3503 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
3504 # configured wine environment available, with the winepath program in $build's
3505 # $PATH. Assumes ARG has no leading or trailing path separator characters.
3507 # ARG is path to be converted from $build format to win32.
3508 # Result is available in $func_convert_core_path_wine_to_w32_result.
3509 # Unconvertible file (directory) names in ARG are skipped; if no directory names
3510 # are convertible, then the result may be empty.
3511 func_convert_core_path_wine_to_w32 ()
3515 # unfortunately, winepath doesn't convert paths, only file names
3516 func_convert_core_path_wine_to_w32_result=
3517 if test -n "$1"; then
3520 for func_convert_core_path_wine_to_w32_f in $1; do
3522 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
3523 if test -n "$func_convert_core_file_wine_to_w32_result"; then
3524 if test -z "$func_convert_core_path_wine_to_w32_result"; then
3525 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
3527 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
3534 # end: func_convert_core_path_wine_to_w32
3537 # func_cygpath ARGS...
3538 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
3539 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
3540 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
3541 # (2), returns the Cygwin file name or path in func_cygpath_result (input
3542 # file name or path is assumed to be in w32 format, as previously converted
3543 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
3544 # or path in func_cygpath_result (input file name or path is assumed to be in
3545 # Cygwin format). Returns an empty string on error.
3547 # ARGS are passed to cygpath, with the last one being the file name or path to
3550 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
3551 # environment variable; do not put it in $PATH.
3556 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
3557 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
3558 if test "$?" -ne 0; then
3559 # on failure, ensure result is empty
3560 func_cygpath_result=
3563 func_cygpath_result=
3564 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
3570 # func_convert_core_msys_to_w32 ARG
3571 # Convert file name or path ARG from MSYS format to w32 format. Return
3572 # result in func_convert_core_msys_to_w32_result.
3573 func_convert_core_msys_to_w32 ()
3577 # awkward: cmd appends spaces to result
3578 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
3579 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
3581 #end: func_convert_core_msys_to_w32
3584 # func_convert_file_check ARG1 ARG2
3585 # Verify that ARG1 (a file name in $build format) was converted to $host
3586 # format in ARG2. Otherwise, emit an error message, but continue (resetting
3587 # func_to_host_file_result to ARG1).
3588 func_convert_file_check ()
3592 if test -z "$2" && test -n "$1"; then
3593 func_error "Could not determine host file name corresponding to"
3595 func_error "Continuing, but uninstalled executables may not work."
3597 func_to_host_file_result=$1
3600 # end func_convert_file_check
3603 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
3604 # Verify that FROM_PATH (a path in $build format) was converted to $host
3605 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
3606 # func_to_host_file_result to a simplistic fallback value (see below).
3607 func_convert_path_check ()
3611 if test -z "$4" && test -n "$3"; then
3612 func_error "Could not determine the host path corresponding to"
3614 func_error "Continuing, but uninstalled executables may not work."
3615 # Fallback. This is a deliberately simplistic "conversion" and
3616 # should not be "improved". See libtool.info.
3617 if test "x$1" != "x$2"; then
3618 lt_replace_pathsep_chars="s|$1|$2|g"
3619 func_to_host_path_result=`echo "$3" |
3620 $SED -e "$lt_replace_pathsep_chars"`
3622 func_to_host_path_result=$3
3626 # end func_convert_path_check
3629 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
3630 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
3631 # and appending REPL if ORIG matches BACKPAT.
3632 func_convert_path_front_back_pathsep ()
3637 $1 ) func_to_host_path_result=$3$func_to_host_path_result
3641 $2 ) func_append func_to_host_path_result "$3"
3645 # end func_convert_path_front_back_pathsep
3648 ##################################################
3649 # $build to $host FILE NAME CONVERSION FUNCTIONS #
3650 ##################################################
3651 # invoked via '$to_host_file_cmd ARG'
3653 # In each case, ARG is the path to be converted from $build to $host format.
3654 # Result will be available in $func_to_host_file_result.
3657 # func_to_host_file ARG
3658 # Converts the file name ARG from $build format to $host format. Return result
3659 # in func_to_host_file_result.
3660 func_to_host_file ()
3664 $to_host_file_cmd "$1"
3666 # end func_to_host_file
3669 # func_to_tool_file ARG LAZY
3670 # converts the file name ARG from $build format to toolchain format. Return
3671 # result in func_to_tool_file_result. If the conversion in use is listed
3672 # in (the comma separated) LAZY, no conversion takes place.
3673 func_to_tool_file ()
3678 *,"$to_tool_file_cmd",*)
3679 func_to_tool_file_result=$1
3682 $to_tool_file_cmd "$1"
3683 func_to_tool_file_result=$func_to_host_file_result
3687 # end func_to_tool_file
3690 # func_convert_file_noop ARG
3691 # Copy ARG to func_to_host_file_result.
3692 func_convert_file_noop ()
3694 func_to_host_file_result=$1
3696 # end func_convert_file_noop
3699 # func_convert_file_msys_to_w32 ARG
3700 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
3701 # conversion to w32 is not available inside the cwrapper. Returns result in
3702 # func_to_host_file_result.
3703 func_convert_file_msys_to_w32 ()
3707 func_to_host_file_result=$1
3708 if test -n "$1"; then
3709 func_convert_core_msys_to_w32 "$1"
3710 func_to_host_file_result=$func_convert_core_msys_to_w32_result
3712 func_convert_file_check "$1" "$func_to_host_file_result"
3714 # end func_convert_file_msys_to_w32
3717 # func_convert_file_cygwin_to_w32 ARG
3718 # Convert file name ARG from Cygwin to w32 format. Returns result in
3719 # func_to_host_file_result.
3720 func_convert_file_cygwin_to_w32 ()
3724 func_to_host_file_result=$1
3725 if test -n "$1"; then
3726 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3727 # LT_CYGPATH in this case.
3728 func_to_host_file_result=`cygpath -m "$1"`
3730 func_convert_file_check "$1" "$func_to_host_file_result"
3732 # end func_convert_file_cygwin_to_w32
3735 # func_convert_file_nix_to_w32 ARG
3736 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3737 # and a working winepath. Returns result in func_to_host_file_result.
3738 func_convert_file_nix_to_w32 ()
3742 func_to_host_file_result=$1
3743 if test -n "$1"; then
3744 func_convert_core_file_wine_to_w32 "$1"
3745 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3747 func_convert_file_check "$1" "$func_to_host_file_result"
3749 # end func_convert_file_nix_to_w32
3752 # func_convert_file_msys_to_cygwin ARG
3753 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3754 # Returns result in func_to_host_file_result.
3755 func_convert_file_msys_to_cygwin ()
3759 func_to_host_file_result=$1
3760 if test -n "$1"; then
3761 func_convert_core_msys_to_w32 "$1"
3762 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3763 func_to_host_file_result=$func_cygpath_result
3765 func_convert_file_check "$1" "$func_to_host_file_result"
3767 # end func_convert_file_msys_to_cygwin
3770 # func_convert_file_nix_to_cygwin ARG
3771 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3772 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3773 # in func_to_host_file_result.
3774 func_convert_file_nix_to_cygwin ()
3778 func_to_host_file_result=$1
3779 if test -n "$1"; then
3780 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3781 func_convert_core_file_wine_to_w32 "$1"
3782 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3783 func_to_host_file_result=$func_cygpath_result
3785 func_convert_file_check "$1" "$func_to_host_file_result"
3787 # end func_convert_file_nix_to_cygwin
3790 #############################################
3791 # $build to $host PATH CONVERSION FUNCTIONS #
3792 #############################################
3793 # invoked via '$to_host_path_cmd ARG'
3795 # In each case, ARG is the path to be converted from $build to $host format.
3796 # The result will be available in $func_to_host_path_result.
3798 # Path separators are also converted from $build format to $host format. If
3799 # ARG begins or ends with a path separator character, it is preserved (but
3800 # converted to $host format) on output.
3802 # All path conversion functions are named using the following convention:
3803 # file name conversion function : func_convert_file_X_to_Y ()
3804 # path conversion function : func_convert_path_X_to_Y ()
3805 # where, for any given $build/$host combination the 'X_to_Y' value is the
3806 # same. If conversion functions are added for new $build/$host combinations,
3807 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3811 # func_init_to_host_path_cmd
3812 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3813 # appropriate value, based on the value of $to_host_file_cmd.
3815 func_init_to_host_path_cmd ()
3819 if test -z "$to_host_path_cmd"; then
3820 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3821 to_host_path_cmd=func_convert_path_$func_stripname_result
3826 # func_to_host_path ARG
3827 # Converts the path ARG from $build format to $host format. Return result
3828 # in func_to_host_path_result.
3829 func_to_host_path ()
3833 func_init_to_host_path_cmd
3834 $to_host_path_cmd "$1"
3836 # end func_to_host_path
3839 # func_convert_path_noop ARG
3840 # Copy ARG to func_to_host_path_result.
3841 func_convert_path_noop ()
3843 func_to_host_path_result=$1
3845 # end func_convert_path_noop
3848 # func_convert_path_msys_to_w32 ARG
3849 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3850 # conversion to w32 is not available inside the cwrapper. Returns result in
3851 # func_to_host_path_result.
3852 func_convert_path_msys_to_w32 ()
3856 func_to_host_path_result=$1
3857 if test -n "$1"; then
3858 # Remove leading and trailing path separator characters from ARG. MSYS
3859 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3860 # and winepath ignores them completely.
3861 func_stripname : : "$1"
3862 func_to_host_path_tmp1=$func_stripname_result
3863 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3864 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3865 func_convert_path_check : ";" \
3866 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3867 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3870 # end func_convert_path_msys_to_w32
3873 # func_convert_path_cygwin_to_w32 ARG
3874 # Convert path ARG from Cygwin to w32 format. Returns result in
3875 # func_to_host_file_result.
3876 func_convert_path_cygwin_to_w32 ()
3880 func_to_host_path_result=$1
3881 if test -n "$1"; then
3882 # See func_convert_path_msys_to_w32:
3883 func_stripname : : "$1"
3884 func_to_host_path_tmp1=$func_stripname_result
3885 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3886 func_convert_path_check : ";" \
3887 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3888 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3891 # end func_convert_path_cygwin_to_w32
3894 # func_convert_path_nix_to_w32 ARG
3895 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3896 # a working winepath. Returns result in func_to_host_file_result.
3897 func_convert_path_nix_to_w32 ()
3901 func_to_host_path_result=$1
3902 if test -n "$1"; then
3903 # See func_convert_path_msys_to_w32:
3904 func_stripname : : "$1"
3905 func_to_host_path_tmp1=$func_stripname_result
3906 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3907 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3908 func_convert_path_check : ";" \
3909 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3910 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3913 # end func_convert_path_nix_to_w32
3916 # func_convert_path_msys_to_cygwin ARG
3917 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3918 # Returns result in func_to_host_file_result.
3919 func_convert_path_msys_to_cygwin ()
3923 func_to_host_path_result=$1
3924 if test -n "$1"; then
3925 # See func_convert_path_msys_to_w32:
3926 func_stripname : : "$1"
3927 func_to_host_path_tmp1=$func_stripname_result
3928 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3929 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3930 func_to_host_path_result=$func_cygpath_result
3931 func_convert_path_check : : \
3932 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3933 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3936 # end func_convert_path_msys_to_cygwin
3939 # func_convert_path_nix_to_cygwin ARG
3940 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3941 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3942 # func_to_host_file_result.
3943 func_convert_path_nix_to_cygwin ()
3947 func_to_host_path_result=$1
3948 if test -n "$1"; then
3949 # Remove leading and trailing path separator characters from
3950 # ARG. msys behavior is inconsistent here, cygpath turns them
3951 # into '.;' and ';.', and winepath ignores them completely.
3952 func_stripname : : "$1"
3953 func_to_host_path_tmp1=$func_stripname_result
3954 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3955 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3956 func_to_host_path_result=$func_cygpath_result
3957 func_convert_path_check : : \
3958 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3959 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3962 # end func_convert_path_nix_to_cygwin
3965 # func_dll_def_p FILE
3966 # True iff FILE is a Windows DLL '.def' file.
3967 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3972 func_dll_def_p_tmp=`$SED -n \
3974 -e '/^\(;.*\)*$/d' \
3975 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3978 test DEF = "$func_dll_def_p_tmp"
3982 # func_mode_compile arg...
3983 func_mode_compile ()
3987 # Get the compilation command and the source file.
3989 srcfile=$nonopt # always keep a non-empty value in "srcfile"
4001 # do not "continue". Instead, add this to base_compile
4013 # Accept any command-line options.
4016 test -n "$libobj" && \
4017 func_fatal_error "you cannot specify '-o' more than once"
4022 -pie | -fpie | -fPIE)
4023 func_append pie_flag " $arg"
4027 -shared | -static | -prefer-pic | -prefer-non-pic)
4028 func_append later " $arg"
4038 arg_mode=arg # the next one goes into the "base_compile" arg list
4039 continue # The current "srcfile" will either be retained or
4040 ;; # replaced later. I would guess that would be a bug.
4043 func_stripname '-Wc,' '' "$arg"
4044 args=$func_stripname_result
4046 save_ifs=$IFS; IFS=,
4047 for arg in $args; do
4049 func_append_quoted lastarg "$arg"
4052 func_stripname ' ' '' "$lastarg"
4053 lastarg=$func_stripname_result
4055 # Add the arguments to base_compile.
4056 func_append base_compile " $lastarg"
4061 # Accept the current argument as the source file.
4062 # The previous "srcfile" becomes the current argument.
4069 esac # case $arg_mode
4071 # Aesthetically quote the previous argument.
4072 func_append_quoted base_compile "$lastarg"
4077 func_fatal_error "you must specify an argument for -Xcompile"
4080 func_fatal_error "you must specify a target with '-o'"
4083 # Get the name of the library object.
4084 test -z "$libobj" && {
4085 func_basename "$srcfile"
4086 libobj=$func_basename_result
4091 # Recognize several different file suffixes.
4092 # If the user specifies -o file.o, it is replaced with file.lo
4095 *.ada | *.adb | *.ads | *.asm | \
4096 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
4097 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
4098 func_xform "$libobj"
4099 libobj=$func_xform_result
4104 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
4106 func_fatal_error "cannot determine name of library object from '$libobj'"
4110 func_infer_tag $base_compile
4112 for arg in $later; do
4115 test yes = "$build_libtool_libs" \
4116 || func_fatal_configuration "cannot build a shared library"
4122 build_libtool_libs=no
4139 func_quote_arg pretty "$libobj"
4140 test "X$libobj" != "X$func_quote_arg_result" \
4141 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
4142 && func_warning "libobj name '$libobj' may not contain shell special characters."
4143 func_dirname_and_basename "$obj" "/" ""
4144 objname=$func_basename_result
4145 xdir=$func_dirname_result
4146 lobj=$xdir$objdir/$objname
4148 test -z "$base_compile" && \
4149 func_fatal_help "you must specify a compilation command"
4151 # Delete any leftover library objects.
4152 if test yes = "$build_old_libs"; then
4153 removelist="$obj $lobj $libobj ${libobj}T"
4155 removelist="$lobj $libobj ${libobj}T"
4158 # On Cygwin there's no "real" PIC flag so we must build both object types
4160 cygwin* | mingw* | pw32* | os2* | cegcc*)
4164 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
4165 # non-PIC code in shared libraries is not supported
4169 # Calculate the filename of the output object if compiler does
4170 # not support -o with -c
4171 if test no = "$compiler_c_o"; then
4172 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
4173 lockfile=$output_obj.lock
4180 # Lock this critical section if it is needed
4181 # We use this script file to make the link, it avoids creating a new file
4182 if test yes = "$need_locks"; then
4183 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
4184 func_echo "Waiting for $lockfile to be removed"
4187 elif test warn = "$need_locks"; then
4188 if test -f "$lockfile"; then
4190 *** ERROR, $lockfile exists and contains:
4191 `cat $lockfile 2>/dev/null`
4193 This indicates that another process is trying to use the same
4194 temporary object file, and libtool could not work around it because
4195 your compiler does not support '-c' and '-o' together. If you
4196 repeat this compilation, it may succeed, by chance, but you had better
4197 avoid parallel builds (make -j) in this platform, or get a better
4200 $opt_dry_run || $RM $removelist
4203 func_append removelist " $output_obj"
4204 $ECHO "$srcfile" > "$lockfile"
4207 $opt_dry_run || $RM $removelist
4208 func_append removelist " $lockfile"
4209 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
4211 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
4212 srcfile=$func_to_tool_file_result
4213 func_quote_arg pretty "$srcfile"
4214 qsrcfile=$func_quote_arg_result
4216 # Only build a PIC object if we are building libtool libraries.
4217 if test yes = "$build_libtool_libs"; then
4218 # Without this assignment, base_compile gets emptied.
4219 fbsd_hideous_sh_bug=$base_compile
4221 if test no != "$pic_mode"; then
4222 command="$base_compile $qsrcfile $pic_flag"
4224 # Don't build PIC code
4225 command="$base_compile $qsrcfile"
4228 func_mkdir_p "$xdir$objdir"
4230 if test -z "$output_obj"; then
4231 # Place PIC objects in $objdir
4232 func_append command " -o $lobj"
4235 func_show_eval_locale "$command" \
4236 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
4238 if test warn = "$need_locks" &&
4239 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
4241 *** ERROR, $lockfile contains:
4242 `cat $lockfile 2>/dev/null`
4244 but it should contain:
4247 This indicates that another process is trying to use the same
4248 temporary object file, and libtool could not work around it because
4249 your compiler does not support '-c' and '-o' together. If you
4250 repeat this compilation, it may succeed, by chance, but you had better
4251 avoid parallel builds (make -j) in this platform, or get a better
4254 $opt_dry_run || $RM $removelist
4258 # Just move the object if needed, then go on to compile the next one
4259 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
4260 func_show_eval '$MV "$output_obj" "$lobj"' \
4261 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
4264 # Allow error messages only from the first compilation.
4265 if test yes = "$suppress_opt"; then
4266 suppress_output=' >/dev/null 2>&1'
4270 # Only build a position-dependent object if we build old libraries.
4271 if test yes = "$build_old_libs"; then
4272 if test yes != "$pic_mode"; then
4273 # Don't build PIC code
4274 command="$base_compile $qsrcfile$pie_flag"
4276 command="$base_compile $qsrcfile $pic_flag"
4278 if test yes = "$compiler_c_o"; then
4279 func_append command " -o $obj"
4282 # Suppress compiler output if we already did a PIC compilation.
4283 func_append command "$suppress_output"
4284 func_show_eval_locale "$command" \
4285 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
4287 if test warn = "$need_locks" &&
4288 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
4290 *** ERROR, $lockfile contains:
4291 `cat $lockfile 2>/dev/null`
4293 but it should contain:
4296 This indicates that another process is trying to use the same
4297 temporary object file, and libtool could not work around it because
4298 your compiler does not support '-c' and '-o' together. If you
4299 repeat this compilation, it may succeed, by chance, but you had better
4300 avoid parallel builds (make -j) in this platform, or get a better
4303 $opt_dry_run || $RM $removelist
4307 # Just move the object if needed
4308 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
4309 func_show_eval '$MV "$output_obj" "$obj"' \
4310 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
4315 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
4317 # Unlock the critical section if it was locked
4318 if test no != "$need_locks"; then
4319 removelist=$lockfile
4328 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
4333 # We need to display help for each of the modes.
4336 # Generic help is extracted from the usage comments
4337 # at the start of this file.
4343 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4345 Remove files from the build directory.
4347 RM is the name of the program to use to delete files associated with each FILE
4348 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4351 If FILE is a libtool library, object or program, all the files associated
4352 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4357 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4359 Compile a source file into a libtool library object.
4361 This mode accepts the following additional options:
4363 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4364 -no-suppress do not suppress compiler output for multiple passes
4365 -prefer-pic try to build PIC objects only
4366 -prefer-non-pic try to build non-PIC objects only
4367 -shared do not build a '.o' file suitable for static linking
4368 -static only build a '.o' file suitable for static linking
4369 -Wc,FLAG pass FLAG directly to the compiler
4371 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
4372 from the given SOURCEFILE.
4374 The output file name is determined by removing the directory component from
4375 SOURCEFILE, then substituting the C source code suffix '.c' with the
4376 library object suffix, '.lo'."
4381 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
4383 Automatically set library path, then run a program.
4385 This mode accepts the following additional options:
4387 -dlopen FILE add the directory containing FILE to the library path
4389 This mode sets the library path environment variable according to '-dlopen'
4392 If any of the ARGS are libtool executable wrappers, then they are translated
4393 into their corresponding uninstalled binary, and any of their required library
4394 directories are added to the library path.
4396 Then, COMMAND is executed, with ARGS as arguments."
4401 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
4403 Complete the installation of libtool libraries.
4405 Each LIBDIR is a directory that contains libtool libraries.
4407 The commands that this mode executes may require superuser privileges. Use
4408 the '--dry-run' option if you just want to see what would be executed."
4413 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
4415 Install executables or libraries.
4417 INSTALL-COMMAND is the installation command. The first component should be
4418 either the 'install' or 'cp' program.
4420 The following components of INSTALL-COMMAND are treated specially:
4422 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
4424 The rest of the components are interpreted as arguments to that command (only
4425 BSD-compatible install options are recognized)."
4430 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
4432 Link object files or libraries together to form another library, or to
4433 create an executable program.
4435 LINK-COMMAND is a command using the C compiler that you would use to create
4436 a program from several object files.
4438 The following components of LINK-COMMAND are treated specially:
4440 -all-static do not do any dynamic linking at all
4441 -avoid-version do not add a version suffix if possible
4442 -bindir BINDIR specify path to binaries directory (for systems where
4443 libraries must be found in the PATH setting at runtime)
4444 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
4445 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4446 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4447 -export-symbols SYMFILE
4448 try to export only the symbols listed in SYMFILE
4449 -export-symbols-regex REGEX
4450 try to export only the symbols matching REGEX
4451 -LLIBDIR search LIBDIR for required installed libraries
4452 -lNAME OUTPUT-FILE requires the installed library libNAME
4453 -module build a library that can dlopened
4454 -no-fast-install disable the fast-install mode
4455 -no-install link a not-installable executable
4456 -no-undefined declare that a library does not refer to external symbols
4457 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4458 -objectlist FILE use a list of object files found in FILE to specify objects
4459 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
4460 -precious-files-regex REGEX
4461 don't remove output files matching REGEX
4462 -release RELEASE specify package release information
4463 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4464 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4465 -shared only do dynamic linking of libtool libraries
4466 -shrext SUFFIX override the standard shared library file extension
4467 -static do not do any dynamic linking of uninstalled libtool libraries
4468 -static-libtool-libs
4469 do not do any dynamic linking of libtool libraries
4470 -version-info CURRENT[:REVISION[:AGE]]
4471 specify library version info [each variable defaults to 0]
4472 -weak LIBNAME declare that the target provides the LIBNAME interface
4474 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
4476 -Xlinker FLAG pass linker-specific FLAG directly to the linker
4477 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
4479 All other options (arguments beginning with '-') are ignored.
4481 Every other argument is treated as a filename. Files ending in '.la' are
4482 treated as uninstalled libtool libraries, other files are standard or library
4485 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
4486 only library objects ('.lo' files) may be specified, and '-rpath' is
4487 required, except when creating a convenience library.
4489 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
4490 using 'ar' and 'ranlib', or on Windows using 'lib'.
4492 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
4493 is created, otherwise an executable program is created."
4498 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4500 Remove libraries from an installation directory.
4502 RM is the name of the program to use to delete files associated with each FILE
4503 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4506 If FILE is a libtool library, all the files associated with it are deleted.
4507 Otherwise, only FILE itself is deleted using RM."
4511 func_fatal_help "invalid operation mode '$opt_mode'"
4516 $ECHO "Try '$progname --help' for more information about other modes."
4519 # Now that we've collected a possible --mode arg, show help if necessary
4521 if test : = "$opt_help"; then
4526 for opt_mode in compile link execute install finish uninstall clean; do
4529 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
4532 for opt_mode in compile link execute install finish uninstall clean; do
4538 /^When reporting/,/^Report/{
4543 /information about other modes/d
4544 /more detailed .*MODE/d
4545 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
4551 # func_mode_execute arg...
4552 func_mode_execute ()
4556 # The first argument is the command name.
4559 func_fatal_help "you must specify a COMMAND"
4561 # Handle -dlopen flags immediately.
4562 for file in $opt_dlopen; do
4564 || func_fatal_help "'$file' is not a file"
4569 func_resolve_sysroot "$file"
4570 file=$func_resolve_sysroot_result
4572 # Check to see that this really is a libtool archive.
4573 func_lalib_unsafe_p "$file" \
4574 || func_fatal_help "'$lib' is not a valid libtool archive"
4576 # Read the libtool library.
4581 # Skip this library if it cannot be dlopened.
4582 if test -z "$dlname"; then
4583 # Warn if it was a shared library.
4584 test -n "$library_names" && \
4585 func_warning "'$file' was not linked with '-export-dynamic'"
4589 func_dirname "$file" "" "."
4590 dir=$func_dirname_result
4592 if test -f "$dir/$objdir/$dlname"; then
4593 func_append dir "/$objdir"
4595 if test ! -f "$dir/$dlname"; then
4596 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
4602 # Just add the directory containing the .lo file.
4603 func_dirname "$file" "" "."
4604 dir=$func_dirname_result
4608 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
4613 # Get the absolute pathname.
4614 absdir=`cd "$dir" && pwd`
4615 test -n "$absdir" && dir=$absdir
4617 # Now add the directory to shlibpath_var.
4618 if eval "test -z \"\$$shlibpath_var\""; then
4619 eval "$shlibpath_var=\"\$dir\""
4621 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4625 # This variable tells wrapper scripts just to set shlibpath_var
4626 # rather than running their programs.
4627 libtool_execute_magic=$magic
4629 # Check if any of the arguments is a wrapper script.
4634 -* | *.la | *.lo ) ;;
4636 # Do a test to see if this is really a libtool program.
4637 if func_ltwrapper_script_p "$file"; then
4639 # Transform arg to wrapped name.
4640 file=$progdir/$program
4641 elif func_ltwrapper_executable_p "$file"; then
4642 func_ltwrapper_scriptname "$file"
4643 func_source "$func_ltwrapper_scriptname_result"
4644 # Transform arg to wrapped name.
4645 file=$progdir/$program
4649 # Quote arguments (to preserve shell metacharacters).
4650 func_append_quoted args "$file"
4653 if $opt_dry_run; then
4654 # Display what would be done.
4655 if test -n "$shlibpath_var"; then
4656 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
4657 echo "export $shlibpath_var"
4662 if test -n "$shlibpath_var"; then
4663 # Export the shlibpath_var.
4664 eval "export $shlibpath_var"
4667 # Restore saved environment variables
4668 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
4670 eval "if test \"\${save_$lt_var+set}\" = set; then
4671 $lt_var=\$save_$lt_var; export $lt_var
4677 # Now prepare to actually exec the command.
4682 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
4685 # func_mode_finish arg...
4694 for opt in "$nonopt" ${1+"$@"}
4696 if test -d "$opt"; then
4697 func_append libdirs " $opt"
4699 elif test -f "$opt"; then
4700 if func_lalib_unsafe_p "$opt"; then
4701 func_append libs " $opt"
4703 func_warning "'$opt' is not a valid libtool archive"
4707 func_fatal_error "invalid argument '$opt'"
4711 if test -n "$libs"; then
4712 if test -n "$lt_sysroot"; then
4713 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
4714 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
4719 # Remove sysroot references
4720 if $opt_dry_run; then
4721 for lib in $libs; do
4722 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4725 tmpdir=`func_mktempdir`
4726 for lib in $libs; do
4727 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4729 mv -f $tmpdir/tmp-la $lib
4735 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4736 for libdir in $libdirs; do
4737 if test -n "$finish_cmds"; then
4738 # Do each command in the finish commands.
4739 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4742 if test -n "$finish_eval"; then
4743 # Do the single finish_eval.
4744 eval cmds=\"$finish_eval\"
4745 $opt_dry_run || eval "$cmds" || func_append admincmds "
4751 # Exit here if they wanted silent mode.
4752 $opt_quiet && exit $EXIT_SUCCESS
4754 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4755 echo "----------------------------------------------------------------------"
4756 echo "Libraries have been installed in:"
4757 for libdir in $libdirs; do
4761 echo "If you ever happen to want to link against installed libraries"
4762 echo "in a given directory, LIBDIR, you must either use libtool, and"
4763 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4764 echo "flag during linking and do at least one of the following:"
4765 if test -n "$shlibpath_var"; then
4766 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4767 echo " during execution"
4769 if test -n "$runpath_var"; then
4770 echo " - add LIBDIR to the '$runpath_var' environment variable"
4771 echo " during linking"
4773 if test -n "$hardcode_libdir_flag_spec"; then
4775 eval flag=\"$hardcode_libdir_flag_spec\"
4777 $ECHO " - use the '$flag' linker flag"
4779 if test -n "$admincmds"; then
4780 $ECHO " - have your system administrator run these commands:$admincmds"
4782 if test -f /etc/ld.so.conf; then
4783 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4787 echo "See any operating system documentation about shared libraries for"
4789 solaris2.[6789]|solaris2.1[0-9])
4790 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4794 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4797 echo "----------------------------------------------------------------------"
4802 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4805 # func_mode_install arg...
4806 func_mode_install ()
4810 # There may be an optional sh(1) argument at the beginning of
4811 # install_prog (especially on Windows NT).
4812 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4813 # Allow the use of GNU shtool's install command.
4814 case $nonopt in *shtool*) :;; *) false;; esac
4816 # Aesthetically quote it.
4817 func_quote_arg pretty "$nonopt"
4818 install_prog="$func_quote_arg_result "
4826 # The real first argument should be the name of the installation program.
4827 # Aesthetically quote it.
4828 func_quote_arg pretty "$arg"
4829 func_append install_prog "$func_quote_arg_result"
4830 install_shared_prog=$install_prog
4831 case " $install_prog " in
4832 *[\\\ /]cp\ *) install_cp=: ;;
4833 *) install_cp=false ;;
4836 # We need to accept at least all the BSD install flags.
4848 if test -n "$dest"; then
4849 func_append files " $dest"
4857 if $install_cp; then :; else
4871 # If the previous option needed an argument, then skip it.
4872 if test -n "$prev"; then
4873 if test X-m = "X$prev" && test -n "$install_override_mode"; then
4874 arg2=$install_override_mode
4885 # Aesthetically quote the argument.
4886 func_quote_arg pretty "$arg"
4887 func_append install_prog " $func_quote_arg_result"
4888 if test -n "$arg2"; then
4889 func_quote_arg pretty "$arg2"
4891 func_append install_shared_prog " $func_quote_arg_result"
4894 test -z "$install_prog" && \
4895 func_fatal_help "you must specify an install program"
4897 test -n "$prev" && \
4898 func_fatal_help "the '$prev' option requires an argument"
4900 if test -n "$install_override_mode" && $no_mode; then
4901 if $install_cp; then :; else
4902 func_quote_arg pretty "$install_override_mode"
4903 func_append install_shared_prog " -m $func_quote_arg_result"
4907 if test -z "$files"; then
4908 if test -z "$dest"; then
4909 func_fatal_help "no file or destination specified"
4911 func_fatal_help "you must specify a destination"
4915 # Strip any trailing slash from the destination.
4916 func_stripname '' '/' "$dest"
4917 dest=$func_stripname_result
4919 # Check to see that the destination is a directory.
4920 test -d "$dest" && isdir=:
4925 func_dirname_and_basename "$dest" "" "."
4926 destdir=$func_dirname_result
4927 destname=$func_basename_result
4929 # Not a directory, so check to see that there is only one file specified.
4930 set dummy $files; shift
4931 test "$#" -gt 1 && \
4932 func_fatal_help "'$dest' is not a directory"
4935 [\\/]* | [A-Za-z]:[\\/]*) ;;
4937 for file in $files; do
4941 func_fatal_help "'$destdir' must be an absolute directory name"
4948 # This variable tells wrapper scripts just to set variables rather
4949 # than running their programs.
4950 libtool_install_magic=$magic
4955 for file in $files; do
4957 # Do each installation.
4960 # Do the static libraries later.
4961 func_append staticlibs " $file"
4965 func_resolve_sysroot "$file"
4966 file=$func_resolve_sysroot_result
4968 # Check to see that this really is a libtool archive.
4969 func_lalib_unsafe_p "$file" \
4970 || func_fatal_help "'$file' is not a valid libtool archive"
4977 # Add the libdir to current_libdirs if it is the destination.
4978 if test "X$destdir" = "X$libdir"; then
4979 case "$current_libdirs " in
4981 *) func_append current_libdirs " $libdir" ;;
4984 # Note the libdir as a future libdir.
4985 case "$future_libdirs " in
4987 *) func_append future_libdirs " $libdir" ;;
4991 func_dirname "$file" "/" ""
4992 dir=$func_dirname_result
4993 func_append dir "$objdir"
4995 if test -n "$relink_command"; then
4996 # Determine the prefix the user has applied to our future dir.
4997 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4999 # Don't allow the user to place us outside of our expected
5000 # location b/c this prevents finding dependent libraries that
5001 # are installed to the same prefix.
5002 # At present, this check doesn't affect windows .dll's that
5003 # are installed into $libdir/../bin (currently, that works fine)
5004 # but it's something to keep an eye on.
5005 test "$inst_prefix_dir" = "$destdir" && \
5006 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
5008 if test -n "$inst_prefix_dir"; then
5009 # Stick the inst_prefix_dir data into the link command.
5010 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5012 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5015 func_warning "relinking '$file'"
5016 func_show_eval "$relink_command" \
5017 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
5020 # See the names of the shared library.
5021 set dummy $library_names; shift
5022 if test -n "$1"; then
5027 test -n "$relink_command" && srcname=${realname}T
5029 # Install the shared library and build the symlinks.
5030 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
5034 cygwin* | mingw* | pw32* | cegcc*)
5049 if test -n "$tstripme" && test -n "$striplib"; then
5050 func_show_eval "$striplib $destdir/$realname" 'exit $?'
5053 if test "$#" -gt 0; then
5054 # Delete the old symlinks, and create new ones.
5055 # Try 'ln -sf' first, because the 'ln' binary might depend on
5056 # the symlink we replace! Solaris /bin/ln does not understand -f,
5057 # so we also need to try rm && ln -s.
5060 test "$linkname" != "$realname" \
5061 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
5065 # Do each command in the postinstall commands.
5066 lib=$destdir/$realname
5067 func_execute_cmds "$postinstall_cmds" 'exit $?'
5070 # Install the pseudo-library for information purposes.
5071 func_basename "$file"
5072 name=$func_basename_result
5073 instname=$dir/${name}i
5074 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
5076 # Maybe install the static library, too.
5077 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
5081 # Install (i.e. copy) a libtool object.
5083 # Figure out destination file name, if it wasn't already specified.
5084 if test -n "$destname"; then
5085 destfile=$destdir/$destname
5087 func_basename "$file"
5088 destfile=$func_basename_result
5089 destfile=$destdir/$destfile
5092 # Deduce the name of the destination old-style object file.
5095 func_lo2o "$destfile"
5096 staticdest=$func_lo2o_result
5099 staticdest=$destfile
5103 func_fatal_help "cannot copy a libtool object to '$destfile'"
5107 # Install the libtool object if requested.
5108 test -n "$destfile" && \
5109 func_show_eval "$install_prog $file $destfile" 'exit $?'
5111 # Install the old object if enabled.
5112 if test yes = "$build_old_libs"; then
5113 # Deduce the name of the old-style object file.
5115 staticobj=$func_lo2o_result
5116 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
5122 # Figure out destination file name, if it wasn't already specified.
5123 if test -n "$destname"; then
5124 destfile=$destdir/$destname
5126 func_basename "$file"
5127 destfile=$func_basename_result
5128 destfile=$destdir/$destfile
5131 # If the file is missing, and there is a .exe on the end, strip it
5132 # because it is most likely a libtool script we actually want to
5137 if test ! -f "$file"; then
5138 func_stripname '' '.exe' "$file"
5139 file=$func_stripname_result
5145 # Do a test to see if this is really a libtool program.
5148 if func_ltwrapper_executable_p "$file"; then
5149 func_ltwrapper_scriptname "$file"
5150 wrapper=$func_ltwrapper_scriptname_result
5152 func_stripname '' '.exe' "$file"
5153 wrapper=$func_stripname_result
5160 if func_ltwrapper_script_p "$wrapper"; then
5164 func_source "$wrapper"
5166 # Check the variables that should have been set.
5167 test -z "$generated_by_libtool_version" && \
5168 func_fatal_error "invalid libtool wrapper script '$wrapper'"
5171 for lib in $notinst_deplibs; do
5172 # Check to see that each library is installed.
5174 if test -f "$lib"; then
5177 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
5178 if test -n "$libdir" && test ! -f "$libfile"; then
5179 func_warning "'$lib' has not been installed in '$libdir'"
5185 func_source "$wrapper"
5188 if test no = "$fast_install" && test -n "$relink_command"; then
5191 tmpdir=`func_mktempdir`
5192 func_basename "$file$stripped_ext"
5193 file=$func_basename_result
5194 outputname=$tmpdir/$file
5195 # Replace the output file specification.
5196 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
5199 func_quote_arg expand,pretty "$relink_command"
5200 eval "func_echo $func_quote_arg_result"
5202 if eval "$relink_command"; then :
5204 func_error "error: relink '$file' with the above command before installing it"
5205 $opt_dry_run || ${RM}r "$tmpdir"
5210 func_warning "cannot relink '$file'"
5214 # Install the binary that we compiled earlier.
5215 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
5219 # remove .exe since cygwin /usr/bin/install will append another
5221 case $install_prog,$host in
5222 */usr/bin/install*,*cygwin*)
5223 case $file:$destfile in
5228 destfile=$destfile.exe
5231 func_stripname '' '.exe' "$destfile"
5232 destfile=$func_stripname_result
5237 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
5238 $opt_dry_run || if test -n "$outputname"; then
5245 for file in $staticlibs; do
5246 func_basename "$file"
5247 name=$func_basename_result
5249 # Set up the ranlib parameters.
5250 oldlib=$destdir/$name
5251 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
5252 tool_oldlib=$func_to_tool_file_result
5254 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
5256 if test -n "$stripme" && test -n "$old_striplib"; then
5257 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
5260 # Do each command in the postinstall commands.
5261 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
5264 test -n "$future_libdirs" && \
5265 func_warning "remember to run '$progname --finish$future_libdirs'"
5267 if test -n "$current_libdirs"; then
5268 # Maybe just do a dry run.
5269 $opt_dry_run && current_libdirs=" -n$current_libdirs"
5270 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
5276 test install = "$opt_mode" && func_mode_install ${1+"$@"}
5279 # func_generate_dlsyms outputname originator pic_p
5280 # Extract symbols from dlprefiles and create ${outputname}S.o with
5281 # a dlpreopen symbol table.
5282 func_generate_dlsyms ()
5289 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
5292 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
5293 if test -n "$NM" && test -n "$global_symbol_pipe"; then
5294 my_dlsyms=${my_outputname}S.c
5296 func_error "not configured to extract global symbols from dlpreopened files"
5300 if test -n "$my_dlsyms"; then
5304 # Discover the nlist of each of the dlfiles.
5305 nlist=$output_objdir/$my_outputname.nm
5307 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
5309 # Parse the name list into a source file.
5310 func_verbose "creating $output_objdir/$my_dlsyms"
5312 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
5313 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
5314 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
5320 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
5321 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
5324 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
5325 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
5326 /* DATA imports from DLLs on WIN32 can't be const, because runtime
5327 relocations are performed -- see ld's documentation on pseudo-relocs. */
5328 # define LT_DLSYM_CONST
5329 #elif defined __osf__
5330 /* This system does not cope well with relocations in const data. */
5331 # define LT_DLSYM_CONST
5333 # define LT_DLSYM_CONST const
5336 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5338 /* External symbol declarations for the compiler. */\
5341 if test yes = "$dlself"; then
5342 func_verbose "generating symbol list for '$output'"
5344 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
5346 # Add our own program objects to the symbol list.
5347 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
5348 for progfile in $progfiles; do
5349 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
5350 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
5351 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
5354 if test -n "$exclude_expsyms"; then
5356 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
5357 eval '$MV "$nlist"T "$nlist"'
5361 if test -n "$export_symbols_regex"; then
5363 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
5364 eval '$MV "$nlist"T "$nlist"'
5368 # Prepare the list of exported symbols
5369 if test -z "$export_symbols"; then
5370 export_symbols=$output_objdir/$outputname.exp
5373 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
5375 *cygwin* | *mingw* | *cegcc* )
5376 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5377 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
5383 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
5384 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
5385 eval '$MV "$nlist"T "$nlist"'
5387 *cygwin* | *mingw* | *cegcc* )
5388 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5389 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
5396 for dlprefile in $dlprefiles; do
5397 func_verbose "extracting global C symbols from '$dlprefile'"
5398 func_basename "$dlprefile"
5399 name=$func_basename_result
5401 *cygwin* | *mingw* | *cegcc* )
5402 # if an import library, we need to obtain dlname
5403 if func_win32_import_lib_p "$dlprefile"; then
5404 func_tr_sh "$dlprefile"
5405 eval "curr_lafile=\$libfile_$func_tr_sh_result"
5406 dlprefile_dlbasename=
5407 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
5408 # Use subshell, to avoid clobbering current variable values
5409 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
5410 if test -n "$dlprefile_dlname"; then
5411 func_basename "$dlprefile_dlname"
5412 dlprefile_dlbasename=$func_basename_result
5414 # no lafile. user explicitly requested -dlpreopen <import library>.
5415 $sharedlib_from_linklib_cmd "$dlprefile"
5416 dlprefile_dlbasename=$sharedlib_from_linklib_result
5420 if test -n "$dlprefile_dlbasename"; then
5421 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
5423 func_warning "Could not compute DLL name from $name"
5424 eval '$ECHO ": $name " >> "$nlist"'
5426 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5427 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
5428 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
5430 else # not an import lib
5432 eval '$ECHO ": $name " >> "$nlist"'
5433 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5434 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5440 eval '$ECHO ": $name " >> "$nlist"'
5441 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
5442 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5449 # Make sure we have at least an empty file.
5450 test -f "$nlist" || : > "$nlist"
5452 if test -n "$exclude_expsyms"; then
5453 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
5454 $MV "$nlist"T "$nlist"
5457 # Try sorting and uniquifying the output.
5458 if $GREP -v "^: " < "$nlist" |
5459 if sort -k 3 </dev/null >/dev/null 2>&1; then
5464 uniq > "$nlist"S; then
5467 $GREP -v "^: " < "$nlist" > "$nlist"S
5470 if test -f "$nlist"S; then
5471 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
5473 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
5476 func_show_eval '$RM "${nlist}I"'
5477 if test -n "$global_symbol_to_import"; then
5478 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
5481 echo >> "$output_objdir/$my_dlsyms" "\
5483 /* The mapping between symbol names and symbols. */
5488 extern LT_DLSYM_CONST lt_dlsymlist
5489 lt_${my_prefix}_LTX_preloaded_symbols[];\
5492 if test -s "$nlist"I; then
5493 echo >> "$output_objdir/$my_dlsyms" "\
5494 static void lt_syminit(void)
5496 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
5497 for (; symbol->name; ++symbol)
5499 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
5500 echo >> "$output_objdir/$my_dlsyms" "\
5504 echo >> "$output_objdir/$my_dlsyms" "\
5505 LT_DLSYM_CONST lt_dlsymlist
5506 lt_${my_prefix}_LTX_preloaded_symbols[] =
5507 { {\"$my_originator\", (void *) 0},"
5509 if test -s "$nlist"I; then
5510 echo >> "$output_objdir/$my_dlsyms" "\
5511 {\"@INIT@\", (void *) <_syminit},"
5514 case $need_lib_prefix in
5516 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
5519 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
5522 echo >> "$output_objdir/$my_dlsyms" "\
5526 /* This works around a problem in FreeBSD linker */
5527 #ifdef FREEBSD_WORKAROUND
5528 static const void *lt_preloaded_setup() {
5529 return lt_${my_prefix}_LTX_preloaded_symbols;
5539 pic_flag_for_symtable=
5540 case "$compile_command " in
5544 # compiling the symbol table file with pic_flag works around
5545 # a FreeBSD bug that causes programs to crash when -lm is
5546 # linked before any other PIC object. But we must not use
5547 # pic_flag when linking with -static. The problem exists in
5548 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
5549 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
5550 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
5552 pic_flag_for_symtable=" $pic_flag" ;;
5554 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
5560 for arg in $LTCFLAGS; do
5562 -pie | -fpie | -fPIE) ;;
5563 *) func_append symtab_cflags " $arg" ;;
5567 # Now compile the dynamic symbol file.
5568 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
5570 # Clean up the generated files.
5571 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
5573 # Transform the symbol file into the correct name.
5574 symfileobj=$output_objdir/${my_outputname}S.$objext
5576 *cygwin* | *mingw* | *cegcc* )
5577 if test -f "$output_objdir/$my_outputname.def"; then
5578 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5579 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5581 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5582 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5586 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5587 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5592 func_fatal_error "unknown suffix for '$my_dlsyms'"
5596 # We keep going just in case the user didn't refer to
5597 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
5598 # really was required.
5600 # Nullify the symbol file.
5601 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
5602 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
5606 # func_cygming_gnu_implib_p ARG
5607 # This predicate returns with zero status (TRUE) if
5608 # ARG is a GNU/binutils-style import library. Returns
5609 # with nonzero status (FALSE) otherwise.
5610 func_cygming_gnu_implib_p ()
5614 func_to_tool_file "$1" func_convert_file_msys_to_w32
5615 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)$'`
5616 test -n "$func_cygming_gnu_implib_tmp"
5619 # func_cygming_ms_implib_p ARG
5620 # This predicate returns with zero status (TRUE) if
5621 # ARG is an MS-style import library. Returns
5622 # with nonzero status (FALSE) otherwise.
5623 func_cygming_ms_implib_p ()
5627 func_to_tool_file "$1" func_convert_file_msys_to_w32
5628 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
5629 test -n "$func_cygming_ms_implib_tmp"
5632 # func_win32_libid arg
5633 # return the library type of file 'arg'
5635 # Need a lot of goo to handle *both* DLLs and import libs
5636 # Has to be a shell function in order to 'eat' the argument
5637 # that is supplied when $file_magic_command is called.
5638 # Despite the name, also deal with 64 bit binaries.
5643 win32_libid_type=unknown
5644 win32_fileres=`file -L $1 2>/dev/null`
5645 case $win32_fileres in
5646 *ar\ archive\ import\ library*) # definitely import
5647 win32_libid_type="x86 archive import"
5649 *ar\ archive*) # could be an import, or static
5650 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
5651 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
5652 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
5653 case $nm_interface in
5655 if func_cygming_ms_implib_p "$1" ||
5656 func_cygming_gnu_implib_p "$1"
5664 func_to_tool_file "$1" func_convert_file_msys_to_w32
5665 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
5676 case $win32_nmres in
5677 import*) win32_libid_type="x86 archive import";;
5678 *) win32_libid_type="x86 archive static";;
5683 win32_libid_type="x86 DLL"
5685 *executable*) # but shell scripts are "executable" too...
5686 case $win32_fileres in
5687 *MS\ Windows\ PE\ Intel*)
5688 win32_libid_type="x86 DLL"
5693 $ECHO "$win32_libid_type"
5696 # func_cygming_dll_for_implib ARG
5698 # Platform-specific function to extract the
5699 # name of the DLL associated with the specified
5700 # import library ARG.
5701 # Invoked by eval'ing the libtool variable
5702 # $sharedlib_from_linklib_cmd
5703 # Result is available in the variable
5704 # $sharedlib_from_linklib_result
5705 func_cygming_dll_for_implib ()
5709 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
5712 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
5714 # The is the core of a fallback implementation of a
5715 # platform-specific function to extract the name of the
5716 # DLL associated with the specified import library LIBNAME.
5718 # SECTION_NAME is either .idata$6 or .idata$7, depending
5719 # on the platform and compiler that created the implib.
5721 # Echos the name of the DLL associated with the
5722 # specified import library.
5723 func_cygming_dll_for_implib_fallback_core ()
5727 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5728 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5729 $SED '/^Contents of section '"$match_literal"':/{
5730 # Place marker at beginning of archive member dllname section
5735 # These lines can sometimes be longer than 43 characters, but
5736 # are always uninteresting
5737 /:[ ]*file format pe[i]\{,1\}-/d
5738 /^In archive [^:]*:/d
5739 # Ensure marker is printed
5741 # Remove all lines with less than 43 characters
5743 # From remaining lines, remove first 43 characters
5746 # Join marker and all lines until next marker into a single line
5747 /^====MARK====/ b para
5756 # Remove trailing dots and whitespace
5760 # we now have a list, one entry per line, of the stringified
5761 # contents of the appropriate section of all members of the
5762 # archive that possess that section. Heuristic: eliminate
5763 # all those that have a first or second character that is
5764 # a '.' (that is, objdump's representation of an unprintable
5765 # character.) This should work for all archives with less than
5766 # 0x302f exports -- but will fail for DLLs whose name actually
5767 # begins with a literal '.' or a single character followed by
5770 # Of those that remain, print the first one.
5771 $SED -e '/^\./d;/^.\./d;q'
5774 # func_cygming_dll_for_implib_fallback ARG
5775 # Platform-specific function to extract the
5776 # name of the DLL associated with the specified
5777 # import library ARG.
5779 # This fallback implementation is for use when $DLLTOOL
5780 # does not support the --identify-strict option.
5781 # Invoked by eval'ing the libtool variable
5782 # $sharedlib_from_linklib_cmd
5783 # Result is available in the variable
5784 # $sharedlib_from_linklib_result
5785 func_cygming_dll_for_implib_fallback ()
5789 if func_cygming_gnu_implib_p "$1"; then
5790 # binutils import library
5791 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5792 elif func_cygming_ms_implib_p "$1"; then
5793 # ms-generated import library
5794 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5797 sharedlib_from_linklib_result=
5802 # func_extract_an_archive dir oldlib
5803 func_extract_an_archive ()
5807 f_ex_an_ar_dir=$1; shift
5808 f_ex_an_ar_oldlib=$1
5809 if test yes = "$lock_old_archive_extraction"; then
5810 lockfile=$f_ex_an_ar_oldlib.lock
5811 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5812 func_echo "Waiting for $lockfile to be removed"
5816 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5817 'stat=$?; rm -f "$lockfile"; exit $stat'
5818 if test yes = "$lock_old_archive_extraction"; then
5819 $opt_dry_run || rm -f "$lockfile"
5821 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5824 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5829 # func_extract_archives gentop oldlib ...
5830 func_extract_archives ()
5835 my_oldlibs=${1+"$@"}
5841 for my_xlib in $my_oldlibs; do
5842 # Extract the objects.
5844 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5845 *) my_xabs=`pwd`"/$my_xlib" ;;
5847 func_basename "$my_xlib"
5848 my_xlib=$func_basename_result
5851 case " $extracted_archives " in
5853 func_arith $extracted_serial + 1
5854 extracted_serial=$func_arith_result
5855 my_xlib_u=lt$extracted_serial-$my_xlib ;;
5859 extracted_archives="$extracted_archives $my_xlib_u"
5860 my_xdir=$my_gentop/$my_xlib_u
5862 func_mkdir_p "$my_xdir"
5866 func_verbose "Extracting $my_xabs"
5867 # Do not bother doing anything if just a dry run
5869 darwin_orig_dir=`pwd`
5870 cd $my_xdir || exit $?
5871 darwin_archive=$my_xabs
5873 func_basename "$darwin_archive"
5874 darwin_base_archive=$func_basename_result
5875 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5876 if test -n "$darwin_arches"; then
5877 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5879 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5880 for darwin_arch in $darwin_arches; do
5881 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5882 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5883 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5884 func_extract_an_archive "`pwd`" "$darwin_base_archive"
5886 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5887 done # $darwin_arches
5888 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5889 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5892 for darwin_file in $darwin_filelist; do
5893 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5894 $LIPO -create -output "$darwin_file" $darwin_files
5895 done # $darwin_filelist
5897 cd "$darwin_orig_dir"
5900 func_extract_an_archive "$my_xdir" "$my_xabs"
5905 func_extract_an_archive "$my_xdir" "$my_xabs"
5908 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5911 func_extract_archives_result=$my_oldobjs
5915 # func_emit_wrapper [arg=no]
5917 # Emit a libtool wrapper script on stdout.
5918 # Don't directly open a file because we may want to
5919 # incorporate the script contents within a cygwin/mingw
5920 # wrapper executable. Must ONLY be called from within
5921 # func_mode_link because it depends on a number of variables
5924 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5925 # variable will take. If 'yes', then the emitted script
5926 # will assume that the directory where it is stored is
5927 # the $objdir directory. This is a cygwin/mingw-specific
5929 func_emit_wrapper ()
5931 func_emit_wrapper_arg1=${1-no}
5936 # $output - temporary wrapper script for $objdir/$outputname
5937 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5939 # The $output program cannot be directly executed until all the libtool
5940 # libraries that it depends on are installed.
5942 # This wrapper script should never be moved out of the build directory.
5943 # If it is, it will not operate correctly.
5945 # Sed substitution that helps us do robust quoting. It backslashifies
5946 # metacharacters that are still active within double-quoted strings.
5947 sed_quote_subst='$sed_quote_subst'
5949 # Be Bourne compatible
5950 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5953 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5954 # is contrary to our usage. Disable this feature.
5955 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5956 setopt NO_GLOB_SUBST
5958 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5960 BIN_SH=xpg4; export BIN_SH # for Tru64
5961 DUALCASE=1; export DUALCASE # for MKS sh
5963 # The HP-UX ksh and POSIX shell print the target directory to stdout
5965 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5967 relink_command=\"$relink_command\"
5969 # This environment variable determines our operation mode.
5970 if test \"\$libtool_install_magic\" = \"$magic\"; then
5971 # install mode needs the following variables:
5972 generated_by_libtool_version='$macro_version'
5973 notinst_deplibs='$notinst_deplibs'
5975 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5976 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5979 func_quote_arg pretty "$ECHO"
5980 qECHO=$func_quote_arg_result
5983 # A function that is used when there is no print builtin or printf.
5984 func_fallback_echo ()
5986 eval 'cat <<_LTECHO_EOF
5993 # Very basic option parsing. These options are (a) specific to
5994 # the libtool wrapper, (b) are identical between the wrapper
5995 # /script/ and the wrapper /executable/ that is used only on
5996 # windows platforms, and (c) all begin with the string "--lt-"
5997 # (application programs are unlikely to have options that match
6000 # There are only two supported options: --lt-debug and
6001 # --lt-dump-script. There is, deliberately, no --lt-help.
6003 # The first argument to this parsing function should be the
6004 # script's $0 value, followed by "$@".
6006 func_parse_lt_options ()
6012 case \"\$lt_opt\" in
6013 --lt-debug) lt_option_debug=1 ;;
6015 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
6016 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
6017 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
6018 cat \"\$lt_dump_D/\$lt_dump_F\"
6022 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
6028 # Print the debug banner immediately:
6029 if test -n \"\$lt_option_debug\"; then
6030 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
6034 # Used when --lt-debug. Prints its arguments to stdout
6035 # (redirection is the responsibility of the caller)
6036 func_lt_dump_args ()
6041 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
6042 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
6046 # Core function for launching the target application
6047 func_exec_program_core ()
6051 # Backslashes separate directories on plain windows
6052 *-*-mingw | *-*-os2* | *-cegcc*)
6054 if test -n \"\$lt_option_debug\"; then
6055 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
6056 func_lt_dump_args \${1+\"\$@\"} 1>&2
6058 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
6064 if test -n \"\$lt_option_debug\"; then
6065 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
6066 func_lt_dump_args \${1+\"\$@\"} 1>&2
6068 exec \"\$progdir/\$program\" \${1+\"\$@\"}
6073 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
6077 # A function to encapsulate launching the target application
6078 # Strips options in the --lt-* namespace from \$@ and
6079 # launches target application with the remaining arguments.
6080 func_exec_program ()
6088 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
6093 func_exec_program_core \${1+\"\$@\"}
6097 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
6099 # Find the directory that this script lives in.
6100 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
6101 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
6103 # Follow symbolic links until we get to the real thisdir.
6104 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
6105 while test -n \"\$file\"; do
6106 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
6108 # If there was a directory component, then change thisdir.
6109 if test \"x\$destdir\" != \"x\$file\"; then
6110 case \"\$destdir\" in
6111 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
6112 *) thisdir=\"\$thisdir/\$destdir\" ;;
6116 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
6117 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
6120 # Usually 'no', except on cygwin/mingw when embedded into
6122 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
6123 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
6124 # special case for '.'
6125 if test \"\$thisdir\" = \".\"; then
6128 # remove .libs from thisdir
6129 case \"\$thisdir\" in
6130 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
6131 $objdir ) thisdir=. ;;
6135 # Try to get the absolute directory name.
6136 absdir=\`cd \"\$thisdir\" && pwd\`
6137 test -n \"\$absdir\" && thisdir=\"\$absdir\"
6140 if test yes = "$fast_install"; then
6142 program=lt-'$outputname'$exeext
6143 progdir=\"\$thisdir/$objdir\"
6145 if test ! -f \"\$progdir/\$program\" ||
6146 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
6147 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
6149 file=\"\$\$-\$program\"
6151 if test ! -d \"\$progdir\"; then
6152 $MKDIR \"\$progdir\"
6154 $RM \"\$progdir/\$file\"
6159 # relink executable if necessary
6160 if test -n \"\$relink_command\"; then
6161 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
6163 \$ECHO \"\$relink_command_output\" >&2
6164 $RM \"\$progdir/\$file\"
6169 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
6170 { $RM \"\$progdir/\$program\";
6171 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
6172 $RM \"\$progdir/\$file\"
6176 program='$outputname'
6177 progdir=\"\$thisdir/$objdir\"
6183 if test -f \"\$progdir/\$program\"; then"
6185 # fixup the dll searchpath if we need to.
6187 # Fix the DLL searchpath if we need to. Do this before prepending
6188 # to shlibpath, because on Windows, both are PATH and uninstalled
6189 # libraries must come first.
6190 if test -n "$dllsearchpath"; then
6192 # Add the dll search path components to the executable PATH
6193 PATH=$dllsearchpath:\$PATH
6197 # Export our shlibpath_var if we have one.
6198 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
6200 # Add our own library path to $shlibpath_var
6201 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
6203 # Some systems cannot cope with colon-terminated $shlibpath_var
6204 # The second colon is a workaround for a bug in BeOS R4 sed
6205 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
6207 export $shlibpath_var
6212 if test \"\$libtool_execute_magic\" != \"$magic\"; then
6213 # Run the actual program with our arguments.
6214 func_exec_program \${1+\"\$@\"}
6217 # The program doesn't exist.
6218 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
6219 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
6220 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
6228 # func_emit_cwrapperexe_src
6229 # emit the source code for a wrapper executable on stdout
6230 # Must ONLY be called from within func_mode_link because
6231 # it depends on a number of variable set therein.
6232 func_emit_cwrapperexe_src ()
6236 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
6237 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
6239 The $output program cannot be directly executed until all the libtool
6240 libraries that it depends on are installed.
6242 This wrapper executable should never be moved out of the build directory.
6243 If it is, it will not operate correctly.
6248 # define _CRT_SECURE_NO_DEPRECATE 1
6253 # include <direct.h>
6254 # include <process.h>
6257 # include <unistd.h>
6258 # include <stdint.h>
6270 #include <sys/stat.h>
6272 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
6274 /* declarations of non-ANSI functions */
6275 #if defined __MINGW32__
6276 # ifdef __STRICT_ANSI__
6277 int _putenv (const char *);
6279 #elif defined __CYGWIN__
6280 # ifdef __STRICT_ANSI__
6281 char *realpath (const char *, char *);
6282 int putenv (char *);
6283 int setenv (const char *, const char *, int);
6285 /* #elif defined other_platform || defined ... */
6288 /* portability defines, excluding path handling macros */
6289 #if defined _MSC_VER
6290 # define setmode _setmode
6292 # define chmod _chmod
6293 # define getcwd _getcwd
6294 # define putenv _putenv
6295 # define S_IXUSR _S_IEXEC
6296 #elif defined __MINGW32__
6297 # define setmode _setmode
6299 # define chmod _chmod
6300 # define getcwd _getcwd
6301 # define putenv _putenv
6302 #elif defined __CYGWIN__
6303 # define HAVE_SETENV
6304 # define FOPEN_WB "wb"
6305 /* #elif defined other platforms ... */
6308 #if defined PATH_MAX
6309 # define LT_PATHMAX PATH_MAX
6310 #elif defined MAXPATHLEN
6311 # define LT_PATHMAX MAXPATHLEN
6313 # define LT_PATHMAX 1024
6323 /* path handling portability macros */
6324 #ifndef DIR_SEPARATOR
6325 # define DIR_SEPARATOR '/'
6326 # define PATH_SEPARATOR ':'
6329 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
6331 # define HAVE_DOS_BASED_FILE_SYSTEM
6332 # define FOPEN_WB "wb"
6333 # ifndef DIR_SEPARATOR_2
6334 # define DIR_SEPARATOR_2 '\\'
6336 # ifndef PATH_SEPARATOR_2
6337 # define PATH_SEPARATOR_2 ';'
6341 #ifndef DIR_SEPARATOR_2
6342 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
6343 #else /* DIR_SEPARATOR_2 */
6344 # define IS_DIR_SEPARATOR(ch) \
6345 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
6346 #endif /* DIR_SEPARATOR_2 */
6348 #ifndef PATH_SEPARATOR_2
6349 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
6350 #else /* PATH_SEPARATOR_2 */
6351 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
6352 #endif /* PATH_SEPARATOR_2 */
6355 # define FOPEN_WB "w"
6358 # define _O_BINARY 0
6361 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
6362 #define XFREE(stale) do { \
6363 if (stale) { free (stale); stale = 0; } \
6366 #if defined LT_DEBUGWRAPPER
6367 static int lt_debug = 1;
6369 static int lt_debug = 0;
6372 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
6374 void *xmalloc (size_t num);
6375 char *xstrdup (const char *string);
6376 const char *base_name (const char *name);
6377 char *find_executable (const char *wrapper);
6378 char *chase_symlinks (const char *pathspec);
6379 int make_executable (const char *path);
6380 int check_executable (const char *path);
6381 char *strendzap (char *str, const char *pat);
6382 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
6383 void lt_fatal (const char *file, int line, const char *message, ...);
6384 static const char *nonnull (const char *s);
6385 static const char *nonempty (const char *s);
6386 void lt_setenv (const char *name, const char *value);
6387 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
6388 void lt_update_exe_path (const char *name, const char *value);
6389 void lt_update_lib_path (const char *name, const char *value);
6390 char **prepare_spawn (char **argv);
6391 void lt_dump_script (FILE *f);
6395 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
6396 # define externally_visible volatile
6398 # define externally_visible __attribute__((externally_visible)) volatile
6400 externally_visible const char * MAGIC_EXE = "$magic_exe";
6401 const char * LIB_PATH_VARNAME = "$shlibpath_var";
6404 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
6405 func_to_host_path "$temp_rpath"
6407 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
6411 const char * LIB_PATH_VALUE = "";
6415 if test -n "$dllsearchpath"; then
6416 func_to_host_path "$dllsearchpath:"
6418 const char * EXE_PATH_VARNAME = "PATH";
6419 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
6423 const char * EXE_PATH_VARNAME = "";
6424 const char * EXE_PATH_VALUE = "";
6428 if test yes = "$fast_install"; then
6430 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
6434 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
6441 #define LTWRAPPER_OPTION_PREFIX "--lt-"
6443 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
6444 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
6445 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
6448 main (int argc, char *argv[])
6453 char *actual_cwrapper_path;
6454 char *actual_cwrapper_name;
6461 program_name = (char *) xstrdup (base_name (argv[0]));
6462 newargz = XMALLOC (char *, (size_t) argc + 1);
6464 /* very simple arg parsing; don't want to rely on getopt
6465 * also, copy all non cwrapper options to newargz, except
6466 * argz[0], which is handled differently
6469 for (i = 1; i < argc; i++)
6471 if (STREQ (argv[i], dumpscript_opt))
6475 *mingw* | *cygwin* )
6476 # make stdout use "unix" line endings
6477 echo " setmode(1,_O_BINARY);"
6482 lt_dump_script (stdout);
6485 if (STREQ (argv[i], debug_opt))
6490 if (STREQ (argv[i], ltwrapper_option_prefix))
6492 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
6493 namespace, but it is not one of the ones we know about and
6494 have already dealt with, above (inluding dump-script), then
6495 report an error. Otherwise, targets might begin to believe
6496 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
6497 namespace. The first time any user complains about this, we'll
6498 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
6499 or a configure.ac-settable value.
6501 lt_fatal (__FILE__, __LINE__,
6502 "unrecognized %s option: '%s'",
6503 ltwrapper_option_prefix, argv[i]);
6506 newargz[++newargc] = xstrdup (argv[i]);
6508 newargz[++newargc] = NULL;
6512 /* The GNU banner must be the first non-error debug message */
6513 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
6516 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
6517 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
6519 tmp_pathspec = find_executable (argv[0]);
6520 if (tmp_pathspec == NULL)
6521 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
6522 lt_debugprintf (__FILE__, __LINE__,
6523 "(main) found exe (before symlink chase) at: %s\n",
6526 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
6527 lt_debugprintf (__FILE__, __LINE__,
6528 "(main) found exe (after symlink chase) at: %s\n",
6529 actual_cwrapper_path);
6530 XFREE (tmp_pathspec);
6532 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
6533 strendzap (actual_cwrapper_path, actual_cwrapper_name);
6535 /* wrapper name transforms */
6536 strendzap (actual_cwrapper_name, ".exe");
6537 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
6538 XFREE (actual_cwrapper_name);
6539 actual_cwrapper_name = tmp_pathspec;
6542 /* target_name transforms -- use actual target program name; might have lt- prefix */
6543 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
6544 strendzap (target_name, ".exe");
6545 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
6546 XFREE (target_name);
6547 target_name = tmp_pathspec;
6550 lt_debugprintf (__FILE__, __LINE__,
6551 "(main) libtool target name: %s\n",
6557 XMALLOC (char, (strlen (actual_cwrapper_path) +
6558 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
6559 strcpy (newargz[0], actual_cwrapper_path);
6560 strcat (newargz[0], "$objdir");
6561 strcat (newargz[0], "/");
6565 /* stop here, and copy so we don't have to do this twice */
6566 tmp_pathspec = xstrdup (newargz[0]);
6568 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
6569 strcat (newargz[0], actual_cwrapper_name);
6571 /* DO want the lt- prefix here if it exists, so use target_name */
6572 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
6573 XFREE (tmp_pathspec);
6574 tmp_pathspec = NULL;
6582 while ((p = strchr (newargz[0], '\\')) != NULL)
6586 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
6596 XFREE (target_name);
6597 XFREE (actual_cwrapper_path);
6598 XFREE (actual_cwrapper_name);
6600 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
6601 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
6602 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
6603 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
6604 because on Windows, both *_VARNAMEs are PATH but uninstalled
6605 libraries must come first. */
6606 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
6607 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
6609 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
6610 nonnull (lt_argv_zero));
6611 for (i = 0; i < newargc; i++)
6613 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
6614 i, nonnull (newargz[i]));
6622 /* execv doesn't actually work on mingw as expected on unix */
6623 newargz = prepare_spawn (newargz);
6624 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
6627 /* failed to start process */
6628 lt_debugprintf (__FILE__, __LINE__,
6629 "(main) failed to launch target \"%s\": %s\n",
6630 lt_argv_zero, nonnull (strerror (errno)));
6638 execv (lt_argv_zero, newargz);
6639 return rval; /* =127, but avoids unused variable warning */
6648 xmalloc (size_t num)
6650 void *p = (void *) malloc (num);
6652 lt_fatal (__FILE__, __LINE__, "memory exhausted");
6658 xstrdup (const char *string)
6660 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
6665 base_name (const char *name)
6669 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6670 /* Skip over the disk name in MSDOS pathnames. */
6671 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
6675 for (base = name; *name; name++)
6676 if (IS_DIR_SEPARATOR (*name))
6682 check_executable (const char *path)
6686 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
6688 if ((!path) || (!*path))
6691 if ((stat (path, &st) >= 0)
6692 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
6699 make_executable (const char *path)
6704 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
6706 if ((!path) || (!*path))
6709 if (stat (path, &st) >= 0)
6711 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
6716 /* Searches for the full path of the wrapper. Returns
6717 newly allocated full path name if found, NULL otherwise
6718 Does not chase symlinks, even on platforms that support them.
6721 find_executable (const char *wrapper)
6726 /* static buffer for getcwd */
6727 char tmp[LT_PATHMAX + 1];
6731 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
6732 nonempty (wrapper));
6734 if ((wrapper == NULL) || (*wrapper == '\0'))
6737 /* Absolute path? */
6738 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6739 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
6741 concat_name = xstrdup (wrapper);
6742 if (check_executable (concat_name))
6744 XFREE (concat_name);
6749 if (IS_DIR_SEPARATOR (wrapper[0]))
6751 concat_name = xstrdup (wrapper);
6752 if (check_executable (concat_name))
6754 XFREE (concat_name);
6756 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6760 for (p = wrapper; *p; p++)
6768 /* no slashes; search PATH */
6769 const char *path = getenv ("PATH");
6772 for (p = path; *p; p = p_next)
6776 for (q = p; *q; q++)
6777 if (IS_PATH_SEPARATOR (*q))
6779 p_len = (size_t) (q - p);
6780 p_next = (*q == '\0' ? q : q + 1);
6783 /* empty path: current directory */
6784 if (getcwd (tmp, LT_PATHMAX) == NULL)
6785 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6786 nonnull (strerror (errno)));
6787 tmp_len = strlen (tmp);
6789 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6790 memcpy (concat_name, tmp, tmp_len);
6791 concat_name[tmp_len] = '/';
6792 strcpy (concat_name + tmp_len + 1, wrapper);
6797 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6798 memcpy (concat_name, p, p_len);
6799 concat_name[p_len] = '/';
6800 strcpy (concat_name + p_len + 1, wrapper);
6802 if (check_executable (concat_name))
6804 XFREE (concat_name);
6807 /* not found in PATH; assume curdir */
6809 /* Relative path | not found in path: prepend cwd */
6810 if (getcwd (tmp, LT_PATHMAX) == NULL)
6811 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6812 nonnull (strerror (errno)));
6813 tmp_len = strlen (tmp);
6814 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6815 memcpy (concat_name, tmp, tmp_len);
6816 concat_name[tmp_len] = '/';
6817 strcpy (concat_name + tmp_len + 1, wrapper);
6819 if (check_executable (concat_name))
6821 XFREE (concat_name);
6826 chase_symlinks (const char *pathspec)
6829 return xstrdup (pathspec);
6831 char buf[LT_PATHMAX];
6833 char *tmp_pathspec = xstrdup (pathspec);
6835 int has_symlinks = 0;
6836 while (strlen (tmp_pathspec) && !has_symlinks)
6838 lt_debugprintf (__FILE__, __LINE__,
6839 "checking path component for symlinks: %s\n",
6841 if (lstat (tmp_pathspec, &s) == 0)
6843 if (S_ISLNK (s.st_mode) != 0)
6849 /* search backwards for last DIR_SEPARATOR */
6850 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6851 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6853 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6855 /* no more DIR_SEPARATORS left */
6862 lt_fatal (__FILE__, __LINE__,
6863 "error accessing file \"%s\": %s",
6864 tmp_pathspec, nonnull (strerror (errno)));
6867 XFREE (tmp_pathspec);
6871 return xstrdup (pathspec);
6874 tmp_pathspec = realpath (pathspec, buf);
6875 if (tmp_pathspec == 0)
6877 lt_fatal (__FILE__, __LINE__,
6878 "could not follow symlinks for %s", pathspec);
6880 return xstrdup (tmp_pathspec);
6885 strendzap (char *str, const char *pat)
6889 assert (str != NULL);
6890 assert (pat != NULL);
6893 patlen = strlen (pat);
6897 str += len - patlen;
6898 if (STREQ (str, pat))
6905 lt_debugprintf (const char *file, int line, const char *fmt, ...)
6910 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6911 va_start (args, fmt);
6912 (void) vfprintf (stderr, fmt, args);
6918 lt_error_core (int exit_status, const char *file,
6919 int line, const char *mode,
6920 const char *message, va_list ap)
6922 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6923 vfprintf (stderr, message, ap);
6924 fprintf (stderr, ".\n");
6926 if (exit_status >= 0)
6931 lt_fatal (const char *file, int line, const char *message, ...)
6934 va_start (ap, message);
6935 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6940 nonnull (const char *s)
6942 return s ? s : "(null)";
6946 nonempty (const char *s)
6948 return (s && !*s) ? "(empty)" : nonnull (s);
6952 lt_setenv (const char *name, const char *value)
6954 lt_debugprintf (__FILE__, __LINE__,
6955 "(lt_setenv) setting '%s' to '%s'\n",
6956 nonnull (name), nonnull (value));
6959 /* always make a copy, for consistency with !HAVE_SETENV */
6960 char *str = xstrdup (value);
6961 setenv (name, str, 1);
6963 size_t len = strlen (name) + 1 + strlen (value) + 1;
6964 char *str = XMALLOC (char, len);
6965 sprintf (str, "%s=%s", name, value);
6966 if (putenv (str) != EXIT_SUCCESS)
6975 lt_extend_str (const char *orig_value, const char *add, int to_end)
6978 if (orig_value && *orig_value)
6980 size_t orig_value_len = strlen (orig_value);
6981 size_t add_len = strlen (add);
6982 new_value = XMALLOC (char, add_len + orig_value_len + 1);
6985 strcpy (new_value, orig_value);
6986 strcpy (new_value + orig_value_len, add);
6990 strcpy (new_value, add);
6991 strcpy (new_value + add_len, orig_value);
6996 new_value = xstrdup (add);
7002 lt_update_exe_path (const char *name, const char *value)
7004 lt_debugprintf (__FILE__, __LINE__,
7005 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
7006 nonnull (name), nonnull (value));
7008 if (name && *name && value && *value)
7010 char *new_value = lt_extend_str (getenv (name), value, 0);
7011 /* some systems can't cope with a ':'-terminated path #' */
7012 size_t len = strlen (new_value);
7013 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
7015 new_value[--len] = '\0';
7017 lt_setenv (name, new_value);
7023 lt_update_lib_path (const char *name, const char *value)
7025 lt_debugprintf (__FILE__, __LINE__,
7026 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
7027 nonnull (name), nonnull (value));
7029 if (name && *name && value && *value)
7031 char *new_value = lt_extend_str (getenv (name), value, 0);
7032 lt_setenv (name, new_value);
7042 /* Prepares an argument vector before calling spawn().
7043 Note that spawn() does not by itself call the command interpreter
7044 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
7045 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
7047 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
7048 }) ? "cmd.exe" : "command.com").
7049 Instead it simply concatenates the arguments, separated by ' ', and calls
7050 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
7051 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
7053 - Space and tab are interpreted as delimiters. They are not treated as
7054 delimiters if they are surrounded by double quotes: "...".
7055 - Unescaped double quotes are removed from the input. Their only effect is
7056 that within double quotes, space and tab are treated like normal
7058 - Backslashes not followed by double quotes are not special.
7059 - But 2*n+1 backslashes followed by a double quote become
7060 n backslashes followed by a double quote (n >= 0):
7065 #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"
7066 #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"
7068 prepare_spawn (char **argv)
7074 /* Count number of arguments. */
7075 for (argc = 0; argv[argc] != NULL; argc++)
7078 /* Allocate new argument vector. */
7079 new_argv = XMALLOC (char *, argc + 1);
7081 /* Put quoted arguments into the new argument vector. */
7082 for (i = 0; i < argc; i++)
7084 const char *string = argv[i];
7086 if (string[0] == '\0')
7087 new_argv[i] = xstrdup ("\"\"");
7088 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
7090 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
7092 unsigned int backslashes;
7094 char *quoted_string;
7101 for (s = string; *s != '\0'; s++)
7105 length += backslashes + 1;
7113 length += backslashes + 1;
7115 quoted_string = XMALLOC (char, length + 1);
7121 for (s = string; *s != '\0'; s++)
7127 for (j = backslashes + 1; j > 0; j--)
7139 for (j = backslashes; j > 0; j--)
7145 new_argv[i] = quoted_string;
7148 new_argv[i] = (char *) string;
7150 new_argv[argc] = NULL;
7159 void lt_dump_script (FILE* f)
7162 func_emit_wrapper yes |
7164 s/^\(.\{79\}\)\(..*\)/\1\
7169 s/\([^\n]*\).*/ fputs ("\1", f);/p
7176 # end: func_emit_cwrapperexe_src
7178 # func_win32_import_lib_p ARG
7179 # True if ARG is an import lib, as indicated by $file_magic_cmd
7180 func_win32_import_lib_p ()
7184 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
7190 # func_suncc_cstd_abi
7191 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
7192 # Several compiler flags select an ABI that is incompatible with the
7193 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
7194 func_suncc_cstd_abi ()
7198 case " $compile_command " in
7199 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
7200 suncc_use_cstd_abi=no
7203 suncc_use_cstd_abi=yes
7208 # func_mode_link arg...
7214 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7215 # It is impossible to link a dll without this setting, and
7216 # we shouldn't force the makefile maintainer to figure out
7217 # what system we are compiling for in order to pass an extra
7218 # flag for every libtool invocation.
7219 # allow_undefined=no
7221 # FIXME: Unfortunately, there are problems with the above when trying
7222 # to make a dll that has undefined symbols, in which case not
7223 # even a static library is built. For now, we need to specify
7224 # -no-undefined on the libtool link line when we can be certain
7225 # that all symbols are satisfied, otherwise we get a static library.
7232 libtool_args=$nonopt
7233 base_compile="$nonopt $@"
7234 compile_command=$nonopt
7235 finalize_command=$nonopt
7248 lib_search_path=`pwd`
7250 new_inherited_linker_flags=
7259 export_symbols_regex=
7268 precious_files_regex=
7269 prefer_static_libs=no
7282 single_module=$wl-single_module
7283 func_infer_tag $base_compile
7285 # We need to know -static, to get the right output filenames.
7290 test yes != "$build_libtool_libs" \
7291 && func_fatal_configuration "cannot build a shared library"
7295 -all-static | -static | -static-libtool-libs)
7298 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
7299 func_warning "complete static linking is impossible in this configuration"
7301 if test -n "$link_static_flag"; then
7302 dlopen_self=$dlopen_self_static
7304 prefer_static_libs=yes
7307 if test -z "$pic_flag" && test -n "$link_static_flag"; then
7308 dlopen_self=$dlopen_self_static
7310 prefer_static_libs=built
7312 -static-libtool-libs)
7313 if test -z "$pic_flag" && test -n "$link_static_flag"; then
7314 dlopen_self=$dlopen_self_static
7316 prefer_static_libs=yes
7319 build_libtool_libs=no
7326 # See if our shared archives depend on static archives.
7327 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
7329 # Go through the arguments, transforming them on the way.
7330 while test "$#" -gt 0; do
7333 func_quote_arg pretty,unquoted "$arg"
7334 qarg=$func_quote_arg_unquoted_result
7335 func_append libtool_args " $func_quote_arg_result"
7337 # If the previous option needs an argument, assign it.
7338 if test -n "$prev"; then
7341 func_append compile_command " @OUTPUT@"
7342 func_append finalize_command " @OUTPUT@"
7354 # Add the symbol object into the linking commands.
7355 func_append compile_command " @SYMFILE@"
7356 func_append finalize_command " @SYMFILE@"
7360 *.la | *.lo) ;; # We handle these cases below.
7362 if test no = "$dlself"; then
7370 if test dlprefiles = "$prev"; then
7372 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
7382 if test dlfiles = "$prev"; then
7383 func_append dlfiles " $arg"
7385 func_append dlprefiles " $arg"
7395 || func_fatal_error "symbol file '$arg' does not exist"
7400 export_symbols_regex=$arg
7408 *" $qarg.ltframework "*) ;;
7409 *) func_append deplibs " $qarg.ltframework" # this is fixed later
7418 inst_prefix_dir=$arg
7423 # Clang does not use LLVM to link, so we can simply discard any
7424 # '-mllvm $arg' options when doing the link step.
7429 if test -f "$arg"; then
7432 for fil in `cat "$save_arg"`
7434 # func_append moreargs " $fil"
7436 # A libtool-controlled object.
7438 # Check to see that this really is a libtool object.
7439 if func_lalib_unsafe_p "$arg"; then
7446 if test -z "$pic_object" ||
7447 test -z "$non_pic_object" ||
7448 test none = "$pic_object" &&
7449 test none = "$non_pic_object"; then
7450 func_fatal_error "cannot find name of object for '$arg'"
7453 # Extract subdirectory from the argument.
7454 func_dirname "$arg" "/" ""
7455 xdir=$func_dirname_result
7457 if test none != "$pic_object"; then
7458 # Prepend the subdirectory the object is found in.
7459 pic_object=$xdir$pic_object
7461 if test dlfiles = "$prev"; then
7462 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7463 func_append dlfiles " $pic_object"
7467 # If libtool objects are unsupported, then we need to preload.
7472 # CHECK ME: I think I busted this. -Ossama
7473 if test dlprefiles = "$prev"; then
7474 # Preload the old-style object.
7475 func_append dlprefiles " $pic_object"
7480 func_append libobjs " $pic_object"
7485 if test none != "$non_pic_object"; then
7486 # Prepend the subdirectory the object is found in.
7487 non_pic_object=$xdir$non_pic_object
7489 # A standard non-PIC object
7490 func_append non_pic_objects " $non_pic_object"
7491 if test -z "$pic_object" || test none = "$pic_object"; then
7495 # If the PIC object exists, use it instead.
7496 # $xdir was prepended to $pic_object above.
7497 non_pic_object=$pic_object
7498 func_append non_pic_objects " $non_pic_object"
7501 # Only an error if not doing a dry-run.
7502 if $opt_dry_run; then
7503 # Extract subdirectory from the argument.
7504 func_dirname "$arg" "/" ""
7505 xdir=$func_dirname_result
7508 pic_object=$xdir$objdir/$func_lo2o_result
7509 non_pic_object=$xdir$func_lo2o_result
7510 func_append libobjs " $pic_object"
7511 func_append non_pic_objects " $non_pic_object"
7513 func_fatal_error "'$arg' is not a valid libtool object"
7518 func_fatal_error "link input file '$arg' does not exist"
7530 precious_files_regex=$arg
7540 # We need an absolute path.
7542 [\\/]* | [A-Za-z]:[\\/]*) ;;
7544 func_fatal_error "only absolute run-paths are allowed"
7547 if test rpath = "$prev"; then
7550 *) func_append rpath " $arg" ;;
7555 *) func_append xrpath " $arg" ;;
7567 func_append weak_libs " $arg"
7572 func_append linker_flags " $qarg"
7573 func_append compiler_flags " $qarg"
7575 func_append compile_command " $qarg"
7576 func_append finalize_command " $qarg"
7580 func_append compiler_flags " $qarg"
7582 func_append compile_command " $qarg"
7583 func_append finalize_command " $qarg"
7587 func_append linker_flags " $qarg"
7588 func_append compiler_flags " $wl$qarg"
7590 func_append compile_command " $wl$qarg"
7591 func_append finalize_command " $wl$qarg"
7595 eval "$prev=\"\$arg\""
7600 fi # test -n "$prev"
7606 if test -n "$link_static_flag"; then
7607 # See comment for -static flag below, for more details.
7608 func_append compile_command " $link_static_flag"
7609 func_append finalize_command " $link_static_flag"
7615 # FIXME: remove this flag sometime in the future.
7616 func_fatal_error "'-allow-undefined' must not be used because it is the default"
7644 -export-symbols | -export-symbols-regex)
7645 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
7646 func_fatal_error "more than one -exported-symbols argument is not allowed"
7648 if test X-export-symbols = "X$arg"; then
7666 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
7667 # so, if we see these flags be careful not to treat them like -L
7669 case $with_gcc/$host in
7670 no/*-*-irix* | /*-*-irix*)
7671 func_append compile_command " $arg"
7672 func_append finalize_command " $arg"
7679 func_stripname "-L" '' "$arg"
7680 if test -z "$func_stripname_result"; then
7681 if test "$#" -gt 0; then
7682 func_fatal_error "require no space between '-L' and '$1'"
7684 func_fatal_error "need path for '-L' option"
7687 func_resolve_sysroot "$func_stripname_result"
7688 dir=$func_resolve_sysroot_result
7689 # We need an absolute path.
7691 [\\/]* | [A-Za-z]:[\\/]*) ;;
7693 absdir=`cd "$dir" && pwd`
7694 test -z "$absdir" && \
7695 func_fatal_error "cannot determine absolute directory name of '$dir'"
7700 *" -L$dir "* | *" $arg "*)
7701 # Will only happen for absolute or sysroot arguments
7704 # Preserve sysroot, but never include relative directories
7706 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
7707 *) func_append deplibs " -L$dir" ;;
7709 func_append lib_search_path " $dir"
7713 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7714 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
7715 case :$dllsearchpath: in
7717 ::) dllsearchpath=$dir;;
7718 *) func_append dllsearchpath ":$dir";;
7720 case :$dllsearchpath: in
7721 *":$testbindir:"*) ;;
7722 ::) dllsearchpath=$testbindir;;
7723 *) func_append dllsearchpath ":$testbindir";;
7731 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7733 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7734 # These systems don't actually have a C or math library (as such)
7738 # These systems don't actually have a C library (as such)
7739 test X-lc = "X$arg" && continue
7741 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7742 # Do not include libc due to us having libc/libc_r.
7743 test X-lc = "X$arg" && continue
7745 *-*-rhapsody* | *-*-darwin1.[012])
7746 # Rhapsody C and math libraries are in the System framework
7747 func_append deplibs " System.ltframework"
7750 *-*-sco3.2v5* | *-*-sco5v6*)
7751 # Causes problems with __ctype
7752 test X-lc = "X$arg" && continue
7754 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7755 # Compiler inserts libc in the correct place for threads to work
7756 test X-lc = "X$arg" && continue
7759 elif test X-lc_r = "X$arg"; then
7761 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7762 # Do not include libc_r directly, use -pthread flag.
7767 func_append deplibs " $arg"
7781 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7782 # classes, name mangling, and exception handling.
7783 # Darwin uses the -arch flag to determine output architecture.
7784 -model|-arch|-isysroot|--sysroot)
7785 func_append compiler_flags " $arg"
7786 func_append compile_command " $arg"
7787 func_append finalize_command " $arg"
7792 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7793 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7794 func_append compiler_flags " $arg"
7795 func_append compile_command " $arg"
7796 func_append finalize_command " $arg"
7797 case "$new_inherited_linker_flags " in
7799 * ) func_append new_inherited_linker_flags " $arg" ;;
7805 single_module=$wl-multi_module
7816 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7817 # The PATH hackery in wrapper scripts is required on Windows
7818 # and Darwin in order for the loader to find any dlls it needs.
7819 func_warning "'-no-install' is ignored for $host"
7820 func_warning "assuming '-no-fast-install' instead"
7823 *) no_install=yes ;;
7845 -precious-files-regex)
7866 func_stripname '-R' '' "$arg"
7867 dir=$func_stripname_result
7868 # We need an absolute path.
7870 [\\/]* | [A-Za-z]:[\\/]*) ;;
7872 func_stripname '=' '' "$dir"
7873 dir=$lt_sysroot$func_stripname_result
7876 func_fatal_error "only absolute run-paths are allowed"
7881 *) func_append xrpath " $dir" ;;
7887 # The effects of -shared are defined in a previous loop.
7896 -static | -static-libtool-libs)
7897 # The effects of -static are defined in a previous loop.
7898 # We used to do the same as -all-static on platforms that
7899 # didn't have a PIC flag, but the assumption that the effects
7900 # would be equivalent was wrong. It would break on at least
7901 # Digital Unix and AIX.
7927 func_stripname '-Wc,' '' "$arg"
7928 args=$func_stripname_result
7930 save_ifs=$IFS; IFS=,
7931 for flag in $args; do
7933 func_quote_arg pretty "$flag"
7934 func_append arg " $func_quote_arg_result"
7935 func_append compiler_flags " $func_quote_arg_result"
7938 func_stripname ' ' '' "$arg"
7939 arg=$func_stripname_result
7943 func_stripname '-Wl,' '' "$arg"
7944 args=$func_stripname_result
7946 save_ifs=$IFS; IFS=,
7947 for flag in $args; do
7949 func_quote_arg pretty "$flag"
7950 func_append arg " $wl$func_quote_arg_result"
7951 func_append compiler_flags " $wl$func_quote_arg_result"
7952 func_append linker_flags " $func_quote_arg_result"
7955 func_stripname ' ' '' "$arg"
7956 arg=$func_stripname_result
7976 func_quote_arg pretty "$arg"
7977 arg=$func_quote_arg_result
7980 # Flags to be passed through unchanged, with rationale:
7981 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7982 # -r[0-9][0-9]* specify processor for the SGI compiler
7983 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7984 # +DA*, +DD* enable 64-bit mode for the HP compiler
7985 # -q* compiler args for the IBM compiler
7986 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7987 # -F/path path to uninstalled frameworks, gcc on darwin
7988 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7989 # -fstack-protector* stack protector flags for GCC
7990 # @file GCC response files
7991 # -tp=* Portland pgcc target processor selection
7992 # --sysroot=* for sysroot support
7993 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7994 # -specs=* GCC specs files
7995 # -stdlib=* select c++ std lib with clang
7996 # -fsanitize=* Clang/GCC memory and address sanitizer
7997 # -fuse-ld=* Linker select flags for GCC
7998 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7999 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
8000 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
8001 -specs=*|-fsanitize=*|-fuse-ld=*)
8002 func_quote_arg pretty "$arg"
8003 arg=$func_quote_arg_result
8004 func_append compile_command " $arg"
8005 func_append finalize_command " $arg"
8006 func_append compiler_flags " $arg"
8011 if test os2 = "`expr $host : '.*\(os2\)'`"; then
8012 # OS/2 uses -Zxxx to specify OS/2-specific options
8013 compiler_flags="$compiler_flags $arg"
8014 func_append compile_command " $arg"
8015 func_append finalize_command " $arg"
8023 # Otherwise treat like 'Some other compiler flag' below
8024 func_quote_arg pretty "$arg"
8025 arg=$func_quote_arg_result
8029 # Some other compiler flag.
8031 func_quote_arg pretty "$arg"
8032 arg=$func_quote_arg_result
8036 # A standard object.
8037 func_append objs " $arg"
8041 # A libtool-controlled object.
8043 # Check to see that this really is a libtool object.
8044 if func_lalib_unsafe_p "$arg"; then
8051 if test -z "$pic_object" ||
8052 test -z "$non_pic_object" ||
8053 test none = "$pic_object" &&
8054 test none = "$non_pic_object"; then
8055 func_fatal_error "cannot find name of object for '$arg'"
8058 # Extract subdirectory from the argument.
8059 func_dirname "$arg" "/" ""
8060 xdir=$func_dirname_result
8062 test none = "$pic_object" || {
8063 # Prepend the subdirectory the object is found in.
8064 pic_object=$xdir$pic_object
8066 if test dlfiles = "$prev"; then
8067 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
8068 func_append dlfiles " $pic_object"
8072 # If libtool objects are unsupported, then we need to preload.
8077 # CHECK ME: I think I busted this. -Ossama
8078 if test dlprefiles = "$prev"; then
8079 # Preload the old-style object.
8080 func_append dlprefiles " $pic_object"
8085 func_append libobjs " $pic_object"
8090 if test none != "$non_pic_object"; then
8091 # Prepend the subdirectory the object is found in.
8092 non_pic_object=$xdir$non_pic_object
8094 # A standard non-PIC object
8095 func_append non_pic_objects " $non_pic_object"
8096 if test -z "$pic_object" || test none = "$pic_object"; then
8100 # If the PIC object exists, use it instead.
8101 # $xdir was prepended to $pic_object above.
8102 non_pic_object=$pic_object
8103 func_append non_pic_objects " $non_pic_object"
8106 # Only an error if not doing a dry-run.
8107 if $opt_dry_run; then
8108 # Extract subdirectory from the argument.
8109 func_dirname "$arg" "/" ""
8110 xdir=$func_dirname_result
8113 pic_object=$xdir$objdir/$func_lo2o_result
8114 non_pic_object=$xdir$func_lo2o_result
8115 func_append libobjs " $pic_object"
8116 func_append non_pic_objects " $non_pic_object"
8118 func_fatal_error "'$arg' is not a valid libtool object"
8125 func_append deplibs " $arg"
8126 func_append old_deplibs " $arg"
8131 # A libtool-controlled library.
8133 func_resolve_sysroot "$arg"
8134 if test dlfiles = "$prev"; then
8135 # This library was specified with -dlopen.
8136 func_append dlfiles " $func_resolve_sysroot_result"
8138 elif test dlprefiles = "$prev"; then
8139 # The library was specified with -dlpreopen.
8140 func_append dlprefiles " $func_resolve_sysroot_result"
8143 func_append deplibs " $func_resolve_sysroot_result"
8148 # Some other compiler argument.
8150 # Unknown arguments in both finalize_command and compile_command need
8151 # to be aesthetically quoted because they are evaled later.
8152 func_quote_arg pretty "$arg"
8153 arg=$func_quote_arg_result
8157 # Now actually substitute the argument into the commands.
8158 if test -n "$arg"; then
8159 func_append compile_command " $arg"
8160 func_append finalize_command " $arg"
8162 done # argument parsing loop
8164 test -n "$prev" && \
8165 func_fatal_help "the '$prevarg' option requires an argument"
8167 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
8168 eval arg=\"$export_dynamic_flag_spec\"
8169 func_append compile_command " $arg"
8170 func_append finalize_command " $arg"
8174 # calculate the name of the file, without its directory
8175 func_basename "$output"
8176 outputname=$func_basename_result
8177 libobjs_save=$libobjs
8179 if test -n "$shlibpath_var"; then
8180 # get the directories listed in $shlibpath_var
8181 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
8185 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
8186 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
8188 # Definition is injected by LT_CONFIG during libtool generation.
8189 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
8191 func_dirname "$output" "/" ""
8192 output_objdir=$func_dirname_result$objdir
8193 func_to_tool_file "$output_objdir/"
8194 tool_output_objdir=$func_to_tool_file_result
8195 # Create the object directory.
8196 func_mkdir_p "$output_objdir"
8198 # Determine the type of output
8201 func_fatal_help "you must specify an output file"
8203 *.$libext) linkmode=oldlib ;;
8204 *.lo | *.$objext) linkmode=obj ;;
8205 *.la) linkmode=lib ;;
8206 *) linkmode=prog ;; # Anything else should be a program.
8212 # Find all interdependent deplibs by searching for libraries
8213 # that are linked more than once (e.g. -la -lb -la)
8214 for deplib in $deplibs; do
8215 if $opt_preserve_dup_deps; then
8217 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8220 func_append libs " $deplib"
8223 if test lib = "$linkmode"; then
8224 libs="$predeps $libs $compiler_lib_search_path $postdeps"
8226 # Compute libraries that are listed more than once in $predeps
8227 # $postdeps and mark them as special (i.e., whose duplicates are
8228 # not to be eliminated).
8230 if $opt_duplicate_compiler_generated_deps; then
8231 for pre_post_dep in $predeps $postdeps; do
8232 case "$pre_post_deps " in
8233 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
8235 func_append pre_post_deps " $pre_post_dep"
8244 need_relink=no # whether we're linking any uninstalled libtool libraries
8245 notinst_deplibs= # not-installed libtool libraries
8246 notinst_path= # paths that contain not-installed libtool libraries
8250 passes="conv dlpreopen link"
8251 for file in $dlfiles $dlprefiles; do
8255 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
8266 passes="conv scan dlopen dlpreopen link"
8272 for pass in $passes; do
8273 # The preopen pass in lib mode reverses $deplibs; put it back here
8274 # so that -L comes before libs that need it for instance...
8275 if test lib,link = "$linkmode,$pass"; then
8276 ## FIXME: Find the place where the list is rebuilt in the wrong
8277 ## order, and fix it there properly
8279 for deplib in $deplibs; do
8280 tmp_deplibs="$deplib $tmp_deplibs"
8282 deplibs=$tmp_deplibs
8285 if test lib,link = "$linkmode,$pass" ||
8286 test prog,scan = "$linkmode,$pass"; then
8290 if test prog = "$linkmode"; then
8292 dlopen) libs=$dlfiles ;;
8293 dlpreopen) libs=$dlprefiles ;;
8294 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
8297 if test lib,dlpreopen = "$linkmode,$pass"; then
8298 # Collect and forward deplibs of preopened libtool libs
8299 for lib in $dlprefiles; do
8300 # Ignore non-libtool-libs
8302 func_resolve_sysroot "$lib"
8304 *.la) func_source "$func_resolve_sysroot_result" ;;
8307 # Collect preopened libtool deplibs, except any this library
8308 # has declared as weak libs
8309 for deplib in $dependency_libs; do
8310 func_basename "$deplib"
8311 deplib_base=$func_basename_result
8312 case " $weak_libs " in
8313 *" $deplib_base "*) ;;
8314 *) func_append deplibs " $deplib" ;;
8320 if test dlopen = "$pass"; then
8321 # Collect dlpreopened libraries
8322 save_deplibs=$deplibs
8326 for deplib in $libs; do
8330 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
8331 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
8332 if test prog,link = "$linkmode,$pass"; then
8333 compile_deplibs="$deplib $compile_deplibs"
8334 finalize_deplibs="$deplib $finalize_deplibs"
8336 func_append compiler_flags " $deplib"
8337 if test lib = "$linkmode"; then
8338 case "$new_inherited_linker_flags " in
8340 * ) func_append new_inherited_linker_flags " $deplib" ;;
8347 if test lib != "$linkmode" && test prog != "$linkmode"; then
8348 func_warning "'-l' is ignored for archives/objects"
8351 func_stripname '-l' '' "$deplib"
8352 name=$func_stripname_result
8353 if test lib = "$linkmode"; then
8354 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
8356 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
8358 for searchdir in $searchdirs; do
8359 for search_ext in .la $std_shrext .so .a; do
8360 # Search the libtool library
8361 lib=$searchdir/lib$name$search_ext
8362 if test -f "$lib"; then
8363 if test .la = "$search_ext"; then
8373 # deplib is a libtool library
8374 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
8375 # We need to do some special things here, and not later.
8376 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8377 case " $predeps $postdeps " in
8379 if func_lalib_p "$lib"; then
8383 for l in $old_library $library_names; do
8386 if test "X$ll" = "X$old_library"; then # only static version available
8388 func_dirname "$lib" "" "."
8389 ladir=$func_dirname_result
8390 lib=$ladir/$old_library
8391 if test prog,link = "$linkmode,$pass"; then
8392 compile_deplibs="$deplib $compile_deplibs"
8393 finalize_deplibs="$deplib $finalize_deplibs"
8395 deplibs="$deplib $deplibs"
8396 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8406 # deplib doesn't seem to be a libtool library
8407 if test prog,link = "$linkmode,$pass"; then
8408 compile_deplibs="$deplib $compile_deplibs"
8409 finalize_deplibs="$deplib $finalize_deplibs"
8411 deplibs="$deplib $deplibs"
8412 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8418 if test prog,link = "$linkmode,$pass"; then
8419 compile_deplibs="$deplib $compile_deplibs"
8420 finalize_deplibs="$deplib $finalize_deplibs"
8422 deplibs="$deplib $deplibs"
8423 if test lib = "$linkmode"; then
8424 case "$new_inherited_linker_flags " in
8426 * ) func_append new_inherited_linker_flags " $deplib" ;;
8435 deplibs="$deplib $deplibs"
8436 test conv = "$pass" && continue
8437 newdependency_libs="$deplib $newdependency_libs"
8438 func_stripname '-L' '' "$deplib"
8439 func_resolve_sysroot "$func_stripname_result"
8440 func_append newlib_search_path " $func_resolve_sysroot_result"
8443 if test conv = "$pass"; then
8444 deplibs="$deplib $deplibs"
8447 if test scan = "$pass"; then
8448 deplibs="$deplib $deplibs"
8450 compile_deplibs="$deplib $compile_deplibs"
8451 finalize_deplibs="$deplib $finalize_deplibs"
8453 func_stripname '-L' '' "$deplib"
8454 func_resolve_sysroot "$func_stripname_result"
8455 func_append newlib_search_path " $func_resolve_sysroot_result"
8458 func_warning "'-L' is ignored for archives/objects"
8464 if test link = "$pass"; then
8465 func_stripname '-R' '' "$deplib"
8466 func_resolve_sysroot "$func_stripname_result"
8467 dir=$func_resolve_sysroot_result
8468 # Make sure the xrpath contains only unique directories.
8471 *) func_append xrpath " $dir" ;;
8474 deplibs="$deplib $deplibs"
8478 func_resolve_sysroot "$deplib"
8479 lib=$func_resolve_sysroot_result
8482 if test conv = "$pass"; then
8483 deplibs="$deplib $deplibs"
8488 # Linking convenience modules into shared libraries is allowed,
8489 # but linking other static libraries is non-portable.
8490 case " $dlpreconveniencelibs " in
8494 case $deplibs_check_method in
8496 set dummy $deplibs_check_method; shift
8497 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8498 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
8499 | $EGREP "$match_pattern_regex" > /dev/null; then
8507 if $valid_a_lib; then
8509 $ECHO "*** Warning: Linking the shared library $output against the"
8510 $ECHO "*** static library $deplib is not portable!"
8511 deplibs="$deplib $deplibs"
8514 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
8515 echo "*** I have the capability to make that library automatically link in when"
8516 echo "*** you link to this library. But I can only do this if you have a"
8517 echo "*** shared version of the library, which you do not appear to have"
8518 echo "*** because the file extensions .$libext of this argument makes me believe"
8519 echo "*** that it is just a static archive that I should not use here."
8526 if test link != "$pass"; then
8527 deplibs="$deplib $deplibs"
8529 compile_deplibs="$deplib $compile_deplibs"
8530 finalize_deplibs="$deplib $finalize_deplibs"
8537 if test conv = "$pass"; then
8538 deplibs="$deplib $deplibs"
8539 elif test prog = "$linkmode"; then
8540 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
8541 # If there is no dlopen support or we're linking statically,
8542 # we need to preload.
8543 func_append newdlprefiles " $deplib"
8544 compile_deplibs="$deplib $compile_deplibs"
8545 finalize_deplibs="$deplib $finalize_deplibs"
8547 func_append newdlfiles " $deplib"
8558 $found || test -f "$lib" \
8559 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
8561 # Check to see that this really is a libtool archive.
8562 func_lalib_unsafe_p "$lib" \
8563 || func_fatal_error "'$lib' is not a valid libtool archive"
8565 func_dirname "$lib" "" "."
8566 ladir=$func_dirname_result
8574 inherited_linker_flags=
8575 # If the library was installed with an old release of libtool,
8576 # it will not redefine variables installed, or shouldnotlink
8585 # Convert "-framework foo" to "foo.ltframework"
8586 if test -n "$inherited_linker_flags"; then
8587 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
8588 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
8589 case " $new_inherited_linker_flags " in
8590 *" $tmp_inherited_linker_flag "*) ;;
8591 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
8595 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8596 if test lib,link = "$linkmode,$pass" ||
8597 test prog,scan = "$linkmode,$pass" ||
8598 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
8599 test -n "$dlopen" && func_append dlfiles " $dlopen"
8600 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
8603 if test conv = "$pass"; then
8604 # Only check for convenience libraries
8605 deplibs="$lib $deplibs"
8606 if test -z "$libdir"; then
8607 if test -z "$old_library"; then
8608 func_fatal_error "cannot find name of link library for '$lib'"
8610 # It is a libtool convenience library, so add in its objects.
8611 func_append convenience " $ladir/$objdir/$old_library"
8612 func_append old_convenience " $ladir/$objdir/$old_library"
8613 elif test prog != "$linkmode" && test lib != "$linkmode"; then
8614 func_fatal_error "'$lib' is not a convenience library"
8617 for deplib in $dependency_libs; do
8618 deplibs="$deplib $deplibs"
8619 if $opt_preserve_dup_deps; then
8620 case "$tmp_libs " in
8621 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8624 func_append tmp_libs " $deplib"
8630 # Get the name of the library we link against.
8632 if test -n "$old_library" &&
8633 { test yes = "$prefer_static_libs" ||
8634 test built,no = "$prefer_static_libs,$installed"; }; then
8635 linklib=$old_library
8637 for l in $old_library $library_names; do
8641 if test -z "$linklib"; then
8642 func_fatal_error "cannot find name of link library for '$lib'"
8645 # This library was specified with -dlopen.
8646 if test dlopen = "$pass"; then
8648 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8649 if test -z "$dlname" ||
8650 test yes != "$dlopen_support" ||
8651 test no = "$build_libtool_libs"
8653 # If there is no dlname, no dlopen support or we're linking
8654 # statically, we need to preload. We also need to preload any
8655 # dependent libraries so libltdl's deplib preloader doesn't
8656 # bomb out in the load deplibs phase.
8657 func_append dlprefiles " $lib $dependency_libs"
8659 func_append newdlfiles " $lib"
8664 # We need an absolute path.
8666 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8668 abs_ladir=`cd "$ladir" && pwd`
8669 if test -z "$abs_ladir"; then
8670 func_warning "cannot determine absolute directory name of '$ladir'"
8671 func_warning "passing it literally to the linker, although it might fail"
8676 func_basename "$lib"
8677 laname=$func_basename_result
8679 # Find the relevant object directory and library name.
8680 if test yes = "$installed"; then
8681 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8682 func_warning "library '$lib' was moved."
8687 dir=$lt_sysroot$libdir
8688 absdir=$lt_sysroot$libdir
8690 test yes = "$hardcode_automatic" && avoidtemprpath=yes
8692 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8695 # Remove this search path later
8696 func_append notinst_path " $abs_ladir"
8699 absdir=$abs_ladir/$objdir
8700 # Remove this search path later
8701 func_append notinst_path " $abs_ladir"
8703 fi # $installed = yes
8704 func_stripname 'lib' '.la' "$laname"
8705 name=$func_stripname_result
8707 # This library was specified with -dlpreopen.
8708 if test dlpreopen = "$pass"; then
8709 if test -z "$libdir" && test prog = "$linkmode"; then
8710 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8713 # special handling for platforms with PE-DLLs.
8714 *cygwin* | *mingw* | *cegcc* )
8715 # Linker will automatically link against shared library if both
8716 # static and shared are present. Therefore, ensure we extract
8717 # symbols from the import library if a shared library is present
8718 # (otherwise, the dlopen module name will be incorrect). We do
8719 # this by putting the import library name into $newdlprefiles.
8720 # We recover the dlopen module name by 'saving' the la file
8721 # name in a special purpose variable, and (later) extracting the
8722 # dlname from the la file.
8723 if test -n "$dlname"; then
8724 func_tr_sh "$dir/$linklib"
8725 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8726 func_append newdlprefiles " $dir/$linklib"
8728 func_append newdlprefiles " $dir/$old_library"
8729 # Keep a list of preopened convenience libraries to check
8730 # that they are being used correctly in the link pass.
8731 test -z "$libdir" && \
8732 func_append dlpreconveniencelibs " $dir/$old_library"
8736 # Prefer using a static library (so that no silly _DYNAMIC symbols
8737 # are required to link).
8738 if test -n "$old_library"; then
8739 func_append newdlprefiles " $dir/$old_library"
8740 # Keep a list of preopened convenience libraries to check
8741 # that they are being used correctly in the link pass.
8742 test -z "$libdir" && \
8743 func_append dlpreconveniencelibs " $dir/$old_library"
8744 # Otherwise, use the dlname, so that lt_dlopen finds it.
8745 elif test -n "$dlname"; then
8746 func_append newdlprefiles " $dir/$dlname"
8748 func_append newdlprefiles " $dir/$linklib"
8752 fi # $pass = dlpreopen
8754 if test -z "$libdir"; then
8755 # Link the convenience library
8756 if test lib = "$linkmode"; then
8757 deplibs="$dir/$old_library $deplibs"
8758 elif test prog,link = "$linkmode,$pass"; then
8759 compile_deplibs="$dir/$old_library $compile_deplibs"
8760 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8762 deplibs="$lib $deplibs" # used for prog,scan pass
8768 if test prog = "$linkmode" && test link != "$pass"; then
8769 func_append newlib_search_path " $ladir"
8770 deplibs="$lib $deplibs"
8772 linkalldeplibs=false
8773 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8774 test no = "$build_libtool_libs"; then
8779 for deplib in $dependency_libs; do
8781 -L*) func_stripname '-L' '' "$deplib"
8782 func_resolve_sysroot "$func_stripname_result"
8783 func_append newlib_search_path " $func_resolve_sysroot_result"
8786 # Need to link against all dependency_libs?
8787 if $linkalldeplibs; then
8788 deplibs="$deplib $deplibs"
8790 # Need to hardcode shared library paths
8791 # or/and link against static libraries
8792 newdependency_libs="$deplib $newdependency_libs"
8794 if $opt_preserve_dup_deps; then
8795 case "$tmp_libs " in
8796 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8799 func_append tmp_libs " $deplib"
8802 fi # $linkmode = prog...
8804 if test prog,link = "$linkmode,$pass"; then
8805 if test -n "$library_names" &&
8806 { { test no = "$prefer_static_libs" ||
8807 test built,yes = "$prefer_static_libs,$installed"; } ||
8808 test -z "$old_library"; }; then
8809 # We need to hardcode the library path
8810 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8811 # Make sure the rpath contains only unique directories.
8812 case $temp_rpath: in
8814 *) func_append temp_rpath "$absdir:" ;;
8818 # Hardcode the library path.
8819 # Skip directories that are in the system default run-time
8821 case " $sys_lib_dlsearch_path " in
8824 case "$compile_rpath " in
8826 *) func_append compile_rpath " $absdir" ;;
8830 case " $sys_lib_dlsearch_path " in
8833 case "$finalize_rpath " in
8835 *) func_append finalize_rpath " $libdir" ;;
8839 fi # $linkmode,$pass = prog,link...
8842 { test pass_all = "$deplibs_check_method" ||
8843 { test yes = "$build_libtool_libs" &&
8844 test -n "$library_names"; }; }; then
8845 # We only need to search for static libraries
8850 link_static=no # Whether the deplib will be linked statically
8851 use_static_libs=$prefer_static_libs
8852 if test built = "$use_static_libs" && test yes = "$installed"; then
8855 if test -n "$library_names" &&
8856 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8858 *cygwin* | *mingw* | *cegcc* | *os2*)
8859 # No point in relinking DLLs because paths are not encoded
8860 func_append notinst_deplibs " $lib"
8864 if test no = "$installed"; then
8865 func_append notinst_deplibs " $lib"
8870 # This is a shared library
8872 # Warn about portability, can't link against -module's on some
8873 # systems (darwin). Don't bleat about dlopened modules though!
8875 for dlpremoduletest in $dlprefiles; do
8876 if test "X$dlpremoduletest" = "X$lib"; then
8877 dlopenmodule=$dlpremoduletest
8881 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8883 if test prog = "$linkmode"; then
8884 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8886 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8888 $ECHO "*** $linklib is not portable!"
8890 if test lib = "$linkmode" &&
8891 test yes = "$hardcode_into_libs"; then
8892 # Hardcode the library path.
8893 # Skip directories that are in the system default run-time
8895 case " $sys_lib_dlsearch_path " in
8898 case "$compile_rpath " in
8900 *) func_append compile_rpath " $absdir" ;;
8904 case " $sys_lib_dlsearch_path " in
8907 case "$finalize_rpath " in
8909 *) func_append finalize_rpath " $libdir" ;;
8915 if test -n "$old_archive_from_expsyms_cmds"; then
8916 # figure out the soname
8917 set dummy $library_names
8921 libname=`eval "\\$ECHO \"$libname_spec\""`
8922 # use dlname if we got it. it's perfectly good, no?
8923 if test -n "$dlname"; then
8925 elif test -n "$soname_spec"; then
8928 *cygwin* | mingw* | *cegcc* | *os2*)
8929 func_arith $current - $age
8930 major=$func_arith_result
8934 eval soname=\"$soname_spec\"
8939 # Make a new name for the extract_expsyms_cmds to use
8941 func_basename "$soroot"
8942 soname=$func_basename_result
8943 func_stripname 'lib' '.dll' "$soname"
8944 newlib=libimp-$func_stripname_result.a
8946 # If the library has no export list, then create one now
8947 if test -f "$output_objdir/$soname-def"; then :
8949 func_verbose "extracting exported symbol list from '$soname'"
8950 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8954 if test -f "$output_objdir/$newlib"; then :; else
8955 func_verbose "generating import library for '$soname'"
8956 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8958 # make sure the library variables are pointing to the new library
8961 fi # test -n "$old_archive_from_expsyms_cmds"
8963 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8968 case $hardcode_action in
8969 immediate | unsupported)
8970 if test no = "$hardcode_direct"; then
8973 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8974 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8975 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8976 *-*-unixware7*) add_dir=-L$dir ;;
8978 # if the lib is a (non-dlopened) module then we cannot
8979 # link against it, someone is ignoring the earlier warnings
8980 if /usr/bin/file -L $add 2> /dev/null |
8981 $GREP ": [^:]* bundle" >/dev/null; then
8982 if test "X$dlopenmodule" != "X$lib"; then
8983 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8984 if test -z "$old_library"; then
8986 echo "*** And there doesn't seem to be a static archive available"
8987 echo "*** The link will probably fail, sorry"
8989 add=$dir/$old_library
8991 elif test -n "$old_library"; then
8992 add=$dir/$old_library
8996 elif test no = "$hardcode_minus_L"; then
8998 *-*-sunos*) add_shlibpath=$dir ;;
9002 elif test no = "$hardcode_shlibpath_var"; then
9010 if test yes = "$hardcode_direct" &&
9011 test no = "$hardcode_direct_absolute"; then
9013 elif test yes = "$hardcode_minus_L"; then
9015 # Try looking first in the location we're being installed to.
9016 if test -n "$inst_prefix_dir"; then
9019 func_append add_dir " -L$inst_prefix_dir$libdir"
9024 elif test yes = "$hardcode_shlibpath_var"; then
9034 if test yes != "$lib_linked"; then
9035 func_fatal_configuration "unsupported hardcode properties"
9038 if test -n "$add_shlibpath"; then
9039 case :$compile_shlibpath: in
9040 *":$add_shlibpath:"*) ;;
9041 *) func_append compile_shlibpath "$add_shlibpath:" ;;
9044 if test prog = "$linkmode"; then
9045 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
9046 test -n "$add" && compile_deplibs="$add $compile_deplibs"
9048 test -n "$add_dir" && deplibs="$add_dir $deplibs"
9049 test -n "$add" && deplibs="$add $deplibs"
9050 if test yes != "$hardcode_direct" &&
9051 test yes != "$hardcode_minus_L" &&
9052 test yes = "$hardcode_shlibpath_var"; then
9053 case :$finalize_shlibpath: in
9055 *) func_append finalize_shlibpath "$libdir:" ;;
9061 if test prog = "$linkmode" || test relink = "$opt_mode"; then
9065 # Finalize command for both is simple: just hardcode it.
9066 if test yes = "$hardcode_direct" &&
9067 test no = "$hardcode_direct_absolute"; then
9068 add=$libdir/$linklib
9069 elif test yes = "$hardcode_minus_L"; then
9072 elif test yes = "$hardcode_shlibpath_var"; then
9073 case :$finalize_shlibpath: in
9075 *) func_append finalize_shlibpath "$libdir:" ;;
9078 elif test yes = "$hardcode_automatic"; then
9079 if test -n "$inst_prefix_dir" &&
9080 test -f "$inst_prefix_dir$libdir/$linklib"; then
9081 add=$inst_prefix_dir$libdir/$linklib
9083 add=$libdir/$linklib
9086 # We cannot seem to hardcode it, guess we'll fake it.
9088 # Try looking first in the location we're being installed to.
9089 if test -n "$inst_prefix_dir"; then
9092 func_append add_dir " -L$inst_prefix_dir$libdir"
9099 if test prog = "$linkmode"; then
9100 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
9101 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
9103 test -n "$add_dir" && deplibs="$add_dir $deplibs"
9104 test -n "$add" && deplibs="$add $deplibs"
9107 elif test prog = "$linkmode"; then
9108 # Here we assume that one of hardcode_direct or hardcode_minus_L
9109 # is not unsupported. This is valid on all known static and
9111 if test unsupported != "$hardcode_direct"; then
9112 test -n "$old_library" && linklib=$old_library
9113 compile_deplibs="$dir/$linklib $compile_deplibs"
9114 finalize_deplibs="$dir/$linklib $finalize_deplibs"
9116 compile_deplibs="-l$name -L$dir $compile_deplibs"
9117 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
9119 elif test yes = "$build_libtool_libs"; then
9120 # Not a shared library
9121 if test pass_all != "$deplibs_check_method"; then
9122 # We're trying link a shared library against a static one
9123 # but the system doesn't support it.
9125 # Just print a warning and add the library to dependency_libs so
9126 # that the program can be linked against the static library.
9128 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
9129 echo "*** I have the capability to make that library automatically link in when"
9130 echo "*** you link to this library. But I can only do this if you have a"
9131 echo "*** shared version of the library, which you do not appear to have."
9132 if test yes = "$module"; then
9133 echo "*** But as you try to build a module library, libtool will still create "
9134 echo "*** a static module, that should work as long as the dlopening application"
9135 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
9136 if test -z "$global_symbol_pipe"; then
9138 echo "*** However, this would only work if libtool was able to extract symbol"
9139 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9140 echo "*** not find such a program. So, this module is probably useless."
9141 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9143 if test no = "$build_old_libs"; then
9144 build_libtool_libs=module
9147 build_libtool_libs=no
9151 deplibs="$dir/$old_library $deplibs"
9154 fi # link shared/static library?
9156 if test lib = "$linkmode"; then
9157 if test -n "$dependency_libs" &&
9158 { test yes != "$hardcode_into_libs" ||
9159 test yes = "$build_old_libs" ||
9160 test yes = "$link_static"; }; then
9161 # Extract -R from dependency_libs
9163 for libdir in $dependency_libs; do
9165 -R*) func_stripname '-R' '' "$libdir"
9166 temp_xrpath=$func_stripname_result
9168 *" $temp_xrpath "*) ;;
9169 *) func_append xrpath " $temp_xrpath";;
9171 *) func_append temp_deplibs " $libdir";;
9174 dependency_libs=$temp_deplibs
9177 func_append newlib_search_path " $absdir"
9178 # Link against this library
9179 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
9180 # ... and its dependency_libs
9182 for deplib in $dependency_libs; do
9183 newdependency_libs="$deplib $newdependency_libs"
9185 -L*) func_stripname '-L' '' "$deplib"
9186 func_resolve_sysroot "$func_stripname_result";;
9187 *) func_resolve_sysroot "$deplib" ;;
9189 if $opt_preserve_dup_deps; then
9190 case "$tmp_libs " in
9191 *" $func_resolve_sysroot_result "*)
9192 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
9195 func_append tmp_libs " $func_resolve_sysroot_result"
9198 if test no != "$link_all_deplibs"; then
9199 # Add the search paths of all dependency libraries
9200 for deplib in $dependency_libs; do
9203 -L*) path=$deplib ;;
9205 func_resolve_sysroot "$deplib"
9206 deplib=$func_resolve_sysroot_result
9207 func_dirname "$deplib" "" "."
9208 dir=$func_dirname_result
9209 # We need an absolute path.
9211 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
9213 absdir=`cd "$dir" && pwd`
9214 if test -z "$absdir"; then
9215 func_warning "cannot determine absolute directory name of '$dir'"
9220 if $GREP "^installed=no" $deplib > /dev/null; then
9224 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
9225 if test -n "$deplibrary_names"; then
9226 for tmp in $deplibrary_names; do
9229 if test -f "$absdir/$objdir/$depdepl"; then
9230 depdepl=$absdir/$objdir/$depdepl
9231 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9232 if test -z "$darwin_install_name"; then
9233 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9235 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
9236 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
9242 path=-L$absdir/$objdir
9246 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
9247 test -z "$libdir" && \
9248 func_fatal_error "'$deplib' is not a valid libtool archive"
9249 test "$absdir" != "$libdir" && \
9250 func_warning "'$deplib' seems to be moved"
9256 case " $deplibs " in
9258 *) deplibs="$path $deplibs" ;;
9261 fi # link_all_deplibs != no
9263 done # for deplib in $libs
9264 if test link = "$pass"; then
9265 if test prog = "$linkmode"; then
9266 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
9267 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
9269 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9272 dependency_libs=$newdependency_libs
9273 if test dlpreopen = "$pass"; then
9274 # Link the dlpreopened libraries before other libraries
9275 for deplib in $save_deplibs; do
9276 deplibs="$deplib $deplibs"
9279 if test dlopen != "$pass"; then
9280 test conv = "$pass" || {
9281 # Make sure lib_search_path contains only unique directories.
9283 for dir in $newlib_search_path; do
9284 case "$lib_search_path " in
9286 *) func_append lib_search_path " $dir" ;;
9292 if test prog,link = "$linkmode,$pass"; then
9293 vars="compile_deplibs finalize_deplibs"
9297 for var in $vars dependency_libs; do
9298 # Add libraries to $var in reverse order
9299 eval tmp_libs=\"\$$var\"
9301 for deplib in $tmp_libs; do
9302 # FIXME: Pedantically, this is the right thing to do, so
9303 # that some nasty dependency loop isn't accidentally
9305 #new_libs="$deplib $new_libs"
9306 # Pragmatically, this seems to cause very few problems in
9309 -L*) new_libs="$deplib $new_libs" ;;
9312 # And here is the reason: when a library appears more
9313 # than once as an explicit dependence of a library, or
9314 # is implicitly linked in more than once by the
9315 # compiler, it is considered special, and multiple
9316 # occurrences thereof are not removed. Compare this
9317 # with having the same library being listed as a
9318 # dependency of multiple other libraries: in this case,
9319 # we know (pedantically, we assume) the library does not
9320 # need to be listed more than once, so we keep only the
9321 # last copy. This is not always right, but it is rare
9322 # enough that we require users that really mean to play
9323 # such unportable linking tricks to link the library
9324 # using -Wl,-lname, so that libtool does not consider it
9325 # for duplicate removal.
9326 case " $specialdeplibs " in
9327 *" $deplib "*) new_libs="$deplib $new_libs" ;;
9329 case " $new_libs " in
9331 *) new_libs="$deplib $new_libs" ;;
9339 for deplib in $new_libs; do
9342 case " $tmp_libs " in
9344 *) func_append tmp_libs " $deplib" ;;
9347 *) func_append tmp_libs " $deplib" ;;
9350 eval $var=\"$tmp_libs\"
9354 # Add Sun CC postdeps if required:
9355 test CXX = "$tagname" && {
9358 case `$CC -V 2>&1 | sed 5q` in
9359 *Sun\ C*) # Sun C++ 5.9
9362 if test no != "$suncc_use_cstd_abi"; then
9363 func_append postdeps ' -library=Cstd -library=Crun'
9370 func_cc_basename "$CC"
9371 case $func_cc_basename_result in
9375 if test no != "$suncc_use_cstd_abi"; then
9376 func_append postdeps ' -library=Cstd -library=Crun'
9384 # Last step: remove runtime libs from dependency_libs
9385 # (they stay in deplibs)
9387 for i in $dependency_libs; do
9388 case " $predeps $postdeps $compiler_lib_search_path " in
9393 if test -n "$i"; then
9394 func_append tmp_libs " $i"
9397 dependency_libs=$tmp_libs
9399 if test prog = "$linkmode"; then
9402 if test prog = "$linkmode" || test lib = "$linkmode"; then
9403 dlprefiles=$newdlprefiles
9408 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
9409 func_warning "'-dlopen' is ignored for archives"
9414 func_warning "'-l' and '-L' are ignored for archives" ;;
9417 test -n "$rpath" && \
9418 func_warning "'-rpath' is ignored for archives"
9420 test -n "$xrpath" && \
9421 func_warning "'-R' is ignored for archives"
9423 test -n "$vinfo" && \
9424 func_warning "'-version-info/-version-number' is ignored for archives"
9426 test -n "$release" && \
9427 func_warning "'-release' is ignored for archives"
9429 test -n "$export_symbols$export_symbols_regex" && \
9430 func_warning "'-export-symbols' is ignored for archives"
9432 # Now set the variables for building old libraries.
9433 build_libtool_libs=no
9435 func_append objs "$old_deplibs"
9439 # Make sure we only generate libraries of the form 'libNAME.la'.
9442 func_stripname 'lib' '.la' "$outputname"
9443 name=$func_stripname_result
9444 eval shared_ext=\"$shrext_cmds\"
9445 eval libname=\"$libname_spec\"
9448 test no = "$module" \
9449 && func_fatal_help "libtool library '$output' must begin with 'lib'"
9451 if test no != "$need_lib_prefix"; then
9452 # Add the "lib" prefix for modules if required
9453 func_stripname '' '.la' "$outputname"
9454 name=$func_stripname_result
9455 eval shared_ext=\"$shrext_cmds\"
9456 eval libname=\"$libname_spec\"
9458 func_stripname '' '.la' "$outputname"
9459 libname=$func_stripname_result
9464 if test -n "$objs"; then
9465 if test pass_all != "$deplibs_check_method"; then
9466 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
9469 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
9470 $ECHO "*** objects $objs is not portable!"
9471 func_append libobjs " $objs"
9475 test no = "$dlself" \
9476 || func_warning "'-dlopen self' is ignored for libtool libraries"
9481 && func_warning "ignoring multiple '-rpath's for a libtool library"
9486 if test -z "$rpath"; then
9487 if test yes = "$build_libtool_libs"; then
9488 # Building a libtool convenience library.
9489 # Some compilers have problems with a '.al' extension so
9490 # convenience libraries should have the same extension an
9491 # archive normally would.
9492 oldlibs="$output_objdir/$libname.$libext $oldlibs"
9493 build_libtool_libs=convenience
9497 test -n "$vinfo" && \
9498 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
9500 test -n "$release" && \
9501 func_warning "'-release' is ignored for convenience libraries"
9504 # Parse the version information argument.
9505 save_ifs=$IFS; IFS=:
9506 set dummy $vinfo 0 0 0
9511 func_fatal_help "too many parameters to '-version-info'"
9513 # convert absolute version numbers to libtool ages
9514 # this retains compatibility with .la files and attempts
9515 # to make the code below a bit more comprehensible
9517 case $vinfo_number in
9523 # There are really only two kinds -- those that
9524 # use the current revision as the major version
9525 # and those that subtract age and use age as
9526 # a minor version. But, then there is irix
9527 # that has an extra 1 added just for fun
9529 case $version_type in
9530 # correct linux to gnu/linux during the next big refactor
9531 darwin|freebsd-elf|linux|osf|windows|none)
9532 func_arith $number_major + $number_minor
9533 current=$func_arith_result
9535 revision=$number_revision
9537 freebsd-aout|qnx|sunos)
9538 current=$number_major
9539 revision=$number_minor
9543 func_arith $number_major + $number_minor
9544 current=$func_arith_result
9546 revision=$number_minor
9547 lt_irix_increment=no
9558 # Check that each of the things are valid numbers.
9560 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]) ;;
9562 func_error "CURRENT '$current' must be a nonnegative integer"
9563 func_fatal_error "'$vinfo' is not valid version information"
9568 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]) ;;
9570 func_error "REVISION '$revision' must be a nonnegative integer"
9571 func_fatal_error "'$vinfo' is not valid version information"
9576 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]) ;;
9578 func_error "AGE '$age' must be a nonnegative integer"
9579 func_fatal_error "'$vinfo' is not valid version information"
9583 if test "$age" -gt "$current"; then
9584 func_error "AGE '$age' is greater than the current interface number '$current'"
9585 func_fatal_error "'$vinfo' is not valid version information"
9588 # Calculate the version variables.
9592 case $version_type in
9596 # Like Linux, but with the current version available in
9597 # verstring for coding it into the library header
9598 func_arith $current - $age
9599 major=.$func_arith_result
9600 versuffix=$major.$age.$revision
9601 # Darwin ld doesn't like 0 for these options...
9602 func_arith $current + 1
9603 minor_current=$func_arith_result
9604 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9605 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9606 # On Darwin other compilers
9609 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9612 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9619 versuffix=.$current.$revision
9623 func_arith $current - $age
9624 major=.$func_arith_result
9625 versuffix=$major.$age.$revision
9629 if test no = "$lt_irix_increment"; then
9630 func_arith $current - $age
9632 func_arith $current - $age + 1
9634 major=$func_arith_result
9636 case $version_type in
9637 nonstopux) verstring_prefix=nonstopux ;;
9638 *) verstring_prefix=sgi ;;
9640 verstring=$verstring_prefix$major.$revision
9642 # Add in all the interfaces that we are compatible with.
9644 while test 0 -ne "$loop"; do
9645 func_arith $revision - $loop
9646 iface=$func_arith_result
9647 func_arith $loop - 1
9648 loop=$func_arith_result
9649 verstring=$verstring_prefix$major.$iface:$verstring
9652 # Before this point, $major must not contain '.'.
9654 versuffix=$major.$revision
9657 linux) # correct to gnu/linux during the next big refactor
9658 func_arith $current - $age
9659 major=.$func_arith_result
9660 versuffix=$major.$age.$revision
9664 func_arith $current - $age
9665 major=.$func_arith_result
9666 versuffix=.$current.$age.$revision
9667 verstring=$current.$age.$revision
9669 # Add in all the interfaces that we are compatible with.
9671 while test 0 -ne "$loop"; do
9672 func_arith $current - $loop
9673 iface=$func_arith_result
9674 func_arith $loop - 1
9675 loop=$func_arith_result
9676 verstring=$verstring:$iface.0
9679 # Make executables depend on our current version.
9680 func_append verstring ":$current.0"
9695 versuffix=.$current.$revision
9699 # Use '-' rather than '.', since we only want one
9700 # extension on DOS 8.3 file systems.
9701 func_arith $current - $age
9702 major=$func_arith_result
9707 func_fatal_configuration "unknown library version type '$version_type'"
9711 # Clear the version info if we defaulted, and they specified a release.
9712 if test -z "$vinfo" && test -n "$release"; then
9714 case $version_type in
9716 # we can't check for "0.0" in archive_cmds due to quoting
9717 # problems, so we reset it completely
9724 if test no = "$need_version"; then
9731 # Remove version info from name if versioning should be avoided
9732 if test yes,no = "$avoid_version,$need_version"; then
9738 # Check to see if the archive will have undefined symbols.
9739 if test yes = "$allow_undefined"; then
9740 if test unsupported = "$allow_undefined_flag"; then
9741 if test yes = "$build_old_libs"; then
9742 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9743 build_libtool_libs=no
9745 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9749 # Don't allow undefined symbols.
9750 allow_undefined_flag=$no_undefined_flag
9755 func_generate_dlsyms "$libname" "$libname" :
9756 func_append libobjs " $symfileobj"
9757 test " " = "$libobjs" && libobjs=
9759 if test relink != "$opt_mode"; then
9760 # Remove our outputs, but don't remove object files since they
9761 # may have been created when compiling PIC objects.
9763 tempremovelist=`$ECHO "$output_objdir/*"`
9764 for p in $tempremovelist; do
9768 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9769 if test -n "$precious_files_regex"; then
9770 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9775 func_append removelist " $p"
9780 test -n "$removelist" && \
9781 func_show_eval "${RM}r \$removelist"
9784 # Now set the variables for building old libraries.
9785 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9786 func_append oldlibs " $output_objdir/$libname.$libext"
9788 # Transform .lo files to .o files.
9789 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9792 # Eliminate all temporary directories.
9793 #for path in $notinst_path; do
9794 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9795 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9796 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9799 if test -n "$xrpath"; then
9800 # If the user specified any rpath flags, then add them.
9802 for libdir in $xrpath; do
9803 func_replace_sysroot "$libdir"
9804 func_append temp_xrpath " -R$func_replace_sysroot_result"
9805 case "$finalize_rpath " in
9807 *) func_append finalize_rpath " $libdir" ;;
9810 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9811 dependency_libs="$temp_xrpath $dependency_libs"
9815 # Make sure dlfiles contains only unique files that won't be dlpreopened
9816 old_dlfiles=$dlfiles
9818 for lib in $old_dlfiles; do
9819 case " $dlprefiles $dlfiles " in
9821 *) func_append dlfiles " $lib" ;;
9825 # Make sure dlprefiles contains only unique files
9826 old_dlprefiles=$dlprefiles
9828 for lib in $old_dlprefiles; do
9829 case "$dlprefiles " in
9831 *) func_append dlprefiles " $lib" ;;
9835 if test yes = "$build_libtool_libs"; then
9836 if test -n "$rpath"; then
9838 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9839 # these systems don't actually have a c library (as such)!
9841 *-*-rhapsody* | *-*-darwin1.[012])
9842 # Rhapsody C library is in the System framework
9843 func_append deplibs " System.ltframework"
9846 # Don't link with libc until the a.out ld.so is fixed.
9848 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9849 # Do not include libc due to us having libc/libc_r.
9851 *-*-sco3.2v5* | *-*-sco5v6*)
9852 # Causes problems with __ctype
9854 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9855 # Compiler inserts libc in the correct place for threads to work
9858 # Add libc to deplibs on all other systems if necessary.
9859 if test yes = "$build_libtool_need_lc"; then
9860 func_append deplibs " -lc"
9866 # Transform deplibs into only deplibs that can be linked in shared.
9868 libname_save=$libname
9869 release_save=$release
9870 versuffix_save=$versuffix
9872 # I'm not sure if I'm treating the release correctly. I think
9873 # release should show up in the -l (ie -lgmp5) so we don't want to
9874 # add it in twice. Is that correct?
9880 case $deplibs_check_method in
9882 # Don't check for shared/static. Everything works.
9883 # This might be a little naive. We might want to check
9884 # whether the library exists or not. But this is on
9885 # osf3 & osf4 and I'm not really sure... Just
9886 # implementing what was already the behavior.
9890 # This code stresses the "libraries are programs" paradigm to its
9891 # limits. Maybe even breaks it. We compile a program, linking it
9892 # against the deplibs as a proxy for the library. Then we can check
9893 # whether they linked in statically or dynamically with ldd.
9894 $opt_dry_run || $RM conftest.c
9895 cat > conftest.c <<EOF
9896 int main() { return 0; }
9898 $opt_dry_run || $RM conftest
9899 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9900 ldd_output=`ldd conftest`
9901 for i in $deplibs; do
9904 func_stripname -l '' "$i"
9905 name=$func_stripname_result
9906 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9907 case " $predeps $postdeps " in
9909 func_append newdeplibs " $i"
9914 if test -n "$i"; then
9915 libname=`eval "\\$ECHO \"$libname_spec\""`
9916 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9917 set dummy $deplib_matches; shift
9919 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9920 func_append newdeplibs " $i"
9924 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9925 echo "*** I have the capability to make that library automatically link in when"
9926 echo "*** you link to this library. But I can only do this if you have a"
9927 echo "*** shared version of the library, which I believe you do not have"
9928 echo "*** because a test_compile did reveal that the linker did not use it for"
9929 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9934 func_append newdeplibs " $i"
9939 # Error occurred in the first compile. Let's try to salvage
9940 # the situation: Compile a separate program for each library.
9941 for i in $deplibs; do
9944 func_stripname -l '' "$i"
9945 name=$func_stripname_result
9946 $opt_dry_run || $RM conftest
9947 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9948 ldd_output=`ldd conftest`
9949 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9950 case " $predeps $postdeps " in
9952 func_append newdeplibs " $i"
9957 if test -n "$i"; then
9958 libname=`eval "\\$ECHO \"$libname_spec\""`
9959 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9960 set dummy $deplib_matches; shift
9962 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9963 func_append newdeplibs " $i"
9967 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9968 echo "*** I have the capability to make that library automatically link in when"
9969 echo "*** you link to this library. But I can only do this if you have a"
9970 echo "*** shared version of the library, which you do not appear to have"
9971 echo "*** because a test_compile did reveal that the linker did not use this one"
9972 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9978 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9979 echo "*** make it link in! You will probably need to install it or some"
9980 echo "*** library that it depends on before this library will be fully"
9981 echo "*** functional. Installing it before continuing would be even better."
9985 func_append newdeplibs " $i"
9992 set dummy $deplibs_check_method; shift
9993 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9994 for a_deplib in $deplibs; do
9997 func_stripname -l '' "$a_deplib"
9998 name=$func_stripname_result
9999 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
10000 case " $predeps $postdeps " in
10002 func_append newdeplibs " $a_deplib"
10007 if test -n "$a_deplib"; then
10008 libname=`eval "\\$ECHO \"$libname_spec\""`
10009 if test -n "$file_magic_glob"; then
10010 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
10012 libnameglob=$libname
10014 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
10015 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
10016 if test yes = "$want_nocaseglob"; then
10017 shopt -s nocaseglob
10018 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
10021 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
10023 for potent_lib in $potential_libs; do
10024 # Follow soft links.
10025 if ls -lLd "$potent_lib" 2>/dev/null |
10026 $GREP " -> " >/dev/null; then
10029 # The statement above tries to avoid entering an
10030 # endless loop below, in case of cyclic links.
10031 # We might still enter an endless loop, since a link
10032 # loop can be closed while we follow links,
10035 while test -h "$potlib" 2>/dev/null; do
10036 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
10037 case $potliblink in
10038 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
10039 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
10042 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
10044 $EGREP "$file_magic_regex" > /dev/null; then
10045 func_append newdeplibs " $a_deplib"
10052 if test -n "$a_deplib"; then
10055 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
10056 echo "*** I have the capability to make that library automatically link in when"
10057 echo "*** you link to this library. But I can only do this if you have a"
10058 echo "*** shared version of the library, which you do not appear to have"
10059 echo "*** because I did check the linker path looking for a file starting"
10060 if test -z "$potlib"; then
10061 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
10063 $ECHO "*** with $libname and none of the candidates passed a file format test"
10064 $ECHO "*** using a file magic. Last file checked: $potlib"
10069 # Add a -L argument.
10070 func_append newdeplibs " $a_deplib"
10073 done # Gone through all deplibs.
10076 set dummy $deplibs_check_method; shift
10077 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
10078 for a_deplib in $deplibs; do
10081 func_stripname -l '' "$a_deplib"
10082 name=$func_stripname_result
10083 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
10084 case " $predeps $postdeps " in
10086 func_append newdeplibs " $a_deplib"
10091 if test -n "$a_deplib"; then
10092 libname=`eval "\\$ECHO \"$libname_spec\""`
10093 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
10094 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
10095 for potent_lib in $potential_libs; do
10096 potlib=$potent_lib # see symlink-check above in file_magic test
10097 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
10098 $EGREP "$match_pattern_regex" > /dev/null; then
10099 func_append newdeplibs " $a_deplib"
10106 if test -n "$a_deplib"; then
10109 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
10110 echo "*** I have the capability to make that library automatically link in when"
10111 echo "*** you link to this library. But I can only do this if you have a"
10112 echo "*** shared version of the library, which you do not appear to have"
10113 echo "*** because I did check the linker path looking for a file starting"
10114 if test -z "$potlib"; then
10115 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
10117 $ECHO "*** with $libname and none of the candidates passed a file format test"
10118 $ECHO "*** using a regex pattern. Last file checked: $potlib"
10123 # Add a -L argument.
10124 func_append newdeplibs " $a_deplib"
10127 done # Gone through all deplibs.
10129 none | unknown | *)
10131 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
10132 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
10133 for i in $predeps $postdeps; do
10134 # can't use Xsed below, because $i might contain '/'
10135 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
10138 case $tmp_deplibs in
10141 if test none = "$deplibs_check_method"; then
10142 echo "*** Warning: inter-library dependencies are not supported in this platform."
10144 echo "*** Warning: inter-library dependencies are not known to be supported."
10146 echo "*** All declared inter-library dependencies are being dropped."
10152 versuffix=$versuffix_save
10154 release=$release_save
10155 libname=$libname_save
10159 *-*-rhapsody* | *-*-darwin1.[012])
10160 # On Rhapsody replace the C library with the System framework
10161 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
10165 if test yes = "$droppeddeps"; then
10166 if test yes = "$module"; then
10168 echo "*** Warning: libtool could not satisfy all declared inter-library"
10169 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
10170 echo "*** a static module, that should work as long as the dlopening"
10171 echo "*** application is linked with the -dlopen flag."
10172 if test -z "$global_symbol_pipe"; then
10174 echo "*** However, this would only work if libtool was able to extract symbol"
10175 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
10176 echo "*** not find such a program. So, this module is probably useless."
10177 echo "*** 'nm' from GNU binutils and a full rebuild may help."
10179 if test no = "$build_old_libs"; then
10180 oldlibs=$output_objdir/$libname.$libext
10181 build_libtool_libs=module
10184 build_libtool_libs=no
10187 echo "*** The inter-library dependencies that have been dropped here will be"
10188 echo "*** automatically added whenever a program is linked with this library"
10189 echo "*** or is declared to -dlopen it."
10191 if test no = "$allow_undefined"; then
10193 echo "*** Since this library must not contain undefined symbols,"
10194 echo "*** because either the platform does not support them or"
10195 echo "*** it was explicitly requested with -no-undefined,"
10196 echo "*** libtool will only create a static version of it."
10197 if test no = "$build_old_libs"; then
10198 oldlibs=$output_objdir/$libname.$libext
10199 build_libtool_libs=module
10202 build_libtool_libs=no
10207 # Done checking deplibs!
10208 deplibs=$newdeplibs
10210 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10213 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10214 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10215 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10219 # move library search paths that coincide with paths to not yet
10220 # installed libraries to the beginning of the library search list
10222 for path in $notinst_path; do
10223 case " $new_libs " in
10224 *" -L$path/$objdir "*) ;;
10226 case " $deplibs " in
10227 *" -L$path/$objdir "*)
10228 func_append new_libs " -L$path/$objdir" ;;
10233 for deplib in $deplibs; do
10236 case " $new_libs " in
10238 *) func_append new_libs " $deplib" ;;
10241 *) func_append new_libs " $deplib" ;;
10246 # All the library-specific variables (install_libdir is set above).
10251 # Test again, we may have decided not to build it any more
10252 if test yes = "$build_libtool_libs"; then
10253 # Remove $wl instances when linking with ld.
10254 # FIXME: should test the right _cmds variable.
10255 case $archive_cmds in
10258 if test yes = "$hardcode_into_libs"; then
10259 # Hardcode the library paths
10262 rpath=$finalize_rpath
10263 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
10264 for libdir in $rpath; do
10265 if test -n "$hardcode_libdir_flag_spec"; then
10266 if test -n "$hardcode_libdir_separator"; then
10267 func_replace_sysroot "$libdir"
10268 libdir=$func_replace_sysroot_result
10269 if test -z "$hardcode_libdirs"; then
10270 hardcode_libdirs=$libdir
10272 # Just accumulate the unique libdirs.
10273 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10274 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10277 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10282 eval flag=\"$hardcode_libdir_flag_spec\"
10283 func_append dep_rpath " $flag"
10285 elif test -n "$runpath_var"; then
10286 case "$perm_rpath " in
10288 *) func_append perm_rpath " $libdir" ;;
10292 # Substitute the hardcoded libdirs into the rpath.
10293 if test -n "$hardcode_libdir_separator" &&
10294 test -n "$hardcode_libdirs"; then
10295 libdir=$hardcode_libdirs
10296 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
10298 if test -n "$runpath_var" && test -n "$perm_rpath"; then
10299 # We should set the runpath_var.
10301 for dir in $perm_rpath; do
10302 func_append rpath "$dir:"
10304 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
10306 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
10309 shlibpath=$finalize_shlibpath
10310 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
10311 if test -n "$shlibpath"; then
10312 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
10315 # Get the real and link names of the library.
10316 eval shared_ext=\"$shrext_cmds\"
10317 eval library_names=\"$library_names_spec\"
10318 set dummy $library_names
10323 if test -n "$soname_spec"; then
10324 eval soname=\"$soname_spec\"
10328 if test -z "$dlname"; then
10332 lib=$output_objdir/$realname
10336 func_append linknames " $link"
10339 # Use standard objects if they are pic
10340 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
10341 test "X$libobjs" = "X " && libobjs=
10344 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10345 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
10346 export_symbols=$output_objdir/$libname.uexp
10347 func_append delfiles " $export_symbols"
10350 orig_export_symbols=
10352 cygwin* | mingw* | cegcc*)
10353 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
10354 # exporting using user supplied symfile
10355 func_dll_def_p "$export_symbols" || {
10356 # and it's NOT already a .def file. Must figure out
10357 # which of the given symbols are data symbols and tag
10358 # them as such. So, trigger use of export_symbols_cmds.
10359 # export_symbols gets reassigned inside the "prepare
10360 # the list of exported symbols" if statement, so the
10361 # include_expsyms logic still works.
10362 orig_export_symbols=$export_symbols
10364 always_export_symbols=yes
10370 # Prepare the list of exported symbols
10371 if test -z "$export_symbols"; then
10372 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
10373 func_verbose "generating symbol list for '$libname.la'"
10374 export_symbols=$output_objdir/$libname.exp
10375 $opt_dry_run || $RM $export_symbols
10376 cmds=$export_symbols_cmds
10377 save_ifs=$IFS; IFS='~'
10378 for cmd1 in $cmds; do
10380 # Take the normal branch if the nm_file_list_spec branch
10381 # doesn't work or if tool conversion is not needed.
10382 case $nm_file_list_spec~$to_tool_file_cmd in
10383 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
10384 try_normal_branch=yes
10387 len=$func_len_result
10390 try_normal_branch=no
10393 if test yes = "$try_normal_branch" \
10394 && { test "$len" -lt "$max_cmd_len" \
10395 || test "$max_cmd_len" -le -1; }
10397 func_show_eval "$cmd" 'exit $?'
10398 skipped_export=false
10399 elif test -n "$nm_file_list_spec"; then
10400 func_basename "$output"
10401 output_la=$func_basename_result
10402 save_libobjs=$libobjs
10403 save_output=$output
10404 output=$output_objdir/$output_la.nm
10405 func_to_tool_file "$output"
10406 libobjs=$nm_file_list_spec$func_to_tool_file_result
10407 func_append delfiles " $output"
10408 func_verbose "creating $NM input file list: $output"
10409 for obj in $save_libobjs; do
10410 func_to_tool_file "$obj"
10411 $ECHO "$func_to_tool_file_result"
10414 func_show_eval "$cmd" 'exit $?'
10415 output=$save_output
10416 libobjs=$save_libobjs
10417 skipped_export=false
10419 # The command line is too long to execute in one step.
10420 func_verbose "using reloadable object file for export list..."
10422 # Break out early, otherwise skipped_export may be
10423 # set to false by a later but shorter cmd.
10428 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
10429 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10430 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10435 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10436 tmp_export_symbols=$export_symbols
10437 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10438 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10441 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
10442 # The given exports_symbols file has to be filtered, so filter it.
10443 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10444 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10445 # 's' commands, which not all seds can handle. GNU sed should be fine
10446 # though. Also, the filter scales superlinearly with the number of
10447 # global variables. join(1) would be nice here, but unfortunately
10448 # isn't a blessed tool.
10449 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10450 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10451 export_symbols=$output_objdir/$libname.def
10452 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10456 for test_deplib in $deplibs; do
10457 case " $convenience " in
10458 *" $test_deplib "*) ;;
10460 func_append tmp_deplibs " $test_deplib"
10464 deplibs=$tmp_deplibs
10466 if test -n "$convenience"; then
10467 if test -n "$whole_archive_flag_spec" &&
10468 test yes = "$compiler_needs_object" &&
10469 test -z "$libobjs"; then
10470 # extract the archives, so we have objects to list.
10471 # TODO: could optimize this to just extract one archive.
10472 whole_archive_flag_spec=
10474 if test -n "$whole_archive_flag_spec"; then
10475 save_libobjs=$libobjs
10476 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10477 test "X$libobjs" = "X " && libobjs=
10479 gentop=$output_objdir/${outputname}x
10480 func_append generated " $gentop"
10482 func_extract_archives $gentop $convenience
10483 func_append libobjs " $func_extract_archives_result"
10484 test "X$libobjs" = "X " && libobjs=
10488 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
10489 eval flag=\"$thread_safe_flag_spec\"
10490 func_append linker_flags " $flag"
10493 # Make a backup of the uninstalled library when relinking
10494 if test relink = "$opt_mode"; then
10495 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
10498 # Do each of the archive commands.
10499 if test yes = "$module" && test -n "$module_cmds"; then
10500 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10501 eval test_cmds=\"$module_expsym_cmds\"
10502 cmds=$module_expsym_cmds
10504 eval test_cmds=\"$module_cmds\"
10508 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10509 eval test_cmds=\"$archive_expsym_cmds\"
10510 cmds=$archive_expsym_cmds
10512 eval test_cmds=\"$archive_cmds\"
10517 if test : != "$skipped_export" &&
10518 func_len " $test_cmds" &&
10519 len=$func_len_result &&
10520 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10523 # The command line is too long to link in one step, link piecewise
10524 # or, if using GNU ld and skipped_export is not :, use a linker
10527 # Save the value of $output and $libobjs because we want to
10528 # use them later. If we have whole_archive_flag_spec, we
10529 # want to use save_libobjs as it was before
10530 # whole_archive_flag_spec was expanded, because we can't
10531 # assume the linker understands whole_archive_flag_spec.
10532 # This may have to be revisited, in case too many
10533 # convenience libraries get linked in and end up exceeding
10535 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
10536 save_libobjs=$libobjs
10538 save_output=$output
10539 func_basename "$output"
10540 output_la=$func_basename_result
10542 # Clear the reloadable object creation command queue and
10543 # initialize k to one.
10550 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
10551 output=$output_objdir/$output_la.lnkscript
10552 func_verbose "creating GNU ld script: $output"
10553 echo 'INPUT (' > $output
10554 for obj in $save_libobjs
10556 func_to_tool_file "$obj"
10557 $ECHO "$func_to_tool_file_result" >> $output
10559 echo ')' >> $output
10560 func_append delfiles " $output"
10561 func_to_tool_file "$output"
10562 output=$func_to_tool_file_result
10563 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
10564 output=$output_objdir/$output_la.lnk
10565 func_verbose "creating linker input file list: $output"
10567 set x $save_libobjs
10570 if test yes = "$compiler_needs_object"; then
10576 func_to_tool_file "$obj"
10577 $ECHO "$func_to_tool_file_result" >> $output
10579 func_append delfiles " $output"
10580 func_to_tool_file "$output"
10581 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
10583 if test -n "$save_libobjs"; then
10584 func_verbose "creating reloadable object files..."
10585 output=$output_objdir/$output_la-$k.$objext
10586 eval test_cmds=\"$reload_cmds\"
10587 func_len " $test_cmds"
10588 len0=$func_len_result
10591 # Loop over the list of objects to be linked.
10592 for obj in $save_libobjs
10595 func_arith $len + $func_len_result
10596 len=$func_arith_result
10597 if test -z "$objlist" ||
10598 test "$len" -lt "$max_cmd_len"; then
10599 func_append objlist " $obj"
10601 # The command $test_cmds is almost too long, add a
10602 # command to the queue.
10603 if test 1 -eq "$k"; then
10604 # The first file doesn't have a previous command to add.
10605 reload_objs=$objlist
10606 eval concat_cmds=\"$reload_cmds\"
10608 # All subsequent reloadable object files will link in
10609 # the last one created.
10610 reload_objs="$objlist $last_robj"
10611 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
10613 last_robj=$output_objdir/$output_la-$k.$objext
10615 k=$func_arith_result
10616 output=$output_objdir/$output_la-$k.$objext
10618 func_len " $last_robj"
10619 func_arith $len0 + $func_len_result
10620 len=$func_arith_result
10623 # Handle the remaining objects by creating one last
10624 # reloadable object file. All subsequent reloadable object
10625 # files will link in the last one created.
10626 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10627 reload_objs="$objlist $last_robj"
10628 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
10629 if test -n "$last_robj"; then
10630 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10632 func_append delfiles " $output"
10638 ${skipped_export-false} && {
10639 func_verbose "generating symbol list for '$libname.la'"
10640 export_symbols=$output_objdir/$libname.exp
10641 $opt_dry_run || $RM $export_symbols
10643 # Append the command to create the export file.
10644 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10645 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
10646 if test -n "$last_robj"; then
10647 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10651 test -n "$save_libobjs" &&
10652 func_verbose "creating a temporary reloadable object file: $output"
10654 # Loop through the commands generated above and execute them.
10655 save_ifs=$IFS; IFS='~'
10656 for cmd in $concat_cmds; do
10659 func_quote_arg expand,pretty "$cmd"
10660 eval "func_echo $func_quote_arg_result"
10662 $opt_dry_run || eval "$cmd" || {
10665 # Restore the uninstalled library and exit
10666 if test relink = "$opt_mode"; then
10667 ( cd "$output_objdir" && \
10668 $RM "${realname}T" && \
10669 $MV "${realname}U" "$realname" )
10677 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
10678 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10679 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10683 ${skipped_export-false} && {
10684 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10685 tmp_export_symbols=$export_symbols
10686 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10687 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10690 if test -n "$orig_export_symbols"; then
10691 # The given exports_symbols file has to be filtered, so filter it.
10692 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10693 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10694 # 's' commands, which not all seds can handle. GNU sed should be fine
10695 # though. Also, the filter scales superlinearly with the number of
10696 # global variables. join(1) would be nice here, but unfortunately
10697 # isn't a blessed tool.
10698 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10699 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10700 export_symbols=$output_objdir/$libname.def
10701 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10706 # Restore the value of output.
10707 output=$save_output
10709 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10710 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10711 test "X$libobjs" = "X " && libobjs=
10713 # Expand the library linking commands again to reset the
10714 # value of $libobjs for piecewise linking.
10716 # Do each of the archive commands.
10717 if test yes = "$module" && test -n "$module_cmds"; then
10718 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10719 cmds=$module_expsym_cmds
10724 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10725 cmds=$archive_expsym_cmds
10732 if test -n "$delfiles"; then
10733 # Append the command to remove temporary files to $cmds.
10734 eval cmds=\"\$cmds~\$RM $delfiles\"
10737 # Add any objects from preloaded convenience libraries
10738 if test -n "$dlprefiles"; then
10739 gentop=$output_objdir/${outputname}x
10740 func_append generated " $gentop"
10742 func_extract_archives $gentop $dlprefiles
10743 func_append libobjs " $func_extract_archives_result"
10744 test "X$libobjs" = "X " && libobjs=
10747 save_ifs=$IFS; IFS='~'
10748 for cmd in $cmds; do
10753 func_quote_arg expand,pretty "$cmd"
10754 eval "func_echo $func_quote_arg_result"
10756 $opt_dry_run || eval "$cmd" || {
10759 # Restore the uninstalled library and exit
10760 if test relink = "$opt_mode"; then
10761 ( cd "$output_objdir" && \
10762 $RM "${realname}T" && \
10763 $MV "${realname}U" "$realname" )
10771 # Restore the uninstalled library and exit
10772 if test relink = "$opt_mode"; then
10773 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10775 if test -n "$convenience"; then
10776 if test -z "$whole_archive_flag_spec"; then
10777 func_show_eval '${RM}r "$gentop"'
10784 # Create links to the real library.
10785 for linkname in $linknames; do
10786 if test "$realname" != "$linkname"; then
10787 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10791 # If -module or -export-dynamic was specified, set the dlname.
10792 if test yes = "$module" || test yes = "$export_dynamic"; then
10793 # On all known operating systems, these are identical.
10800 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10801 func_warning "'-dlopen' is ignored for objects"
10804 case " $deplibs" in
10806 func_warning "'-l' and '-L' are ignored for objects" ;;
10809 test -n "$rpath" && \
10810 func_warning "'-rpath' is ignored for objects"
10812 test -n "$xrpath" && \
10813 func_warning "'-R' is ignored for objects"
10815 test -n "$vinfo" && \
10816 func_warning "'-version-info' is ignored for objects"
10818 test -n "$release" && \
10819 func_warning "'-release' is ignored for objects"
10823 test -n "$objs$old_deplibs" && \
10824 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10827 func_lo2o "$libobj"
10828 obj=$func_lo2o_result
10836 # Delete the old objects.
10837 $opt_dry_run || $RM $obj $libobj
10839 # Objects from convenience libraries. This assumes
10840 # single-version convenience libraries. Whenever we create
10841 # different ones for PIC/non-PIC, this we'll have to duplicate
10845 # if reload_cmds runs $LD directly, get rid of -Wl from
10846 # whole_archive_flag_spec and hope we can get by with turning comma
10848 case $reload_cmds in
10849 *\$LD[\ \$]*) wl= ;;
10851 if test -n "$convenience"; then
10852 if test -n "$whole_archive_flag_spec"; then
10853 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10854 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10855 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10857 gentop=$output_objdir/${obj}x
10858 func_append generated " $gentop"
10860 func_extract_archives $gentop $convenience
10861 reload_conv_objs="$reload_objs $func_extract_archives_result"
10865 # If we're not building shared, we need to use non_pic_objs
10866 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10868 # Create the old-style object.
10869 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10872 func_execute_cmds "$reload_cmds" 'exit $?'
10874 # Exit if we aren't doing a library object file.
10875 if test -z "$libobj"; then
10876 if test -n "$gentop"; then
10877 func_show_eval '${RM}r "$gentop"'
10883 test yes = "$build_libtool_libs" || {
10884 if test -n "$gentop"; then
10885 func_show_eval '${RM}r "$gentop"'
10888 # Create an invalid libtool object if no PIC, so that we don't
10889 # accidentally link it into a program.
10890 # $show "echo timestamp > $libobj"
10891 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10895 if test -n "$pic_flag" || test default != "$pic_mode"; then
10896 # Only do commands if we really have different PIC objects.
10897 reload_objs="$libobjs $reload_conv_objs"
10899 func_execute_cmds "$reload_cmds" 'exit $?'
10902 if test -n "$gentop"; then
10903 func_show_eval '${RM}r "$gentop"'
10911 *cygwin*) func_stripname '' '.exe' "$output"
10912 output=$func_stripname_result.exe;;
10914 test -n "$vinfo" && \
10915 func_warning "'-version-info' is ignored for programs"
10917 test -n "$release" && \
10918 func_warning "'-release' is ignored for programs"
10921 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10922 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10925 *-*-rhapsody* | *-*-darwin1.[012])
10926 # On Rhapsody replace the C library is the System framework
10927 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10928 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10934 # Don't allow lazy linking, it breaks C++ global constructors
10935 # But is supposedly fixed on 10.4 or later (yay!).
10936 if test CXX = "$tagname"; then
10937 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10939 func_append compile_command " $wl-bind_at_load"
10940 func_append finalize_command " $wl-bind_at_load"
10944 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10945 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10946 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10951 # move library search paths that coincide with paths to not yet
10952 # installed libraries to the beginning of the library search list
10954 for path in $notinst_path; do
10955 case " $new_libs " in
10956 *" -L$path/$objdir "*) ;;
10958 case " $compile_deplibs " in
10959 *" -L$path/$objdir "*)
10960 func_append new_libs " -L$path/$objdir" ;;
10965 for deplib in $compile_deplibs; do
10968 case " $new_libs " in
10970 *) func_append new_libs " $deplib" ;;
10973 *) func_append new_libs " $deplib" ;;
10976 compile_deplibs=$new_libs
10979 func_append compile_command " $compile_deplibs"
10980 func_append finalize_command " $finalize_deplibs"
10982 if test -n "$rpath$xrpath"; then
10983 # If the user specified any rpath flags, then add them.
10984 for libdir in $rpath $xrpath; do
10985 # This is the magic to use -rpath.
10986 case "$finalize_rpath " in
10988 *) func_append finalize_rpath " $libdir" ;;
10993 # Now hardcode the library paths
10996 for libdir in $compile_rpath $finalize_rpath; do
10997 if test -n "$hardcode_libdir_flag_spec"; then
10998 if test -n "$hardcode_libdir_separator"; then
10999 if test -z "$hardcode_libdirs"; then
11000 hardcode_libdirs=$libdir
11002 # Just accumulate the unique libdirs.
11003 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
11004 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
11007 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
11012 eval flag=\"$hardcode_libdir_flag_spec\"
11013 func_append rpath " $flag"
11015 elif test -n "$runpath_var"; then
11016 case "$perm_rpath " in
11018 *) func_append perm_rpath " $libdir" ;;
11022 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
11023 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
11024 case :$dllsearchpath: in
11026 ::) dllsearchpath=$libdir;;
11027 *) func_append dllsearchpath ":$libdir";;
11029 case :$dllsearchpath: in
11030 *":$testbindir:"*) ;;
11031 ::) dllsearchpath=$testbindir;;
11032 *) func_append dllsearchpath ":$testbindir";;
11037 # Substitute the hardcoded libdirs into the rpath.
11038 if test -n "$hardcode_libdir_separator" &&
11039 test -n "$hardcode_libdirs"; then
11040 libdir=$hardcode_libdirs
11041 eval rpath=\" $hardcode_libdir_flag_spec\"
11043 compile_rpath=$rpath
11047 for libdir in $finalize_rpath; do
11048 if test -n "$hardcode_libdir_flag_spec"; then
11049 if test -n "$hardcode_libdir_separator"; then
11050 if test -z "$hardcode_libdirs"; then
11051 hardcode_libdirs=$libdir
11053 # Just accumulate the unique libdirs.
11054 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
11055 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
11058 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
11063 eval flag=\"$hardcode_libdir_flag_spec\"
11064 func_append rpath " $flag"
11066 elif test -n "$runpath_var"; then
11067 case "$finalize_perm_rpath " in
11069 *) func_append finalize_perm_rpath " $libdir" ;;
11073 # Substitute the hardcoded libdirs into the rpath.
11074 if test -n "$hardcode_libdir_separator" &&
11075 test -n "$hardcode_libdirs"; then
11076 libdir=$hardcode_libdirs
11077 eval rpath=\" $hardcode_libdir_flag_spec\"
11079 finalize_rpath=$rpath
11081 if test -n "$libobjs" && test yes = "$build_old_libs"; then
11082 # Transform all the library objects into standard objects.
11083 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
11084 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
11087 func_generate_dlsyms "$outputname" "@PROGRAM@" false
11089 # template prelinking step
11090 if test -n "$prelink_cmds"; then
11091 func_execute_cmds "$prelink_cmds" 'exit $?'
11094 wrappers_required=:
11096 *cegcc* | *mingw32ce*)
11097 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
11098 wrappers_required=false
11100 *cygwin* | *mingw* )
11101 test yes = "$build_libtool_libs" || wrappers_required=false
11104 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
11105 wrappers_required=false
11109 $wrappers_required || {
11110 # Replace the output file specification.
11111 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
11112 link_command=$compile_command$compile_rpath
11114 # We have no uninstalled library dependencies, so finalize right now.
11116 func_show_eval "$link_command" 'exit_status=$?'
11118 if test -n "$postlink_cmds"; then
11119 func_to_tool_file "$output"
11120 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
11121 func_execute_cmds "$postlink_cmds" 'exit $?'
11124 # Delete the generated files.
11125 if test -f "$output_objdir/${outputname}S.$objext"; then
11126 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
11132 if test -n "$compile_shlibpath$finalize_shlibpath"; then
11133 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
11135 if test -n "$finalize_shlibpath"; then
11136 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
11141 if test -n "$runpath_var"; then
11142 if test -n "$perm_rpath"; then
11143 # We should set the runpath_var.
11145 for dir in $perm_rpath; do
11146 func_append rpath "$dir:"
11148 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
11150 if test -n "$finalize_perm_rpath"; then
11151 # We should set the runpath_var.
11153 for dir in $finalize_perm_rpath; do
11154 func_append rpath "$dir:"
11156 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
11160 if test yes = "$no_install"; then
11161 # We don't need to create a wrapper script.
11162 link_command=$compile_var$compile_command$compile_rpath
11163 # Replace the output file specification.
11164 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
11165 # Delete the old output file.
11166 $opt_dry_run || $RM $output
11167 # Link the executable and exit
11168 func_show_eval "$link_command" 'exit $?'
11170 if test -n "$postlink_cmds"; then
11171 func_to_tool_file "$output"
11172 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
11173 func_execute_cmds "$postlink_cmds" 'exit $?'
11179 case $hardcode_action,$fast_install in
11181 # Fast installation is not supported
11182 link_command=$compile_var$compile_command$compile_rpath
11183 relink_command=$finalize_var$finalize_command$finalize_rpath
11185 func_warning "this platform does not like uninstalled shared libraries"
11186 func_warning "'$output' will be relinked during installation"
11189 link_command=$finalize_var$compile_command$finalize_rpath
11190 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
11193 link_command=$compile_var$compile_command$compile_rpath
11194 relink_command=$finalize_var$finalize_command$finalize_rpath
11197 link_command=$finalize_var$compile_command$finalize_rpath
11202 # Replace the output file specification.
11203 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
11205 # Delete the old output files.
11206 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
11208 func_show_eval "$link_command" 'exit $?'
11210 if test -n "$postlink_cmds"; then
11211 func_to_tool_file "$output_objdir/$outputname"
11212 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'`
11213 func_execute_cmds "$postlink_cmds" 'exit $?'
11216 # Now create the wrapper script.
11217 func_verbose "creating $output"
11219 # Quote the relink command for shipping.
11220 if test -n "$relink_command"; then
11221 # Preserve any variables that may affect compiler behavior
11222 for var in $variables_saved_for_relink; do
11223 if eval test -z \"\${$var+set}\"; then
11224 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11225 elif eval var_value=\$$var; test -z "$var_value"; then
11226 relink_command="$var=; export $var; $relink_command"
11228 func_quote_arg pretty "$var_value"
11229 relink_command="$var=$func_quote_arg_result; export $var; $relink_command"
11232 func_quote eval cd "`pwd`"
11233 func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)"
11234 relink_command=$func_quote_arg_unquoted_result
11237 # Only actually do things if not in dry run mode.
11239 # win32 will think the script is a binary if it has
11240 # a .exe suffix, so we strip it off here.
11242 *.exe) func_stripname '' '.exe' "$output"
11243 output=$func_stripname_result ;;
11245 # test for cygwin because mv fails w/o .exe extensions
11249 func_stripname '' '.exe' "$outputname"
11250 outputname=$func_stripname_result ;;
11254 *cygwin* | *mingw* )
11255 func_dirname_and_basename "$output" "" "."
11256 output_name=$func_basename_result
11257 output_path=$func_dirname_result
11258 cwrappersource=$output_path/$objdir/lt-$output_name.c
11259 cwrapper=$output_path/$output_name.exe
11260 $RM $cwrappersource $cwrapper
11261 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
11263 func_emit_cwrapperexe_src > $cwrappersource
11265 # The wrapper executable is built using the $host compiler,
11266 # because it contains $host paths and files. If cross-
11267 # compiling, it, like the target executable, must be
11268 # executed on the $host or under an emulation environment.
11270 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
11274 # Now, create the wrapper script for func_source use:
11275 func_ltwrapper_scriptname $cwrapper
11276 $RM $func_ltwrapper_scriptname_result
11277 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
11279 # note: this script will not be executed, so do not chmod.
11280 if test "x$build" = "x$host"; then
11281 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
11283 func_emit_wrapper no > $func_ltwrapper_scriptname_result
11289 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
11291 func_emit_wrapper no > $output
11300 # See if we need to build an old-fashioned archive.
11301 for oldlib in $oldlibs; do
11303 case $build_libtool_libs in
11305 oldobjs="$libobjs_save $symfileobj"
11306 addlibs=$convenience
11307 build_libtool_libs=no
11310 oldobjs=$libobjs_save
11311 addlibs=$old_convenience
11312 build_libtool_libs=no
11315 oldobjs="$old_deplibs $non_pic_objects"
11316 $preload && test -f "$symfileobj" \
11317 && func_append oldobjs " $symfileobj"
11318 addlibs=$old_convenience
11322 if test -n "$addlibs"; then
11323 gentop=$output_objdir/${outputname}x
11324 func_append generated " $gentop"
11326 func_extract_archives $gentop $addlibs
11327 func_append oldobjs " $func_extract_archives_result"
11330 # Do each command in the archive commands.
11331 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
11332 cmds=$old_archive_from_new_cmds
11335 # Add any objects from preloaded convenience libraries
11336 if test -n "$dlprefiles"; then
11337 gentop=$output_objdir/${outputname}x
11338 func_append generated " $gentop"
11340 func_extract_archives $gentop $dlprefiles
11341 func_append oldobjs " $func_extract_archives_result"
11344 # POSIX demands no paths to be encoded in archives. We have
11345 # to avoid creating archives with duplicate basenames if we
11346 # might have to extract them afterwards, e.g., when creating a
11347 # static archive out of a convenience library, or when linking
11348 # the entirety of a libtool archive into another (currently
11349 # not supported by libtool).
11350 if (for obj in $oldobjs
11352 func_basename "$obj"
11353 $ECHO "$func_basename_result"
11354 done | sort | sort -uc >/dev/null 2>&1); then
11357 echo "copying selected object files to avoid basename conflicts..."
11358 gentop=$output_objdir/${outputname}x
11359 func_append generated " $gentop"
11360 func_mkdir_p "$gentop"
11361 save_oldobjs=$oldobjs
11364 for obj in $save_oldobjs
11366 func_basename "$obj"
11367 objbase=$func_basename_result
11368 case " $oldobjs " in
11369 " ") oldobjs=$obj ;;
11370 *[\ /]"$objbase "*)
11372 # Make sure we don't pick an alternate name that also
11374 newobj=lt$counter-$objbase
11375 func_arith $counter + 1
11376 counter=$func_arith_result
11377 case " $oldobjs " in
11378 *[\ /]"$newobj "*) ;;
11379 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
11382 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
11383 func_append oldobjs " $gentop/$newobj"
11385 *) func_append oldobjs " $obj" ;;
11389 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
11390 tool_oldlib=$func_to_tool_file_result
11391 eval cmds=\"$old_archive_cmds\"
11394 len=$func_len_result
11395 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
11396 cmds=$old_archive_cmds
11397 elif test -n "$archiver_list_spec"; then
11398 func_verbose "using command file archive linking..."
11399 for obj in $oldobjs
11401 func_to_tool_file "$obj"
11402 $ECHO "$func_to_tool_file_result"
11403 done > $output_objdir/$libname.libcmd
11404 func_to_tool_file "$output_objdir/$libname.libcmd"
11405 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
11406 cmds=$old_archive_cmds
11408 # the command line is too long to link in one step, link in parts
11409 func_verbose "using piecewise archive linking..."
11410 save_RANLIB=$RANLIB
11414 save_oldobjs=$oldobjs
11416 # Is there a better way of finding the last object in the list?
11417 for obj in $save_oldobjs
11421 eval test_cmds=\"$old_archive_cmds\"
11422 func_len " $test_cmds"
11423 len0=$func_len_result
11425 for obj in $save_oldobjs
11428 func_arith $len + $func_len_result
11429 len=$func_arith_result
11430 func_append objlist " $obj"
11431 if test "$len" -lt "$max_cmd_len"; then
11434 # the above command should be used before it gets too long
11436 if test "$obj" = "$last_oldobj"; then
11437 RANLIB=$save_RANLIB
11439 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
11440 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
11445 RANLIB=$save_RANLIB
11447 if test -z "$oldobjs"; then
11448 eval cmds=\"\$concat_cmds\"
11450 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
11454 func_execute_cmds "$cmds" 'exit $?'
11457 test -n "$generated" && \
11458 func_show_eval "${RM}r$generated"
11460 # Now create the libtool archive.
11464 test yes = "$build_old_libs" && old_library=$libname.$libext
11465 func_verbose "creating $output"
11467 # Preserve any variables that may affect compiler behavior
11468 for var in $variables_saved_for_relink; do
11469 if eval test -z \"\${$var+set}\"; then
11470 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11471 elif eval var_value=\$$var; test -z "$var_value"; then
11472 relink_command="$var=; export $var; $relink_command"
11474 func_quote_arg pretty,unquoted "$var_value"
11475 relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command"
11478 # Quote the link command for shipping.
11479 func_quote eval cd "`pwd`"
11480 relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
11481 func_quote_arg pretty,unquoted "$relink_command"
11482 relink_command=$func_quote_arg_unquoted_result
11483 if test yes = "$hardcode_automatic"; then
11487 # Only create the output if not a dry run.
11489 for installed in no yes; do
11490 if test yes = "$installed"; then
11491 if test -z "$install_libdir"; then
11494 output=$output_objdir/${outputname}i
11495 # Replace all uninstalled libtool libraries with the installed ones
11496 newdependency_libs=
11497 for deplib in $dependency_libs; do
11500 func_basename "$deplib"
11501 name=$func_basename_result
11502 func_resolve_sysroot "$deplib"
11503 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
11504 test -z "$libdir" && \
11505 func_fatal_error "'$deplib' is not a valid libtool archive"
11506 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
11509 func_stripname -L '' "$deplib"
11510 func_replace_sysroot "$func_stripname_result"
11511 func_append newdependency_libs " -L$func_replace_sysroot_result"
11514 func_stripname -R '' "$deplib"
11515 func_replace_sysroot "$func_stripname_result"
11516 func_append newdependency_libs " -R$func_replace_sysroot_result"
11518 *) func_append newdependency_libs " $deplib" ;;
11521 dependency_libs=$newdependency_libs
11524 for lib in $dlfiles; do
11527 func_basename "$lib"
11528 name=$func_basename_result
11529 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11530 test -z "$libdir" && \
11531 func_fatal_error "'$lib' is not a valid libtool archive"
11532 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
11534 *) func_append newdlfiles " $lib" ;;
11537 dlfiles=$newdlfiles
11539 for lib in $dlprefiles; do
11542 # Only pass preopened files to the pseudo-archive (for
11543 # eventual linking with the app. that links it) if we
11544 # didn't already link the preopened objects directly into
11546 func_basename "$lib"
11547 name=$func_basename_result
11548 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11549 test -z "$libdir" && \
11550 func_fatal_error "'$lib' is not a valid libtool archive"
11551 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
11555 dlprefiles=$newdlprefiles
11558 for lib in $dlfiles; do
11560 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11561 *) abs=`pwd`"/$lib" ;;
11563 func_append newdlfiles " $abs"
11565 dlfiles=$newdlfiles
11567 for lib in $dlprefiles; do
11569 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11570 *) abs=`pwd`"/$lib" ;;
11572 func_append newdlprefiles " $abs"
11574 dlprefiles=$newdlprefiles
11577 # place dlname in correct position for cygwin
11578 # In fact, it would be nice if we could use this code for all target
11579 # systems that can't hard-code library paths into their executables
11580 # and that have no shared library path variable independent of PATH,
11581 # but it turns out we can't easily determine that from inspecting
11582 # libtool variables, so we have to hard-code the OSs to which it
11583 # applies here; at the moment, that means platforms that use the PE
11584 # object format with DLL files. See the long comment at the top of
11585 # tests/bindir.at for full details.
11587 case $host,$output,$installed,$module,$dlname in
11588 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
11589 # If a -bindir argument was supplied, place the dll there.
11590 if test -n "$bindir"; then
11591 func_relative_path "$install_libdir" "$bindir"
11592 tdlname=$func_relative_path_result/$dlname
11594 # Otherwise fall back on heuristic.
11595 tdlname=../bin/$dlname
11600 # $outputname - a libtool library file
11601 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
11603 # Please DO NOT delete this file!
11604 # It is necessary for linking the library.
11606 # The name that we can dlopen(3).
11609 # Names of this library.
11610 library_names='$library_names'
11612 # The name of the static archive.
11613 old_library='$old_library'
11615 # Linker flags that cannot go in dependency_libs.
11616 inherited_linker_flags='$new_inherited_linker_flags'
11618 # Libraries that this one depends upon.
11619 dependency_libs='$dependency_libs'
11621 # Names of additional weak libraries provided by this library
11622 weak_library_names='$weak_libs'
11624 # Version information for $libname.
11629 # Is this an already installed library?
11630 installed=$installed
11632 # Should we warn about portability when linking against -modules?
11633 shouldnotlink=$module
11635 # Files to dlopen/dlpreopen
11637 dlpreopen='$dlprefiles'
11639 # Directory that this library needs to be installed in:
11640 libdir='$install_libdir'"
11641 if test no,yes = "$installed,$need_relink"; then
11642 $ECHO >> $output "\
11643 relink_command=\"$relink_command\""
11648 # Do a symbolic link so that the libtool archive can be found in
11649 # LD_LIBRARY_PATH before the program is installed.
11650 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
11656 if test link = "$opt_mode" || test relink = "$opt_mode"; then
11657 func_mode_link ${1+"$@"}
11661 # func_mode_uninstall arg...
11662 func_mode_uninstall ()
11671 # This variable tells wrapper scripts just to set variables rather
11672 # than running their programs.
11673 libtool_install_magic=$magic
11678 -f) func_append RM " $arg"; rmforce=: ;;
11679 -*) func_append RM " $arg" ;;
11680 *) func_append files " $arg" ;;
11685 func_fatal_help "you must specify an RM program"
11689 for file in $files; do
11690 func_dirname "$file" "" "."
11691 dir=$func_dirname_result
11692 if test . = "$dir"; then
11697 func_basename "$file"
11698 name=$func_basename_result
11699 test uninstall = "$opt_mode" && odir=$dir
11701 # Remember odir for removal later, being careful to avoid duplicates
11702 if test clean = "$opt_mode"; then
11703 case " $rmdirs " in
11705 *) func_append rmdirs " $odir" ;;
11709 # Don't error if the file doesn't exist and rm -f was used.
11710 if { test -L "$file"; } >/dev/null 2>&1 ||
11711 { test -h "$file"; } >/dev/null 2>&1 ||
11712 test -f "$file"; then
11714 elif test -d "$file"; then
11717 elif $rmforce; then
11725 # Possibly a libtool archive, so verify it.
11726 if func_lalib_p "$file"; then
11727 func_source $dir/$name
11729 # Delete the libtool libraries and symlinks.
11730 for n in $library_names; do
11731 func_append rmfiles " $odir/$n"
11733 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11737 case " $library_names " in
11739 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11741 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11744 if test -n "$library_names"; then
11745 # Do each command in the postuninstall commands.
11746 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11749 if test -n "$old_library"; then
11750 # Do each command in the old_postuninstall commands.
11751 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11753 # FIXME: should reinstall the best remaining shared library.
11760 # Possibly a libtool object, so verify it.
11761 if func_lalib_p "$file"; then
11763 # Read the .lo file
11764 func_source $dir/$name
11766 # Add PIC object to the list of files to remove.
11767 if test -n "$pic_object" && test none != "$pic_object"; then
11768 func_append rmfiles " $dir/$pic_object"
11771 # Add non-PIC object to the list of files to remove.
11772 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11773 func_append rmfiles " $dir/$non_pic_object"
11779 if test clean = "$opt_mode"; then
11783 func_stripname '' '.exe' "$file"
11784 file=$func_stripname_result
11785 func_stripname '' '.exe' "$name"
11786 noexename=$func_stripname_result
11787 # $file with .exe has already been added to rmfiles,
11788 # add $file without .exe
11789 func_append rmfiles " $file"
11792 # Do a test to see if this is a libtool program.
11793 if func_ltwrapper_p "$file"; then
11794 if func_ltwrapper_executable_p "$file"; then
11795 func_ltwrapper_scriptname "$file"
11797 func_source $func_ltwrapper_scriptname_result
11798 func_append rmfiles " $func_ltwrapper_scriptname_result"
11801 func_source $dir/$noexename
11804 # note $name still contains .exe if it was in $file originally
11805 # as does the version of $file that was added into $rmfiles
11806 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11807 if test yes = "$fast_install" && test -n "$relink_command"; then
11808 func_append rmfiles " $odir/lt-$name"
11810 if test "X$noexename" != "X$name"; then
11811 func_append rmfiles " $odir/lt-$noexename.c"
11817 func_show_eval "$RM $rmfiles" 'exit_status=1'
11820 # Try to remove the $objdir's in the directories where we deleted files
11821 for dir in $rmdirs; do
11822 if test -d "$dir"; then
11823 func_show_eval "rmdir $dir >/dev/null 2>&1"
11830 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11831 func_mode_uninstall ${1+"$@"}
11834 test -z "$opt_mode" && {
11836 func_fatal_help "you must specify a MODE"
11839 test -z "$exec_cmd" && \
11840 func_fatal_help "invalid operation mode '$opt_mode'"
11842 if test -n "$exec_cmd"; then
11843 eval exec "$exec_cmd"
11850 # The TAGs below are defined such that we never get into a situation
11851 # where we disable both kinds of libraries. Given conflicting
11852 # choices, we go for a static library, that is the most portable,
11853 # since we can't tell whether shared libraries were disabled because
11854 # the user asked for that or because the platform doesn't support
11855 # them. This is particularly important on AIX, because we don't
11856 # support having both static and shared libraries enabled at the same
11857 # time on that platform, so we default to a shared-only configuration.
11858 # If a disable-shared tag is given, we'll fallback to a static-only
11859 # configuration. But we'll never go from static-only to shared-only.
11861 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11862 build_libtool_libs=no
11864 # ### END LIBTOOL TAG CONFIG: disable-shared
11866 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11867 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11868 # ### END LIBTOOL TAG CONFIG: disable-static
11871 # mode:shell-script