2 # Generated automatically by config.status (recutils) 1.8
3 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
5 # Provide generalized library-building support services.
6 # Written by Gordon Matzigkeit, 1996
8 # Copyright (C) 2014 Free Software Foundation, Inc.
9 # This is free software; see the source for copying conditions. There is NO
10 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 # GNU Libtool is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of of the License, or
15 # (at your option) any later version.
17 # As a special exception to the GNU General Public License, if you
18 # distribute this file as part of a program or library that is built
19 # using GNU Libtool, you may include this file under the same
20 # distribution terms that you use for the rest of that program.
22 # GNU Libtool is distributed in the hope that it will be useful, but
23 # WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
27 # You should have received a copy of the GNU General Public License
28 # along with this program. If not, see <http://www.gnu.org/licenses/>.
31 # The names of the tagged configurations supported by this script.
34 # Configured defaults for sys_lib_dlsearch_path munging.
35 : ${LT_SYS_LIBRARY_PATH=""}
37 # ### BEGIN LIBTOOL CONFIG
39 # Which release of libtool.m4 was used?
43 # Whether or not to build shared libraries.
44 build_libtool_libs
=yes
46 # Whether or not to build static libraries.
49 # What type of objects to build.
52 # Whether or not to optimize for fast installation.
55 # Shared archive member basename,for filename based shared library versioning on AIX.
56 shared_archive_member_spec
=
58 # Shell to use when invoking shell scripts.
61 # An echo program that protects backslashes.
64 # The PATH separator for the build system.
69 host=i686-pc-linux-gnu
74 build
=i686-pc-linux-gnu
77 # A sed program that does not truncate output.
80 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
81 Xsed
="$SED -e 1s/^X//"
83 # A grep program that handles long lines.
89 # A literal string matcher.
92 # A BSD- or MS-compatible name lister.
95 # Whether we need soft or hard links.
98 # What is the maximum length of a command?
101 # Object file suffix (normally "o").
104 # Executable file suffix (normally "").
107 # whether the shell understands "unset".
110 # turn spaces into newlines.
111 SP2NL
="tr \\040 \\012"
113 # turn newlines into spaces.
114 NL2SP
="tr \\015\\012 \\040\\040"
116 # convert $build file names to $host format.
117 to_host_file_cmd
=func_convert_file_noop
119 # convert $build files to toolchain format.
120 to_tool_file_cmd
=func_convert_file_noop
122 # An object symbol dumper.
125 # Method to check whether dependent libraries are shared objects.
126 deplibs_check_method
="pass_all"
128 # Command to use when deplibs_check_method = "file_magic".
129 file_magic_cmd
="\$MAGIC_CMD"
131 # How to find potential files when deplibs_check_method = "file_magic".
134 # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
137 # DLL creation program.
140 # Command to associate shared and link libraries.
141 sharedlib_from_linklib_cmd
="printf %s\\n"
146 # Flags to create an archive.
149 # How to feed a file listing to the archiver.
150 archiver_list_spec
="@"
152 # A symbol stripping program.
155 # Commands used to install an old-style archive.
157 old_postinstall_cmds
="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
158 old_postuninstall_cmds
=""
160 # Whether to use a lock for old archive extraction.
161 lock_old_archive_extraction
=no
166 # LTCC compiler flags.
169 # Take the output of nm and produce a listing of raw symbols and C names.
170 global_symbol_pipe
="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
172 # Transform the output of nm in a proper C declaration.
173 global_symbol_to_cdecl
="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
175 # Transform the output of nm into a list of symbols to manually relocate.
176 global_symbol_to_import
=""
178 # Transform the output of nm in a C name address pair.
179 global_symbol_to_c_name_address
="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'"
181 # Transform the output of nm in a C name address pair when lib prefix is needed.
182 global_symbol_to_c_name_address_lib_prefix
="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(lib.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"lib\\1\", (void *) \\&\\1},/p'"
184 # The name lister interface.
185 nm_interface
="BSD nm"
187 # Specify filename containing input files for $NM.
188 nm_file_list_spec
="@"
190 # The root where to search for dependent libraries,and where our libraries should be installed.
193 # Command to truncate a binary pipe.
194 lt_truncate_bin
="/bin/dd bs=4096 count=1"
196 # The name of the directory that contains temporary libtool files.
199 # Used to examine libraries when file_magic_cmd begins with "file".
202 # Must we lock files when doing compilation?
208 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
211 # Tool to change global to local symbols on Mac OS X.
214 # Tool to manipulate fat objects and archives on Mac OS X.
217 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
220 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
223 # Old archive suffix (normally "a").
226 # Shared library suffix (normally ".so").
229 # The commands to extract the exported symbol list from a shared archive.
230 extract_expsyms_cmds
=""
232 # Variables whose values should be saved in libtool wrapper scripts and
233 # restored at link time.
234 variables_saved_for_relink
="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
236 # Do we need the "lib" prefix for modules?
239 # Do we need a version for libraries?
242 # Library versioning type.
245 # Shared library runtime path variable.
246 runpath_var
=LD_RUN_PATH
248 # Shared library path variable.
249 shlibpath_var
=LD_LIBRARY_PATH
251 # Is shlibpath searched before the hard-coded library search path?
252 shlibpath_overrides_runpath
=no
254 # Format of library name prefix.
255 libname_spec
="lib\$name"
257 # List of archive names. First name is the real one, the rest are links.
258 # The last name is the one that the linker finds with -lNAME
259 library_names_spec
="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
261 # The coded name of the library, if different from the real name.
262 soname_spec
="\$libname\$release\$shared_ext\$major"
264 # Permission mode override for installation of shared libraries.
265 install_override_mode
=""
267 # Command to use after installation of a shared archive.
270 # Command to use after uninstallation of a shared archive.
271 postuninstall_cmds
=""
273 # Commands used to finish a libtool library installation in a directory.
274 finish_cmds
="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
276 # As "finish_cmds", except a single script fragment to be evaled but
280 # Whether we should hardcode library paths into libraries.
281 hardcode_into_libs
=yes
283 # Compile-time system search path for libraries.
284 sys_lib_search_path_spec
="/usr/lib/gcc/i686-linux-gnu/5 /usr/lib/i386-linux-gnu /usr/lib /lib/i386-linux-gnu /lib "
286 # Detected run-time system search path for libraries.
287 sys_lib_dlsearch_path_spec
="/lib /usr/lib /usr/lib/i386-linux-gnu/libfakeroot /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/lib/i386-linux-gnu/mesa-egl /usr/lib/i386-linux-gnu/mesa /usr/local/lib /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 "
289 # Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
290 configure_time_lt_sys_library_path
=""
292 # Whether dlopen is supported.
293 dlopen_support
=unknown
295 # Whether dlopen of programs is supported.
298 # Whether dlopen of statically linked programs is supported.
299 dlopen_self_static
=unknown
301 # Commands to strip libraries.
302 old_striplib
="strip --strip-debug"
303 striplib
="strip --strip-unneeded"
306 # The linker used to build libraries.
309 # How to create reloadable object files.
311 reload_cmds
="\$LD\$reload_flag -o \$output\$reload_objs"
313 # Commands used to build an old-style archive.
314 old_archive_cmds
="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
316 # A language specific compiler.
319 # Is the compiler the GNU compiler?
322 # Compiler flag to turn off builtin functions.
323 no_builtin_flag
=" -fno-builtin"
325 # Additional compiler flags for building library objects.
326 pic_flag
=" -fPIC -DPIC"
328 # How to pass a linker flag through the compiler.
331 # Compiler flag to prevent dynamic linking.
332 link_static_flag
="-static"
334 # Does compiler simultaneously support -c and -o options?
337 # Whether or not to add -lc for building shared libraries.
338 build_libtool_need_lc
=no
340 # Whether or not to disallow shared libs when runtime libs are static.
341 allow_libtool_libs_with_static_runtimes
=no
343 # Compiler flag to allow reflexive dlopens.
344 export_dynamic_flag_spec
="\$wl--export-dynamic"
346 # Compiler flag to generate shared objects directly from archives.
347 whole_archive_flag_spec
="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
349 # Whether the compiler copes with passing no objects directly.
350 compiler_needs_object
="no"
352 # Create an old-style archive from a shared archive.
353 old_archive_from_new_cmds
=""
355 # Create a temporary old-style archive to link instead of a shared archive.
356 old_archive_from_expsyms_cmds
=""
358 # Commands used to build a shared archive.
359 archive_cmds
="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
360 archive_expsym_cmds
="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
361 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
362 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
363 \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
365 # Commands used to build a loadable module if different from building
368 module_expsym_cmds
=""
370 # Whether we are building with GNU ld or not.
373 # Flag that allows shared libraries with undefined symbols to be built.
374 allow_undefined_flag
=""
376 # Flag that enforces no undefined symbols.
379 # Flag to hardcode $libdir into a binary during linking.
380 # This must work even if $libdir does not exist
381 hardcode_libdir_flag_spec
="\$wl-rpath \$wl\$libdir"
383 # Whether we need a single "-rpath" flag with a separated argument.
384 hardcode_libdir_separator
=""
386 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
387 # DIR into the resulting binary.
390 # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
391 # DIR into the resulting binary and the resulting library dependency is
392 # "absolute",i.e impossible to change by setting $shlibpath_var if the
393 # library is relocated.
394 hardcode_direct_absolute
=no
396 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
397 # into the resulting binary.
400 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
401 # into the resulting binary.
402 hardcode_shlibpath_var
=unsupported
404 # Set to "yes" if building a shared library automatically hardcodes DIR
405 # into the library and all subsequent libraries and executables linked
407 hardcode_automatic
=no
409 # Set to yes if linker adds runtime paths of dependent libraries
410 # to runtime path list.
413 # Whether libtool must link a program against all its dependency libraries.
416 # Set to "yes" if exported symbols are required.
417 always_export_symbols
=no
419 # The commands to list exported symbols.
420 export_symbols_cmds
="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
422 # Symbols that should not be listed in the preloaded symbols.
423 exclude_expsyms
="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
425 # Symbols that must always be exported.
428 # Commands necessary for linking programs (against libraries) with templates.
431 # Commands necessary for finishing linking programs.
434 # Specify filename containing input files.
437 # How to hardcode a shared library path into an executable.
438 hardcode_action
=immediate
440 # ### END LIBTOOL CONFIG
443 # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
445 # func_munge_path_list VARIABLE PATH
446 # -----------------------------------
447 # VARIABLE is name of variable containing _space_ separated list of
448 # directories to be munged by the contents of PATH, which is string
451 # string "DIR[ DIR]" will be prepended to VARIABLE
453 # string "DIR[ DIR]" will be appended to VARIABLE
454 # "DIRP[:DIRP]::[DIRA:]DIRA"
455 # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
456 # "DIRA[ DIRA]" will be appended to VARIABLE
458 # VARIABLE will be replaced by "DIR[ DIR]"
459 func_munge_path_list
()
465 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$
$1\"
468 eval $1=\"\$
$1 `$ECHO $2 | $SED 's/:/ /g'`\"
471 eval $1=\"\$
$1\
`$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
472 eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$
$1\"
475 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
481 # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
484 for cc_temp
in $
*""; do
486 compile |
*[\\/]compile | ccache |
*[\\/]ccache
) ;;
487 distcc |
*[\\/]distcc | purify |
*[\\/]purify
) ;;
492 func_cc_basename_result
=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
496 # ### END FUNCTIONS SHARED WITH CONFIGURE
499 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
500 ## by inline-source v2014-01-03.01
502 # libtool (GNU libtool) 2.4.6
503 # Provide generalized library-building support services.
504 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
506 # Copyright (C) 1996-2015 Free Software Foundation, Inc.
507 # This is free software; see the source for copying conditions. There is NO
508 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
510 # GNU Libtool is free software; you can redistribute it and/or modify
511 # it under the terms of the GNU General Public License as published by
512 # the Free Software Foundation; either version 2 of the License, or
513 # (at your option) any later version.
515 # As a special exception to the GNU General Public License,
516 # if you distribute this file as part of a program or library that
517 # is built using GNU Libtool, you may include this file under the
518 # same distribution terms that you use for the rest of that program.
520 # GNU Libtool is distributed in the hope that it will be useful, but
521 # WITHOUT ANY WARRANTY; without even the implied warranty of
522 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
523 # General Public License for more details.
525 # You should have received a copy of the GNU General Public License
526 # along with this program. If not, see <http://www.gnu.org/licenses/>.
531 VERSION
="2.4.6 Debian-2.4.6-2"
532 package_revision
=2.4.6
539 # Run './libtool --help' for help with using this script from the
543 ## ------------------------------- ##
544 ## User overridable command paths. ##
545 ## ------------------------------- ##
547 # After configure completes, it has a better idea of some of the
548 # shell tools we need than the defaults used by the functions shared
549 # with bootstrap, so set those here where they can still be over-
550 # ridden by the user, but otherwise take precedence.
552 : ${AUTOCONF="autoconf"}
553 : ${AUTOMAKE="automake"}
556 ## -------------------------- ##
557 ## Source external libraries. ##
558 ## -------------------------- ##
560 # Much of our low-level functionality needs to be sourced from external
561 # libraries, which are installed to $pkgauxdir.
563 # Set a version string for this script.
564 scriptversion
=2015-01-20.17
; # UTC
566 # General shell script boiler plate, and helper functions.
567 # Written by Gary V. Vaughan, 2004
569 # Copyright (C) 2004-2015 Free Software Foundation, Inc.
570 # This is free software; see the source for copying conditions. There is NO
571 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
573 # This program is free software; you can redistribute it and/or modify
574 # it under the terms of the GNU General Public License as published by
575 # the Free Software Foundation; either version 3 of the License, or
576 # (at your option) any later version.
578 # As a special exception to the GNU General Public License, if you distribute
579 # this file as part of a program or library that is built using GNU Libtool,
580 # you may include this file under the same distribution terms that you use
581 # for the rest of that program.
583 # This program is distributed in the hope that it will be useful,
584 # but WITHOUT ANY WARRANTY; without even the implied warranty of
585 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
586 # General Public License for more details.
588 # You should have received a copy of the GNU General Public License
589 # along with this program. If not, see <http://www.gnu.org/licenses/>.
591 # Please report bugs or propose patches to gary@gnu.org.
598 # Evaluate this file near the top of your script to gain access to
599 # the functions and variables defined here:
601 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
603 # If you need to override any of the default environment variable
604 # settings, do that before evaluating this file.
607 ## -------------------- ##
608 ## Shell normalisation. ##
609 ## -------------------- ##
611 # Some shells need a little help to be as Bourne compatible as possible.
612 # Before doing anything else, make sure all that help has been provided!
614 DUALCASE
=1; export DUALCASE
# for MKS sh
615 if test -n "${ZSH_VERSION+set}" && (emulate sh
) >/dev
/null
2>&1; then :
618 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
619 # is contrary to our usage. Disable this feature.
620 alias -g '${1+"$@"}'='"$@"'
623 case `(set -o) 2>/dev/null` in *posix
*) set -o posix
;; esac
626 # NLS nuisances: We save the old values in case they are required later.
629 for _G_var
in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
631 eval "if test set = \"\${$_G_var+set}\"; then
632 save_$_G_var=\$$_G_var
635 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
636 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
641 (unset CDPATH
) >/dev
/null
2>&1 && unset CDPATH
643 # Make sure IFS has a sensible default
649 # There are apparently some retarded systems that use ';' as a PATH separator!
650 if test "${PATH_SEPARATOR+set}" != set; then
652 (PATH
='/bin;/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 && {
653 (PATH
='/bin:/bin'; FPATH
=$PATH; sh
-c :) >/dev
/null
2>&1 ||
660 ## ------------------------- ##
661 ## Locate command utilities. ##
662 ## ------------------------- ##
665 # func_executable_p FILE
666 # ----------------------
667 # Check that FILE is an executable regular file.
670 test -f "$1" && test -x "$1"
674 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
675 # --------------------------------------------
676 # Search for either a program that responds to --version with output
677 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
678 # trying all the directories in PATH with each of the elements of
681 # CHECK_FUNC should accept the path to a candidate program, and
682 # set $func_check_prog_result if it truncates its output less than
683 # $_G_path_prog_max characters.
691 _G_path_prog_found
=false
692 _G_save_IFS
=$IFS; IFS
=${PATH_SEPARATOR-:}
693 for _G_dir
in $_G_PATH; do
695 test -z "$_G_dir" && _G_dir
=.
696 for _G_prog_name
in $_G_progs_list; do
697 for _exeext
in '' .EXE
; do
698 _G_path_prog
=$_G_dir/$_G_prog_name$_exeext
699 func_executable_p
"$_G_path_prog" ||
continue
700 case `"$_G_path_prog" --version 2>&1` in
701 *GNU
*) func_path_progs_result
=$_G_path_prog _G_path_prog_found
=: ;;
702 *) $_G_check_func $_G_path_prog
703 func_path_progs_result
=$func_check_prog_result
706 $_G_path_prog_found && break 3
711 test -z "$func_path_progs_result" && {
712 echo "no acceptable sed could be found in \$PATH" >&2
718 # We want to be able to use the functions in this file before configure
719 # has figured out where the best binaries are kept, which means we have
720 # to search for them ourselves - except when the results are already set
721 # where we skip the searches.
723 # Unless the user overrides by setting SED, search the path for either GNU
724 # sed, or the sed that truncates its output the least.
726 _G_sed_script
=s
/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
/
727 for _G_i
in 1 2 3 4 5 6 7; do
728 _G_sed_script
=$_G_sed_script$nl$_G_sed_script
730 echo "$_G_sed_script" 2>/dev
/null |
sed 99q
>conftest.
sed
733 func_check_prog_sed
()
738 printf 0123456789 >conftest.
in
741 cat conftest.
in conftest.
in >conftest.tmp
742 mv conftest.tmp conftest.
in
743 cp conftest.
in conftest.
nl
744 echo '' >> conftest.
nl
745 "$_G_path_prog" -f conftest.
sed <conftest.
nl >conftest.out
2>/dev
/null ||
break
746 diff conftest.out conftest.
nl >/dev
/null
2>&1 ||
break
747 _G_count
=`expr $_G_count + 1`
748 if test "$_G_count" -gt "$_G_path_prog_max"; then
749 # Best one so far, save it but keep looking for a better one
750 func_check_prog_result
=$_G_path_prog
751 _G_path_prog_max
=$_G_count
753 # 10*(2^10) chars as input seems more than enough
754 test 10 -lt "$_G_count" && break
756 rm -f conftest.
in conftest.tmp conftest.
nl conftest.out
759 func_path_progs
"sed gsed" func_check_prog_sed
$PATH:/usr
/xpg
4/bin
761 SED
=$func_path_progs_result
765 # Unless the user overrides by setting GREP, search the path for either GNU
766 # grep, or the grep that truncates its output the least.
768 func_check_prog_grep
()
774 printf 0123456789 >conftest.
in
777 cat conftest.
in conftest.
in >conftest.tmp
778 mv conftest.tmp conftest.
in
779 cp conftest.
in conftest.
nl
780 echo 'GREP' >> conftest.
nl
781 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.
nl >conftest.out
2>/dev
/null ||
break
782 diff conftest.out conftest.
nl >/dev
/null
2>&1 ||
break
783 _G_count
=`expr $_G_count + 1`
784 if test "$_G_count" -gt "$_G_path_prog_max"; then
785 # Best one so far, save it but keep looking for a better one
786 func_check_prog_result
=$_G_path_prog
787 _G_path_prog_max
=$_G_count
789 # 10*(2^10) chars as input seems more than enough
790 test 10 -lt "$_G_count" && break
792 rm -f conftest.
in conftest.tmp conftest.
nl conftest.out
795 func_path_progs
"grep ggrep" func_check_prog_grep
$PATH:/usr
/xpg
4/bin
796 GREP
=$func_path_progs_result
800 ## ------------------------------- ##
801 ## User overridable command paths. ##
802 ## ------------------------------- ##
804 # All uppercase variable names are used for environment variables. These
805 # variables can be overridden by the user before calling a script that
806 # uses them if a suitable command of that name is not already available
807 # in the command search PATH.
810 : ${ECHO="printf %s\n"}
811 : ${EGREP="$GREP -E"}
812 : ${FGREP="$GREP -F"}
818 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
821 ## -------------------- ##
822 ## Useful sed snippets. ##
823 ## -------------------- ##
825 sed_dirname
='s|/[^/]*$||'
826 sed_basename
='s|^.*/||'
828 # Sed substitution that helps us do robust quoting. It backslashifies
829 # metacharacters that are still active within double-quoted strings.
830 sed_quote_subst
='s|\([`"$\\]\)|\\\1|g'
832 # Same as above, but do not quote variable references.
833 sed_double_quote_subst
='s/\(["`\\]\)/\\\1/g'
835 # Sed substitution that turns a string into a regex matching for the
837 sed_make_literal_regex
='s|[].[^$\\*\/]|\\&|g'
839 # Sed substitution that converts a w32 file name or path
840 # that contains forward slashes, into one that contains
841 # (escaped) backslashes. A very naive implementation.
842 sed_naive_backslashify
='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
844 # Re-'\' parameter expansions in output of sed_double_quote_subst that
845 # were '\'-ed in input to the same. If an odd number of '\' preceded a
846 # '$' in input to sed_double_quote_subst, that '$' was protected from
847 # expansion. Since each input '\' is now two '\'s, look for any number
848 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
853 sed_double_backslash
="\
856 s/^$_G_bs2$_G_dollar/$_G_bs&/
857 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
861 ## ----------------- ##
862 ## Global variables. ##
863 ## ----------------- ##
865 # Except for the global variables explicitly listed below, the following
866 # functions in the '^func_' namespace, and the '^require_' namespace
867 # variables initialised in the 'Resource management' section, sourcing
868 # this file will not pollute your global namespace with anything
869 # else. There's no portable way to scope variables in Bourne shell
870 # though, so actually running these functions will sometimes place
871 # results into a variable named after the function, and often use
872 # temporary variables in the '^_G_' namespace. If you are careful to
873 # avoid using those namespaces casually in your sourcing script, things
874 # should continue to work as you expect. And, of course, you can freely
875 # overwrite any of the functions or variables defined here before
876 # calling anything to customize them.
880 EXIT_MISMATCH
=63 # $? = 63 is used to indicate version mismatch to missing.
881 EXIT_SKIP
=77 # $? = 77 is used to indicate a skipped test to automake.
883 # Allow overriding, eg assuming that you follow the convention of
884 # putting '$debug_cmd' at the start of all your functions, you can get
885 # bash to show function call trace with:
887 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
888 debug_cmd
=${debug_cmd-":"}
891 # By convention, finish your script with:
895 # so that you can set exit_status to non-zero if you want to indicate
896 # something went wrong during execution without actually bailing out at
897 # the point of failure.
898 exit_status
=$EXIT_SUCCESS
900 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
901 # is ksh but when the shell is invoked as "sh" and the current value of
902 # the _XPG environment variable is not equal to 1 (one), the special
903 # positional parameter $0, within a function call, is the name of the
907 # The name of this program.
908 progname
=`$ECHO "$progpath" |$SED "$sed_basename"`
910 # Make sure we have an absolute progpath for reexecution:
912 [\\/]*|
[A-Za-z
]:\\*) ;;
914 progdir
=`$ECHO "$progpath" |$SED "$sed_dirname"`
915 progdir
=`cd "$progdir" && pwd`
916 progpath
=$progdir/$progname
920 IFS
=${PATH_SEPARATOR-:}
921 for progdir
in $PATH; do
923 test -x "$progdir/$progname" && break
926 test -n "$progdir" || progdir
=`pwd`
927 progpath
=$progdir/$progname
932 ## ----------------- ##
933 ## Standard options. ##
934 ## ----------------- ##
936 # The following options affect the operation of the functions defined
937 # below, and should be set appropriately depending on run-time para-
938 # meters passed on the command line.
944 # Categories 'all' and 'none' are always available. Append any others
945 # you will pass as the first argument to func_warning from your own
949 # By default, display warnings according to 'opt_warning_types'. Set
950 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
951 # treat the next displayed warning as a fatal error.
952 warning_func
=func_warn_and_continue
954 # Set to 'all' to display all warnings, 'none' to suppress all
955 # warnings, or a space delimited list of some subset of
956 # 'warning_categories' to display only the listed warnings.
957 opt_warning_types
=all
960 ## -------------------- ##
961 ## Resource management. ##
962 ## -------------------- ##
964 # This section contains definitions for functions that each ensure a
965 # particular resource (a file, or a non-empty configuration variable for
966 # example) is available, and if appropriate to extract default values
967 # from pertinent package files. Call them using their associated
968 # 'require_*' variable to ensure that they are executed, at most, once.
970 # It's entirely deliberate that calling these functions can set
971 # variables that don't obey the namespace limitations obeyed by the rest
972 # of this file, in order that that they be as useful as possible to
976 # require_term_colors
977 # -------------------
978 # Allow display of bold text on terminals that support it.
979 require_term_colors
=func_require_term_colors
980 func_require_term_colors
()
985 # COLORTERM and USE_ANSI_COLORS environment variables take
986 # precedence, because most terminfo databases neglect to describe
987 # whether color sequences are supported.
988 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
990 if test 1 = "$USE_ANSI_COLORS"; then
991 # Standard ANSI escape sequences
993 tc_bold
='\e[1m'; tc_standout
='\e[7m'
994 tc_red
='\e[31m'; tc_green
='\e[32m'
995 tc_blue
='\e[34m'; tc_cyan
='\e[36m'
997 # Otherwise trust the terminfo database after all.
998 test -n "`tput sgr0 2>/dev/null`" && {
1000 test -n "`tput bold 2>/dev/null`" && tc_bold
=`tput bold`
1001 tc_standout
=$tc_bold
1002 test -n "`tput smso 2>/dev/null`" && tc_standout
=`tput smso`
1003 test -n "`tput setaf 1 2>/dev/null`" && tc_red
=`tput setaf 1`
1004 test -n "`tput setaf 2 2>/dev/null`" && tc_green
=`tput setaf 2`
1005 test -n "`tput setaf 4 2>/dev/null`" && tc_blue
=`tput setaf 4`
1006 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan
=`tput setaf 5`
1011 require_term_colors
=:
1015 ## ----------------- ##
1016 ## Function library. ##
1017 ## ----------------- ##
1019 # This section contains a variety of useful functions to call in your
1020 # scripts. Take note of the portable wrappers for features provided by
1021 # some modern shells, which will fall back to slower equivalents on
1022 # less featureful shells.
1025 # func_append VAR VALUE
1026 # ---------------------
1027 # Append VALUE onto the existing contents of VAR.
1029 # We should try to minimise forks, especially on Windows where they are
1030 # unreasonably slow, so skip the feature probes when bash or zsh are
1032 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
1033 : ${_G_HAVE_ARITH_OP="yes"}
1034 : ${_G_HAVE_XSI_OPS="yes"}
1035 # The += operator was introduced in bash 3.1
1036 case $BASH_VERSION in
1037 [12].
* |
3.0 |
3.0*) ;;
1039 : ${_G_HAVE_PLUSEQ_OP="yes"}
1045 # Can be empty, in which case the shell is probed, "yes" if += is
1046 # useable or anything else if it does not work.
1047 test -z "$_G_HAVE_PLUSEQ_OP" \
1048 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev
/null \
1049 && _G_HAVE_PLUSEQ_OP
=yes
1051 if test yes = "$_G_HAVE_PLUSEQ_OP"
1053 # This is an XSI compatible shell, allowing a faster implementation...
1054 eval 'func_append ()
1061 # ...otherwise fall back to using expr, which is often a shell builtin.
1071 # func_append_quoted VAR VALUE
1072 # ----------------------------
1073 # Quote VALUE and append to the end of shell variable VAR, separated
1075 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
1076 eval 'func_append_quoted ()
1080 func_quote_for_eval "$2"
1081 eval "$1+=\\ \$func_quote_for_eval_result"
1084 func_append_quoted
()
1088 func_quote_for_eval
"$2"
1089 eval "$1=\$$1\\ \$func_quote_for_eval_result"
1094 # func_append_uniq VAR VALUE
1095 # --------------------------
1096 # Append unique VALUE onto the existing contents of VAR, assuming
1097 # entries are delimited by the first character of VALUE. For example:
1099 # func_append_uniq options " --another-option option-argument"
1101 # will only append to $options if " --another-option option-argument "
1102 # is not already present somewhere in $options already (note spaces at
1103 # each end implied by leading space in second argument).
1108 eval _G_current_value
='`$ECHO $'$1'`'
1109 _G_delim
=`expr "$2" : '\(.\)'`
1111 case $_G_delim$_G_current_value$_G_delim in
1113 *) func_append
"$@" ;;
1118 # func_arith TERM...
1119 # ------------------
1120 # Set func_arith_result to the result of evaluating TERMs.
1121 test -z "$_G_HAVE_ARITH_OP" \
1122 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev
/null \
1123 && _G_HAVE_ARITH_OP
=yes
1125 if test yes = "$_G_HAVE_ARITH_OP"; then
1130 func_arith_result=$(( $* ))
1137 func_arith_result
=`expr "$@"`
1142 # func_basename FILE
1143 # ------------------
1144 # Set func_basename_result to FILE with everything up to and including
1145 # the last / stripped.
1146 if test yes = "$_G_HAVE_XSI_OPS"; then
1147 # If this shell supports suffix pattern removal, then use it to avoid
1148 # forking. Hide the definitions single quotes in case the shell chokes
1149 # on unsupported syntax...
1150 _b
='func_basename_result=${1##*/}'
1152 */*) func_dirname_result=${1%/*}$2 ;;
1153 * ) func_dirname_result=$3 ;;
1157 # ...otherwise fall back to using sed.
1158 _b
='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
1159 _d
='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
1160 if test "X$func_dirname_result" = "X$1"; then
1161 func_dirname_result=$3
1163 func_append func_dirname_result "$2"
1167 eval 'func_basename ()
1175 # func_dirname FILE APPEND NONDIR_REPLACEMENT
1176 # -------------------------------------------
1177 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
1178 # otherwise set result to NONDIR_REPLACEMENT.
1179 eval 'func_dirname ()
1187 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
1188 # --------------------------------------------------------
1189 # Perform func_basename and func_dirname in a single function
1191 # dirname: Compute the dirname of FILE. If nonempty,
1192 # add APPEND to the result, otherwise set result
1193 # to NONDIR_REPLACEMENT.
1194 # value returned in "$func_dirname_result"
1195 # basename: Compute filename of FILE.
1196 # value retuned in "$func_basename_result"
1197 # For efficiency, we do not delegate to the functions above but instead
1198 # duplicate the functionality here.
1199 eval 'func_dirname_and_basename ()
1210 # Echo program name prefixed message.
1219 for _G_line
in $_G_message; do
1221 $ECHO "$progname: $_G_line"
1227 # func_echo_all ARG...
1228 # --------------------
1229 # Invoke $ECHO with all args, space-separated.
1236 # func_echo_infix_1 INFIX ARG...
1237 # ------------------------------
1238 # Echo program name, followed by INFIX on the first line, with any
1239 # additional lines not showing INFIX.
1240 func_echo_infix_1
()
1244 $require_term_colors
1248 _G_prefix
="$progname: $_G_infix: "
1251 # Strip color escape sequences before counting printable length
1252 for _G_tc
in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
1254 test -n "$_G_tc" && {
1255 _G_esc_tc
=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
1256 _G_indent
=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
1259 _G_indent
="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
1261 func_echo_infix_1_IFS
=$IFS
1263 for _G_line
in $_G_message; do
1264 IFS
=$func_echo_infix_1_IFS
1265 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
1266 _G_prefix
=$_G_indent
1268 IFS
=$func_echo_infix_1_IFS
1274 # Echo program name prefixed message to standard error.
1279 $require_term_colors
1281 func_echo_infix_1
" $tc_standout${tc_red}error$tc_reset" "$*" >&2
1285 # func_fatal_error ARG...
1286 # -----------------------
1287 # Echo program name prefixed message to standard error, and exit.
1297 # func_grep EXPRESSION FILENAME
1298 # -----------------------------
1299 # Check whether EXPRESSION matches any line of FILENAME, without output.
1304 $GREP "$1" "$2" >/dev
/null
2>&1
1310 # Set func_len_result to the length of STRING. STRING may not
1311 # start with a hyphen.
1312 test -z "$_G_HAVE_XSI_OPS" \
1314 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev
/null \
1315 && _G_HAVE_XSI_OPS
=yes
1317 if test yes = "$_G_HAVE_XSI_OPS"; then
1322 func_len_result=${#1}
1329 func_len_result
=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
1334 # func_mkdir_p DIRECTORY-PATH
1335 # ---------------------------
1336 # Make sure the entire path to DIRECTORY-PATH is available.
1341 _G_directory_path
=$1
1344 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
1346 # Protect directory names starting with '-'
1347 case $_G_directory_path in
1348 -*) _G_directory_path
=.
/$_G_directory_path ;;
1351 # While some portion of DIR does not yet exist...
1352 while test ! -d "$_G_directory_path"; do
1353 # ...make a list in topmost first order. Use a colon delimited
1354 # list incase some portion of path contains whitespace.
1355 _G_dir_list
=$_G_directory_path:$_G_dir_list
1357 # If the last portion added has no slash in it, the list is done
1358 case $_G_directory_path in */*) ;; *) break ;; esac
1360 # ...otherwise throw away the child directory and loop
1361 _G_directory_path
=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
1363 _G_dir_list
=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
1365 func_mkdir_p_IFS
=$IFS; IFS
=:
1366 for _G_dir
in $_G_dir_list; do
1367 IFS
=$func_mkdir_p_IFS
1368 # mkdir can fail with a 'File exist' error if two processes
1369 # try to create one of the directories concurrently. Don't
1370 # stop in that case!
1371 $MKDIR "$_G_dir" 2>/dev
/null ||
:
1373 IFS
=$func_mkdir_p_IFS
1375 # Bail out if we (or some other process) failed to create a directory.
1376 test -d "$_G_directory_path" || \
1377 func_fatal_error
"Failed to create '$1'"
1382 # func_mktempdir [BASENAME]
1383 # -------------------------
1384 # Make a temporary directory that won't clash with other running
1385 # libtool processes, and avoids race conditions if possible. If
1386 # given, BASENAME is the basename for that directory.
1391 _G_template
=${TMPDIR-/tmp}/${1-$progname}
1393 if test : = "$opt_dry_run"; then
1394 # Return a directory name, but don't create it in dry-run mode
1395 _G_tmpdir
=$_G_template-$$
1398 # If mktemp works, use that first and foremost
1399 _G_tmpdir
=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
1401 if test ! -d "$_G_tmpdir"; then
1402 # Failing that, at least try and use $RANDOM to avoid a race
1403 _G_tmpdir
=$_G_template-${RANDOM-0}$$
1405 func_mktempdir_umask
=`umask`
1408 umask $func_mktempdir_umask
1411 # If we're not in dry-run mode, bomb out on failure
1412 test -d "$_G_tmpdir" || \
1413 func_fatal_error
"cannot create temporary directory '$_G_tmpdir'"
1420 # func_normal_abspath PATH
1421 # ------------------------
1422 # Remove doubled-up and trailing slashes, "." path components,
1423 # and cancel out any ".." path components in PATH after making
1424 # it an absolute path.
1425 func_normal_abspath
()
1429 # These SED scripts presuppose an absolute path with a trailing slash.
1430 _G_pathcar
='s|^/\([^/]*\).*$|\1|'
1431 _G_pathcdr
='s|^/[^/]*||'
1432 _G_removedotparts
=':dotsl
1436 _G_collapseslashes
='s|/\{1,\}|/|g'
1437 _G_finalslash
='s|/*$|/|'
1439 # Start from root dir and reassemble the path.
1440 func_normal_abspath_result
=
1441 func_normal_abspath_tpath
=$1
1442 func_normal_abspath_altnamespace
=
1443 case $func_normal_abspath_tpath in
1445 # Empty path, that just means $cwd.
1446 func_stripname
'' '/' "`pwd`"
1447 func_normal_abspath_result
=$func_stripname_result
1450 # The next three entries are used to spot a run of precisely
1451 # two leading slashes without using negated character classes;
1452 # we take advantage of case's first-match behaviour.
1454 # Unusual form of absolute path, do nothing.
1457 # Not necessarily an ordinary path; POSIX reserves leading '//'
1458 # and for example Cygwin uses it to access remote file shares
1459 # over CIFS/SMB, so we conserve a leading double slash if found.
1460 func_normal_abspath_altnamespace
=/
1463 # Absolute path, do nothing.
1466 # Relative path, prepend $cwd.
1467 func_normal_abspath_tpath
=`pwd`/$func_normal_abspath_tpath
1471 # Cancel out all the simple stuff to save iterations. We also want
1472 # the path to end with a slash for ease of parsing, so make sure
1473 # there is one (and only one) here.
1474 func_normal_abspath_tpath
=`$ECHO "$func_normal_abspath_tpath" | $SED \
1475 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
1477 # Processed it all yet?
1478 if test / = "$func_normal_abspath_tpath"; then
1479 # If we ascended to the root using ".." the result may be empty now.
1480 if test -z "$func_normal_abspath_result"; then
1481 func_normal_abspath_result
=/
1485 func_normal_abspath_tcomponent
=`$ECHO "$func_normal_abspath_tpath" | $SED \
1487 func_normal_abspath_tpath
=`$ECHO "$func_normal_abspath_tpath" | $SED \
1489 # Figure out what to do with it
1490 case $func_normal_abspath_tcomponent in
1492 # Trailing empty path component, ignore it.
1495 # Parent dir; strip last assembled component from result.
1496 func_dirname
"$func_normal_abspath_result"
1497 func_normal_abspath_result
=$func_dirname_result
1500 # Actual path component, append it.
1501 func_append func_normal_abspath_result
"/$func_normal_abspath_tcomponent"
1505 # Restore leading double-slash if one was found on entry.
1506 func_normal_abspath_result
=$func_normal_abspath_altnamespace$func_normal_abspath_result
1510 # func_notquiet ARG...
1511 # --------------------
1512 # Echo program name prefixed message only when not in quiet mode.
1517 $opt_quiet || func_echo
${1+"$@"}
1519 # A bug in bash halts the script if the last line of a function
1520 # fails when set -e is in force, so we need another command to
1526 # func_relative_path SRCDIR DSTDIR
1527 # --------------------------------
1528 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1529 func_relative_path
()
1533 func_relative_path_result
=
1534 func_normal_abspath
"$1"
1535 func_relative_path_tlibdir
=$func_normal_abspath_result
1536 func_normal_abspath
"$2"
1537 func_relative_path_tbindir
=$func_normal_abspath_result
1539 # Ascend the tree starting from libdir
1541 # check if we have found a prefix of bindir
1542 case $func_relative_path_tbindir in
1543 $func_relative_path_tlibdir)
1544 # found an exact match
1545 func_relative_path_tcancelled
=
1548 $func_relative_path_tlibdir*)
1549 # found a matching prefix
1550 func_stripname
"$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1551 func_relative_path_tcancelled
=$func_stripname_result
1552 if test -z "$func_relative_path_result"; then
1553 func_relative_path_result
=.
1558 func_dirname
$func_relative_path_tlibdir
1559 func_relative_path_tlibdir
=$func_dirname_result
1560 if test -z "$func_relative_path_tlibdir"; then
1561 # Have to descend all the way to the root!
1562 func_relative_path_result
=..
/$func_relative_path_result
1563 func_relative_path_tcancelled
=$func_relative_path_tbindir
1566 func_relative_path_result
=..
/$func_relative_path_result
1571 # Now calculate path; take care to avoid doubling-up slashes.
1572 func_stripname
'' '/' "$func_relative_path_result"
1573 func_relative_path_result
=$func_stripname_result
1574 func_stripname
'/' '/' "$func_relative_path_tcancelled"
1575 if test -n "$func_stripname_result"; then
1576 func_append func_relative_path_result
"/$func_stripname_result"
1579 # Normalisation. If bindir is libdir, return '.' else relative path.
1580 if test -n "$func_relative_path_result"; then
1581 func_stripname
'./' '' "$func_relative_path_result"
1582 func_relative_path_result
=$func_stripname_result
1585 test -n "$func_relative_path_result" || func_relative_path_result
=.
1591 # func_quote_for_eval ARG...
1592 # --------------------------
1593 # Aesthetically quote ARGs to be evaled later.
1594 # This function returns two values:
1595 # i) func_quote_for_eval_result
1596 # double-quoted, suitable for a subsequent eval
1597 # ii) func_quote_for_eval_unquoted_result
1598 # has all characters that are still active within double
1599 # quotes backslashified.
1600 func_quote_for_eval
()
1604 func_quote_for_eval_unquoted_result
=
1605 func_quote_for_eval_result
=
1606 while test 0 -lt $#; do
1609 _G_unquoted_arg=`printf '%s\n' "$1" |
$SED "$sed_quote_subst"` ;;
1611 _G_unquoted_arg=$1 ;;
1613 if test -n "$func_quote_for_eval_unquoted_result"; then
1614 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
1616 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
1619 case $_G_unquoted_arg in
1620 # Double-quote args containing shell metacharacters to delay
1621 # word splitting, command substitution and variable expansion
1622 # for a subsequent eval.
1623 # Many Bourne shells cannot handle close brackets correctly
1624 # in scan sets, so we specify it separately.
1625 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1626 _G_quoted_arg=\"$_G_unquoted_arg\"
1629 _G_quoted_arg=$_G_unquoted_arg
1633 if test -n "$func_quote_for_eval_result"; then
1634 func_append func_quote_for_eval_result " $_G_quoted_arg"
1636 func_append func_quote_for_eval_result "$_G_quoted_arg"
1643 # func_quote_for_expand ARG
1644 # -------------------------
1645 # Aesthetically quote ARG to be evaled later; same as above,
1646 # but do not quote variable references.
1647 func_quote_for_expand ()
1653 _G_arg
=`$ECHO "$1" | $SED \
1654 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
1660 # Double-quote args containing shell metacharacters to delay
1661 # word splitting and command substitution for a subsequent eval.
1662 # Many Bourne shells cannot handle close brackets correctly
1663 # in scan sets, so we specify it separately.
1664 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1669 func_quote_for_expand_result
=$_G_arg
1673 # func_stripname PREFIX SUFFIX NAME
1674 # ---------------------------------
1675 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1676 # PREFIX and SUFFIX must not contain globbing or regex special
1677 # characters, hashes, percent signs, but SUFFIX may contain a leading
1678 # dot (in which case that matches only a dot).
1679 if test yes = "$_G_HAVE_XSI_OPS"; then
1680 eval 'func_stripname ()
1684 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1685 # positional parameters, so assign one to ordinary variable first.
1686 func_stripname_result=$3
1687 func_stripname_result=${func_stripname_result#"$1"}
1688 func_stripname_result=${func_stripname_result%"$2"}
1696 .
*) func_stripname_result
=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1697 *) func_stripname_result
=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1703 # func_show_eval CMD [FAIL_EXP]
1704 # -----------------------------
1705 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1706 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1707 # is given, then evaluate it.
1713 _G_fail_exp
=${2-':'}
1715 func_quote_for_expand
"$_G_cmd"
1716 eval "func_notquiet $func_quote_for_expand_result"
1721 if test 0 -ne "$_G_status"; then
1722 eval "(exit $_G_status); $_G_fail_exp"
1728 # func_show_eval_locale CMD [FAIL_EXP]
1729 # ------------------------------------
1730 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1731 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1732 # is given, then evaluate it. Use the saved locale for evaluation.
1733 func_show_eval_locale
()
1738 _G_fail_exp
=${2-':'}
1741 func_quote_for_expand
"$_G_cmd"
1742 eval "func_echo $func_quote_for_expand_result"
1746 eval "$_G_user_locale
1749 eval "$_G_safe_locale"
1750 if test 0 -ne "$_G_status"; then
1751 eval "(exit $_G_status); $_G_fail_exp"
1759 # Turn $1 into a string suitable for a shell variable name.
1760 # Result is stored in $func_tr_sh_result. All characters
1761 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1762 # if $1 begins with a digit, a '_' is prepended as well.
1768 [0-9]* |
*[!a-zA-Z0-9_
]*)
1769 func_tr_sh_result
=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1772 func_tr_sh_result
=$1
1778 # func_verbose ARG...
1779 # -------------------
1780 # Echo program name prefixed message in verbose mode only.
1785 $opt_verbose && func_echo
"$*"
1791 # func_warn_and_continue ARG...
1792 # -----------------------------
1793 # Echo program name prefixed warning message to standard error.
1794 func_warn_and_continue
()
1798 $require_term_colors
1800 func_echo_infix_1
"${tc_red}warning$tc_reset" "$*" >&2
1804 # func_warning CATEGORY ARG...
1805 # ----------------------------
1806 # Echo program name prefixed warning message to standard error. Warning
1807 # messages can be filtered according to CATEGORY, where this function
1808 # elides messages where CATEGORY is not listed in the global variable
1809 # 'opt_warning_types'.
1814 # CATEGORY must be in the warning_categories list!
1815 case " $warning_categories " in
1817 *) func_internal_error
"invalid warning category '$1'" ;;
1823 case " $opt_warning_types " in
1824 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1829 # func_sort_ver VER1 VER2
1830 # -----------------------
1831 # 'sort -V' is not generally available.
1832 # Note this deviates from the version comparison in automake
1833 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1834 # but this should suffice as we won't be specifying old
1835 # version formats or redundant trailing .0 in bootstrap.conf.
1836 # If we did want full compatibility then we should probably
1837 # use m4_version_compare from autoconf.
1842 printf '%s\n%s\n' "$1" "$2" \
1843 |
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
1846 # func_lt_ver PREV CURR
1847 # ---------------------
1848 # Return true if PREV and CURR are in the correct order according to
1849 # func_sort_ver, otherwise false. Use it like this:
1851 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1856 test "x$1" = x
`func_sort_ver "$1" "$2" | $SED 1q`
1861 # mode: shell-script
1863 # eval: (add-hook 'before-save-hook 'time-stamp)
1864 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1865 # time-stamp-time-zone: "UTC"
1869 # Set a version string for this script.
1870 scriptversion
=2014-01-07.03
; # UTC
1872 # A portable, pluggable option parser for Bourne shell.
1873 # Written by Gary V. Vaughan, 2010
1875 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
1876 # This is free software; see the source for copying conditions. There is NO
1877 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1879 # This program is free software: you can redistribute it and/or modify
1880 # it under the terms of the GNU General Public License as published by
1881 # the Free Software Foundation, either version 3 of the License, or
1882 # (at your option) any later version.
1884 # This program is distributed in the hope that it will be useful,
1885 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1886 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1887 # GNU General Public License for more details.
1889 # You should have received a copy of the GNU General Public License
1890 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1892 # Please report bugs or propose patches to gary@gnu.org.
1899 # This file is a library for parsing options in your shell scripts along
1900 # with assorted other useful supporting features that you can make use
1903 # For the simplest scripts you might need only:
1906 # . relative/path/to/funclib.sh
1907 # . relative/path/to/options-parser
1909 # func_options ${1+"$@"}
1910 # eval set dummy "$func_options_result"; shift
1911 # ...rest of your script...
1913 # In order for the '--version' option to work, you will need to have a
1914 # suitably formatted comment like the one at the top of this file
1915 # starting with '# Written by ' and ending with '# warranty; '.
1917 # For '-h' and '--help' to work, you will also need a one line
1918 # description of your script's purpose in a comment directly above the
1919 # '# Written by ' line, like the one at the top of this file.
1921 # The default options also support '--debug', which will turn on shell
1922 # execution tracing (see the comment above debug_cmd below for another
1923 # use), and '--verbose' and the func_verbose function to allow your script
1924 # to display verbose messages only when your user has specified
1927 # After sourcing this file, you can plug processing for additional
1928 # options by amending the variables from the 'Configuration' section
1929 # below, and following the instructions in the 'Option parsing'
1930 # section further down.
1932 ## -------------- ##
1933 ## Configuration. ##
1934 ## -------------- ##
1936 # You should override these variables in your script after sourcing this
1937 # file so that they reflect the customisations you have added to the
1940 # The usage line for option parsing errors and the start of '-h' and
1941 # '--help' output messages. You can embed shell variables for delayed
1942 # expansion at the time the message is displayed, but you will need to
1943 # quote other shell meta-characters carefully to prevent them being
1944 # expanded when the contents are evaled.
1945 usage
='$progpath [OPTION]...'
1947 # Short help message in response to '-h' and '--help'. Add to this or
1948 # override it after sourcing this library to reflect the full set of
1949 # options your script accepts.
1951 --debug enable verbose shell tracing
1952 -W, --warnings=CATEGORY
1953 report the warnings falling in CATEGORY [all]
1954 -v, --verbose verbosely report processing
1955 --version print version information and exit
1956 -h, --help print short or long help message and exit
1959 # Additional text appended to 'usage_message' in response to '--help'.
1961 Warning categories include:
1962 'all' show all warnings
1963 'none' turn off all the warnings
1964 'error' warnings are treated as fatal errors"
1966 # Help message printed before fatal option parsing errors.
1967 fatal_help
="Try '\$progname --help' for more information."
1971 ## ------------------------- ##
1972 ## Hook function management. ##
1973 ## ------------------------- ##
1975 # This section contains functions for adding, removing, and running hooks
1976 # to the main code. A hook is just a named list of of function, that can
1977 # be run in order later on.
1979 # func_hookable FUNC_NAME
1980 # -----------------------
1981 # Declare that FUNC_NAME will run hooks added with
1982 # 'func_add_hook FUNC_NAME ...'.
1987 func_append hookable_fns
" $1"
1991 # func_add_hook FUNC_NAME HOOK_FUNC
1992 # ---------------------------------
1993 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
1994 # first have been declared "hookable" by a call to 'func_hookable'.
1999 case " $hookable_fns " in
2001 *) func_fatal_error
"'$1' does not accept hook functions." ;;
2004 eval func_append
${1}_hooks
'" $2"'
2008 # func_remove_hook FUNC_NAME HOOK_FUNC
2009 # ------------------------------------
2010 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
2015 eval ${1}_hooks
='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
2019 # func_run_hooks FUNC_NAME [ARG]...
2020 # ---------------------------------
2021 # Run all hook functions registered to FUNC_NAME.
2022 # It is assumed that the list of hook functions contains nothing more
2023 # than a whitespace-delimited list of legal shell function names, and
2024 # no effort is wasted trying to catch shell meta-characters or preserve
2030 case " $hookable_fns " in
2032 *) func_fatal_error
"'$1' does not support hook funcions.n" ;;
2035 eval _G_hook_fns
=\$
$1_hooks; shift
2037 for _G_hook
in $_G_hook_fns; do
2038 eval $_G_hook '"$@"'
2040 # store returned options list back into positional
2041 # parameters for next 'cmd' execution.
2042 eval _G_hook_result
=\$
${_G_hook}_result
2043 eval set dummy
"$_G_hook_result"; shift
2046 func_quote_for_eval
${1+"$@"}
2047 func_run_hooks_result
=$func_quote_for_eval_result
2052 ## --------------- ##
2053 ## Option parsing. ##
2054 ## --------------- ##
2056 # In order to add your own option parsing hooks, you must accept the
2057 # full positional parameter list in your hook function, remove any
2058 # options that you action, and then pass back the remaining unprocessed
2059 # options in '<hooked_function_name>_result', escaped suitably for
2060 # 'eval'. Like this:
2062 # my_options_prep ()
2066 # # Extend the existing usage message.
2067 # usage_message=$usage_message'
2068 # -s, --silent don'\''t print informational messages
2071 # func_quote_for_eval ${1+"$@"}
2072 # my_options_prep_result=$func_quote_for_eval_result
2074 # func_add_hook func_options_prep my_options_prep
2077 # my_silent_option ()
2081 # # Note that for efficiency, we parse as many options as we can
2082 # # recognise in a loop before passing the remainder back to the
2083 # # caller on the first unrecognised argument we encounter.
2084 # while test $# -gt 0; do
2087 # --silent|-s) opt_silent=: ;;
2088 # # Separate non-argument short options:
2089 # -s*) func_split_short_opt "$_G_opt"
2090 # set dummy "$func_split_short_opt_name" \
2091 # "-$func_split_short_opt_arg" ${1+"$@"}
2094 # *) set dummy "$_G_opt" "$*"; shift; break ;;
2098 # func_quote_for_eval ${1+"$@"}
2099 # my_silent_option_result=$func_quote_for_eval_result
2101 # func_add_hook func_parse_options my_silent_option
2104 # my_option_validation ()
2108 # $opt_silent && $opt_verbose && func_fatal_help "\
2109 # '--silent' and '--verbose' options are mutually exclusive."
2111 # func_quote_for_eval ${1+"$@"}
2112 # my_option_validation_result=$func_quote_for_eval_result
2114 # func_add_hook func_validate_options my_option_validation
2116 # You'll alse need to manually amend $usage_message to reflect the extra
2117 # options you parse. It's preferable to append if you can, so that
2118 # multiple option parsing hooks can be added safely.
2121 # func_options [ARG]...
2122 # ---------------------
2123 # All the functions called inside func_options are hookable. See the
2124 # individual implementations for details.
2125 func_hookable func_options
2130 func_options_prep
${1+"$@"}
2131 eval func_parse_options \
2132 ${func_options_prep_result+"$func_options_prep_result"}
2133 eval func_validate_options \
2134 ${func_parse_options_result+"$func_parse_options_result"}
2136 eval func_run_hooks func_options \
2137 ${func_validate_options_result+"$func_validate_options_result"}
2139 # save modified positional parameters for caller
2140 func_options_result
=$func_run_hooks_result
2144 # func_options_prep [ARG]...
2145 # --------------------------
2146 # All initialisations required before starting the option parse loop.
2147 # Note that when calling hook functions, we pass through the list of
2148 # positional parameters. If a hook function modifies that list, and
2149 # needs to propogate that back to rest of this script, then the complete
2150 # modified list must be put in 'func_run_hooks_result' before
2152 func_hookable func_options_prep
2153 func_options_prep
()
2161 func_run_hooks func_options_prep
${1+"$@"}
2163 # save modified positional parameters for caller
2164 func_options_prep_result
=$func_run_hooks_result
2168 # func_parse_options [ARG]...
2169 # ---------------------------
2170 # The main option parsing loop.
2171 func_hookable func_parse_options
2172 func_parse_options
()
2176 func_parse_options_result
=
2178 # this just eases exit handling
2179 while test $# -gt 0; do
2180 # Defer to hook functions for initial option parsing, so they
2181 # get priority in the event of reusing an option name.
2182 func_run_hooks func_parse_options
${1+"$@"}
2184 # Adjust func_parse_options positional parameters to match
2185 eval set dummy
"$func_run_hooks_result"; shift
2187 # Break out of the loop if we already parsed every option.
2188 test $# -gt 0 ||
break
2193 --debug|
-x) debug_cmd
='set -x'
2194 func_echo
"enabling shell trace mode"
2198 --no-warnings|
--no-warning|
--no-warn)
2199 set dummy
--warnings none
${1+"$@"}
2203 --warnings|
--warning|
-W)
2204 test $# = 0 && func_missing_arg
$_G_opt && break
2205 case " $warning_categories $1" in
2207 # trailing space prevents matching last $1 above
2208 func_append_uniq opt_warning_types
" $1"
2211 opt_warning_types
=$warning_categories
2214 opt_warning_types
=none
2218 opt_warning_types
=$warning_categories
2219 warning_func
=func_fatal_error
2223 "unsupported warning category: '$1'"
2229 --verbose|
-v) opt_verbose
=: ;;
2230 --version) func_version
;;
2231 -\?|
-h) func_usage
;;
2232 --help) func_help
;;
2234 # Separate optargs to long options (plugins may need this):
2235 --*=*) func_split_equals
"$_G_opt"
2236 set dummy
"$func_split_equals_lhs" \
2237 "$func_split_equals_rhs" ${1+"$@"}
2241 # Separate optargs to short options:
2243 func_split_short_opt
"$_G_opt"
2244 set dummy
"$func_split_short_opt_name" \
2245 "$func_split_short_opt_arg" ${1+"$@"}
2249 # Separate non-argument short options:
2251 func_split_short_opt
"$_G_opt"
2252 set dummy
"$func_split_short_opt_name" \
2253 "-$func_split_short_opt_arg" ${1+"$@"}
2258 -*) func_fatal_help
"unrecognised option: '$_G_opt'" ;;
2259 *) set dummy
"$_G_opt" ${1+"$@"}; shift; break ;;
2263 # save modified positional parameters for caller
2264 func_quote_for_eval
${1+"$@"}
2265 func_parse_options_result
=$func_quote_for_eval_result
2269 # func_validate_options [ARG]...
2270 # ------------------------------
2271 # Perform any sanity checks on option settings and/or unconsumed
2273 func_hookable func_validate_options
2274 func_validate_options
()
2278 # Display all warnings if -W was not given.
2279 test -n "$opt_warning_types" || opt_warning_types
=" $warning_categories"
2281 func_run_hooks func_validate_options
${1+"$@"}
2283 # Bail if the options were screwed!
2284 $exit_cmd $EXIT_FAILURE
2286 # save modified positional parameters for caller
2287 func_validate_options_result
=$func_run_hooks_result
2292 ## ----------------- ##
2293 ## Helper functions. ##
2294 ## ----------------- ##
2296 # This section contains the helper functions used by the rest of the
2297 # hookable option parser framework in ascii-betical order.
2300 # func_fatal_help ARG...
2301 # ----------------------
2302 # Echo program name prefixed message to standard error, followed by
2303 # a help hint, and exit.
2308 eval \
$ECHO \""Usage: $usage"\"
2309 eval \
$ECHO \""$fatal_help"\"
2310 func_error
${1+"$@"}
2317 # Echo long help message to standard output and exit.
2323 $ECHO "$long_help_message"
2328 # func_missing_arg ARGNAME
2329 # ------------------------
2330 # Echo program name prefixed message to standard error and set global
2336 func_error
"Missing argument for '$1'."
2341 # func_split_equals STRING
2342 # ------------------------
2343 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
2344 # splitting STRING at the '=' sign.
2345 test -z "$_G_HAVE_XSI_OPS" \
2347 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev
/null \
2348 && _G_HAVE_XSI_OPS
=yes
2350 if test yes = "$_G_HAVE_XSI_OPS"
2352 # This is an XSI compatible shell, allowing a faster implementation...
2353 eval 'func_split_equals ()
2357 func_split_equals_lhs=${1%%=*}
2358 func_split_equals_rhs=${1#*=}
2359 test "x$func_split_equals_lhs" = "x$1" \
2360 && func_split_equals_rhs=
2363 # ...otherwise fall back to using expr, which is often a shell builtin.
2364 func_split_equals
()
2368 func_split_equals_lhs
=`expr "x$1" : 'x\([^=]*\)'`
2369 func_split_equals_rhs
=
2370 test "x$func_split_equals_lhs" = "x$1" \
2371 || func_split_equals_rhs
=`expr "x$1" : 'x[^=]*=\(.*\)$'`
2373 fi #func_split_equals
2376 # func_split_short_opt SHORTOPT
2377 # -----------------------------
2378 # Set func_split_short_opt_name and func_split_short_opt_arg shell
2379 # variables after splitting SHORTOPT after the 2nd character.
2380 if test yes = "$_G_HAVE_XSI_OPS"
2382 # This is an XSI compatible shell, allowing a faster implementation...
2383 eval 'func_split_short_opt ()
2387 func_split_short_opt_arg=${1#??}
2388 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
2391 # ...otherwise fall back to using expr, which is often a shell builtin.
2392 func_split_short_opt
()
2396 func_split_short_opt_name
=`expr "x$1" : 'x-\(.\)'`
2397 func_split_short_opt_arg
=`expr "x$1" : 'x-.\(.*\)$'`
2399 fi #func_split_short_opt
2404 # Echo short help message to standard output and exit.
2410 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
2415 # func_usage_message
2416 # ------------------
2417 # Echo short help message to standard output.
2418 func_usage_message
()
2422 eval \
$ECHO \""Usage: $usage"\"
2429 /^Written by/q' < "$progpath"
2431 eval \
$ECHO \""$usage_message"\"
2437 # Echo version message to standard output and exit.
2442 printf '%s\n' "$progname $scriptversion"
2452 /^# Written by /,/# warranty; / {
2455 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2462 /^warranty; /q' < "$progpath"
2469 # mode: shell-script
2471 # eval: (add-hook 'before-save-hook 'time-stamp)
2472 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2473 # time-stamp-time-zone: "UTC"
2476 # Set a version string.
2477 scriptversion
='(GNU libtool) 2.4.6'
2482 # Libtool also displays the current mode in messages, so override
2483 # funclib.sh func_echo with this custom definition.
2492 for _G_line
in $_G_message; do
2494 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2500 # func_warning ARG...
2501 # -------------------
2502 # Libtool warnings are not categorized, so override funclib.sh
2503 # func_warning with this simpler definition.
2508 $warning_func ${1+"$@"}
2512 ## ---------------- ##
2513 ## Options parsing. ##
2514 ## ---------------- ##
2516 # Hook in the functions to make sure our own options are parsed during
2517 # the option parsing loop.
2519 usage
='$progpath [OPTION]... [MODE-ARG]...'
2521 # Short help message in response to '-h'.
2522 usage_message
="Options:
2523 --config show all configuration variables
2524 --debug enable verbose shell tracing
2525 -n, --dry-run display commands without modifying any files
2526 --features display basic configuration information and exit
2527 --mode=MODE use operation mode MODE
2528 --no-warnings equivalent to '-Wnone'
2529 --preserve-dup-deps don't remove duplicate dependency libraries
2530 --quiet, --silent don't print informational messages
2531 --tag=TAG use configuration variables from tag TAG
2532 -v, --verbose print more informational messages than default
2533 --version print version information
2534 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2535 -h, --help, --help-all print short, long, or detailed help message
2538 # Additional text appended to 'usage_message' in response to '--help'.
2544 $ECHO "$long_help_message
2546 MODE must be one of the following:
2548 clean remove files from the build directory
2549 compile compile a source file into a libtool object
2550 execute automatically set library path, then run a program
2551 finish complete the installation of libtool libraries
2552 install install libraries or executables
2553 link create a library or an executable
2554 uninstall remove libraries from an installed directory
2556 MODE-ARGS vary depending on the MODE. When passed as first option,
2557 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2558 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2560 When reporting a bug, please describe a test case to reproduce it and
2561 include the following information:
2566 compiler flags: $LTCFLAGS
2567 linker: $LD (gnu? $with_gnu_ld)
2568 version: $progname $scriptversion Debian-2.4.6-2
2569 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2570 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2572 Report bugs to <bug-libtool@gnu.org>.
2573 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2574 General help using GNU software: <http://www.gnu.org/gethelp/>."
2579 # func_lo2o OBJECT-NAME
2580 # ---------------------
2581 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2584 lo2o
=s
/\\.lo\$
/.
$objext/
2585 o2lo
=s
/\\.
$objext\$
/.lo
/
2587 if test yes = "$_G_HAVE_XSI_OPS"; then
2591 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2592 * ) func_lo2o_result=$1 ;;
2596 # func_xform LIBOBJ-OR-SOURCE
2597 # ---------------------------
2598 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2599 # suffix to a '.lo' libtool-object suffix.
2602 func_xform_result=${1%.*}.lo
2605 # ...otherwise fall back to using sed.
2608 func_lo2o_result
=`$ECHO "$1" | $SED "$lo2o"`
2613 func_xform_result
=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2618 # func_fatal_configuration ARG...
2619 # -------------------------------
2620 # Echo program name prefixed message to standard error, followed by
2621 # a configuration failure hint, and exit.
2622 func_fatal_configuration
()
2624 func__fatal_error
${1+"$@"} \
2625 "See the $PACKAGE documentation for more information." \
2626 "Fatal configuration error."
2632 # Display the configuration for all the tags in this script.
2635 re_begincf
='^# ### BEGIN LIBTOOL'
2636 re_endcf
='^# ### END LIBTOOL'
2638 # Default configuration.
2639 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2641 # Now print the configurations for the tags.
2642 for tagname
in $taglist; do
2643 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2652 # Display the features supported by this script.
2656 if test yes = "$build_libtool_libs"; then
2657 echo "enable shared libraries"
2659 echo "disable shared libraries"
2661 if test yes = "$build_old_libs"; then
2662 echo "enable static libraries"
2664 echo "disable static libraries"
2671 # func_enable_tag TAGNAME
2672 # -----------------------
2673 # Verify that TAGNAME is valid, and either flag an error and exit, or
2674 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2681 re_begincf
="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2682 re_endcf
="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2683 sed_extractcf
=/$re_begincf/,/$re_endcf/p
2688 func_fatal_error
"invalid tag name: $tagname"
2692 # Don't test for the "default" C tag, as we know it's
2693 # there but not specially marked.
2697 if $GREP "$re_begincf" "$progpath" >/dev
/null
2>&1; then
2698 taglist
="$taglist $tagname"
2700 # Evaluate the configuration. Be careful to quote the path
2701 # and the sed script, to avoid splitting on whitespace, but
2702 # also don't use non-portable quotes within backquotes within
2703 # quotes we have to do it in 2 steps:
2704 extractedcf
=`$SED -n -e "$sed_extractcf" < "$progpath"`
2707 func_error
"ignoring unknown tag $tagname"
2714 # func_check_version_match
2715 # ------------------------
2716 # Ensure that we are using m4 macros, and libtool script from the same
2717 # release of libtool.
2718 func_check_version_match
()
2720 if test "$package_revision" != "$macro_revision"; then
2721 if test "$VERSION" != "$macro_version"; then
2722 if test -z "$macro_version"; then
2724 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2725 $progname: definition of this LT_INIT comes from an older release.
2726 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2727 $progname: and run autoconf again.
2731 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2732 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2733 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2734 $progname: and run autoconf again.
2739 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2740 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2741 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2742 $progname: of $PACKAGE $VERSION and run autoconf again.
2751 # libtool_options_prep [ARG]...
2752 # -----------------------------
2753 # Preparation for options parsed by libtool.
2754 libtool_options_prep
()
2764 opt_preserve_dup_deps
=false
2770 # Shorthand for --mode=foo, only valid as the first argument
2773 shift; set dummy
--mode clean
${1+"$@"}; shift
2775 compile|compil|compi|comp|com|co|c
)
2776 shift; set dummy
--mode compile
${1+"$@"}; shift
2778 execute|execut|execu|
exec|exe|ex|e
)
2779 shift; set dummy
--mode execute
${1+"$@"}; shift
2781 finish|finis|fini|fin|
fi|f
)
2782 shift; set dummy
--mode finish
${1+"$@"}; shift
2784 install|instal|insta|inst|ins|
in|i
)
2785 shift; set dummy
--mode install ${1+"$@"}; shift
2788 shift; set dummy
--mode link
${1+"$@"}; shift
2790 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u
)
2791 shift; set dummy
--mode uninstall
${1+"$@"}; shift
2795 # Pass back the list of options.
2796 func_quote_for_eval
${1+"$@"}
2797 libtool_options_prep_result
=$func_quote_for_eval_result
2799 func_add_hook func_options_prep libtool_options_prep
2802 # libtool_parse_options [ARG]...
2803 # ---------------------------------
2804 # Provide handling for libtool specific options.
2805 libtool_parse_options
()
2809 # Perform our own loop to consume as many options as possible in
2811 while test $# -gt 0; do
2815 --dry-run|
--dryrun|
-n)
2819 --config) func_config
;;
2822 opt_dlopen
="${opt_dlopen+$opt_dlopen
2827 --preserve-dup-deps)
2828 opt_preserve_dup_deps
=: ;;
2830 --features) func_features
;;
2832 --finish) set dummy
--mode finish
${1+"$@"}; shift ;;
2834 --help) opt_help
=: ;;
2836 --help-all) opt_help
=': help-all' ;;
2838 --mode) test $# = 0 && func_missing_arg
$_G_opt && break
2841 # Valid mode arguments:
2842 clean|compile|execute|finish|
install|link|relink|uninstall
) ;;
2844 # Catch anything else as an error
2845 *) func_error
"invalid argument for $_G_opt"
2853 --no-silent|
--no-quiet)
2855 func_append preserve_args
" $_G_opt"
2858 --no-warnings|
--no-warning|
--no-warn)
2860 func_append preserve_args
" $_G_opt"
2865 func_append preserve_args
" $_G_opt"
2871 func_append preserve_args
" $_G_opt"
2874 --tag) test $# = 0 && func_missing_arg
$_G_opt && break
2876 func_append preserve_args
" $_G_opt $1"
2877 func_enable_tag
"$1"
2881 --verbose|
-v) opt_quiet
=false
2883 func_append preserve_args
" $_G_opt"
2886 # An option not handled by this hook function:
2887 *) set dummy
"$_G_opt" ${1+"$@"}; shift; break ;;
2892 # save modified positional parameters for caller
2893 func_quote_for_eval
${1+"$@"}
2894 libtool_parse_options_result
=$func_quote_for_eval_result
2896 func_add_hook func_parse_options libtool_parse_options
2900 # libtool_validate_options [ARG]...
2901 # ---------------------------------
2902 # Perform any sanity checks on option settings and/or unconsumed
2904 libtool_validate_options
()
2906 # save first non-option argument
2907 if test 0 -lt $#; then
2913 test : = "$debug_cmd" || func_append preserve_args
" --debug"
2916 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2917 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2918 *cygwin
* |
*mingw
* |
*pw32
* |
*cegcc
* |
*solaris2
* |
*os2
*)
2919 # don't eliminate duplications in $postdeps and $predeps
2920 opt_duplicate_compiler_generated_deps
=:
2923 opt_duplicate_compiler_generated_deps
=$opt_preserve_dup_deps
2928 # Sanity checks first:
2929 func_check_version_match
2931 test yes != "$build_libtool_libs" \
2932 && test yes != "$build_old_libs" \
2933 && func_fatal_configuration
"not configured to build any kind of library"
2936 eval std_shrext
=\"$shrext_cmds\"
2938 # Only execute mode is allowed to have -dlopen flags.
2939 if test -n "$opt_dlopen" && test execute
!= "$opt_mode"; then
2940 func_error
"unrecognized option '-dlopen'"
2945 # Change the help message to a mode-specific one.
2947 help="Try '$progname --help --mode=$opt_mode' for more information."
2950 # Pass back the unparsed argument list
2951 func_quote_for_eval
${1+"$@"}
2952 libtool_validate_options_result
=$func_quote_for_eval_result
2954 func_add_hook func_validate_options libtool_validate_options
2957 # Process options as early as possible so that --help and --version
2958 # can return quickly.
2959 func_options
${1+"$@"}
2960 eval set dummy
"$func_options_result"; shift
2968 magic
='%%%MAGIC variable%%%'
2969 magic_exe
='%%%MAGIC EXE variable%%%'
2975 # If this variable is set in any of the actions, the command in it
2976 # will be execed at the end. This prevents here-documents from being
2977 # left over by shells.
2981 # A function that is used when there is no print builtin or printf.
2982 func_fallback_echo
()
2984 eval 'cat <<_LTECHO_EOF
2989 # func_generated_by_libtool
2990 # True iff stdin has been generated by Libtool. This function is only
2991 # a basic sanity check; it will hardly flush out determined imposters.
2992 func_generated_by_libtool_p
()
2994 $GREP "^# Generated by .*$PACKAGE" > /dev
/null
2>&1
2998 # True iff FILE is a libtool '.la' library or '.lo' object file.
2999 # This function is only a basic sanity check; it will hardly flush out
3000 # determined imposters.
3004 $SED -e 4q
"$1" 2>/dev
/null | func_generated_by_libtool_p
3007 # func_lalib_unsafe_p file
3008 # True iff FILE is a libtool '.la' library or '.lo' object file.
3009 # This function implements the same check as func_lalib_p without
3010 # resorting to external programs. To this end, it redirects stdin and
3011 # closes it afterwards, without saving the original file descriptor.
3012 # As a safety measure, use it only where a negative result would be
3013 # fatal anyway. Works if 'file' does not exist.
3014 func_lalib_unsafe_p
()
3017 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
3018 for lalib_p_l
in 1 2 3 4
3021 case $lalib_p_line in
3022 \
#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
3027 test yes = "$lalib_p"
3030 # func_ltwrapper_script_p file
3031 # True iff FILE is a libtool wrapper script
3032 # This function is only a basic sanity check; it will hardly flush out
3033 # determined imposters.
3034 func_ltwrapper_script_p
()
3037 $lt_truncate_bin < "$1" 2>/dev
/null | func_generated_by_libtool_p
3040 # func_ltwrapper_executable_p file
3041 # True iff FILE is a libtool wrapper executable
3042 # This function is only a basic sanity check; it will hardly flush out
3043 # determined imposters.
3044 func_ltwrapper_executable_p
()
3046 func_ltwrapper_exec_suffix
=
3049 *) func_ltwrapper_exec_suffix
=.exe
;;
3051 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev
/null
2>&1
3054 # func_ltwrapper_scriptname file
3055 # Assumes file is an ltwrapper_executable
3056 # uses $file to determine the appropriate filename for a
3057 # temporary ltwrapper_script.
3058 func_ltwrapper_scriptname
()
3060 func_dirname_and_basename
"$1" "" "."
3061 func_stripname
'' '.exe' "$func_basename_result"
3062 func_ltwrapper_scriptname_result
=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
3065 # func_ltwrapper_p file
3066 # True iff FILE is a libtool wrapper script or wrapper executable
3067 # This function is only a basic sanity check; it will hardly flush out
3068 # determined imposters.
3071 func_ltwrapper_script_p
"$1" || func_ltwrapper_executable_p
"$1"
3075 # func_execute_cmds commands fail_cmd
3076 # Execute tilde-delimited COMMANDS.
3077 # If FAIL_CMD is given, eval that upon failure.
3078 # FAIL_CMD may read-access the current command in variable CMD!
3079 func_execute_cmds
()
3083 save_ifs
=$IFS; IFS
='~'
3088 func_show_eval
"$cmd" "${2-:}"
3095 # Source FILE, adding directory component if necessary.
3096 # Note that it is not necessary on cygwin/mingw to append a dot to
3097 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
3098 # behavior happens only for exec(3), not for open(2)! Also, sourcing
3099 # 'FILE.' does not work on cygwin managed mounts.
3105 */* |
*\\*) .
"$1" ;;
3111 # func_resolve_sysroot PATH
3112 # Replace a leading = in PATH with a sysroot. Store the result into
3113 # func_resolve_sysroot_result
3114 func_resolve_sysroot
()
3116 func_resolve_sysroot_result
=$1
3117 case $func_resolve_sysroot_result in
3119 func_stripname
'=' '' "$func_resolve_sysroot_result"
3120 func_resolve_sysroot_result
=$lt_sysroot$func_stripname_result
3125 # func_replace_sysroot PATH
3126 # If PATH begins with the sysroot, replace it with = and
3127 # store the result into func_replace_sysroot_result.
3128 func_replace_sysroot
()
3130 case $lt_sysroot:$1 in
3132 func_stripname
"$lt_sysroot" '' "$1"
3133 func_replace_sysroot_result
='='$func_stripname_result
3136 # Including no sysroot.
3137 func_replace_sysroot_result
=$1
3142 # func_infer_tag arg
3143 # Infer tagged configuration to use if any are available and
3144 # if one wasn't chosen via the "--tag" command line option.
3145 # Only attempt this if the compiler in the base compile
3146 # command doesn't match the default compiler.
3147 # arg is usually of the form 'gcc ...'
3152 if test -n "$available_tags" && test -z "$tagname"; then
3155 func_append_quoted CC_quoted
"$arg"
3157 CC_expanded
=`func_echo_all $CC`
3158 CC_quoted_expanded
=`func_echo_all $CC_quoted`
3160 # Blanks in the command may have been stripped by the calling shell,
3161 # but not from the CC environment variable when configure was run.
3162 " $CC "* |
"$CC "* |
" $CC_expanded "* |
"$CC_expanded "* | \
3163 " $CC_quoted"* |
"$CC_quoted "* |
" $CC_quoted_expanded "* |
"$CC_quoted_expanded "*) ;;
3164 # Blanks at the start of $base_compile will cause this to fail
3165 # if we don't check for them as well.
3167 for z
in $available_tags; do
3168 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev
/null
; then
3169 # Evaluate the configuration.
3170 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
3173 # Double-quote args containing other shell metacharacters.
3174 func_append_quoted CC_quoted
"$arg"
3176 CC_expanded
=`func_echo_all $CC`
3177 CC_quoted_expanded
=`func_echo_all $CC_quoted`
3179 " $CC "* |
"$CC "* |
" $CC_expanded "* |
"$CC_expanded "* | \
3180 " $CC_quoted"* |
"$CC_quoted "* |
" $CC_quoted_expanded "* |
"$CC_quoted_expanded "*)
3181 # The compiler in the base compile command matches
3182 # the one in the tagged configuration.
3183 # Assume this is the tagged configuration we want.
3190 # If $tagname still isn't set, then no tagged configuration
3191 # was found and let the user know that the "--tag" command
3192 # line option must be used.
3193 if test -z "$tagname"; then
3194 func_echo
"unable to infer tagged configuration"
3195 func_fatal_error
"specify a tag with '--tag'"
3197 # func_verbose "using $tagname tagged configuration"
3206 # func_write_libtool_object output_name pic_name nonpic_name
3207 # Create a libtool object file (analogous to a ".la" file),
3208 # but don't create it if we're doing a dry run.
3209 func_write_libtool_object
()
3212 if test yes = "$build_libtool_libs"; then
3218 if test yes = "$build_old_libs"; then
3225 cat >${write_libobj}T
<<EOF
3226 # $write_libobj - a libtool object file
3227 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
3229 # Please DO NOT delete this file!
3230 # It is necessary for linking the library.
3232 # Name of the PIC object.
3233 pic_object=$write_lobj
3235 # Name of the non-PIC object
3236 non_pic_object=$write_oldobj
3239 $MV "${write_libobj}T" "$write_libobj"
3244 ##################################################
3245 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
3246 ##################################################
3248 # func_convert_core_file_wine_to_w32 ARG
3249 # Helper function used by file name conversion functions when $build is *nix,
3250 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
3251 # correctly configured wine environment available, with the winepath program
3252 # in $build's $PATH.
3254 # ARG is the $build file name to be converted to w32 format.
3255 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
3256 # be empty on error (or when ARG is empty)
3257 func_convert_core_file_wine_to_w32
()
3261 func_convert_core_file_wine_to_w32_result
=$1
3262 if test -n "$1"; then
3263 # Unfortunately, winepath does not exit with a non-zero error code, so we
3264 # are forced to check the contents of stdout. On the other hand, if the
3265 # command is not found, the shell will set an exit code of 127 and print
3266 # *an error message* to stdout. So we must check for both error code of
3267 # zero AND non-empty stdout, which explains the odd construction:
3268 func_convert_core_file_wine_to_w32_tmp
=`winepath -w "$1" 2>/dev/null`
3269 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
3270 func_convert_core_file_wine_to_w32_result
=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
3271 $SED -e "$sed_naive_backslashify"`
3273 func_convert_core_file_wine_to_w32_result
=
3277 # end: func_convert_core_file_wine_to_w32
3280 # func_convert_core_path_wine_to_w32 ARG
3281 # Helper function used by path conversion functions when $build is *nix, and
3282 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
3283 # configured wine environment available, with the winepath program in $build's
3284 # $PATH. Assumes ARG has no leading or trailing path separator characters.
3286 # ARG is path to be converted from $build format to win32.
3287 # Result is available in $func_convert_core_path_wine_to_w32_result.
3288 # Unconvertible file (directory) names in ARG are skipped; if no directory names
3289 # are convertible, then the result may be empty.
3290 func_convert_core_path_wine_to_w32
()
3294 # unfortunately, winepath doesn't convert paths, only file names
3295 func_convert_core_path_wine_to_w32_result
=
3296 if test -n "$1"; then
3299 for func_convert_core_path_wine_to_w32_f
in $1; do
3301 func_convert_core_file_wine_to_w32
"$func_convert_core_path_wine_to_w32_f"
3302 if test -n "$func_convert_core_file_wine_to_w32_result"; then
3303 if test -z "$func_convert_core_path_wine_to_w32_result"; then
3304 func_convert_core_path_wine_to_w32_result
=$func_convert_core_file_wine_to_w32_result
3306 func_append func_convert_core_path_wine_to_w32_result
";$func_convert_core_file_wine_to_w32_result"
3313 # end: func_convert_core_path_wine_to_w32
3316 # func_cygpath ARGS...
3317 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
3318 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
3319 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
3320 # (2), returns the Cygwin file name or path in func_cygpath_result (input
3321 # file name or path is assumed to be in w32 format, as previously converted
3322 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
3323 # or path in func_cygpath_result (input file name or path is assumed to be in
3324 # Cygwin format). Returns an empty string on error.
3326 # ARGS are passed to cygpath, with the last one being the file name or path to
3329 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
3330 # environment variable; do not put it in $PATH.
3335 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
3336 func_cygpath_result
=`$LT_CYGPATH "$@" 2>/dev/null`
3337 if test "$?" -ne 0; then
3338 # on failure, ensure result is empty
3339 func_cygpath_result
=
3342 func_cygpath_result
=
3343 func_error
"LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
3349 # func_convert_core_msys_to_w32 ARG
3350 # Convert file name or path ARG from MSYS format to w32 format. Return
3351 # result in func_convert_core_msys_to_w32_result.
3352 func_convert_core_msys_to_w32
()
3356 # awkward: cmd appends spaces to result
3357 func_convert_core_msys_to_w32_result
=`( cmd //c echo "$1" ) 2>/dev/null |
3358 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
3360 #end: func_convert_core_msys_to_w32
3363 # func_convert_file_check ARG1 ARG2
3364 # Verify that ARG1 (a file name in $build format) was converted to $host
3365 # format in ARG2. Otherwise, emit an error message, but continue (resetting
3366 # func_to_host_file_result to ARG1).
3367 func_convert_file_check
()
3371 if test -z "$2" && test -n "$1"; then
3372 func_error
"Could not determine host file name corresponding to"
3374 func_error
"Continuing, but uninstalled executables may not work."
3376 func_to_host_file_result
=$1
3379 # end func_convert_file_check
3382 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
3383 # Verify that FROM_PATH (a path in $build format) was converted to $host
3384 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
3385 # func_to_host_file_result to a simplistic fallback value (see below).
3386 func_convert_path_check
()
3390 if test -z "$4" && test -n "$3"; then
3391 func_error
"Could not determine the host path corresponding to"
3393 func_error
"Continuing, but uninstalled executables may not work."
3394 # Fallback. This is a deliberately simplistic "conversion" and
3395 # should not be "improved". See libtool.info.
3396 if test "x$1" != "x$2"; then
3397 lt_replace_pathsep_chars
="s|$1|$2|g"
3398 func_to_host_path_result
=`echo "$3" |
3399 $SED -e "$lt_replace_pathsep_chars"`
3401 func_to_host_path_result
=$3
3405 # end func_convert_path_check
3408 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
3409 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
3410 # and appending REPL if ORIG matches BACKPAT.
3411 func_convert_path_front_back_pathsep
()
3416 $1 ) func_to_host_path_result
=$3$func_to_host_path_result
3420 $2 ) func_append func_to_host_path_result
"$3"
3424 # end func_convert_path_front_back_pathsep
3427 ##################################################
3428 # $build to $host FILE NAME CONVERSION FUNCTIONS #
3429 ##################################################
3430 # invoked via '$to_host_file_cmd ARG'
3432 # In each case, ARG is the path to be converted from $build to $host format.
3433 # Result will be available in $func_to_host_file_result.
3436 # func_to_host_file ARG
3437 # Converts the file name ARG from $build format to $host format. Return result
3438 # in func_to_host_file_result.
3439 func_to_host_file
()
3443 $to_host_file_cmd "$1"
3445 # end func_to_host_file
3448 # func_to_tool_file ARG LAZY
3449 # converts the file name ARG from $build format to toolchain format. Return
3450 # result in func_to_tool_file_result. If the conversion in use is listed
3451 # in (the comma separated) LAZY, no conversion takes place.
3452 func_to_tool_file
()
3457 *,"$to_tool_file_cmd",*)
3458 func_to_tool_file_result
=$1
3461 $to_tool_file_cmd "$1"
3462 func_to_tool_file_result
=$func_to_host_file_result
3466 # end func_to_tool_file
3469 # func_convert_file_noop ARG
3470 # Copy ARG to func_to_host_file_result.
3471 func_convert_file_noop
()
3473 func_to_host_file_result
=$1
3475 # end func_convert_file_noop
3478 # func_convert_file_msys_to_w32 ARG
3479 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
3480 # conversion to w32 is not available inside the cwrapper. Returns result in
3481 # func_to_host_file_result.
3482 func_convert_file_msys_to_w32
()
3486 func_to_host_file_result
=$1
3487 if test -n "$1"; then
3488 func_convert_core_msys_to_w32
"$1"
3489 func_to_host_file_result
=$func_convert_core_msys_to_w32_result
3491 func_convert_file_check
"$1" "$func_to_host_file_result"
3493 # end func_convert_file_msys_to_w32
3496 # func_convert_file_cygwin_to_w32 ARG
3497 # Convert file name ARG from Cygwin to w32 format. Returns result in
3498 # func_to_host_file_result.
3499 func_convert_file_cygwin_to_w32
()
3503 func_to_host_file_result
=$1
3504 if test -n "$1"; then
3505 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3506 # LT_CYGPATH in this case.
3507 func_to_host_file_result
=`cygpath -m "$1"`
3509 func_convert_file_check
"$1" "$func_to_host_file_result"
3511 # end func_convert_file_cygwin_to_w32
3514 # func_convert_file_nix_to_w32 ARG
3515 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3516 # and a working winepath. Returns result in func_to_host_file_result.
3517 func_convert_file_nix_to_w32
()
3521 func_to_host_file_result
=$1
3522 if test -n "$1"; then
3523 func_convert_core_file_wine_to_w32
"$1"
3524 func_to_host_file_result
=$func_convert_core_file_wine_to_w32_result
3526 func_convert_file_check
"$1" "$func_to_host_file_result"
3528 # end func_convert_file_nix_to_w32
3531 # func_convert_file_msys_to_cygwin ARG
3532 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3533 # Returns result in func_to_host_file_result.
3534 func_convert_file_msys_to_cygwin
()
3538 func_to_host_file_result
=$1
3539 if test -n "$1"; then
3540 func_convert_core_msys_to_w32
"$1"
3541 func_cygpath
-u "$func_convert_core_msys_to_w32_result"
3542 func_to_host_file_result
=$func_cygpath_result
3544 func_convert_file_check
"$1" "$func_to_host_file_result"
3546 # end func_convert_file_msys_to_cygwin
3549 # func_convert_file_nix_to_cygwin ARG
3550 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3551 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3552 # in func_to_host_file_result.
3553 func_convert_file_nix_to_cygwin
()
3557 func_to_host_file_result
=$1
3558 if test -n "$1"; then
3559 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3560 func_convert_core_file_wine_to_w32
"$1"
3561 func_cygpath
-u "$func_convert_core_file_wine_to_w32_result"
3562 func_to_host_file_result
=$func_cygpath_result
3564 func_convert_file_check
"$1" "$func_to_host_file_result"
3566 # end func_convert_file_nix_to_cygwin
3569 #############################################
3570 # $build to $host PATH CONVERSION FUNCTIONS #
3571 #############################################
3572 # invoked via '$to_host_path_cmd ARG'
3574 # In each case, ARG is the path to be converted from $build to $host format.
3575 # The result will be available in $func_to_host_path_result.
3577 # Path separators are also converted from $build format to $host format. If
3578 # ARG begins or ends with a path separator character, it is preserved (but
3579 # converted to $host format) on output.
3581 # All path conversion functions are named using the following convention:
3582 # file name conversion function : func_convert_file_X_to_Y ()
3583 # path conversion function : func_convert_path_X_to_Y ()
3584 # where, for any given $build/$host combination the 'X_to_Y' value is the
3585 # same. If conversion functions are added for new $build/$host combinations,
3586 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3590 # func_init_to_host_path_cmd
3591 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3592 # appropriate value, based on the value of $to_host_file_cmd.
3594 func_init_to_host_path_cmd
()
3598 if test -z "$to_host_path_cmd"; then
3599 func_stripname
'func_convert_file_' '' "$to_host_file_cmd"
3600 to_host_path_cmd
=func_convert_path_
$func_stripname_result
3605 # func_to_host_path ARG
3606 # Converts the path ARG from $build format to $host format. Return result
3607 # in func_to_host_path_result.
3608 func_to_host_path
()
3612 func_init_to_host_path_cmd
3613 $to_host_path_cmd "$1"
3615 # end func_to_host_path
3618 # func_convert_path_noop ARG
3619 # Copy ARG to func_to_host_path_result.
3620 func_convert_path_noop
()
3622 func_to_host_path_result
=$1
3624 # end func_convert_path_noop
3627 # func_convert_path_msys_to_w32 ARG
3628 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3629 # conversion to w32 is not available inside the cwrapper. Returns result in
3630 # func_to_host_path_result.
3631 func_convert_path_msys_to_w32
()
3635 func_to_host_path_result
=$1
3636 if test -n "$1"; then
3637 # Remove leading and trailing path separator characters from ARG. MSYS
3638 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3639 # and winepath ignores them completely.
3640 func_stripname
: : "$1"
3641 func_to_host_path_tmp1
=$func_stripname_result
3642 func_convert_core_msys_to_w32
"$func_to_host_path_tmp1"
3643 func_to_host_path_result
=$func_convert_core_msys_to_w32_result
3644 func_convert_path_check
: ";" \
3645 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3646 func_convert_path_front_back_pathsep
":*" "*:" ";" "$1"
3649 # end func_convert_path_msys_to_w32
3652 # func_convert_path_cygwin_to_w32 ARG
3653 # Convert path ARG from Cygwin to w32 format. Returns result in
3654 # func_to_host_file_result.
3655 func_convert_path_cygwin_to_w32
()
3659 func_to_host_path_result
=$1
3660 if test -n "$1"; then
3661 # See func_convert_path_msys_to_w32:
3662 func_stripname
: : "$1"
3663 func_to_host_path_tmp1
=$func_stripname_result
3664 func_to_host_path_result
=`cygpath -m -p "$func_to_host_path_tmp1"`
3665 func_convert_path_check
: ";" \
3666 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3667 func_convert_path_front_back_pathsep
":*" "*:" ";" "$1"
3670 # end func_convert_path_cygwin_to_w32
3673 # func_convert_path_nix_to_w32 ARG
3674 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3675 # a working winepath. Returns result in func_to_host_file_result.
3676 func_convert_path_nix_to_w32
()
3680 func_to_host_path_result
=$1
3681 if test -n "$1"; then
3682 # See func_convert_path_msys_to_w32:
3683 func_stripname
: : "$1"
3684 func_to_host_path_tmp1
=$func_stripname_result
3685 func_convert_core_path_wine_to_w32
"$func_to_host_path_tmp1"
3686 func_to_host_path_result
=$func_convert_core_path_wine_to_w32_result
3687 func_convert_path_check
: ";" \
3688 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3689 func_convert_path_front_back_pathsep
":*" "*:" ";" "$1"
3692 # end func_convert_path_nix_to_w32
3695 # func_convert_path_msys_to_cygwin ARG
3696 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3697 # Returns result in func_to_host_file_result.
3698 func_convert_path_msys_to_cygwin
()
3702 func_to_host_path_result
=$1
3703 if test -n "$1"; then
3704 # See func_convert_path_msys_to_w32:
3705 func_stripname
: : "$1"
3706 func_to_host_path_tmp1
=$func_stripname_result
3707 func_convert_core_msys_to_w32
"$func_to_host_path_tmp1"
3708 func_cygpath
-u -p "$func_convert_core_msys_to_w32_result"
3709 func_to_host_path_result
=$func_cygpath_result
3710 func_convert_path_check
: : \
3711 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3712 func_convert_path_front_back_pathsep
":*" "*:" : "$1"
3715 # end func_convert_path_msys_to_cygwin
3718 # func_convert_path_nix_to_cygwin ARG
3719 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3720 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3721 # func_to_host_file_result.
3722 func_convert_path_nix_to_cygwin
()
3726 func_to_host_path_result
=$1
3727 if test -n "$1"; then
3728 # Remove leading and trailing path separator characters from
3729 # ARG. msys behavior is inconsistent here, cygpath turns them
3730 # into '.;' and ';.', and winepath ignores them completely.
3731 func_stripname
: : "$1"
3732 func_to_host_path_tmp1
=$func_stripname_result
3733 func_convert_core_path_wine_to_w32
"$func_to_host_path_tmp1"
3734 func_cygpath
-u -p "$func_convert_core_path_wine_to_w32_result"
3735 func_to_host_path_result
=$func_cygpath_result
3736 func_convert_path_check
: : \
3737 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3738 func_convert_path_front_back_pathsep
":*" "*:" : "$1"
3741 # end func_convert_path_nix_to_cygwin
3744 # func_dll_def_p FILE
3745 # True iff FILE is a Windows DLL '.def' file.
3746 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3751 func_dll_def_p_tmp
=`$SED -n \
3753 -e '/^\(;.*\)*$/d' \
3754 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3757 test DEF
= "$func_dll_def_p_tmp"
3761 # func_mode_compile arg...
3762 func_mode_compile
()
3766 # Get the compilation command and the source file.
3768 srcfile
=$nonopt # always keep a non-empty value in "srcfile"
3780 # do not "continue". Instead, add this to base_compile
3792 # Accept any command-line options.
3795 test -n "$libobj" && \
3796 func_fatal_error
"you cannot specify '-o' more than once"
3801 -pie |
-fpie |
-fPIE)
3802 func_append pie_flag
" $arg"
3806 -shared |
-static |
-prefer-pic |
-prefer-non-pic)
3807 func_append later
" $arg"
3817 arg_mode
=arg
# the next one goes into the "base_compile" arg list
3818 continue # The current "srcfile" will either be retained or
3819 ;; # replaced later. I would guess that would be a bug.
3822 func_stripname
'-Wc,' '' "$arg"
3823 args
=$func_stripname_result
3825 save_ifs
=$IFS; IFS
=,
3826 for arg
in $args; do
3828 func_append_quoted lastarg
"$arg"
3831 func_stripname
' ' '' "$lastarg"
3832 lastarg
=$func_stripname_result
3834 # Add the arguments to base_compile.
3835 func_append base_compile
" $lastarg"
3840 # Accept the current argument as the source file.
3841 # The previous "srcfile" becomes the current argument.
3848 esac # case $arg_mode
3850 # Aesthetically quote the previous argument.
3851 func_append_quoted base_compile
"$lastarg"
3856 func_fatal_error
"you must specify an argument for -Xcompile"
3859 func_fatal_error
"you must specify a target with '-o'"
3862 # Get the name of the library object.
3863 test -z "$libobj" && {
3864 func_basename
"$srcfile"
3865 libobj
=$func_basename_result
3870 # Recognize several different file suffixes.
3871 # If the user specifies -o file.o, it is replaced with file.lo
3874 *.ada |
*.adb |
*.ads |
*.asm | \
3875 *.c
++ |
*.cc |
*.ii |
*.class |
*.cpp |
*.cxx | \
3876 *.
[fF
][09]? |
*.
for |
*.java |
*.go |
*.obj |
*.sx |
*.cu |
*.cup
)
3877 func_xform
"$libobj"
3878 libobj
=$func_xform_result
3883 *.lo
) func_lo2o
"$libobj"; obj
=$func_lo2o_result ;;
3885 func_fatal_error
"cannot determine name of library object from '$libobj'"
3889 func_infer_tag
$base_compile
3891 for arg
in $later; do
3894 test yes = "$build_libtool_libs" \
3895 || func_fatal_configuration
"cannot build a shared library"
3901 build_libtool_libs
=no
3918 func_quote_for_eval
"$libobj"
3919 test "X$libobj" != "X$func_quote_for_eval_result" \
3920 && $ECHO "X$libobj" |
$GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3921 && func_warning
"libobj name '$libobj' may not contain shell special characters."
3922 func_dirname_and_basename
"$obj" "/" ""
3923 objname
=$func_basename_result
3924 xdir
=$func_dirname_result
3925 lobj
=$xdir$objdir/$objname
3927 test -z "$base_compile" && \
3928 func_fatal_help
"you must specify a compilation command"
3930 # Delete any leftover library objects.
3931 if test yes = "$build_old_libs"; then
3932 removelist
="$obj $lobj $libobj ${libobj}T"
3934 removelist
="$lobj $libobj ${libobj}T"
3937 # On Cygwin there's no "real" PIC flag so we must build both object types
3939 cygwin
* | mingw
* | pw32
* | os2
* | cegcc
*)
3943 if test no
= "$pic_mode" && test pass_all
!= "$deplibs_check_method"; then
3944 # non-PIC code in shared libraries is not supported
3948 # Calculate the filename of the output object if compiler does
3949 # not support -o with -c
3950 if test no
= "$compiler_c_o"; then
3951 output_obj
=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.
$objext
3952 lockfile
=$output_obj.lock
3959 # Lock this critical section if it is needed
3960 # We use this script file to make the link, it avoids creating a new file
3961 if test yes = "$need_locks"; then
3962 until $opt_dry_run ||
ln "$progpath" "$lockfile" 2>/dev
/null
; do
3963 func_echo
"Waiting for $lockfile to be removed"
3966 elif test warn
= "$need_locks"; then
3967 if test -f "$lockfile"; then
3969 *** ERROR, $lockfile exists and contains:
3970 `cat $lockfile 2>/dev/null`
3972 This indicates that another process is trying to use the same
3973 temporary object file, and libtool could not work around it because
3974 your compiler does not support '-c' and '-o' together. If you
3975 repeat this compilation, it may succeed, by chance, but you had better
3976 avoid parallel builds (make -j) in this platform, or get a better
3979 $opt_dry_run ||
$RM $removelist
3982 func_append removelist
" $output_obj"
3983 $ECHO "$srcfile" > "$lockfile"
3986 $opt_dry_run ||
$RM $removelist
3987 func_append removelist
" $lockfile"
3988 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
3990 func_to_tool_file
"$srcfile" func_convert_file_msys_to_w32
3991 srcfile
=$func_to_tool_file_result
3992 func_quote_for_eval
"$srcfile"
3993 qsrcfile
=$func_quote_for_eval_result
3995 # Only build a PIC object if we are building libtool libraries.
3996 if test yes = "$build_libtool_libs"; then
3997 # Without this assignment, base_compile gets emptied.
3998 fbsd_hideous_sh_bug
=$base_compile
4000 if test no
!= "$pic_mode"; then
4001 command="$base_compile $qsrcfile $pic_flag"
4003 # Don't build PIC code
4004 command="$base_compile $qsrcfile"
4007 func_mkdir_p
"$xdir$objdir"
4009 if test -z "$output_obj"; then
4010 # Place PIC objects in $objdir
4011 func_append
command " -o $lobj"
4014 func_show_eval_locale
"$command" \
4015 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
4017 if test warn
= "$need_locks" &&
4018 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
4020 *** ERROR, $lockfile contains:
4021 `cat $lockfile 2>/dev/null`
4023 but it should contain:
4026 This indicates that another process is trying to use the same
4027 temporary object file, and libtool could not work around it because
4028 your compiler does not support '-c' and '-o' together. If you
4029 repeat this compilation, it may succeed, by chance, but you had better
4030 avoid parallel builds (make -j) in this platform, or get a better
4033 $opt_dry_run ||
$RM $removelist
4037 # Just move the object if needed, then go on to compile the next one
4038 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
4039 func_show_eval
'$MV "$output_obj" "$lobj"' \
4040 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
4043 # Allow error messages only from the first compilation.
4044 if test yes = "$suppress_opt"; then
4045 suppress_output
=' >/dev/null 2>&1'
4049 # Only build a position-dependent object if we build old libraries.
4050 if test yes = "$build_old_libs"; then
4051 if test yes != "$pic_mode"; then
4052 # Don't build PIC code
4053 command="$base_compile $qsrcfile$pie_flag"
4055 command="$base_compile $qsrcfile $pic_flag"
4057 if test yes = "$compiler_c_o"; then
4058 func_append
command " -o $obj"
4061 # Suppress compiler output if we already did a PIC compilation.
4062 func_append
command "$suppress_output"
4063 func_show_eval_locale
"$command" \
4064 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
4066 if test warn
= "$need_locks" &&
4067 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
4069 *** ERROR, $lockfile contains:
4070 `cat $lockfile 2>/dev/null`
4072 but it should contain:
4075 This indicates that another process is trying to use the same
4076 temporary object file, and libtool could not work around it because
4077 your compiler does not support '-c' and '-o' together. If you
4078 repeat this compilation, it may succeed, by chance, but you had better
4079 avoid parallel builds (make -j) in this platform, or get a better
4082 $opt_dry_run ||
$RM $removelist
4086 # Just move the object if needed
4087 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
4088 func_show_eval
'$MV "$output_obj" "$obj"' \
4089 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
4094 func_write_libtool_object
"$libobj" "$objdir/$objname" "$objname"
4096 # Unlock the critical section if it was locked
4097 if test no
!= "$need_locks"; then
4098 removelist
=$lockfile
4107 test compile
= "$opt_mode" && func_mode_compile
${1+"$@"}
4112 # We need to display help for each of the modes.
4115 # Generic help is extracted from the usage comments
4116 # at the start of this file.
4122 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4124 Remove files from the build directory.
4126 RM is the name of the program to use to delete files associated with each FILE
4127 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4130 If FILE is a libtool library, object or program, all the files associated
4131 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4136 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4138 Compile a source file into a libtool library object.
4140 This mode accepts the following additional options:
4142 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4143 -no-suppress do not suppress compiler output for multiple passes
4144 -prefer-pic try to build PIC objects only
4145 -prefer-non-pic try to build non-PIC objects only
4146 -shared do not build a '.o' file suitable for static linking
4147 -static only build a '.o' file suitable for static linking
4148 -Wc,FLAG pass FLAG directly to the compiler
4150 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
4151 from the given SOURCEFILE.
4153 The output file name is determined by removing the directory component from
4154 SOURCEFILE, then substituting the C source code suffix '.c' with the
4155 library object suffix, '.lo'."
4160 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
4162 Automatically set library path, then run a program.
4164 This mode accepts the following additional options:
4166 -dlopen FILE add the directory containing FILE to the library path
4168 This mode sets the library path environment variable according to '-dlopen'
4171 If any of the ARGS are libtool executable wrappers, then they are translated
4172 into their corresponding uninstalled binary, and any of their required library
4173 directories are added to the library path.
4175 Then, COMMAND is executed, with ARGS as arguments."
4180 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
4182 Complete the installation of libtool libraries.
4184 Each LIBDIR is a directory that contains libtool libraries.
4186 The commands that this mode executes may require superuser privileges. Use
4187 the '--dry-run' option if you just want to see what would be executed."
4192 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
4194 Install executables or libraries.
4196 INSTALL-COMMAND is the installation command. The first component should be
4197 either the 'install' or 'cp' program.
4199 The following components of INSTALL-COMMAND are treated specially:
4201 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
4203 The rest of the components are interpreted as arguments to that command (only
4204 BSD-compatible install options are recognized)."
4209 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
4211 Link object files or libraries together to form another library, or to
4212 create an executable program.
4214 LINK-COMMAND is a command using the C compiler that you would use to create
4215 a program from several object files.
4217 The following components of LINK-COMMAND are treated specially:
4219 -all-static do not do any dynamic linking at all
4220 -avoid-version do not add a version suffix if possible
4221 -bindir BINDIR specify path to binaries directory (for systems where
4222 libraries must be found in the PATH setting at runtime)
4223 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
4224 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4225 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4226 -export-symbols SYMFILE
4227 try to export only the symbols listed in SYMFILE
4228 -export-symbols-regex REGEX
4229 try to export only the symbols matching REGEX
4230 -LLIBDIR search LIBDIR for required installed libraries
4231 -lNAME OUTPUT-FILE requires the installed library libNAME
4232 -module build a library that can dlopened
4233 -no-fast-install disable the fast-install mode
4234 -no-install link a not-installable executable
4235 -no-undefined declare that a library does not refer to external symbols
4236 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4237 -objectlist FILE use a list of object files found in FILE to specify objects
4238 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
4239 -precious-files-regex REGEX
4240 don't remove output files matching REGEX
4241 -release RELEASE specify package release information
4242 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4243 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4244 -shared only do dynamic linking of libtool libraries
4245 -shrext SUFFIX override the standard shared library file extension
4246 -static do not do any dynamic linking of uninstalled libtool libraries
4247 -static-libtool-libs
4248 do not do any dynamic linking of libtool libraries
4249 -version-info CURRENT[:REVISION[:AGE]]
4250 specify library version info [each variable defaults to 0]
4251 -weak LIBNAME declare that the target provides the LIBNAME interface
4253 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
4255 -Xlinker FLAG pass linker-specific FLAG directly to the linker
4256 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
4258 All other options (arguments beginning with '-') are ignored.
4260 Every other argument is treated as a filename. Files ending in '.la' are
4261 treated as uninstalled libtool libraries, other files are standard or library
4264 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
4265 only library objects ('.lo' files) may be specified, and '-rpath' is
4266 required, except when creating a convenience library.
4268 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
4269 using 'ar' and 'ranlib', or on Windows using 'lib'.
4271 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
4272 is created, otherwise an executable program is created."
4277 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4279 Remove libraries from an installation directory.
4281 RM is the name of the program to use to delete files associated with each FILE
4282 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4285 If FILE is a libtool library, all the files associated with it are deleted.
4286 Otherwise, only FILE itself is deleted using RM."
4290 func_fatal_help
"invalid operation mode '$opt_mode'"
4295 $ECHO "Try '$progname --help' for more information about other modes."
4298 # Now that we've collected a possible --mode arg, show help if necessary
4300 if test : = "$opt_help"; then
4305 for opt_mode
in compile link execute
install finish uninstall clean
; do
4308 } |
$SED -n '1p; 2,$s/^Usage:/ or: /p'
4311 for opt_mode
in compile link execute
install finish uninstall clean
; do
4317 /^When reporting/,/^Report/{
4322 /information about other modes/d
4323 /more detailed .*MODE/d
4324 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
4330 # func_mode_execute arg...
4331 func_mode_execute
()
4335 # The first argument is the command name.
4338 func_fatal_help
"you must specify a COMMAND"
4340 # Handle -dlopen flags immediately.
4341 for file in $opt_dlopen; do
4343 || func_fatal_help
"'$file' is not a file"
4348 func_resolve_sysroot
"$file"
4349 file=$func_resolve_sysroot_result
4351 # Check to see that this really is a libtool archive.
4352 func_lalib_unsafe_p
"$file" \
4353 || func_fatal_help
"'$lib' is not a valid libtool archive"
4355 # Read the libtool library.
4360 # Skip this library if it cannot be dlopened.
4361 if test -z "$dlname"; then
4362 # Warn if it was a shared library.
4363 test -n "$library_names" && \
4364 func_warning
"'$file' was not linked with '-export-dynamic'"
4368 func_dirname
"$file" "" "."
4369 dir
=$func_dirname_result
4371 if test -f "$dir/$objdir/$dlname"; then
4372 func_append dir
"/$objdir"
4374 if test ! -f "$dir/$dlname"; then
4375 func_fatal_error
"cannot find '$dlname' in '$dir' or '$dir/$objdir'"
4381 # Just add the directory containing the .lo file.
4382 func_dirname
"$file" "" "."
4383 dir
=$func_dirname_result
4387 func_warning
"'-dlopen' is ignored for non-libtool libraries and objects"
4392 # Get the absolute pathname.
4393 absdir
=`cd "$dir" && pwd`
4394 test -n "$absdir" && dir
=$absdir
4396 # Now add the directory to shlibpath_var.
4397 if eval "test -z \"\$$shlibpath_var\""; then
4398 eval "$shlibpath_var=\"\$dir\""
4400 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4404 # This variable tells wrapper scripts just to set shlibpath_var
4405 # rather than running their programs.
4406 libtool_execute_magic
=$magic
4408 # Check if any of the arguments is a wrapper script.
4413 -* |
*.la |
*.lo
) ;;
4415 # Do a test to see if this is really a libtool program.
4416 if func_ltwrapper_script_p
"$file"; then
4418 # Transform arg to wrapped name.
4419 file=$progdir/$program
4420 elif func_ltwrapper_executable_p
"$file"; then
4421 func_ltwrapper_scriptname
"$file"
4422 func_source
"$func_ltwrapper_scriptname_result"
4423 # Transform arg to wrapped name.
4424 file=$progdir/$program
4428 # Quote arguments (to preserve shell metacharacters).
4429 func_append_quoted args
"$file"
4432 if $opt_dry_run; then
4433 # Display what would be done.
4434 if test -n "$shlibpath_var"; then
4435 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
4436 echo "export $shlibpath_var"
4441 if test -n "$shlibpath_var"; then
4442 # Export the shlibpath_var.
4443 eval "export $shlibpath_var"
4446 # Restore saved environment variables
4447 for lt_var
in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
4449 eval "if test \"\${save_$lt_var+set}\" = set; then
4450 $lt_var=\$save_$lt_var; export $lt_var
4456 # Now prepare to actually exec the command.
4461 test execute
= "$opt_mode" && func_mode_execute
${1+"$@"}
4464 # func_mode_finish arg...
4473 for opt
in "$nonopt" ${1+"$@"}
4475 if test -d "$opt"; then
4476 func_append libdirs
" $opt"
4478 elif test -f "$opt"; then
4479 if func_lalib_unsafe_p
"$opt"; then
4480 func_append libs
" $opt"
4482 func_warning
"'$opt' is not a valid libtool archive"
4486 func_fatal_error
"invalid argument '$opt'"
4490 if test -n "$libs"; then
4491 if test -n "$lt_sysroot"; then
4492 sysroot_regex
=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
4493 sysroot_cmd
="s/\([ ']\)$sysroot_regex/\1/g;"
4498 # Remove sysroot references
4499 if $opt_dry_run; then
4500 for lib
in $libs; do
4501 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4504 tmpdir
=`func_mktempdir`
4505 for lib
in $libs; do
4506 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4508 mv -f $tmpdir/tmp-la
$lib
4514 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4515 for libdir
in $libdirs; do
4516 if test -n "$finish_cmds"; then
4517 # Do each command in the finish commands.
4518 func_execute_cmds
"$finish_cmds" 'admincmds="$admincmds
4521 if test -n "$finish_eval"; then
4522 # Do the single finish_eval.
4523 eval cmds
=\"$finish_eval\"
4524 $opt_dry_run ||
eval "$cmds" || func_append admincmds
"
4530 # Exit here if they wanted silent mode.
4531 $opt_quiet && exit $EXIT_SUCCESS
4533 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4534 echo "----------------------------------------------------------------------"
4535 echo "Libraries have been installed in:"
4536 for libdir
in $libdirs; do
4540 echo "If you ever happen to want to link against installed libraries"
4541 echo "in a given directory, LIBDIR, you must either use libtool, and"
4542 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4543 echo "flag during linking and do at least one of the following:"
4544 if test -n "$shlibpath_var"; then
4545 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4546 echo " during execution"
4548 if test -n "$runpath_var"; then
4549 echo " - add LIBDIR to the '$runpath_var' environment variable"
4550 echo " during linking"
4552 if test -n "$hardcode_libdir_flag_spec"; then
4554 eval flag
=\"$hardcode_libdir_flag_spec\"
4556 $ECHO " - use the '$flag' linker flag"
4558 if test -n "$admincmds"; then
4559 $ECHO " - have your system administrator run these commands:$admincmds"
4561 if test -f /etc
/ld.so.conf
; then
4562 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4566 echo "See any operating system documentation about shared libraries for"
4568 solaris2.
[6789]|solaris2.1
[0-9])
4569 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4573 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4576 echo "----------------------------------------------------------------------"
4581 test finish
= "$opt_mode" && func_mode_finish
${1+"$@"}
4584 # func_mode_install arg...
4585 func_mode_install
()
4589 # There may be an optional sh(1) argument at the beginning of
4590 # install_prog (especially on Windows NT).
4591 if test "$SHELL" = "$nonopt" ||
test /bin
/sh
= "$nonopt" ||
4592 # Allow the use of GNU shtool's install command.
4593 case $nonopt in *shtool
*) :;; *) false
;; esac
4595 # Aesthetically quote it.
4596 func_quote_for_eval
"$nonopt"
4597 install_prog
="$func_quote_for_eval_result "
4605 # The real first argument should be the name of the installation program.
4606 # Aesthetically quote it.
4607 func_quote_for_eval
"$arg"
4608 func_append install_prog
"$func_quote_for_eval_result"
4609 install_shared_prog
=$install_prog
4610 case " $install_prog " in
4611 *[\\\
/]cp\
*) install_cp
=: ;;
4612 *) install_cp
=false
;;
4615 # We need to accept at least all the BSD install flags.
4627 if test -n "$dest"; then
4628 func_append files
" $dest"
4636 if $install_cp; then :; else
4650 # If the previous option needed an argument, then skip it.
4651 if test -n "$prev"; then
4652 if test X-m
= "X$prev" && test -n "$install_override_mode"; then
4653 arg2
=$install_override_mode
4664 # Aesthetically quote the argument.
4665 func_quote_for_eval
"$arg"
4666 func_append install_prog
" $func_quote_for_eval_result"
4667 if test -n "$arg2"; then
4668 func_quote_for_eval
"$arg2"
4670 func_append install_shared_prog
" $func_quote_for_eval_result"
4673 test -z "$install_prog" && \
4674 func_fatal_help
"you must specify an install program"
4676 test -n "$prev" && \
4677 func_fatal_help
"the '$prev' option requires an argument"
4679 if test -n "$install_override_mode" && $no_mode; then
4680 if $install_cp; then :; else
4681 func_quote_for_eval
"$install_override_mode"
4682 func_append install_shared_prog
" -m $func_quote_for_eval_result"
4686 if test -z "$files"; then
4687 if test -z "$dest"; then
4688 func_fatal_help
"no file or destination specified"
4690 func_fatal_help
"you must specify a destination"
4694 # Strip any trailing slash from the destination.
4695 func_stripname
'' '/' "$dest"
4696 dest
=$func_stripname_result
4698 # Check to see that the destination is a directory.
4699 test -d "$dest" && isdir
=:
4704 func_dirname_and_basename
"$dest" "" "."
4705 destdir
=$func_dirname_result
4706 destname
=$func_basename_result
4708 # Not a directory, so check to see that there is only one file specified.
4709 set dummy
$files; shift
4710 test "$#" -gt 1 && \
4711 func_fatal_help
"'$dest' is not a directory"
4714 [\\/]* |
[A-Za-z
]:[\\/]*) ;;
4716 for file in $files; do
4720 func_fatal_help
"'$destdir' must be an absolute directory name"
4727 # This variable tells wrapper scripts just to set variables rather
4728 # than running their programs.
4729 libtool_install_magic
=$magic
4734 for file in $files; do
4736 # Do each installation.
4739 # Do the static libraries later.
4740 func_append staticlibs
" $file"
4744 func_resolve_sysroot
"$file"
4745 file=$func_resolve_sysroot_result
4747 # Check to see that this really is a libtool archive.
4748 func_lalib_unsafe_p
"$file" \
4749 || func_fatal_help
"'$file' is not a valid libtool archive"
4756 # Add the libdir to current_libdirs if it is the destination.
4757 if test "X$destdir" = "X$libdir"; then
4758 case "$current_libdirs " in
4760 *) func_append current_libdirs
" $libdir" ;;
4763 # Note the libdir as a future libdir.
4764 case "$future_libdirs " in
4766 *) func_append future_libdirs
" $libdir" ;;
4770 func_dirname
"$file" "/" ""
4771 dir
=$func_dirname_result
4772 func_append dir
"$objdir"
4774 if test -n "$relink_command"; then
4775 # Determine the prefix the user has applied to our future dir.
4776 inst_prefix_dir
=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4778 # Don't allow the user to place us outside of our expected
4779 # location b/c this prevents finding dependent libraries that
4780 # are installed to the same prefix.
4781 # At present, this check doesn't affect windows .dll's that
4782 # are installed into $libdir/../bin (currently, that works fine)
4783 # but it's something to keep an eye on.
4784 test "$inst_prefix_dir" = "$destdir" && \
4785 func_fatal_error
"error: cannot install '$file' to a directory not ending in $libdir"
4787 if test -n "$inst_prefix_dir"; then
4788 # Stick the inst_prefix_dir data into the link command.
4789 relink_command
=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4791 relink_command
=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4794 func_warning
"relinking '$file'"
4795 func_show_eval
"$relink_command" \
4796 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4799 # See the names of the shared library.
4800 set dummy
$library_names; shift
4801 if test -n "$1"; then
4806 test -n "$relink_command" && srcname
=${realname}T
4808 # Install the shared library and build the symlinks.
4809 func_show_eval
"$install_shared_prog $dir/$srcname $destdir/$realname" \
4813 cygwin
* | mingw
* | pw32
* | cegcc
*)
4828 if test -n "$tstripme" && test -n "$striplib"; then
4829 func_show_eval
"$striplib $destdir/$realname" 'exit $?'
4832 if test "$#" -gt 0; then
4833 # Delete the old symlinks, and create new ones.
4834 # Try 'ln -sf' first, because the 'ln' binary might depend on
4835 # the symlink we replace! Solaris /bin/ln does not understand -f,
4836 # so we also need to try rm && ln -s.
4839 test "$linkname" != "$realname" \
4840 && func_show_eval
"(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4844 # Do each command in the postinstall commands.
4845 lib
=$destdir/$realname
4846 func_execute_cmds
"$postinstall_cmds" 'exit $?'
4849 # Install the pseudo-library for information purposes.
4850 func_basename
"$file"
4851 name
=$func_basename_result
4852 instname
=$dir/${name}i
4853 func_show_eval
"$install_prog $instname $destdir/$name" 'exit $?'
4855 # Maybe install the static library, too.
4856 test -n "$old_library" && func_append staticlibs
" $dir/$old_library"
4860 # Install (i.e. copy) a libtool object.
4862 # Figure out destination file name, if it wasn't already specified.
4863 if test -n "$destname"; then
4864 destfile
=$destdir/$destname
4866 func_basename
"$file"
4867 destfile
=$func_basename_result
4868 destfile
=$destdir/$destfile
4871 # Deduce the name of the destination old-style object file.
4874 func_lo2o
"$destfile"
4875 staticdest
=$func_lo2o_result
4878 staticdest
=$destfile
4882 func_fatal_help
"cannot copy a libtool object to '$destfile'"
4886 # Install the libtool object if requested.
4887 test -n "$destfile" && \
4888 func_show_eval
"$install_prog $file $destfile" 'exit $?'
4890 # Install the old object if enabled.
4891 if test yes = "$build_old_libs"; then
4892 # Deduce the name of the old-style object file.
4894 staticobj
=$func_lo2o_result
4895 func_show_eval
"$install_prog \$staticobj \$staticdest" 'exit $?'
4901 # Figure out destination file name, if it wasn't already specified.
4902 if test -n "$destname"; then
4903 destfile
=$destdir/$destname
4905 func_basename
"$file"
4906 destfile
=$func_basename_result
4907 destfile
=$destdir/$destfile
4910 # If the file is missing, and there is a .exe on the end, strip it
4911 # because it is most likely a libtool script we actually want to
4916 if test ! -f "$file"; then
4917 func_stripname
'' '.exe' "$file"
4918 file=$func_stripname_result
4924 # Do a test to see if this is really a libtool program.
4927 if func_ltwrapper_executable_p
"$file"; then
4928 func_ltwrapper_scriptname
"$file"
4929 wrapper
=$func_ltwrapper_scriptname_result
4931 func_stripname
'' '.exe' "$file"
4932 wrapper
=$func_stripname_result
4939 if func_ltwrapper_script_p
"$wrapper"; then
4943 func_source
"$wrapper"
4945 # Check the variables that should have been set.
4946 test -z "$generated_by_libtool_version" && \
4947 func_fatal_error
"invalid libtool wrapper script '$wrapper'"
4950 for lib
in $notinst_deplibs; do
4951 # Check to see that each library is installed.
4953 if test -f "$lib"; then
4956 libfile
=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4957 if test -n "$libdir" && test ! -f "$libfile"; then
4958 func_warning
"'$lib' has not been installed in '$libdir'"
4964 func_source
"$wrapper"
4967 if test no
= "$fast_install" && test -n "$relink_command"; then
4970 tmpdir
=`func_mktempdir`
4971 func_basename
"$file$stripped_ext"
4972 file=$func_basename_result
4973 outputname
=$tmpdir/$file
4974 # Replace the output file specification.
4975 relink_command
=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4978 func_quote_for_expand
"$relink_command"
4979 eval "func_echo $func_quote_for_expand_result"
4981 if eval "$relink_command"; then :
4983 func_error
"error: relink '$file' with the above command before installing it"
4984 $opt_dry_run ||
${RM}r
"$tmpdir"
4989 func_warning
"cannot relink '$file'"
4993 # Install the binary that we compiled earlier.
4994 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
4998 # remove .exe since cygwin /usr/bin/install will append another
5000 case $install_prog,$host in
5001 */usr
/bin
/install*,*cygwin
*)
5002 case $file:$destfile in
5007 destfile
=$destfile.exe
5010 func_stripname
'' '.exe' "$destfile"
5011 destfile
=$func_stripname_result
5016 func_show_eval
"$install_prog\$stripme \$file \$destfile" 'exit $?'
5017 $opt_dry_run ||
if test -n "$outputname"; then
5024 for file in $staticlibs; do
5025 func_basename
"$file"
5026 name
=$func_basename_result
5028 # Set up the ranlib parameters.
5029 oldlib
=$destdir/$name
5030 func_to_tool_file
"$oldlib" func_convert_file_msys_to_w32
5031 tool_oldlib
=$func_to_tool_file_result
5033 func_show_eval
"$install_prog \$file \$oldlib" 'exit $?'
5035 if test -n "$stripme" && test -n "$old_striplib"; then
5036 func_show_eval
"$old_striplib $tool_oldlib" 'exit $?'
5039 # Do each command in the postinstall commands.
5040 func_execute_cmds
"$old_postinstall_cmds" 'exit $?'
5043 test -n "$future_libdirs" && \
5044 func_warning
"remember to run '$progname --finish$future_libdirs'"
5046 if test -n "$current_libdirs"; then
5047 # Maybe just do a dry run.
5048 $opt_dry_run && current_libdirs
=" -n$current_libdirs"
5049 exec_cmd
='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
5055 test install = "$opt_mode" && func_mode_install
${1+"$@"}
5058 # func_generate_dlsyms outputname originator pic_p
5059 # Extract symbols from dlprefiles and create ${outputname}S.o with
5060 # a dlpreopen symbol table.
5061 func_generate_dlsyms
()
5068 my_prefix
=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
5071 if test -n "$dlfiles$dlprefiles" ||
test no
!= "$dlself"; then
5072 if test -n "$NM" && test -n "$global_symbol_pipe"; then
5073 my_dlsyms
=${my_outputname}S.c
5075 func_error
"not configured to extract global symbols from dlpreopened files"
5079 if test -n "$my_dlsyms"; then
5083 # Discover the nlist of each of the dlfiles.
5084 nlist
=$output_objdir/$my_outputname.nm
5086 func_show_eval
"$RM $nlist ${nlist}S ${nlist}T"
5088 # Parse the name list into a source file.
5089 func_verbose
"creating $output_objdir/$my_dlsyms"
5091 $opt_dry_run ||
$ECHO > "$output_objdir/$my_dlsyms" "\
5092 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
5093 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
5099 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
5100 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
5103 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
5104 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
5105 /* DATA imports from DLLs on WIN32 can't be const, because runtime
5106 relocations are performed -- see ld's documentation on pseudo-relocs. */
5107 # define LT_DLSYM_CONST
5108 #elif defined __osf__
5109 /* This system does not cope well with relocations in const data. */
5110 # define LT_DLSYM_CONST
5112 # define LT_DLSYM_CONST const
5115 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5117 /* External symbol declarations for the compiler. */\
5120 if test yes = "$dlself"; then
5121 func_verbose
"generating symbol list for '$output'"
5123 $opt_dry_run ||
echo ': @PROGRAM@ ' > "$nlist"
5125 # Add our own program objects to the symbol list.
5126 progfiles
=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
5127 for progfile
in $progfiles; do
5128 func_to_tool_file
"$progfile" func_convert_file_msys_to_w32
5129 func_verbose
"extracting global C symbols from '$func_to_tool_file_result'"
5130 $opt_dry_run ||
eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
5133 if test -n "$exclude_expsyms"; then
5135 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
5136 eval '$MV "$nlist"T "$nlist"'
5140 if test -n "$export_symbols_regex"; then
5142 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
5143 eval '$MV "$nlist"T "$nlist"'
5147 # Prepare the list of exported symbols
5148 if test -z "$export_symbols"; then
5149 export_symbols
=$output_objdir/$outputname.exp
5152 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
5154 *cygwin
* |
*mingw
* |
*cegcc
* )
5155 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5156 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
5162 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
5163 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
5164 eval '$MV "$nlist"T "$nlist"'
5166 *cygwin
* |
*mingw
* |
*cegcc
* )
5167 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
5168 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
5175 for dlprefile
in $dlprefiles; do
5176 func_verbose
"extracting global C symbols from '$dlprefile'"
5177 func_basename
"$dlprefile"
5178 name
=$func_basename_result
5180 *cygwin
* |
*mingw
* |
*cegcc
* )
5181 # if an import library, we need to obtain dlname
5182 if func_win32_import_lib_p
"$dlprefile"; then
5183 func_tr_sh
"$dlprefile"
5184 eval "curr_lafile=\$libfile_$func_tr_sh_result"
5185 dlprefile_dlbasename
=
5186 if test -n "$curr_lafile" && func_lalib_p
"$curr_lafile"; then
5187 # Use subshell, to avoid clobbering current variable values
5188 dlprefile_dlname
=`source "$curr_lafile" && echo "$dlname"`
5189 if test -n "$dlprefile_dlname"; then
5190 func_basename
"$dlprefile_dlname"
5191 dlprefile_dlbasename
=$func_basename_result
5193 # no lafile. user explicitly requested -dlpreopen <import library>.
5194 $sharedlib_from_linklib_cmd "$dlprefile"
5195 dlprefile_dlbasename
=$sharedlib_from_linklib_result
5199 if test -n "$dlprefile_dlbasename"; then
5200 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
5202 func_warning
"Could not compute DLL name from $name"
5203 eval '$ECHO ": $name " >> "$nlist"'
5205 func_to_tool_file
"$dlprefile" func_convert_file_msys_to_w32
5206 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
5207 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
5209 else # not an import lib
5211 eval '$ECHO ": $name " >> "$nlist"'
5212 func_to_tool_file
"$dlprefile" func_convert_file_msys_to_w32
5213 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5219 eval '$ECHO ": $name " >> "$nlist"'
5220 func_to_tool_file
"$dlprefile" func_convert_file_msys_to_w32
5221 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
5228 # Make sure we have at least an empty file.
5229 test -f "$nlist" ||
: > "$nlist"
5231 if test -n "$exclude_expsyms"; then
5232 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
5233 $MV "$nlist"T
"$nlist"
5236 # Try sorting and uniquifying the output.
5237 if $GREP -v "^: " < "$nlist" |
5238 if sort -k 3 </dev
/null
>/dev
/null
2>&1; then
5243 uniq > "$nlist"S
; then
5246 $GREP -v "^: " < "$nlist" > "$nlist"S
5249 if test -f "$nlist"S
; then
5250 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
5252 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
5255 func_show_eval
'$RM "${nlist}I"'
5256 if test -n "$global_symbol_to_import"; then
5257 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
5260 echo >> "$output_objdir/$my_dlsyms" "\
5262 /* The mapping between symbol names and symbols. */
5267 extern LT_DLSYM_CONST lt_dlsymlist
5268 lt_${my_prefix}_LTX_preloaded_symbols[];\
5271 if test -s "$nlist"I
; then
5272 echo >> "$output_objdir/$my_dlsyms" "\
5273 static void lt_syminit(void)
5275 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
5276 for (; symbol->name; ++symbol)
5278 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I
>> "$output_objdir/$my_dlsyms"
5279 echo >> "$output_objdir/$my_dlsyms" "\
5283 echo >> "$output_objdir/$my_dlsyms" "\
5284 LT_DLSYM_CONST lt_dlsymlist
5285 lt_${my_prefix}_LTX_preloaded_symbols[] =
5286 { {\"$my_originator\", (void *) 0},"
5288 if test -s "$nlist"I
; then
5289 echo >> "$output_objdir/$my_dlsyms" "\
5290 {\"@INIT@\", (void *) <_syminit},"
5293 case $need_lib_prefix in
5295 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
5298 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
5301 echo >> "$output_objdir/$my_dlsyms" "\
5305 /* This works around a problem in FreeBSD linker */
5306 #ifdef FREEBSD_WORKAROUND
5307 static const void *lt_preloaded_setup() {
5308 return lt_${my_prefix}_LTX_preloaded_symbols;
5318 pic_flag_for_symtable
=
5319 case "$compile_command " in
5323 # compiling the symbol table file with pic_flag works around
5324 # a FreeBSD bug that causes programs to crash when -lm is
5325 # linked before any other PIC object. But we must not use
5326 # pic_flag when linking with -static. The problem exists in
5327 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
5328 *-*-freebsd2.
*|
*-*-freebsd3.0
*|
*-*-freebsdelf3.0
*)
5329 pic_flag_for_symtable
=" $pic_flag -DFREEBSD_WORKAROUND" ;;
5331 pic_flag_for_symtable
=" $pic_flag" ;;
5333 $my_pic_p && pic_flag_for_symtable
=" $pic_flag"
5339 for arg
in $LTCFLAGS; do
5341 -pie |
-fpie |
-fPIE) ;;
5342 *) func_append symtab_cflags
" $arg" ;;
5346 # Now compile the dynamic symbol file.
5347 func_show_eval
'(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
5349 # Clean up the generated files.
5350 func_show_eval
'$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
5352 # Transform the symbol file into the correct name.
5353 symfileobj
=$output_objdir/${my_outputname}S.
$objext
5355 *cygwin
* |
*mingw
* |
*cegcc
* )
5356 if test -f "$output_objdir/$my_outputname.def"; then
5357 compile_command
=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5358 finalize_command
=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5360 compile_command
=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5361 finalize_command
=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5365 compile_command
=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5366 finalize_command
=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5371 func_fatal_error
"unknown suffix for '$my_dlsyms'"
5375 # We keep going just in case the user didn't refer to
5376 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
5377 # really was required.
5379 # Nullify the symbol file.
5380 compile_command
=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
5381 finalize_command
=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
5385 # func_cygming_gnu_implib_p ARG
5386 # This predicate returns with zero status (TRUE) if
5387 # ARG is a GNU/binutils-style import library. Returns
5388 # with nonzero status (FALSE) otherwise.
5389 func_cygming_gnu_implib_p
()
5393 func_to_tool_file
"$1" func_convert_file_msys_to_w32
5394 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)$'`
5395 test -n "$func_cygming_gnu_implib_tmp"
5398 # func_cygming_ms_implib_p ARG
5399 # This predicate returns with zero status (TRUE) if
5400 # ARG is an MS-style import library. Returns
5401 # with nonzero status (FALSE) otherwise.
5402 func_cygming_ms_implib_p
()
5406 func_to_tool_file
"$1" func_convert_file_msys_to_w32
5407 func_cygming_ms_implib_tmp
=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
5408 test -n "$func_cygming_ms_implib_tmp"
5411 # func_win32_libid arg
5412 # return the library type of file 'arg'
5414 # Need a lot of goo to handle *both* DLLs and import libs
5415 # Has to be a shell function in order to 'eat' the argument
5416 # that is supplied when $file_magic_command is called.
5417 # Despite the name, also deal with 64 bit binaries.
5422 win32_libid_type
=unknown
5423 win32_fileres
=`file -L $1 2>/dev/null`
5424 case $win32_fileres in
5425 *ar\ archive\ import\ library
*) # definitely import
5426 win32_libid_type
="x86 archive import"
5428 *ar\ archive
*) # could be an import, or static
5429 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
5430 if eval $OBJDUMP -f $1 |
$SED -e '10q' 2>/dev
/null |
5431 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev
/null
; then
5432 case $nm_interface in
5434 if func_cygming_ms_implib_p
"$1" ||
5435 func_cygming_gnu_implib_p
"$1"
5443 func_to_tool_file
"$1" func_convert_file_msys_to_w32
5444 win32_nmres
=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
5455 case $win32_nmres in
5456 import
*) win32_libid_type
="x86 archive import";;
5457 *) win32_libid_type
="x86 archive static";;
5462 win32_libid_type
="x86 DLL"
5464 *executable
*) # but shell scripts are "executable" too...
5465 case $win32_fileres in
5466 *MS\ Windows\ PE\ Intel
*)
5467 win32_libid_type
="x86 DLL"
5472 $ECHO "$win32_libid_type"
5475 # func_cygming_dll_for_implib ARG
5477 # Platform-specific function to extract the
5478 # name of the DLL associated with the specified
5479 # import library ARG.
5480 # Invoked by eval'ing the libtool variable
5481 # $sharedlib_from_linklib_cmd
5482 # Result is available in the variable
5483 # $sharedlib_from_linklib_result
5484 func_cygming_dll_for_implib
()
5488 sharedlib_from_linklib_result
=`$DLLTOOL --identify-strict --identify "$1"`
5491 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
5493 # The is the core of a fallback implementation of a
5494 # platform-specific function to extract the name of the
5495 # DLL associated with the specified import library LIBNAME.
5497 # SECTION_NAME is either .idata$6 or .idata$7, depending
5498 # on the platform and compiler that created the implib.
5500 # Echos the name of the DLL associated with the
5501 # specified import library.
5502 func_cygming_dll_for_implib_fallback_core
()
5506 match_literal
=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5507 $OBJDUMP -s --section "$1" "$2" 2>/dev
/null |
5508 $SED '/^Contents of section '"$match_literal"':/{
5509 # Place marker at beginning of archive member dllname section
5514 # These lines can sometimes be longer than 43 characters, but
5515 # are always uninteresting
5516 /:[ ]*file format pe[i]\{,1\}-/d
5517 /^In archive [^:]*:/d
5518 # Ensure marker is printed
5520 # Remove all lines with less than 43 characters
5522 # From remaining lines, remove first 43 characters
5525 # Join marker and all lines until next marker into a single line
5526 /^====MARK====/ b para
5535 # Remove trailing dots and whitespace
5539 # we now have a list, one entry per line, of the stringified
5540 # contents of the appropriate section of all members of the
5541 # archive that possess that section. Heuristic: eliminate
5542 # all those that have a first or second character that is
5543 # a '.' (that is, objdump's representation of an unprintable
5544 # character.) This should work for all archives with less than
5545 # 0x302f exports -- but will fail for DLLs whose name actually
5546 # begins with a literal '.' or a single character followed by
5549 # Of those that remain, print the first one.
5550 $SED -e '/^\./d;/^.\./d;q'
5553 # func_cygming_dll_for_implib_fallback ARG
5554 # Platform-specific function to extract the
5555 # name of the DLL associated with the specified
5556 # import library ARG.
5558 # This fallback implementation is for use when $DLLTOOL
5559 # does not support the --identify-strict option.
5560 # Invoked by eval'ing the libtool variable
5561 # $sharedlib_from_linklib_cmd
5562 # Result is available in the variable
5563 # $sharedlib_from_linklib_result
5564 func_cygming_dll_for_implib_fallback
()
5568 if func_cygming_gnu_implib_p
"$1"; then
5569 # binutils import library
5570 sharedlib_from_linklib_result
=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5571 elif func_cygming_ms_implib_p
"$1"; then
5572 # ms-generated import library
5573 sharedlib_from_linklib_result
=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5576 sharedlib_from_linklib_result
=
5581 # func_extract_an_archive dir oldlib
5582 func_extract_an_archive
()
5586 f_ex_an_ar_dir
=$1; shift
5587 f_ex_an_ar_oldlib
=$1
5588 if test yes = "$lock_old_archive_extraction"; then
5589 lockfile
=$f_ex_an_ar_oldlib.lock
5590 until $opt_dry_run ||
ln "$progpath" "$lockfile" 2>/dev
/null
; do
5591 func_echo
"Waiting for $lockfile to be removed"
5595 func_show_eval
"(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5596 'stat=$?; rm -f "$lockfile"; exit $stat'
5597 if test yes = "$lock_old_archive_extraction"; then
5598 $opt_dry_run ||
rm -f "$lockfile"
5600 if ($AR t
"$f_ex_an_ar_oldlib" |
sort |
sort -uc >/dev
/null
2>&1); then
5603 func_fatal_error
"object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5608 # func_extract_archives gentop oldlib ...
5609 func_extract_archives
()
5614 my_oldlibs
=${1+"$@"}
5620 for my_xlib
in $my_oldlibs; do
5621 # Extract the objects.
5623 [\\/]* |
[A-Za-z
]:[\\/]*) my_xabs
=$my_xlib ;;
5624 *) my_xabs
=`pwd`"/$my_xlib" ;;
5626 func_basename
"$my_xlib"
5627 my_xlib
=$func_basename_result
5630 case " $extracted_archives " in
5632 func_arith
$extracted_serial + 1
5633 extracted_serial
=$func_arith_result
5634 my_xlib_u
=lt
$extracted_serial-$my_xlib ;;
5638 extracted_archives
="$extracted_archives $my_xlib_u"
5639 my_xdir
=$my_gentop/$my_xlib_u
5641 func_mkdir_p
"$my_xdir"
5645 func_verbose
"Extracting $my_xabs"
5646 # Do not bother doing anything if just a dry run
5648 darwin_orig_dir
=`pwd`
5649 cd $my_xdir ||
exit $?
5650 darwin_archive
=$my_xabs
5652 func_basename
"$darwin_archive"
5653 darwin_base_archive
=$func_basename_result
5654 darwin_arches
=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5655 if test -n "$darwin_arches"; then
5656 darwin_arches
=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5658 func_verbose
"$darwin_base_archive has multiple architectures $darwin_arches"
5659 for darwin_arch
in $darwin_arches; do
5660 func_mkdir_p
"unfat-$$/$darwin_base_archive-$darwin_arch"
5661 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5662 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5663 func_extract_an_archive
"`pwd`" "$darwin_base_archive"
5665 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5666 done # $darwin_arches
5667 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5668 darwin_filelist
=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5671 for darwin_file
in $darwin_filelist; do
5672 darwin_files
=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5673 $LIPO -create -output "$darwin_file" $darwin_files
5674 done # $darwin_filelist
5676 cd "$darwin_orig_dir"
5679 func_extract_an_archive
"$my_xdir" "$my_xabs"
5684 func_extract_an_archive
"$my_xdir" "$my_xabs"
5687 my_oldobjs
="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5690 func_extract_archives_result
=$my_oldobjs
5694 # func_emit_wrapper [arg=no]
5696 # Emit a libtool wrapper script on stdout.
5697 # Don't directly open a file because we may want to
5698 # incorporate the script contents within a cygwin/mingw
5699 # wrapper executable. Must ONLY be called from within
5700 # func_mode_link because it depends on a number of variables
5703 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5704 # variable will take. If 'yes', then the emitted script
5705 # will assume that the directory where it is stored is
5706 # the $objdir directory. This is a cygwin/mingw-specific
5708 func_emit_wrapper
()
5710 func_emit_wrapper_arg1
=${1-no}
5715 # $output - temporary wrapper script for $objdir/$outputname
5716 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5718 # The $output program cannot be directly executed until all the libtool
5719 # libraries that it depends on are installed.
5721 # This wrapper script should never be moved out of the build directory.
5722 # If it is, it will not operate correctly.
5724 # Sed substitution that helps us do robust quoting. It backslashifies
5725 # metacharacters that are still active within double-quoted strings.
5726 sed_quote_subst='$sed_quote_subst'
5728 # Be Bourne compatible
5729 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5732 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5733 # is contrary to our usage. Disable this feature.
5734 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5735 setopt NO_GLOB_SUBST
5737 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5739 BIN_SH=xpg4; export BIN_SH # for Tru64
5740 DUALCASE=1; export DUALCASE # for MKS sh
5742 # The HP-UX ksh and POSIX shell print the target directory to stdout
5744 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5746 relink_command=\"$relink_command\"
5748 # This environment variable determines our operation mode.
5749 if test \"\$libtool_install_magic\" = \"$magic\"; then
5750 # install mode needs the following variables:
5751 generated_by_libtool_version='$macro_version'
5752 notinst_deplibs='$notinst_deplibs'
5754 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5755 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5758 qECHO
=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
5761 # A function that is used when there is no print builtin or printf.
5762 func_fallback_echo ()
5764 eval 'cat <<_LTECHO_EOF
5771 # Very basic option parsing. These options are (a) specific to
5772 # the libtool wrapper, (b) are identical between the wrapper
5773 # /script/ and the wrapper /executable/ that is used only on
5774 # windows platforms, and (c) all begin with the string "--lt-"
5775 # (application programs are unlikely to have options that match
5778 # There are only two supported options: --lt-debug and
5779 # --lt-dump-script. There is, deliberately, no --lt-help.
5781 # The first argument to this parsing function should be the
5782 # script's $0 value, followed by "$@
".
5784 func_parse_lt_options ()
5790 case \"\$lt_opt\" in
5791 --lt-debug) lt_option_debug=1 ;;
5793 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5794 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5795 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5796 cat \"\$lt_dump_D/\$lt_dump_F\"
5800 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5806 # Print the debug banner immediately:
5807 if test -n \"\$lt_option_debug\"; then
5808 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5812 # Used when --lt-debug. Prints its arguments to stdout
5813 # (redirection is the responsibility of the caller)
5814 func_lt_dump_args ()
5819 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5820 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5824 # Core function for launching the target application
5825 func_exec_program_core ()
5829 # Backslashes separate directories on plain windows
5830 *-*-mingw |
*-*-os2* |
*-cegcc*)
5832 if test -n \"\$lt_option_debug\"; then
5833 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5834 func_lt_dump_args \${1+\"\$@\"} 1>&2
5836 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5842 if test -n \"\$lt_option_debug\"; then
5843 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5844 func_lt_dump_args \${1+\"\$@\"} 1>&2
5846 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5851 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5855 # A function to encapsulate launching the target application
5856 # Strips options in the --lt-* namespace from \$@ and
5857 # launches target application with the remaining arguments.
5858 func_exec_program ()
5866 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5871 func_exec_program_core \${1+\"\$@\"}
5875 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5877 # Find the directory that this script lives in.
5878 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5879 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5881 # Follow symbolic links until we get to the real thisdir.
5882 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5883 while test -n \"\$file\"; do
5884 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5886 # If there was a directory component, then change thisdir.
5887 if test \"x\$destdir\" != \"x\$file\"; then
5888 case \"\$destdir\" in
5889 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5890 *) thisdir=\"\$thisdir/\$destdir\" ;;
5894 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5895 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5898 # Usually 'no', except on cygwin/mingw when embedded into
5900 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5901 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5902 # special case for '.'
5903 if test \"\$thisdir\" = \".\"; then
5906 # remove .libs from thisdir
5907 case \"\$thisdir\" in
5908 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5909 $objdir ) thisdir=. ;;
5913 # Try to get the absolute directory name.
5914 absdir=\`cd \"\$thisdir\" && pwd\`
5915 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5918 if test yes = "$fast_install"; then
5920 program=lt-'$outputname'$exeext
5921 progdir=\"\$thisdir/$objdir\"
5923 if test ! -f \"\$progdir/\$program\" ||
5924 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5925 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5927 file=\"\$\$-\$program\"
5929 if test ! -d \"\$progdir\"; then
5930 $MKDIR \"\$progdir\"
5932 $RM \"\$progdir/\$file\"
5937 # relink executable if necessary
5938 if test -n \"\$relink_command\"; then
5939 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5941 \$ECHO \"\$relink_command_output\" >&2
5942 $RM \"\$progdir/\$file\"
5947 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5948 { $RM \"\$progdir/\$program\";
5949 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5950 $RM \"\$progdir/\$file\"
5954 program='$outputname'
5955 progdir=\"\$thisdir/$objdir\"
5961 if test -f \"\$progdir/\$program\"; then"
5963 # fixup the dll searchpath if we need to.
5965 # Fix the DLL searchpath if we need to. Do this before prepending
5966 # to shlibpath, because on Windows, both are PATH and uninstalled
5967 # libraries must come first.
5968 if test -n "$dllsearchpath"; then
5970 # Add the dll search path components to the executable PATH
5971 PATH=$dllsearchpath:\$PATH
5975 # Export our shlibpath_var if we have one.
5976 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5978 # Add our own library path to $shlibpath_var
5979 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5981 # Some systems cannot cope with colon-terminated $shlibpath_var
5982 # The second colon is a workaround for a bug in BeOS R4 sed
5983 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5985 export $shlibpath_var
5990 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5991 # Run the actual program with our arguments.
5992 func_exec_program \${1+\"\$@\"}
5995 # The program doesn't exist.
5996 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
5997 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
5998 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
6006 # func_emit_cwrapperexe_src
6007 # emit the source code for a wrapper executable on stdout
6008 # Must ONLY be called from within func_mode_link because
6009 # it depends on a number of variable set therein.
6010 func_emit_cwrapperexe_src
()
6014 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
6015 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
6017 The $output program cannot be directly executed until all the libtool
6018 libraries that it depends on are installed.
6020 This wrapper executable should never be moved out of the build directory.
6021 If it is, it will not operate correctly.
6026 # define _CRT_SECURE_NO_DEPRECATE 1
6031 # include <direct.h>
6032 # include <process.h>
6035 # include <unistd.h>
6036 # include <stdint.h>
6048 #include <sys/stat.h>
6050 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
6052 /* declarations of non-ANSI functions */
6053 #if defined __MINGW32__
6054 # ifdef __STRICT_ANSI__
6055 int _putenv (const char *);
6057 #elif defined __CYGWIN__
6058 # ifdef __STRICT_ANSI__
6059 char *realpath (const char *, char *);
6060 int putenv (char *);
6061 int setenv (const char *, const char *, int);
6063 /* #elif defined other_platform || defined ... */
6066 /* portability defines, excluding path handling macros */
6067 #if defined _MSC_VER
6068 # define setmode _setmode
6070 # define chmod _chmod
6071 # define getcwd _getcwd
6072 # define putenv _putenv
6073 # define S_IXUSR _S_IEXEC
6074 #elif defined __MINGW32__
6075 # define setmode _setmode
6077 # define chmod _chmod
6078 # define getcwd _getcwd
6079 # define putenv _putenv
6080 #elif defined __CYGWIN__
6081 # define HAVE_SETENV
6082 # define FOPEN_WB "wb"
6083 /* #elif defined other platforms ... */
6086 #if defined PATH_MAX
6087 # define LT_PATHMAX PATH_MAX
6088 #elif defined MAXPATHLEN
6089 # define LT_PATHMAX MAXPATHLEN
6091 # define LT_PATHMAX 1024
6101 /* path handling portability macros */
6102 #ifndef DIR_SEPARATOR
6103 # define DIR_SEPARATOR '/'
6104 # define PATH_SEPARATOR ':'
6107 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
6109 # define HAVE_DOS_BASED_FILE_SYSTEM
6110 # define FOPEN_WB "wb"
6111 # ifndef DIR_SEPARATOR_2
6112 # define DIR_SEPARATOR_2 '\\'
6114 # ifndef PATH_SEPARATOR_2
6115 # define PATH_SEPARATOR_2 ';'
6119 #ifndef DIR_SEPARATOR_2
6120 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
6121 #else /* DIR_SEPARATOR_2 */
6122 # define IS_DIR_SEPARATOR(ch) \
6123 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
6124 #endif /* DIR_SEPARATOR_2 */
6126 #ifndef PATH_SEPARATOR_2
6127 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
6128 #else /* PATH_SEPARATOR_2 */
6129 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
6130 #endif /* PATH_SEPARATOR_2 */
6133 # define FOPEN_WB "w"
6136 # define _O_BINARY 0
6139 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
6140 #define XFREE(stale) do { \
6141 if (stale) { free (stale); stale = 0; } \
6144 #if defined LT_DEBUGWRAPPER
6145 static int lt_debug = 1;
6147 static int lt_debug = 0;
6150 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
6152 void *xmalloc (size_t num);
6153 char *xstrdup (const char *string);
6154 const char *base_name (const char *name);
6155 char *find_executable (const char *wrapper);
6156 char *chase_symlinks (const char *pathspec);
6157 int make_executable (const char *path);
6158 int check_executable (const char *path);
6159 char *strendzap (char *str, const char *pat);
6160 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
6161 void lt_fatal (const char *file, int line, const char *message, ...);
6162 static const char *nonnull (const char *s);
6163 static const char *nonempty (const char *s);
6164 void lt_setenv (const char *name, const char *value);
6165 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
6166 void lt_update_exe_path (const char *name, const char *value);
6167 void lt_update_lib_path (const char *name, const char *value);
6168 char **prepare_spawn (char **argv);
6169 void lt_dump_script (FILE *f);
6173 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
6174 # define externally_visible volatile
6176 # define externally_visible __attribute__((externally_visible)) volatile
6178 externally_visible const char * MAGIC_EXE = "$magic_exe";
6179 const char * LIB_PATH_VARNAME = "$shlibpath_var";
6182 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
6183 func_to_host_path "$temp_rpath"
6185 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
6189 const char
* LIB_PATH_VALUE
= "";
6193 if test -n "$dllsearchpath"; then
6194 func_to_host_path
"$dllsearchpath:"
6196 const char * EXE_PATH_VARNAME = "PATH";
6197 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
6201 const char * EXE_PATH_VARNAME = "";
6202 const char * EXE_PATH_VALUE = "";
6206 if test yes = "$fast_install"; then
6208 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
6212 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
6219 #define LTWRAPPER_OPTION_PREFIX "--lt-"
6221 static const char
*ltwrapper_option_prefix
= LTWRAPPER_OPTION_PREFIX
;
6222 static const char
*dumpscript_opt
= LTWRAPPER_OPTION_PREFIX
"dump-script";
6223 static const char
*debug_opt
= LTWRAPPER_OPTION_PREFIX
"debug";
6226 main
(int argc
, char
*argv
[])
6231 char
*actual_cwrapper_path
;
6232 char
*actual_cwrapper_name
;
6239 program_name
= (char
*) xstrdup
(base_name
(argv
[0]));
6240 newargz
= XMALLOC
(char
*, (size_t
) argc
+ 1);
6242 /* very simple arg parsing
; don
't want to rely on getopt
6243 * also, copy all non cwrapper options to newargz, except
6244 * argz[0], which is handled differently
6247 for (i = 1; i < argc; i++)
6249 if (STREQ (argv[i], dumpscript_opt))
6253 *mingw* | *cygwin* )
6254 # make stdout use "unix" line endings
6255 echo " setmode(1,_O_BINARY);"
6260 lt_dump_script (stdout);
6263 if (STREQ (argv[i], debug_opt))
6268 if (STREQ (argv[i], ltwrapper_option_prefix))
6270 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
6271 namespace, but it is not one of the ones we know about and
6272 have already dealt with, above (inluding dump-script), then
6273 report an error. Otherwise, targets might begin to believe
6274 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
6275 namespace. The first time any user complains about this, we'll
6276 need to
make LTWRAPPER_OPTION_PREFIX a configure-time option
6277 or a configure.ac-settable value.
6279 lt_fatal
(__FILE__
, __LINE__
,
6280 "unrecognized %s option: '%s'",
6281 ltwrapper_option_prefix
, argv
[i
]);
6284 newargz
[++newargc
] = xstrdup
(argv
[i
]);
6286 newargz
[++newargc
] = NULL
;
6290 /* The GNU banner must be the first non-error debug message */
6291 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
6294 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
6295 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
6297 tmp_pathspec = find_executable (argv[0]);
6298 if (tmp_pathspec == NULL)
6299 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
6300 lt_debugprintf (__FILE__, __LINE__,
6301 "(main) found exe (before symlink chase) at: %s\n",
6304 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
6305 lt_debugprintf (__FILE__, __LINE__,
6306 "(main) found exe (after symlink chase) at: %s\n",
6307 actual_cwrapper_path);
6308 XFREE (tmp_pathspec);
6310 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
6311 strendzap (actual_cwrapper_path, actual_cwrapper_name);
6313 /* wrapper name transforms */
6314 strendzap (actual_cwrapper_name, ".exe");
6315 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
6316 XFREE (actual_cwrapper_name);
6317 actual_cwrapper_name = tmp_pathspec;
6320 /* target_name transforms -- use actual target program name; might have lt- prefix */
6321 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
6322 strendzap (target_name, ".exe");
6323 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
6324 XFREE (target_name);
6325 target_name = tmp_pathspec;
6328 lt_debugprintf (__FILE__, __LINE__,
6329 "(main) libtool target name: %s\n",
6335 XMALLOC (char, (strlen (actual_cwrapper_path) +
6336 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
6337 strcpy (newargz[0], actual_cwrapper_path);
6338 strcat (newargz[0], "$objdir");
6339 strcat (newargz[0], "/");
6343 /* stop here
, and copy so we don
't have to do this twice */
6344 tmp_pathspec = xstrdup (newargz[0]);
6346 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
6347 strcat (newargz[0], actual_cwrapper_name);
6349 /* DO want the lt- prefix here if it exists, so use target_name */
6350 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
6351 XFREE (tmp_pathspec);
6352 tmp_pathspec = NULL;
6360 while ((p = strchr (newargz[0], '\\')) != NULL)
6364 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
6374 XFREE (target_name);
6375 XFREE (actual_cwrapper_path);
6376 XFREE (actual_cwrapper_name);
6378 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
6379 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
6380 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
6381 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
6382 because on Windows, both *_VARNAMEs are PATH but uninstalled
6383 libraries must come first. */
6384 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
6385 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
6387 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
6388 nonnull (lt_argv_zero));
6389 for (i = 0; i < newargc; i++)
6391 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
6392 i, nonnull (newargz[i]));
6400 /* execv doesn't actually work on mingw as expected on unix
*/
6401 newargz
= prepare_spawn
(newargz
);
6402 rval
= (int
) _spawnv
(_P_WAIT
, lt_argv_zero
, (const char
* const
*) newargz
);
6405 /* failed to start process
*/
6406 lt_debugprintf
(__FILE__
, __LINE__
,
6407 "(main) failed to launch target \"%s\": %s\n",
6408 lt_argv_zero
, nonnull
(strerror
(errno
)));
6416 execv (lt_argv_zero, newargz);
6417 return rval; /* =127, but avoids unused variable warning */
6426 xmalloc
(size_t num
)
6428 void
*p
= (void
*) malloc
(num
);
6430 lt_fatal
(__FILE__
, __LINE__
, "memory exhausted");
6436 xstrdup
(const char
*string
)
6438 return string ? strcpy
((char
*) xmalloc
(strlen
(string
) + 1),
6443 base_name
(const char
*name
)
6447 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6448 /* Skip over the disk name
in MSDOS pathnames.
*/
6449 if (isalpha
((unsigned char
) name
[0]) && name
[1] == ':')
6453 for (base
= name
; *name
; name
++)
6454 if (IS_DIR_SEPARATOR
(*name
))
6460 check_executable
(const char
*path
)
6464 lt_debugprintf
(__FILE__
, __LINE__
, "(check_executable): %s\n",
6466 if ((!path
) ||
(!*path
))
6469 if ((stat
(path
, &st
) >= 0)
6470 && (st.st_mode
& (S_IXUSR | S_IXGRP | S_IXOTH
)))
6477 make_executable
(const char
*path
)
6482 lt_debugprintf
(__FILE__
, __LINE__
, "(make_executable): %s\n",
6484 if ((!path
) ||
(!*path
))
6487 if (stat
(path
, &st
) >= 0)
6489 rval
= chmod (path
, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR
);
6494 /* Searches
for the full path of the wrapper. Returns
6495 newly allocated full path name
if found
, NULL otherwise
6496 Does not chase symlinks
, even on platforms that support them.
6499 find_executable
(const char
*wrapper
)
6504 /* static buffer
for getcwd
*/
6505 char tmp
[LT_PATHMAX
+ 1];
6509 lt_debugprintf
(__FILE__
, __LINE__
, "(find_executable): %s\n",
6510 nonempty
(wrapper
));
6512 if ((wrapper
== NULL
) ||
(*wrapper
== '\0'))
6515 /* Absolute path?
*/
6516 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6517 if (isalpha
((unsigned char
) wrapper
[0]) && wrapper
[1] == ':')
6519 concat_name
= xstrdup
(wrapper
);
6520 if (check_executable
(concat_name
))
6522 XFREE
(concat_name
);
6527 if (IS_DIR_SEPARATOR
(wrapper
[0]))
6529 concat_name
= xstrdup
(wrapper
);
6530 if (check_executable
(concat_name
))
6532 XFREE
(concat_name
);
6534 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6538 for (p
= wrapper
; *p
; p
++)
6546 /* no slashes
; search PATH
*/
6547 const char
*path
= getenv
("PATH");
6550 for (p
= path
; *p
; p
= p_next
)
6554 for (q
= p
; *q
; q
++)
6555 if (IS_PATH_SEPARATOR
(*q
))
6557 p_len
= (size_t
) (q
- p
);
6558 p_next
= (*q
== '\0' ? q
: q
+ 1);
6561 /* empty path
: current directory
*/
6562 if (getcwd
(tmp
, LT_PATHMAX
) == NULL
)
6563 lt_fatal
(__FILE__
, __LINE__
, "getcwd failed: %s",
6564 nonnull
(strerror
(errno
)));
6565 tmp_len
= strlen
(tmp
);
6567 XMALLOC
(char
, tmp_len
+ 1 + strlen
(wrapper
) + 1);
6568 memcpy
(concat_name
, tmp
, tmp_len
);
6569 concat_name
[tmp_len
] = '/';
6570 strcpy
(concat_name
+ tmp_len
+ 1, wrapper
);
6575 XMALLOC
(char
, p_len
+ 1 + strlen
(wrapper
) + 1);
6576 memcpy
(concat_name
, p
, p_len
);
6577 concat_name
[p_len
] = '/';
6578 strcpy
(concat_name
+ p_len
+ 1, wrapper
);
6580 if (check_executable
(concat_name
))
6582 XFREE
(concat_name
);
6585 /* not found
in PATH
; assume curdir
*/
6587 /* Relative path | not found
in path
: prepend cwd
*/
6588 if (getcwd
(tmp
, LT_PATHMAX
) == NULL
)
6589 lt_fatal
(__FILE__
, __LINE__
, "getcwd failed: %s",
6590 nonnull
(strerror
(errno
)));
6591 tmp_len
= strlen
(tmp
);
6592 concat_name
= XMALLOC
(char
, tmp_len
+ 1 + strlen
(wrapper
) + 1);
6593 memcpy
(concat_name
, tmp
, tmp_len
);
6594 concat_name
[tmp_len
] = '/';
6595 strcpy
(concat_name
+ tmp_len
+ 1, wrapper
);
6597 if (check_executable
(concat_name
))
6599 XFREE
(concat_name
);
6604 chase_symlinks
(const char
*pathspec
)
6607 return xstrdup
(pathspec
);
6609 char buf
[LT_PATHMAX
];
6611 char
*tmp_pathspec
= xstrdup
(pathspec
);
6613 int has_symlinks
= 0;
6614 while (strlen
(tmp_pathspec
) && !has_symlinks
)
6616 lt_debugprintf
(__FILE__
, __LINE__
,
6617 "checking path component for symlinks: %s\n",
6619 if (lstat
(tmp_pathspec
, &s
) == 0)
6621 if (S_ISLNK
(s.st_mode
) != 0)
6627 /* search backwards
for last DIR_SEPARATOR
*/
6628 p
= tmp_pathspec
+ strlen
(tmp_pathspec
) - 1;
6629 while ((p
> tmp_pathspec
) && (!IS_DIR_SEPARATOR
(*p
)))
6631 if ((p
== tmp_pathspec
) && (!IS_DIR_SEPARATOR
(*p
)))
6633 /* no
more DIR_SEPARATORS left
*/
6640 lt_fatal
(__FILE__
, __LINE__
,
6641 "error accessing file \"%s\": %s",
6642 tmp_pathspec
, nonnull
(strerror
(errno
)));
6645 XFREE
(tmp_pathspec
);
6649 return xstrdup
(pathspec
);
6652 tmp_pathspec
= realpath
(pathspec
, buf
);
6653 if (tmp_pathspec
== 0)
6655 lt_fatal
(__FILE__
, __LINE__
,
6656 "could not follow symlinks for %s", pathspec
);
6658 return xstrdup
(tmp_pathspec
);
6663 strendzap
(char
*str
, const char
*pat
)
6667 assert
(str
!= NULL
);
6668 assert
(pat
!= NULL
);
6671 patlen
= strlen
(pat
);
6675 str
+= len
- patlen
;
6676 if (STREQ
(str
, pat
))
6683 lt_debugprintf
(const char
*file, int line
, const char
*fmt, ...
)
6688 (void
) fprintf
(stderr
, "%s:%s:%d: ", program_name
, file, line
);
6689 va_start
(args
, fmt);
6690 (void
) vfprintf
(stderr
, fmt, args
);
6696 lt_error_core
(int exit_status
, const char
*file,
6697 int line
, const char
*mode
,
6698 const char
*message
, va_list ap
)
6700 fprintf
(stderr
, "%s:%s:%d: %s: ", program_name
, file, line
, mode
);
6701 vfprintf
(stderr
, message
, ap
);
6702 fprintf
(stderr
, ".\n");
6704 if (exit_status
>= 0)
6709 lt_fatal
(const char
*file, int line
, const char
*message
, ...
)
6712 va_start
(ap
, message
);
6713 lt_error_core
(EXIT_FAILURE
, file, line
, "FATAL", message
, ap
);
6718 nonnull
(const char
*s
)
6720 return s ? s
: "(null)";
6724 nonempty
(const char
*s
)
6726 return (s
&& !*s
) ?
"(empty)" : nonnull
(s
);
6730 lt_setenv
(const char
*name
, const char
*value
)
6732 lt_debugprintf
(__FILE__
, __LINE__
,
6733 "(lt_setenv) setting '%s' to '%s'\n",
6734 nonnull
(name
), nonnull
(value
));
6737 /* always
make a copy
, for consistency with
!HAVE_SETENV
*/
6738 char
*str
= xstrdup
(value
);
6739 setenv
(name
, str
, 1);
6741 size_t len
= strlen
(name
) + 1 + strlen
(value
) + 1;
6742 char
*str
= XMALLOC
(char
, len
);
6743 sprintf
(str
, "%s=%s", name
, value
);
6744 if (putenv
(str
) != EXIT_SUCCESS
)
6753 lt_extend_str
(const char
*orig_value
, const char
*add
, int to_end
)
6756 if (orig_value
&& *orig_value
)
6758 size_t orig_value_len
= strlen
(orig_value
);
6759 size_t add_len
= strlen
(add
);
6760 new_value
= XMALLOC
(char
, add_len
+ orig_value_len
+ 1);
6763 strcpy
(new_value
, orig_value
);
6764 strcpy
(new_value
+ orig_value_len
, add
);
6768 strcpy
(new_value
, add
);
6769 strcpy
(new_value
+ add_len
, orig_value
);
6774 new_value
= xstrdup
(add
);
6780 lt_update_exe_path
(const char
*name
, const char
*value
)
6782 lt_debugprintf
(__FILE__
, __LINE__
,
6783 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6784 nonnull
(name
), nonnull
(value
));
6786 if (name
&& *name
&& value
&& *value
)
6788 char
*new_value
= lt_extend_str
(getenv
(name
), value
, 0);
6789 /* some systems can
't cope with a ':'-terminated path #' */
6790 size_t len
= strlen
(new_value
);
6791 while ((len
> 0) && IS_PATH_SEPARATOR
(new_value
[len-1
]))
6793 new_value
[--len] = '\0';
6795 lt_setenv
(name
, new_value
);
6801 lt_update_lib_path
(const char
*name
, const char
*value
)
6803 lt_debugprintf
(__FILE__
, __LINE__
,
6804 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6805 nonnull
(name
), nonnull
(value
));
6807 if (name
&& *name
&& value
&& *value
)
6809 char
*new_value
= lt_extend_str
(getenv
(name
), value
, 0);
6810 lt_setenv
(name
, new_value
);
6820 /* Prepares an argument vector before calling spawn().
6821 Note that spawn() does not by itself call the command interpreter
6822 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6823 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6825 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6826 }) ? "cmd.exe" : "command.com").
6827 Instead it simply concatenates the arguments, separated by ' ', and calls
6828 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6829 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6831 - Space and tab are interpreted as delimiters. They are not treated as
6832 delimiters if they are surrounded by double quotes: "...".
6833 - Unescaped double quotes are removed from the input. Their only effect is
6834 that within double quotes, space and tab are treated like normal
6836 - Backslashes not followed by double quotes are not special.
6837 - But 2*n+1 backslashes followed by a double quote become
6838 n backslashes followed by a double quote (n >= 0):
6843 #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"
6844 #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"
6846 prepare_spawn (char **argv)
6852 /* Count number of arguments. */
6853 for (argc = 0; argv[argc] != NULL; argc++)
6856 /* Allocate new argument vector. */
6857 new_argv = XMALLOC (char *, argc + 1);
6859 /* Put quoted arguments into the new argument vector. */
6860 for (i = 0; i < argc; i++)
6862 const char *string = argv[i];
6864 if (string[0] == '\0')
6865 new_argv[i] = xstrdup ("\"\"");
6866 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6868 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6870 unsigned int backslashes;
6872 char *quoted_string;
6879 for (s = string; *s != '\0'; s++)
6883 length += backslashes + 1;
6891 length += backslashes + 1;
6893 quoted_string = XMALLOC (char, length + 1);
6899 for (s = string; *s != '\0'; s++)
6905 for (j = backslashes + 1; j > 0; j--)
6917 for (j = backslashes; j > 0; j--)
6923 new_argv[i] = quoted_string;
6926 new_argv[i] = (char *) string;
6928 new_argv[argc] = NULL;
6937 void lt_dump_script
(FILE
* f
)
6940 func_emit_wrapper
yes |
6942 s/^\(.\{79\}\)\(..*\)/\1\
6947 s/\([^\n]*\).*/ fputs ("\1", f);/p
6954 # end: func_emit_cwrapperexe_src
6956 # func_win32_import_lib_p ARG
6957 # True if ARG is an import lib, as indicated by $file_magic_cmd
6958 func_win32_import_lib_p ()
6962 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6968 # func_suncc_cstd_abi
6969 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6970 # Several compiler flags select an ABI that is incompatible with the
6971 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
6972 func_suncc_cstd_abi ()
6976 case " $compile_command " in
6977 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6978 suncc_use_cstd_abi=no
6981 suncc_use_cstd_abi=yes
6986 # func_mode_link arg...
6992 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6993 # It is impossible to link a dll without this setting, and
6994 # we shouldn't force the makefile maintainer to figure out
6995 # what system we are compiling for in order to pass an extra
6996 # flag for every libtool invocation.
6997 # allow_undefined=no
6999 # FIXME: Unfortunately, there are problems with the above when trying
7000 # to make a dll that has undefined symbols, in which case not
7001 # even a static library is built. For now, we need to specify
7002 # -no-undefined on the libtool link line when we can be certain
7003 # that all symbols are satisfied, otherwise we get a static library.
7010 libtool_args=$nonopt
7011 base_compile="$nonopt $@"
7012 compile_command=$nonopt
7013 finalize_command=$nonopt
7026 lib_search_path=`pwd`
7028 new_inherited_linker_flags=
7037 export_symbols_regex=
7046 precious_files_regex=
7047 prefer_static_libs=no
7060 single_module=$wl-single_module
7061 func_infer_tag $base_compile
7063 # We need to know -static, to get the right output filenames.
7068 test yes != "$build_libtool_libs" \
7069 && func_fatal_configuration "cannot build a shared library"
7073 -all-static | -static | -static-libtool-libs)
7076 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
7077 func_warning "complete static linking is impossible in this configuration"
7079 if test -n "$link_static_flag"; then
7080 dlopen_self=$dlopen_self_static
7082 prefer_static_libs=yes
7085 if test -z "$pic_flag" && test -n "$link_static_flag"; then
7086 dlopen_self=$dlopen_self_static
7088 prefer_static_libs=built
7090 -static-libtool-libs)
7091 if test -z "$pic_flag" && test -n "$link_static_flag"; then
7092 dlopen_self=$dlopen_self_static
7094 prefer_static_libs=yes
7097 build_libtool_libs=no
7104 # See if our shared archives depend on static archives.
7105 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
7107 # Go through the arguments, transforming them on the way.
7108 while test "$#" -gt 0; do
7111 func_quote_for_eval "$arg"
7112 qarg=$func_quote_for_eval_unquoted_result
7113 func_append libtool_args " $func_quote_for_eval_result"
7115 # If the previous option needs an argument, assign it.
7116 if test -n "$prev"; then
7119 func_append compile_command " @OUTPUT@"
7120 func_append finalize_command " @OUTPUT@"
7132 # Add the symbol object into the linking commands.
7133 func_append compile_command " @SYMFILE@"
7134 func_append finalize_command " @SYMFILE@"
7138 *.la | *.lo) ;; # We handle these cases below.
7140 if test no = "$dlself"; then
7148 if test dlprefiles = "$prev"; then
7150 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
7160 if test dlfiles = "$prev"; then
7161 func_append dlfiles " $arg"
7163 func_append dlprefiles " $arg"
7173 || func_fatal_error "symbol file '$arg' does not exist"
7178 export_symbols_regex=$arg
7186 *" $qarg.ltframework "*) ;;
7187 *) func_append deplibs " $qarg.ltframework" # this is fixed later
7196 inst_prefix_dir=$arg
7201 # Clang does not use LLVM to link, so we can simply discard any
7202 # '-mllvm $arg' options when doing the link step.
7207 if test -f "$arg"; then
7210 for fil in `cat "$save_arg"`
7212 # func_append moreargs " $fil"
7214 # A libtool-controlled object.
7216 # Check to see that this really is a libtool object.
7217 if func_lalib_unsafe_p "$arg"; then
7224 if test -z "$pic_object" ||
7225 test -z "$non_pic_object" ||
7226 test none = "$pic_object" &&
7227 test none = "$non_pic_object"; then
7228 func_fatal_error "cannot find name of object for '$arg'"
7231 # Extract subdirectory from the argument.
7232 func_dirname "$arg" "/" ""
7233 xdir=$func_dirname_result
7235 if test none != "$pic_object"; then
7236 # Prepend the subdirectory the object is found in.
7237 pic_object=$xdir$pic_object
7239 if test dlfiles = "$prev"; then
7240 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7241 func_append dlfiles " $pic_object"
7245 # If libtool objects are unsupported, then we need to preload.
7250 # CHECK ME: I think I busted this. -Ossama
7251 if test dlprefiles = "$prev"; then
7252 # Preload the old-style object.
7253 func_append dlprefiles " $pic_object"
7258 func_append libobjs " $pic_object"
7263 if test none != "$non_pic_object"; then
7264 # Prepend the subdirectory the object is found in.
7265 non_pic_object=$xdir$non_pic_object
7267 # A standard non-PIC object
7268 func_append non_pic_objects " $non_pic_object"
7269 if test -z "$pic_object" || test none = "$pic_object"; then
7273 # If the PIC object exists, use it instead.
7274 # $xdir was prepended to $pic_object above.
7275 non_pic_object=$pic_object
7276 func_append non_pic_objects " $non_pic_object"
7279 # Only an error if not doing a dry-run.
7280 if $opt_dry_run; then
7281 # Extract subdirectory from the argument.
7282 func_dirname "$arg" "/" ""
7283 xdir=$func_dirname_result
7286 pic_object=$xdir$objdir/$func_lo2o_result
7287 non_pic_object=$xdir$func_lo2o_result
7288 func_append libobjs " $pic_object"
7289 func_append non_pic_objects " $non_pic_object"
7291 func_fatal_error "'$arg' is not a valid libtool object"
7296 func_fatal_error "link input file '$arg' does not exist"
7308 precious_files_regex=$arg
7318 # We need an absolute path.
7320 [\\/]* | [A-Za-z]:[\\/]*) ;;
7322 func_fatal_error "only absolute run-paths are allowed"
7325 if test rpath = "$prev"; then
7328 *) func_append rpath " $arg" ;;
7333 *) func_append xrpath " $arg" ;;
7345 func_append weak_libs " $arg"
7350 func_append linker_flags " $qarg"
7351 func_append compiler_flags " $qarg"
7353 func_append compile_command " $qarg"
7354 func_append finalize_command " $qarg"
7358 func_append compiler_flags " $qarg"
7360 func_append compile_command " $qarg"
7361 func_append finalize_command " $qarg"
7365 func_append linker_flags " $qarg"
7366 func_append compiler_flags " $wl$qarg"
7368 func_append compile_command " $wl$qarg"
7369 func_append finalize_command " $wl$qarg"
7373 eval "$prev=\"\$arg\""
7378 fi # test -n "$prev"
7384 if test -n "$link_static_flag"; then
7385 # See comment for -static flag below, for more details.
7386 func_append compile_command " $link_static_flag"
7387 func_append finalize_command " $link_static_flag"
7393 # FIXME: remove this flag sometime in the future.
7394 func_fatal_error "'-allow-undefined' must not be used because it is the default"
7422 -export-symbols | -export-symbols-regex)
7423 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
7424 func_fatal_error "more than one -exported-symbols argument is not allowed"
7426 if test X-export-symbols = "X$arg"; then
7444 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
7445 # so, if we see these flags be careful not to treat them like -L
7447 case $with_gcc/$host in
7448 no/*-*-irix* | /*-*-irix*)
7449 func_append compile_command " $arg"
7450 func_append finalize_command " $arg"
7457 func_stripname "-L" '' "$arg"
7458 if test -z "$func_stripname_result"; then
7459 if test "$#" -gt 0; then
7460 func_fatal_error "require no space between '-L' and '$1'"
7462 func_fatal_error "need path for '-L' option"
7465 func_resolve_sysroot "$func_stripname_result"
7466 dir=$func_resolve_sysroot_result
7467 # We need an absolute path.
7469 [\\/]* | [A-Za-z]:[\\/]*) ;;
7471 absdir=`cd "$dir" && pwd`
7472 test -z "$absdir" && \
7473 func_fatal_error "cannot determine absolute directory name of '$dir'"
7478 *" -L$dir "* | *" $arg "*)
7479 # Will only happen for absolute or sysroot arguments
7482 # Preserve sysroot, but never include relative directories
7484 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
7485 *) func_append deplibs " -L$dir" ;;
7487 func_append lib_search_path " $dir"
7491 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7492 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
7493 case :$dllsearchpath: in
7495 ::) dllsearchpath=$dir;;
7496 *) func_append dllsearchpath ":$dir";;
7498 case :$dllsearchpath: in
7499 *":$testbindir:"*) ;;
7500 ::) dllsearchpath=$testbindir;;
7501 *) func_append dllsearchpath ":$testbindir";;
7509 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7511 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7512 # These systems don't actually have a C or math library (as such)
7516 # These systems don't actually have a C library (as such)
7517 test X-lc = "X$arg" && continue
7519 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7520 # Do not include libc due to us having libc/libc_r.
7521 test X-lc = "X$arg" && continue
7523 *-*-rhapsody* | *-*-darwin1.[012])
7524 # Rhapsody C and math libraries are in the System framework
7525 func_append deplibs " System.ltframework"
7528 *-*-sco3.2v5* | *-*-sco5v6*)
7529 # Causes problems with __ctype
7530 test X-lc = "X$arg" && continue
7532 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7533 # Compiler inserts libc in the correct place for threads to work
7534 test X-lc = "X$arg" && continue
7537 elif test X-lc_r = "X$arg"; then
7539 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7540 # Do not include libc_r directly, use -pthread flag.
7545 func_append deplibs " $arg"
7559 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7560 # classes, name mangling, and exception handling.
7561 # Darwin uses the -arch flag to determine output architecture.
7562 -model|-arch|-isysroot|--sysroot)
7563 func_append compiler_flags " $arg"
7564 func_append compile_command " $arg"
7565 func_append finalize_command " $arg"
7570 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7571 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7572 func_append compiler_flags " $arg"
7573 func_append compile_command " $arg"
7574 func_append finalize_command " $arg"
7575 case "$new_inherited_linker_flags " in
7577 * ) func_append new_inherited_linker_flags " $arg" ;;
7583 single_module=$wl-multi_module
7594 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7595 # The PATH hackery in wrapper scripts is required on Windows
7596 # and Darwin in order for the loader to find any dlls it needs.
7597 func_warning "'-no-install' is ignored for $host"
7598 func_warning "assuming '-no-fast-install' instead"
7601 *) no_install=yes ;;
7623 -precious-files-regex)
7644 func_stripname '-R' '' "$arg"
7645 dir=$func_stripname_result
7646 # We need an absolute path.
7648 [\\/]* | [A-Za-z]:[\\/]*) ;;
7650 func_stripname '=' '' "$dir"
7651 dir=$lt_sysroot$func_stripname_result
7654 func_fatal_error "only absolute run-paths are allowed"
7659 *) func_append xrpath " $dir" ;;
7665 # The effects of -shared are defined in a previous loop.
7674 -static | -static-libtool-libs)
7675 # The effects of -static are defined in a previous loop.
7676 # We used to do the same as -all-static on platforms that
7677 # didn't have a PIC flag, but the assumption that the effects
7678 # would be equivalent was wrong. It would break on at least
7679 # Digital Unix and AIX.
7705 func_stripname '-Wc,' '' "$arg"
7706 args=$func_stripname_result
7708 save_ifs=$IFS; IFS=,
7709 for flag in $args; do
7711 func_quote_for_eval "$flag"
7712 func_append arg " $func_quote_for_eval_result"
7713 func_append compiler_flags " $func_quote_for_eval_result"
7716 func_stripname ' ' '' "$arg"
7717 arg=$func_stripname_result
7721 func_stripname '-Wl,' '' "$arg"
7722 args=$func_stripname_result
7724 save_ifs=$IFS; IFS=,
7725 for flag in $args; do
7727 func_quote_for_eval "$flag"
7728 func_append arg " $wl$func_quote_for_eval_result"
7729 func_append compiler_flags " $wl$func_quote_for_eval_result"
7730 func_append linker_flags " $func_quote_for_eval_result"
7733 func_stripname ' ' '' "$arg"
7734 arg=$func_stripname_result
7754 func_quote_for_eval "$arg"
7755 arg=$func_quote_for_eval_result
7758 # Flags to be passed through unchanged, with rationale:
7759 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7760 # -r[0-9][0-9]* specify processor for the SGI compiler
7761 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7762 # +DA*, +DD* enable 64-bit mode for the HP compiler
7763 # -q* compiler args for the IBM compiler
7764 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7765 # -F/path path to uninstalled frameworks, gcc on darwin
7766 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7767 # -fstack-protector* stack protector flags for GCC
7768 # @file GCC response files
7769 # -tp=* Portland pgcc target processor selection
7770 # --sysroot=* for sysroot support
7771 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7772 # -specs=* GCC specs files
7773 # -stdlib=* select c++ std lib with clang
7774 # -fsanitize=* Clang/GCC memory and address sanitizer
7775 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7776 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7777 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7778 -specs=*|-fsanitize=*)
7779 func_quote_for_eval "$arg"
7780 arg=$func_quote_for_eval_result
7781 func_append compile_command " $arg"
7782 func_append finalize_command " $arg"
7783 func_append compiler_flags " $arg"
7788 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7789 # OS/2 uses -Zxxx to specify OS/2-specific options
7790 compiler_flags="$compiler_flags $arg"
7791 func_append compile_command " $arg"
7792 func_append finalize_command " $arg"
7800 # Otherwise treat like 'Some other compiler flag' below
7801 func_quote_for_eval "$arg"
7802 arg=$func_quote_for_eval_result
7806 # Some other compiler flag.
7808 func_quote_for_eval "$arg"
7809 arg=$func_quote_for_eval_result
7813 # A standard object.
7814 func_append objs " $arg"
7818 # A libtool-controlled object.
7820 # Check to see that this really is a libtool object.
7821 if func_lalib_unsafe_p "$arg"; then
7828 if test -z "$pic_object" ||
7829 test -z "$non_pic_object" ||
7830 test none = "$pic_object" &&
7831 test none = "$non_pic_object"; then
7832 func_fatal_error "cannot find name of object for '$arg'"
7835 # Extract subdirectory from the argument.
7836 func_dirname "$arg" "/" ""
7837 xdir=$func_dirname_result
7839 test none = "$pic_object" || {
7840 # Prepend the subdirectory the object is found in.
7841 pic_object=$xdir$pic_object
7843 if test dlfiles = "$prev"; then
7844 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7845 func_append dlfiles " $pic_object"
7849 # If libtool objects are unsupported, then we need to preload.
7854 # CHECK ME: I think I busted this. -Ossama
7855 if test dlprefiles = "$prev"; then
7856 # Preload the old-style object.
7857 func_append dlprefiles " $pic_object"
7862 func_append libobjs " $pic_object"
7867 if test none != "$non_pic_object"; then
7868 # Prepend the subdirectory the object is found in.
7869 non_pic_object=$xdir$non_pic_object
7871 # A standard non-PIC object
7872 func_append non_pic_objects " $non_pic_object"
7873 if test -z "$pic_object" || test none = "$pic_object"; then
7877 # If the PIC object exists, use it instead.
7878 # $xdir was prepended to $pic_object above.
7879 non_pic_object=$pic_object
7880 func_append non_pic_objects " $non_pic_object"
7883 # Only an error if not doing a dry-run.
7884 if $opt_dry_run; then
7885 # Extract subdirectory from the argument.
7886 func_dirname "$arg" "/" ""
7887 xdir=$func_dirname_result
7890 pic_object=$xdir$objdir/$func_lo2o_result
7891 non_pic_object=$xdir$func_lo2o_result
7892 func_append libobjs " $pic_object"
7893 func_append non_pic_objects " $non_pic_object"
7895 func_fatal_error "'$arg' is not a valid libtool object"
7902 func_append deplibs " $arg"
7903 func_append old_deplibs " $arg"
7908 # A libtool-controlled library.
7910 func_resolve_sysroot "$arg"
7911 if test dlfiles = "$prev"; then
7912 # This library was specified with -dlopen.
7913 func_append dlfiles " $func_resolve_sysroot_result"
7915 elif test dlprefiles = "$prev"; then
7916 # The library was specified with -dlpreopen.
7917 func_append dlprefiles " $func_resolve_sysroot_result"
7920 func_append deplibs " $func_resolve_sysroot_result"
7925 # Some other compiler argument.
7927 # Unknown arguments in both finalize_command and compile_command need
7928 # to be aesthetically quoted because they are evaled later.
7929 func_quote_for_eval "$arg"
7930 arg=$func_quote_for_eval_result
7934 # Now actually substitute the argument into the commands.
7935 if test -n "$arg"; then
7936 func_append compile_command " $arg"
7937 func_append finalize_command " $arg"
7939 done # argument parsing loop
7941 test -n "$prev" && \
7942 func_fatal_help "the '$prevarg' option requires an argument"
7944 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7945 eval arg=\"$export_dynamic_flag_spec\"
7946 func_append compile_command " $arg"
7947 func_append finalize_command " $arg"
7951 # calculate the name of the file, without its directory
7952 func_basename "$output"
7953 outputname=$func_basename_result
7954 libobjs_save=$libobjs
7956 if test -n "$shlibpath_var"; then
7957 # get the directories listed in $shlibpath_var
7958 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7962 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7963 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7965 # Definition is injected by LT_CONFIG during libtool generation.
7966 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7968 func_dirname "$output" "/" ""
7969 output_objdir=$func_dirname_result$objdir
7970 func_to_tool_file "$output_objdir/"
7971 tool_output_objdir=$func_to_tool_file_result
7972 # Create the object directory.
7973 func_mkdir_p "$output_objdir"
7975 # Determine the type of output
7978 func_fatal_help "you must specify an output file"
7980 *.$libext) linkmode=oldlib ;;
7981 *.lo | *.$objext) linkmode=obj ;;
7982 *.la) linkmode=lib ;;
7983 *) linkmode=prog ;; # Anything else should be a program.
7989 # Find all interdependent deplibs by searching for libraries
7990 # that are linked more than once (e.g. -la -lb -la)
7991 for deplib in $deplibs; do
7992 if $opt_preserve_dup_deps; then
7994 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7997 func_append libs " $deplib"
8000 if test lib = "$linkmode"; then
8001 libs="$predeps $libs $compiler_lib_search_path $postdeps"
8003 # Compute libraries that are listed more than once in $predeps
8004 # $postdeps and mark them as special (i.e., whose duplicates are
8005 # not to be eliminated).
8007 if $opt_duplicate_compiler_generated_deps; then
8008 for pre_post_dep in $predeps $postdeps; do
8009 case "$pre_post_deps " in
8010 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
8012 func_append pre_post_deps " $pre_post_dep"
8021 need_relink=no # whether we're linking any uninstalled libtool libraries
8022 notinst_deplibs= # not-installed libtool libraries
8023 notinst_path= # paths that contain not-installed libtool libraries
8027 passes="conv dlpreopen link"
8028 for file in $dlfiles $dlprefiles; do
8032 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
8043 passes="conv scan dlopen dlpreopen link"
8049 for pass in $passes; do
8050 # The preopen pass in lib mode reverses $deplibs; put it back here
8051 # so that -L comes before libs that need it for instance...
8052 if test lib,link = "$linkmode,$pass"; then
8053 ## FIXME: Find the place where the list is rebuilt in the wrong
8054 ## order, and fix it there properly
8056 for deplib in $deplibs; do
8057 tmp_deplibs="$deplib $tmp_deplibs"
8059 deplibs=$tmp_deplibs
8062 if test lib,link = "$linkmode,$pass" ||
8063 test prog,scan = "$linkmode,$pass"; then
8067 if test prog = "$linkmode"; then
8069 dlopen) libs=$dlfiles ;;
8070 dlpreopen) libs=$dlprefiles ;;
8072 libs="$deplibs %DEPLIBS%"
8073 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
8077 if test lib,dlpreopen = "$linkmode,$pass"; then
8078 # Collect and forward deplibs of preopened libtool libs
8079 for lib in $dlprefiles; do
8080 # Ignore non-libtool-libs
8082 func_resolve_sysroot "$lib"
8084 *.la) func_source "$func_resolve_sysroot_result" ;;
8087 # Collect preopened libtool deplibs, except any this library
8088 # has declared as weak libs
8089 for deplib in $dependency_libs; do
8090 func_basename "$deplib"
8091 deplib_base=$func_basename_result
8092 case " $weak_libs " in
8093 *" $deplib_base "*) ;;
8094 *) func_append deplibs " $deplib" ;;
8100 if test dlopen = "$pass"; then
8101 # Collect dlpreopened libraries
8102 save_deplibs=$deplibs
8106 for deplib in $libs; do
8110 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
8111 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
8112 if test prog,link = "$linkmode,$pass"; then
8113 compile_deplibs="$deplib $compile_deplibs"
8114 finalize_deplibs="$deplib $finalize_deplibs"
8116 func_append compiler_flags " $deplib"
8117 if test lib = "$linkmode"; then
8118 case "$new_inherited_linker_flags " in
8120 * ) func_append new_inherited_linker_flags " $deplib" ;;
8127 if test lib != "$linkmode" && test prog != "$linkmode"; then
8128 func_warning "'-l' is ignored for archives/objects"
8131 func_stripname '-l' '' "$deplib"
8132 name=$func_stripname_result
8133 if test lib = "$linkmode"; then
8134 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
8136 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
8138 for searchdir in $searchdirs; do
8139 for search_ext in .la $std_shrext .so .a; do
8140 # Search the libtool library
8141 lib=$searchdir/lib$name$search_ext
8142 if test -f "$lib"; then
8143 if test .la = "$search_ext"; then
8153 # deplib is a libtool library
8154 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
8155 # We need to do some special things here, and not later.
8156 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
8157 case " $predeps $postdeps " in
8159 if func_lalib_p "$lib"; then
8163 for l in $old_library $library_names; do
8166 if test "X$ll" = "X$old_library"; then # only static version available
8168 func_dirname "$lib" "" "."
8169 ladir=$func_dirname_result
8170 lib=$ladir/$old_library
8171 if test prog,link = "$linkmode,$pass"; then
8172 compile_deplibs="$deplib $compile_deplibs"
8173 finalize_deplibs="$deplib $finalize_deplibs"
8175 deplibs="$deplib $deplibs"
8176 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8186 # deplib doesn't seem to be a libtool library
8187 if test prog,link = "$linkmode,$pass"; then
8188 compile_deplibs="$deplib $compile_deplibs"
8189 finalize_deplibs="$deplib $finalize_deplibs"
8191 deplibs="$deplib $deplibs"
8192 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
8198 if test prog,link = "$linkmode,$pass"; then
8199 compile_deplibs="$deplib $compile_deplibs"
8200 finalize_deplibs="$deplib $finalize_deplibs"
8202 deplibs="$deplib $deplibs"
8203 if test lib = "$linkmode"; then
8204 case "$new_inherited_linker_flags " in
8206 * ) func_append new_inherited_linker_flags " $deplib" ;;
8215 deplibs="$deplib $deplibs"
8216 test conv = "$pass" && continue
8217 newdependency_libs="$deplib $newdependency_libs"
8218 func_stripname '-L' '' "$deplib"
8219 func_resolve_sysroot "$func_stripname_result"
8220 func_append newlib_search_path " $func_resolve_sysroot_result"
8223 if test conv = "$pass"; then
8224 deplibs="$deplib $deplibs"
8227 if test scan = "$pass"; then
8228 deplibs="$deplib $deplibs"
8230 compile_deplibs="$deplib $compile_deplibs"
8231 finalize_deplibs="$deplib $finalize_deplibs"
8233 func_stripname '-L' '' "$deplib"
8234 func_resolve_sysroot "$func_stripname_result"
8235 func_append newlib_search_path " $func_resolve_sysroot_result"
8238 func_warning "'-L' is ignored for archives/objects"
8244 if test link = "$pass"; then
8245 func_stripname '-R' '' "$deplib"
8246 func_resolve_sysroot "$func_stripname_result"
8247 dir=$func_resolve_sysroot_result
8248 # Make sure the xrpath contains only unique directories.
8251 *) func_append xrpath " $dir" ;;
8254 deplibs="$deplib $deplibs"
8258 func_resolve_sysroot "$deplib"
8259 lib=$func_resolve_sysroot_result
8262 if test conv = "$pass"; then
8263 deplibs="$deplib $deplibs"
8268 # Linking convenience modules into shared libraries is allowed,
8269 # but linking other static libraries is non-portable.
8270 case " $dlpreconveniencelibs " in
8274 case $deplibs_check_method in
8276 set dummy $deplibs_check_method; shift
8277 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8278 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
8279 | $EGREP "$match_pattern_regex" > /dev/null; then
8287 if $valid_a_lib; then
8289 $ECHO "*** Warning: Linking the shared library $output against the"
8290 $ECHO "*** static library $deplib is not portable!"
8291 deplibs="$deplib $deplibs"
8294 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
8295 echo "*** I have the capability to make that library automatically link in when"
8296 echo "*** you link to this library. But I can only do this if you have a"
8297 echo "*** shared version of the library, which you do not appear to have"
8298 echo "*** because the file extensions .$libext of this argument makes me believe"
8299 echo "*** that it is just a static archive that I should not use here."
8306 if test link != "$pass"; then
8307 deplibs="$deplib $deplibs"
8309 compile_deplibs="$deplib $compile_deplibs"
8310 finalize_deplibs="$deplib $finalize_deplibs"
8317 if test conv = "$pass"; then
8318 deplibs="$deplib $deplibs"
8319 elif test prog = "$linkmode"; then
8320 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
8321 # If there is no dlopen support or we're linking statically,
8322 # we need to preload.
8323 func_append newdlprefiles " $deplib"
8324 compile_deplibs="$deplib $compile_deplibs"
8325 finalize_deplibs="$deplib $finalize_deplibs"
8327 func_append newdlfiles " $deplib"
8338 $found || test -f "$lib" \
8339 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
8341 # Check to see that this really is a libtool archive.
8342 func_lalib_unsafe_p "$lib" \
8343 || func_fatal_error "'$lib' is not a valid libtool archive"
8345 func_dirname "$lib" "" "."
8346 ladir=$func_dirname_result
8354 inherited_linker_flags=
8355 # If the library was installed with an old release of libtool,
8356 # it will not redefine variables installed, or shouldnotlink
8365 # Convert "-framework foo" to "foo.ltframework"
8366 if test -n "$inherited_linker_flags"; then
8367 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
8368 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
8369 case " $new_inherited_linker_flags " in
8370 *" $tmp_inherited_linker_flag "*) ;;
8371 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
8375 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8376 if test lib,link = "$linkmode,$pass" ||
8377 test prog,scan = "$linkmode,$pass" ||
8378 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
8379 test -n "$dlopen" && func_append dlfiles " $dlopen"
8380 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
8383 if test conv = "$pass"; then
8384 # Only check for convenience libraries
8385 deplibs="$lib $deplibs"
8386 if test -z "$libdir"; then
8387 if test -z "$old_library"; then
8388 func_fatal_error "cannot find name of link library for '$lib'"
8390 # It is a libtool convenience library, so add in its objects.
8391 func_append convenience " $ladir/$objdir/$old_library"
8392 func_append old_convenience " $ladir/$objdir/$old_library"
8394 for deplib in $dependency_libs; do
8395 deplibs="$deplib $deplibs"
8396 if $opt_preserve_dup_deps; then
8397 case "$tmp_libs " in
8398 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8401 func_append tmp_libs " $deplib"
8403 elif test prog != "$linkmode" && test lib != "$linkmode"; then
8404 func_fatal_error "'$lib' is not a convenience library"
8410 # Get the name of the library we link against.
8412 if test -n "$old_library" &&
8413 { test yes = "$prefer_static_libs" ||
8414 test built,no = "$prefer_static_libs,$installed"; }; then
8415 linklib=$old_library
8417 for l in $old_library $library_names; do
8421 if test -z "$linklib"; then
8422 func_fatal_error "cannot find name of link library for '$lib'"
8425 # This library was specified with -dlopen.
8426 if test dlopen = "$pass"; then
8428 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8429 if test -z "$dlname" ||
8430 test yes != "$dlopen_support" ||
8431 test no = "$build_libtool_libs"
8433 # If there is no dlname, no dlopen support or we're linking
8434 # statically, we need to preload. We also need to preload any
8435 # dependent libraries so libltdl's deplib preloader doesn't
8436 # bomb out in the load deplibs phase.
8437 func_append dlprefiles " $lib $dependency_libs"
8439 func_append newdlfiles " $lib"
8444 # We need an absolute path.
8446 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8448 abs_ladir=`cd "$ladir" && pwd`
8449 if test -z "$abs_ladir"; then
8450 func_warning "cannot determine absolute directory name of '$ladir'"
8451 func_warning "passing it literally to the linker, although it might fail"
8456 func_basename "$lib"
8457 laname=$func_basename_result
8459 # Find the relevant object directory and library name.
8460 if test yes = "$installed"; then
8461 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8462 func_warning "library '$lib' was moved."
8467 dir=$lt_sysroot$libdir
8468 absdir=$lt_sysroot$libdir
8470 test yes = "$hardcode_automatic" && avoidtemprpath=yes
8472 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8475 # Remove this search path later
8476 func_append notinst_path " $abs_ladir"
8479 absdir=$abs_ladir/$objdir
8480 # Remove this search path later
8481 func_append notinst_path " $abs_ladir"
8483 fi # $installed = yes
8484 func_stripname 'lib' '.la' "$laname"
8485 name=$func_stripname_result
8487 # This library was specified with -dlpreopen.
8488 if test dlpreopen = "$pass"; then
8489 if test -z "$libdir" && test prog = "$linkmode"; then
8490 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8493 # special handling for platforms with PE-DLLs.
8494 *cygwin* | *mingw* | *cegcc* )
8495 # Linker will automatically link against shared library if both
8496 # static and shared are present. Therefore, ensure we extract
8497 # symbols from the import library if a shared library is present
8498 # (otherwise, the dlopen module name will be incorrect). We do
8499 # this by putting the import library name into $newdlprefiles.
8500 # We recover the dlopen module name by 'saving' the la file
8501 # name in a special purpose variable, and (later) extracting the
8502 # dlname from the la file.
8503 if test -n "$dlname"; then
8504 func_tr_sh "$dir/$linklib"
8505 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8506 func_append newdlprefiles " $dir/$linklib"
8508 func_append newdlprefiles " $dir/$old_library"
8509 # Keep a list of preopened convenience libraries to check
8510 # that they are being used correctly in the link pass.
8511 test -z "$libdir" && \
8512 func_append dlpreconveniencelibs " $dir/$old_library"
8516 # Prefer using a static library (so that no silly _DYNAMIC symbols
8517 # are required to link).
8518 if test -n "$old_library"; then
8519 func_append newdlprefiles " $dir/$old_library"
8520 # Keep a list of preopened convenience libraries to check
8521 # that they are being used correctly in the link pass.
8522 test -z "$libdir" && \
8523 func_append dlpreconveniencelibs " $dir/$old_library"
8524 # Otherwise, use the dlname, so that lt_dlopen finds it.
8525 elif test -n "$dlname"; then
8526 func_append newdlprefiles " $dir/$dlname"
8528 func_append newdlprefiles " $dir/$linklib"
8532 fi # $pass = dlpreopen
8534 if test -z "$libdir"; then
8535 # Link the convenience library
8536 if test lib = "$linkmode"; then
8537 deplibs="$dir/$old_library $deplibs"
8538 elif test prog,link = "$linkmode,$pass"; then
8539 compile_deplibs="$dir/$old_library $compile_deplibs"
8540 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8542 deplibs="$lib $deplibs" # used for prog,scan pass
8548 if test prog = "$linkmode" && test link != "$pass"; then
8549 func_append newlib_search_path " $ladir"
8550 deplibs="$lib $deplibs"
8552 linkalldeplibs=false
8553 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8554 test no = "$build_libtool_libs"; then
8559 for deplib in $dependency_libs; do
8561 -L*) func_stripname '-L' '' "$deplib"
8562 func_resolve_sysroot "$func_stripname_result"
8563 func_append newlib_search_path " $func_resolve_sysroot_result"
8566 # Need to link against all dependency_libs?
8567 if $linkalldeplibs; then
8568 deplibs="$deplib $deplibs"
8570 # Need to hardcode shared library paths
8571 # or/and link against static libraries
8572 newdependency_libs="$deplib $newdependency_libs"
8574 if $opt_preserve_dup_deps; then
8575 case "$tmp_libs " in
8576 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8579 func_append tmp_libs " $deplib"
8582 fi # $linkmode = prog...
8584 if test prog,link = "$linkmode,$pass"; then
8585 if test -n "$library_names" &&
8586 { { test no = "$prefer_static_libs" ||
8587 test built,yes = "$prefer_static_libs,$installed"; } ||
8588 test -z "$old_library"; }; then
8589 # We need to hardcode the library path
8590 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8591 # Make sure the rpath contains only unique directories.
8592 case $temp_rpath: in
8594 *) func_append temp_rpath "$absdir:" ;;
8598 # Hardcode the library path.
8599 # Skip directories that are in the system default run-time
8601 case " $sys_lib_dlsearch_path " in
8604 case "$compile_rpath " in
8606 *) func_append compile_rpath " $absdir" ;;
8610 case " $sys_lib_dlsearch_path " in
8613 case "$finalize_rpath " in
8615 *) func_append finalize_rpath " $libdir" ;;
8619 fi # $linkmode,$pass = prog,link...
8622 { test pass_all = "$deplibs_check_method" ||
8623 { test yes = "$build_libtool_libs" &&
8624 test -n "$library_names"; }; }; then
8625 # We only need to search for static libraries
8630 link_static=no # Whether the deplib will be linked statically
8631 use_static_libs=$prefer_static_libs
8632 if test built = "$use_static_libs" && test yes = "$installed"; then
8635 if test -n "$library_names" &&
8636 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8638 *cygwin* | *mingw* | *cegcc* | *os2*)
8639 # No point in relinking DLLs because paths are not encoded
8640 func_append notinst_deplibs " $lib"
8644 if test no = "$installed"; then
8645 func_append notinst_deplibs " $lib"
8650 # This is a shared library
8652 # Warn about portability, can't link against -module's on some
8653 # systems (darwin). Don't bleat about dlopened modules though!
8655 for dlpremoduletest in $dlprefiles; do
8656 if test "X$dlpremoduletest" = "X$lib"; then
8657 dlopenmodule=$dlpremoduletest
8661 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8663 if test prog = "$linkmode"; then
8664 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8666 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8668 $ECHO "*** $linklib is not portable!"
8670 if test lib = "$linkmode" &&
8671 test yes = "$hardcode_into_libs"; then
8672 # Hardcode the library path.
8673 # Skip directories that are in the system default run-time
8675 case " $sys_lib_dlsearch_path " in
8678 case "$compile_rpath " in
8680 *) func_append compile_rpath " $absdir" ;;
8684 case " $sys_lib_dlsearch_path " in
8687 case "$finalize_rpath " in
8689 *) func_append finalize_rpath " $libdir" ;;
8695 if test -n "$old_archive_from_expsyms_cmds"; then
8696 # figure out the soname
8697 set dummy $library_names
8701 libname=`eval "\\$ECHO \"$libname_spec\""`
8702 # use dlname if we got it. it's perfectly good, no?
8703 if test -n "$dlname"; then
8705 elif test -n "$soname_spec"; then
8708 *cygwin* | mingw* | *cegcc* | *os2*)
8709 func_arith $current - $age
8710 major=$func_arith_result
8714 eval soname=\"$soname_spec\"
8719 # Make a new name for the extract_expsyms_cmds to use
8721 func_basename "$soroot"
8722 soname=$func_basename_result
8723 func_stripname 'lib' '.dll' "$soname"
8724 newlib=libimp-$func_stripname_result.a
8726 # If the library has no export list, then create one now
8727 if test -f "$output_objdir/$soname-def"; then :
8729 func_verbose "extracting exported symbol list from '$soname'"
8730 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8734 if test -f "$output_objdir/$newlib"; then :; else
8735 func_verbose "generating import library for '$soname'"
8736 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8738 # make sure the library variables are pointing to the new library
8741 fi # test -n "$old_archive_from_expsyms_cmds"
8743 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8748 case $hardcode_action in
8749 immediate | unsupported)
8750 if test no = "$hardcode_direct"; then
8753 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8754 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8755 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8756 *-*-unixware7*) add_dir=-L$dir ;;
8758 # if the lib is a (non-dlopened) module then we cannot
8759 # link against it, someone is ignoring the earlier warnings
8760 if /usr/bin/file -L $add 2> /dev/null |
8761 $GREP ": [^:]* bundle" >/dev/null; then
8762 if test "X$dlopenmodule" != "X$lib"; then
8763 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8764 if test -z "$old_library"; then
8766 echo "*** And there doesn't seem to be a static archive available"
8767 echo "*** The link will probably fail, sorry"
8769 add=$dir/$old_library
8771 elif test -n "$old_library"; then
8772 add=$dir/$old_library
8776 elif test no = "$hardcode_minus_L"; then
8778 *-*-sunos*) add_shlibpath=$dir ;;
8782 elif test no = "$hardcode_shlibpath_var"; then
8790 if test yes = "$hardcode_direct" &&
8791 test no = "$hardcode_direct_absolute"; then
8793 elif test yes = "$hardcode_minus_L"; then
8795 # Try looking first in the location we're being installed to.
8796 if test -n "$inst_prefix_dir"; then
8799 func_append add_dir " -L$inst_prefix_dir$libdir"
8804 elif test yes = "$hardcode_shlibpath_var"; then
8814 if test yes != "$lib_linked"; then
8815 func_fatal_configuration "unsupported hardcode properties"
8818 if test -n "$add_shlibpath"; then
8819 case :$compile_shlibpath: in
8820 *":$add_shlibpath:"*) ;;
8821 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8824 if test prog = "$linkmode"; then
8825 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8826 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8828 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8829 test -n "$add" && deplibs="$add $deplibs"
8830 if test yes != "$hardcode_direct" &&
8831 test yes != "$hardcode_minus_L" &&
8832 test yes = "$hardcode_shlibpath_var"; then
8833 case :$finalize_shlibpath: in
8835 *) func_append finalize_shlibpath "$libdir:" ;;
8841 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8845 # Finalize command for both is simple: just hardcode it.
8846 if test yes = "$hardcode_direct" &&
8847 test no = "$hardcode_direct_absolute"; then
8848 add=$libdir/$linklib
8849 elif test yes = "$hardcode_minus_L"; then
8852 elif test yes = "$hardcode_shlibpath_var"; then
8853 case :$finalize_shlibpath: in
8855 *) func_append finalize_shlibpath "$libdir:" ;;
8858 elif test yes = "$hardcode_automatic"; then
8859 if test -n "$inst_prefix_dir" &&
8860 test -f "$inst_prefix_dir$libdir/$linklib"; then
8861 add=$inst_prefix_dir$libdir/$linklib
8863 add=$libdir/$linklib
8866 # We cannot seem to hardcode it, guess we'll fake it.
8868 # Try looking first in the location we're being installed to.
8869 if test -n "$inst_prefix_dir"; then
8872 func_append add_dir " -L$inst_prefix_dir$libdir"
8879 if test prog = "$linkmode"; then
8880 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8881 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8883 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8884 test -n "$add" && deplibs="$add $deplibs"
8887 elif test prog = "$linkmode"; then
8888 # Here we assume that one of hardcode_direct or hardcode_minus_L
8889 # is not unsupported. This is valid on all known static and
8891 if test unsupported != "$hardcode_direct"; then
8892 test -n "$old_library" && linklib=$old_library
8893 compile_deplibs="$dir/$linklib $compile_deplibs"
8894 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8896 compile_deplibs="-l$name -L$dir $compile_deplibs"
8897 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8899 elif test yes = "$build_libtool_libs"; then
8900 # Not a shared library
8901 if test pass_all != "$deplibs_check_method"; then
8902 # We're trying link a shared library against a static one
8903 # but the system doesn't support it.
8905 # Just print a warning and add the library to dependency_libs so
8906 # that the program can be linked against the static library.
8908 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8909 echo "*** I have the capability to make that library automatically link in when"
8910 echo "*** you link to this library. But I can only do this if you have a"
8911 echo "*** shared version of the library, which you do not appear to have."
8912 if test yes = "$module"; then
8913 echo "*** But as you try to build a module library, libtool will still create "
8914 echo "*** a static module, that should work as long as the dlopening application"
8915 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8916 if test -z "$global_symbol_pipe"; then
8918 echo "*** However, this would only work if libtool was able to extract symbol"
8919 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8920 echo "*** not find such a program. So, this module is probably useless."
8921 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8923 if test no = "$build_old_libs"; then
8924 build_libtool_libs=module
8927 build_libtool_libs=no
8931 deplibs="$dir/$old_library $deplibs"
8934 fi # link shared/static library?
8936 if test lib = "$linkmode"; then
8937 if test -n "$dependency_libs" &&
8938 { test yes != "$hardcode_into_libs" ||
8939 test yes = "$build_old_libs" ||
8940 test yes = "$link_static"; }; then
8941 # Extract -R from dependency_libs
8943 for libdir in $dependency_libs; do
8945 -R*) func_stripname '-R' '' "$libdir"
8946 temp_xrpath=$func_stripname_result
8948 *" $temp_xrpath "*) ;;
8949 *) func_append xrpath " $temp_xrpath";;
8951 *) func_append temp_deplibs " $libdir";;
8954 dependency_libs=$temp_deplibs
8957 func_append newlib_search_path " $absdir"
8958 # Link against this library
8959 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8960 # ... and its dependency_libs
8962 for deplib in $dependency_libs; do
8963 newdependency_libs="$deplib $newdependency_libs"
8965 -L*) func_stripname '-L' '' "$deplib"
8966 func_resolve_sysroot "$func_stripname_result";;
8967 *) func_resolve_sysroot "$deplib" ;;
8969 if $opt_preserve_dup_deps; then
8970 case "$tmp_libs " in
8971 *" $func_resolve_sysroot_result "*)
8972 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8975 func_append tmp_libs " $func_resolve_sysroot_result"
8978 if test no != "$link_all_deplibs"; then
8979 # Add the search paths of all dependency libraries
8980 for deplib in $dependency_libs; do
8983 -L*) path=$deplib ;;
8985 func_resolve_sysroot "$deplib"
8986 deplib=$func_resolve_sysroot_result
8987 func_dirname "$deplib" "" "."
8988 dir=$func_dirname_result
8989 # We need an absolute path.
8991 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8993 absdir=`cd "$dir" && pwd`
8994 if test -z "$absdir"; then
8995 func_warning "cannot determine absolute directory name of '$dir'"
9000 if $GREP "^installed=no" $deplib > /dev/null; then
9004 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
9005 if test -n "$deplibrary_names"; then
9006 for tmp in $deplibrary_names; do
9009 if test -f "$absdir/$objdir/$depdepl"; then
9010 depdepl=$absdir/$objdir/$depdepl
9011 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9012 if test -z "$darwin_install_name"; then
9013 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
9015 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
9016 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
9022 path=-L$absdir/$objdir
9026 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
9027 test -z "$libdir" && \
9028 func_fatal_error "'$deplib' is not a valid libtool archive"
9029 test "$absdir" != "$libdir" && \
9030 func_warning "'$deplib' seems to be moved"
9036 case " $deplibs " in
9038 *) deplibs="$path $deplibs" ;;
9041 fi # link_all_deplibs != no
9043 done # for deplib in $libs
9044 if test link = "$pass"; then
9045 if test prog = "$linkmode"; then
9046 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
9047 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
9049 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9052 dependency_libs=$newdependency_libs
9053 if test dlpreopen = "$pass"; then
9054 # Link the dlpreopened libraries before other libraries
9055 for deplib in $save_deplibs; do
9056 deplibs="$deplib $deplibs"
9059 if test dlopen != "$pass"; then
9060 test conv = "$pass" || {
9061 # Make sure lib_search_path contains only unique directories.
9063 for dir in $newlib_search_path; do
9064 case "$lib_search_path " in
9066 *) func_append lib_search_path " $dir" ;;
9072 if test prog,link = "$linkmode,$pass"; then
9073 vars="compile_deplibs finalize_deplibs"
9077 for var in $vars dependency_libs; do
9078 # Add libraries to $var in reverse order
9079 eval tmp_libs=\"\$$var\"
9081 for deplib in $tmp_libs; do
9082 # FIXME: Pedantically, this is the right thing to do, so
9083 # that some nasty dependency loop isn't accidentally
9085 #new_libs="$deplib $new_libs"
9086 # Pragmatically, this seems to cause very few problems in
9089 -L*) new_libs="$deplib $new_libs" ;;
9092 # And here is the reason: when a library appears more
9093 # than once as an explicit dependence of a library, or
9094 # is implicitly linked in more than once by the
9095 # compiler, it is considered special, and multiple
9096 # occurrences thereof are not removed. Compare this
9097 # with having the same library being listed as a
9098 # dependency of multiple other libraries: in this case,
9099 # we know (pedantically, we assume) the library does not
9100 # need to be listed more than once, so we keep only the
9101 # last copy. This is not always right, but it is rare
9102 # enough that we require users that really mean to play
9103 # such unportable linking tricks to link the library
9104 # using -Wl,-lname, so that libtool does not consider it
9105 # for duplicate removal.
9106 case " $specialdeplibs " in
9107 *" $deplib "*) new_libs="$deplib $new_libs" ;;
9109 case " $new_libs " in
9111 *) new_libs="$deplib $new_libs" ;;
9119 for deplib in $new_libs; do
9122 case " $tmp_libs " in
9124 *) func_append tmp_libs " $deplib" ;;
9127 *) func_append tmp_libs " $deplib" ;;
9130 eval $var=\"$tmp_libs\"
9134 # Add Sun CC postdeps if required:
9135 test CXX = "$tagname" && {
9138 case `$CC -V 2>&1 | sed 5q` in
9139 *Sun\ C*) # Sun C++ 5.9
9142 if test no != "$suncc_use_cstd_abi"; then
9143 func_append postdeps ' -library=Cstd -library=Crun'
9150 func_cc_basename "$CC"
9151 case $func_cc_basename_result in
9155 if test no != "$suncc_use_cstd_abi"; then
9156 func_append postdeps ' -library=Cstd -library=Crun'
9164 # Last step: remove runtime libs from dependency_libs
9165 # (they stay in deplibs)
9167 for i in $dependency_libs; do
9168 case " $predeps $postdeps $compiler_lib_search_path " in
9173 if test -n "$i"; then
9174 func_append tmp_libs " $i"
9177 dependency_libs=$tmp_libs
9179 if test prog = "$linkmode"; then
9182 if test prog = "$linkmode" || test lib = "$linkmode"; then
9183 dlprefiles=$newdlprefiles
9188 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
9189 func_warning "'-dlopen' is ignored for archives"
9194 func_warning "'-l' and '-L' are ignored for archives" ;;
9197 test -n "$rpath" && \
9198 func_warning "'-rpath' is ignored for archives"
9200 test -n "$xrpath" && \
9201 func_warning "'-R' is ignored for archives"
9203 test -n "$vinfo" && \
9204 func_warning "'-version-info/-version-number' is ignored for archives"
9206 test -n "$release" && \
9207 func_warning "'-release' is ignored for archives"
9209 test -n "$export_symbols$export_symbols_regex" && \
9210 func_warning "'-export-symbols' is ignored for archives"
9212 # Now set the variables for building old libraries.
9213 build_libtool_libs=no
9215 func_append objs "$old_deplibs"
9219 # Make sure we only generate libraries of the form 'libNAME.la'.
9222 func_stripname 'lib' '.la' "$outputname"
9223 name=$func_stripname_result
9224 eval shared_ext=\"$shrext_cmds\"
9225 eval libname=\"$libname_spec\"
9228 test no = "$module" \
9229 && func_fatal_help "libtool library '$output' must begin with 'lib'"
9231 if test no != "$need_lib_prefix"; then
9232 # Add the "lib" prefix for modules if required
9233 func_stripname '' '.la' "$outputname"
9234 name=$func_stripname_result
9235 eval shared_ext=\"$shrext_cmds\"
9236 eval libname=\"$libname_spec\"
9238 func_stripname '' '.la' "$outputname"
9239 libname=$func_stripname_result
9244 if test -n "$objs"; then
9245 if test pass_all != "$deplibs_check_method"; then
9246 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
9249 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
9250 $ECHO "*** objects $objs is not portable!"
9251 func_append libobjs " $objs"
9255 test no = "$dlself" \
9256 || func_warning "'-dlopen self' is ignored for libtool libraries"
9261 && func_warning "ignoring multiple '-rpath's for a libtool library"
9266 if test -z "$rpath"; then
9267 if test yes = "$build_libtool_libs"; then
9268 # Building a libtool convenience library.
9269 # Some compilers have problems with a '.al' extension so
9270 # convenience libraries should have the same extension an
9271 # archive normally would.
9272 oldlibs="$output_objdir/$libname.$libext $oldlibs"
9273 build_libtool_libs=convenience
9277 test -n "$vinfo" && \
9278 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
9280 test -n "$release" && \
9281 func_warning "'-release' is ignored for convenience libraries"
9284 # Parse the version information argument.
9285 save_ifs=$IFS; IFS=:
9286 set dummy $vinfo 0 0 0
9291 func_fatal_help "too many parameters to '-version-info'"
9293 # convert absolute version numbers to libtool ages
9294 # this retains compatibility with .la files and attempts
9295 # to make the code below a bit more comprehensible
9297 case $vinfo_number in
9303 # There are really only two kinds -- those that
9304 # use the current revision as the major version
9305 # and those that subtract age and use age as
9306 # a minor version. But, then there is irix
9307 # that has an extra 1 added just for fun
9309 case $version_type in
9310 # correct linux to gnu/linux during the next big refactor
9311 darwin|freebsd-elf|linux|osf|windows|none)
9312 func_arith $number_major + $number_minor
9313 current=$func_arith_result
9315 revision=$number_revision
9317 freebsd-aout|qnx|sunos)
9318 current=$number_major
9319 revision=$number_minor
9323 func_arith $number_major + $number_minor
9324 current=$func_arith_result
9326 revision=$number_minor
9327 lt_irix_increment=no
9330 func_fatal_configuration "$modename: unknown library version type '$version_type'"
9341 # Check that each of the things are valid numbers.
9343 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]) ;;
9345 func_error "CURRENT '$current' must be a nonnegative integer"
9346 func_fatal_error "'$vinfo' is not valid version information"
9351 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]) ;;
9353 func_error "REVISION '$revision' must be a nonnegative integer"
9354 func_fatal_error "'$vinfo' is not valid version information"
9359 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]) ;;
9361 func_error "AGE '$age' must be a nonnegative integer"
9362 func_fatal_error "'$vinfo' is not valid version information"
9366 if test "$age" -gt "$current"; then
9367 func_error "AGE '$age' is greater than the current interface number '$current'"
9368 func_fatal_error "'$vinfo' is not valid version information"
9371 # Calculate the version variables.
9375 case $version_type in
9379 # Like Linux, but with the current version available in
9380 # verstring for coding it into the library header
9381 func_arith $current - $age
9382 major=.$func_arith_result
9383 versuffix=$major.$age.$revision
9384 # Darwin ld doesn't like 0 for these options...
9385 func_arith $current + 1
9386 minor_current=$func_arith_result
9387 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9388 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9389 # On Darwin other compilers
9392 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9395 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9402 versuffix=.$current.$revision
9406 func_arith $current - $age
9407 major=.$func_arith_result
9408 versuffix=$major.$age.$revision
9412 if test no = "$lt_irix_increment"; then
9413 func_arith $current - $age
9415 func_arith $current - $age + 1
9417 major=$func_arith_result
9419 case $version_type in
9420 nonstopux) verstring_prefix=nonstopux ;;
9421 *) verstring_prefix=sgi ;;
9423 verstring=$verstring_prefix$major.$revision
9425 # Add in all the interfaces that we are compatible with.
9427 while test 0 -ne "$loop"; do
9428 func_arith $revision - $loop
9429 iface=$func_arith_result
9430 func_arith $loop - 1
9431 loop=$func_arith_result
9432 verstring=$verstring_prefix$major.$iface:$verstring
9435 # Before this point, $major must not contain '.'.
9437 versuffix=$major.$revision
9440 linux) # correct to gnu/linux during the next big refactor
9441 func_arith $current - $age
9442 major=.$func_arith_result
9443 versuffix=$major.$age.$revision
9447 func_arith $current - $age
9448 major=.$func_arith_result
9449 versuffix=.$current.$age.$revision
9450 verstring=$current.$age.$revision
9452 # Add in all the interfaces that we are compatible with.
9454 while test 0 -ne "$loop"; do
9455 func_arith $current - $loop
9456 iface=$func_arith_result
9457 func_arith $loop - 1
9458 loop=$func_arith_result
9459 verstring=$verstring:$iface.0
9462 # Make executables depend on our current version.
9463 func_append verstring ":$current.0"
9478 versuffix=.$current.$revision
9482 # Use '-' rather than '.', since we only want one
9483 # extension on DOS 8.3 file systems.
9484 func_arith $current - $age
9485 major=$func_arith_result
9490 func_fatal_configuration "unknown library version type '$version_type'"
9494 # Clear the version info if we defaulted, and they specified a release.
9495 if test -z "$vinfo" && test -n "$release"; then
9497 case $version_type in
9499 # we can't check for "0.0" in archive_cmds due to quoting
9500 # problems, so we reset it completely
9507 if test no = "$need_version"; then
9514 # Remove version info from name if versioning should be avoided
9515 if test yes,no = "$avoid_version,$need_version"; then
9521 # Check to see if the archive will have undefined symbols.
9522 if test yes = "$allow_undefined"; then
9523 if test unsupported = "$allow_undefined_flag"; then
9524 if test yes = "$build_old_libs"; then
9525 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9526 build_libtool_libs=no
9528 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9532 # Don't allow undefined symbols.
9533 allow_undefined_flag=$no_undefined_flag
9538 func_generate_dlsyms "$libname" "$libname" :
9539 func_append libobjs " $symfileobj"
9540 test " " = "$libobjs" && libobjs=
9542 if test relink != "$opt_mode"; then
9543 # Remove our outputs, but don't remove object files since they
9544 # may have been created when compiling PIC objects.
9546 tempremovelist=`$ECHO "$output_objdir/*"`
9547 for p in $tempremovelist; do
9551 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9552 if test -n "$precious_files_regex"; then
9553 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9558 func_append removelist " $p"
9563 test -n "$removelist" && \
9564 func_show_eval "${RM}r \$removelist"
9567 # Now set the variables for building old libraries.
9568 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9569 func_append oldlibs " $output_objdir/$libname.$libext"
9571 # Transform .lo files to .o files.
9572 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9575 # Eliminate all temporary directories.
9576 #for path in $notinst_path; do
9577 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9578 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9579 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9582 if test -n "$xrpath"; then
9583 # If the user specified any rpath flags, then add them.
9585 for libdir in $xrpath; do
9586 func_replace_sysroot "$libdir"
9587 func_append temp_xrpath " -R$func_replace_sysroot_result"
9588 case "$finalize_rpath " in
9590 *) func_append finalize_rpath " $libdir" ;;
9593 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9594 dependency_libs="$temp_xrpath $dependency_libs"
9598 # Make sure dlfiles contains only unique files that won't be dlpreopened
9599 old_dlfiles=$dlfiles
9601 for lib in $old_dlfiles; do
9602 case " $dlprefiles $dlfiles " in
9604 *) func_append dlfiles " $lib" ;;
9608 # Make sure dlprefiles contains only unique files
9609 old_dlprefiles=$dlprefiles
9611 for lib in $old_dlprefiles; do
9612 case "$dlprefiles " in
9614 *) func_append dlprefiles " $lib" ;;
9618 if test yes = "$build_libtool_libs"; then
9619 if test -n "$rpath"; then
9621 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9622 # these systems don't actually have a c library (as such)!
9624 *-*-rhapsody* | *-*-darwin1.[012])
9625 # Rhapsody C library is in the System framework
9626 func_append deplibs " System.ltframework"
9629 # Don't link with libc until the a.out ld.so is fixed.
9631 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9632 # Do not include libc due to us having libc/libc_r.
9634 *-*-sco3.2v5* | *-*-sco5v6*)
9635 # Causes problems with __ctype
9637 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9638 # Compiler inserts libc in the correct place for threads to work
9641 # Add libc to deplibs on all other systems if necessary.
9642 if test yes = "$build_libtool_need_lc"; then
9643 func_append deplibs " -lc"
9649 # Transform deplibs into only deplibs that can be linked in shared.
9651 libname_save=$libname
9652 release_save=$release
9653 versuffix_save=$versuffix
9655 # I'm not sure if I'm treating the release correctly. I think
9656 # release should show up in the -l (ie -lgmp5) so we don't want to
9657 # add it in twice. Is that correct?
9663 case $deplibs_check_method in
9665 # Don't check for shared/static. Everything works.
9666 # This might be a little naive. We might want to check
9667 # whether the library exists or not. But this is on
9668 # osf3 & osf4 and I'm not really sure... Just
9669 # implementing what was already the behavior.
9673 # This code stresses the "libraries are programs" paradigm to its
9674 # limits. Maybe even breaks it. We compile a program, linking it
9675 # against the deplibs as a proxy for the library. Then we can check
9676 # whether they linked in statically or dynamically with ldd.
9677 $opt_dry_run || $RM conftest.c
9678 cat > conftest.c <<EOF
9679 int main() { return 0; }
9681 $opt_dry_run || $RM conftest
9682 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9683 ldd_output=`ldd conftest`
9684 for i in $deplibs; do
9687 func_stripname -l '' "$i"
9688 name=$func_stripname_result
9689 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9690 case " $predeps $postdeps " in
9692 func_append newdeplibs " $i"
9697 if test -n "$i"; then
9698 libname=`eval "\\$ECHO \"$libname_spec\""`
9699 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9700 set dummy $deplib_matches; shift
9702 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9703 func_append newdeplibs " $i"
9707 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9708 echo "*** I have the capability to make that library automatically link in when"
9709 echo "*** you link to this library. But I can only do this if you have a"
9710 echo "*** shared version of the library, which I believe you do not have"
9711 echo "*** because a test_compile did reveal that the linker did not use it for"
9712 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9717 func_append newdeplibs " $i"
9722 # Error occurred in the first compile. Let's try to salvage
9723 # the situation: Compile a separate program for each library.
9724 for i in $deplibs; do
9727 func_stripname -l '' "$i"
9728 name=$func_stripname_result
9729 $opt_dry_run || $RM conftest
9730 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9731 ldd_output=`ldd conftest`
9732 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9733 case " $predeps $postdeps " in
9735 func_append newdeplibs " $i"
9740 if test -n "$i"; then
9741 libname=`eval "\\$ECHO \"$libname_spec\""`
9742 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9743 set dummy $deplib_matches; shift
9745 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9746 func_append newdeplibs " $i"
9750 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9751 echo "*** I have the capability to make that library automatically link in when"
9752 echo "*** you link to this library. But I can only do this if you have a"
9753 echo "*** shared version of the library, which you do not appear to have"
9754 echo "*** because a test_compile did reveal that the linker did not use this one"
9755 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9761 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9762 echo "*** make it link in! You will probably need to install it or some"
9763 echo "*** library that it depends on before this library will be fully"
9764 echo "*** functional. Installing it before continuing would be even better."
9768 func_append newdeplibs " $i"
9775 set dummy $deplibs_check_method; shift
9776 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9777 for a_deplib in $deplibs; do
9780 func_stripname -l '' "$a_deplib"
9781 name=$func_stripname_result
9782 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9783 case " $predeps $postdeps " in
9785 func_append newdeplibs " $a_deplib"
9790 if test -n "$a_deplib"; then
9791 libname=`eval "\\$ECHO \"$libname_spec\""`
9792 if test -n "$file_magic_glob"; then
9793 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9795 libnameglob=$libname
9797 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9798 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9799 if test yes = "$want_nocaseglob"; then
9801 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9804 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9806 for potent_lib in $potential_libs; do
9807 # Follow soft links.
9808 if ls -lLd "$potent_lib" 2>/dev/null |
9809 $GREP " -> " >/dev/null; then
9812 # The statement above tries to avoid entering an
9813 # endless loop below, in case of cyclic links.
9814 # We might still enter an endless loop, since a link
9815 # loop can be closed while we follow links,
9818 while test -h "$potlib" 2>/dev/null; do
9819 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9821 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9822 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9825 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9827 $EGREP "$file_magic_regex" > /dev/null; then
9828 func_append newdeplibs " $a_deplib"
9835 if test -n "$a_deplib"; then
9838 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9839 echo "*** I have the capability to make that library automatically link in when"
9840 echo "*** you link to this library. But I can only do this if you have a"
9841 echo "*** shared version of the library, which you do not appear to have"
9842 echo "*** because I did check the linker path looking for a file starting"
9843 if test -z "$potlib"; then
9844 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9846 $ECHO "*** with $libname and none of the candidates passed a file format test"
9847 $ECHO "*** using a file magic. Last file checked: $potlib"
9852 # Add a -L argument.
9853 func_append newdeplibs " $a_deplib"
9856 done # Gone through all deplibs.
9859 set dummy $deplibs_check_method; shift
9860 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9861 for a_deplib in $deplibs; do
9864 func_stripname -l '' "$a_deplib"
9865 name=$func_stripname_result
9866 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9867 case " $predeps $postdeps " in
9869 func_append newdeplibs " $a_deplib"
9874 if test -n "$a_deplib"; then
9875 libname=`eval "\\$ECHO \"$libname_spec\""`
9876 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9877 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9878 for potent_lib in $potential_libs; do
9879 potlib=$potent_lib # see symlink-check above in file_magic test
9880 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9881 $EGREP "$match_pattern_regex" > /dev/null; then
9882 func_append newdeplibs " $a_deplib"
9889 if test -n "$a_deplib"; then
9892 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9893 echo "*** I have the capability to make that library automatically link in when"
9894 echo "*** you link to this library. But I can only do this if you have a"
9895 echo "*** shared version of the library, which you do not appear to have"
9896 echo "*** because I did check the linker path looking for a file starting"
9897 if test -z "$potlib"; then
9898 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9900 $ECHO "*** with $libname and none of the candidates passed a file format test"
9901 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9906 # Add a -L argument.
9907 func_append newdeplibs " $a_deplib"
9910 done # Gone through all deplibs.
9914 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9915 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9916 for i in $predeps $postdeps; do
9917 # can't use Xsed below, because $i might contain '/'
9918 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9921 case $tmp_deplibs in
9924 if test none = "$deplibs_check_method"; then
9925 echo "*** Warning: inter-library dependencies are not supported in this platform."
9927 echo "*** Warning: inter-library dependencies are not known to be supported."
9929 echo "*** All declared inter-library dependencies are being dropped."
9935 versuffix=$versuffix_save
9937 release=$release_save
9938 libname=$libname_save
9942 *-*-rhapsody* | *-*-darwin1.[012])
9943 # On Rhapsody replace the C library with the System framework
9944 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9948 if test yes = "$droppeddeps"; then
9949 if test yes = "$module"; then
9951 echo "*** Warning: libtool could not satisfy all declared inter-library"
9952 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9953 echo "*** a static module, that should work as long as the dlopening"
9954 echo "*** application is linked with the -dlopen flag."
9955 if test -z "$global_symbol_pipe"; then
9957 echo "*** However, this would only work if libtool was able to extract symbol"
9958 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9959 echo "*** not find such a program. So, this module is probably useless."
9960 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9962 if test no = "$build_old_libs"; then
9963 oldlibs=$output_objdir/$libname.$libext
9964 build_libtool_libs=module
9967 build_libtool_libs=no
9970 echo "*** The inter-library dependencies that have been dropped here will be"
9971 echo "*** automatically added whenever a program is linked with this library"
9972 echo "*** or is declared to -dlopen it."
9974 if test no = "$allow_undefined"; then
9976 echo "*** Since this library must not contain undefined symbols,"
9977 echo "*** because either the platform does not support them or"
9978 echo "*** it was explicitly requested with -no-undefined,"
9979 echo "*** libtool will only create a static version of it."
9980 if test no = "$build_old_libs"; then
9981 oldlibs=$output_objdir/$libname.$libext
9982 build_libtool_libs=module
9985 build_libtool_libs=no
9990 # Done checking deplibs!
9993 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9996 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9997 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9998 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10002 # move library search paths that coincide with paths to not yet
10003 # installed libraries to the beginning of the library search list
10005 for path in $notinst_path; do
10006 case " $new_libs " in
10007 *" -L$path/$objdir "*) ;;
10009 case " $deplibs " in
10010 *" -L$path/$objdir "*)
10011 func_append new_libs " -L$path/$objdir" ;;
10016 for deplib in $deplibs; do
10019 case " $new_libs " in
10021 *) func_append new_libs " $deplib" ;;
10024 *) func_append new_libs " $deplib" ;;
10029 # All the library-specific variables (install_libdir is set above).
10034 # Test again, we may have decided not to build it any more
10035 if test yes = "$build_libtool_libs"; then
10036 # Remove $wl instances when linking with ld.
10037 # FIXME: should test the right _cmds variable.
10038 case $archive_cmds in
10041 if test yes = "$hardcode_into_libs"; then
10042 # Hardcode the library paths
10045 rpath=$finalize_rpath
10046 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
10047 for libdir in $rpath; do
10048 if test -n "$hardcode_libdir_flag_spec"; then
10049 if test -n "$hardcode_libdir_separator"; then
10050 func_replace_sysroot "$libdir"
10051 libdir=$func_replace_sysroot_result
10052 if test -z "$hardcode_libdirs"; then
10053 hardcode_libdirs=$libdir
10055 # Just accumulate the unique libdirs.
10056 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10057 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10060 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10065 eval flag=\"$hardcode_libdir_flag_spec\"
10066 func_append dep_rpath " $flag"
10068 elif test -n "$runpath_var"; then
10069 case "$perm_rpath " in
10071 *) func_append perm_rpath " $libdir" ;;
10075 # Substitute the hardcoded libdirs into the rpath.
10076 if test -n "$hardcode_libdir_separator" &&
10077 test -n "$hardcode_libdirs"; then
10078 libdir=$hardcode_libdirs
10079 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
10081 if test -n "$runpath_var" && test -n "$perm_rpath"; then
10082 # We should set the runpath_var.
10084 for dir in $perm_rpath; do
10085 func_append rpath "$dir:"
10087 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
10089 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
10092 shlibpath=$finalize_shlibpath
10093 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
10094 if test -n "$shlibpath"; then
10095 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
10098 # Get the real and link names of the library.
10099 eval shared_ext=\"$shrext_cmds\"
10100 eval library_names=\"$library_names_spec\"
10101 set dummy $library_names
10106 if test -n "$soname_spec"; then
10107 eval soname=\"$soname_spec\"
10111 if test -z "$dlname"; then
10115 lib=$output_objdir/$realname
10119 func_append linknames " $link"
10122 # Use standard objects if they are pic
10123 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
10124 test "X$libobjs" = "X " && libobjs=
10127 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10128 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
10129 export_symbols=$output_objdir/$libname.uexp
10130 func_append delfiles " $export_symbols"
10133 orig_export_symbols=
10135 cygwin* | mingw* | cegcc*)
10136 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
10137 # exporting using user supplied symfile
10138 func_dll_def_p "$export_symbols" || {
10139 # and it's NOT already a .def file. Must figure out
10140 # which of the given symbols are data symbols and tag
10141 # them as such. So, trigger use of export_symbols_cmds.
10142 # export_symbols gets reassigned inside the "prepare
10143 # the list of exported symbols" if statement, so the
10144 # include_expsyms logic still works.
10145 orig_export_symbols=$export_symbols
10147 always_export_symbols=yes
10153 # Prepare the list of exported symbols
10154 if test -z "$export_symbols"; then
10155 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
10156 func_verbose "generating symbol list for '$libname.la'"
10157 export_symbols=$output_objdir/$libname.exp
10158 $opt_dry_run || $RM $export_symbols
10159 cmds=$export_symbols_cmds
10160 save_ifs=$IFS; IFS='~'
10161 for cmd1 in $cmds; do
10163 # Take the normal branch if the nm_file_list_spec branch
10164 # doesn't work or if tool conversion is not needed.
10165 case $nm_file_list_spec~$to_tool_file_cmd in
10166 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
10167 try_normal_branch=yes
10170 len=$func_len_result
10173 try_normal_branch=no
10176 if test yes = "$try_normal_branch" \
10177 && { test "$len" -lt "$max_cmd_len" \
10178 || test "$max_cmd_len" -le -1; }
10180 func_show_eval "$cmd" 'exit $?'
10181 skipped_export=false
10182 elif test -n "$nm_file_list_spec"; then
10183 func_basename "$output"
10184 output_la=$func_basename_result
10185 save_libobjs=$libobjs
10186 save_output=$output
10187 output=$output_objdir/$output_la.nm
10188 func_to_tool_file "$output"
10189 libobjs=$nm_file_list_spec$func_to_tool_file_result
10190 func_append delfiles " $output"
10191 func_verbose "creating $NM input file list: $output"
10192 for obj in $save_libobjs; do
10193 func_to_tool_file "$obj"
10194 $ECHO "$func_to_tool_file_result"
10197 func_show_eval "$cmd" 'exit $?'
10198 output=$save_output
10199 libobjs=$save_libobjs
10200 skipped_export=false
10202 # The command line is too long to execute in one step.
10203 func_verbose "using reloadable object file for export list..."
10205 # Break out early, otherwise skipped_export may be
10206 # set to false by a later but shorter cmd.
10211 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
10212 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10213 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10218 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10219 tmp_export_symbols=$export_symbols
10220 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10221 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10224 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
10225 # The given exports_symbols file has to be filtered, so filter it.
10226 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10227 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10228 # 's' commands, which not all seds can handle. GNU sed should be fine
10229 # though. Also, the filter scales superlinearly with the number of
10230 # global variables. join(1) would be nice here, but unfortunately
10231 # isn't a blessed tool.
10232 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10233 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10234 export_symbols=$output_objdir/$libname.def
10235 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10239 for test_deplib in $deplibs; do
10240 case " $convenience " in
10241 *" $test_deplib "*) ;;
10243 func_append tmp_deplibs " $test_deplib"
10247 deplibs=$tmp_deplibs
10249 if test -n "$convenience"; then
10250 if test -n "$whole_archive_flag_spec" &&
10251 test yes = "$compiler_needs_object" &&
10252 test -z "$libobjs"; then
10253 # extract the archives, so we have objects to list.
10254 # TODO: could optimize this to just extract one archive.
10255 whole_archive_flag_spec=
10257 if test -n "$whole_archive_flag_spec"; then
10258 save_libobjs=$libobjs
10259 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10260 test "X$libobjs" = "X " && libobjs=
10262 gentop=$output_objdir/${outputname}x
10263 func_append generated " $gentop"
10265 func_extract_archives $gentop $convenience
10266 func_append libobjs " $func_extract_archives_result"
10267 test "X$libobjs" = "X " && libobjs=
10271 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
10272 eval flag=\"$thread_safe_flag_spec\"
10273 func_append linker_flags " $flag"
10276 # Make a backup of the uninstalled library when relinking
10277 if test relink = "$opt_mode"; then
10278 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
10281 # Do each of the archive commands.
10282 if test yes = "$module" && test -n "$module_cmds"; then
10283 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10284 eval test_cmds=\"$module_expsym_cmds\"
10285 cmds=$module_expsym_cmds
10287 eval test_cmds=\"$module_cmds\"
10291 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10292 eval test_cmds=\"$archive_expsym_cmds\"
10293 cmds=$archive_expsym_cmds
10295 eval test_cmds=\"$archive_cmds\"
10300 if test : != "$skipped_export" &&
10301 func_len " $test_cmds" &&
10302 len=$func_len_result &&
10303 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10306 # The command line is too long to link in one step, link piecewise
10307 # or, if using GNU ld and skipped_export is not :, use a linker
10310 # Save the value of $output and $libobjs because we want to
10311 # use them later. If we have whole_archive_flag_spec, we
10312 # want to use save_libobjs as it was before
10313 # whole_archive_flag_spec was expanded, because we can't
10314 # assume the linker understands whole_archive_flag_spec.
10315 # This may have to be revisited, in case too many
10316 # convenience libraries get linked in and end up exceeding
10318 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
10319 save_libobjs=$libobjs
10321 save_output=$output
10322 func_basename "$output"
10323 output_la=$func_basename_result
10325 # Clear the reloadable object creation command queue and
10326 # initialize k to one.
10333 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
10334 output=$output_objdir/$output_la.lnkscript
10335 func_verbose "creating GNU ld script: $output"
10336 echo 'INPUT (' > $output
10337 for obj in $save_libobjs
10339 func_to_tool_file "$obj"
10340 $ECHO "$func_to_tool_file_result" >> $output
10342 echo ')' >> $output
10343 func_append delfiles " $output"
10344 func_to_tool_file "$output"
10345 output=$func_to_tool_file_result
10346 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
10347 output=$output_objdir/$output_la.lnk
10348 func_verbose "creating linker input file list: $output"
10350 set x $save_libobjs
10353 if test yes = "$compiler_needs_object"; then
10359 func_to_tool_file "$obj"
10360 $ECHO "$func_to_tool_file_result" >> $output
10362 func_append delfiles " $output"
10363 func_to_tool_file "$output"
10364 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
10366 if test -n "$save_libobjs"; then
10367 func_verbose "creating reloadable object files..."
10368 output=$output_objdir/$output_la-$k.$objext
10369 eval test_cmds=\"$reload_cmds\"
10370 func_len " $test_cmds"
10371 len0=$func_len_result
10374 # Loop over the list of objects to be linked.
10375 for obj in $save_libobjs
10378 func_arith $len + $func_len_result
10379 len=$func_arith_result
10380 if test -z "$objlist" ||
10381 test "$len" -lt "$max_cmd_len"; then
10382 func_append objlist " $obj"
10384 # The command $test_cmds is almost too long, add a
10385 # command to the queue.
10386 if test 1 -eq "$k"; then
10387 # The first file doesn't have a previous command to add.
10388 reload_objs=$objlist
10389 eval concat_cmds=\"$reload_cmds\"
10391 # All subsequent reloadable object files will link in
10392 # the last one created.
10393 reload_objs="$objlist $last_robj"
10394 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
10396 last_robj=$output_objdir/$output_la-$k.$objext
10398 k=$func_arith_result
10399 output=$output_objdir/$output_la-$k.$objext
10401 func_len " $last_robj"
10402 func_arith $len0 + $func_len_result
10403 len=$func_arith_result
10406 # Handle the remaining objects by creating one last
10407 # reloadable object file. All subsequent reloadable object
10408 # files will link in the last one created.
10409 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10410 reload_objs="$objlist $last_robj"
10411 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
10412 if test -n "$last_robj"; then
10413 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10415 func_append delfiles " $output"
10421 ${skipped_export-false} && {
10422 func_verbose "generating symbol list for '$libname.la'"
10423 export_symbols=$output_objdir/$libname.exp
10424 $opt_dry_run || $RM $export_symbols
10426 # Append the command to create the export file.
10427 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10428 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
10429 if test -n "$last_robj"; then
10430 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10434 test -n "$save_libobjs" &&
10435 func_verbose "creating a temporary reloadable object file: $output"
10437 # Loop through the commands generated above and execute them.
10438 save_ifs=$IFS; IFS='~'
10439 for cmd in $concat_cmds; do
10442 func_quote_for_expand "$cmd"
10443 eval "func_echo $func_quote_for_expand_result"
10445 $opt_dry_run || eval "$cmd" || {
10448 # Restore the uninstalled library and exit
10449 if test relink = "$opt_mode"; then
10450 ( cd "$output_objdir" && \
10451 $RM "${realname}T" && \
10452 $MV "${realname}U" "$realname" )
10460 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
10461 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10462 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10466 ${skipped_export-false} && {
10467 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10468 tmp_export_symbols=$export_symbols
10469 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10470 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10473 if test -n "$orig_export_symbols"; then
10474 # The given exports_symbols file has to be filtered, so filter it.
10475 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10476 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10477 # 's' commands, which not all seds can handle. GNU sed should be fine
10478 # though. Also, the filter scales superlinearly with the number of
10479 # global variables. join(1) would be nice here, but unfortunately
10480 # isn't a blessed tool.
10481 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10482 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10483 export_symbols=$output_objdir/$libname.def
10484 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10489 # Restore the value of output.
10490 output=$save_output
10492 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10493 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10494 test "X$libobjs" = "X " && libobjs=
10496 # Expand the library linking commands again to reset the
10497 # value of $libobjs for piecewise linking.
10499 # Do each of the archive commands.
10500 if test yes = "$module" && test -n "$module_cmds"; then
10501 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10502 cmds=$module_expsym_cmds
10507 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10508 cmds=$archive_expsym_cmds
10515 if test -n "$delfiles"; then
10516 # Append the command to remove temporary files to $cmds.
10517 eval cmds=\"\$cmds~\$RM $delfiles\"
10520 # Add any objects from preloaded convenience libraries
10521 if test -n "$dlprefiles"; then
10522 gentop=$output_objdir/${outputname}x
10523 func_append generated " $gentop"
10525 func_extract_archives $gentop $dlprefiles
10526 func_append libobjs " $func_extract_archives_result"
10527 test "X$libobjs" = "X " && libobjs=
10530 save_ifs=$IFS; IFS='~'
10531 for cmd in $cmds; do
10536 func_quote_for_expand "$cmd"
10537 eval "func_echo $func_quote_for_expand_result"
10539 $opt_dry_run || eval "$cmd" || {
10542 # Restore the uninstalled library and exit
10543 if test relink = "$opt_mode"; then
10544 ( cd "$output_objdir" && \
10545 $RM "${realname}T" && \
10546 $MV "${realname}U" "$realname" )
10554 # Restore the uninstalled library and exit
10555 if test relink = "$opt_mode"; then
10556 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10558 if test -n "$convenience"; then
10559 if test -z "$whole_archive_flag_spec"; then
10560 func_show_eval '${RM}r "$gentop"'
10567 # Create links to the real library.
10568 for linkname in $linknames; do
10569 if test "$realname" != "$linkname"; then
10570 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10574 # If -module or -export-dynamic was specified, set the dlname.
10575 if test yes = "$module" || test yes = "$export_dynamic"; then
10576 # On all known operating systems, these are identical.
10583 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10584 func_warning "'-dlopen' is ignored for objects"
10587 case " $deplibs" in
10589 func_warning "'-l' and '-L' are ignored for objects" ;;
10592 test -n "$rpath" && \
10593 func_warning "'-rpath' is ignored for objects"
10595 test -n "$xrpath" && \
10596 func_warning "'-R' is ignored for objects"
10598 test -n "$vinfo" && \
10599 func_warning "'-version-info' is ignored for objects"
10601 test -n "$release" && \
10602 func_warning "'-release' is ignored for objects"
10606 test -n "$objs$old_deplibs" && \
10607 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10610 func_lo2o "$libobj"
10611 obj=$func_lo2o_result
10619 # Delete the old objects.
10620 $opt_dry_run || $RM $obj $libobj
10622 # Objects from convenience libraries. This assumes
10623 # single-version convenience libraries. Whenever we create
10624 # different ones for PIC/non-PIC, this we'll have to duplicate
10628 # if reload_cmds runs $LD directly, get rid of -Wl from
10629 # whole_archive_flag_spec and hope we can get by with turning comma
10631 case $reload_cmds in
10632 *\$LD[\ \$]*) wl= ;;
10634 if test -n "$convenience"; then
10635 if test -n "$whole_archive_flag_spec"; then
10636 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10637 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10638 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10640 gentop=$output_objdir/${obj}x
10641 func_append generated " $gentop"
10643 func_extract_archives $gentop $convenience
10644 reload_conv_objs="$reload_objs $func_extract_archives_result"
10648 # If we're not building shared, we need to use non_pic_objs
10649 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10651 # Create the old-style object.
10652 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10655 func_execute_cmds "$reload_cmds" 'exit $?'
10657 # Exit if we aren't doing a library object file.
10658 if test -z "$libobj"; then
10659 if test -n "$gentop"; then
10660 func_show_eval '${RM}r "$gentop"'
10666 test yes = "$build_libtool_libs" || {
10667 if test -n "$gentop"; then
10668 func_show_eval '${RM}r "$gentop"'
10671 # Create an invalid libtool object if no PIC, so that we don't
10672 # accidentally link it into a program.
10673 # $show "echo timestamp > $libobj"
10674 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10678 if test -n "$pic_flag" || test default != "$pic_mode"; then
10679 # Only do commands if we really have different PIC objects.
10680 reload_objs="$libobjs $reload_conv_objs"
10682 func_execute_cmds "$reload_cmds" 'exit $?'
10685 if test -n "$gentop"; then
10686 func_show_eval '${RM}r "$gentop"'
10694 *cygwin*) func_stripname '' '.exe' "$output"
10695 output=$func_stripname_result.exe;;
10697 test -n "$vinfo" && \
10698 func_warning "'-version-info' is ignored for programs"
10700 test -n "$release" && \
10701 func_warning "'-release' is ignored for programs"
10704 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10705 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10708 *-*-rhapsody* | *-*-darwin1.[012])
10709 # On Rhapsody replace the C library is the System framework
10710 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10711 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10717 # Don't allow lazy linking, it breaks C++ global constructors
10718 # But is supposedly fixed on 10.4 or later (yay!).
10719 if test CXX = "$tagname"; then
10720 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10722 func_append compile_command " $wl-bind_at_load"
10723 func_append finalize_command " $wl-bind_at_load"
10727 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10728 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10729 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10734 # move library search paths that coincide with paths to not yet
10735 # installed libraries to the beginning of the library search list
10737 for path in $notinst_path; do
10738 case " $new_libs " in
10739 *" -L$path/$objdir "*) ;;
10741 case " $compile_deplibs " in
10742 *" -L$path/$objdir "*)
10743 func_append new_libs " -L$path/$objdir" ;;
10748 for deplib in $compile_deplibs; do
10751 case " $new_libs " in
10753 *) func_append new_libs " $deplib" ;;
10756 *) func_append new_libs " $deplib" ;;
10759 compile_deplibs=$new_libs
10762 func_append compile_command " $compile_deplibs"
10763 func_append finalize_command " $finalize_deplibs"
10765 if test -n "$rpath$xrpath"; then
10766 # If the user specified any rpath flags, then add them.
10767 for libdir in $rpath $xrpath; do
10768 # This is the magic to use -rpath.
10769 case "$finalize_rpath " in
10771 *) func_append finalize_rpath " $libdir" ;;
10776 # Now hardcode the library paths
10779 for libdir in $compile_rpath $finalize_rpath; do
10780 if test -n "$hardcode_libdir_flag_spec"; then
10781 if test -n "$hardcode_libdir_separator"; then
10782 if test -z "$hardcode_libdirs"; then
10783 hardcode_libdirs=$libdir
10785 # Just accumulate the unique libdirs.
10786 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10787 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10790 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10795 eval flag=\"$hardcode_libdir_flag_spec\"
10796 func_append rpath " $flag"
10798 elif test -n "$runpath_var"; then
10799 case "$perm_rpath " in
10801 *) func_append perm_rpath " $libdir" ;;
10805 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10806 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10807 case :$dllsearchpath: in
10809 ::) dllsearchpath=$libdir;;
10810 *) func_append dllsearchpath ":$libdir";;
10812 case :$dllsearchpath: in
10813 *":$testbindir:"*) ;;
10814 ::) dllsearchpath=$testbindir;;
10815 *) func_append dllsearchpath ":$testbindir";;
10820 # Substitute the hardcoded libdirs into the rpath.
10821 if test -n "$hardcode_libdir_separator" &&
10822 test -n "$hardcode_libdirs"; then
10823 libdir=$hardcode_libdirs
10824 eval rpath=\" $hardcode_libdir_flag_spec\"
10826 compile_rpath=$rpath
10830 for libdir in $finalize_rpath; do
10831 if test -n "$hardcode_libdir_flag_spec"; then
10832 if test -n "$hardcode_libdir_separator"; then
10833 if test -z "$hardcode_libdirs"; then
10834 hardcode_libdirs=$libdir
10836 # Just accumulate the unique libdirs.
10837 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10838 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10841 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10846 eval flag=\"$hardcode_libdir_flag_spec\"
10847 func_append rpath " $flag"
10849 elif test -n "$runpath_var"; then
10850 case "$finalize_perm_rpath " in
10852 *) func_append finalize_perm_rpath " $libdir" ;;
10856 # Substitute the hardcoded libdirs into the rpath.
10857 if test -n "$hardcode_libdir_separator" &&
10858 test -n "$hardcode_libdirs"; then
10859 libdir=$hardcode_libdirs
10860 eval rpath=\" $hardcode_libdir_flag_spec\"
10862 finalize_rpath=$rpath
10864 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10865 # Transform all the library objects into standard objects.
10866 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10867 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10870 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10872 # template prelinking step
10873 if test -n "$prelink_cmds"; then
10874 func_execute_cmds "$prelink_cmds" 'exit $?'
10877 wrappers_required=:
10879 *cegcc* | *mingw32ce*)
10880 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10881 wrappers_required=false
10883 *cygwin* | *mingw* )
10884 test yes = "$build_libtool_libs" || wrappers_required=false
10887 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10888 wrappers_required=false
10892 $wrappers_required || {
10893 # Replace the output file specification.
10894 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10895 link_command=$compile_command$compile_rpath
10897 # We have no uninstalled library dependencies, so finalize right now.
10899 func_show_eval "$link_command" 'exit_status=$?'
10901 if test -n "$postlink_cmds"; then
10902 func_to_tool_file "$output"
10903 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10904 func_execute_cmds "$postlink_cmds" 'exit $?'
10907 # Delete the generated files.
10908 if test -f "$output_objdir/${outputname}S.$objext"; then
10909 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10915 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10916 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10918 if test -n "$finalize_shlibpath"; then
10919 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10924 if test -n "$runpath_var"; then
10925 if test -n "$perm_rpath"; then
10926 # We should set the runpath_var.
10928 for dir in $perm_rpath; do
10929 func_append rpath "$dir:"
10931 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10933 if test -n "$finalize_perm_rpath"; then
10934 # We should set the runpath_var.
10936 for dir in $finalize_perm_rpath; do
10937 func_append rpath "$dir:"
10939 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10943 if test yes = "$no_install"; then
10944 # We don't need to create a wrapper script.
10945 link_command=$compile_var$compile_command$compile_rpath
10946 # Replace the output file specification.
10947 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10948 # Delete the old output file.
10949 $opt_dry_run || $RM $output
10950 # Link the executable and exit
10951 func_show_eval "$link_command" 'exit $?'
10953 if test -n "$postlink_cmds"; then
10954 func_to_tool_file "$output"
10955 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10956 func_execute_cmds "$postlink_cmds" 'exit $?'
10962 case $hardcode_action,$fast_install in
10964 # Fast installation is not supported
10965 link_command=$compile_var$compile_command$compile_rpath
10966 relink_command=$finalize_var$finalize_command$finalize_rpath
10968 func_warning "this platform does not like uninstalled shared libraries"
10969 func_warning "'$output' will be relinked during installation"
10972 link_command=$finalize_var$compile_command$finalize_rpath
10973 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10976 link_command=$compile_var$compile_command$compile_rpath
10977 relink_command=$finalize_var$finalize_command$finalize_rpath
10980 link_command=$finalize_var$compile_command$finalize_rpath
10985 # Replace the output file specification.
10986 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
10988 # Delete the old output files.
10989 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
10991 func_show_eval "$link_command" 'exit $?'
10993 if test -n "$postlink_cmds"; then
10994 func_to_tool_file "$output_objdir/$outputname"
10995 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'`
10996 func_execute_cmds "$postlink_cmds" 'exit $?'
10999 # Now create the wrapper script.
11000 func_verbose "creating $output"
11002 # Quote the relink command for shipping.
11003 if test -n "$relink_command"; then
11004 # Preserve any variables that may affect compiler behavior
11005 for var in $variables_saved_for_relink; do
11006 if eval test -z \"\${$var+set}\"; then
11007 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11008 elif eval var_value=\$$var; test -z "$var_value"; then
11009 relink_command="$var=; export $var; $relink_command"
11011 func_quote_for_eval "$var_value"
11012 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
11015 relink_command="(cd `pwd`; $relink_command)"
11016 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
11019 # Only actually do things if not in dry run mode.
11021 # win32 will think the script is a binary if it has
11022 # a .exe suffix, so we strip it off here.
11024 *.exe) func_stripname '' '.exe' "$output"
11025 output=$func_stripname_result ;;
11027 # test for cygwin because mv fails w/o .exe extensions
11031 func_stripname '' '.exe' "$outputname"
11032 outputname=$func_stripname_result ;;
11036 *cygwin* | *mingw* )
11037 func_dirname_and_basename "$output" "" "."
11038 output_name=$func_basename_result
11039 output_path=$func_dirname_result
11040 cwrappersource=$output_path/$objdir/lt-$output_name.c
11041 cwrapper=$output_path/$output_name.exe
11042 $RM $cwrappersource $cwrapper
11043 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
11045 func_emit_cwrapperexe_src > $cwrappersource
11047 # The wrapper executable is built using the $host compiler,
11048 # because it contains $host paths and files. If cross-
11049 # compiling, it, like the target executable, must be
11050 # executed on the $host or under an emulation environment.
11052 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
11056 # Now, create the wrapper script for func_source use:
11057 func_ltwrapper_scriptname $cwrapper
11058 $RM $func_ltwrapper_scriptname_result
11059 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
11061 # note: this script will not be executed, so do not chmod.
11062 if test "x$build" = "x$host"; then
11063 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
11065 func_emit_wrapper no > $func_ltwrapper_scriptname_result
11071 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
11073 func_emit_wrapper no > $output
11082 # See if we need to build an old-fashioned archive.
11083 for oldlib in $oldlibs; do
11085 case $build_libtool_libs in
11087 oldobjs="$libobjs_save $symfileobj"
11088 addlibs=$convenience
11089 build_libtool_libs=no
11092 oldobjs=$libobjs_save
11093 addlibs=$old_convenience
11094 build_libtool_libs=no
11097 oldobjs="$old_deplibs $non_pic_objects"
11098 $preload && test -f "$symfileobj" \
11099 && func_append oldobjs " $symfileobj"
11100 addlibs=$old_convenience
11104 if test -n "$addlibs"; then
11105 gentop=$output_objdir/${outputname}x
11106 func_append generated " $gentop"
11108 func_extract_archives $gentop $addlibs
11109 func_append oldobjs " $func_extract_archives_result"
11112 # Do each command in the archive commands.
11113 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
11114 cmds=$old_archive_from_new_cmds
11117 # Add any objects from preloaded convenience libraries
11118 if test -n "$dlprefiles"; then
11119 gentop=$output_objdir/${outputname}x
11120 func_append generated " $gentop"
11122 func_extract_archives $gentop $dlprefiles
11123 func_append oldobjs " $func_extract_archives_result"
11126 # POSIX demands no paths to be encoded in archives. We have
11127 # to avoid creating archives with duplicate basenames if we
11128 # might have to extract them afterwards, e.g., when creating a
11129 # static archive out of a convenience library, or when linking
11130 # the entirety of a libtool archive into another (currently
11131 # not supported by libtool).
11132 if (for obj in $oldobjs
11134 func_basename "$obj"
11135 $ECHO "$func_basename_result"
11136 done | sort | sort -uc >/dev/null 2>&1); then
11139 echo "copying selected object files to avoid basename conflicts..."
11140 gentop=$output_objdir/${outputname}x
11141 func_append generated " $gentop"
11142 func_mkdir_p "$gentop"
11143 save_oldobjs=$oldobjs
11146 for obj in $save_oldobjs
11148 func_basename "$obj"
11149 objbase=$func_basename_result
11150 case " $oldobjs " in
11151 " ") oldobjs=$obj ;;
11152 *[\ /]"$objbase "*)
11154 # Make sure we don't pick an alternate name that also
11156 newobj=lt$counter-$objbase
11157 func_arith $counter + 1
11158 counter=$func_arith_result
11159 case " $oldobjs " in
11160 *[\ /]"$newobj "*) ;;
11161 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
11164 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
11165 func_append oldobjs " $gentop/$newobj"
11167 *) func_append oldobjs " $obj" ;;
11171 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
11172 tool_oldlib=$func_to_tool_file_result
11173 eval cmds=\"$old_archive_cmds\"
11176 len=$func_len_result
11177 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
11178 cmds=$old_archive_cmds
11179 elif test -n "$archiver_list_spec"; then
11180 func_verbose "using command file archive linking..."
11181 for obj in $oldobjs
11183 func_to_tool_file "$obj"
11184 $ECHO "$func_to_tool_file_result"
11185 done > $output_objdir/$libname.libcmd
11186 func_to_tool_file "$output_objdir/$libname.libcmd"
11187 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
11188 cmds=$old_archive_cmds
11190 # the command line is too long to link in one step, link in parts
11191 func_verbose "using piecewise archive linking..."
11192 save_RANLIB=$RANLIB
11196 save_oldobjs=$oldobjs
11198 # Is there a better way of finding the last object in the list?
11199 for obj in $save_oldobjs
11203 eval test_cmds=\"$old_archive_cmds\"
11204 func_len " $test_cmds"
11205 len0=$func_len_result
11207 for obj in $save_oldobjs
11210 func_arith $len + $func_len_result
11211 len=$func_arith_result
11212 func_append objlist " $obj"
11213 if test "$len" -lt "$max_cmd_len"; then
11216 # the above command should be used before it gets too long
11218 if test "$obj" = "$last_oldobj"; then
11219 RANLIB=$save_RANLIB
11221 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
11222 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
11227 RANLIB=$save_RANLIB
11229 if test -z "$oldobjs"; then
11230 eval cmds=\"\$concat_cmds\"
11232 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
11236 func_execute_cmds "$cmds" 'exit $?'
11239 test -n "$generated" && \
11240 func_show_eval "${RM}r$generated"
11242 # Now create the libtool archive.
11246 test yes = "$build_old_libs" && old_library=$libname.$libext
11247 func_verbose "creating $output"
11249 # Preserve any variables that may affect compiler behavior
11250 for var in $variables_saved_for_relink; do
11251 if eval test -z \"\${$var+set}\"; then
11252 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
11253 elif eval var_value=\$$var; test -z "$var_value"; then
11254 relink_command="$var=; export $var; $relink_command"
11256 func_quote_for_eval "$var_value"
11257 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
11260 # Quote the link command for shipping.
11261 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
11262 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
11263 if test yes = "$hardcode_automatic"; then
11267 # Only create the output if not a dry run.
11269 for installed in no yes; do
11270 if test yes = "$installed"; then
11271 if test -z "$install_libdir"; then
11274 output=$output_objdir/${outputname}i
11275 # Replace all uninstalled libtool libraries with the installed ones
11276 newdependency_libs=
11277 for deplib in $dependency_libs; do
11280 func_basename "$deplib"
11281 name=$func_basename_result
11282 func_resolve_sysroot "$deplib"
11283 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
11284 test -z "$libdir" && \
11285 func_fatal_error "'$deplib' is not a valid libtool archive"
11286 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
11289 func_stripname -L '' "$deplib"
11290 func_replace_sysroot "$func_stripname_result"
11291 func_append newdependency_libs " -L$func_replace_sysroot_result"
11294 func_stripname -R '' "$deplib"
11295 func_replace_sysroot "$func_stripname_result"
11296 func_append newdependency_libs " -R$func_replace_sysroot_result"
11298 *) func_append newdependency_libs " $deplib" ;;
11301 dependency_libs=$newdependency_libs
11304 for lib in $dlfiles; do
11307 func_basename "$lib"
11308 name=$func_basename_result
11309 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11310 test -z "$libdir" && \
11311 func_fatal_error "'$lib' is not a valid libtool archive"
11312 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
11314 *) func_append newdlfiles " $lib" ;;
11317 dlfiles=$newdlfiles
11319 for lib in $dlprefiles; do
11322 # Only pass preopened files to the pseudo-archive (for
11323 # eventual linking with the app. that links it) if we
11324 # didn't already link the preopened objects directly into
11326 func_basename "$lib"
11327 name=$func_basename_result
11328 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11329 test -z "$libdir" && \
11330 func_fatal_error "'$lib' is not a valid libtool archive"
11331 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
11335 dlprefiles=$newdlprefiles
11338 for lib in $dlfiles; do
11340 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11341 *) abs=`pwd`"/$lib" ;;
11343 func_append newdlfiles " $abs"
11345 dlfiles=$newdlfiles
11347 for lib in $dlprefiles; do
11349 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11350 *) abs=`pwd`"/$lib" ;;
11352 func_append newdlprefiles " $abs"
11354 dlprefiles=$newdlprefiles
11357 # place dlname in correct position for cygwin
11358 # In fact, it would be nice if we could use this code for all target
11359 # systems that can't hard-code library paths into their executables
11360 # and that have no shared library path variable independent of PATH,
11361 # but it turns out we can't easily determine that from inspecting
11362 # libtool variables, so we have to hard-code the OSs to which it
11363 # applies here; at the moment, that means platforms that use the PE
11364 # object format with DLL files. See the long comment at the top of
11365 # tests/bindir.at for full details.
11367 case $host,$output,$installed,$module,$dlname in
11368 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
11369 # If a -bindir argument was supplied, place the dll there.
11370 if test -n "$bindir"; then
11371 func_relative_path "$install_libdir" "$bindir"
11372 tdlname=$func_relative_path_result/$dlname
11374 # Otherwise fall back on heuristic.
11375 tdlname=../bin/$dlname
11380 # $outputname - a libtool library file
11381 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
11383 # Please DO NOT delete this file!
11384 # It is necessary for linking the library.
11386 # The name that we can dlopen(3).
11389 # Names of this library.
11390 library_names='$library_names'
11392 # The name of the static archive.
11393 old_library='$old_library'
11395 # Linker flags that cannot go in dependency_libs.
11396 inherited_linker_flags='$new_inherited_linker_flags'
11398 # Libraries that this one depends upon.
11399 dependency_libs='$dependency_libs'
11401 # Names of additional weak libraries provided by this library
11402 weak_library_names='$weak_libs'
11404 # Version information for $libname.
11409 # Is this an already installed library?
11410 installed=$installed
11412 # Should we warn about portability when linking against -modules?
11413 shouldnotlink=$module
11415 # Files to dlopen/dlpreopen
11417 dlpreopen='$dlprefiles'
11419 # Directory that this library needs to be installed in:
11420 libdir='$install_libdir'"
11421 if test no,yes = "$installed,$need_relink"; then
11422 $ECHO >> $output "\
11423 relink_command=\"$relink_command\""
11428 # Do a symbolic link so that the libtool archive can be found in
11429 # LD_LIBRARY_PATH before the program is installed.
11430 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
11436 if test link = "$opt_mode" || test relink = "$opt_mode"; then
11437 func_mode_link ${1+"$@"}
11441 # func_mode_uninstall arg...
11442 func_mode_uninstall ()
11451 # This variable tells wrapper scripts just to set variables rather
11452 # than running their programs.
11453 libtool_install_magic=$magic
11458 -f) func_append RM " $arg"; rmforce=: ;;
11459 -*) func_append RM " $arg" ;;
11460 *) func_append files " $arg" ;;
11465 func_fatal_help "you must specify an RM program"
11469 for file in $files; do
11470 func_dirname "$file" "" "."
11471 dir=$func_dirname_result
11472 if test . = "$dir"; then
11477 func_basename "$file"
11478 name=$func_basename_result
11479 test uninstall = "$opt_mode" && odir=$dir
11481 # Remember odir for removal later, being careful to avoid duplicates
11482 if test clean = "$opt_mode"; then
11483 case " $rmdirs " in
11485 *) func_append rmdirs " $odir" ;;
11489 # Don't error if the file doesn't exist and rm -f was used.
11490 if { test -L "$file"; } >/dev/null 2>&1 ||
11491 { test -h "$file"; } >/dev/null 2>&1 ||
11492 test -f "$file"; then
11494 elif test -d "$file"; then
11497 elif $rmforce; then
11505 # Possibly a libtool archive, so verify it.
11506 if func_lalib_p "$file"; then
11507 func_source $dir/$name
11509 # Delete the libtool libraries and symlinks.
11510 for n in $library_names; do
11511 func_append rmfiles " $odir/$n"
11513 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11517 case " $library_names " in
11519 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11521 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11524 if test -n "$library_names"; then
11525 # Do each command in the postuninstall commands.
11526 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11529 if test -n "$old_library"; then
11530 # Do each command in the old_postuninstall commands.
11531 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11533 # FIXME: should reinstall the best remaining shared library.
11540 # Possibly a libtool object, so verify it.
11541 if func_lalib_p "$file"; then
11543 # Read the .lo file
11544 func_source $dir/$name
11546 # Add PIC object to the list of files to remove.
11547 if test -n "$pic_object" && test none != "$pic_object"; then
11548 func_append rmfiles " $dir/$pic_object"
11551 # Add non-PIC object to the list of files to remove.
11552 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11553 func_append rmfiles " $dir/$non_pic_object"
11559 if test clean = "$opt_mode"; then
11563 func_stripname '' '.exe' "$file"
11564 file=$func_stripname_result
11565 func_stripname '' '.exe' "$name"
11566 noexename=$func_stripname_result
11567 # $file with .exe has already been added to rmfiles,
11568 # add $file without .exe
11569 func_append rmfiles " $file"
11572 # Do a test to see if this is a libtool program.
11573 if func_ltwrapper_p "$file"; then
11574 if func_ltwrapper_executable_p "$file"; then
11575 func_ltwrapper_scriptname "$file"
11577 func_source $func_ltwrapper_scriptname_result
11578 func_append rmfiles " $func_ltwrapper_scriptname_result"
11581 func_source $dir/$noexename
11584 # note $name still contains .exe if it was in $file originally
11585 # as does the version of $file that was added into $rmfiles
11586 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11587 if test yes = "$fast_install" && test -n "$relink_command"; then
11588 func_append rmfiles " $odir/lt-$name"
11590 if test "X$noexename" != "X$name"; then
11591 func_append rmfiles " $odir/lt-$noexename.c"
11597 func_show_eval "$RM $rmfiles" 'exit_status=1'
11600 # Try to remove the $objdir's in the directories where we deleted files
11601 for dir in $rmdirs; do
11602 if test -d "$dir"; then
11603 func_show_eval "rmdir $dir >/dev/null 2>&1"
11610 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11611 func_mode_uninstall ${1+"$@"}
11614 test -z "$opt_mode" && {
11616 func_fatal_help "you must specify a MODE"
11619 test -z "$exec_cmd" && \
11620 func_fatal_help "invalid operation mode '$opt_mode'"
11622 if test -n "$exec_cmd"; then
11623 eval exec "$exec_cmd"
11630 # The TAGs below are defined such that we never get into a situation
11631 # where we disable both kinds of libraries. Given conflicting
11632 # choices, we go for a static library, that is the most portable,
11633 # since we can't tell whether shared libraries were disabled because
11634 # the user asked for that or because the platform doesn't support
11635 # them. This is particularly important on AIX, because we don't
11636 # support having both static and shared libraries enabled at the same
11637 # time on that platform, so we default to a shared-only configuration.
11638 # If a disable-shared tag is given, we'll fallback to a static-only
11639 # configuration. But we'll never go from static-only to shared-only.
11641 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11642 build_libtool_libs=no
11644 # ### END LIBTOOL TAG CONFIG: disable-shared
11646 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11647 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11648 # ### END LIBTOOL TAG CONFIG: disable-static
11651 # mode:shell-script