3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (libgphoto2_port) 0.8.0
5 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
7 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
8 # 2006, 2007, 2008 Free Software Foundation, Inc.
9 # Written by Gordon Matzigkeit, 1996
11 # This file is part of GNU Libtool.
13 # GNU Libtool is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation; either version 2 of
16 # the License, or (at your option) any later version.
18 # As a special exception to the GNU General Public License,
19 # if you distribute this file as part of a program or library that
20 # is built using GNU Libtool, you may include this file under the
21 # same distribution terms that you use for the rest of that program.
23 # GNU Libtool is distributed in the hope that it will be useful,
24 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 # GNU General Public License for more details.
28 # You should have received a copy of the GNU General Public License
29 # along with GNU Libtool; see the file COPYING. If not, a copy
30 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
31 # obtained by writing to the Free Software Foundation, Inc.,
32 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
35 # The names of the tagged configurations supported by this script.
38 # ### BEGIN LIBTOOL CONFIG
40 # Whether or not to build static libraries.
46 # DLL creation program.
49 # Object dumper program.
52 # Which release of libtool.m4 was used?
56 # Whether or not to build shared libraries.
57 build_libtool_libs=yes
59 # What type of objects to build.
62 # Whether or not to optimize for fast installation.
66 host_alias=armv7l-unknown-linux-gnueabi
67 host=armv7l-unknown-linux-gnueabi
71 build_alias=armv7l-unknown-linux-gnueabi
72 build=armv7l-unknown-linux-gnueabi
73 build_os=linux-gnueabi
75 # A sed program that does not truncate output.
78 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
79 Xsed="$SED -e 1s/^X//"
81 # A grep program that handles long lines.
87 # A literal string matcher.
90 # A BSD- or MS-compatible name lister.
93 # Whether we need soft or hard links.
96 # What is the maximum length of a command?
99 # Object file suffix (normally "o").
102 # Executable file suffix (normally "").
105 # whether the shell understands "unset".
108 # turn spaces into newlines.
109 SP2NL="tr \\040 \\012"
111 # turn newlines into spaces.
112 NL2SP="tr \\015\\012 \\040\\040"
114 # How to create reloadable object files.
116 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
118 # Method to check whether dependent libraries are shared objects.
119 deplibs_check_method="pass_all"
121 # Command to use when deplibs_check_method == "file_magic".
122 file_magic_cmd="\$MAGIC_CMD"
128 # A symbol stripping program.
131 # Commands used to install an old-style archive.
133 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
134 old_postuninstall_cmds=""
139 # LTCC compiler flags.
140 LTCFLAGS="-Wall -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -fmessage-length=0 -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=vfpv3 -mfloat-abi=softfp -D__SOFTFP__ -fPIC"
142 # Take the output of nm and produce a listing of raw symbols and C names.
143 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
145 # Transform the output of nm in a proper C declaration.
146 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
148 # Transform the output of nm in a C name address pair.
149 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
151 # Transform the output of nm in a C name address pair when lib prefix is needed.
152 global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'"
154 # The name of the directory that contains temporary libtool files.
157 # Shell to use when invoking shell scripts.
160 # An echo program that does not interpret backslashes.
163 # Used to examine libraries when file_magic_cmd begins with "file".
166 # Must we lock files when doing compilation?
169 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
172 # Tool to change global to local symbols on Mac OS X.
175 # Tool to manipulate fat objects and archives on Mac OS X.
178 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
181 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
184 # Old archive suffix (normally "a").
187 # Shared library suffix (normally ".so").
190 # The commands to extract the exported symbol list from a shared archive.
191 extract_expsyms_cmds=""
193 # Variables whose values should be saved in libtool wrapper scripts and
194 # restored at link time.
195 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
197 # Do we need the "lib" prefix for modules?
200 # Do we need a version for libraries?
203 # Library versioning type.
206 # Shared library runtime path variable.
207 runpath_var=LD_RUN_PATH
209 # Shared library path variable.
210 shlibpath_var=LD_LIBRARY_PATH
212 # Is shlibpath searched before the hard-coded library search path?
213 shlibpath_overrides_runpath=no
215 # Format of library name prefix.
216 libname_spec="lib\$name"
218 # List of archive names. First name is the real one, the rest are links.
219 # The last name is the one that the linker finds with -lNAME
220 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
222 # The coded name of the library, if different from the real name.
223 soname_spec="\${libname}\${release}\${shared_ext}\$major"
225 # Command to use after installation of a shared archive.
228 # Command to use after uninstallation of a shared archive.
229 postuninstall_cmds=""
231 # Commands used to finish a libtool library installation in a directory.
232 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
234 # As "finish_cmds", except a single script fragment to be evaled but
238 # Whether we should hardcode library paths into libraries.
239 hardcode_into_libs=yes
241 # Compile-time system search path for libraries.
242 sys_lib_search_path_spec="/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.5.3 /lib /usr/lib"
244 # Run-time system search path for libraries.
245 sys_lib_dlsearch_path_spec="/lib /usr/lib /emul/ia32-linux/usr/i586-tizen-linux/lib /emul/ia32-linux/usr/local/lib /emul/ia32-linux/lib /emul/ia32-linux/usr/lib "
247 # Whether dlopen is supported.
250 # Whether dlopen of programs is supported.
253 # Whether dlopen of statically linked programs is supported.
254 dlopen_self_static=yes
256 # Commands to strip libraries.
257 old_striplib="strip --strip-debug"
258 striplib="strip --strip-unneeded"
261 # The linker used to build libraries.
262 LD="/usr/libexec/gcc/armv7l-tizen-linux-gnueabi/4.5.3/ld"
264 # Commands used to build an old-style archive.
265 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
267 # A language specific compiler.
270 # Is the compiler the GNU compiler?
273 # Compiler flag to turn off builtin functions.
274 no_builtin_flag=" -fno-builtin"
276 # How to pass a linker flag through the compiler.
279 # Additional compiler flags for building library objects.
280 pic_flag=" -fPIC -DPIC"
282 # Compiler flag to prevent dynamic linking.
285 # Does compiler simultaneously support -c and -o options?
288 # Whether or not to add -lc for building shared libraries.
289 build_libtool_need_lc=no
291 # Whether or not to disallow shared libs when runtime libs are static.
292 allow_libtool_libs_with_static_runtimes=no
294 # Compiler flag to allow reflexive dlopens.
295 export_dynamic_flag_spec="\${wl}--export-dynamic"
297 # Compiler flag to generate shared objects directly from archives.
298 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
300 # Whether the compiler copes with passing no objects directly.
301 compiler_needs_object="no"
303 # Create an old-style archive from a shared archive.
304 old_archive_from_new_cmds=""
306 # Create a temporary old-style archive to link instead of a shared archive.
307 old_archive_from_expsyms_cmds=""
309 # Commands used to build a shared archive.
310 archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
311 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
312 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
313 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
314 \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
316 # Commands used to build a loadable module if different from building
319 module_expsym_cmds=""
321 # Whether we are building with GNU ld or not.
324 # Flag that allows shared libraries with undefined symbols to be built.
325 allow_undefined_flag=""
327 # Flag that enforces no undefined symbols.
330 # Flag to hardcode $libdir into a binary during linking.
331 # This must work even if $libdir does not exist
332 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
334 # If ld is used when linking, flag to hardcode $libdir into a binary
335 # during linking. This must work even if $libdir does not exist.
336 hardcode_libdir_flag_spec_ld=""
338 # Whether we need a single "-rpath" flag with a separated argument.
339 hardcode_libdir_separator=""
341 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
342 # DIR into the resulting binary.
345 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
346 # DIR into the resulting binary and the resulting library dependency is
347 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
348 # library is relocated.
349 hardcode_direct_absolute=no
351 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
352 # into the resulting binary.
355 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
356 # into the resulting binary.
357 hardcode_shlibpath_var=unsupported
359 # Set to "yes" if building a shared library automatically hardcodes DIR
360 # into the library and all subsequent libraries and executables linked
362 hardcode_automatic=no
364 # Set to yes if linker adds runtime paths of dependent libraries
365 # to runtime path list.
368 # Whether libtool must link a program against all its dependency libraries.
369 link_all_deplibs=unknown
371 # Fix the shell variable $srcfile for the compiler.
374 # Set to "yes" if exported symbols are required.
375 always_export_symbols=no
377 # The commands to list exported symbols.
378 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
380 # Symbols that should not be listed in the preloaded symbols.
381 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
383 # Symbols that must always be exported.
386 # Commands necessary for linking programs (against libraries) with templates.
389 # Specify filename containing input files.
392 # How to hardcode a shared library path into an executable.
393 hardcode_action=immediate
395 # ### END LIBTOOL CONFIG
397 # Generated from ltmain.m4sh.
399 # ltmain.sh (GNU libtool) 2.2.6b
400 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
402 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
403 # This is free software; see the source for copying conditions. There is NO
404 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
406 # GNU Libtool is free software; you can redistribute it and/or modify
407 # it under the terms of the GNU General Public License as published by
408 # the Free Software Foundation; either version 2 of the License, or
409 # (at your option) any later version.
411 # As a special exception to the GNU General Public License,
412 # if you distribute this file as part of a program or library that
413 # is built using GNU Libtool, you may include this file under the
414 # same distribution terms that you use for the rest of that program.
416 # GNU Libtool is distributed in the hope that it will be useful, but
417 # WITHOUT ANY WARRANTY; without even the implied warranty of
418 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
419 # General Public License for more details.
421 # You should have received a copy of the GNU General Public License
422 # along with GNU Libtool; see the file COPYING. If not, a copy
423 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
424 # or obtained by writing to the Free Software Foundation, Inc.,
425 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
427 # Usage: $progname [OPTION]... [MODE-ARG]...
429 # Provide generalized library-building support services.
431 # --config show all configuration variables
432 # --debug enable verbose shell tracing
433 # -n, --dry-run display commands without modifying any files
434 # --features display basic configuration information and exit
435 # --mode=MODE use operation mode MODE
436 # --preserve-dup-deps don't remove duplicate dependency libraries
437 # --quiet, --silent don't print informational messages
438 # --tag=TAG use configuration variables from tag TAG
439 # -v, --verbose print informational messages (default)
440 # --version print version information
441 # -h, --help print short or long help message
443 # MODE must be one of the following:
445 # clean remove files from the build directory
446 # compile compile a source file into a libtool object
447 # execute automatically set library path, then run a program
448 # finish complete the installation of libtool libraries
449 # install install libraries or executables
450 # link create a library or an executable
451 # uninstall remove libraries from an installed directory
453 # MODE-ARGS vary depending on the MODE.
454 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
456 # When reporting a bug, please describe a test case to reproduce it and
457 # include the following information:
459 # host-triplet: $host
462 # compiler flags: $LTCFLAGS
463 # linker: $LD (gnu? $with_gnu_ld)
464 # $progname: (GNU libtool) 2.2.6b
465 # automake: $automake_version
466 # autoconf: $autoconf_version
468 # Report bugs to <bug-libtool@gnu.org>.
474 package_revision=1.3017
476 # Be Bourne compatible
477 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
480 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
481 # is contrary to our usage. Disable this feature.
482 alias -g '${1+"$@"}'='"$@"'
485 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
487 BIN_SH=xpg4; export BIN_SH # for Tru64
488 DUALCASE=1; export DUALCASE # for MKS sh
490 # NLS nuisances: We save the old values to restore during execute mode.
491 # Only set LANG and LC_ALL to C if already set.
492 # These must not be set unconditionally because not all systems understand
493 # e.g. LANG=C (notably SCO).
496 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
498 eval "if test \"\${$lt_var+set}\" = set; then
499 save_$lt_var=\$$lt_var
502 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
503 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
515 : ${EGREP="/bin/grep -E"}
516 : ${FGREP="/bin/grep -F"}
517 : ${GREP="/bin/grep"}
524 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
525 : ${Xsed="$SED -e 1s/^X//"}
530 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
531 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
533 exit_status=$EXIT_SUCCESS
535 # Make sure IFS has a sensible default
540 dirname="s,/[^/]*$,,"
543 # func_dirname_and_basename file append nondir_replacement
544 # perform func_basename and func_dirname in a single function
546 # dirname: Compute the dirname of FILE. If nonempty,
547 # add APPEND to the result, otherwise set result
548 # to NONDIR_REPLACEMENT.
549 # value returned in "$func_dirname_result"
550 # basename: Compute filename of FILE.
551 # value retuned in "$func_basename_result"
552 # Implementation must be kept synchronized with func_dirname
553 # and func_basename. For efficiency, we do not delegate to
554 # those functions but instead duplicate the functionality here.
555 func_dirname_and_basename ()
557 # Extract subdirectory from the argument.
558 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
559 if test "X$func_dirname_result" = "X${1}"; then
560 func_dirname_result="${3}"
562 func_dirname_result="$func_dirname_result${2}"
564 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
567 # Generated shell functions inserted here.
569 # func_dirname file append nondir_replacement
570 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
571 # otherwise set result to NONDIR_REPLACEMENT.
575 */*) func_dirname_result="${1%/*}${2}" ;;
576 * ) func_dirname_result="${3}" ;;
583 func_basename_result="${1##*/}"
586 # func_dirname_and_basename file append nondir_replacement
587 # perform func_basename and func_dirname in a single function
589 # dirname: Compute the dirname of FILE. If nonempty,
590 # add APPEND to the result, otherwise set result
591 # to NONDIR_REPLACEMENT.
592 # value returned in "$func_dirname_result"
593 # basename: Compute filename of FILE.
594 # value retuned in "$func_basename_result"
595 # Implementation must be kept synchronized with func_dirname
596 # and func_basename. For efficiency, we do not delegate to
597 # those functions but instead duplicate the functionality here.
598 func_dirname_and_basename ()
601 */*) func_dirname_result="${1%/*}${2}" ;;
602 * ) func_dirname_result="${3}" ;;
604 func_basename_result="${1##*/}"
607 # func_stripname prefix suffix name
608 # strip PREFIX and SUFFIX off of NAME.
609 # PREFIX and SUFFIX must not contain globbing or regex special
610 # characters, hashes, percent signs, but SUFFIX may contain a leading
611 # dot (in which case that matches only a dot).
614 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
615 # positional parameters, so assign one to ordinary parameter first.
616 func_stripname_result=${3}
617 func_stripname_result=${func_stripname_result#"${1}"}
618 func_stripname_result=${func_stripname_result%"${2}"}
624 func_opt_split_opt=${1%%=*}
625 func_opt_split_arg=${1#*=}
632 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
633 *) func_lo2o_result=${1} ;;
637 # func_xform libobj-or-source
640 func_xform_result=${1%.*}.lo
643 # func_arith arithmetic-term...
646 func_arith_result=$(( $* ))
650 # STRING may not start with a hyphen.
653 func_len_result=${#1}
657 # func_append var value
658 # Append VALUE to the end of shell variable VAR.
663 # Generated shell functions inserted here.
665 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
666 # is ksh but when the shell is invoked as "sh" and the current value of
667 # the _XPG environment variable is not equal to 1 (one), the special
668 # positional parameter $0, within a function call, is the name of the
672 # The name of this program:
673 # In the unlikely event $progname began with a '-', it would play havoc with
674 # func_echo (imagine progname=-n), so we prepend ./ in that case:
675 func_dirname_and_basename "$progpath"
676 progname=$func_basename_result
678 -*) progname=./$progname ;;
681 # Make sure we have an absolute path for reexecution:
683 [\\/]*|[A-Za-z]:\\*) ;;
685 progdir=$func_dirname_result
686 progdir=`cd "$progdir" && pwd`
687 progpath="$progdir/$progname"
692 for progdir in $PATH; do
694 test -x "$progdir/$progname" && break
697 test -n "$progdir" || progdir=`pwd`
698 progpath="$progdir/$progname"
702 # Sed substitution that helps us do robust quoting. It backslashifies
703 # metacharacters that are still active within double-quoted strings.
704 Xsed="${SED}"' -e 1s/^X//'
705 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
707 # Same as above, but do not quote variable references.
708 double_quote_subst='s/\(["`\\]\)/\\\1/g'
710 # Re-`\' parameter expansions in output of double_quote_subst that were
711 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
712 # in input to double_quote_subst, that '$' was protected from expansion.
713 # Since each input `\' is now two `\'s, look for any number of runs of
714 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
719 sed_double_backslash="\
723 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
734 # Echo program name prefixed message, along with the current mode
735 # name if it has been set yet.
738 $ECHO "$progname${mode+: }$mode: $*"
741 # func_verbose arg...
742 # Echo program name prefixed message in verbose mode only.
745 $opt_verbose && func_echo ${1+"$@"}
747 # A bug in bash halts the script if the last line of a function
748 # fails when set -e is in force, so we need another command to
754 # Echo program name prefixed message to standard error.
757 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
760 # func_warning arg...
761 # Echo program name prefixed warning message to standard error.
764 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
770 # func_fatal_error arg...
771 # Echo program name prefixed message to standard error, and exit.
778 # func_fatal_help arg...
779 # Echo program name prefixed message to standard error, followed by
780 # a help hint, and exit.
784 func_fatal_error "$help"
786 help="Try \`$progname --help' for more information." ## default
789 # func_grep expression filename
790 # Check whether EXPRESSION matches any line of FILENAME, without output.
793 $GREP "$1" "$2" >/dev/null 2>&1
797 # func_mkdir_p directory-path
798 # Make sure the entire path to DIRECTORY-PATH is available.
801 my_directory_path="$1"
804 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
806 # Protect directory names starting with `-'
807 case $my_directory_path in
808 -*) my_directory_path="./$my_directory_path" ;;
811 # While some portion of DIR does not yet exist...
812 while test ! -d "$my_directory_path"; do
813 # ...make a list in topmost first order. Use a colon delimited
814 # list incase some portion of path contains whitespace.
815 my_dir_list="$my_directory_path:$my_dir_list"
817 # If the last portion added has no slash in it, the list is done
818 case $my_directory_path in */*) ;; *) break ;; esac
820 # ...otherwise throw away the child directory and loop
821 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
823 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
825 save_mkdir_p_IFS="$IFS"; IFS=':'
826 for my_dir in $my_dir_list; do
827 IFS="$save_mkdir_p_IFS"
828 # mkdir can fail with a `File exist' error if two processes
829 # try to create one of the directories concurrently. Don't
831 $MKDIR "$my_dir" 2>/dev/null || :
833 IFS="$save_mkdir_p_IFS"
835 # Bail out if we (or some other process) failed to create a directory.
836 test -d "$my_directory_path" || \
837 func_fatal_error "Failed to create \`$1'"
842 # func_mktempdir [string]
843 # Make a temporary directory that won't clash with other running
844 # libtool processes, and avoids race conditions if possible. If
845 # given, STRING is the basename for that directory.
848 my_template="${TMPDIR-/tmp}/${1-$progname}"
850 if test "$opt_dry_run" = ":"; then
851 # Return a directory name, but don't create it in dry-run mode
852 my_tmpdir="${my_template}-$$"
855 # If mktemp works, use that first and foremost
856 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
858 if test ! -d "$my_tmpdir"; then
859 # Failing that, at least try and use $RANDOM to avoid a race
860 my_tmpdir="${my_template}-${RANDOM-0}$$"
862 save_mktempdir_umask=`umask`
865 umask $save_mktempdir_umask
868 # If we're not in dry-run mode, bomb out on failure
869 test -d "$my_tmpdir" || \
870 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
873 $ECHO "X$my_tmpdir" | $Xsed
877 # func_quote_for_eval arg
878 # Aesthetically quote ARG to be evaled later.
879 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
880 # is double-quoted, suitable for a subsequent eval, whereas
881 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
882 # which are still active within double quotes backslashified.
883 func_quote_for_eval ()
887 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
889 func_quote_for_eval_unquoted_result="$1" ;;
892 case $func_quote_for_eval_unquoted_result in
893 # Double-quote args containing shell metacharacters to delay
894 # word splitting, command substitution and and variable
895 # expansion for a subsequent eval.
896 # Many Bourne shells cannot handle close brackets correctly
897 # in scan sets, so we specify it separately.
898 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
899 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
902 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
907 # func_quote_for_expand arg
908 # Aesthetically quote ARG to be evaled later; same as above,
909 # but do not quote variable references.
910 func_quote_for_expand ()
914 my_arg=`$ECHO "X$1" | $Xsed \
915 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
921 # Double-quote args containing shell metacharacters to delay
922 # word splitting and command substitution for a subsequent eval.
923 # Many Bourne shells cannot handle close brackets correctly
924 # in scan sets, so we specify it separately.
925 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
930 func_quote_for_expand_result="$my_arg"
934 # func_show_eval cmd [fail_exp]
935 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
936 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
937 # is given, then evaluate it.
943 ${opt_silent-false} || {
944 func_quote_for_expand "$my_cmd"
945 eval "func_echo $func_quote_for_expand_result"
948 if ${opt_dry_run-false}; then :; else
951 if test "$my_status" -eq 0; then :; else
952 eval "(exit $my_status); $my_fail_exp"
958 # func_show_eval_locale cmd [fail_exp]
959 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
960 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
961 # is given, then evaluate it. Use the saved locale for evaluation.
962 func_show_eval_locale ()
967 ${opt_silent-false} || {
968 func_quote_for_expand "$my_cmd"
969 eval "func_echo $func_quote_for_expand_result"
972 if ${opt_dry_run-false}; then :; else
973 eval "$lt_user_locale
976 eval "$lt_safe_locale"
977 if test "$my_status" -eq 0; then :; else
978 eval "(exit $my_status); $my_fail_exp"
988 # Echo version message to standard output and exit.
991 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
994 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1001 # Echo short help message to standard output and exit.
1004 $SED -n '/^# Usage:/,/# -h/ {
1007 s/\$progname/'$progname'/
1011 $ECHO "run \`$progname --help | more' for full usage"
1016 # Echo long help message to standard output and exit.
1019 $SED -n '/^# Usage:/,/# Report bugs to/ {
1022 s*\$progname*'$progname'*
1024 s*\$SHELL*'"$SHELL"'*
1026 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1028 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1029 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1030 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1036 # func_missing_arg argname
1037 # Echo program name prefixed message to standard error and set global
1041 func_error "missing argument for $1"
1051 # Check that we have a working $ECHO.
1052 if test "X$1" = X--no-reexec; then
1053 # Discard the --no-reexec flag, and continue.
1055 elif test "X$1" = X--fallback-echo; then
1056 # Avoid inline document here, it may be left over
1058 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
1059 # Yippee, $ECHO works!
1062 # Restart under the correct shell, and then maybe $ECHO will work.
1063 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
1066 if test "X$1" = X--fallback-echo; then
1067 # used as fallback echo
1075 magic="%%%MAGIC variable%%%"
1076 magic_exe="%%%MAGIC EXE variable%%%"
1083 lo2o="s/\\.lo\$/.${objext}/"
1084 o2lo="s/\\.${objext}\$/.lo/"
1089 opt_duplicate_deps=false
1093 # If this variable is set in any of the actions, the command in it
1094 # will be execed at the end. This prevents here-documents from being
1095 # left over by shells.
1098 # func_fatal_configuration arg...
1099 # Echo program name prefixed message to standard error, followed by
1100 # a configuration failure hint, and exit.
1101 func_fatal_configuration ()
1103 func_error ${1+"$@"}
1104 func_error "See the $PACKAGE documentation for more information."
1105 func_fatal_error "Fatal configuration error."
1110 # Display the configuration for all the tags in this script.
1113 re_begincf='^# ### BEGIN LIBTOOL'
1114 re_endcf='^# ### END LIBTOOL'
1116 # Default configuration.
1117 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1119 # Now print the configurations for the tags.
1120 for tagname in $taglist; do
1121 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1128 # Display the features supported by this script.
1132 if test "$build_libtool_libs" = yes; then
1133 $ECHO "enable shared libraries"
1135 $ECHO "disable shared libraries"
1137 if test "$build_old_libs" = yes; then
1138 $ECHO "enable static libraries"
1140 $ECHO "disable static libraries"
1146 # func_enable_tag tagname
1147 # Verify that TAGNAME is valid, and either flag an error and exit, or
1148 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1155 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1156 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1157 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1162 func_fatal_error "invalid tag name: $tagname"
1166 # Don't test for the "default" C tag, as we know it's
1167 # there but not specially marked.
1171 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1172 taglist="$taglist $tagname"
1174 # Evaluate the configuration. Be careful to quote the path
1175 # and the sed script, to avoid splitting on whitespace, but
1176 # also don't use non-portable quotes within backquotes within
1177 # quotes we have to do it in 2 steps:
1178 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1181 func_error "ignoring unknown tag $tagname"
1187 # Parse options once, thoroughly. This comes as soon as possible in
1188 # the script to make things like `libtool --version' happen quickly.
1191 # Shorthand for --mode=foo, only valid as the first argument
1194 shift; set dummy --mode clean ${1+"$@"}; shift
1196 compile|compil|compi|comp|com|co|c)
1197 shift; set dummy --mode compile ${1+"$@"}; shift
1199 execute|execut|execu|exec|exe|ex|e)
1200 shift; set dummy --mode execute ${1+"$@"}; shift
1202 finish|finis|fini|fin|fi|f)
1203 shift; set dummy --mode finish ${1+"$@"}; shift
1205 install|instal|insta|inst|ins|in|i)
1206 shift; set dummy --mode install ${1+"$@"}; shift
1209 shift; set dummy --mode link ${1+"$@"}; shift
1211 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1212 shift; set dummy --mode uninstall ${1+"$@"}; shift
1216 # Parse non-mode specific arguments:
1217 while test "$#" -gt 0; do
1222 --config) func_config ;;
1224 --debug) preserve_args="$preserve_args $opt"
1225 func_echo "enabling shell trace mode"
1230 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
1231 execute_dlfiles="$execute_dlfiles $1"
1235 --dry-run | -n) opt_dry_run=: ;;
1236 --features) func_features ;;
1237 --finish) mode="finish" ;;
1239 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
1241 # Valid mode arguments:
1251 # Catch anything else as an error
1252 *) func_error "invalid argument for $opt"
1262 --preserve-dup-deps)
1263 opt_duplicate_deps=: ;;
1265 --quiet|--silent) preserve_args="$preserve_args $opt"
1269 --verbose| -v) preserve_args="$preserve_args $opt"
1273 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
1274 preserve_args="$preserve_args $opt $1"
1275 func_enable_tag "$1" # tagname is set here
1279 # Separate optargs to long options:
1280 -dlopen=*|--mode=*|--tag=*)
1281 func_opt_split "$opt"
1282 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
1286 -\?|-h) func_usage ;;
1287 --help) opt_help=: ;;
1288 --version) func_version ;;
1290 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1300 *cygwin* | *mingw* | *pw32* | *cegcc*)
1301 # don't eliminate duplications in $postdeps and $predeps
1302 opt_duplicate_compiler_generated_deps=:
1305 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
1309 # Having warned about all mis-specified options, bail out if
1310 # anything was wrong.
1311 $exit_cmd $EXIT_FAILURE
1314 # func_check_version_match
1315 # Ensure that we are using m4 macros, and libtool script from the same
1316 # release of libtool.
1317 func_check_version_match ()
1319 if test "$package_revision" != "$macro_revision"; then
1320 if test "$VERSION" != "$macro_version"; then
1321 if test -z "$macro_version"; then
1323 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1324 $progname: definition of this LT_INIT comes from an older release.
1325 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1326 $progname: and run autoconf again.
1330 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1331 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1332 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1333 $progname: and run autoconf again.
1338 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1339 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1340 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1341 $progname: of $PACKAGE $VERSION and run autoconf again.
1355 # Sanity checks first:
1356 func_check_version_match
1358 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1359 func_fatal_configuration "not configured to build any kind of library"
1362 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1366 eval std_shrext=\"$shrext_cmds\"
1369 # Only execute mode is allowed to have -dlopen flags.
1370 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1371 func_error "unrecognized option \`-dlopen'"
1376 # Change the help message to a mode-specific one.
1377 generic_help="$help"
1378 help="Try \`$progname --help --mode=$mode' for more information."
1383 # True iff FILE is a libtool `.la' library or `.lo' object file.
1384 # This function is only a basic sanity check; it will hardly flush out
1385 # determined imposters.
1389 $SED -e 4q "$1" 2>/dev/null \
1390 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1393 # func_lalib_unsafe_p file
1394 # True iff FILE is a libtool `.la' library or `.lo' object file.
1395 # This function implements the same check as func_lalib_p without
1396 # resorting to external programs. To this end, it redirects stdin and
1397 # closes it afterwards, without saving the original file descriptor.
1398 # As a safety measure, use it only where a negative result would be
1399 # fatal anyway. Works if `file' does not exist.
1400 func_lalib_unsafe_p ()
1403 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1404 for lalib_p_l in 1 2 3 4
1407 case "$lalib_p_line" in
1408 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1413 test "$lalib_p" = yes
1416 # func_ltwrapper_script_p file
1417 # True iff FILE is a libtool wrapper script
1418 # This function is only a basic sanity check; it will hardly flush out
1419 # determined imposters.
1420 func_ltwrapper_script_p ()
1425 # func_ltwrapper_executable_p file
1426 # True iff FILE is a libtool wrapper executable
1427 # This function is only a basic sanity check; it will hardly flush out
1428 # determined imposters.
1429 func_ltwrapper_executable_p ()
1431 func_ltwrapper_exec_suffix=
1434 *) func_ltwrapper_exec_suffix=.exe ;;
1436 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1439 # func_ltwrapper_scriptname file
1440 # Assumes file is an ltwrapper_executable
1441 # uses $file to determine the appropriate filename for a
1442 # temporary ltwrapper_script.
1443 func_ltwrapper_scriptname ()
1445 func_ltwrapper_scriptname_result=""
1446 if func_ltwrapper_executable_p "$1"; then
1447 func_dirname_and_basename "$1" "" "."
1448 func_stripname '' '.exe' "$func_basename_result"
1449 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1453 # func_ltwrapper_p file
1454 # True iff FILE is a libtool wrapper script or wrapper executable
1455 # This function is only a basic sanity check; it will hardly flush out
1456 # determined imposters.
1459 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1463 # func_execute_cmds commands fail_cmd
1464 # Execute tilde-delimited COMMANDS.
1465 # If FAIL_CMD is given, eval that upon failure.
1466 # FAIL_CMD may read-access the current command in variable CMD!
1467 func_execute_cmds ()
1470 save_ifs=$IFS; IFS='~'
1474 func_show_eval "$cmd" "${2-:}"
1481 # Source FILE, adding directory component if necessary.
1482 # Note that it is not necessary on cygwin/mingw to append a dot to
1483 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1484 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1485 # `FILE.' does not work on cygwin managed mounts.
1490 */* | *\\*) . "$1" ;;
1496 # func_infer_tag arg
1497 # Infer tagged configuration to use if any are available and
1498 # if one wasn't chosen via the "--tag" command line option.
1499 # Only attempt this if the compiler in the base compile
1500 # command doesn't match the default compiler.
1501 # arg is usually of the form 'gcc ...'
1505 if test -n "$available_tags" && test -z "$tagname"; then
1508 func_quote_for_eval "$arg"
1509 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1512 # Blanks in the command may have been stripped by the calling shell,
1513 # but not from the CC environment variable when configure was run.
1514 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1515 # Blanks at the start of $base_compile will cause this to fail
1516 # if we don't check for them as well.
1518 for z in $available_tags; do
1519 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1520 # Evaluate the configuration.
1521 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1524 # Double-quote args containing other shell metacharacters.
1525 func_quote_for_eval "$arg"
1526 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1529 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1530 # The compiler in the base compile command matches
1531 # the one in the tagged configuration.
1532 # Assume this is the tagged configuration we want.
1539 # If $tagname still isn't set, then no tagged configuration
1540 # was found and let the user know that the "--tag" command
1541 # line option must be used.
1542 if test -z "$tagname"; then
1543 func_echo "unable to infer tagged configuration"
1544 func_fatal_error "specify a tag with \`--tag'"
1546 # func_verbose "using $tagname tagged configuration"
1555 # func_write_libtool_object output_name pic_name nonpic_name
1556 # Create a libtool object file (analogous to a ".la" file),
1557 # but don't create it if we're doing a dry run.
1558 func_write_libtool_object ()
1561 if test "$build_libtool_libs" = yes; then
1567 if test "$build_old_libs" = yes; then
1568 write_oldobj=\'${3}\'
1574 cat >${write_libobj}T <<EOF
1575 # $write_libobj - a libtool object file
1576 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1578 # Please DO NOT delete this file!
1579 # It is necessary for linking the library.
1581 # Name of the PIC object.
1582 pic_object=$write_lobj
1584 # Name of the non-PIC object
1585 non_pic_object=$write_oldobj
1588 $MV "${write_libobj}T" "${write_libobj}"
1592 # func_mode_compile arg...
1593 func_mode_compile ()
1596 # Get the compilation command and the source file.
1598 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1610 # do not "continue". Instead, add this to base_compile
1622 # Accept any command-line options.
1625 test -n "$libobj" && \
1626 func_fatal_error "you cannot specify \`-o' more than once"
1631 -pie | -fpie | -fPIE)
1632 pie_flag="$pie_flag $arg"
1636 -shared | -static | -prefer-pic | -prefer-non-pic)
1647 arg_mode=arg # the next one goes into the "base_compile" arg list
1648 continue # The current "srcfile" will either be retained or
1649 ;; # replaced later. I would guess that would be a bug.
1652 func_stripname '-Wc,' '' "$arg"
1653 args=$func_stripname_result
1655 save_ifs="$IFS"; IFS=','
1656 for arg in $args; do
1658 func_quote_for_eval "$arg"
1659 lastarg="$lastarg $func_quote_for_eval_result"
1662 func_stripname ' ' '' "$lastarg"
1663 lastarg=$func_stripname_result
1665 # Add the arguments to base_compile.
1666 base_compile="$base_compile $lastarg"
1671 # Accept the current argument as the source file.
1672 # The previous "srcfile" becomes the current argument.
1679 esac # case $arg_mode
1681 # Aesthetically quote the previous argument.
1682 func_quote_for_eval "$lastarg"
1683 base_compile="$base_compile $func_quote_for_eval_result"
1688 func_fatal_error "you must specify an argument for -Xcompile"
1691 func_fatal_error "you must specify a target with \`-o'"
1694 # Get the name of the library object.
1695 test -z "$libobj" && {
1696 func_basename "$srcfile"
1697 libobj="$func_basename_result"
1702 # Recognize several different file suffixes.
1703 # If the user specifies -o file.o, it is replaced with file.lo
1706 *.ada | *.adb | *.ads | *.asm | \
1707 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1708 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1709 func_xform "$libobj"
1710 libobj=$func_xform_result
1715 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1717 func_fatal_error "cannot determine name of library object from \`$libobj'"
1721 func_infer_tag $base_compile
1723 for arg in $later; do
1726 test "$build_libtool_libs" != yes && \
1727 func_fatal_configuration "can not build a shared library"
1733 build_libtool_libs=no
1750 func_quote_for_eval "$libobj"
1751 test "X$libobj" != "X$func_quote_for_eval_result" \
1752 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1753 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1754 func_dirname_and_basename "$obj" "/" ""
1755 objname="$func_basename_result"
1756 xdir="$func_dirname_result"
1757 lobj=${xdir}$objdir/$objname
1759 test -z "$base_compile" && \
1760 func_fatal_help "you must specify a compilation command"
1762 # Delete any leftover library objects.
1763 if test "$build_old_libs" = yes; then
1764 removelist="$obj $lobj $libobj ${libobj}T"
1766 removelist="$lobj $libobj ${libobj}T"
1769 # On Cygwin there's no "real" PIC flag so we must build both object types
1771 cygwin* | mingw* | pw32* | os2* | cegcc*)
1775 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1776 # non-PIC code in shared libraries is not supported
1780 # Calculate the filename of the output object if compiler does
1781 # not support -o with -c
1782 if test "$compiler_c_o" = no; then
1783 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1784 lockfile="$output_obj.lock"
1791 # Lock this critical section if it is needed
1792 # We use this script file to make the link, it avoids creating a new file
1793 if test "$need_locks" = yes; then
1794 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1795 func_echo "Waiting for $lockfile to be removed"
1798 elif test "$need_locks" = warn; then
1799 if test -f "$lockfile"; then
1801 *** ERROR, $lockfile exists and contains:
1802 `cat $lockfile 2>/dev/null`
1804 This indicates that another process is trying to use the same
1805 temporary object file, and libtool could not work around it because
1806 your compiler does not support \`-c' and \`-o' together. If you
1807 repeat this compilation, it may succeed, by chance, but you had better
1808 avoid parallel builds (make -j) in this platform, or get a better
1811 $opt_dry_run || $RM $removelist
1814 removelist="$removelist $output_obj"
1815 $ECHO "$srcfile" > "$lockfile"
1818 $opt_dry_run || $RM $removelist
1819 removelist="$removelist $lockfile"
1820 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1822 if test -n "$fix_srcfile_path"; then
1823 eval srcfile=\"$fix_srcfile_path\"
1825 func_quote_for_eval "$srcfile"
1826 qsrcfile=$func_quote_for_eval_result
1828 # Only build a PIC object if we are building libtool libraries.
1829 if test "$build_libtool_libs" = yes; then
1830 # Without this assignment, base_compile gets emptied.
1831 fbsd_hideous_sh_bug=$base_compile
1833 if test "$pic_mode" != no; then
1834 command="$base_compile $qsrcfile $pic_flag"
1836 # Don't build PIC code
1837 command="$base_compile $qsrcfile"
1840 func_mkdir_p "$xdir$objdir"
1842 if test -z "$output_obj"; then
1843 # Place PIC objects in $objdir
1844 command="$command -o $lobj"
1847 func_show_eval_locale "$command" \
1848 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1850 if test "$need_locks" = warn &&
1851 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1853 *** ERROR, $lockfile contains:
1854 `cat $lockfile 2>/dev/null`
1856 but it should contain:
1859 This indicates that another process is trying to use the same
1860 temporary object file, and libtool could not work around it because
1861 your compiler does not support \`-c' and \`-o' together. If you
1862 repeat this compilation, it may succeed, by chance, but you had better
1863 avoid parallel builds (make -j) in this platform, or get a better
1866 $opt_dry_run || $RM $removelist
1870 # Just move the object if needed, then go on to compile the next one
1871 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1872 func_show_eval '$MV "$output_obj" "$lobj"' \
1873 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1876 # Allow error messages only from the first compilation.
1877 if test "$suppress_opt" = yes; then
1878 suppress_output=' >/dev/null 2>&1'
1882 # Only build a position-dependent object if we build old libraries.
1883 if test "$build_old_libs" = yes; then
1884 if test "$pic_mode" != yes; then
1885 # Don't build PIC code
1886 command="$base_compile $qsrcfile$pie_flag"
1888 command="$base_compile $qsrcfile $pic_flag"
1890 if test "$compiler_c_o" = yes; then
1891 command="$command -o $obj"
1894 # Suppress compiler output if we already did a PIC compilation.
1895 command="$command$suppress_output"
1896 func_show_eval_locale "$command" \
1897 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1899 if test "$need_locks" = warn &&
1900 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1902 *** ERROR, $lockfile contains:
1903 `cat $lockfile 2>/dev/null`
1905 but it should contain:
1908 This indicates that another process is trying to use the same
1909 temporary object file, and libtool could not work around it because
1910 your compiler does not support \`-c' and \`-o' together. If you
1911 repeat this compilation, it may succeed, by chance, but you had better
1912 avoid parallel builds (make -j) in this platform, or get a better
1915 $opt_dry_run || $RM $removelist
1919 # Just move the object if needed
1920 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1921 func_show_eval '$MV "$output_obj" "$obj"' \
1922 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1927 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1929 # Unlock the critical section if it was locked
1930 if test "$need_locks" != no; then
1931 removelist=$lockfile
1940 test "$mode" = compile && func_mode_compile ${1+"$@"}
1945 # We need to display help for each of the modes.
1948 # Generic help is extracted from the usage comments
1949 # at the start of this file.
1955 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1957 Remove files from the build directory.
1959 RM is the name of the program to use to delete files associated with each FILE
1960 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1963 If FILE is a libtool library, object or program, all the files associated
1964 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1969 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1971 Compile a source file into a libtool library object.
1973 This mode accepts the following additional options:
1975 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1976 -no-suppress do not suppress compiler output for multiple passes
1977 -prefer-pic try to building PIC objects only
1978 -prefer-non-pic try to building non-PIC objects only
1979 -shared do not build a \`.o' file suitable for static linking
1980 -static only build a \`.o' file suitable for static linking
1982 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1983 from the given SOURCEFILE.
1985 The output file name is determined by removing the directory component from
1986 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1987 library object suffix, \`.lo'."
1992 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1994 Automatically set library path, then run a program.
1996 This mode accepts the following additional options:
1998 -dlopen FILE add the directory containing FILE to the library path
2000 This mode sets the library path environment variable according to \`-dlopen'
2003 If any of the ARGS are libtool executable wrappers, then they are translated
2004 into their corresponding uninstalled binary, and any of their required library
2005 directories are added to the library path.
2007 Then, COMMAND is executed, with ARGS as arguments."
2012 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2014 Complete the installation of libtool libraries.
2016 Each LIBDIR is a directory that contains libtool libraries.
2018 The commands that this mode executes may require superuser privileges. Use
2019 the \`--dry-run' option if you just want to see what would be executed."
2024 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2026 Install executables or libraries.
2028 INSTALL-COMMAND is the installation command. The first component should be
2029 either the \`install' or \`cp' program.
2031 The following components of INSTALL-COMMAND are treated specially:
2033 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2035 The rest of the components are interpreted as arguments to that command (only
2036 BSD-compatible install options are recognized)."
2041 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2043 Link object files or libraries together to form another library, or to
2044 create an executable program.
2046 LINK-COMMAND is a command using the C compiler that you would use to create
2047 a program from several object files.
2049 The following components of LINK-COMMAND are treated specially:
2051 -all-static do not do any dynamic linking at all
2052 -avoid-version do not add a version suffix if possible
2053 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2054 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2055 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2056 -export-symbols SYMFILE
2057 try to export only the symbols listed in SYMFILE
2058 -export-symbols-regex REGEX
2059 try to export only the symbols matching REGEX
2060 -LLIBDIR search LIBDIR for required installed libraries
2061 -lNAME OUTPUT-FILE requires the installed library libNAME
2062 -module build a library that can dlopened
2063 -no-fast-install disable the fast-install mode
2064 -no-install link a not-installable executable
2065 -no-undefined declare that a library does not refer to external symbols
2066 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2067 -objectlist FILE Use a list of object files found in FILE to specify objects
2068 -precious-files-regex REGEX
2069 don't remove output files matching REGEX
2070 -release RELEASE specify package release information
2071 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2072 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2073 -shared only do dynamic linking of libtool libraries
2074 -shrext SUFFIX override the standard shared library file extension
2075 -static do not do any dynamic linking of uninstalled libtool libraries
2076 -static-libtool-libs
2077 do not do any dynamic linking of libtool libraries
2078 -version-info CURRENT[:REVISION[:AGE]]
2079 specify library version info [each variable defaults to 0]
2080 -weak LIBNAME declare that the target provides the LIBNAME interface
2082 All other options (arguments beginning with \`-') are ignored.
2084 Every other argument is treated as a filename. Files ending in \`.la' are
2085 treated as uninstalled libtool libraries, other files are standard or library
2088 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2089 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2090 required, except when creating a convenience library.
2092 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2093 using \`ar' and \`ranlib', or on Windows using \`lib'.
2095 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2096 is created, otherwise an executable program is created."
2101 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2103 Remove libraries from an installation directory.
2105 RM is the name of the program to use to delete files associated with each FILE
2106 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2109 If FILE is a libtool library, all the files associated with it are deleted.
2110 Otherwise, only FILE itself is deleted using RM."
2114 func_fatal_help "invalid operation mode \`$mode'"
2119 $ECHO "Try \`$progname --help' for more information about other modes."
2124 # Now that we've collected a possible --mode arg, show help if necessary
2125 $opt_help && func_mode_help
2128 # func_mode_execute arg...
2129 func_mode_execute ()
2132 # The first argument is the command name.
2135 func_fatal_help "you must specify a COMMAND"
2137 # Handle -dlopen flags immediately.
2138 for file in $execute_dlfiles; do
2140 || func_fatal_help "\`$file' is not a file"
2145 # Check to see that this really is a libtool archive.
2146 func_lalib_unsafe_p "$file" \
2147 || func_fatal_help "\`$lib' is not a valid libtool archive"
2149 # Read the libtool library.
2154 # Skip this library if it cannot be dlopened.
2155 if test -z "$dlname"; then
2156 # Warn if it was a shared library.
2157 test -n "$library_names" && \
2158 func_warning "\`$file' was not linked with \`-export-dynamic'"
2162 func_dirname "$file" "" "."
2163 dir="$func_dirname_result"
2165 if test -f "$dir/$objdir/$dlname"; then
2168 if test ! -f "$dir/$dlname"; then
2169 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2175 # Just add the directory containing the .lo file.
2176 func_dirname "$file" "" "."
2177 dir="$func_dirname_result"
2181 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2186 # Get the absolute pathname.
2187 absdir=`cd "$dir" && pwd`
2188 test -n "$absdir" && dir="$absdir"
2190 # Now add the directory to shlibpath_var.
2191 if eval "test -z \"\$$shlibpath_var\""; then
2192 eval "$shlibpath_var=\"\$dir\""
2194 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2198 # This variable tells wrapper scripts just to set shlibpath_var
2199 # rather than running their programs.
2200 libtool_execute_magic="$magic"
2202 # Check if any of the arguments is a wrapper script.
2209 # Do a test to see if this is really a libtool program.
2210 if func_ltwrapper_script_p "$file"; then
2212 # Transform arg to wrapped name.
2213 file="$progdir/$program"
2214 elif func_ltwrapper_executable_p "$file"; then
2215 func_ltwrapper_scriptname "$file"
2216 func_source "$func_ltwrapper_scriptname_result"
2217 # Transform arg to wrapped name.
2218 file="$progdir/$program"
2222 # Quote arguments (to preserve shell metacharacters).
2223 func_quote_for_eval "$file"
2224 args="$args $func_quote_for_eval_result"
2227 if test "X$opt_dry_run" = Xfalse; then
2228 if test -n "$shlibpath_var"; then
2229 # Export the shlibpath_var.
2230 eval "export $shlibpath_var"
2233 # Restore saved environment variables
2234 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2236 eval "if test \"\${save_$lt_var+set}\" = set; then
2237 $lt_var=\$save_$lt_var; export $lt_var
2243 # Now prepare to actually exec the command.
2244 exec_cmd="\$cmd$args"
2246 # Display what would be done.
2247 if test -n "$shlibpath_var"; then
2248 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2249 $ECHO "export $shlibpath_var"
2256 test "$mode" = execute && func_mode_execute ${1+"$@"}
2259 # func_mode_finish arg...
2266 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2269 libdirs="$libdirs $dir"
2272 for libdir in $libdirs; do
2273 if test -n "$finish_cmds"; then
2274 # Do each command in the finish commands.
2275 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2278 if test -n "$finish_eval"; then
2279 # Do the single finish_eval.
2280 eval cmds=\"$finish_eval\"
2281 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2287 # Exit here if they wanted silent mode.
2288 $opt_silent && exit $EXIT_SUCCESS
2290 $ECHO "X----------------------------------------------------------------------" | $Xsed
2291 $ECHO "Libraries have been installed in:"
2292 for libdir in $libdirs; do
2296 $ECHO "If you ever happen to want to link against installed libraries"
2297 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2298 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2299 $ECHO "flag during linking and do at least one of the following:"
2300 if test -n "$shlibpath_var"; then
2301 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2302 $ECHO " during execution"
2304 if test -n "$runpath_var"; then
2305 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2306 $ECHO " during linking"
2308 if test -n "$hardcode_libdir_flag_spec"; then
2310 eval flag=\"$hardcode_libdir_flag_spec\"
2312 $ECHO " - use the \`$flag' linker flag"
2314 if test -n "$admincmds"; then
2315 $ECHO " - have your system administrator run these commands:$admincmds"
2317 if test -f /etc/ld.so.conf; then
2318 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2322 $ECHO "See any operating system documentation about shared libraries for"
2324 solaris2.[6789]|solaris2.1[0-9])
2325 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2329 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2332 $ECHO "X----------------------------------------------------------------------" | $Xsed
2336 test "$mode" = finish && func_mode_finish ${1+"$@"}
2339 # func_mode_install arg...
2340 func_mode_install ()
2343 # There may be an optional sh(1) argument at the beginning of
2344 # install_prog (especially on Windows NT).
2345 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2346 # Allow the use of GNU shtool's install command.
2347 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2348 # Aesthetically quote it.
2349 func_quote_for_eval "$nonopt"
2350 install_prog="$func_quote_for_eval_result "
2358 # The real first argument should be the name of the installation program.
2359 # Aesthetically quote it.
2360 func_quote_for_eval "$arg"
2361 install_prog="$install_prog$func_quote_for_eval_result"
2363 # We need to accept at least all the BSD install flags.
2373 if test -n "$dest"; then
2374 files="$files $dest"
2382 case " $install_prog " in
2397 # If the previous option needed an argument, then skip it.
2398 if test -n "$prev"; then
2407 # Aesthetically quote the argument.
2408 func_quote_for_eval "$arg"
2409 install_prog="$install_prog $func_quote_for_eval_result"
2412 test -z "$install_prog" && \
2413 func_fatal_help "you must specify an install program"
2415 test -n "$prev" && \
2416 func_fatal_help "the \`$prev' option requires an argument"
2418 if test -z "$files"; then
2419 if test -z "$dest"; then
2420 func_fatal_help "no file or destination specified"
2422 func_fatal_help "you must specify a destination"
2426 # Strip any trailing slash from the destination.
2427 func_stripname '' '/' "$dest"
2428 dest=$func_stripname_result
2430 # Check to see that the destination is a directory.
2431 test -d "$dest" && isdir=yes
2432 if test "$isdir" = yes; then
2436 func_dirname_and_basename "$dest" "" "."
2437 destdir="$func_dirname_result"
2438 destname="$func_basename_result"
2440 # Not a directory, so check to see that there is only one file specified.
2441 set dummy $files; shift
2442 test "$#" -gt 1 && \
2443 func_fatal_help "\`$dest' is not a directory"
2446 [\\/]* | [A-Za-z]:[\\/]*) ;;
2448 for file in $files; do
2452 func_fatal_help "\`$destdir' must be an absolute directory name"
2459 # This variable tells wrapper scripts just to set variables rather
2460 # than running their programs.
2461 libtool_install_magic="$magic"
2466 for file in $files; do
2468 # Do each installation.
2471 # Do the static libraries later.
2472 staticlibs="$staticlibs $file"
2476 # Check to see that this really is a libtool archive.
2477 func_lalib_unsafe_p "$file" \
2478 || func_fatal_help "\`$file' is not a valid libtool archive"
2485 # Add the libdir to current_libdirs if it is the destination.
2486 if test "X$destdir" = "X$libdir"; then
2487 case "$current_libdirs " in
2489 *) current_libdirs="$current_libdirs $libdir" ;;
2492 # Note the libdir as a future libdir.
2493 case "$future_libdirs " in
2495 *) future_libdirs="$future_libdirs $libdir" ;;
2499 func_dirname "$file" "/" ""
2500 dir="$func_dirname_result"
2503 if test -n "$relink_command"; then
2504 # Determine the prefix the user has applied to our future dir.
2505 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2507 # Don't allow the user to place us outside of our expected
2508 # location b/c this prevents finding dependent libraries that
2509 # are installed to the same prefix.
2510 # At present, this check doesn't affect windows .dll's that
2511 # are installed into $libdir/../bin (currently, that works fine)
2512 # but it's something to keep an eye on.
2513 test "$inst_prefix_dir" = "$destdir" && \
2514 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2516 if test -n "$inst_prefix_dir"; then
2517 # Stick the inst_prefix_dir data into the link command.
2518 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2520 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2523 func_warning "relinking \`$file'"
2524 func_show_eval "$relink_command" \
2525 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2528 # See the names of the shared library.
2529 set dummy $library_names; shift
2530 if test -n "$1"; then
2535 test -n "$relink_command" && srcname="$realname"T
2537 # Install the shared library and build the symlinks.
2538 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2542 cygwin* | mingw* | pw32* | cegcc*)
2550 if test -n "$tstripme" && test -n "$striplib"; then
2551 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2554 if test "$#" -gt 0; then
2555 # Delete the old symlinks, and create new ones.
2556 # Try `ln -sf' first, because the `ln' binary might depend on
2557 # the symlink we replace! Solaris /bin/ln does not understand -f,
2558 # so we also need to try rm && ln -s.
2561 test "$linkname" != "$realname" \
2562 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2566 # Do each command in the postinstall commands.
2567 lib="$destdir/$realname"
2568 func_execute_cmds "$postinstall_cmds" 'exit $?'
2571 # Install the pseudo-library for information purposes.
2572 func_basename "$file"
2573 name="$func_basename_result"
2574 instname="$dir/$name"i
2575 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2577 # Maybe install the static library, too.
2578 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2582 # Install (i.e. copy) a libtool object.
2584 # Figure out destination file name, if it wasn't already specified.
2585 if test -n "$destname"; then
2586 destfile="$destdir/$destname"
2588 func_basename "$file"
2589 destfile="$func_basename_result"
2590 destfile="$destdir/$destfile"
2593 # Deduce the name of the destination old-style object file.
2596 func_lo2o "$destfile"
2597 staticdest=$func_lo2o_result
2600 staticdest="$destfile"
2604 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2608 # Install the libtool object if requested.
2609 test -n "$destfile" && \
2610 func_show_eval "$install_prog $file $destfile" 'exit $?'
2612 # Install the old object if enabled.
2613 if test "$build_old_libs" = yes; then
2614 # Deduce the name of the old-style object file.
2616 staticobj=$func_lo2o_result
2617 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2623 # Figure out destination file name, if it wasn't already specified.
2624 if test -n "$destname"; then
2625 destfile="$destdir/$destname"
2627 func_basename "$file"
2628 destfile="$func_basename_result"
2629 destfile="$destdir/$destfile"
2632 # If the file is missing, and there is a .exe on the end, strip it
2633 # because it is most likely a libtool script we actually want to
2638 if test ! -f "$file"; then
2639 func_stripname '' '.exe' "$file"
2640 file=$func_stripname_result
2646 # Do a test to see if this is really a libtool program.
2649 if func_ltwrapper_executable_p "$file"; then
2650 func_ltwrapper_scriptname "$file"
2651 wrapper=$func_ltwrapper_scriptname_result
2653 func_stripname '' '.exe' "$file"
2654 wrapper=$func_stripname_result
2661 if func_ltwrapper_script_p "$wrapper"; then
2665 func_source "$wrapper"
2667 # Check the variables that should have been set.
2668 test -z "$generated_by_libtool_version" && \
2669 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2672 for lib in $notinst_deplibs; do
2673 # Check to see that each library is installed.
2675 if test -f "$lib"; then
2678 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2679 if test -n "$libdir" && test ! -f "$libfile"; then
2680 func_warning "\`$lib' has not been installed in \`$libdir'"
2686 func_source "$wrapper"
2689 if test "$fast_install" = no && test -n "$relink_command"; then
2691 if test "$finalize" = yes; then
2692 tmpdir=`func_mktempdir`
2693 func_basename "$file$stripped_ext"
2694 file="$func_basename_result"
2695 outputname="$tmpdir/$file"
2696 # Replace the output file specification.
2697 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2700 func_quote_for_expand "$relink_command"
2701 eval "func_echo $func_quote_for_expand_result"
2703 if eval "$relink_command"; then :
2705 func_error "error: relink \`$file' with the above command before installing it"
2706 $opt_dry_run || ${RM}r "$tmpdir"
2711 func_warning "cannot relink \`$file'"
2715 # Install the binary that we compiled earlier.
2716 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2720 # remove .exe since cygwin /usr/bin/install will append another
2722 case $install_prog,$host in
2723 */usr/bin/install*,*cygwin*)
2724 case $file:$destfile in
2729 destfile=$destfile.exe
2732 func_stripname '' '.exe' "$destfile"
2733 destfile=$func_stripname_result
2738 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2739 $opt_dry_run || if test -n "$outputname"; then
2746 for file in $staticlibs; do
2747 func_basename "$file"
2748 name="$func_basename_result"
2750 # Set up the ranlib parameters.
2751 oldlib="$destdir/$name"
2753 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2755 if test -n "$stripme" && test -n "$old_striplib"; then
2756 func_show_eval "$old_striplib $oldlib" 'exit $?'
2759 # Do each command in the postinstall commands.
2760 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2763 test -n "$future_libdirs" && \
2764 func_warning "remember to run \`$progname --finish$future_libdirs'"
2766 if test -n "$current_libdirs"; then
2767 # Maybe just do a dry run.
2768 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2769 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2775 test "$mode" = install && func_mode_install ${1+"$@"}
2778 # func_generate_dlsyms outputname originator pic_p
2779 # Extract symbols from dlprefiles and create ${outputname}S.o with
2780 # a dlpreopen symbol table.
2781 func_generate_dlsyms ()
2787 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2790 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2791 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2792 my_dlsyms="${my_outputname}S.c"
2794 func_error "not configured to extract global symbols from dlpreopened files"
2798 if test -n "$my_dlsyms"; then
2802 # Discover the nlist of each of the dlfiles.
2803 nlist="$output_objdir/${my_outputname}.nm"
2805 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2807 # Parse the name list into a source file.
2808 func_verbose "creating $output_objdir/$my_dlsyms"
2810 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2811 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2812 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2818 /* External symbol declarations for the compiler. */\
2821 if test "$dlself" = yes; then
2822 func_verbose "generating symbol list for \`$output'"
2824 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2826 # Add our own program objects to the symbol list.
2827 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2828 for progfile in $progfiles; do
2829 func_verbose "extracting global C symbols from \`$progfile'"
2830 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2833 if test -n "$exclude_expsyms"; then
2835 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2836 eval '$MV "$nlist"T "$nlist"'
2840 if test -n "$export_symbols_regex"; then
2842 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2843 eval '$MV "$nlist"T "$nlist"'
2847 # Prepare the list of exported symbols
2848 if test -z "$export_symbols"; then
2849 export_symbols="$output_objdir/$outputname.exp"
2852 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2854 *cygwin* | *mingw* | *cegcc* )
2855 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2856 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2862 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2863 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2864 eval '$MV "$nlist"T "$nlist"'
2866 *cygwin | *mingw* | *cegcc* )
2867 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2868 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2875 for dlprefile in $dlprefiles; do
2876 func_verbose "extracting global C symbols from \`$dlprefile'"
2877 func_basename "$dlprefile"
2878 name="$func_basename_result"
2880 eval '$ECHO ": $name " >> "$nlist"'
2881 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2886 # Make sure we have at least an empty file.
2887 test -f "$nlist" || : > "$nlist"
2889 if test -n "$exclude_expsyms"; then
2890 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2891 $MV "$nlist"T "$nlist"
2894 # Try sorting and uniquifying the output.
2895 if $GREP -v "^: " < "$nlist" |
2896 if sort -k 3 </dev/null >/dev/null 2>&1; then
2901 uniq > "$nlist"S; then
2904 $GREP -v "^: " < "$nlist" > "$nlist"S
2907 if test -f "$nlist"S; then
2908 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2910 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2913 $ECHO >> "$output_objdir/$my_dlsyms" "\
2915 /* The mapping between symbol names and symbols. */
2922 *cygwin* | *mingw* | *cegcc* )
2923 $ECHO >> "$output_objdir/$my_dlsyms" "\
2924 /* DATA imports from DLLs on WIN32 con't be const, because
2925 runtime relocations are performed -- see ld's documentation
2926 on pseudo-relocs. */"
2929 echo >> "$output_objdir/$my_dlsyms" "\
2930 /* This system does not cope well with relocations in const data */"
2933 lt_dlsym_const=const ;;
2936 $ECHO >> "$output_objdir/$my_dlsyms" "\
2937 extern $lt_dlsym_const lt_dlsymlist
2938 lt_${my_prefix}_LTX_preloaded_symbols[];
2939 $lt_dlsym_const lt_dlsymlist
2940 lt_${my_prefix}_LTX_preloaded_symbols[] =
2942 { \"$my_originator\", (void *) 0 },"
2944 case $need_lib_prefix in
2946 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2949 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2952 $ECHO >> "$output_objdir/$my_dlsyms" "\
2956 /* This works around a problem in FreeBSD linker */
2957 #ifdef FREEBSD_WORKAROUND
2958 static const void *lt_preloaded_setup() {
2959 return lt_${my_prefix}_LTX_preloaded_symbols;
2969 pic_flag_for_symtable=
2970 case "$compile_command " in
2974 # compiling the symbol table file with pic_flag works around
2975 # a FreeBSD bug that causes programs to crash when -lm is
2976 # linked before any other PIC object. But we must not use
2977 # pic_flag when linking with -static. The problem exists in
2978 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2979 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2980 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2982 pic_flag_for_symtable=" $pic_flag" ;;
2984 if test "X$my_pic_p" != Xno; then
2985 pic_flag_for_symtable=" $pic_flag"
2992 for arg in $LTCFLAGS; do
2994 -pie | -fpie | -fPIE) ;;
2995 *) symtab_cflags="$symtab_cflags $arg" ;;
2999 # Now compile the dynamic symbol file.
3000 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3002 # Clean up the generated files.
3003 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3005 # Transform the symbol file into the correct name.
3006 symfileobj="$output_objdir/${my_outputname}S.$objext"
3008 *cygwin* | *mingw* | *cegcc* )
3009 if test -f "$output_objdir/$my_outputname.def"; then
3010 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3011 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3013 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3014 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3018 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3019 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3024 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3028 # We keep going just in case the user didn't refer to
3029 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3030 # really was required.
3032 # Nullify the symbol file.
3033 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3034 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3038 # func_win32_libid arg
3039 # return the library type of file 'arg'
3041 # Need a lot of goo to handle *both* DLLs and import libs
3042 # Has to be a shell function in order to 'eat' the argument
3043 # that is supplied when $file_magic_command is called.
3047 win32_libid_type="unknown"
3048 win32_fileres=`file -L $1 2>/dev/null`
3049 case $win32_fileres in
3050 *ar\ archive\ import\ library*) # definitely import
3051 win32_libid_type="x86 archive import"
3053 *ar\ archive*) # could be an import, or static
3054 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3055 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
3056 win32_nmres=`eval $NM -f posix -A $1 |
3065 case $win32_nmres in
3066 import*) win32_libid_type="x86 archive import";;
3067 *) win32_libid_type="x86 archive static";;
3072 win32_libid_type="x86 DLL"
3074 *executable*) # but shell scripts are "executable" too...
3075 case $win32_fileres in
3076 *MS\ Windows\ PE\ Intel*)
3077 win32_libid_type="x86 DLL"
3082 $ECHO "$win32_libid_type"
3087 # func_extract_an_archive dir oldlib
3088 func_extract_an_archive ()
3091 f_ex_an_ar_dir="$1"; shift
3092 f_ex_an_ar_oldlib="$1"
3093 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
3094 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3097 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3102 # func_extract_archives gentop oldlib ...
3103 func_extract_archives ()
3106 my_gentop="$1"; shift
3107 my_oldlibs=${1+"$@"}
3113 for my_xlib in $my_oldlibs; do
3114 # Extract the objects.
3116 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3117 *) my_xabs=`pwd`"/$my_xlib" ;;
3119 func_basename "$my_xlib"
3120 my_xlib="$func_basename_result"
3123 case " $extracted_archives " in
3125 func_arith $extracted_serial + 1
3126 extracted_serial=$func_arith_result
3127 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3131 extracted_archives="$extracted_archives $my_xlib_u"
3132 my_xdir="$my_gentop/$my_xlib_u"
3134 func_mkdir_p "$my_xdir"
3138 func_verbose "Extracting $my_xabs"
3139 # Do not bother doing anything if just a dry run
3141 darwin_orig_dir=`pwd`
3142 cd $my_xdir || exit $?
3143 darwin_archive=$my_xabs
3145 darwin_base_archive=`basename "$darwin_archive"`
3146 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3147 if test -n "$darwin_arches"; then
3148 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3150 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3151 for darwin_arch in $darwin_arches ; do
3152 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3153 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3154 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3155 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3157 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3158 done # $darwin_arches
3159 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3160 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3163 for darwin_file in $darwin_filelist; do
3164 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
3165 $LIPO -create -output "$darwin_file" $darwin_files
3166 done # $darwin_filelist
3168 cd "$darwin_orig_dir"
3171 func_extract_an_archive "$my_xdir" "$my_xabs"
3176 func_extract_an_archive "$my_xdir" "$my_xabs"
3179 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3182 func_extract_archives_result="$my_oldobjs"
3187 # func_emit_wrapper_part1 [arg=no]
3189 # Emit the first part of a libtool wrapper script on stdout.
3190 # For more information, see the description associated with
3191 # func_emit_wrapper(), below.
3192 func_emit_wrapper_part1 ()
3194 func_emit_wrapper_part1_arg1=no
3195 if test -n "$1" ; then
3196 func_emit_wrapper_part1_arg1=$1
3202 # $output - temporary wrapper script for $objdir/$outputname
3203 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3205 # The $output program cannot be directly executed until all the libtool
3206 # libraries that it depends on are installed.
3208 # This wrapper script should never be moved out of the build directory.
3209 # If it is, it will not operate correctly.
3211 # Sed substitution that helps us do robust quoting. It backslashifies
3212 # metacharacters that are still active within double-quoted strings.
3213 Xsed='${SED} -e 1s/^X//'
3214 sed_quote_subst='$sed_quote_subst'
3216 # Be Bourne compatible
3217 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3220 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3221 # is contrary to our usage. Disable this feature.
3222 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3223 setopt NO_GLOB_SUBST
3225 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3227 BIN_SH=xpg4; export BIN_SH # for Tru64
3228 DUALCASE=1; export DUALCASE # for MKS sh
3230 # The HP-UX ksh and POSIX shell print the target directory to stdout
3232 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3234 relink_command=\"$relink_command\"
3236 # This environment variable determines our operation mode.
3237 if test \"\$libtool_install_magic\" = \"$magic\"; then
3238 # install mode needs the following variables:
3239 generated_by_libtool_version='$macro_version'
3240 notinst_deplibs='$notinst_deplibs'
3242 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3243 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3246 # Make sure echo works.
3247 if test \"X\$1\" = X--no-reexec; then
3248 # Discard the --no-reexec flag, and continue.
3250 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
3251 # Yippee, \$ECHO works!
3254 # Restart under the correct shell, and then maybe \$ECHO will work.
3255 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3261 # Find the directory that this script lives in.
3262 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3263 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3265 # Follow symbolic links until we get to the real thisdir.
3266 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3267 while test -n \"\$file\"; do
3268 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3270 # If there was a directory component, then change thisdir.
3271 if test \"x\$destdir\" != \"x\$file\"; then
3272 case \"\$destdir\" in
3273 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3274 *) thisdir=\"\$thisdir/\$destdir\" ;;
3278 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3279 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3283 # end: func_emit_wrapper_part1
3285 # func_emit_wrapper_part2 [arg=no]
3287 # Emit the second part of a libtool wrapper script on stdout.
3288 # For more information, see the description associated with
3289 # func_emit_wrapper(), below.
3290 func_emit_wrapper_part2 ()
3292 func_emit_wrapper_part2_arg1=no
3293 if test -n "$1" ; then
3294 func_emit_wrapper_part2_arg1=$1
3299 # Usually 'no', except on cygwin/mingw when embedded into
3301 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
3302 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3303 # special case for '.'
3304 if test \"\$thisdir\" = \".\"; then
3307 # remove .libs from thisdir
3308 case \"\$thisdir\" in
3309 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
3310 $objdir ) thisdir=. ;;
3314 # Try to get the absolute directory name.
3315 absdir=\`cd \"\$thisdir\" && pwd\`
3316 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3319 if test "$fast_install" = yes; then
3321 program=lt-'$outputname'$exeext
3322 progdir=\"\$thisdir/$objdir\"
3324 if test ! -f \"\$progdir/\$program\" ||
3325 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3326 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3328 file=\"\$\$-\$program\"
3330 if test ! -d \"\$progdir\"; then
3331 $MKDIR \"\$progdir\"
3333 $RM \"\$progdir/\$file\"
3338 # relink executable if necessary
3339 if test -n \"\$relink_command\"; then
3340 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3342 $ECHO \"\$relink_command_output\" >&2
3343 $RM \"\$progdir/\$file\"
3348 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3349 { $RM \"\$progdir/\$program\";
3350 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3351 $RM \"\$progdir/\$file\"
3355 program='$outputname'
3356 progdir=\"\$thisdir/$objdir\"
3362 if test -f \"\$progdir/\$program\"; then"
3364 # Export our shlibpath_var if we have one.
3365 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3367 # Add our own library path to $shlibpath_var
3368 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3370 # Some systems cannot cope with colon-terminated $shlibpath_var
3371 # The second colon is a workaround for a bug in BeOS R4 sed
3372 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3374 export $shlibpath_var
3378 # fixup the dll searchpath if we need to.
3379 if test -n "$dllsearchpath"; then
3381 # Add the dll search path components to the executable PATH
3382 PATH=$dllsearchpath:\$PATH
3387 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3388 # Run the actual program with our arguments.
3391 # Backslashes separate directories on plain windows
3392 *-*-mingw | *-*-os2* | *-cegcc*)
3394 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3400 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3405 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3409 # The program doesn't exist.
3410 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3411 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3412 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3418 # end: func_emit_wrapper_part2
3421 # func_emit_wrapper [arg=no]
3423 # Emit a libtool wrapper script on stdout.
3424 # Don't directly open a file because we may want to
3425 # incorporate the script contents within a cygwin/mingw
3426 # wrapper executable. Must ONLY be called from within
3427 # func_mode_link because it depends on a number of variables
3430 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3431 # variable will take. If 'yes', then the emitted script
3432 # will assume that the directory in which it is stored is
3433 # the $objdir directory. This is a cygwin/mingw-specific
3435 func_emit_wrapper ()
3437 func_emit_wrapper_arg1=no
3438 if test -n "$1" ; then
3439 func_emit_wrapper_arg1=$1
3442 # split this up so that func_emit_cwrapperexe_src
3443 # can call each part independently.
3444 func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
3445 func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
3449 # func_to_host_path arg
3451 # Convert paths to host format when used with build tools.
3452 # Intended for use with "native" mingw (where libtool itself
3453 # is running under the msys shell), or in the following cross-
3454 # build environments:
3456 # mingw (msys) mingw [e.g. native]
3459 # where wine is equipped with the `winepath' executable.
3460 # In the native mingw case, the (msys) shell automatically
3461 # converts paths for any non-msys applications it launches,
3462 # but that facility isn't available from inside the cwrapper.
3463 # Similar accommodations are necessary for $host mingw and
3464 # $build cygwin. Calling this function does no harm for other
3465 # $host/$build combinations not listed above.
3467 # ARG is the path (on $build) that should be converted to
3468 # the proper representation for $host. The result is stored
3469 # in $func_to_host_path_result.
3470 func_to_host_path ()
3472 func_to_host_path_result="$1"
3473 if test -n "$1" ; then
3476 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3478 *mingw* ) # actually, msys
3479 # awkward: cmd appends spaces to result
3480 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3481 func_to_host_path_tmp1=`( cmd //c echo "$1" |\
3482 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3483 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3484 $SED -e "$lt_sed_naive_backslashify"`
3487 func_to_host_path_tmp1=`cygpath -w "$1"`
3488 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3489 $SED -e "$lt_sed_naive_backslashify"`
3492 # Unfortunately, winepath does not exit with a non-zero
3493 # error code, so we are forced to check the contents of
3494 # stdout. On the other hand, if the command is not
3495 # found, the shell will set an exit code of 127 and print
3496 # *an error message* to stdout. So we must check for both
3497 # error code of zero AND non-empty stdout, which explains
3498 # the odd construction:
3499 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3500 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3501 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3502 $SED -e "$lt_sed_naive_backslashify"`
3504 # Allow warning below.
3505 func_to_host_path_result=""
3509 if test -z "$func_to_host_path_result" ; then
3510 func_error "Could not determine host path corresponding to"
3512 func_error "Continuing, but uninstalled executables may not work."
3514 func_to_host_path_result="$1"
3520 # end: func_to_host_path
3522 # func_to_host_pathlist arg
3524 # Convert pathlists to host format when used with build tools.
3525 # See func_to_host_path(), above. This function supports the
3526 # following $build/$host combinations (but does no harm for
3527 # combinations not listed here):
3529 # mingw (msys) mingw [e.g. native]
3533 # Path separators are also converted from $build format to
3534 # $host format. If ARG begins or ends with a path separator
3535 # character, it is preserved (but converted to $host format)
3538 # ARG is a pathlist (on $build) that should be converted to
3539 # the proper representation on $host. The result is stored
3540 # in $func_to_host_pathlist_result.
3541 func_to_host_pathlist ()
3543 func_to_host_pathlist_result="$1"
3544 if test -n "$1" ; then
3547 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3548 # Remove leading and trailing path separator characters from
3549 # ARG. msys behavior is inconsistent here, cygpath turns them
3550 # into '.;' and ';.', and winepath ignores them completely.
3551 func_to_host_pathlist_tmp2="$1"
3552 # Once set for this call, this variable should not be
3553 # reassigned. It is used in tha fallback case.
3554 func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
3555 $SED -e 's|^:*||' -e 's|:*$||'`
3557 *mingw* ) # Actually, msys.
3558 # Awkward: cmd appends spaces to result.
3559 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3560 func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
3561 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3562 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3563 $SED -e "$lt_sed_naive_backslashify"`
3566 func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
3567 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3568 $SED -e "$lt_sed_naive_backslashify"`
3571 # unfortunately, winepath doesn't convert pathlists
3572 func_to_host_pathlist_result=""
3573 func_to_host_pathlist_oldIFS=$IFS
3575 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3576 IFS=$func_to_host_pathlist_oldIFS
3577 if test -n "$func_to_host_pathlist_f" ; then
3578 func_to_host_path "$func_to_host_pathlist_f"
3579 if test -n "$func_to_host_path_result" ; then
3580 if test -z "$func_to_host_pathlist_result" ; then
3581 func_to_host_pathlist_result="$func_to_host_path_result"
3583 func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
3589 IFS=$func_to_host_pathlist_oldIFS
3592 if test -z "$func_to_host_pathlist_result" ; then
3593 func_error "Could not determine the host path(s) corresponding to"
3595 func_error "Continuing, but uninstalled executables may not work."
3596 # Fallback. This may break if $1 contains DOS-style drive
3597 # specifications. The fix is not to complicate the expression
3598 # below, but for the user to provide a working wine installation
3599 # with winepath so that path translation in the cross-to-mingw
3600 # case works properly.
3601 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3602 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3603 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3605 # Now, add the leading and trailing path separators back
3607 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3611 *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
3618 # end: func_to_host_pathlist
3620 # func_emit_cwrapperexe_src
3621 # emit the source code for a wrapper executable on stdout
3622 # Must ONLY be called from within func_mode_link because
3623 # it depends on a number of variable set therein.
3624 func_emit_cwrapperexe_src ()
3628 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3629 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3631 The $output program cannot be directly executed until all the libtool
3632 libraries that it depends on are installed.
3634 This wrapper executable should never be moved out of the build directory.
3635 If it is, it will not operate correctly.
3637 Currently, it simply execs the wrapper *script* "$SHELL $output",
3638 but could eventually absorb all of the scripts functionality and
3639 exec $objdir/$outputname directly.
3646 # include <direct.h>
3647 # include <process.h>
3649 # define setmode _setmode
3651 # include <unistd.h>
3652 # include <stdint.h>
3655 # define HAVE_SETENV
3656 # ifdef __STRICT_ANSI__
3657 char *realpath (const char *, char *);
3658 int putenv (char *);
3659 int setenv (const char *, const char *, int);
3670 #include <sys/stat.h>
3672 #if defined(PATH_MAX)
3673 # define LT_PATHMAX PATH_MAX
3674 #elif defined(MAXPATHLEN)
3675 # define LT_PATHMAX MAXPATHLEN
3677 # define LT_PATHMAX 1024
3688 # define S_IXUSR _S_IEXEC
3690 # ifndef _INTPTR_T_DEFINED
3691 # define intptr_t int
3695 #ifndef DIR_SEPARATOR
3696 # define DIR_SEPARATOR '/'
3697 # define PATH_SEPARATOR ':'
3700 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3702 # define HAVE_DOS_BASED_FILE_SYSTEM
3703 # define FOPEN_WB "wb"
3704 # ifndef DIR_SEPARATOR_2
3705 # define DIR_SEPARATOR_2 '\\'
3707 # ifndef PATH_SEPARATOR_2
3708 # define PATH_SEPARATOR_2 ';'
3712 #ifndef DIR_SEPARATOR_2
3713 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3714 #else /* DIR_SEPARATOR_2 */
3715 # define IS_DIR_SEPARATOR(ch) \
3716 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3717 #endif /* DIR_SEPARATOR_2 */
3719 #ifndef PATH_SEPARATOR_2
3720 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3721 #else /* PATH_SEPARATOR_2 */
3722 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3723 #endif /* PATH_SEPARATOR_2 */
3726 # define FOPEN_WB "wb"
3730 # define FOPEN_WB "w"
3733 # define _O_BINARY 0
3736 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3737 #define XFREE(stale) do { \
3738 if (stale) { free ((void *) stale); stale = 0; } \
3741 #undef LTWRAPPER_DEBUGPRINTF
3742 #if defined DEBUGWRAPPER
3743 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3745 ltwrapper_debugprintf (const char *fmt, ...)
3748 va_start (args, fmt);
3749 (void) vfprintf (stderr, fmt, args);
3753 # define LTWRAPPER_DEBUGPRINTF(args)
3756 const char *program_name = NULL;
3758 void *xmalloc (size_t num);
3759 char *xstrdup (const char *string);
3760 const char *base_name (const char *name);
3761 char *find_executable (const char *wrapper);
3762 char *chase_symlinks (const char *pathspec);
3763 int make_executable (const char *path);
3764 int check_executable (const char *path);
3765 char *strendzap (char *str, const char *pat);
3766 void lt_fatal (const char *message, ...);
3767 void lt_setenv (const char *name, const char *value);
3768 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3769 void lt_opt_process_env_set (const char *arg);
3770 void lt_opt_process_env_prepend (const char *arg);
3771 void lt_opt_process_env_append (const char *arg);
3772 int lt_split_name_value (const char *arg, char** name, char** value);
3773 void lt_update_exe_path (const char *name, const char *value);
3774 void lt_update_lib_path (const char *name, const char *value);
3776 static const char *script_text_part1 =
3779 func_emit_wrapper_part1 yes |
3780 $SED -e 's/\([\\"]\)/\\\1/g' \
3781 -e 's/^/ "/' -e 's/$/\\n"/'
3785 static const char *script_text_part2 =
3787 func_emit_wrapper_part2 yes |
3788 $SED -e 's/\([\\"]\)/\\\1/g' \
3789 -e 's/^/ "/' -e 's/$/\\n"/'
3793 const char * MAGIC_EXE = "$magic_exe";
3794 const char * LIB_PATH_VARNAME = "$shlibpath_var";
3797 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3798 func_to_host_pathlist "$temp_rpath"
3800 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
3804 const char * LIB_PATH_VALUE = "";
3808 if test -n "$dllsearchpath"; then
3809 func_to_host_pathlist "$dllsearchpath:"
3811 const char * EXE_PATH_VARNAME = "PATH";
3812 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
3816 const char * EXE_PATH_VARNAME = "";
3817 const char * EXE_PATH_VALUE = "";
3821 if test "$fast_install" = yes; then
3823 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3827 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3834 #define LTWRAPPER_OPTION_PREFIX "--lt-"
3835 #define LTWRAPPER_OPTION_PREFIX_LENGTH 5
3837 static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
3838 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3840 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
3842 static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
3843 static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
3844 /* argument is putenv-style "foo=bar", value of foo is set to bar */
3846 static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
3847 static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
3848 /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
3850 static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
3851 static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
3852 /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
3855 main (int argc, char *argv[])
3860 char *actual_cwrapper_path;
3861 char *actual_cwrapper_name;
3864 intptr_t rval = 127;
3868 program_name = (char *) xstrdup (base_name (argv[0]));
3869 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3870 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3872 /* very simple arg parsing; don't want to rely on getopt */
3873 for (i = 1; i < argc; i++)
3875 if (strcmp (argv[i], dumpscript_opt) == 0)
3879 *mingw* | *cygwin* )
3880 # make stdout use "unix" line endings
3881 echo " setmode(1,_O_BINARY);"
3886 printf ("%s", script_text_part1);
3887 printf ("%s", script_text_part2);
3892 newargz = XMALLOC (char *, argc + 1);
3893 tmp_pathspec = find_executable (argv[0]);
3894 if (tmp_pathspec == NULL)
3895 lt_fatal ("Couldn't find %s", argv[0]);
3896 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3899 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3900 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3901 actual_cwrapper_path));
3902 XFREE (tmp_pathspec);
3904 actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
3905 strendzap (actual_cwrapper_path, actual_cwrapper_name);
3907 /* wrapper name transforms */
3908 strendzap (actual_cwrapper_name, ".exe");
3909 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3910 XFREE (actual_cwrapper_name);
3911 actual_cwrapper_name = tmp_pathspec;
3914 /* target_name transforms -- use actual target program name; might have lt- prefix */
3915 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3916 strendzap (target_name, ".exe");
3917 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3918 XFREE (target_name);
3919 target_name = tmp_pathspec;
3922 LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
3928 XMALLOC (char, (strlen (actual_cwrapper_path) +
3929 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3930 strcpy (newargz[0], actual_cwrapper_path);
3931 strcat (newargz[0], "$objdir");
3932 strcat (newargz[0], "/");
3936 /* stop here, and copy so we don't have to do this twice */
3937 tmp_pathspec = xstrdup (newargz[0]);
3939 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3940 strcat (newargz[0], actual_cwrapper_name);
3942 /* DO want the lt- prefix here if it exists, so use target_name */
3943 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3944 XFREE (tmp_pathspec);
3945 tmp_pathspec = NULL;
3953 while ((p = strchr (newargz[0], '\\')) != NULL)
3957 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
3967 XFREE (target_name);
3968 XFREE (actual_cwrapper_path);
3969 XFREE (actual_cwrapper_name);
3971 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3972 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
3973 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3974 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3977 for (i = 1; i < argc; i++)
3979 if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
3981 if (argv[i][env_set_opt_len] == '=')
3983 const char *p = argv[i] + env_set_opt_len + 1;
3984 lt_opt_process_env_set (p);
3986 else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
3988 lt_opt_process_env_set (argv[++i]); /* don't copy */
3991 lt_fatal ("%s missing required argument", env_set_opt);
3994 if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
3996 if (argv[i][env_prepend_opt_len] == '=')
3998 const char *p = argv[i] + env_prepend_opt_len + 1;
3999 lt_opt_process_env_prepend (p);
4001 else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
4003 lt_opt_process_env_prepend (argv[++i]); /* don't copy */
4006 lt_fatal ("%s missing required argument", env_prepend_opt);
4009 if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
4011 if (argv[i][env_append_opt_len] == '=')
4013 const char *p = argv[i] + env_append_opt_len + 1;
4014 lt_opt_process_env_append (p);
4016 else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
4018 lt_opt_process_env_append (argv[++i]); /* don't copy */
4021 lt_fatal ("%s missing required argument", env_append_opt);
4024 if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
4026 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4027 namespace, but it is not one of the ones we know about and
4028 have already dealt with, above (inluding dump-script), then
4029 report an error. Otherwise, targets might begin to believe
4030 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4031 namespace. The first time any user complains about this, we'll
4032 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4033 or a configure.ac-settable value.
4035 lt_fatal ("Unrecognized option in %s namespace: '%s'",
4036 ltwrapper_option_prefix, argv[i]);
4039 newargz[++newargc] = xstrdup (argv[i]);
4041 newargz[++newargc] = NULL;
4043 LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
4044 for (i = 0; i < newargc; i++)
4046 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
4054 /* execv doesn't actually work on mingw as expected on unix */
4055 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4058 /* failed to start process */
4059 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
4067 execv (lt_argv_zero, newargz);
4068 return rval; /* =127, but avoids unused variable warning */
4077 xmalloc (size_t num)
4079 void *p = (void *) malloc (num);
4081 lt_fatal ("Memory exhausted");
4087 xstrdup (const char *string)
4089 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4094 base_name (const char *name)
4098 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4099 /* Skip over the disk name in MSDOS pathnames. */
4100 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4104 for (base = name; *name; name++)
4105 if (IS_DIR_SEPARATOR (*name))
4111 check_executable (const char *path)
4115 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
4116 path ? (*path ? path : "EMPTY!") : "NULL!"));
4117 if ((!path) || (!*path))
4120 if ((stat (path, &st) >= 0)
4121 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4128 make_executable (const char *path)
4133 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
4134 path ? (*path ? path : "EMPTY!") : "NULL!"));
4135 if ((!path) || (!*path))
4138 if (stat (path, &st) >= 0)
4140 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4145 /* Searches for the full path of the wrapper. Returns
4146 newly allocated full path name if found, NULL otherwise
4147 Does not chase symlinks, even on platforms that support them.
4150 find_executable (const char *wrapper)
4155 /* static buffer for getcwd */
4156 char tmp[LT_PATHMAX + 1];
4160 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
4161 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
4163 if ((wrapper == NULL) || (*wrapper == '\0'))
4166 /* Absolute path? */
4167 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4168 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4170 concat_name = xstrdup (wrapper);
4171 if (check_executable (concat_name))
4173 XFREE (concat_name);
4178 if (IS_DIR_SEPARATOR (wrapper[0]))
4180 concat_name = xstrdup (wrapper);
4181 if (check_executable (concat_name))
4183 XFREE (concat_name);
4185 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4189 for (p = wrapper; *p; p++)
4197 /* no slashes; search PATH */
4198 const char *path = getenv ("PATH");
4201 for (p = path; *p; p = p_next)
4205 for (q = p; *q; q++)
4206 if (IS_PATH_SEPARATOR (*q))
4209 p_next = (*q == '\0' ? q : q + 1);
4212 /* empty path: current directory */
4213 if (getcwd (tmp, LT_PATHMAX) == NULL)
4214 lt_fatal ("getcwd failed");
4215 tmp_len = strlen (tmp);
4217 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4218 memcpy (concat_name, tmp, tmp_len);
4219 concat_name[tmp_len] = '/';
4220 strcpy (concat_name + tmp_len + 1, wrapper);
4225 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4226 memcpy (concat_name, p, p_len);
4227 concat_name[p_len] = '/';
4228 strcpy (concat_name + p_len + 1, wrapper);
4230 if (check_executable (concat_name))
4232 XFREE (concat_name);
4235 /* not found in PATH; assume curdir */
4237 /* Relative path | not found in path: prepend cwd */
4238 if (getcwd (tmp, LT_PATHMAX) == NULL)
4239 lt_fatal ("getcwd failed");
4240 tmp_len = strlen (tmp);
4241 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4242 memcpy (concat_name, tmp, tmp_len);
4243 concat_name[tmp_len] = '/';
4244 strcpy (concat_name + tmp_len + 1, wrapper);
4246 if (check_executable (concat_name))
4248 XFREE (concat_name);
4253 chase_symlinks (const char *pathspec)
4256 return xstrdup (pathspec);
4258 char buf[LT_PATHMAX];
4260 char *tmp_pathspec = xstrdup (pathspec);
4262 int has_symlinks = 0;
4263 while (strlen (tmp_pathspec) && !has_symlinks)
4265 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
4267 if (lstat (tmp_pathspec, &s) == 0)
4269 if (S_ISLNK (s.st_mode) != 0)
4275 /* search backwards for last DIR_SEPARATOR */
4276 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4277 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4279 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4281 /* no more DIR_SEPARATORS left */
4288 char *errstr = strerror (errno);
4289 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
4292 XFREE (tmp_pathspec);
4296 return xstrdup (pathspec);
4299 tmp_pathspec = realpath (pathspec, buf);
4300 if (tmp_pathspec == 0)
4302 lt_fatal ("Could not follow symlinks for %s", pathspec);
4304 return xstrdup (tmp_pathspec);
4309 strendzap (char *str, const char *pat)
4313 assert (str != NULL);
4314 assert (pat != NULL);
4317 patlen = strlen (pat);
4321 str += len - patlen;
4322 if (strcmp (str, pat) == 0)
4329 lt_error_core (int exit_status, const char *mode,
4330 const char *message, va_list ap)
4332 fprintf (stderr, "%s: %s: ", program_name, mode);
4333 vfprintf (stderr, message, ap);
4334 fprintf (stderr, ".\n");
4336 if (exit_status >= 0)
4341 lt_fatal (const char *message, ...)
4344 va_start (ap, message);
4345 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4350 lt_setenv (const char *name, const char *value)
4352 LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
4353 (name ? name : "<NULL>"),
4354 (value ? value : "<NULL>")));
4357 /* always make a copy, for consistency with !HAVE_SETENV */
4358 char *str = xstrdup (value);
4359 setenv (name, str, 1);
4361 int len = strlen (name) + 1 + strlen (value) + 1;
4362 char *str = XMALLOC (char, len);
4363 sprintf (str, "%s=%s", name, value);
4364 if (putenv (str) != EXIT_SUCCESS)
4373 lt_extend_str (const char *orig_value, const char *add, int to_end)
4376 if (orig_value && *orig_value)
4378 int orig_value_len = strlen (orig_value);
4379 int add_len = strlen (add);
4380 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4383 strcpy (new_value, orig_value);
4384 strcpy (new_value + orig_value_len, add);
4388 strcpy (new_value, add);
4389 strcpy (new_value + add_len, orig_value);
4394 new_value = xstrdup (add);
4400 lt_split_name_value (const char *arg, char** name, char** value)
4407 p = strchr (arg, (int)'=');
4412 *value = xstrdup (++p);
4414 len = strlen (arg) - strlen (*value);
4415 *name = XMALLOC (char, len);
4416 strncpy (*name, arg, len-1);
4417 (*name)[len - 1] = '\0';
4423 lt_opt_process_env_set (const char *arg)
4428 if (lt_split_name_value (arg, &name, &value) != 0)
4432 lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
4435 lt_setenv (name, value);
4441 lt_opt_process_env_prepend (const char *arg)
4445 char *new_value = NULL;
4447 if (lt_split_name_value (arg, &name, &value) != 0)
4451 lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
4454 new_value = lt_extend_str (getenv (name), value, 0);
4455 lt_setenv (name, new_value);
4462 lt_opt_process_env_append (const char *arg)
4466 char *new_value = NULL;
4468 if (lt_split_name_value (arg, &name, &value) != 0)
4472 lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
4475 new_value = lt_extend_str (getenv (name), value, 1);
4476 lt_setenv (name, new_value);
4483 lt_update_exe_path (const char *name, const char *value)
4485 LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4486 (name ? name : "<NULL>"),
4487 (value ? value : "<NULL>")));
4489 if (name && *name && value && *value)
4491 char *new_value = lt_extend_str (getenv (name), value, 0);
4492 /* some systems can't cope with a ':'-terminated path #' */
4493 int len = strlen (new_value);
4494 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4496 new_value[len-1] = '\0';
4498 lt_setenv (name, new_value);
4504 lt_update_lib_path (const char *name, const char *value)
4506 LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4507 (name ? name : "<NULL>"),
4508 (value ? value : "<NULL>")));
4510 if (name && *name && value && *value)
4512 char *new_value = lt_extend_str (getenv (name), value, 0);
4513 lt_setenv (name, new_value);
4521 # end: func_emit_cwrapperexe_src
4523 # func_mode_link arg...
4528 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4529 # It is impossible to link a dll without this setting, and
4530 # we shouldn't force the makefile maintainer to figure out
4531 # which system we are compiling for in order to pass an extra
4532 # flag for every libtool invocation.
4533 # allow_undefined=no
4535 # FIXME: Unfortunately, there are problems with the above when trying
4536 # to make a dll which has undefined symbols, in which case not
4537 # even a static library is built. For now, we need to specify
4538 # -no-undefined on the libtool link line when we can be certain
4539 # that all symbols are satisfied, otherwise we get a static library.
4546 libtool_args=$nonopt
4547 base_compile="$nonopt $@"
4548 compile_command=$nonopt
4549 finalize_command=$nonopt
4562 lib_search_path=`pwd`
4564 new_inherited_linker_flags=
4572 export_symbols_regex=
4580 precious_files_regex=
4581 prefer_static_libs=no
4594 single_module="${wl}-single_module"
4595 func_infer_tag $base_compile
4597 # We need to know -static, to get the right output filenames.
4602 test "$build_libtool_libs" != yes && \
4603 func_fatal_configuration "can not build a shared library"
4607 -all-static | -static | -static-libtool-libs)
4610 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4611 func_warning "complete static linking is impossible in this configuration"
4613 if test -n "$link_static_flag"; then
4614 dlopen_self=$dlopen_self_static
4616 prefer_static_libs=yes
4619 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4620 dlopen_self=$dlopen_self_static
4622 prefer_static_libs=built
4624 -static-libtool-libs)
4625 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4626 dlopen_self=$dlopen_self_static
4628 prefer_static_libs=yes
4631 build_libtool_libs=no
4638 # See if our shared archives depend on static archives.
4639 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4641 # Go through the arguments, transforming them on the way.
4642 while test "$#" -gt 0; do
4645 func_quote_for_eval "$arg"
4646 qarg=$func_quote_for_eval_unquoted_result
4647 func_append libtool_args " $func_quote_for_eval_result"
4649 # If the previous option needs an argument, assign it.
4650 if test -n "$prev"; then
4653 func_append compile_command " @OUTPUT@"
4654 func_append finalize_command " @OUTPUT@"
4660 if test "$preload" = no; then
4661 # Add the symbol object into the linking commands.
4662 func_append compile_command " @SYMFILE@"
4663 func_append finalize_command " @SYMFILE@"
4667 *.la | *.lo) ;; # We handle these cases below.
4669 if test "$dlself" = no; then
4677 if test "$prev" = dlprefiles; then
4679 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4689 if test "$prev" = dlfiles; then
4690 dlfiles="$dlfiles $arg"
4692 dlprefiles="$dlprefiles $arg"
4700 export_symbols="$arg"
4702 || func_fatal_error "symbol file \`$arg' does not exist"
4707 export_symbols_regex="$arg"
4715 *" $qarg.ltframework "*) ;;
4716 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4725 inst_prefix_dir="$arg"
4730 if test -f "$arg"; then
4733 for fil in `cat "$save_arg"`
4735 # moreargs="$moreargs $fil"
4737 # A libtool-controlled object.
4739 # Check to see that this really is a libtool object.
4740 if func_lalib_unsafe_p "$arg"; then
4747 if test -z "$pic_object" ||
4748 test -z "$non_pic_object" ||
4749 test "$pic_object" = none &&
4750 test "$non_pic_object" = none; then
4751 func_fatal_error "cannot find name of object for \`$arg'"
4754 # Extract subdirectory from the argument.
4755 func_dirname "$arg" "/" ""
4756 xdir="$func_dirname_result"
4758 if test "$pic_object" != none; then
4759 # Prepend the subdirectory the object is found in.
4760 pic_object="$xdir$pic_object"
4762 if test "$prev" = dlfiles; then
4763 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4764 dlfiles="$dlfiles $pic_object"
4768 # If libtool objects are unsupported, then we need to preload.
4773 # CHECK ME: I think I busted this. -Ossama
4774 if test "$prev" = dlprefiles; then
4775 # Preload the old-style object.
4776 dlprefiles="$dlprefiles $pic_object"
4781 func_append libobjs " $pic_object"
4786 if test "$non_pic_object" != none; then
4787 # Prepend the subdirectory the object is found in.
4788 non_pic_object="$xdir$non_pic_object"
4790 # A standard non-PIC object
4791 func_append non_pic_objects " $non_pic_object"
4792 if test -z "$pic_object" || test "$pic_object" = none ; then
4793 arg="$non_pic_object"
4796 # If the PIC object exists, use it instead.
4797 # $xdir was prepended to $pic_object above.
4798 non_pic_object="$pic_object"
4799 func_append non_pic_objects " $non_pic_object"
4802 # Only an error if not doing a dry-run.
4803 if $opt_dry_run; then
4804 # Extract subdirectory from the argument.
4805 func_dirname "$arg" "/" ""
4806 xdir="$func_dirname_result"
4809 pic_object=$xdir$objdir/$func_lo2o_result
4810 non_pic_object=$xdir$func_lo2o_result
4811 func_append libobjs " $pic_object"
4812 func_append non_pic_objects " $non_pic_object"
4814 func_fatal_error "\`$arg' is not a valid libtool object"
4819 func_fatal_error "link input file \`$arg' does not exist"
4826 precious_files_regex="$arg"
4836 # We need an absolute path.
4838 [\\/]* | [A-Za-z]:[\\/]*) ;;
4840 func_fatal_error "only absolute run-paths are allowed"
4843 if test "$prev" = rpath; then
4846 *) rpath="$rpath $arg" ;;
4851 *) xrpath="$xrpath $arg" ;;
4863 weak_libs="$weak_libs $arg"
4868 linker_flags="$linker_flags $qarg"
4869 compiler_flags="$compiler_flags $qarg"
4871 func_append compile_command " $qarg"
4872 func_append finalize_command " $qarg"
4876 compiler_flags="$compiler_flags $qarg"
4878 func_append compile_command " $qarg"
4879 func_append finalize_command " $qarg"
4883 linker_flags="$linker_flags $qarg"
4884 compiler_flags="$compiler_flags $wl$qarg"
4886 func_append compile_command " $wl$qarg"
4887 func_append finalize_command " $wl$qarg"
4891 eval "$prev=\"\$arg\""
4896 fi # test -n "$prev"
4902 if test -n "$link_static_flag"; then
4903 # See comment for -static flag below, for more details.
4904 func_append compile_command " $link_static_flag"
4905 func_append finalize_command " $link_static_flag"
4911 # FIXME: remove this flag sometime in the future.
4912 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
4935 -export-symbols | -export-symbols-regex)
4936 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
4937 func_fatal_error "more than one -exported-symbols argument is not allowed"
4939 if test "X$arg" = "X-export-symbols"; then
4957 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
4958 # so, if we see these flags be careful not to treat them like -L
4960 case $with_gcc/$host in
4961 no/*-*-irix* | /*-*-irix*)
4962 func_append compile_command " $arg"
4963 func_append finalize_command " $arg"
4970 func_stripname '-L' '' "$arg"
4971 dir=$func_stripname_result
4972 if test -z "$dir"; then
4973 if test "$#" -gt 0; then
4974 func_fatal_error "require no space between \`-L' and \`$1'"
4976 func_fatal_error "need path for \`-L' option"
4979 # We need an absolute path.
4981 [\\/]* | [A-Za-z]:[\\/]*) ;;
4983 absdir=`cd "$dir" && pwd`
4984 test -z "$absdir" && \
4985 func_fatal_error "cannot determine absolute directory name of \`$dir'"
4992 deplibs="$deplibs -L$dir"
4993 lib_search_path="$lib_search_path $dir"
4997 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4998 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
4999 case :$dllsearchpath: in
5001 ::) dllsearchpath=$dir;;
5002 *) dllsearchpath="$dllsearchpath:$dir";;
5004 case :$dllsearchpath: in
5005 *":$testbindir:"*) ;;
5006 ::) dllsearchpath=$testbindir;;
5007 *) dllsearchpath="$dllsearchpath:$testbindir";;
5015 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5017 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
5018 # These systems don't actually have a C or math library (as such)
5022 # These systems don't actually have a C library (as such)
5023 test "X$arg" = "X-lc" && continue
5025 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5026 # Do not include libc due to us having libc/libc_r.
5027 test "X$arg" = "X-lc" && continue
5029 *-*-rhapsody* | *-*-darwin1.[012])
5030 # Rhapsody C and math libraries are in the System framework
5031 deplibs="$deplibs System.ltframework"
5034 *-*-sco3.2v5* | *-*-sco5v6*)
5035 # Causes problems with __ctype
5036 test "X$arg" = "X-lc" && continue
5038 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5039 # Compiler inserts libc in the correct place for threads to work
5040 test "X$arg" = "X-lc" && continue
5043 elif test "X$arg" = "X-lc_r"; then
5045 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5046 # Do not include libc_r directly, use -pthread flag.
5051 deplibs="$deplibs $arg"
5060 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5061 # classes, name mangling, and exception handling.
5062 # Darwin uses the -arch flag to determine output architecture.
5063 -model|-arch|-isysroot)
5064 compiler_flags="$compiler_flags $arg"
5065 func_append compile_command " $arg"
5066 func_append finalize_command " $arg"
5071 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5072 compiler_flags="$compiler_flags $arg"
5073 func_append compile_command " $arg"
5074 func_append finalize_command " $arg"
5075 case "$new_inherited_linker_flags " in
5077 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
5083 single_module="${wl}-multi_module"
5094 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5095 # The PATH hackery in wrapper scripts is required on Windows
5096 # and Darwin in order for the loader to find any dlls it needs.
5097 func_warning "\`-no-install' is ignored for $host"
5098 func_warning "assuming \`-no-fast-install' instead"
5101 *) no_install=yes ;;
5118 -precious-files-regex)
5139 func_stripname '-R' '' "$arg"
5140 dir=$func_stripname_result
5141 # We need an absolute path.
5143 [\\/]* | [A-Za-z]:[\\/]*) ;;
5145 func_fatal_error "only absolute run-paths are allowed"
5150 *) xrpath="$xrpath $dir" ;;
5156 # The effects of -shared are defined in a previous loop.
5165 -static | -static-libtool-libs)
5166 # The effects of -static are defined in a previous loop.
5167 # We used to do the same as -all-static on platforms that
5168 # didn't have a PIC flag, but the assumption that the effects
5169 # would be equivalent was wrong. It would break on at least
5170 # Digital Unix and AIX.
5196 func_stripname '-Wc,' '' "$arg"
5197 args=$func_stripname_result
5199 save_ifs="$IFS"; IFS=','
5200 for flag in $args; do
5202 func_quote_for_eval "$flag"
5203 arg="$arg $wl$func_quote_for_eval_result"
5204 compiler_flags="$compiler_flags $func_quote_for_eval_result"
5207 func_stripname ' ' '' "$arg"
5208 arg=$func_stripname_result
5212 func_stripname '-Wl,' '' "$arg"
5213 args=$func_stripname_result
5215 save_ifs="$IFS"; IFS=','
5216 for flag in $args; do
5218 func_quote_for_eval "$flag"
5219 arg="$arg $wl$func_quote_for_eval_result"
5220 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
5221 linker_flags="$linker_flags $func_quote_for_eval_result"
5224 func_stripname ' ' '' "$arg"
5225 arg=$func_stripname_result
5245 func_quote_for_eval "$arg"
5246 arg="$func_quote_for_eval_result"
5249 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
5250 # -r[0-9][0-9]* specifies the processor on the SGI compiler
5251 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
5252 # +DA*, +DD* enable 64-bit mode on the HP compiler
5253 # -q* pass through compiler args for the IBM compiler
5254 # -m*, -t[45]*, -txscale* pass through architecture-specific
5255 # compiler args for GCC
5256 # -F/path gives path to uninstalled frameworks, gcc on darwin
5257 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
5258 # @file GCC response files
5259 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5260 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
5261 func_quote_for_eval "$arg"
5262 arg="$func_quote_for_eval_result"
5263 func_append compile_command " $arg"
5264 func_append finalize_command " $arg"
5265 compiler_flags="$compiler_flags $arg"
5269 # Some other compiler flag.
5271 func_quote_for_eval "$arg"
5272 arg="$func_quote_for_eval_result"
5276 # A standard object.
5281 # A libtool-controlled object.
5283 # Check to see that this really is a libtool object.
5284 if func_lalib_unsafe_p "$arg"; then
5291 if test -z "$pic_object" ||
5292 test -z "$non_pic_object" ||
5293 test "$pic_object" = none &&
5294 test "$non_pic_object" = none; then
5295 func_fatal_error "cannot find name of object for \`$arg'"
5298 # Extract subdirectory from the argument.
5299 func_dirname "$arg" "/" ""
5300 xdir="$func_dirname_result"
5302 if test "$pic_object" != none; then
5303 # Prepend the subdirectory the object is found in.
5304 pic_object="$xdir$pic_object"
5306 if test "$prev" = dlfiles; then
5307 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5308 dlfiles="$dlfiles $pic_object"
5312 # If libtool objects are unsupported, then we need to preload.
5317 # CHECK ME: I think I busted this. -Ossama
5318 if test "$prev" = dlprefiles; then
5319 # Preload the old-style object.
5320 dlprefiles="$dlprefiles $pic_object"
5325 func_append libobjs " $pic_object"
5330 if test "$non_pic_object" != none; then
5331 # Prepend the subdirectory the object is found in.
5332 non_pic_object="$xdir$non_pic_object"
5334 # A standard non-PIC object
5335 func_append non_pic_objects " $non_pic_object"
5336 if test -z "$pic_object" || test "$pic_object" = none ; then
5337 arg="$non_pic_object"
5340 # If the PIC object exists, use it instead.
5341 # $xdir was prepended to $pic_object above.
5342 non_pic_object="$pic_object"
5343 func_append non_pic_objects " $non_pic_object"
5346 # Only an error if not doing a dry-run.
5347 if $opt_dry_run; then
5348 # Extract subdirectory from the argument.
5349 func_dirname "$arg" "/" ""
5350 xdir="$func_dirname_result"
5353 pic_object=$xdir$objdir/$func_lo2o_result
5354 non_pic_object=$xdir$func_lo2o_result
5355 func_append libobjs " $pic_object"
5356 func_append non_pic_objects " $non_pic_object"
5358 func_fatal_error "\`$arg' is not a valid libtool object"
5365 deplibs="$deplibs $arg"
5366 old_deplibs="$old_deplibs $arg"
5371 # A libtool-controlled library.
5373 if test "$prev" = dlfiles; then
5374 # This library was specified with -dlopen.
5375 dlfiles="$dlfiles $arg"
5377 elif test "$prev" = dlprefiles; then
5378 # The library was specified with -dlpreopen.
5379 dlprefiles="$dlprefiles $arg"
5382 deplibs="$deplibs $arg"
5387 # Some other compiler argument.
5389 # Unknown arguments in both finalize_command and compile_command need
5390 # to be aesthetically quoted because they are evaled later.
5391 func_quote_for_eval "$arg"
5392 arg="$func_quote_for_eval_result"
5396 # Now actually substitute the argument into the commands.
5397 if test -n "$arg"; then
5398 func_append compile_command " $arg"
5399 func_append finalize_command " $arg"
5401 done # argument parsing loop
5403 test -n "$prev" && \
5404 func_fatal_help "the \`$prevarg' option requires an argument"
5406 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5407 eval arg=\"$export_dynamic_flag_spec\"
5408 func_append compile_command " $arg"
5409 func_append finalize_command " $arg"
5413 # calculate the name of the file, without its directory
5414 func_basename "$output"
5415 outputname="$func_basename_result"
5416 libobjs_save="$libobjs"
5418 if test -n "$shlibpath_var"; then
5419 # get the directories listed in $shlibpath_var
5420 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
5424 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5425 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5427 func_dirname "$output" "/" ""
5428 output_objdir="$func_dirname_result$objdir"
5429 # Create the object directory.
5430 func_mkdir_p "$output_objdir"
5432 # Determine the type of output
5435 func_fatal_help "you must specify an output file"
5437 *.$libext) linkmode=oldlib ;;
5438 *.lo | *.$objext) linkmode=obj ;;
5439 *.la) linkmode=lib ;;
5440 *) linkmode=prog ;; # Anything else should be a program.
5446 # Find all interdependent deplibs by searching for libraries
5447 # that are linked more than once (e.g. -la -lb -la)
5448 for deplib in $deplibs; do
5449 if $opt_duplicate_deps ; then
5451 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5454 libs="$libs $deplib"
5457 if test "$linkmode" = lib; then
5458 libs="$predeps $libs $compiler_lib_search_path $postdeps"
5460 # Compute libraries that are listed more than once in $predeps
5461 # $postdeps and mark them as special (i.e., whose duplicates are
5462 # not to be eliminated).
5464 if $opt_duplicate_compiler_generated_deps; then
5465 for pre_post_dep in $predeps $postdeps; do
5466 case "$pre_post_deps " in
5467 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
5469 pre_post_deps="$pre_post_deps $pre_post_dep"
5478 need_relink=no # whether we're linking any uninstalled libtool libraries
5479 notinst_deplibs= # not-installed libtool libraries
5480 notinst_path= # paths that contain not-installed libtool libraries
5484 passes="conv dlpreopen link"
5485 for file in $dlfiles $dlprefiles; do
5489 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5500 passes="conv scan dlopen dlpreopen link"
5506 for pass in $passes; do
5507 # The preopen pass in lib mode reverses $deplibs; put it back here
5508 # so that -L comes before libs that need it for instance...
5509 if test "$linkmode,$pass" = "lib,link"; then
5510 ## FIXME: Find the place where the list is rebuilt in the wrong
5511 ## order, and fix it there properly
5513 for deplib in $deplibs; do
5514 tmp_deplibs="$deplib $tmp_deplibs"
5516 deplibs="$tmp_deplibs"
5519 if test "$linkmode,$pass" = "lib,link" ||
5520 test "$linkmode,$pass" = "prog,scan"; then
5524 if test "$linkmode" = prog; then
5526 dlopen) libs="$dlfiles" ;;
5527 dlpreopen) libs="$dlprefiles" ;;
5528 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5531 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5532 # Collect and forward deplibs of preopened libtool libs
5533 for lib in $dlprefiles; do
5534 # Ignore non-libtool-libs
5537 *.la) func_source "$lib" ;;
5540 # Collect preopened libtool deplibs, except any this library
5541 # has declared as weak libs
5542 for deplib in $dependency_libs; do
5543 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
5544 case " $weak_libs " in
5545 *" $deplib_base "*) ;;
5546 *) deplibs="$deplibs $deplib" ;;
5552 if test "$pass" = dlopen; then
5553 # Collect dlpreopened libraries
5554 save_deplibs="$deplibs"
5558 for deplib in $libs; do
5562 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5563 if test "$linkmode,$pass" = "prog,link"; then
5564 compile_deplibs="$deplib $compile_deplibs"
5565 finalize_deplibs="$deplib $finalize_deplibs"
5567 compiler_flags="$compiler_flags $deplib"
5568 if test "$linkmode" = lib ; then
5569 case "$new_inherited_linker_flags " in
5571 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5578 if test "$linkmode" != lib && test "$linkmode" != prog; then
5579 func_warning "\`-l' is ignored for archives/objects"
5582 func_stripname '-l' '' "$deplib"
5583 name=$func_stripname_result
5584 if test "$linkmode" = lib; then
5585 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5587 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5589 for searchdir in $searchdirs; do
5590 for search_ext in .la $std_shrext .so .a; do
5591 # Search the libtool library
5592 lib="$searchdir/lib${name}${search_ext}"
5593 if test -f "$lib"; then
5594 if test "$search_ext" = ".la"; then
5603 if test "$found" != yes; then
5604 # deplib doesn't seem to be a libtool library
5605 if test "$linkmode,$pass" = "prog,link"; then
5606 compile_deplibs="$deplib $compile_deplibs"
5607 finalize_deplibs="$deplib $finalize_deplibs"
5609 deplibs="$deplib $deplibs"
5610 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5613 else # deplib is a libtool library
5614 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5615 # We need to do some special things here, and not later.
5616 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5617 case " $predeps $postdeps " in
5619 if func_lalib_p "$lib"; then
5623 for l in $old_library $library_names; do
5626 if test "X$ll" = "X$old_library" ; then # only static version available
5628 func_dirname "$lib" "" "."
5629 ladir="$func_dirname_result"
5630 lib=$ladir/$old_library
5631 if test "$linkmode,$pass" = "prog,link"; then
5632 compile_deplibs="$deplib $compile_deplibs"
5633 finalize_deplibs="$deplib $finalize_deplibs"
5635 deplibs="$deplib $deplibs"
5636 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5648 if test "$linkmode,$pass" = "prog,link"; then
5649 compile_deplibs="$deplib $compile_deplibs"
5650 finalize_deplibs="$deplib $finalize_deplibs"
5652 deplibs="$deplib $deplibs"
5653 if test "$linkmode" = lib ; then
5654 case "$new_inherited_linker_flags " in
5656 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5665 deplibs="$deplib $deplibs"
5666 test "$pass" = conv && continue
5667 newdependency_libs="$deplib $newdependency_libs"
5668 func_stripname '-L' '' "$deplib"
5669 newlib_search_path="$newlib_search_path $func_stripname_result"
5672 if test "$pass" = conv; then
5673 deplibs="$deplib $deplibs"
5676 if test "$pass" = scan; then
5677 deplibs="$deplib $deplibs"
5679 compile_deplibs="$deplib $compile_deplibs"
5680 finalize_deplibs="$deplib $finalize_deplibs"
5682 func_stripname '-L' '' "$deplib"
5683 newlib_search_path="$newlib_search_path $func_stripname_result"
5686 func_warning "\`-L' is ignored for archives/objects"
5692 if test "$pass" = link; then
5693 func_stripname '-R' '' "$deplib"
5694 dir=$func_stripname_result
5695 # Make sure the xrpath contains only unique directories.
5698 *) xrpath="$xrpath $dir" ;;
5701 deplibs="$deplib $deplibs"
5704 *.la) lib="$deplib" ;;
5706 if test "$pass" = conv; then
5707 deplibs="$deplib $deplibs"
5712 # Linking convenience modules into shared libraries is allowed,
5713 # but linking other static libraries is non-portable.
5714 case " $dlpreconveniencelibs " in
5718 case $deplibs_check_method in
5720 set dummy $deplibs_check_method; shift
5721 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5722 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
5723 | $EGREP "$match_pattern_regex" > /dev/null; then
5731 if test "$valid_a_lib" != yes; then
5733 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5734 $ECHO "*** I have the capability to make that library automatically link in when"
5735 $ECHO "*** you link to this library. But I can only do this if you have a"
5736 $ECHO "*** shared version of the library, which you do not appear to have"
5737 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
5738 $ECHO "*** that it is just a static archive that I should not use here."
5741 $ECHO "*** Warning: Linking the shared library $output against the"
5742 $ECHO "*** static library $deplib is not portable!"
5743 deplibs="$deplib $deplibs"
5750 if test "$pass" != link; then
5751 deplibs="$deplib $deplibs"
5753 compile_deplibs="$deplib $compile_deplibs"
5754 finalize_deplibs="$deplib $finalize_deplibs"
5761 if test "$pass" = conv; then
5762 deplibs="$deplib $deplibs"
5763 elif test "$linkmode" = prog; then
5764 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5765 # If there is no dlopen support or we're linking statically,
5766 # we need to preload.
5767 newdlprefiles="$newdlprefiles $deplib"
5768 compile_deplibs="$deplib $compile_deplibs"
5769 finalize_deplibs="$deplib $finalize_deplibs"
5771 newdlfiles="$newdlfiles $deplib"
5782 if test "$found" = yes || test -f "$lib"; then :
5784 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
5787 # Check to see that this really is a libtool archive.
5788 func_lalib_unsafe_p "$lib" \
5789 || func_fatal_error "\`$lib' is not a valid libtool archive"
5791 func_dirname "$lib" "" "."
5792 ladir="$func_dirname_result"
5800 inherited_linker_flags=
5801 # If the library was installed with an old release of libtool,
5802 # it will not redefine variables installed, or shouldnotlink
5811 # Convert "-framework foo" to "foo.ltframework"
5812 if test -n "$inherited_linker_flags"; then
5813 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
5814 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5815 case " $new_inherited_linker_flags " in
5816 *" $tmp_inherited_linker_flag "*) ;;
5817 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
5821 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5822 if test "$linkmode,$pass" = "lib,link" ||
5823 test "$linkmode,$pass" = "prog,scan" ||
5824 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
5825 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
5826 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
5829 if test "$pass" = conv; then
5830 # Only check for convenience libraries
5831 deplibs="$lib $deplibs"
5832 if test -z "$libdir"; then
5833 if test -z "$old_library"; then
5834 func_fatal_error "cannot find name of link library for \`$lib'"
5836 # It is a libtool convenience library, so add in its objects.
5837 convenience="$convenience $ladir/$objdir/$old_library"
5838 old_convenience="$old_convenience $ladir/$objdir/$old_library"
5839 elif test "$linkmode" != prog && test "$linkmode" != lib; then
5840 func_fatal_error "\`$lib' is not a convenience library"
5843 for deplib in $dependency_libs; do
5844 deplibs="$deplib $deplibs"
5845 if $opt_duplicate_deps ; then
5846 case "$tmp_libs " in
5847 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5850 tmp_libs="$tmp_libs $deplib"
5856 # Get the name of the library we link against.
5858 for l in $old_library $library_names; do
5861 if test -z "$linklib"; then
5862 func_fatal_error "cannot find name of link library for \`$lib'"
5865 # This library was specified with -dlopen.
5866 if test "$pass" = dlopen; then
5867 if test -z "$libdir"; then
5868 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
5870 if test -z "$dlname" ||
5871 test "$dlopen_support" != yes ||
5872 test "$build_libtool_libs" = no; then
5873 # If there is no dlname, no dlopen support or we're linking
5874 # statically, we need to preload. We also need to preload any
5875 # dependent libraries so libltdl's deplib preloader doesn't
5876 # bomb out in the load deplibs phase.
5877 dlprefiles="$dlprefiles $lib $dependency_libs"
5879 newdlfiles="$newdlfiles $lib"
5884 # We need an absolute path.
5886 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
5888 abs_ladir=`cd "$ladir" && pwd`
5889 if test -z "$abs_ladir"; then
5890 func_warning "cannot determine absolute directory name of \`$ladir'"
5891 func_warning "passing it literally to the linker, although it might fail"
5896 func_basename "$lib"
5897 laname="$func_basename_result"
5899 # Find the relevant object directory and library name.
5900 if test "X$installed" = Xyes; then
5901 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5902 func_warning "library \`$lib' was moved."
5910 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
5912 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5915 # Remove this search path later
5916 notinst_path="$notinst_path $abs_ladir"
5918 dir="$ladir/$objdir"
5919 absdir="$abs_ladir/$objdir"
5920 # Remove this search path later
5921 notinst_path="$notinst_path $abs_ladir"
5923 fi # $installed = yes
5924 func_stripname 'lib' '.la' "$laname"
5925 name=$func_stripname_result
5927 # This library was specified with -dlpreopen.
5928 if test "$pass" = dlpreopen; then
5929 if test -z "$libdir" && test "$linkmode" = prog; then
5930 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
5932 # Prefer using a static library (so that no silly _DYNAMIC symbols
5933 # are required to link).
5934 if test -n "$old_library"; then
5935 newdlprefiles="$newdlprefiles $dir/$old_library"
5936 # Keep a list of preopened convenience libraries to check
5937 # that they are being used correctly in the link pass.
5938 test -z "$libdir" && \
5939 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
5940 # Otherwise, use the dlname, so that lt_dlopen finds it.
5941 elif test -n "$dlname"; then
5942 newdlprefiles="$newdlprefiles $dir/$dlname"
5944 newdlprefiles="$newdlprefiles $dir/$linklib"
5946 fi # $pass = dlpreopen
5948 if test -z "$libdir"; then
5949 # Link the convenience library
5950 if test "$linkmode" = lib; then
5951 deplibs="$dir/$old_library $deplibs"
5952 elif test "$linkmode,$pass" = "prog,link"; then
5953 compile_deplibs="$dir/$old_library $compile_deplibs"
5954 finalize_deplibs="$dir/$old_library $finalize_deplibs"
5956 deplibs="$lib $deplibs" # used for prog,scan pass
5962 if test "$linkmode" = prog && test "$pass" != link; then
5963 newlib_search_path="$newlib_search_path $ladir"
5964 deplibs="$lib $deplibs"
5967 if test "$link_all_deplibs" != no || test -z "$library_names" ||
5968 test "$build_libtool_libs" = no; then
5973 for deplib in $dependency_libs; do
5975 -L*) func_stripname '-L' '' "$deplib"
5976 newlib_search_path="$newlib_search_path $func_stripname_result"
5979 # Need to link against all dependency_libs?
5980 if test "$linkalldeplibs" = yes; then
5981 deplibs="$deplib $deplibs"
5983 # Need to hardcode shared library paths
5984 # or/and link against static libraries
5985 newdependency_libs="$deplib $newdependency_libs"
5987 if $opt_duplicate_deps ; then
5988 case "$tmp_libs " in
5989 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5992 tmp_libs="$tmp_libs $deplib"
5995 fi # $linkmode = prog...
5997 if test "$linkmode,$pass" = "prog,link"; then
5998 if test -n "$library_names" &&
5999 { { test "$prefer_static_libs" = no ||
6000 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6001 test -z "$old_library"; }; then
6002 # We need to hardcode the library path
6003 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6004 # Make sure the rpath contains only unique directories.
6005 case "$temp_rpath:" in
6007 *) temp_rpath="$temp_rpath$absdir:" ;;
6011 # Hardcode the library path.
6012 # Skip directories that are in the system default run-time
6014 case " $sys_lib_dlsearch_path " in
6017 case "$compile_rpath " in
6019 *) compile_rpath="$compile_rpath $absdir"
6023 case " $sys_lib_dlsearch_path " in
6026 case "$finalize_rpath " in
6028 *) finalize_rpath="$finalize_rpath $libdir"
6032 fi # $linkmode,$pass = prog,link...
6034 if test "$alldeplibs" = yes &&
6035 { test "$deplibs_check_method" = pass_all ||
6036 { test "$build_libtool_libs" = yes &&
6037 test -n "$library_names"; }; }; then
6038 # We only need to search for static libraries
6043 link_static=no # Whether the deplib will be linked statically
6044 use_static_libs=$prefer_static_libs
6045 if test "$use_static_libs" = built && test "$installed" = yes; then
6048 if test -n "$library_names" &&
6049 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6051 *cygwin* | *mingw* | *cegcc*)
6052 # No point in relinking DLLs because paths are not encoded
6053 notinst_deplibs="$notinst_deplibs $lib"
6057 if test "$installed" = no; then
6058 notinst_deplibs="$notinst_deplibs $lib"
6063 # This is a shared library
6065 # Warn about portability, can't link against -module's on some
6066 # systems (darwin). Don't bleat about dlopened modules though!
6068 for dlpremoduletest in $dlprefiles; do
6069 if test "X$dlpremoduletest" = "X$lib"; then
6070 dlopenmodule="$dlpremoduletest"
6074 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6076 if test "$linkmode" = prog; then
6077 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6079 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6081 $ECHO "*** $linklib is not portable!"
6083 if test "$linkmode" = lib &&
6084 test "$hardcode_into_libs" = yes; then
6085 # Hardcode the library path.
6086 # Skip directories that are in the system default run-time
6088 case " $sys_lib_dlsearch_path " in
6091 case "$compile_rpath " in
6093 *) compile_rpath="$compile_rpath $absdir"
6097 case " $sys_lib_dlsearch_path " in
6100 case "$finalize_rpath " in
6102 *) finalize_rpath="$finalize_rpath $libdir"
6108 if test -n "$old_archive_from_expsyms_cmds"; then
6109 # figure out the soname
6110 set dummy $library_names
6114 libname=`eval "\\$ECHO \"$libname_spec\""`
6115 # use dlname if we got it. it's perfectly good, no?
6116 if test -n "$dlname"; then
6118 elif test -n "$soname_spec"; then
6121 *cygwin* | mingw* | *cegcc*)
6122 func_arith $current - $age
6123 major=$func_arith_result
6127 eval soname=\"$soname_spec\"
6132 # Make a new name for the extract_expsyms_cmds to use
6134 func_basename "$soroot"
6135 soname="$func_basename_result"
6136 func_stripname 'lib' '.dll' "$soname"
6137 newlib=libimp-$func_stripname_result.a
6139 # If the library has no export list, then create one now
6140 if test -f "$output_objdir/$soname-def"; then :
6142 func_verbose "extracting exported symbol list from \`$soname'"
6143 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6147 if test -f "$output_objdir/$newlib"; then :; else
6148 func_verbose "generating import library for \`$soname'"
6149 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6151 # make sure the library variables are pointing to the new library
6154 fi # test -n "$old_archive_from_expsyms_cmds"
6156 if test "$linkmode" = prog || test "$mode" != relink; then
6161 case $hardcode_action in
6162 immediate | unsupported)
6163 if test "$hardcode_direct" = no; then
6166 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6167 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6168 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6169 *-*-unixware7*) add_dir="-L$dir" ;;
6171 # if the lib is a (non-dlopened) module then we can not
6172 # link against it, someone is ignoring the earlier warnings
6173 if /usr/bin/file -L $add 2> /dev/null |
6174 $GREP ": [^:]* bundle" >/dev/null ; then
6175 if test "X$dlopenmodule" != "X$lib"; then
6176 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6177 if test -z "$old_library" ; then
6179 $ECHO "*** And there doesn't seem to be a static archive available"
6180 $ECHO "*** The link will probably fail, sorry"
6182 add="$dir/$old_library"
6184 elif test -n "$old_library"; then
6185 add="$dir/$old_library"
6189 elif test "$hardcode_minus_L" = no; then
6191 *-*-sunos*) add_shlibpath="$dir" ;;
6195 elif test "$hardcode_shlibpath_var" = no; then
6196 add_shlibpath="$dir"
6203 if test "$hardcode_direct" = yes &&
6204 test "$hardcode_direct_absolute" = no; then
6206 elif test "$hardcode_minus_L" = yes; then
6208 # Try looking first in the location we're being installed to.
6209 if test -n "$inst_prefix_dir"; then
6212 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6217 elif test "$hardcode_shlibpath_var" = yes; then
6218 add_shlibpath="$dir"
6227 if test "$lib_linked" != yes; then
6228 func_fatal_configuration "unsupported hardcode properties"
6231 if test -n "$add_shlibpath"; then
6232 case :$compile_shlibpath: in
6233 *":$add_shlibpath:"*) ;;
6234 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
6237 if test "$linkmode" = prog; then
6238 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6239 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6241 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6242 test -n "$add" && deplibs="$add $deplibs"
6243 if test "$hardcode_direct" != yes &&
6244 test "$hardcode_minus_L" != yes &&
6245 test "$hardcode_shlibpath_var" = yes; then
6246 case :$finalize_shlibpath: in
6248 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6254 if test "$linkmode" = prog || test "$mode" = relink; then
6258 # Finalize command for both is simple: just hardcode it.
6259 if test "$hardcode_direct" = yes &&
6260 test "$hardcode_direct_absolute" = no; then
6261 add="$libdir/$linklib"
6262 elif test "$hardcode_minus_L" = yes; then
6265 elif test "$hardcode_shlibpath_var" = yes; then
6266 case :$finalize_shlibpath: in
6268 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6271 elif test "$hardcode_automatic" = yes; then
6272 if test -n "$inst_prefix_dir" &&
6273 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6274 add="$inst_prefix_dir$libdir/$linklib"
6276 add="$libdir/$linklib"
6279 # We cannot seem to hardcode it, guess we'll fake it.
6281 # Try looking first in the location we're being installed to.
6282 if test -n "$inst_prefix_dir"; then
6285 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6292 if test "$linkmode" = prog; then
6293 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6294 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6296 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6297 test -n "$add" && deplibs="$add $deplibs"
6300 elif test "$linkmode" = prog; then
6301 # Here we assume that one of hardcode_direct or hardcode_minus_L
6302 # is not unsupported. This is valid on all known static and
6304 if test "$hardcode_direct" != unsupported; then
6305 test -n "$old_library" && linklib="$old_library"
6306 compile_deplibs="$dir/$linklib $compile_deplibs"
6307 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6309 compile_deplibs="-l$name -L$dir $compile_deplibs"
6310 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6312 elif test "$build_libtool_libs" = yes; then
6313 # Not a shared library
6314 if test "$deplibs_check_method" != pass_all; then
6315 # We're trying link a shared library against a static one
6316 # but the system doesn't support it.
6318 # Just print a warning and add the library to dependency_libs so
6319 # that the program can be linked against the static library.
6321 $ECHO "*** Warning: This system can not link to static lib archive $lib."
6322 $ECHO "*** I have the capability to make that library automatically link in when"
6323 $ECHO "*** you link to this library. But I can only do this if you have a"
6324 $ECHO "*** shared version of the library, which you do not appear to have."
6325 if test "$module" = yes; then
6326 $ECHO "*** But as you try to build a module library, libtool will still create "
6327 $ECHO "*** a static module, that should work as long as the dlopening application"
6328 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
6329 if test -z "$global_symbol_pipe"; then
6331 $ECHO "*** However, this would only work if libtool was able to extract symbol"
6332 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6333 $ECHO "*** not find such a program. So, this module is probably useless."
6334 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6336 if test "$build_old_libs" = no; then
6337 build_libtool_libs=module
6340 build_libtool_libs=no
6344 deplibs="$dir/$old_library $deplibs"
6347 fi # link shared/static library?
6349 if test "$linkmode" = lib; then
6350 if test -n "$dependency_libs" &&
6351 { test "$hardcode_into_libs" != yes ||
6352 test "$build_old_libs" = yes ||
6353 test "$link_static" = yes; }; then
6354 # Extract -R from dependency_libs
6356 for libdir in $dependency_libs; do
6358 -R*) func_stripname '-R' '' "$libdir"
6359 temp_xrpath=$func_stripname_result
6361 *" $temp_xrpath "*) ;;
6362 *) xrpath="$xrpath $temp_xrpath";;
6364 *) temp_deplibs="$temp_deplibs $libdir";;
6367 dependency_libs="$temp_deplibs"
6370 newlib_search_path="$newlib_search_path $absdir"
6371 # Link against this library
6372 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6373 # ... and its dependency_libs
6375 for deplib in $dependency_libs; do
6376 newdependency_libs="$deplib $newdependency_libs"
6377 if $opt_duplicate_deps ; then
6378 case "$tmp_libs " in
6379 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6382 tmp_libs="$tmp_libs $deplib"
6385 if test "$link_all_deplibs" != no; then
6386 # Add the search paths of all dependency libraries
6387 for deplib in $dependency_libs; do
6389 -L*) path="$deplib" ;;
6391 func_dirname "$deplib" "" "."
6392 dir="$func_dirname_result"
6393 # We need an absolute path.
6395 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
6397 absdir=`cd "$dir" && pwd`
6398 if test -z "$absdir"; then
6399 func_warning "cannot determine absolute directory name of \`$dir'"
6404 if $GREP "^installed=no" $deplib > /dev/null; then
6408 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
6409 if test -n "$deplibrary_names" ; then
6410 for tmp in $deplibrary_names ; do
6413 if test -f "$absdir/$objdir/$depdepl" ; then
6414 depdepl="$absdir/$objdir/$depdepl"
6415 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6416 if test -z "$darwin_install_name"; then
6417 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6419 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
6420 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
6426 path="-L$absdir/$objdir"
6430 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6431 test -z "$libdir" && \
6432 func_fatal_error "\`$deplib' is not a valid libtool archive"
6433 test "$absdir" != "$libdir" && \
6434 func_warning "\`$deplib' seems to be moved"
6440 case " $deplibs " in
6442 *) deplibs="$path $deplibs" ;;
6445 fi # link_all_deplibs != no
6447 done # for deplib in $libs
6448 if test "$pass" = link; then
6449 if test "$linkmode" = "prog"; then
6450 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
6451 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
6453 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6456 dependency_libs="$newdependency_libs"
6457 if test "$pass" = dlpreopen; then
6458 # Link the dlpreopened libraries before other libraries
6459 for deplib in $save_deplibs; do
6460 deplibs="$deplib $deplibs"
6463 if test "$pass" != dlopen; then
6464 if test "$pass" != conv; then
6465 # Make sure lib_search_path contains only unique directories.
6467 for dir in $newlib_search_path; do
6468 case "$lib_search_path " in
6470 *) lib_search_path="$lib_search_path $dir" ;;
6476 if test "$linkmode,$pass" != "prog,link"; then
6479 vars="compile_deplibs finalize_deplibs"
6481 for var in $vars dependency_libs; do
6482 # Add libraries to $var in reverse order
6483 eval tmp_libs=\"\$$var\"
6485 for deplib in $tmp_libs; do
6486 # FIXME: Pedantically, this is the right thing to do, so
6487 # that some nasty dependency loop isn't accidentally
6489 #new_libs="$deplib $new_libs"
6490 # Pragmatically, this seems to cause very few problems in
6493 -L*) new_libs="$deplib $new_libs" ;;
6496 # And here is the reason: when a library appears more
6497 # than once as an explicit dependence of a library, or
6498 # is implicitly linked in more than once by the
6499 # compiler, it is considered special, and multiple
6500 # occurrences thereof are not removed. Compare this
6501 # with having the same library being listed as a
6502 # dependency of multiple other libraries: in this case,
6503 # we know (pedantically, we assume) the library does not
6504 # need to be listed more than once, so we keep only the
6505 # last copy. This is not always right, but it is rare
6506 # enough that we require users that really mean to play
6507 # such unportable linking tricks to link the library
6508 # using -Wl,-lname, so that libtool does not consider it
6509 # for duplicate removal.
6510 case " $specialdeplibs " in
6511 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6513 case " $new_libs " in
6515 *) new_libs="$deplib $new_libs" ;;
6523 for deplib in $new_libs; do
6526 case " $tmp_libs " in
6528 *) tmp_libs="$tmp_libs $deplib" ;;
6531 *) tmp_libs="$tmp_libs $deplib" ;;
6534 eval $var=\"$tmp_libs\"
6537 # Last step: remove runtime libs from dependency_libs
6538 # (they stay in deplibs)
6540 for i in $dependency_libs ; do
6541 case " $predeps $postdeps $compiler_lib_search_path " in
6546 if test -n "$i" ; then
6547 tmp_libs="$tmp_libs $i"
6550 dependency_libs=$tmp_libs
6552 if test "$linkmode" = prog; then
6553 dlfiles="$newdlfiles"
6555 if test "$linkmode" = prog || test "$linkmode" = lib; then
6556 dlprefiles="$newdlprefiles"
6561 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6562 func_warning "\`-dlopen' is ignored for archives"
6567 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6570 test -n "$rpath" && \
6571 func_warning "\`-rpath' is ignored for archives"
6573 test -n "$xrpath" && \
6574 func_warning "\`-R' is ignored for archives"
6576 test -n "$vinfo" && \
6577 func_warning "\`-version-info/-version-number' is ignored for archives"
6579 test -n "$release" && \
6580 func_warning "\`-release' is ignored for archives"
6582 test -n "$export_symbols$export_symbols_regex" && \
6583 func_warning "\`-export-symbols' is ignored for archives"
6585 # Now set the variables for building old libraries.
6586 build_libtool_libs=no
6588 objs="$objs$old_deplibs"
6592 # Make sure we only generate libraries of the form `libNAME.la'.
6595 func_stripname 'lib' '.la' "$outputname"
6596 name=$func_stripname_result
6597 eval shared_ext=\"$shrext_cmds\"
6598 eval libname=\"$libname_spec\"
6601 test "$module" = no && \
6602 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6604 if test "$need_lib_prefix" != no; then
6605 # Add the "lib" prefix for modules if required
6606 func_stripname '' '.la' "$outputname"
6607 name=$func_stripname_result
6608 eval shared_ext=\"$shrext_cmds\"
6609 eval libname=\"$libname_spec\"
6611 func_stripname '' '.la' "$outputname"
6612 libname=$func_stripname_result
6617 if test -n "$objs"; then
6618 if test "$deplibs_check_method" != pass_all; then
6619 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6622 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6623 $ECHO "*** objects $objs is not portable!"
6624 libobjs="$libobjs $objs"
6628 test "$dlself" != no && \
6629 func_warning "\`-dlopen self' is ignored for libtool libraries"
6633 test "$#" -gt 1 && \
6634 func_warning "ignoring multiple \`-rpath's for a libtool library"
6639 if test -z "$rpath"; then
6640 if test "$build_libtool_libs" = yes; then
6641 # Building a libtool convenience library.
6642 # Some compilers have problems with a `.al' extension so
6643 # convenience libraries should have the same extension an
6644 # archive normally would.
6645 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6646 build_libtool_libs=convenience
6650 test -n "$vinfo" && \
6651 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6653 test -n "$release" && \
6654 func_warning "\`-release' is ignored for convenience libraries"
6657 # Parse the version information argument.
6658 save_ifs="$IFS"; IFS=':'
6659 set dummy $vinfo 0 0 0
6664 func_fatal_help "too many parameters to \`-version-info'"
6666 # convert absolute version numbers to libtool ages
6667 # this retains compatibility with .la files and attempts
6668 # to make the code below a bit more comprehensible
6670 case $vinfo_number in
6674 number_revision="$3"
6676 # There are really only two kinds -- those that
6677 # use the current revision as the major version
6678 # and those that subtract age and use age as
6679 # a minor version. But, then there is irix
6680 # which has an extra 1 added just for fun
6682 case $version_type in
6683 darwin|linux|osf|windows|none)
6684 func_arith $number_major + $number_minor
6685 current=$func_arith_result
6687 revision="$number_revision"
6689 freebsd-aout|freebsd-elf|sunos)
6690 current="$number_major"
6691 revision="$number_minor"
6695 func_arith $number_major + $number_minor
6696 current=$func_arith_result
6698 revision="$number_minor"
6699 lt_irix_increment=no
6710 # Check that each of the things are valid numbers.
6712 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]) ;;
6714 func_error "CURRENT \`$current' must be a nonnegative integer"
6715 func_fatal_error "\`$vinfo' is not valid version information"
6720 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]) ;;
6722 func_error "REVISION \`$revision' must be a nonnegative integer"
6723 func_fatal_error "\`$vinfo' is not valid version information"
6728 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]) ;;
6730 func_error "AGE \`$age' must be a nonnegative integer"
6731 func_fatal_error "\`$vinfo' is not valid version information"
6735 if test "$age" -gt "$current"; then
6736 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6737 func_fatal_error "\`$vinfo' is not valid version information"
6740 # Calculate the version variables.
6744 case $version_type in
6748 # Like Linux, but with the current version available in
6749 # verstring for coding it into the library header
6750 func_arith $current - $age
6751 major=.$func_arith_result
6752 versuffix="$major.$age.$revision"
6753 # Darwin ld doesn't like 0 for these options...
6754 func_arith $current + 1
6755 minor_current=$func_arith_result
6756 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6757 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6762 versuffix=".$current.$revision";
6767 versuffix=".$current"
6771 if test "X$lt_irix_increment" = "Xno"; then
6772 func_arith $current - $age
6774 func_arith $current - $age + 1
6776 major=$func_arith_result
6778 case $version_type in
6779 nonstopux) verstring_prefix=nonstopux ;;
6780 *) verstring_prefix=sgi ;;
6782 verstring="$verstring_prefix$major.$revision"
6784 # Add in all the interfaces that we are compatible with.
6786 while test "$loop" -ne 0; do
6787 func_arith $revision - $loop
6788 iface=$func_arith_result
6789 func_arith $loop - 1
6790 loop=$func_arith_result
6791 verstring="$verstring_prefix$major.$iface:$verstring"
6794 # Before this point, $major must not contain `.'.
6796 versuffix="$major.$revision"
6800 func_arith $current - $age
6801 major=.$func_arith_result
6802 versuffix="$major.$age.$revision"
6806 func_arith $current - $age
6807 major=.$func_arith_result
6808 versuffix=".$current.$age.$revision"
6809 verstring="$current.$age.$revision"
6811 # Add in all the interfaces that we are compatible with.
6813 while test "$loop" -ne 0; do
6814 func_arith $current - $loop
6815 iface=$func_arith_result
6816 func_arith $loop - 1
6817 loop=$func_arith_result
6818 verstring="$verstring:${iface}.0"
6821 # Make executables depend on our current version.
6822 verstring="$verstring:${current}.0"
6827 versuffix=".$current"
6832 versuffix=".$current.$revision"
6836 # Use '-' rather than '.', since we only want one
6837 # extension on DOS 8.3 filesystems.
6838 func_arith $current - $age
6839 major=$func_arith_result
6844 func_fatal_configuration "unknown library version type \`$version_type'"
6848 # Clear the version info if we defaulted, and they specified a release.
6849 if test -z "$vinfo" && test -n "$release"; then
6851 case $version_type in
6853 # we can't check for "0.0" in archive_cmds due to quoting
6854 # problems, so we reset it completely
6861 if test "$need_version" = no; then
6868 # Remove version info from name if versioning should be avoided
6869 if test "$avoid_version" = yes && test "$need_version" = no; then
6875 # Check to see if the archive will have undefined symbols.
6876 if test "$allow_undefined" = yes; then
6877 if test "$allow_undefined_flag" = unsupported; then
6878 func_warning "undefined symbols not allowed in $host shared libraries"
6879 build_libtool_libs=no
6883 # Don't allow undefined symbols.
6884 allow_undefined_flag="$no_undefined_flag"
6889 func_generate_dlsyms "$libname" "$libname" "yes"
6890 libobjs="$libobjs $symfileobj"
6891 test "X$libobjs" = "X " && libobjs=
6893 if test "$mode" != relink; then
6894 # Remove our outputs, but don't remove object files since they
6895 # may have been created when compiling PIC objects.
6897 tempremovelist=`$ECHO "$output_objdir/*"`
6898 for p in $tempremovelist; do
6902 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
6903 if test "X$precious_files_regex" != "X"; then
6904 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6909 removelist="$removelist $p"
6914 test -n "$removelist" && \
6915 func_show_eval "${RM}r \$removelist"
6918 # Now set the variables for building old libraries.
6919 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
6920 oldlibs="$oldlibs $output_objdir/$libname.$libext"
6922 # Transform .lo files to .o files.
6923 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
6926 # Eliminate all temporary directories.
6927 #for path in $notinst_path; do
6928 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
6929 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
6930 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
6933 if test -n "$xrpath"; then
6934 # If the user specified any rpath flags, then add them.
6936 for libdir in $xrpath; do
6937 temp_xrpath="$temp_xrpath -R$libdir"
6938 case "$finalize_rpath " in
6940 *) finalize_rpath="$finalize_rpath $libdir" ;;
6943 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
6944 dependency_libs="$temp_xrpath $dependency_libs"
6948 # Make sure dlfiles contains only unique files that won't be dlpreopened
6949 old_dlfiles="$dlfiles"
6951 for lib in $old_dlfiles; do
6952 case " $dlprefiles $dlfiles " in
6954 *) dlfiles="$dlfiles $lib" ;;
6958 # Make sure dlprefiles contains only unique files
6959 old_dlprefiles="$dlprefiles"
6961 for lib in $old_dlprefiles; do
6962 case "$dlprefiles " in
6964 *) dlprefiles="$dlprefiles $lib" ;;
6968 if test "$build_libtool_libs" = yes; then
6969 if test -n "$rpath"; then
6971 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
6972 # these systems don't actually have a c library (as such)!
6974 *-*-rhapsody* | *-*-darwin1.[012])
6975 # Rhapsody C library is in the System framework
6976 deplibs="$deplibs System.ltframework"
6979 # Don't link with libc until the a.out ld.so is fixed.
6981 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6982 # Do not include libc due to us having libc/libc_r.
6984 *-*-sco3.2v5* | *-*-sco5v6*)
6985 # Causes problems with __ctype
6987 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6988 # Compiler inserts libc in the correct place for threads to work
6991 # Add libc to deplibs on all other systems if necessary.
6992 if test "$build_libtool_need_lc" = "yes"; then
6993 deplibs="$deplibs -lc"
6999 # Transform deplibs into only deplibs that can be linked in shared.
7001 libname_save=$libname
7002 release_save=$release
7003 versuffix_save=$versuffix
7005 # I'm not sure if I'm treating the release correctly. I think
7006 # release should show up in the -l (ie -lgmp5) so we don't want to
7007 # add it in twice. Is that correct?
7013 case $deplibs_check_method in
7015 # Don't check for shared/static. Everything works.
7016 # This might be a little naive. We might want to check
7017 # whether the library exists or not. But this is on
7018 # osf3 & osf4 and I'm not really sure... Just
7019 # implementing what was already the behavior.
7023 # This code stresses the "libraries are programs" paradigm to its
7024 # limits. Maybe even breaks it. We compile a program, linking it
7025 # against the deplibs as a proxy for the library. Then we can check
7026 # whether they linked in statically or dynamically with ldd.
7027 $opt_dry_run || $RM conftest.c
7028 cat > conftest.c <<EOF
7029 int main() { return 0; }
7031 $opt_dry_run || $RM conftest
7032 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7033 ldd_output=`ldd conftest`
7034 for i in $deplibs; do
7037 func_stripname -l '' "$i"
7038 name=$func_stripname_result
7039 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7040 case " $predeps $postdeps " in
7042 newdeplibs="$newdeplibs $i"
7047 if test -n "$i" ; then
7048 libname=`eval "\\$ECHO \"$libname_spec\""`
7049 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7050 set dummy $deplib_matches; shift
7052 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7053 newdeplibs="$newdeplibs $i"
7057 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7058 $ECHO "*** I have the capability to make that library automatically link in when"
7059 $ECHO "*** you link to this library. But I can only do this if you have a"
7060 $ECHO "*** shared version of the library, which I believe you do not have"
7061 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
7062 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
7067 newdeplibs="$newdeplibs $i"
7072 # Error occurred in the first compile. Let's try to salvage
7073 # the situation: Compile a separate program for each library.
7074 for i in $deplibs; do
7077 func_stripname -l '' "$i"
7078 name=$func_stripname_result
7079 $opt_dry_run || $RM conftest
7080 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7081 ldd_output=`ldd conftest`
7082 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7083 case " $predeps $postdeps " in
7085 newdeplibs="$newdeplibs $i"
7090 if test -n "$i" ; then
7091 libname=`eval "\\$ECHO \"$libname_spec\""`
7092 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7093 set dummy $deplib_matches; shift
7095 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7096 newdeplibs="$newdeplibs $i"
7100 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7101 $ECHO "*** I have the capability to make that library automatically link in when"
7102 $ECHO "*** you link to this library. But I can only do this if you have a"
7103 $ECHO "*** shared version of the library, which you do not appear to have"
7104 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
7105 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
7111 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7112 $ECHO "*** make it link in! You will probably need to install it or some"
7113 $ECHO "*** library that it depends on before this library will be fully"
7114 $ECHO "*** functional. Installing it before continuing would be even better."
7118 newdeplibs="$newdeplibs $i"
7125 set dummy $deplibs_check_method; shift
7126 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7127 for a_deplib in $deplibs; do
7130 func_stripname -l '' "$a_deplib"
7131 name=$func_stripname_result
7132 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7133 case " $predeps $postdeps " in
7135 newdeplibs="$newdeplibs $a_deplib"
7140 if test -n "$a_deplib" ; then
7141 libname=`eval "\\$ECHO \"$libname_spec\""`
7142 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7143 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7144 for potent_lib in $potential_libs; do
7145 # Follow soft links.
7146 if ls -lLd "$potent_lib" 2>/dev/null |
7147 $GREP " -> " >/dev/null; then
7150 # The statement above tries to avoid entering an
7151 # endless loop below, in case of cyclic links.
7152 # We might still enter an endless loop, since a link
7153 # loop can be closed while we follow links,
7155 potlib="$potent_lib"
7156 while test -h "$potlib" 2>/dev/null; do
7157 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7159 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7160 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
7163 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7165 $EGREP "$file_magic_regex" > /dev/null; then
7166 newdeplibs="$newdeplibs $a_deplib"
7173 if test -n "$a_deplib" ; then
7176 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7177 $ECHO "*** I have the capability to make that library automatically link in when"
7178 $ECHO "*** you link to this library. But I can only do this if you have a"
7179 $ECHO "*** shared version of the library, which you do not appear to have"
7180 $ECHO "*** because I did check the linker path looking for a file starting"
7181 if test -z "$potlib" ; then
7182 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7184 $ECHO "*** with $libname and none of the candidates passed a file format test"
7185 $ECHO "*** using a file magic. Last file checked: $potlib"
7190 # Add a -L argument.
7191 newdeplibs="$newdeplibs $a_deplib"
7194 done # Gone through all deplibs.
7197 set dummy $deplibs_check_method; shift
7198 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7199 for a_deplib in $deplibs; do
7202 func_stripname -l '' "$a_deplib"
7203 name=$func_stripname_result
7204 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7205 case " $predeps $postdeps " in
7207 newdeplibs="$newdeplibs $a_deplib"
7212 if test -n "$a_deplib" ; then
7213 libname=`eval "\\$ECHO \"$libname_spec\""`
7214 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7215 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7216 for potent_lib in $potential_libs; do
7217 potlib="$potent_lib" # see symlink-check above in file_magic test
7218 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
7219 $EGREP "$match_pattern_regex" > /dev/null; then
7220 newdeplibs="$newdeplibs $a_deplib"
7227 if test -n "$a_deplib" ; then
7230 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7231 $ECHO "*** I have the capability to make that library automatically link in when"
7232 $ECHO "*** you link to this library. But I can only do this if you have a"
7233 $ECHO "*** shared version of the library, which you do not appear to have"
7234 $ECHO "*** because I did check the linker path looking for a file starting"
7235 if test -z "$potlib" ; then
7236 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7238 $ECHO "*** with $libname and none of the candidates passed a file format test"
7239 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7244 # Add a -L argument.
7245 newdeplibs="$newdeplibs $a_deplib"
7248 done # Gone through all deplibs.
7252 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
7253 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
7254 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7255 for i in $predeps $postdeps ; do
7256 # can't use Xsed below, because $i might contain '/'
7257 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
7260 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
7261 $GREP . >/dev/null; then
7263 if test "X$deplibs_check_method" = "Xnone"; then
7264 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
7266 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
7268 $ECHO "*** All declared inter-library dependencies are being dropped."
7273 versuffix=$versuffix_save
7275 release=$release_save
7276 libname=$libname_save
7280 *-*-rhapsody* | *-*-darwin1.[012])
7281 # On Rhapsody replace the C library with the System framework
7282 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7286 if test "$droppeddeps" = yes; then
7287 if test "$module" = yes; then
7289 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
7290 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7291 $ECHO "*** a static module, that should work as long as the dlopening"
7292 $ECHO "*** application is linked with the -dlopen flag."
7293 if test -z "$global_symbol_pipe"; then
7295 $ECHO "*** However, this would only work if libtool was able to extract symbol"
7296 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
7297 $ECHO "*** not find such a program. So, this module is probably useless."
7298 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
7300 if test "$build_old_libs" = no; then
7301 oldlibs="$output_objdir/$libname.$libext"
7302 build_libtool_libs=module
7305 build_libtool_libs=no
7308 $ECHO "*** The inter-library dependencies that have been dropped here will be"
7309 $ECHO "*** automatically added whenever a program is linked with this library"
7310 $ECHO "*** or is declared to -dlopen it."
7312 if test "$allow_undefined" = no; then
7314 $ECHO "*** Since this library must not contain undefined symbols,"
7315 $ECHO "*** because either the platform does not support them or"
7316 $ECHO "*** it was explicitly requested with -no-undefined,"
7317 $ECHO "*** libtool will only create a static version of it."
7318 if test "$build_old_libs" = no; then
7319 oldlibs="$output_objdir/$libname.$libext"
7320 build_libtool_libs=module
7323 build_libtool_libs=no
7328 # Done checking deplibs!
7331 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7334 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7335 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7336 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7340 # move library search paths that coincide with paths to not yet
7341 # installed libraries to the beginning of the library search list
7343 for path in $notinst_path; do
7344 case " $new_libs " in
7345 *" -L$path/$objdir "*) ;;
7347 case " $deplibs " in
7348 *" -L$path/$objdir "*)
7349 new_libs="$new_libs -L$path/$objdir" ;;
7354 for deplib in $deplibs; do
7357 case " $new_libs " in
7359 *) new_libs="$new_libs $deplib" ;;
7362 *) new_libs="$new_libs $deplib" ;;
7367 # All the library-specific variables (install_libdir is set above).
7372 # Test again, we may have decided not to build it any more
7373 if test "$build_libtool_libs" = yes; then
7374 if test "$hardcode_into_libs" = yes; then
7375 # Hardcode the library paths
7378 rpath="$finalize_rpath"
7379 test "$mode" != relink && rpath="$compile_rpath$rpath"
7380 for libdir in $rpath; do
7381 if test -n "$hardcode_libdir_flag_spec"; then
7382 if test -n "$hardcode_libdir_separator"; then
7383 if test -z "$hardcode_libdirs"; then
7384 hardcode_libdirs="$libdir"
7386 # Just accumulate the unique libdirs.
7387 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7388 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7391 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7396 eval flag=\"$hardcode_libdir_flag_spec\"
7397 dep_rpath="$dep_rpath $flag"
7399 elif test -n "$runpath_var"; then
7400 case "$perm_rpath " in
7402 *) perm_rpath="$perm_rpath $libdir" ;;
7406 # Substitute the hardcoded libdirs into the rpath.
7407 if test -n "$hardcode_libdir_separator" &&
7408 test -n "$hardcode_libdirs"; then
7409 libdir="$hardcode_libdirs"
7410 if test -n "$hardcode_libdir_flag_spec_ld"; then
7411 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
7413 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
7416 if test -n "$runpath_var" && test -n "$perm_rpath"; then
7417 # We should set the runpath_var.
7419 for dir in $perm_rpath; do
7422 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
7424 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
7427 shlibpath="$finalize_shlibpath"
7428 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
7429 if test -n "$shlibpath"; then
7430 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
7433 # Get the real and link names of the library.
7434 eval shared_ext=\"$shrext_cmds\"
7435 eval library_names=\"$library_names_spec\"
7436 set dummy $library_names
7441 if test -n "$soname_spec"; then
7442 eval soname=\"$soname_spec\"
7446 if test -z "$dlname"; then
7450 lib="$output_objdir/$realname"
7454 linknames="$linknames $link"
7457 # Use standard objects if they are pic
7458 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7459 test "X$libobjs" = "X " && libobjs=
7462 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7463 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
7464 export_symbols="$output_objdir/$libname.uexp"
7465 delfiles="$delfiles $export_symbols"
7468 orig_export_symbols=
7470 cygwin* | mingw* | cegcc*)
7471 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
7472 # exporting using user supplied symfile
7473 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
7474 # and it's NOT already a .def file. Must figure out
7475 # which of the given symbols are data symbols and tag
7476 # them as such. So, trigger use of export_symbols_cmds.
7477 # export_symbols gets reassigned inside the "prepare
7478 # the list of exported symbols" if statement, so the
7479 # include_expsyms logic still works.
7480 orig_export_symbols="$export_symbols"
7482 always_export_symbols=yes
7488 # Prepare the list of exported symbols
7489 if test -z "$export_symbols"; then
7490 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7491 func_verbose "generating symbol list for \`$libname.la'"
7492 export_symbols="$output_objdir/$libname.exp"
7493 $opt_dry_run || $RM $export_symbols
7494 cmds=$export_symbols_cmds
7495 save_ifs="$IFS"; IFS='~'
7496 for cmd in $cmds; do
7500 len=$func_len_result
7501 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7502 func_show_eval "$cmd" 'exit $?'
7503 skipped_export=false
7505 # The command line is too long to execute in one step.
7506 func_verbose "using reloadable object file for export list..."
7508 # Break out early, otherwise skipped_export may be
7509 # set to false by a later but shorter cmd.
7514 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7515 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7516 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7521 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7522 tmp_export_symbols="$export_symbols"
7523 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7524 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7527 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7528 # The given exports_symbols file has to be filtered, so filter it.
7529 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7530 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7531 # 's' commands which not all seds can handle. GNU sed should be fine
7532 # though. Also, the filter scales superlinearly with the number of
7533 # global variables. join(1) would be nice here, but unfortunately
7534 # isn't a blessed tool.
7535 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7536 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7537 export_symbols=$output_objdir/$libname.def
7538 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7542 for test_deplib in $deplibs; do
7543 case " $convenience " in
7544 *" $test_deplib "*) ;;
7546 tmp_deplibs="$tmp_deplibs $test_deplib"
7550 deplibs="$tmp_deplibs"
7552 if test -n "$convenience"; then
7553 if test -n "$whole_archive_flag_spec" &&
7554 test "$compiler_needs_object" = yes &&
7555 test -z "$libobjs"; then
7556 # extract the archives, so we have objects to list.
7557 # TODO: could optimize this to just extract one archive.
7558 whole_archive_flag_spec=
7560 if test -n "$whole_archive_flag_spec"; then
7561 save_libobjs=$libobjs
7562 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7563 test "X$libobjs" = "X " && libobjs=
7565 gentop="$output_objdir/${outputname}x"
7566 generated="$generated $gentop"
7568 func_extract_archives $gentop $convenience
7569 libobjs="$libobjs $func_extract_archives_result"
7570 test "X$libobjs" = "X " && libobjs=
7574 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7575 eval flag=\"$thread_safe_flag_spec\"
7576 linker_flags="$linker_flags $flag"
7579 # Make a backup of the uninstalled library when relinking
7580 if test "$mode" = relink; then
7581 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7584 # Do each of the archive commands.
7585 if test "$module" = yes && test -n "$module_cmds" ; then
7586 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7587 eval test_cmds=\"$module_expsym_cmds\"
7588 cmds=$module_expsym_cmds
7590 eval test_cmds=\"$module_cmds\"
7594 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7595 eval test_cmds=\"$archive_expsym_cmds\"
7596 cmds=$archive_expsym_cmds
7598 eval test_cmds=\"$archive_cmds\"
7603 if test "X$skipped_export" != "X:" &&
7604 func_len " $test_cmds" &&
7605 len=$func_len_result &&
7606 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7609 # The command line is too long to link in one step, link piecewise
7610 # or, if using GNU ld and skipped_export is not :, use a linker
7613 # Save the value of $output and $libobjs because we want to
7614 # use them later. If we have whole_archive_flag_spec, we
7615 # want to use save_libobjs as it was before
7616 # whole_archive_flag_spec was expanded, because we can't
7617 # assume the linker understands whole_archive_flag_spec.
7618 # This may have to be revisited, in case too many
7619 # convenience libraries get linked in and end up exceeding
7621 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7622 save_libobjs=$libobjs
7625 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
7627 # Clear the reloadable object creation command queue and
7628 # initialize k to one.
7635 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7636 output=${output_objdir}/${output_la}.lnkscript
7637 func_verbose "creating GNU ld script: $output"
7638 $ECHO 'INPUT (' > $output
7639 for obj in $save_libobjs
7641 $ECHO "$obj" >> $output
7643 $ECHO ')' >> $output
7644 delfiles="$delfiles $output"
7645 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7646 output=${output_objdir}/${output_la}.lnk
7647 func_verbose "creating linker input file list: $output"
7652 if test "$compiler_needs_object" = yes; then
7658 $ECHO "$obj" >> $output
7660 delfiles="$delfiles $output"
7661 output=$firstobj\"$file_list_spec$output\"
7663 if test -n "$save_libobjs"; then
7664 func_verbose "creating reloadable object files..."
7665 output=$output_objdir/$output_la-${k}.$objext
7666 eval test_cmds=\"$reload_cmds\"
7667 func_len " $test_cmds"
7668 len0=$func_len_result
7671 # Loop over the list of objects to be linked.
7672 for obj in $save_libobjs
7675 func_arith $len + $func_len_result
7676 len=$func_arith_result
7677 if test "X$objlist" = X ||
7678 test "$len" -lt "$max_cmd_len"; then
7679 func_append objlist " $obj"
7681 # The command $test_cmds is almost too long, add a
7682 # command to the queue.
7683 if test "$k" -eq 1 ; then
7684 # The first file doesn't have a previous command to add.
7685 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
7687 # All subsequent reloadable object files will link in
7688 # the last one created.
7689 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
7691 last_robj=$output_objdir/$output_la-${k}.$objext
7693 k=$func_arith_result
7694 output=$output_objdir/$output_la-${k}.$objext
7696 func_len " $last_robj"
7697 func_arith $len0 + $func_len_result
7698 len=$func_arith_result
7701 # Handle the remaining objects by creating one last
7702 # reloadable object file. All subsequent reloadable object
7703 # files will link in the last one created.
7704 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7705 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
7706 if test -n "$last_robj"; then
7707 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7709 delfiles="$delfiles $output"
7715 if ${skipped_export-false}; then
7716 func_verbose "generating symbol list for \`$libname.la'"
7717 export_symbols="$output_objdir/$libname.exp"
7718 $opt_dry_run || $RM $export_symbols
7720 # Append the command to create the export file.
7721 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7722 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7723 if test -n "$last_robj"; then
7724 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7728 test -n "$save_libobjs" &&
7729 func_verbose "creating a temporary reloadable object file: $output"
7731 # Loop through the commands generated above and execute them.
7732 save_ifs="$IFS"; IFS='~'
7733 for cmd in $concat_cmds; do
7736 func_quote_for_expand "$cmd"
7737 eval "func_echo $func_quote_for_expand_result"
7739 $opt_dry_run || eval "$cmd" || {
7742 # Restore the uninstalled library and exit
7743 if test "$mode" = relink; then
7744 ( cd "$output_objdir" && \
7745 $RM "${realname}T" && \
7746 $MV "${realname}U" "$realname" )
7754 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7755 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7756 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7760 if ${skipped_export-false}; then
7761 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7762 tmp_export_symbols="$export_symbols"
7763 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7764 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7767 if test -n "$orig_export_symbols"; then
7768 # The given exports_symbols file has to be filtered, so filter it.
7769 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7770 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7771 # 's' commands which not all seds can handle. GNU sed should be fine
7772 # though. Also, the filter scales superlinearly with the number of
7773 # global variables. join(1) would be nice here, but unfortunately
7774 # isn't a blessed tool.
7775 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7776 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7777 export_symbols=$output_objdir/$libname.def
7778 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7783 # Restore the value of output.
7786 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
7787 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7788 test "X$libobjs" = "X " && libobjs=
7790 # Expand the library linking commands again to reset the
7791 # value of $libobjs for piecewise linking.
7793 # Do each of the archive commands.
7794 if test "$module" = yes && test -n "$module_cmds" ; then
7795 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7796 cmds=$module_expsym_cmds
7801 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7802 cmds=$archive_expsym_cmds
7809 if test -n "$delfiles"; then
7810 # Append the command to remove temporary files to $cmds.
7811 eval cmds=\"\$cmds~\$RM $delfiles\"
7814 # Add any objects from preloaded convenience libraries
7815 if test -n "$dlprefiles"; then
7816 gentop="$output_objdir/${outputname}x"
7817 generated="$generated $gentop"
7819 func_extract_archives $gentop $dlprefiles
7820 libobjs="$libobjs $func_extract_archives_result"
7821 test "X$libobjs" = "X " && libobjs=
7824 save_ifs="$IFS"; IFS='~'
7825 for cmd in $cmds; do
7829 func_quote_for_expand "$cmd"
7830 eval "func_echo $func_quote_for_expand_result"
7832 $opt_dry_run || eval "$cmd" || {
7835 # Restore the uninstalled library and exit
7836 if test "$mode" = relink; then
7837 ( cd "$output_objdir" && \
7838 $RM "${realname}T" && \
7839 $MV "${realname}U" "$realname" )
7847 # Restore the uninstalled library and exit
7848 if test "$mode" = relink; then
7849 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
7851 if test -n "$convenience"; then
7852 if test -z "$whole_archive_flag_spec"; then
7853 func_show_eval '${RM}r "$gentop"'
7860 # Create links to the real library.
7861 for linkname in $linknames; do
7862 if test "$realname" != "$linkname"; then
7863 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
7867 # If -module or -export-dynamic was specified, set the dlname.
7868 if test "$module" = yes || test "$export_dynamic" = yes; then
7869 # On all known operating systems, these are identical.
7876 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7877 func_warning "\`-dlopen' is ignored for objects"
7882 func_warning "\`-l' and \`-L' are ignored for objects" ;;
7885 test -n "$rpath" && \
7886 func_warning "\`-rpath' is ignored for objects"
7888 test -n "$xrpath" && \
7889 func_warning "\`-R' is ignored for objects"
7891 test -n "$vinfo" && \
7892 func_warning "\`-version-info' is ignored for objects"
7894 test -n "$release" && \
7895 func_warning "\`-release' is ignored for objects"
7899 test -n "$objs$old_deplibs" && \
7900 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
7904 obj=$func_lo2o_result
7912 # Delete the old objects.
7913 $opt_dry_run || $RM $obj $libobj
7915 # Objects from convenience libraries. This assumes
7916 # single-version convenience libraries. Whenever we create
7917 # different ones for PIC/non-PIC, this we'll have to duplicate
7921 # reload_cmds runs $LD directly, so let us get rid of
7922 # -Wl from whole_archive_flag_spec and hope we can get by with
7923 # turning comma into space..
7926 if test -n "$convenience"; then
7927 if test -n "$whole_archive_flag_spec"; then
7928 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
7929 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
7931 gentop="$output_objdir/${obj}x"
7932 generated="$generated $gentop"
7934 func_extract_archives $gentop $convenience
7935 reload_conv_objs="$reload_objs $func_extract_archives_result"
7939 # Create the old-style object.
7940 reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
7943 func_execute_cmds "$reload_cmds" 'exit $?'
7945 # Exit if we aren't doing a library object file.
7946 if test -z "$libobj"; then
7947 if test -n "$gentop"; then
7948 func_show_eval '${RM}r "$gentop"'
7954 if test "$build_libtool_libs" != yes; then
7955 if test -n "$gentop"; then
7956 func_show_eval '${RM}r "$gentop"'
7959 # Create an invalid libtool object if no PIC, so that we don't
7960 # accidentally link it into a program.
7961 # $show "echo timestamp > $libobj"
7962 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
7966 if test -n "$pic_flag" || test "$pic_mode" != default; then
7967 # Only do commands if we really have different PIC objects.
7968 reload_objs="$libobjs $reload_conv_objs"
7970 func_execute_cmds "$reload_cmds" 'exit $?'
7973 if test -n "$gentop"; then
7974 func_show_eval '${RM}r "$gentop"'
7982 *cygwin*) func_stripname '' '.exe' "$output"
7983 output=$func_stripname_result.exe;;
7985 test -n "$vinfo" && \
7986 func_warning "\`-version-info' is ignored for programs"
7988 test -n "$release" && \
7989 func_warning "\`-release' is ignored for programs"
7991 test "$preload" = yes \
7992 && test "$dlopen_support" = unknown \
7993 && test "$dlopen_self" = unknown \
7994 && test "$dlopen_self_static" = unknown && \
7995 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
7998 *-*-rhapsody* | *-*-darwin1.[012])
7999 # On Rhapsody replace the C library is the System framework
8000 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
8001 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
8007 # Don't allow lazy linking, it breaks C++ global constructors
8008 # But is supposedly fixed on 10.4 or later (yay!).
8009 if test "$tagname" = CXX ; then
8010 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8012 compile_command="$compile_command ${wl}-bind_at_load"
8013 finalize_command="$finalize_command ${wl}-bind_at_load"
8017 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8018 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
8019 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
8024 # move library search paths that coincide with paths to not yet
8025 # installed libraries to the beginning of the library search list
8027 for path in $notinst_path; do
8028 case " $new_libs " in
8029 *" -L$path/$objdir "*) ;;
8031 case " $compile_deplibs " in
8032 *" -L$path/$objdir "*)
8033 new_libs="$new_libs -L$path/$objdir" ;;
8038 for deplib in $compile_deplibs; do
8041 case " $new_libs " in
8043 *) new_libs="$new_libs $deplib" ;;
8046 *) new_libs="$new_libs $deplib" ;;
8049 compile_deplibs="$new_libs"
8052 compile_command="$compile_command $compile_deplibs"
8053 finalize_command="$finalize_command $finalize_deplibs"
8055 if test -n "$rpath$xrpath"; then
8056 # If the user specified any rpath flags, then add them.
8057 for libdir in $rpath $xrpath; do
8058 # This is the magic to use -rpath.
8059 case "$finalize_rpath " in
8061 *) finalize_rpath="$finalize_rpath $libdir" ;;
8066 # Now hardcode the library paths
8069 for libdir in $compile_rpath $finalize_rpath; do
8070 if test -n "$hardcode_libdir_flag_spec"; then
8071 if test -n "$hardcode_libdir_separator"; then
8072 if test -z "$hardcode_libdirs"; then
8073 hardcode_libdirs="$libdir"
8075 # Just accumulate the unique libdirs.
8076 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8077 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8080 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8085 eval flag=\"$hardcode_libdir_flag_spec\"
8086 rpath="$rpath $flag"
8088 elif test -n "$runpath_var"; then
8089 case "$perm_rpath " in
8091 *) perm_rpath="$perm_rpath $libdir" ;;
8095 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8096 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8097 case :$dllsearchpath: in
8099 ::) dllsearchpath=$libdir;;
8100 *) dllsearchpath="$dllsearchpath:$libdir";;
8102 case :$dllsearchpath: in
8103 *":$testbindir:"*) ;;
8104 ::) dllsearchpath=$testbindir;;
8105 *) dllsearchpath="$dllsearchpath:$testbindir";;
8110 # Substitute the hardcoded libdirs into the rpath.
8111 if test -n "$hardcode_libdir_separator" &&
8112 test -n "$hardcode_libdirs"; then
8113 libdir="$hardcode_libdirs"
8114 eval rpath=\" $hardcode_libdir_flag_spec\"
8116 compile_rpath="$rpath"
8120 for libdir in $finalize_rpath; do
8121 if test -n "$hardcode_libdir_flag_spec"; then
8122 if test -n "$hardcode_libdir_separator"; then
8123 if test -z "$hardcode_libdirs"; then
8124 hardcode_libdirs="$libdir"
8126 # Just accumulate the unique libdirs.
8127 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8128 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8131 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8136 eval flag=\"$hardcode_libdir_flag_spec\"
8137 rpath="$rpath $flag"
8139 elif test -n "$runpath_var"; then
8140 case "$finalize_perm_rpath " in
8142 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
8146 # Substitute the hardcoded libdirs into the rpath.
8147 if test -n "$hardcode_libdir_separator" &&
8148 test -n "$hardcode_libdirs"; then
8149 libdir="$hardcode_libdirs"
8150 eval rpath=\" $hardcode_libdir_flag_spec\"
8152 finalize_rpath="$rpath"
8154 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8155 # Transform all the library objects into standard objects.
8156 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
8157 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
8160 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8162 # template prelinking step
8163 if test -n "$prelink_cmds"; then
8164 func_execute_cmds "$prelink_cmds" 'exit $?'
8167 wrappers_required=yes
8169 *cygwin* | *mingw* )
8170 if test "$build_libtool_libs" != yes; then
8171 wrappers_required=no
8175 # Disable wrappers for cegcc, we are cross compiling anyway.
8176 wrappers_required=no
8179 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8180 wrappers_required=no
8184 if test "$wrappers_required" = no; then
8185 # Replace the output file specification.
8186 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
8187 link_command="$compile_command$compile_rpath"
8189 # We have no uninstalled library dependencies, so finalize right now.
8191 func_show_eval "$link_command" 'exit_status=$?'
8193 # Delete the generated files.
8194 if test -f "$output_objdir/${outputname}S.${objext}"; then
8195 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8201 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8202 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8204 if test -n "$finalize_shlibpath"; then
8205 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8210 if test -n "$runpath_var"; then
8211 if test -n "$perm_rpath"; then
8212 # We should set the runpath_var.
8214 for dir in $perm_rpath; do
8217 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8219 if test -n "$finalize_perm_rpath"; then
8220 # We should set the runpath_var.
8222 for dir in $finalize_perm_rpath; do
8225 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8229 if test "$no_install" = yes; then
8230 # We don't need to create a wrapper script.
8231 link_command="$compile_var$compile_command$compile_rpath"
8232 # Replace the output file specification.
8233 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
8234 # Delete the old output file.
8235 $opt_dry_run || $RM $output
8236 # Link the executable and exit
8237 func_show_eval "$link_command" 'exit $?'
8241 if test "$hardcode_action" = relink; then
8242 # Fast installation is not supported
8243 link_command="$compile_var$compile_command$compile_rpath"
8244 relink_command="$finalize_var$finalize_command$finalize_rpath"
8246 func_warning "this platform does not like uninstalled shared libraries"
8247 func_warning "\`$output' will be relinked during installation"
8249 if test "$fast_install" != no; then
8250 link_command="$finalize_var$compile_command$finalize_rpath"
8251 if test "$fast_install" = yes; then
8252 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
8254 # fast_install is set to needless
8258 link_command="$compile_var$compile_command$compile_rpath"
8259 relink_command="$finalize_var$finalize_command$finalize_rpath"
8263 # Replace the output file specification.
8264 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8266 # Delete the old output files.
8267 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8269 func_show_eval "$link_command" 'exit $?'
8271 # Now create the wrapper script.
8272 func_verbose "creating $output"
8274 # Quote the relink command for shipping.
8275 if test -n "$relink_command"; then
8276 # Preserve any variables that may affect compiler behavior
8277 for var in $variables_saved_for_relink; do
8278 if eval test -z \"\${$var+set}\"; then
8279 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8280 elif eval var_value=\$$var; test -z "$var_value"; then
8281 relink_command="$var=; export $var; $relink_command"
8283 func_quote_for_eval "$var_value"
8284 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8287 relink_command="(cd `pwd`; $relink_command)"
8288 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
8291 # Quote $ECHO for shipping.
8292 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
8294 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
8295 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
8297 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
8299 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
8302 # Only actually do things if not in dry run mode.
8304 # win32 will think the script is a binary if it has
8305 # a .exe suffix, so we strip it off here.
8307 *.exe) func_stripname '' '.exe' "$output"
8308 output=$func_stripname_result ;;
8310 # test for cygwin because mv fails w/o .exe extensions
8314 func_stripname '' '.exe' "$outputname"
8315 outputname=$func_stripname_result ;;
8319 *cygwin* | *mingw* )
8320 func_dirname_and_basename "$output" "" "."
8321 output_name=$func_basename_result
8322 output_path=$func_dirname_result
8323 cwrappersource="$output_path/$objdir/lt-$output_name.c"
8324 cwrapper="$output_path/$output_name.exe"
8325 $RM $cwrappersource $cwrapper
8326 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8328 func_emit_cwrapperexe_src > $cwrappersource
8330 # The wrapper executable is built using the $host compiler,
8331 # because it contains $host paths and files. If cross-
8332 # compiling, it, like the target executable, must be
8333 # executed on the $host or under an emulation environment.
8335 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8339 # Now, create the wrapper script for func_source use:
8340 func_ltwrapper_scriptname $cwrapper
8341 $RM $func_ltwrapper_scriptname_result
8342 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8344 # note: this script will not be executed, so do not chmod.
8345 if test "x$build" = "x$host" ; then
8346 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8348 func_emit_wrapper no > $func_ltwrapper_scriptname_result
8354 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8356 func_emit_wrapper no > $output
8365 # See if we need to build an old-fashioned archive.
8366 for oldlib in $oldlibs; do
8368 if test "$build_libtool_libs" = convenience; then
8369 oldobjs="$libobjs_save $symfileobj"
8370 addlibs="$convenience"
8371 build_libtool_libs=no
8373 if test "$build_libtool_libs" = module; then
8374 oldobjs="$libobjs_save"
8375 build_libtool_libs=no
8377 oldobjs="$old_deplibs $non_pic_objects"
8378 if test "$preload" = yes && test -f "$symfileobj"; then
8379 oldobjs="$oldobjs $symfileobj"
8382 addlibs="$old_convenience"
8385 if test -n "$addlibs"; then
8386 gentop="$output_objdir/${outputname}x"
8387 generated="$generated $gentop"
8389 func_extract_archives $gentop $addlibs
8390 oldobjs="$oldobjs $func_extract_archives_result"
8393 # Do each command in the archive commands.
8394 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
8395 cmds=$old_archive_from_new_cmds
8398 # Add any objects from preloaded convenience libraries
8399 if test -n "$dlprefiles"; then
8400 gentop="$output_objdir/${outputname}x"
8401 generated="$generated $gentop"
8403 func_extract_archives $gentop $dlprefiles
8404 oldobjs="$oldobjs $func_extract_archives_result"
8407 # POSIX demands no paths to be encoded in archives. We have
8408 # to avoid creating archives with duplicate basenames if we
8409 # might have to extract them afterwards, e.g., when creating a
8410 # static archive out of a convenience library, or when linking
8411 # the entirety of a libtool archive into another (currently
8412 # not supported by libtool).
8413 if (for obj in $oldobjs
8415 func_basename "$obj"
8416 $ECHO "$func_basename_result"
8417 done | sort | sort -uc >/dev/null 2>&1); then
8420 $ECHO "copying selected object files to avoid basename conflicts..."
8421 gentop="$output_objdir/${outputname}x"
8422 generated="$generated $gentop"
8423 func_mkdir_p "$gentop"
8424 save_oldobjs=$oldobjs
8427 for obj in $save_oldobjs
8429 func_basename "$obj"
8430 objbase="$func_basename_result"
8431 case " $oldobjs " in
8432 " ") oldobjs=$obj ;;
8435 # Make sure we don't pick an alternate name that also
8437 newobj=lt$counter-$objbase
8438 func_arith $counter + 1
8439 counter=$func_arith_result
8440 case " $oldobjs " in
8441 *[\ /]"$newobj "*) ;;
8442 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
8445 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8446 oldobjs="$oldobjs $gentop/$newobj"
8448 *) oldobjs="$oldobjs $obj" ;;
8452 eval cmds=\"$old_archive_cmds\"
8455 len=$func_len_result
8456 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8457 cmds=$old_archive_cmds
8459 # the command line is too long to link in one step, link in parts
8460 func_verbose "using piecewise archive linking..."
8465 save_oldobjs=$oldobjs
8467 # Is there a better way of finding the last object in the list?
8468 for obj in $save_oldobjs
8472 eval test_cmds=\"$old_archive_cmds\"
8473 func_len " $test_cmds"
8474 len0=$func_len_result
8476 for obj in $save_oldobjs
8479 func_arith $len + $func_len_result
8480 len=$func_arith_result
8481 func_append objlist " $obj"
8482 if test "$len" -lt "$max_cmd_len"; then
8485 # the above command should be used before it gets too long
8487 if test "$obj" = "$last_oldobj" ; then
8490 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8491 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8498 if test "X$oldobjs" = "X" ; then
8499 eval cmds=\"\$concat_cmds\"
8501 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8505 func_execute_cmds "$cmds" 'exit $?'
8508 test -n "$generated" && \
8509 func_show_eval "${RM}r$generated"
8511 # Now create the libtool archive.
8515 test "$build_old_libs" = yes && old_library="$libname.$libext"
8516 func_verbose "creating $output"
8518 # Preserve any variables that may affect compiler behavior
8519 for var in $variables_saved_for_relink; do
8520 if eval test -z \"\${$var+set}\"; then
8521 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8522 elif eval var_value=\$$var; test -z "$var_value"; then
8523 relink_command="$var=; export $var; $relink_command"
8525 func_quote_for_eval "$var_value"
8526 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8529 # Quote the link command for shipping.
8530 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8531 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
8532 if test "$hardcode_automatic" = yes ; then
8536 # Only create the output if not a dry run.
8538 for installed in no yes; do
8539 if test "$installed" = yes; then
8540 if test -z "$install_libdir"; then
8543 output="$output_objdir/$outputname"i
8544 # Replace all uninstalled libtool libraries with the installed ones
8546 for deplib in $dependency_libs; do
8549 func_basename "$deplib"
8550 name="$func_basename_result"
8551 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8552 test -z "$libdir" && \
8553 func_fatal_error "\`$deplib' is not a valid libtool archive"
8554 newdependency_libs="$newdependency_libs $libdir/$name"
8556 *) newdependency_libs="$newdependency_libs $deplib" ;;
8559 dependency_libs="$newdependency_libs"
8562 for lib in $dlfiles; do
8565 func_basename "$lib"
8566 name="$func_basename_result"
8567 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8568 test -z "$libdir" && \
8569 func_fatal_error "\`$lib' is not a valid libtool archive"
8570 newdlfiles="$newdlfiles $libdir/$name"
8572 *) newdlfiles="$newdlfiles $lib" ;;
8575 dlfiles="$newdlfiles"
8577 for lib in $dlprefiles; do
8580 # Only pass preopened files to the pseudo-archive (for
8581 # eventual linking with the app. that links it) if we
8582 # didn't already link the preopened objects directly into
8584 func_basename "$lib"
8585 name="$func_basename_result"
8586 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8587 test -z "$libdir" && \
8588 func_fatal_error "\`$lib' is not a valid libtool archive"
8589 newdlprefiles="$newdlprefiles $libdir/$name"
8593 dlprefiles="$newdlprefiles"
8596 for lib in $dlfiles; do
8598 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8599 *) abs=`pwd`"/$lib" ;;
8601 newdlfiles="$newdlfiles $abs"
8603 dlfiles="$newdlfiles"
8605 for lib in $dlprefiles; do
8607 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8608 *) abs=`pwd`"/$lib" ;;
8610 newdlprefiles="$newdlprefiles $abs"
8612 dlprefiles="$newdlprefiles"
8615 # place dlname in correct position for cygwin
8617 case $host,$output,$installed,$module,$dlname in
8618 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
8621 # $outputname - a libtool library file
8622 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8624 # Please DO NOT delete this file!
8625 # It is necessary for linking the library.
8627 # The name that we can dlopen(3).
8630 # Names of this library.
8631 library_names='$library_names'
8633 # The name of the static archive.
8634 old_library='$old_library'
8636 # Linker flags that can not go in dependency_libs.
8637 inherited_linker_flags='$new_inherited_linker_flags'
8639 # Libraries that this one depends upon.
8640 dependency_libs='$dependency_libs'
8642 # Names of additional weak libraries provided by this library
8643 weak_library_names='$weak_libs'
8645 # Version information for $libname.
8650 # Is this an already installed library?
8651 installed=$installed
8653 # Should we warn about portability when linking against -modules?
8654 shouldnotlink=$module
8656 # Files to dlopen/dlpreopen
8658 dlpreopen='$dlprefiles'
8660 # Directory that this library needs to be installed in:
8661 libdir='$install_libdir'"
8662 if test "$installed" = no && test "$need_relink" = yes; then
8664 relink_command=\"$relink_command\""
8669 # Do a symbolic link so that the libtool archive can be found in
8670 # LD_LIBRARY_PATH before the program is installed.
8671 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8677 { test "$mode" = link || test "$mode" = relink; } &&
8678 func_mode_link ${1+"$@"}
8681 # func_mode_uninstall arg...
8682 func_mode_uninstall ()
8690 # This variable tells wrapper scripts just to set variables rather
8691 # than running their programs.
8692 libtool_install_magic="$magic"
8697 -f) RM="$RM $arg"; rmforce=yes ;;
8698 -*) RM="$RM $arg" ;;
8699 *) files="$files $arg" ;;
8704 func_fatal_help "you must specify an RM program"
8708 origobjdir="$objdir"
8709 for file in $files; do
8710 func_dirname "$file" "" "."
8711 dir="$func_dirname_result"
8712 if test "X$dir" = X.; then
8713 objdir="$origobjdir"
8715 objdir="$dir/$origobjdir"
8717 func_basename "$file"
8718 name="$func_basename_result"
8719 test "$mode" = uninstall && objdir="$dir"
8721 # Remember objdir for removal later, being careful to avoid duplicates
8722 if test "$mode" = clean; then
8725 *) rmdirs="$rmdirs $objdir" ;;
8729 # Don't error if the file doesn't exist and rm -f was used.
8730 if { test -L "$file"; } >/dev/null 2>&1 ||
8731 { test -h "$file"; } >/dev/null 2>&1 ||
8732 test -f "$file"; then
8734 elif test -d "$file"; then
8737 elif test "$rmforce" = yes; then
8745 # Possibly a libtool archive, so verify it.
8746 if func_lalib_p "$file"; then
8747 func_source $dir/$name
8749 # Delete the libtool libraries and symlinks.
8750 for n in $library_names; do
8751 rmfiles="$rmfiles $objdir/$n"
8753 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
8757 case " $library_names " in
8758 # " " in the beginning catches empty $dlname
8760 *) rmfiles="$rmfiles $objdir/$dlname" ;;
8762 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
8765 if test -n "$library_names"; then
8766 # Do each command in the postuninstall commands.
8767 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8770 if test -n "$old_library"; then
8771 # Do each command in the old_postuninstall commands.
8772 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8774 # FIXME: should reinstall the best remaining shared library.
8781 # Possibly a libtool object, so verify it.
8782 if func_lalib_p "$file"; then
8785 func_source $dir/$name
8787 # Add PIC object to the list of files to remove.
8788 if test -n "$pic_object" &&
8789 test "$pic_object" != none; then
8790 rmfiles="$rmfiles $dir/$pic_object"
8793 # Add non-PIC object to the list of files to remove.
8794 if test -n "$non_pic_object" &&
8795 test "$non_pic_object" != none; then
8796 rmfiles="$rmfiles $dir/$non_pic_object"
8802 if test "$mode" = clean ; then
8806 func_stripname '' '.exe' "$file"
8807 file=$func_stripname_result
8808 func_stripname '' '.exe' "$name"
8809 noexename=$func_stripname_result
8810 # $file with .exe has already been added to rmfiles,
8811 # add $file without .exe
8812 rmfiles="$rmfiles $file"
8815 # Do a test to see if this is a libtool program.
8816 if func_ltwrapper_p "$file"; then
8817 if func_ltwrapper_executable_p "$file"; then
8818 func_ltwrapper_scriptname "$file"
8820 func_source $func_ltwrapper_scriptname_result
8821 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
8824 func_source $dir/$noexename
8827 # note $name still contains .exe if it was in $file originally
8828 # as does the version of $file that was added into $rmfiles
8829 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
8830 if test "$fast_install" = yes && test -n "$relink_command"; then
8831 rmfiles="$rmfiles $objdir/lt-$name"
8833 if test "X$noexename" != "X$name" ; then
8834 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
8840 func_show_eval "$RM $rmfiles" 'exit_status=1'
8842 objdir="$origobjdir"
8844 # Try to remove the ${objdir}s in the directories where we deleted files
8845 for dir in $rmdirs; do
8846 if test -d "$dir"; then
8847 func_show_eval "rmdir $dir >/dev/null 2>&1"
8854 { test "$mode" = uninstall || test "$mode" = clean; } &&
8855 func_mode_uninstall ${1+"$@"}
8857 test -z "$mode" && {
8858 help="$generic_help"
8859 func_fatal_help "you must specify a MODE"
8862 test -z "$exec_cmd" && \
8863 func_fatal_help "invalid operation mode \`$mode'"
8865 if test -n "$exec_cmd"; then
8866 eval exec "$exec_cmd"
8873 # The TAGs below are defined such that we never get into a situation
8874 # in which we disable both kinds of libraries. Given conflicting
8875 # choices, we go for a static library, that is the most portable,
8876 # since we can't tell whether shared libraries were disabled because
8877 # the user asked for that or because the platform doesn't support
8878 # them. This is particularly important on AIX, because we don't
8879 # support having both static and shared libraries enabled at the same
8880 # time on that platform, so we default to a shared-only configuration.
8881 # If a disable-shared tag is given, we'll fallback to a static-only
8882 # configuration. But we'll never go from static-only to shared-only.
8884 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
8885 build_libtool_libs=no
8887 # ### END LIBTOOL TAG CONFIG: disable-shared
8889 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
8890 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
8891 # ### END LIBTOOL TAG CONFIG: disable-static