Merge branch 'ical'
[alpine.git] / libtool
blob9a48e8feab5b832518cc243fdd798f16763fa5e1
1 #! /bin/sh
3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (alpine) 2.21.9
5 # Libtool was configured on host linux.suse:
6 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
8 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
9 # 2006, 2007, 2008, 2009, 2010, 2011 Free Software
10 # Foundation, Inc.
11 # Written by Gordon Matzigkeit, 1996
13 # This file is part of GNU Libtool.
15 # GNU Libtool is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License as
17 # published by the Free Software Foundation; either version 2 of
18 # the License, or (at your option) any later version.
20 # As a special exception to the GNU General Public License,
21 # if you distribute this file as part of a program or library that
22 # is built using GNU Libtool, you may include this file under the
23 # same distribution terms that you use for the rest of that program.
25 # GNU Libtool is distributed in the hope that it will be useful,
26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 # GNU General Public License for more details.
30 # You should have received a copy of the GNU General Public License
31 # along with GNU Libtool; see the file COPYING. If not, a copy
32 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
33 # obtained by writing to the Free Software Foundation, Inc.,
34 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
37 # The names of the tagged configurations supported by this script.
38 available_tags=""
40 # ### BEGIN LIBTOOL CONFIG
42 # Which release of libtool.m4 was used?
43 macro_version=2.4.2
44 macro_revision=1.3337
46 # Whether or not to build shared libraries.
47 build_libtool_libs=yes
49 # Whether or not to build static libraries.
50 build_old_libs=yes
52 # What type of objects to build.
53 pic_mode=default
55 # Whether or not to optimize for fast installation.
56 fast_install=needless
58 # Shell to use when invoking shell scripts.
59 SHELL="/bin/sh"
61 # An echo program that protects backslashes.
62 ECHO="printf %s\\n"
64 # The PATH separator for the build system.
65 PATH_SEPARATOR=":"
67 # The host system.
68 host_alias=
69 host=x86_64-suse-linux-gnu
70 host_os=linux-gnu
72 # The build system.
73 build_alias=
74 build=x86_64-suse-linux-gnu
75 build_os=linux-gnu
77 # A sed program that does not truncate output.
78 SED="/usr/bin/sed"
80 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
81 Xsed="$SED -e 1s/^X//"
83 # A grep program that handles long lines.
84 GREP="/usr/bin/grep"
86 # An ERE matcher.
87 EGREP="/usr/bin/grep -E"
89 # A literal string matcher.
90 FGREP="/usr/bin/grep -F"
92 # A BSD- or MS-compatible name lister.
93 NM="/usr/bin/nm -B"
95 # Whether we need soft or hard links.
96 LN_S="ln -s"
98 # What is the maximum length of a command?
99 max_cmd_len=1572864
101 # Object file suffix (normally "o").
102 objext=o
104 # Executable file suffix (normally "").
105 exeext=
107 # whether the shell understands "unset".
108 lt_unset=unset
110 # turn spaces into newlines.
111 SP2NL="tr \\040 \\012"
113 # turn newlines into spaces.
114 NL2SP="tr \\015\\012 \\040\\040"
116 # convert $build file names to $host format.
117 to_host_file_cmd=func_convert_file_noop
119 # convert $build files to toolchain format.
120 to_tool_file_cmd=func_convert_file_noop
122 # An object symbol dumper.
123 OBJDUMP="objdump"
125 # Method to check whether dependent libraries are shared objects.
126 deplibs_check_method="pass_all"
128 # Command to use when deplibs_check_method = "file_magic".
129 file_magic_cmd="\$MAGIC_CMD"
131 # How to find potential files when deplibs_check_method = "file_magic".
132 file_magic_glob=""
134 # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
135 want_nocaseglob="no"
137 # DLL creation program.
138 DLLTOOL="false"
140 # Command to associate shared and link libraries.
141 sharedlib_from_linklib_cmd="printf %s\\n"
143 # The archiver.
144 AR="/usr/bin/ar"
146 # Flags to create an archive.
147 AR_FLAGS="cru"
149 # How to feed a file listing to the archiver.
150 archiver_list_spec="@"
152 # A symbol stripping program.
153 STRIP="strip"
155 # Commands used to install an old-style archive.
156 RANLIB="ranlib"
157 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
158 old_postuninstall_cmds=""
160 # Whether to use a lock for old archive extraction.
161 lock_old_archive_extraction=no
163 # A C compiler.
164 LTCC="gcc -std=gnu99"
166 # LTCC compiler flags.
167 LTCFLAGS="-g"
169 # Take the output of nm and produce a listing of raw symbols and C names.
170 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
172 # Transform the output of nm in a proper C declaration.
173 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
175 # Transform the output of nm in a C name address pair.
176 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
178 # Transform the output of nm in a C name address pair when lib prefix is needed.
179 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'"
181 # Specify filename containing input files for $NM.
182 nm_file_list_spec="@"
184 # The root where to search for dependent libraries,and in which our libraries should be installed.
185 lt_sysroot=
187 # The name of the directory that contains temporary libtool files.
188 objdir=.libs
190 # Used to examine libraries when file_magic_cmd begins with "file".
191 MAGIC_CMD=file
193 # Must we lock files when doing compilation?
194 need_locks="no"
196 # Manifest tool.
197 MANIFEST_TOOL=":"
199 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
200 DSYMUTIL=""
202 # Tool to change global to local symbols on Mac OS X.
203 NMEDIT=""
205 # Tool to manipulate fat objects and archives on Mac OS X.
206 LIPO=""
208 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
209 OTOOL=""
211 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
212 OTOOL64=""
214 # Old archive suffix (normally "a").
215 libext=a
217 # Shared library suffix (normally ".so").
218 shrext_cmds=".so"
220 # The commands to extract the exported symbol list from a shared archive.
221 extract_expsyms_cmds=""
223 # Variables whose values should be saved in libtool wrapper scripts and
224 # restored at link time.
225 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
227 # Do we need the "lib" prefix for modules?
228 need_lib_prefix=no
230 # Do we need a version for libraries?
231 need_version=no
233 # Library versioning type.
234 version_type=linux
236 # Shared library runtime path variable.
237 runpath_var=LD_RUN_PATH
239 # Shared library path variable.
240 shlibpath_var=LD_LIBRARY_PATH
242 # Is shlibpath searched before the hard-coded library search path?
243 shlibpath_overrides_runpath=yes
245 # Format of library name prefix.
246 libname_spec="lib\$name"
248 # List of archive names. First name is the real one, the rest are links.
249 # The last name is the one that the linker finds with -lNAME
250 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
252 # The coded name of the library, if different from the real name.
253 soname_spec="\${libname}\${release}\${shared_ext}\$major"
255 # Permission mode override for installation of shared libraries.
256 install_override_mode=""
258 # Command to use after installation of a shared archive.
259 postinstall_cmds=""
261 # Command to use after uninstallation of a shared archive.
262 postuninstall_cmds=""
264 # Commands used to finish a libtool library installation in a directory.
265 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
267 # As "finish_cmds", except a single script fragment to be evaled but
268 # not shown.
269 finish_eval=""
271 # Whether we should hardcode library paths into libraries.
272 hardcode_into_libs=yes
274 # Compile-time system search path for libraries.
275 sys_lib_search_path_spec="/usr/lib64/gcc/x86_64-suse-linux/4.8 /usr/lib64 /lib64 /usr/x86_64-suse-linux/lib "
277 # Run-time system search path for libraries.
278 sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib64/graphviz /usr/lib64/graphviz/sharp /usr/lib64/graphviz/java /usr/lib64/graphviz/perl /usr/lib64/graphviz/php /usr/lib64/graphviz/ocaml /usr/lib64/graphviz/python /usr/lib64/graphviz/lua /usr/lib64/graphviz/tcl /usr/lib64/graphviz/guile /usr/lib64/graphviz/ruby "
280 # Whether dlopen is supported.
281 dlopen_support=unknown
283 # Whether dlopen of programs is supported.
284 dlopen_self=unknown
286 # Whether dlopen of statically linked programs is supported.
287 dlopen_self_static=unknown
289 # Commands to strip libraries.
290 old_striplib="strip --strip-debug"
291 striplib="strip --strip-unneeded"
294 # The linker used to build libraries.
295 LD="/usr/x86_64-suse-linux/bin/ld -m elf_x86_64"
297 # How to create reloadable object files.
298 reload_flag=" -r"
299 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
301 # Commands used to build an old-style archive.
302 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
304 # A language specific compiler.
305 CC="gcc -std=gnu99"
307 # Is the compiler the GNU compiler?
308 with_gcc=yes
310 # Compiler flag to turn off builtin functions.
311 no_builtin_flag=" -fno-builtin"
313 # Additional compiler flags for building library objects.
314 pic_flag=" -fPIC -DPIC"
316 # How to pass a linker flag through the compiler.
317 wl="-Wl,"
319 # Compiler flag to prevent dynamic linking.
320 link_static_flag=""
322 # Does compiler simultaneously support -c and -o options?
323 compiler_c_o="yes"
325 # Whether or not to add -lc for building shared libraries.
326 build_libtool_need_lc=no
328 # Whether or not to disallow shared libs when runtime libs are static.
329 allow_libtool_libs_with_static_runtimes=no
331 # Compiler flag to allow reflexive dlopens.
332 export_dynamic_flag_spec="\${wl}--export-dynamic"
334 # Compiler flag to generate shared objects directly from archives.
335 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
337 # Whether the compiler copes with passing no objects directly.
338 compiler_needs_object="no"
340 # Create an old-style archive from a shared archive.
341 old_archive_from_new_cmds=""
343 # Create a temporary old-style archive to link instead of a shared archive.
344 old_archive_from_expsyms_cmds=""
346 # Commands used to build a shared archive.
347 archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
348 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
349 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
350 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
351 \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
353 # Commands used to build a loadable module if different from building
354 # a shared archive.
355 module_cmds=""
356 module_expsym_cmds=""
358 # Whether we are building with GNU ld or not.
359 with_gnu_ld="yes"
361 # Flag that allows shared libraries with undefined symbols to be built.
362 allow_undefined_flag=""
364 # Flag that enforces no undefined symbols.
365 no_undefined_flag=""
367 # Flag to hardcode $libdir into a binary during linking.
368 # This must work even if $libdir does not exist
369 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
371 # Whether we need a single "-rpath" flag with a separated argument.
372 hardcode_libdir_separator=""
374 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
375 # DIR into the resulting binary.
376 hardcode_direct=no
378 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
379 # DIR into the resulting binary and the resulting library dependency is
380 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
381 # library is relocated.
382 hardcode_direct_absolute=no
384 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
385 # into the resulting binary.
386 hardcode_minus_L=no
388 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
389 # into the resulting binary.
390 hardcode_shlibpath_var=unsupported
392 # Set to "yes" if building a shared library automatically hardcodes DIR
393 # into the library and all subsequent libraries and executables linked
394 # against it.
395 hardcode_automatic=no
397 # Set to yes if linker adds runtime paths of dependent libraries
398 # to runtime path list.
399 inherit_rpath=no
401 # Whether libtool must link a program against all its dependency libraries.
402 link_all_deplibs=unknown
404 # Set to "yes" if exported symbols are required.
405 always_export_symbols=no
407 # The commands to list exported symbols.
408 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
410 # Symbols that should not be listed in the preloaded symbols.
411 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
413 # Symbols that must always be exported.
414 include_expsyms=""
416 # Commands necessary for linking programs (against libraries) with templates.
417 prelink_cmds=""
419 # Commands necessary for finishing linking programs.
420 postlink_cmds=""
422 # Specify filename containing input files.
423 file_list_spec=""
425 # How to hardcode a shared library path into an executable.
426 hardcode_action=immediate
428 # ### END LIBTOOL CONFIG
431 # libtool (GNU libtool) 2.4.2
432 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
434 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
435 # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
436 # This is free software; see the source for copying conditions. There is NO
437 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
439 # GNU Libtool is free software; you can redistribute it and/or modify
440 # it under the terms of the GNU General Public License as published by
441 # the Free Software Foundation; either version 2 of the License, or
442 # (at your option) any later version.
444 # As a special exception to the GNU General Public License,
445 # if you distribute this file as part of a program or library that
446 # is built using GNU Libtool, you may include this file under the
447 # same distribution terms that you use for the rest of that program.
449 # GNU Libtool is distributed in the hope that it will be useful, but
450 # WITHOUT ANY WARRANTY; without even the implied warranty of
451 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
452 # General Public License for more details.
454 # You should have received a copy of the GNU General Public License
455 # along with GNU Libtool; see the file COPYING. If not, a copy
456 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
457 # or obtained by writing to the Free Software Foundation, Inc.,
458 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
460 # Usage: $progname [OPTION]... [MODE-ARG]...
462 # Provide generalized library-building support services.
464 # --config show all configuration variables
465 # --debug enable verbose shell tracing
466 # -n, --dry-run display commands without modifying any files
467 # --features display basic configuration information and exit
468 # --mode=MODE use operation mode MODE
469 # --preserve-dup-deps don't remove duplicate dependency libraries
470 # --quiet, --silent don't print informational messages
471 # --no-quiet, --no-silent
472 # print informational messages (default)
473 # --no-warn don't display warning messages
474 # --tag=TAG use configuration variables from tag TAG
475 # -v, --verbose print more informational messages than default
476 # --no-verbose don't print the extra informational messages
477 # --version print version information
478 # -h, --help, --help-all print short, long, or detailed help message
480 # MODE must be one of the following:
482 # clean remove files from the build directory
483 # compile compile a source file into a libtool object
484 # execute automatically set library path, then run a program
485 # finish complete the installation of libtool libraries
486 # install install libraries or executables
487 # link create a library or an executable
488 # uninstall remove libraries from an installed directory
490 # MODE-ARGS vary depending on the MODE. When passed as first option,
491 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
492 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
494 # When reporting a bug, please describe a test case to reproduce it and
495 # include the following information:
497 # host-triplet: $host
498 # shell: $SHELL
499 # compiler: $LTCC
500 # compiler flags: $LTCFLAGS
501 # linker: $LD (gnu? $with_gnu_ld)
502 # $progname: (GNU libtool) 2.4.2
503 # automake: $automake_version
504 # autoconf: $autoconf_version
506 # Report bugs to <bug-libtool@gnu.org>.
507 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
508 # General help using GNU software: <http://www.gnu.org/gethelp/>.
510 PROGRAM=libtool
511 PACKAGE=libtool
512 VERSION=2.4.2
513 TIMESTAMP=""
514 package_revision=1.3337
516 # Be Bourne compatible
517 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
518 emulate sh
519 NULLCMD=:
520 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
521 # is contrary to our usage. Disable this feature.
522 alias -g '${1+"$@"}'='"$@"'
523 setopt NO_GLOB_SUBST
524 else
525 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
527 BIN_SH=xpg4; export BIN_SH # for Tru64
528 DUALCASE=1; export DUALCASE # for MKS sh
530 # A function that is used when there is no print builtin or printf.
531 func_fallback_echo ()
533 eval 'cat <<_LTECHO_EOF
535 _LTECHO_EOF'
538 # NLS nuisances: We save the old values to restore during execute mode.
539 lt_user_locale=
540 lt_safe_locale=
541 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
543 eval "if test \"\${$lt_var+set}\" = set; then
544 save_$lt_var=\$$lt_var
545 $lt_var=C
546 export $lt_var
547 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
548 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
550 done
551 LC_ALL=C
552 LANGUAGE=C
553 export LANGUAGE LC_ALL
555 $lt_unset CDPATH
558 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
559 # is ksh but when the shell is invoked as "sh" and the current value of
560 # the _XPG environment variable is not equal to 1 (one), the special
561 # positional parameter $0, within a function call, is the name of the
562 # function.
563 progpath="$0"
567 : ${CP="cp -f"}
568 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
569 : ${MAKE="make"}
570 : ${MKDIR="mkdir"}
571 : ${MV="mv -f"}
572 : ${RM="rm -f"}
573 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
574 : ${Xsed="$SED -e 1s/^X//"}
576 # Global variables:
577 EXIT_SUCCESS=0
578 EXIT_FAILURE=1
579 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
580 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
582 exit_status=$EXIT_SUCCESS
584 # Make sure IFS has a sensible default
585 lt_nl='
587 IFS=" $lt_nl"
589 dirname="s,/[^/]*$,,"
590 basename="s,^.*/,,"
592 # func_dirname file append nondir_replacement
593 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
594 # otherwise set result to NONDIR_REPLACEMENT.
595 func_dirname ()
597 case ${1} in
598 */*) func_dirname_result="${1%/*}${2}" ;;
599 * ) func_dirname_result="${3}" ;;
600 esac
601 } # Extended-shell func_dirname implementation
604 # func_basename file
605 func_basename ()
607 func_basename_result="${1##*/}"
608 } # Extended-shell func_basename implementation
611 # func_dirname_and_basename file append nondir_replacement
612 # perform func_basename and func_dirname in a single function
613 # call:
614 # dirname: Compute the dirname of FILE. If nonempty,
615 # add APPEND to the result, otherwise set result
616 # to NONDIR_REPLACEMENT.
617 # value returned in "$func_dirname_result"
618 # basename: Compute filename of FILE.
619 # value retuned in "$func_basename_result"
620 # Implementation must be kept synchronized with func_dirname
621 # and func_basename. For efficiency, we do not delegate to
622 # those functions but instead duplicate the functionality here.
623 func_dirname_and_basename ()
625 case ${1} in
626 */*) func_dirname_result="${1%/*}${2}" ;;
627 * ) func_dirname_result="${3}" ;;
628 esac
629 func_basename_result="${1##*/}"
630 } # Extended-shell func_dirname_and_basename implementation
633 # func_stripname prefix suffix name
634 # strip PREFIX and SUFFIX off of NAME.
635 # PREFIX and SUFFIX must not contain globbing or regex special
636 # characters, hashes, percent signs, but SUFFIX may contain a leading
637 # dot (in which case that matches only a dot).
638 # func_strip_suffix prefix name
639 func_stripname ()
641 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
642 # positional parameters, so assign one to ordinary parameter first.
643 func_stripname_result=${3}
644 func_stripname_result=${func_stripname_result#"${1}"}
645 func_stripname_result=${func_stripname_result%"${2}"}
646 } # Extended-shell func_stripname implementation
649 # These SED scripts presuppose an absolute path with a trailing slash.
650 pathcar='s,^/\([^/]*\).*$,\1,'
651 pathcdr='s,^/[^/]*,,'
652 removedotparts=':dotsl
653 s@/\./@/@g
654 t dotsl
655 s,/\.$,/,'
656 collapseslashes='s@/\{1,\}@/@g'
657 finalslash='s,/*$,/,'
659 # func_normal_abspath PATH
660 # Remove doubled-up and trailing slashes, "." path components,
661 # and cancel out any ".." path components in PATH after making
662 # it an absolute path.
663 # value returned in "$func_normal_abspath_result"
664 func_normal_abspath ()
666 # Start from root dir and reassemble the path.
667 func_normal_abspath_result=
668 func_normal_abspath_tpath=$1
669 func_normal_abspath_altnamespace=
670 case $func_normal_abspath_tpath in
672 # Empty path, that just means $cwd.
673 func_stripname '' '/' "`pwd`"
674 func_normal_abspath_result=$func_stripname_result
675 return
677 # The next three entries are used to spot a run of precisely
678 # two leading slashes without using negated character classes;
679 # we take advantage of case's first-match behaviour.
680 ///*)
681 # Unusual form of absolute path, do nothing.
683 //*)
684 # Not necessarily an ordinary path; POSIX reserves leading '//'
685 # and for example Cygwin uses it to access remote file shares
686 # over CIFS/SMB, so we conserve a leading double slash if found.
687 func_normal_abspath_altnamespace=/
690 # Absolute path, do nothing.
693 # Relative path, prepend $cwd.
694 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
696 esac
697 # Cancel out all the simple stuff to save iterations. We also want
698 # the path to end with a slash for ease of parsing, so make sure
699 # there is one (and only one) here.
700 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
701 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
702 while :; do
703 # Processed it all yet?
704 if test "$func_normal_abspath_tpath" = / ; then
705 # If we ascended to the root using ".." the result may be empty now.
706 if test -z "$func_normal_abspath_result" ; then
707 func_normal_abspath_result=/
709 break
711 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
712 -e "$pathcar"`
713 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
714 -e "$pathcdr"`
715 # Figure out what to do with it
716 case $func_normal_abspath_tcomponent in
718 # Trailing empty path component, ignore it.
721 # Parent dir; strip last assembled component from result.
722 func_dirname "$func_normal_abspath_result"
723 func_normal_abspath_result=$func_dirname_result
726 # Actual path component, append it.
727 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
729 esac
730 done
731 # Restore leading double-slash if one was found on entry.
732 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
735 # func_relative_path SRCDIR DSTDIR
736 # generates a relative path from SRCDIR to DSTDIR, with a trailing
737 # slash if non-empty, suitable for immediately appending a filename
738 # without needing to append a separator.
739 # value returned in "$func_relative_path_result"
740 func_relative_path ()
742 func_relative_path_result=
743 func_normal_abspath "$1"
744 func_relative_path_tlibdir=$func_normal_abspath_result
745 func_normal_abspath "$2"
746 func_relative_path_tbindir=$func_normal_abspath_result
748 # Ascend the tree starting from libdir
749 while :; do
750 # check if we have found a prefix of bindir
751 case $func_relative_path_tbindir in
752 $func_relative_path_tlibdir)
753 # found an exact match
754 func_relative_path_tcancelled=
755 break
757 $func_relative_path_tlibdir*)
758 # found a matching prefix
759 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
760 func_relative_path_tcancelled=$func_stripname_result
761 if test -z "$func_relative_path_result"; then
762 func_relative_path_result=.
764 break
767 func_dirname $func_relative_path_tlibdir
768 func_relative_path_tlibdir=${func_dirname_result}
769 if test "x$func_relative_path_tlibdir" = x ; then
770 # Have to descend all the way to the root!
771 func_relative_path_result=../$func_relative_path_result
772 func_relative_path_tcancelled=$func_relative_path_tbindir
773 break
775 func_relative_path_result=../$func_relative_path_result
777 esac
778 done
780 # Now calculate path; take care to avoid doubling-up slashes.
781 func_stripname '' '/' "$func_relative_path_result"
782 func_relative_path_result=$func_stripname_result
783 func_stripname '/' '/' "$func_relative_path_tcancelled"
784 if test "x$func_stripname_result" != x ; then
785 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
788 # Normalisation. If bindir is libdir, return empty string,
789 # else relative path ending with a slash; either way, target
790 # file name can be directly appended.
791 if test ! -z "$func_relative_path_result"; then
792 func_stripname './' '' "$func_relative_path_result/"
793 func_relative_path_result=$func_stripname_result
797 # The name of this program:
798 func_dirname_and_basename "$progpath"
799 progname=$func_basename_result
801 # Make sure we have an absolute path for reexecution:
802 case $progpath in
803 [\\/]*|[A-Za-z]:\\*) ;;
804 *[\\/]*)
805 progdir=$func_dirname_result
806 progdir=`cd "$progdir" && pwd`
807 progpath="$progdir/$progname"
810 save_IFS="$IFS"
811 IFS=${PATH_SEPARATOR-:}
812 for progdir in $PATH; do
813 IFS="$save_IFS"
814 test -x "$progdir/$progname" && break
815 done
816 IFS="$save_IFS"
817 test -n "$progdir" || progdir=`pwd`
818 progpath="$progdir/$progname"
820 esac
822 # Sed substitution that helps us do robust quoting. It backslashifies
823 # metacharacters that are still active within double-quoted strings.
824 Xsed="${SED}"' -e 1s/^X//'
825 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
827 # Same as above, but do not quote variable references.
828 double_quote_subst='s/\(["`\\]\)/\\\1/g'
830 # Sed substitution that turns a string into a regex matching for the
831 # string literally.
832 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
834 # Sed substitution that converts a w32 file name or path
835 # which contains forward slashes, into one that contains
836 # (escaped) backslashes. A very naive implementation.
837 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
839 # Re-`\' parameter expansions in output of double_quote_subst that were
840 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
841 # in input to double_quote_subst, that '$' was protected from expansion.
842 # Since each input `\' is now two `\'s, look for any number of runs of
843 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
844 bs='\\'
845 bs2='\\\\'
846 bs4='\\\\\\\\'
847 dollar='\$'
848 sed_double_backslash="\
849 s/$bs4/&\\
851 s/^$bs2$dollar/$bs&/
852 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
853 s/\n//g"
855 # Standard options:
856 opt_dry_run=false
857 opt_help=false
858 opt_quiet=false
859 opt_verbose=false
860 opt_warning=:
862 # func_echo arg...
863 # Echo program name prefixed message, along with the current mode
864 # name if it has been set yet.
865 func_echo ()
867 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
870 # func_verbose arg...
871 # Echo program name prefixed message in verbose mode only.
872 func_verbose ()
874 $opt_verbose && func_echo ${1+"$@"}
876 # A bug in bash halts the script if the last line of a function
877 # fails when set -e is in force, so we need another command to
878 # work around that:
882 # func_echo_all arg...
883 # Invoke $ECHO with all args, space-separated.
884 func_echo_all ()
886 $ECHO "$*"
889 # func_error arg...
890 # Echo program name prefixed message to standard error.
891 func_error ()
893 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
896 # func_warning arg...
897 # Echo program name prefixed warning message to standard error.
898 func_warning ()
900 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
902 # bash bug again:
906 # func_fatal_error arg...
907 # Echo program name prefixed message to standard error, and exit.
908 func_fatal_error ()
910 func_error ${1+"$@"}
911 exit $EXIT_FAILURE
914 # func_fatal_help arg...
915 # Echo program name prefixed message to standard error, followed by
916 # a help hint, and exit.
917 func_fatal_help ()
919 func_error ${1+"$@"}
920 func_fatal_error "$help"
922 help="Try \`$progname --help' for more information." ## default
925 # func_grep expression filename
926 # Check whether EXPRESSION matches any line of FILENAME, without output.
927 func_grep ()
929 $GREP "$1" "$2" >/dev/null 2>&1
933 # func_mkdir_p directory-path
934 # Make sure the entire path to DIRECTORY-PATH is available.
935 func_mkdir_p ()
937 my_directory_path="$1"
938 my_dir_list=
940 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
942 # Protect directory names starting with `-'
943 case $my_directory_path in
944 -*) my_directory_path="./$my_directory_path" ;;
945 esac
947 # While some portion of DIR does not yet exist...
948 while test ! -d "$my_directory_path"; do
949 # ...make a list in topmost first order. Use a colon delimited
950 # list incase some portion of path contains whitespace.
951 my_dir_list="$my_directory_path:$my_dir_list"
953 # If the last portion added has no slash in it, the list is done
954 case $my_directory_path in */*) ;; *) break ;; esac
956 # ...otherwise throw away the child directory and loop
957 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
958 done
959 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
961 save_mkdir_p_IFS="$IFS"; IFS=':'
962 for my_dir in $my_dir_list; do
963 IFS="$save_mkdir_p_IFS"
964 # mkdir can fail with a `File exist' error if two processes
965 # try to create one of the directories concurrently. Don't
966 # stop in that case!
967 $MKDIR "$my_dir" 2>/dev/null || :
968 done
969 IFS="$save_mkdir_p_IFS"
971 # Bail out if we (or some other process) failed to create a directory.
972 test -d "$my_directory_path" || \
973 func_fatal_error "Failed to create \`$1'"
978 # func_mktempdir [string]
979 # Make a temporary directory that won't clash with other running
980 # libtool processes, and avoids race conditions if possible. If
981 # given, STRING is the basename for that directory.
982 func_mktempdir ()
984 my_template="${TMPDIR-/tmp}/${1-$progname}"
986 if test "$opt_dry_run" = ":"; then
987 # Return a directory name, but don't create it in dry-run mode
988 my_tmpdir="${my_template}-$$"
989 else
991 # If mktemp works, use that first and foremost
992 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
994 if test ! -d "$my_tmpdir"; then
995 # Failing that, at least try and use $RANDOM to avoid a race
996 my_tmpdir="${my_template}-${RANDOM-0}$$"
998 save_mktempdir_umask=`umask`
999 umask 0077
1000 $MKDIR "$my_tmpdir"
1001 umask $save_mktempdir_umask
1004 # If we're not in dry-run mode, bomb out on failure
1005 test -d "$my_tmpdir" || \
1006 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1009 $ECHO "$my_tmpdir"
1013 # func_quote_for_eval arg
1014 # Aesthetically quote ARG to be evaled later.
1015 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1016 # is double-quoted, suitable for a subsequent eval, whereas
1017 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1018 # which are still active within double quotes backslashified.
1019 func_quote_for_eval ()
1021 case $1 in
1022 *[\\\`\"\$]*)
1023 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
1025 func_quote_for_eval_unquoted_result="$1" ;;
1026 esac
1028 case $func_quote_for_eval_unquoted_result in
1029 # Double-quote args containing shell metacharacters to delay
1030 # word splitting, command substitution and and variable
1031 # expansion for a subsequent eval.
1032 # Many Bourne shells cannot handle close brackets correctly
1033 # in scan sets, so we specify it separately.
1034 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1035 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1038 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1039 esac
1043 # func_quote_for_expand arg
1044 # Aesthetically quote ARG to be evaled later; same as above,
1045 # but do not quote variable references.
1046 func_quote_for_expand ()
1048 case $1 in
1049 *[\\\`\"]*)
1050 my_arg=`$ECHO "$1" | $SED \
1051 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1053 my_arg="$1" ;;
1054 esac
1056 case $my_arg in
1057 # Double-quote args containing shell metacharacters to delay
1058 # word splitting and command substitution for a subsequent eval.
1059 # Many Bourne shells cannot handle close brackets correctly
1060 # in scan sets, so we specify it separately.
1061 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1062 my_arg="\"$my_arg\""
1064 esac
1066 func_quote_for_expand_result="$my_arg"
1070 # func_show_eval cmd [fail_exp]
1071 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1072 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1073 # is given, then evaluate it.
1074 func_show_eval ()
1076 my_cmd="$1"
1077 my_fail_exp="${2-:}"
1079 ${opt_silent-false} || {
1080 func_quote_for_expand "$my_cmd"
1081 eval "func_echo $func_quote_for_expand_result"
1084 if ${opt_dry_run-false}; then :; else
1085 eval "$my_cmd"
1086 my_status=$?
1087 if test "$my_status" -eq 0; then :; else
1088 eval "(exit $my_status); $my_fail_exp"
1094 # func_show_eval_locale cmd [fail_exp]
1095 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1096 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1097 # is given, then evaluate it. Use the saved locale for evaluation.
1098 func_show_eval_locale ()
1100 my_cmd="$1"
1101 my_fail_exp="${2-:}"
1103 ${opt_silent-false} || {
1104 func_quote_for_expand "$my_cmd"
1105 eval "func_echo $func_quote_for_expand_result"
1108 if ${opt_dry_run-false}; then :; else
1109 eval "$lt_user_locale
1110 $my_cmd"
1111 my_status=$?
1112 eval "$lt_safe_locale"
1113 if test "$my_status" -eq 0; then :; else
1114 eval "(exit $my_status); $my_fail_exp"
1119 # func_tr_sh
1120 # Turn $1 into a string suitable for a shell variable name.
1121 # Result is stored in $func_tr_sh_result. All characters
1122 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1123 # if $1 begins with a digit, a '_' is prepended as well.
1124 func_tr_sh ()
1126 case $1 in
1127 [0-9]* | *[!a-zA-Z0-9_]*)
1128 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
1131 func_tr_sh_result=$1
1133 esac
1137 # func_version
1138 # Echo version message to standard output and exit.
1139 func_version ()
1141 $opt_debug
1143 $SED -n '/(C)/!b go
1144 :more
1145 /\./!{
1147 s/\n# / /
1148 b more
1151 /^# '$PROGRAM' (GNU /,/# warranty; / {
1152 s/^# //
1153 s/^# *$//
1154 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1156 }' < "$progpath"
1157 exit $?
1160 # func_usage
1161 # Echo short help message to standard output and exit.
1162 func_usage ()
1164 $opt_debug
1166 $SED -n '/^# Usage:/,/^# *.*--help/ {
1167 s/^# //
1168 s/^# *$//
1169 s/\$progname/'$progname'/
1171 }' < "$progpath"
1172 echo
1173 $ECHO "run \`$progname --help | more' for full usage"
1174 exit $?
1177 # func_help [NOEXIT]
1178 # Echo long help message to standard output and exit,
1179 # unless 'noexit' is passed as argument.
1180 func_help ()
1182 $opt_debug
1184 $SED -n '/^# Usage:/,/# Report bugs to/ {
1185 :print
1186 s/^# //
1187 s/^# *$//
1188 s*\$progname*'$progname'*
1189 s*\$host*'"$host"'*
1190 s*\$SHELL*'"$SHELL"'*
1191 s*\$LTCC*'"$LTCC"'*
1192 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1193 s*\$LD*'"$LD"'*
1194 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1195 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
1196 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
1200 /^# .* home page:/b print
1201 /^# General help using/b print
1202 ' < "$progpath"
1203 ret=$?
1204 if test -z "$1"; then
1205 exit $ret
1209 # func_missing_arg argname
1210 # Echo program name prefixed message to standard error and set global
1211 # exit_cmd.
1212 func_missing_arg ()
1214 $opt_debug
1216 func_error "missing argument for $1."
1217 exit_cmd=exit
1221 # func_split_short_opt shortopt
1222 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1223 # variables after splitting SHORTOPT after the 2nd character.
1224 func_split_short_opt ()
1226 func_split_short_opt_arg=${1#??}
1227 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1228 } # Extended-shell func_split_short_opt implementation
1231 # func_split_long_opt longopt
1232 # Set func_split_long_opt_name and func_split_long_opt_arg shell
1233 # variables after splitting LONGOPT at the `=' sign.
1234 func_split_long_opt ()
1236 func_split_long_opt_name=${1%%=*}
1237 func_split_long_opt_arg=${1#*=}
1238 } # Extended-shell func_split_long_opt implementation
1240 exit_cmd=:
1246 magic="%%%MAGIC variable%%%"
1247 magic_exe="%%%MAGIC EXE variable%%%"
1249 # Global variables.
1250 nonopt=
1251 preserve_args=
1252 lo2o="s/\\.lo\$/.${objext}/"
1253 o2lo="s/\\.${objext}\$/.lo/"
1254 extracted_archives=
1255 extracted_serial=0
1257 # If this variable is set in any of the actions, the command in it
1258 # will be execed at the end. This prevents here-documents from being
1259 # left over by shells.
1260 exec_cmd=
1262 # func_append var value
1263 # Append VALUE to the end of shell variable VAR.
1264 func_append ()
1266 eval "${1}+=\${2}"
1267 } # Extended-shell func_append implementation
1269 # func_append_quoted var value
1270 # Quote VALUE and append to the end of shell variable VAR, separated
1271 # by a space.
1272 func_append_quoted ()
1274 func_quote_for_eval "${2}"
1275 eval "${1}+=\\ \$func_quote_for_eval_result"
1276 } # Extended-shell func_append_quoted implementation
1279 # func_arith arithmetic-term...
1280 func_arith ()
1282 func_arith_result=$(( $* ))
1283 } # Extended-shell func_arith implementation
1286 # func_len string
1287 # STRING may not start with a hyphen.
1288 func_len ()
1290 func_len_result=${#1}
1291 } # Extended-shell func_len implementation
1294 # func_lo2o object
1295 func_lo2o ()
1297 case ${1} in
1298 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
1299 *) func_lo2o_result=${1} ;;
1300 esac
1301 } # Extended-shell func_lo2o implementation
1304 # func_xform libobj-or-source
1305 func_xform ()
1307 func_xform_result=${1%.*}.lo
1308 } # Extended-shell func_xform implementation
1311 # func_fatal_configuration arg...
1312 # Echo program name prefixed message to standard error, followed by
1313 # a configuration failure hint, and exit.
1314 func_fatal_configuration ()
1316 func_error ${1+"$@"}
1317 func_error "See the $PACKAGE documentation for more information."
1318 func_fatal_error "Fatal configuration error."
1322 # func_config
1323 # Display the configuration for all the tags in this script.
1324 func_config ()
1326 re_begincf='^# ### BEGIN LIBTOOL'
1327 re_endcf='^# ### END LIBTOOL'
1329 # Default configuration.
1330 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1332 # Now print the configurations for the tags.
1333 for tagname in $taglist; do
1334 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1335 done
1337 exit $?
1340 # func_features
1341 # Display the features supported by this script.
1342 func_features ()
1344 echo "host: $host"
1345 if test "$build_libtool_libs" = yes; then
1346 echo "enable shared libraries"
1347 else
1348 echo "disable shared libraries"
1350 if test "$build_old_libs" = yes; then
1351 echo "enable static libraries"
1352 else
1353 echo "disable static libraries"
1356 exit $?
1359 # func_enable_tag tagname
1360 # Verify that TAGNAME is valid, and either flag an error and exit, or
1361 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1362 # variable here.
1363 func_enable_tag ()
1365 # Global variable:
1366 tagname="$1"
1368 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1369 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1370 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1372 # Validate tagname.
1373 case $tagname in
1374 *[!-_A-Za-z0-9,/]*)
1375 func_fatal_error "invalid tag name: $tagname"
1377 esac
1379 # Don't test for the "default" C tag, as we know it's
1380 # there but not specially marked.
1381 case $tagname in
1382 CC) ;;
1384 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1385 taglist="$taglist $tagname"
1387 # Evaluate the configuration. Be careful to quote the path
1388 # and the sed script, to avoid splitting on whitespace, but
1389 # also don't use non-portable quotes within backquotes within
1390 # quotes we have to do it in 2 steps:
1391 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1392 eval "$extractedcf"
1393 else
1394 func_error "ignoring unknown tag $tagname"
1397 esac
1400 # func_check_version_match
1401 # Ensure that we are using m4 macros, and libtool script from the same
1402 # release of libtool.
1403 func_check_version_match ()
1405 if test "$package_revision" != "$macro_revision"; then
1406 if test "$VERSION" != "$macro_version"; then
1407 if test -z "$macro_version"; then
1408 cat >&2 <<_LT_EOF
1409 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1410 $progname: definition of this LT_INIT comes from an older release.
1411 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1412 $progname: and run autoconf again.
1413 _LT_EOF
1414 else
1415 cat >&2 <<_LT_EOF
1416 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1417 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1418 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1419 $progname: and run autoconf again.
1420 _LT_EOF
1422 else
1423 cat >&2 <<_LT_EOF
1424 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1425 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1426 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1427 $progname: of $PACKAGE $VERSION and run autoconf again.
1428 _LT_EOF
1431 exit $EXIT_MISMATCH
1436 # Shorthand for --mode=foo, only valid as the first argument
1437 case $1 in
1438 clean|clea|cle|cl)
1439 shift; set dummy --mode clean ${1+"$@"}; shift
1441 compile|compil|compi|comp|com|co|c)
1442 shift; set dummy --mode compile ${1+"$@"}; shift
1444 execute|execut|execu|exec|exe|ex|e)
1445 shift; set dummy --mode execute ${1+"$@"}; shift
1447 finish|finis|fini|fin|fi|f)
1448 shift; set dummy --mode finish ${1+"$@"}; shift
1450 install|instal|insta|inst|ins|in|i)
1451 shift; set dummy --mode install ${1+"$@"}; shift
1453 link|lin|li|l)
1454 shift; set dummy --mode link ${1+"$@"}; shift
1456 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1457 shift; set dummy --mode uninstall ${1+"$@"}; shift
1459 esac
1463 # Option defaults:
1464 opt_debug=:
1465 opt_dry_run=false
1466 opt_config=false
1467 opt_preserve_dup_deps=false
1468 opt_features=false
1469 opt_finish=false
1470 opt_help=false
1471 opt_help_all=false
1472 opt_silent=:
1473 opt_warning=:
1474 opt_verbose=:
1475 opt_silent=false
1476 opt_verbose=false
1479 # Parse options once, thoroughly. This comes as soon as possible in the
1480 # script to make things like `--version' happen as quickly as we can.
1482 # this just eases exit handling
1483 while test $# -gt 0; do
1484 opt="$1"
1485 shift
1486 case $opt in
1487 --debug|-x) opt_debug='set -x'
1488 func_echo "enabling shell trace mode"
1489 $opt_debug
1491 --dry-run|--dryrun|-n)
1492 opt_dry_run=:
1494 --config)
1495 opt_config=:
1496 func_config
1498 --dlopen|-dlopen)
1499 optarg="$1"
1500 opt_dlopen="${opt_dlopen+$opt_dlopen
1501 }$optarg"
1502 shift
1504 --preserve-dup-deps)
1505 opt_preserve_dup_deps=:
1507 --features)
1508 opt_features=:
1509 func_features
1511 --finish)
1512 opt_finish=:
1513 set dummy --mode finish ${1+"$@"}; shift
1515 --help)
1516 opt_help=:
1518 --help-all)
1519 opt_help_all=:
1520 opt_help=': help-all'
1522 --mode)
1523 test $# = 0 && func_missing_arg $opt && break
1524 optarg="$1"
1525 opt_mode="$optarg"
1526 case $optarg in
1527 # Valid mode arguments:
1528 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1530 # Catch anything else as an error
1531 *) func_error "invalid argument for $opt"
1532 exit_cmd=exit
1533 break
1535 esac
1536 shift
1538 --no-silent|--no-quiet)
1539 opt_silent=false
1540 preserve_args+=" $opt"
1542 --no-warning|--no-warn)
1543 opt_warning=false
1544 preserve_args+=" $opt"
1546 --no-verbose)
1547 opt_verbose=false
1548 preserve_args+=" $opt"
1550 --silent|--quiet)
1551 opt_silent=:
1552 preserve_args+=" $opt"
1553 opt_verbose=false
1555 --verbose|-v)
1556 opt_verbose=:
1557 preserve_args+=" $opt"
1558 opt_silent=false
1560 --tag)
1561 test $# = 0 && func_missing_arg $opt && break
1562 optarg="$1"
1563 opt_tag="$optarg"
1564 preserve_args+=" $opt $optarg"
1565 func_enable_tag "$optarg"
1566 shift
1569 -\?|-h) func_usage ;;
1570 --help) func_help ;;
1571 --version) func_version ;;
1573 # Separate optargs to long options:
1574 --*=*)
1575 func_split_long_opt "$opt"
1576 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1577 shift
1580 # Separate non-argument short options:
1581 -\?*|-h*|-n*|-v*)
1582 func_split_short_opt "$opt"
1583 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1584 shift
1587 --) break ;;
1588 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1589 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
1590 esac
1591 done
1593 # Validate options:
1595 # save first non-option argument
1596 if test "$#" -gt 0; then
1597 nonopt="$opt"
1598 shift
1601 # preserve --debug
1602 test "$opt_debug" = : || preserve_args+=" --debug"
1604 case $host in
1605 *cygwin* | *mingw* | *pw32* | *cegcc*)
1606 # don't eliminate duplications in $postdeps and $predeps
1607 opt_duplicate_compiler_generated_deps=:
1610 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1612 esac
1614 $opt_help || {
1615 # Sanity checks first:
1616 func_check_version_match
1618 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1619 func_fatal_configuration "not configured to build any kind of library"
1622 # Darwin sucks
1623 eval std_shrext=\"$shrext_cmds\"
1625 # Only execute mode is allowed to have -dlopen flags.
1626 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1627 func_error "unrecognized option \`-dlopen'"
1628 $ECHO "$help" 1>&2
1629 exit $EXIT_FAILURE
1632 # Change the help message to a mode-specific one.
1633 generic_help="$help"
1634 help="Try \`$progname --help --mode=$opt_mode' for more information."
1638 # Bail if the options were screwed
1639 $exit_cmd $EXIT_FAILURE
1645 ## ----------- ##
1646 ## Main. ##
1647 ## ----------- ##
1649 # func_lalib_p file
1650 # True iff FILE is a libtool `.la' library or `.lo' object file.
1651 # This function is only a basic sanity check; it will hardly flush out
1652 # determined imposters.
1653 func_lalib_p ()
1655 test -f "$1" &&
1656 $SED -e 4q "$1" 2>/dev/null \
1657 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1660 # func_lalib_unsafe_p file
1661 # True iff FILE is a libtool `.la' library or `.lo' object file.
1662 # This function implements the same check as func_lalib_p without
1663 # resorting to external programs. To this end, it redirects stdin and
1664 # closes it afterwards, without saving the original file descriptor.
1665 # As a safety measure, use it only where a negative result would be
1666 # fatal anyway. Works if `file' does not exist.
1667 func_lalib_unsafe_p ()
1669 lalib_p=no
1670 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1671 for lalib_p_l in 1 2 3 4
1673 read lalib_p_line
1674 case "$lalib_p_line" in
1675 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1676 esac
1677 done
1678 exec 0<&5 5<&-
1680 test "$lalib_p" = yes
1683 # func_ltwrapper_script_p file
1684 # True iff FILE is a libtool wrapper script
1685 # This function is only a basic sanity check; it will hardly flush out
1686 # determined imposters.
1687 func_ltwrapper_script_p ()
1689 func_lalib_p "$1"
1692 # func_ltwrapper_executable_p file
1693 # True iff FILE is a libtool wrapper executable
1694 # This function is only a basic sanity check; it will hardly flush out
1695 # determined imposters.
1696 func_ltwrapper_executable_p ()
1698 func_ltwrapper_exec_suffix=
1699 case $1 in
1700 *.exe) ;;
1701 *) func_ltwrapper_exec_suffix=.exe ;;
1702 esac
1703 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1706 # func_ltwrapper_scriptname file
1707 # Assumes file is an ltwrapper_executable
1708 # uses $file to determine the appropriate filename for a
1709 # temporary ltwrapper_script.
1710 func_ltwrapper_scriptname ()
1712 func_dirname_and_basename "$1" "" "."
1713 func_stripname '' '.exe' "$func_basename_result"
1714 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1717 # func_ltwrapper_p file
1718 # True iff FILE is a libtool wrapper script or wrapper executable
1719 # This function is only a basic sanity check; it will hardly flush out
1720 # determined imposters.
1721 func_ltwrapper_p ()
1723 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1727 # func_execute_cmds commands fail_cmd
1728 # Execute tilde-delimited COMMANDS.
1729 # If FAIL_CMD is given, eval that upon failure.
1730 # FAIL_CMD may read-access the current command in variable CMD!
1731 func_execute_cmds ()
1733 $opt_debug
1734 save_ifs=$IFS; IFS='~'
1735 for cmd in $1; do
1736 IFS=$save_ifs
1737 eval cmd=\"$cmd\"
1738 func_show_eval "$cmd" "${2-:}"
1739 done
1740 IFS=$save_ifs
1744 # func_source file
1745 # Source FILE, adding directory component if necessary.
1746 # Note that it is not necessary on cygwin/mingw to append a dot to
1747 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1748 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1749 # `FILE.' does not work on cygwin managed mounts.
1750 func_source ()
1752 $opt_debug
1753 case $1 in
1754 */* | *\\*) . "$1" ;;
1755 *) . "./$1" ;;
1756 esac
1760 # func_resolve_sysroot PATH
1761 # Replace a leading = in PATH with a sysroot. Store the result into
1762 # func_resolve_sysroot_result
1763 func_resolve_sysroot ()
1765 func_resolve_sysroot_result=$1
1766 case $func_resolve_sysroot_result in
1768 func_stripname '=' '' "$func_resolve_sysroot_result"
1769 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1771 esac
1774 # func_replace_sysroot PATH
1775 # If PATH begins with the sysroot, replace it with = and
1776 # store the result into func_replace_sysroot_result.
1777 func_replace_sysroot ()
1779 case "$lt_sysroot:$1" in
1780 ?*:"$lt_sysroot"*)
1781 func_stripname "$lt_sysroot" '' "$1"
1782 func_replace_sysroot_result="=$func_stripname_result"
1785 # Including no sysroot.
1786 func_replace_sysroot_result=$1
1788 esac
1791 # func_infer_tag arg
1792 # Infer tagged configuration to use if any are available and
1793 # if one wasn't chosen via the "--tag" command line option.
1794 # Only attempt this if the compiler in the base compile
1795 # command doesn't match the default compiler.
1796 # arg is usually of the form 'gcc ...'
1797 func_infer_tag ()
1799 $opt_debug
1800 if test -n "$available_tags" && test -z "$tagname"; then
1801 CC_quoted=
1802 for arg in $CC; do
1803 func_append_quoted CC_quoted "$arg"
1804 done
1805 CC_expanded=`func_echo_all $CC`
1806 CC_quoted_expanded=`func_echo_all $CC_quoted`
1807 case $@ in
1808 # Blanks in the command may have been stripped by the calling shell,
1809 # but not from the CC environment variable when configure was run.
1810 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1811 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1812 # Blanks at the start of $base_compile will cause this to fail
1813 # if we don't check for them as well.
1815 for z in $available_tags; do
1816 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1817 # Evaluate the configuration.
1818 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1819 CC_quoted=
1820 for arg in $CC; do
1821 # Double-quote args containing other shell metacharacters.
1822 func_append_quoted CC_quoted "$arg"
1823 done
1824 CC_expanded=`func_echo_all $CC`
1825 CC_quoted_expanded=`func_echo_all $CC_quoted`
1826 case "$@ " in
1827 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1828 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1829 # The compiler in the base compile command matches
1830 # the one in the tagged configuration.
1831 # Assume this is the tagged configuration we want.
1832 tagname=$z
1833 break
1835 esac
1837 done
1838 # If $tagname still isn't set, then no tagged configuration
1839 # was found and let the user know that the "--tag" command
1840 # line option must be used.
1841 if test -z "$tagname"; then
1842 func_echo "unable to infer tagged configuration"
1843 func_fatal_error "specify a tag with \`--tag'"
1844 # else
1845 # func_verbose "using $tagname tagged configuration"
1848 esac
1854 # func_write_libtool_object output_name pic_name nonpic_name
1855 # Create a libtool object file (analogous to a ".la" file),
1856 # but don't create it if we're doing a dry run.
1857 func_write_libtool_object ()
1859 write_libobj=${1}
1860 if test "$build_libtool_libs" = yes; then
1861 write_lobj=\'${2}\'
1862 else
1863 write_lobj=none
1866 if test "$build_old_libs" = yes; then
1867 write_oldobj=\'${3}\'
1868 else
1869 write_oldobj=none
1872 $opt_dry_run || {
1873 cat >${write_libobj}T <<EOF
1874 # $write_libobj - a libtool object file
1875 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1877 # Please DO NOT delete this file!
1878 # It is necessary for linking the library.
1880 # Name of the PIC object.
1881 pic_object=$write_lobj
1883 # Name of the non-PIC object
1884 non_pic_object=$write_oldobj
1887 $MV "${write_libobj}T" "${write_libobj}"
1892 ##################################################
1893 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1894 ##################################################
1896 # func_convert_core_file_wine_to_w32 ARG
1897 # Helper function used by file name conversion functions when $build is *nix,
1898 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
1899 # correctly configured wine environment available, with the winepath program
1900 # in $build's $PATH.
1902 # ARG is the $build file name to be converted to w32 format.
1903 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
1904 # be empty on error (or when ARG is empty)
1905 func_convert_core_file_wine_to_w32 ()
1907 $opt_debug
1908 func_convert_core_file_wine_to_w32_result="$1"
1909 if test -n "$1"; then
1910 # Unfortunately, winepath does not exit with a non-zero error code, so we
1911 # are forced to check the contents of stdout. On the other hand, if the
1912 # command is not found, the shell will set an exit code of 127 and print
1913 # *an error message* to stdout. So we must check for both error code of
1914 # zero AND non-empty stdout, which explains the odd construction:
1915 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1916 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1917 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1918 $SED -e "$lt_sed_naive_backslashify"`
1919 else
1920 func_convert_core_file_wine_to_w32_result=
1924 # end: func_convert_core_file_wine_to_w32
1927 # func_convert_core_path_wine_to_w32 ARG
1928 # Helper function used by path conversion functions when $build is *nix, and
1929 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1930 # configured wine environment available, with the winepath program in $build's
1931 # $PATH. Assumes ARG has no leading or trailing path separator characters.
1933 # ARG is path to be converted from $build format to win32.
1934 # Result is available in $func_convert_core_path_wine_to_w32_result.
1935 # Unconvertible file (directory) names in ARG are skipped; if no directory names
1936 # are convertible, then the result may be empty.
1937 func_convert_core_path_wine_to_w32 ()
1939 $opt_debug
1940 # unfortunately, winepath doesn't convert paths, only file names
1941 func_convert_core_path_wine_to_w32_result=""
1942 if test -n "$1"; then
1943 oldIFS=$IFS
1944 IFS=:
1945 for func_convert_core_path_wine_to_w32_f in $1; do
1946 IFS=$oldIFS
1947 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1948 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1949 if test -z "$func_convert_core_path_wine_to_w32_result"; then
1950 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1951 else
1952 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1955 done
1956 IFS=$oldIFS
1959 # end: func_convert_core_path_wine_to_w32
1962 # func_cygpath ARGS...
1963 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1964 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1965 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1966 # (2), returns the Cygwin file name or path in func_cygpath_result (input
1967 # file name or path is assumed to be in w32 format, as previously converted
1968 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
1969 # or path in func_cygpath_result (input file name or path is assumed to be in
1970 # Cygwin format). Returns an empty string on error.
1972 # ARGS are passed to cygpath, with the last one being the file name or path to
1973 # be converted.
1975 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1976 # environment variable; do not put it in $PATH.
1977 func_cygpath ()
1979 $opt_debug
1980 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1981 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1982 if test "$?" -ne 0; then
1983 # on failure, ensure result is empty
1984 func_cygpath_result=
1986 else
1987 func_cygpath_result=
1988 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1991 #end: func_cygpath
1994 # func_convert_core_msys_to_w32 ARG
1995 # Convert file name or path ARG from MSYS format to w32 format. Return
1996 # result in func_convert_core_msys_to_w32_result.
1997 func_convert_core_msys_to_w32 ()
1999 $opt_debug
2000 # awkward: cmd appends spaces to result
2001 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
2002 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
2004 #end: func_convert_core_msys_to_w32
2007 # func_convert_file_check ARG1 ARG2
2008 # Verify that ARG1 (a file name in $build format) was converted to $host
2009 # format in ARG2. Otherwise, emit an error message, but continue (resetting
2010 # func_to_host_file_result to ARG1).
2011 func_convert_file_check ()
2013 $opt_debug
2014 if test -z "$2" && test -n "$1" ; then
2015 func_error "Could not determine host file name corresponding to"
2016 func_error " \`$1'"
2017 func_error "Continuing, but uninstalled executables may not work."
2018 # Fallback:
2019 func_to_host_file_result="$1"
2022 # end func_convert_file_check
2025 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
2026 # Verify that FROM_PATH (a path in $build format) was converted to $host
2027 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
2028 # func_to_host_file_result to a simplistic fallback value (see below).
2029 func_convert_path_check ()
2031 $opt_debug
2032 if test -z "$4" && test -n "$3"; then
2033 func_error "Could not determine the host path corresponding to"
2034 func_error " \`$3'"
2035 func_error "Continuing, but uninstalled executables may not work."
2036 # Fallback. This is a deliberately simplistic "conversion" and
2037 # should not be "improved". See libtool.info.
2038 if test "x$1" != "x$2"; then
2039 lt_replace_pathsep_chars="s|$1|$2|g"
2040 func_to_host_path_result=`echo "$3" |
2041 $SED -e "$lt_replace_pathsep_chars"`
2042 else
2043 func_to_host_path_result="$3"
2047 # end func_convert_path_check
2050 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
2051 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
2052 # and appending REPL if ORIG matches BACKPAT.
2053 func_convert_path_front_back_pathsep ()
2055 $opt_debug
2056 case $4 in
2057 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
2059 esac
2060 case $4 in
2061 $2 ) func_to_host_path_result+="$3"
2063 esac
2065 # end func_convert_path_front_back_pathsep
2068 ##################################################
2069 # $build to $host FILE NAME CONVERSION FUNCTIONS #
2070 ##################################################
2071 # invoked via `$to_host_file_cmd ARG'
2073 # In each case, ARG is the path to be converted from $build to $host format.
2074 # Result will be available in $func_to_host_file_result.
2077 # func_to_host_file ARG
2078 # Converts the file name ARG from $build format to $host format. Return result
2079 # in func_to_host_file_result.
2080 func_to_host_file ()
2082 $opt_debug
2083 $to_host_file_cmd "$1"
2085 # end func_to_host_file
2088 # func_to_tool_file ARG LAZY
2089 # converts the file name ARG from $build format to toolchain format. Return
2090 # result in func_to_tool_file_result. If the conversion in use is listed
2091 # in (the comma separated) LAZY, no conversion takes place.
2092 func_to_tool_file ()
2094 $opt_debug
2095 case ,$2, in
2096 *,"$to_tool_file_cmd",*)
2097 func_to_tool_file_result=$1
2100 $to_tool_file_cmd "$1"
2101 func_to_tool_file_result=$func_to_host_file_result
2103 esac
2105 # end func_to_tool_file
2108 # func_convert_file_noop ARG
2109 # Copy ARG to func_to_host_file_result.
2110 func_convert_file_noop ()
2112 func_to_host_file_result="$1"
2114 # end func_convert_file_noop
2117 # func_convert_file_msys_to_w32 ARG
2118 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
2119 # conversion to w32 is not available inside the cwrapper. Returns result in
2120 # func_to_host_file_result.
2121 func_convert_file_msys_to_w32 ()
2123 $opt_debug
2124 func_to_host_file_result="$1"
2125 if test -n "$1"; then
2126 func_convert_core_msys_to_w32 "$1"
2127 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
2129 func_convert_file_check "$1" "$func_to_host_file_result"
2131 # end func_convert_file_msys_to_w32
2134 # func_convert_file_cygwin_to_w32 ARG
2135 # Convert file name ARG from Cygwin to w32 format. Returns result in
2136 # func_to_host_file_result.
2137 func_convert_file_cygwin_to_w32 ()
2139 $opt_debug
2140 func_to_host_file_result="$1"
2141 if test -n "$1"; then
2142 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
2143 # LT_CYGPATH in this case.
2144 func_to_host_file_result=`cygpath -m "$1"`
2146 func_convert_file_check "$1" "$func_to_host_file_result"
2148 # end func_convert_file_cygwin_to_w32
2151 # func_convert_file_nix_to_w32 ARG
2152 # Convert file name ARG from *nix to w32 format. Requires a wine environment
2153 # and a working winepath. Returns result in func_to_host_file_result.
2154 func_convert_file_nix_to_w32 ()
2156 $opt_debug
2157 func_to_host_file_result="$1"
2158 if test -n "$1"; then
2159 func_convert_core_file_wine_to_w32 "$1"
2160 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
2162 func_convert_file_check "$1" "$func_to_host_file_result"
2164 # end func_convert_file_nix_to_w32
2167 # func_convert_file_msys_to_cygwin ARG
2168 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
2169 # Returns result in func_to_host_file_result.
2170 func_convert_file_msys_to_cygwin ()
2172 $opt_debug
2173 func_to_host_file_result="$1"
2174 if test -n "$1"; then
2175 func_convert_core_msys_to_w32 "$1"
2176 func_cygpath -u "$func_convert_core_msys_to_w32_result"
2177 func_to_host_file_result="$func_cygpath_result"
2179 func_convert_file_check "$1" "$func_to_host_file_result"
2181 # end func_convert_file_msys_to_cygwin
2184 # func_convert_file_nix_to_cygwin ARG
2185 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
2186 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
2187 # in func_to_host_file_result.
2188 func_convert_file_nix_to_cygwin ()
2190 $opt_debug
2191 func_to_host_file_result="$1"
2192 if test -n "$1"; then
2193 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
2194 func_convert_core_file_wine_to_w32 "$1"
2195 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
2196 func_to_host_file_result="$func_cygpath_result"
2198 func_convert_file_check "$1" "$func_to_host_file_result"
2200 # end func_convert_file_nix_to_cygwin
2203 #############################################
2204 # $build to $host PATH CONVERSION FUNCTIONS #
2205 #############################################
2206 # invoked via `$to_host_path_cmd ARG'
2208 # In each case, ARG is the path to be converted from $build to $host format.
2209 # The result will be available in $func_to_host_path_result.
2211 # Path separators are also converted from $build format to $host format. If
2212 # ARG begins or ends with a path separator character, it is preserved (but
2213 # converted to $host format) on output.
2215 # All path conversion functions are named using the following convention:
2216 # file name conversion function : func_convert_file_X_to_Y ()
2217 # path conversion function : func_convert_path_X_to_Y ()
2218 # where, for any given $build/$host combination the 'X_to_Y' value is the
2219 # same. If conversion functions are added for new $build/$host combinations,
2220 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
2221 # will break.
2224 # func_init_to_host_path_cmd
2225 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
2226 # appropriate value, based on the value of $to_host_file_cmd.
2227 to_host_path_cmd=
2228 func_init_to_host_path_cmd ()
2230 $opt_debug
2231 if test -z "$to_host_path_cmd"; then
2232 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
2233 to_host_path_cmd="func_convert_path_${func_stripname_result}"
2238 # func_to_host_path ARG
2239 # Converts the path ARG from $build format to $host format. Return result
2240 # in func_to_host_path_result.
2241 func_to_host_path ()
2243 $opt_debug
2244 func_init_to_host_path_cmd
2245 $to_host_path_cmd "$1"
2247 # end func_to_host_path
2250 # func_convert_path_noop ARG
2251 # Copy ARG to func_to_host_path_result.
2252 func_convert_path_noop ()
2254 func_to_host_path_result="$1"
2256 # end func_convert_path_noop
2259 # func_convert_path_msys_to_w32 ARG
2260 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
2261 # conversion to w32 is not available inside the cwrapper. Returns result in
2262 # func_to_host_path_result.
2263 func_convert_path_msys_to_w32 ()
2265 $opt_debug
2266 func_to_host_path_result="$1"
2267 if test -n "$1"; then
2268 # Remove leading and trailing path separator characters from ARG. MSYS
2269 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
2270 # and winepath ignores them completely.
2271 func_stripname : : "$1"
2272 func_to_host_path_tmp1=$func_stripname_result
2273 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
2274 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
2275 func_convert_path_check : ";" \
2276 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2277 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2280 # end func_convert_path_msys_to_w32
2283 # func_convert_path_cygwin_to_w32 ARG
2284 # Convert path ARG from Cygwin to w32 format. Returns result in
2285 # func_to_host_file_result.
2286 func_convert_path_cygwin_to_w32 ()
2288 $opt_debug
2289 func_to_host_path_result="$1"
2290 if test -n "$1"; then
2291 # See func_convert_path_msys_to_w32:
2292 func_stripname : : "$1"
2293 func_to_host_path_tmp1=$func_stripname_result
2294 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
2295 func_convert_path_check : ";" \
2296 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2297 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2300 # end func_convert_path_cygwin_to_w32
2303 # func_convert_path_nix_to_w32 ARG
2304 # Convert path ARG from *nix to w32 format. Requires a wine environment and
2305 # a working winepath. Returns result in func_to_host_file_result.
2306 func_convert_path_nix_to_w32 ()
2308 $opt_debug
2309 func_to_host_path_result="$1"
2310 if test -n "$1"; then
2311 # See func_convert_path_msys_to_w32:
2312 func_stripname : : "$1"
2313 func_to_host_path_tmp1=$func_stripname_result
2314 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
2315 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
2316 func_convert_path_check : ";" \
2317 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2318 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2321 # end func_convert_path_nix_to_w32
2324 # func_convert_path_msys_to_cygwin ARG
2325 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
2326 # Returns result in func_to_host_file_result.
2327 func_convert_path_msys_to_cygwin ()
2329 $opt_debug
2330 func_to_host_path_result="$1"
2331 if test -n "$1"; then
2332 # See func_convert_path_msys_to_w32:
2333 func_stripname : : "$1"
2334 func_to_host_path_tmp1=$func_stripname_result
2335 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
2336 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
2337 func_to_host_path_result="$func_cygpath_result"
2338 func_convert_path_check : : \
2339 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2340 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
2343 # end func_convert_path_msys_to_cygwin
2346 # func_convert_path_nix_to_cygwin ARG
2347 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
2348 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
2349 # func_to_host_file_result.
2350 func_convert_path_nix_to_cygwin ()
2352 $opt_debug
2353 func_to_host_path_result="$1"
2354 if test -n "$1"; then
2355 # Remove leading and trailing path separator characters from
2356 # ARG. msys behavior is inconsistent here, cygpath turns them
2357 # into '.;' and ';.', and winepath ignores them completely.
2358 func_stripname : : "$1"
2359 func_to_host_path_tmp1=$func_stripname_result
2360 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
2361 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
2362 func_to_host_path_result="$func_cygpath_result"
2363 func_convert_path_check : : \
2364 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2365 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
2368 # end func_convert_path_nix_to_cygwin
2371 # func_mode_compile arg...
2372 func_mode_compile ()
2374 $opt_debug
2375 # Get the compilation command and the source file.
2376 base_compile=
2377 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
2378 suppress_opt=yes
2379 suppress_output=
2380 arg_mode=normal
2381 libobj=
2382 later=
2383 pie_flag=
2385 for arg
2387 case $arg_mode in
2388 arg )
2389 # do not "continue". Instead, add this to base_compile
2390 lastarg="$arg"
2391 arg_mode=normal
2394 target )
2395 libobj="$arg"
2396 arg_mode=normal
2397 continue
2400 normal )
2401 # Accept any command-line options.
2402 case $arg in
2404 test -n "$libobj" && \
2405 func_fatal_error "you cannot specify \`-o' more than once"
2406 arg_mode=target
2407 continue
2410 -pie | -fpie | -fPIE)
2411 pie_flag+=" $arg"
2412 continue
2415 -shared | -static | -prefer-pic | -prefer-non-pic)
2416 later+=" $arg"
2417 continue
2420 -no-suppress)
2421 suppress_opt=no
2422 continue
2425 -Xcompiler)
2426 arg_mode=arg # the next one goes into the "base_compile" arg list
2427 continue # The current "srcfile" will either be retained or
2428 ;; # replaced later. I would guess that would be a bug.
2430 -Wc,*)
2431 func_stripname '-Wc,' '' "$arg"
2432 args=$func_stripname_result
2433 lastarg=
2434 save_ifs="$IFS"; IFS=','
2435 for arg in $args; do
2436 IFS="$save_ifs"
2437 func_append_quoted lastarg "$arg"
2438 done
2439 IFS="$save_ifs"
2440 func_stripname ' ' '' "$lastarg"
2441 lastarg=$func_stripname_result
2443 # Add the arguments to base_compile.
2444 base_compile+=" $lastarg"
2445 continue
2449 # Accept the current argument as the source file.
2450 # The previous "srcfile" becomes the current argument.
2452 lastarg="$srcfile"
2453 srcfile="$arg"
2455 esac # case $arg
2457 esac # case $arg_mode
2459 # Aesthetically quote the previous argument.
2460 func_append_quoted base_compile "$lastarg"
2461 done # for arg
2463 case $arg_mode in
2464 arg)
2465 func_fatal_error "you must specify an argument for -Xcompile"
2467 target)
2468 func_fatal_error "you must specify a target with \`-o'"
2471 # Get the name of the library object.
2472 test -z "$libobj" && {
2473 func_basename "$srcfile"
2474 libobj="$func_basename_result"
2477 esac
2479 # Recognize several different file suffixes.
2480 # If the user specifies -o file.o, it is replaced with file.lo
2481 case $libobj in
2482 *.[cCFSifmso] | \
2483 *.ada | *.adb | *.ads | *.asm | \
2484 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
2485 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
2486 func_xform "$libobj"
2487 libobj=$func_xform_result
2489 esac
2491 case $libobj in
2492 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2494 func_fatal_error "cannot determine name of library object from \`$libobj'"
2496 esac
2498 func_infer_tag $base_compile
2500 for arg in $later; do
2501 case $arg in
2502 -shared)
2503 test "$build_libtool_libs" != yes && \
2504 func_fatal_configuration "can not build a shared library"
2505 build_old_libs=no
2506 continue
2509 -static)
2510 build_libtool_libs=no
2511 build_old_libs=yes
2512 continue
2515 -prefer-pic)
2516 pic_mode=yes
2517 continue
2520 -prefer-non-pic)
2521 pic_mode=no
2522 continue
2524 esac
2525 done
2527 func_quote_for_eval "$libobj"
2528 test "X$libobj" != "X$func_quote_for_eval_result" \
2529 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2530 && func_warning "libobj name \`$libobj' may not contain shell special characters."
2531 func_dirname_and_basename "$obj" "/" ""
2532 objname="$func_basename_result"
2533 xdir="$func_dirname_result"
2534 lobj=${xdir}$objdir/$objname
2536 test -z "$base_compile" && \
2537 func_fatal_help "you must specify a compilation command"
2539 # Delete any leftover library objects.
2540 if test "$build_old_libs" = yes; then
2541 removelist="$obj $lobj $libobj ${libobj}T"
2542 else
2543 removelist="$lobj $libobj ${libobj}T"
2546 # On Cygwin there's no "real" PIC flag so we must build both object types
2547 case $host_os in
2548 cygwin* | mingw* | pw32* | os2* | cegcc*)
2549 pic_mode=default
2551 esac
2552 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2553 # non-PIC code in shared libraries is not supported
2554 pic_mode=default
2557 # Calculate the filename of the output object if compiler does
2558 # not support -o with -c
2559 if test "$compiler_c_o" = no; then
2560 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2561 lockfile="$output_obj.lock"
2562 else
2563 output_obj=
2564 need_locks=no
2565 lockfile=
2568 # Lock this critical section if it is needed
2569 # We use this script file to make the link, it avoids creating a new file
2570 if test "$need_locks" = yes; then
2571 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2572 func_echo "Waiting for $lockfile to be removed"
2573 sleep 2
2574 done
2575 elif test "$need_locks" = warn; then
2576 if test -f "$lockfile"; then
2577 $ECHO "\
2578 *** ERROR, $lockfile exists and contains:
2579 `cat $lockfile 2>/dev/null`
2581 This indicates that another process is trying to use the same
2582 temporary object file, and libtool could not work around it because
2583 your compiler does not support \`-c' and \`-o' together. If you
2584 repeat this compilation, it may succeed, by chance, but you had better
2585 avoid parallel builds (make -j) in this platform, or get a better
2586 compiler."
2588 $opt_dry_run || $RM $removelist
2589 exit $EXIT_FAILURE
2591 removelist+=" $output_obj"
2592 $ECHO "$srcfile" > "$lockfile"
2595 $opt_dry_run || $RM $removelist
2596 removelist+=" $lockfile"
2597 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2599 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2600 srcfile=$func_to_tool_file_result
2601 func_quote_for_eval "$srcfile"
2602 qsrcfile=$func_quote_for_eval_result
2604 # Only build a PIC object if we are building libtool libraries.
2605 if test "$build_libtool_libs" = yes; then
2606 # Without this assignment, base_compile gets emptied.
2607 fbsd_hideous_sh_bug=$base_compile
2609 if test "$pic_mode" != no; then
2610 command="$base_compile $qsrcfile $pic_flag"
2611 else
2612 # Don't build PIC code
2613 command="$base_compile $qsrcfile"
2616 func_mkdir_p "$xdir$objdir"
2618 if test -z "$output_obj"; then
2619 # Place PIC objects in $objdir
2620 command+=" -o $lobj"
2623 func_show_eval_locale "$command" \
2624 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2626 if test "$need_locks" = warn &&
2627 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2628 $ECHO "\
2629 *** ERROR, $lockfile contains:
2630 `cat $lockfile 2>/dev/null`
2632 but it should contain:
2633 $srcfile
2635 This indicates that another process is trying to use the same
2636 temporary object file, and libtool could not work around it because
2637 your compiler does not support \`-c' and \`-o' together. If you
2638 repeat this compilation, it may succeed, by chance, but you had better
2639 avoid parallel builds (make -j) in this platform, or get a better
2640 compiler."
2642 $opt_dry_run || $RM $removelist
2643 exit $EXIT_FAILURE
2646 # Just move the object if needed, then go on to compile the next one
2647 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2648 func_show_eval '$MV "$output_obj" "$lobj"' \
2649 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2652 # Allow error messages only from the first compilation.
2653 if test "$suppress_opt" = yes; then
2654 suppress_output=' >/dev/null 2>&1'
2658 # Only build a position-dependent object if we build old libraries.
2659 if test "$build_old_libs" = yes; then
2660 if test "$pic_mode" != yes; then
2661 # Don't build PIC code
2662 command="$base_compile $qsrcfile$pie_flag"
2663 else
2664 command="$base_compile $qsrcfile $pic_flag"
2666 if test "$compiler_c_o" = yes; then
2667 command+=" -o $obj"
2670 # Suppress compiler output if we already did a PIC compilation.
2671 command+="$suppress_output"
2672 func_show_eval_locale "$command" \
2673 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2675 if test "$need_locks" = warn &&
2676 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2677 $ECHO "\
2678 *** ERROR, $lockfile contains:
2679 `cat $lockfile 2>/dev/null`
2681 but it should contain:
2682 $srcfile
2684 This indicates that another process is trying to use the same
2685 temporary object file, and libtool could not work around it because
2686 your compiler does not support \`-c' and \`-o' together. If you
2687 repeat this compilation, it may succeed, by chance, but you had better
2688 avoid parallel builds (make -j) in this platform, or get a better
2689 compiler."
2691 $opt_dry_run || $RM $removelist
2692 exit $EXIT_FAILURE
2695 # Just move the object if needed
2696 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2697 func_show_eval '$MV "$output_obj" "$obj"' \
2698 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2702 $opt_dry_run || {
2703 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2705 # Unlock the critical section if it was locked
2706 if test "$need_locks" != no; then
2707 removelist=$lockfile
2708 $RM "$lockfile"
2712 exit $EXIT_SUCCESS
2715 $opt_help || {
2716 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2719 func_mode_help ()
2721 # We need to display help for each of the modes.
2722 case $opt_mode in
2724 # Generic help is extracted from the usage comments
2725 # at the start of this file.
2726 func_help
2729 clean)
2730 $ECHO \
2731 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2733 Remove files from the build directory.
2735 RM is the name of the program to use to delete files associated with each FILE
2736 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2737 to RM.
2739 If FILE is a libtool library, object or program, all the files associated
2740 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2743 compile)
2744 $ECHO \
2745 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2747 Compile a source file into a libtool library object.
2749 This mode accepts the following additional options:
2751 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2752 -no-suppress do not suppress compiler output for multiple passes
2753 -prefer-pic try to build PIC objects only
2754 -prefer-non-pic try to build non-PIC objects only
2755 -shared do not build a \`.o' file suitable for static linking
2756 -static only build a \`.o' file suitable for static linking
2757 -Wc,FLAG pass FLAG directly to the compiler
2759 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2760 from the given SOURCEFILE.
2762 The output file name is determined by removing the directory component from
2763 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2764 library object suffix, \`.lo'."
2767 execute)
2768 $ECHO \
2769 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2771 Automatically set library path, then run a program.
2773 This mode accepts the following additional options:
2775 -dlopen FILE add the directory containing FILE to the library path
2777 This mode sets the library path environment variable according to \`-dlopen'
2778 flags.
2780 If any of the ARGS are libtool executable wrappers, then they are translated
2781 into their corresponding uninstalled binary, and any of their required library
2782 directories are added to the library path.
2784 Then, COMMAND is executed, with ARGS as arguments."
2787 finish)
2788 $ECHO \
2789 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2791 Complete the installation of libtool libraries.
2793 Each LIBDIR is a directory that contains libtool libraries.
2795 The commands that this mode executes may require superuser privileges. Use
2796 the \`--dry-run' option if you just want to see what would be executed."
2799 install)
2800 $ECHO \
2801 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2803 Install executables or libraries.
2805 INSTALL-COMMAND is the installation command. The first component should be
2806 either the \`install' or \`cp' program.
2808 The following components of INSTALL-COMMAND are treated specially:
2810 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2812 The rest of the components are interpreted as arguments to that command (only
2813 BSD-compatible install options are recognized)."
2816 link)
2817 $ECHO \
2818 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2820 Link object files or libraries together to form another library, or to
2821 create an executable program.
2823 LINK-COMMAND is a command using the C compiler that you would use to create
2824 a program from several object files.
2826 The following components of LINK-COMMAND are treated specially:
2828 -all-static do not do any dynamic linking at all
2829 -avoid-version do not add a version suffix if possible
2830 -bindir BINDIR specify path to binaries directory (for systems where
2831 libraries must be found in the PATH setting at runtime)
2832 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2833 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2834 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2835 -export-symbols SYMFILE
2836 try to export only the symbols listed in SYMFILE
2837 -export-symbols-regex REGEX
2838 try to export only the symbols matching REGEX
2839 -LLIBDIR search LIBDIR for required installed libraries
2840 -lNAME OUTPUT-FILE requires the installed library libNAME
2841 -module build a library that can dlopened
2842 -no-fast-install disable the fast-install mode
2843 -no-install link a not-installable executable
2844 -no-undefined declare that a library does not refer to external symbols
2845 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2846 -objectlist FILE Use a list of object files found in FILE to specify objects
2847 -precious-files-regex REGEX
2848 don't remove output files matching REGEX
2849 -release RELEASE specify package release information
2850 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2851 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2852 -shared only do dynamic linking of libtool libraries
2853 -shrext SUFFIX override the standard shared library file extension
2854 -static do not do any dynamic linking of uninstalled libtool libraries
2855 -static-libtool-libs
2856 do not do any dynamic linking of libtool libraries
2857 -version-info CURRENT[:REVISION[:AGE]]
2858 specify library version info [each variable defaults to 0]
2859 -weak LIBNAME declare that the target provides the LIBNAME interface
2860 -Wc,FLAG
2861 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2862 -Wl,FLAG
2863 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2864 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2866 All other options (arguments beginning with \`-') are ignored.
2868 Every other argument is treated as a filename. Files ending in \`.la' are
2869 treated as uninstalled libtool libraries, other files are standard or library
2870 object files.
2872 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2873 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2874 required, except when creating a convenience library.
2876 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2877 using \`ar' and \`ranlib', or on Windows using \`lib'.
2879 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2880 is created, otherwise an executable program is created."
2883 uninstall)
2884 $ECHO \
2885 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2887 Remove libraries from an installation directory.
2889 RM is the name of the program to use to delete files associated with each FILE
2890 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2891 to RM.
2893 If FILE is a libtool library, all the files associated with it are deleted.
2894 Otherwise, only FILE itself is deleted using RM."
2898 func_fatal_help "invalid operation mode \`$opt_mode'"
2900 esac
2902 echo
2903 $ECHO "Try \`$progname --help' for more information about other modes."
2906 # Now that we've collected a possible --mode arg, show help if necessary
2907 if $opt_help; then
2908 if test "$opt_help" = :; then
2909 func_mode_help
2910 else
2912 func_help noexit
2913 for opt_mode in compile link execute install finish uninstall clean; do
2914 func_mode_help
2915 done
2916 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2918 func_help noexit
2919 for opt_mode in compile link execute install finish uninstall clean; do
2920 echo
2921 func_mode_help
2922 done
2924 sed '1d
2925 /^When reporting/,/^Report/{
2930 /information about other modes/d
2931 /more detailed .*MODE/d
2932 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2934 exit $?
2938 # func_mode_execute arg...
2939 func_mode_execute ()
2941 $opt_debug
2942 # The first argument is the command name.
2943 cmd="$nonopt"
2944 test -z "$cmd" && \
2945 func_fatal_help "you must specify a COMMAND"
2947 # Handle -dlopen flags immediately.
2948 for file in $opt_dlopen; do
2949 test -f "$file" \
2950 || func_fatal_help "\`$file' is not a file"
2952 dir=
2953 case $file in
2954 *.la)
2955 func_resolve_sysroot "$file"
2956 file=$func_resolve_sysroot_result
2958 # Check to see that this really is a libtool archive.
2959 func_lalib_unsafe_p "$file" \
2960 || func_fatal_help "\`$lib' is not a valid libtool archive"
2962 # Read the libtool library.
2963 dlname=
2964 library_names=
2965 func_source "$file"
2967 # Skip this library if it cannot be dlopened.
2968 if test -z "$dlname"; then
2969 # Warn if it was a shared library.
2970 test -n "$library_names" && \
2971 func_warning "\`$file' was not linked with \`-export-dynamic'"
2972 continue
2975 func_dirname "$file" "" "."
2976 dir="$func_dirname_result"
2978 if test -f "$dir/$objdir/$dlname"; then
2979 dir+="/$objdir"
2980 else
2981 if test ! -f "$dir/$dlname"; then
2982 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2987 *.lo)
2988 # Just add the directory containing the .lo file.
2989 func_dirname "$file" "" "."
2990 dir="$func_dirname_result"
2994 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2995 continue
2997 esac
2999 # Get the absolute pathname.
3000 absdir=`cd "$dir" && pwd`
3001 test -n "$absdir" && dir="$absdir"
3003 # Now add the directory to shlibpath_var.
3004 if eval "test -z \"\$$shlibpath_var\""; then
3005 eval "$shlibpath_var=\"\$dir\""
3006 else
3007 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3009 done
3011 # This variable tells wrapper scripts just to set shlibpath_var
3012 # rather than running their programs.
3013 libtool_execute_magic="$magic"
3015 # Check if any of the arguments is a wrapper script.
3016 args=
3017 for file
3019 case $file in
3020 -* | *.la | *.lo ) ;;
3022 # Do a test to see if this is really a libtool program.
3023 if func_ltwrapper_script_p "$file"; then
3024 func_source "$file"
3025 # Transform arg to wrapped name.
3026 file="$progdir/$program"
3027 elif func_ltwrapper_executable_p "$file"; then
3028 func_ltwrapper_scriptname "$file"
3029 func_source "$func_ltwrapper_scriptname_result"
3030 # Transform arg to wrapped name.
3031 file="$progdir/$program"
3034 esac
3035 # Quote arguments (to preserve shell metacharacters).
3036 func_append_quoted args "$file"
3037 done
3039 if test "X$opt_dry_run" = Xfalse; then
3040 if test -n "$shlibpath_var"; then
3041 # Export the shlibpath_var.
3042 eval "export $shlibpath_var"
3045 # Restore saved environment variables
3046 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
3048 eval "if test \"\${save_$lt_var+set}\" = set; then
3049 $lt_var=\$save_$lt_var; export $lt_var
3050 else
3051 $lt_unset $lt_var
3053 done
3055 # Now prepare to actually exec the command.
3056 exec_cmd="\$cmd$args"
3057 else
3058 # Display what would be done.
3059 if test -n "$shlibpath_var"; then
3060 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
3061 echo "export $shlibpath_var"
3063 $ECHO "$cmd$args"
3064 exit $EXIT_SUCCESS
3068 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
3071 # func_mode_finish arg...
3072 func_mode_finish ()
3074 $opt_debug
3075 libs=
3076 libdirs=
3077 admincmds=
3079 for opt in "$nonopt" ${1+"$@"}
3081 if test -d "$opt"; then
3082 libdirs+=" $opt"
3084 elif test -f "$opt"; then
3085 if func_lalib_unsafe_p "$opt"; then
3086 libs+=" $opt"
3087 else
3088 func_warning "\`$opt' is not a valid libtool archive"
3091 else
3092 func_fatal_error "invalid argument \`$opt'"
3094 done
3096 if test -n "$libs"; then
3097 if test -n "$lt_sysroot"; then
3098 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
3099 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
3100 else
3101 sysroot_cmd=
3104 # Remove sysroot references
3105 if $opt_dry_run; then
3106 for lib in $libs; do
3107 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
3108 done
3109 else
3110 tmpdir=`func_mktempdir`
3111 for lib in $libs; do
3112 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
3113 > $tmpdir/tmp-la
3114 mv -f $tmpdir/tmp-la $lib
3115 done
3116 ${RM}r "$tmpdir"
3120 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3121 for libdir in $libdirs; do
3122 if test -n "$finish_cmds"; then
3123 # Do each command in the finish commands.
3124 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
3125 '"$cmd"'"'
3127 if test -n "$finish_eval"; then
3128 # Do the single finish_eval.
3129 eval cmds=\"$finish_eval\"
3130 $opt_dry_run || eval "$cmds" || admincmds+="
3131 $cmds"
3133 done
3136 # Exit here if they wanted silent mode.
3137 $opt_silent && exit $EXIT_SUCCESS
3139 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3140 echo "----------------------------------------------------------------------"
3141 echo "Libraries have been installed in:"
3142 for libdir in $libdirs; do
3143 $ECHO " $libdir"
3144 done
3145 echo
3146 echo "If you ever happen to want to link against installed libraries"
3147 echo "in a given directory, LIBDIR, you must either use libtool, and"
3148 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
3149 echo "flag during linking and do at least one of the following:"
3150 if test -n "$shlibpath_var"; then
3151 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3152 echo " during execution"
3154 if test -n "$runpath_var"; then
3155 echo " - add LIBDIR to the \`$runpath_var' environment variable"
3156 echo " during linking"
3158 if test -n "$hardcode_libdir_flag_spec"; then
3159 libdir=LIBDIR
3160 eval flag=\"$hardcode_libdir_flag_spec\"
3162 $ECHO " - use the \`$flag' linker flag"
3164 if test -n "$admincmds"; then
3165 $ECHO " - have your system administrator run these commands:$admincmds"
3167 if test -f /etc/ld.so.conf; then
3168 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3170 echo
3172 echo "See any operating system documentation about shared libraries for"
3173 case $host in
3174 solaris2.[6789]|solaris2.1[0-9])
3175 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
3176 echo "pages."
3179 echo "more information, such as the ld(1) and ld.so(8) manual pages."
3181 esac
3182 echo "----------------------------------------------------------------------"
3184 exit $EXIT_SUCCESS
3187 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
3190 # func_mode_install arg...
3191 func_mode_install ()
3193 $opt_debug
3194 # There may be an optional sh(1) argument at the beginning of
3195 # install_prog (especially on Windows NT).
3196 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3197 # Allow the use of GNU shtool's install command.
3198 case $nonopt in *shtool*) :;; *) false;; esac; then
3199 # Aesthetically quote it.
3200 func_quote_for_eval "$nonopt"
3201 install_prog="$func_quote_for_eval_result "
3202 arg=$1
3203 shift
3204 else
3205 install_prog=
3206 arg=$nonopt
3209 # The real first argument should be the name of the installation program.
3210 # Aesthetically quote it.
3211 func_quote_for_eval "$arg"
3212 install_prog+="$func_quote_for_eval_result"
3213 install_shared_prog=$install_prog
3214 case " $install_prog " in
3215 *[\\\ /]cp\ *) install_cp=: ;;
3216 *) install_cp=false ;;
3217 esac
3219 # We need to accept at least all the BSD install flags.
3220 dest=
3221 files=
3222 opts=
3223 prev=
3224 install_type=
3225 isdir=no
3226 stripme=
3227 no_mode=:
3228 for arg
3230 arg2=
3231 if test -n "$dest"; then
3232 files+=" $dest"
3233 dest=$arg
3234 continue
3237 case $arg in
3238 -d) isdir=yes ;;
3240 if $install_cp; then :; else
3241 prev=$arg
3244 -g | -m | -o)
3245 prev=$arg
3248 stripme=" -s"
3249 continue
3254 # If the previous option needed an argument, then skip it.
3255 if test -n "$prev"; then
3256 if test "x$prev" = x-m && test -n "$install_override_mode"; then
3257 arg2=$install_override_mode
3258 no_mode=false
3260 prev=
3261 else
3262 dest=$arg
3263 continue
3266 esac
3268 # Aesthetically quote the argument.
3269 func_quote_for_eval "$arg"
3270 install_prog+=" $func_quote_for_eval_result"
3271 if test -n "$arg2"; then
3272 func_quote_for_eval "$arg2"
3274 install_shared_prog+=" $func_quote_for_eval_result"
3275 done
3277 test -z "$install_prog" && \
3278 func_fatal_help "you must specify an install program"
3280 test -n "$prev" && \
3281 func_fatal_help "the \`$prev' option requires an argument"
3283 if test -n "$install_override_mode" && $no_mode; then
3284 if $install_cp; then :; else
3285 func_quote_for_eval "$install_override_mode"
3286 install_shared_prog+=" -m $func_quote_for_eval_result"
3290 if test -z "$files"; then
3291 if test -z "$dest"; then
3292 func_fatal_help "no file or destination specified"
3293 else
3294 func_fatal_help "you must specify a destination"
3298 # Strip any trailing slash from the destination.
3299 func_stripname '' '/' "$dest"
3300 dest=$func_stripname_result
3302 # Check to see that the destination is a directory.
3303 test -d "$dest" && isdir=yes
3304 if test "$isdir" = yes; then
3305 destdir="$dest"
3306 destname=
3307 else
3308 func_dirname_and_basename "$dest" "" "."
3309 destdir="$func_dirname_result"
3310 destname="$func_basename_result"
3312 # Not a directory, so check to see that there is only one file specified.
3313 set dummy $files; shift
3314 test "$#" -gt 1 && \
3315 func_fatal_help "\`$dest' is not a directory"
3317 case $destdir in
3318 [\\/]* | [A-Za-z]:[\\/]*) ;;
3320 for file in $files; do
3321 case $file in
3322 *.lo) ;;
3324 func_fatal_help "\`$destdir' must be an absolute directory name"
3326 esac
3327 done
3329 esac
3331 # This variable tells wrapper scripts just to set variables rather
3332 # than running their programs.
3333 libtool_install_magic="$magic"
3335 staticlibs=
3336 future_libdirs=
3337 current_libdirs=
3338 for file in $files; do
3340 # Do each installation.
3341 case $file in
3342 *.$libext)
3343 # Do the static libraries later.
3344 staticlibs+=" $file"
3347 *.la)
3348 func_resolve_sysroot "$file"
3349 file=$func_resolve_sysroot_result
3351 # Check to see that this really is a libtool archive.
3352 func_lalib_unsafe_p "$file" \
3353 || func_fatal_help "\`$file' is not a valid libtool archive"
3355 library_names=
3356 old_library=
3357 relink_command=
3358 func_source "$file"
3360 # Add the libdir to current_libdirs if it is the destination.
3361 if test "X$destdir" = "X$libdir"; then
3362 case "$current_libdirs " in
3363 *" $libdir "*) ;;
3364 *) current_libdirs+=" $libdir" ;;
3365 esac
3366 else
3367 # Note the libdir as a future libdir.
3368 case "$future_libdirs " in
3369 *" $libdir "*) ;;
3370 *) future_libdirs+=" $libdir" ;;
3371 esac
3374 func_dirname "$file" "/" ""
3375 dir="$func_dirname_result"
3376 dir+="$objdir"
3378 if test -n "$relink_command"; then
3379 # Determine the prefix the user has applied to our future dir.
3380 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
3382 # Don't allow the user to place us outside of our expected
3383 # location b/c this prevents finding dependent libraries that
3384 # are installed to the same prefix.
3385 # At present, this check doesn't affect windows .dll's that
3386 # are installed into $libdir/../bin (currently, that works fine)
3387 # but it's something to keep an eye on.
3388 test "$inst_prefix_dir" = "$destdir" && \
3389 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
3391 if test -n "$inst_prefix_dir"; then
3392 # Stick the inst_prefix_dir data into the link command.
3393 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
3394 else
3395 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
3398 func_warning "relinking \`$file'"
3399 func_show_eval "$relink_command" \
3400 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
3403 # See the names of the shared library.
3404 set dummy $library_names; shift
3405 if test -n "$1"; then
3406 realname="$1"
3407 shift
3409 srcname="$realname"
3410 test -n "$relink_command" && srcname="$realname"T
3412 # Install the shared library and build the symlinks.
3413 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
3414 'exit $?'
3415 tstripme="$stripme"
3416 case $host_os in
3417 cygwin* | mingw* | pw32* | cegcc*)
3418 case $realname in
3419 *.dll.a)
3420 tstripme=""
3422 esac
3424 esac
3425 if test -n "$tstripme" && test -n "$striplib"; then
3426 func_show_eval "$striplib $destdir/$realname" 'exit $?'
3429 if test "$#" -gt 0; then
3430 # Delete the old symlinks, and create new ones.
3431 # Try `ln -sf' first, because the `ln' binary might depend on
3432 # the symlink we replace! Solaris /bin/ln does not understand -f,
3433 # so we also need to try rm && ln -s.
3434 for linkname
3436 test "$linkname" != "$realname" \
3437 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3438 done
3441 # Do each command in the postinstall commands.
3442 lib="$destdir/$realname"
3443 func_execute_cmds "$postinstall_cmds" 'exit $?'
3446 # Install the pseudo-library for information purposes.
3447 func_basename "$file"
3448 name="$func_basename_result"
3449 instname="$dir/$name"i
3450 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3452 # Maybe install the static library, too.
3453 test -n "$old_library" && staticlibs+=" $dir/$old_library"
3456 *.lo)
3457 # Install (i.e. copy) a libtool object.
3459 # Figure out destination file name, if it wasn't already specified.
3460 if test -n "$destname"; then
3461 destfile="$destdir/$destname"
3462 else
3463 func_basename "$file"
3464 destfile="$func_basename_result"
3465 destfile="$destdir/$destfile"
3468 # Deduce the name of the destination old-style object file.
3469 case $destfile in
3470 *.lo)
3471 func_lo2o "$destfile"
3472 staticdest=$func_lo2o_result
3474 *.$objext)
3475 staticdest="$destfile"
3476 destfile=
3479 func_fatal_help "cannot copy a libtool object to \`$destfile'"
3481 esac
3483 # Install the libtool object if requested.
3484 test -n "$destfile" && \
3485 func_show_eval "$install_prog $file $destfile" 'exit $?'
3487 # Install the old object if enabled.
3488 if test "$build_old_libs" = yes; then
3489 # Deduce the name of the old-style object file.
3490 func_lo2o "$file"
3491 staticobj=$func_lo2o_result
3492 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3494 exit $EXIT_SUCCESS
3498 # Figure out destination file name, if it wasn't already specified.
3499 if test -n "$destname"; then
3500 destfile="$destdir/$destname"
3501 else
3502 func_basename "$file"
3503 destfile="$func_basename_result"
3504 destfile="$destdir/$destfile"
3507 # If the file is missing, and there is a .exe on the end, strip it
3508 # because it is most likely a libtool script we actually want to
3509 # install
3510 stripped_ext=""
3511 case $file in
3512 *.exe)
3513 if test ! -f "$file"; then
3514 func_stripname '' '.exe' "$file"
3515 file=$func_stripname_result
3516 stripped_ext=".exe"
3519 esac
3521 # Do a test to see if this is really a libtool program.
3522 case $host in
3523 *cygwin* | *mingw*)
3524 if func_ltwrapper_executable_p "$file"; then
3525 func_ltwrapper_scriptname "$file"
3526 wrapper=$func_ltwrapper_scriptname_result
3527 else
3528 func_stripname '' '.exe' "$file"
3529 wrapper=$func_stripname_result
3533 wrapper=$file
3535 esac
3536 if func_ltwrapper_script_p "$wrapper"; then
3537 notinst_deplibs=
3538 relink_command=
3540 func_source "$wrapper"
3542 # Check the variables that should have been set.
3543 test -z "$generated_by_libtool_version" && \
3544 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3546 finalize=yes
3547 for lib in $notinst_deplibs; do
3548 # Check to see that each library is installed.
3549 libdir=
3550 if test -f "$lib"; then
3551 func_source "$lib"
3553 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3554 if test -n "$libdir" && test ! -f "$libfile"; then
3555 func_warning "\`$lib' has not been installed in \`$libdir'"
3556 finalize=no
3558 done
3560 relink_command=
3561 func_source "$wrapper"
3563 outputname=
3564 if test "$fast_install" = no && test -n "$relink_command"; then
3565 $opt_dry_run || {
3566 if test "$finalize" = yes; then
3567 tmpdir=`func_mktempdir`
3568 func_basename "$file$stripped_ext"
3569 file="$func_basename_result"
3570 outputname="$tmpdir/$file"
3571 # Replace the output file specification.
3572 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3574 $opt_silent || {
3575 func_quote_for_expand "$relink_command"
3576 eval "func_echo $func_quote_for_expand_result"
3578 if eval "$relink_command"; then :
3579 else
3580 func_error "error: relink \`$file' with the above command before installing it"
3581 $opt_dry_run || ${RM}r "$tmpdir"
3582 continue
3584 file="$outputname"
3585 else
3586 func_warning "cannot relink \`$file'"
3589 else
3590 # Install the binary that we compiled earlier.
3591 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3595 # remove .exe since cygwin /usr/bin/install will append another
3596 # one anyway
3597 case $install_prog,$host in
3598 */usr/bin/install*,*cygwin*)
3599 case $file:$destfile in
3600 *.exe:*.exe)
3601 # this is ok
3603 *.exe:*)
3604 destfile=$destfile.exe
3606 *:*.exe)
3607 func_stripname '' '.exe' "$destfile"
3608 destfile=$func_stripname_result
3610 esac
3612 esac
3613 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3614 $opt_dry_run || if test -n "$outputname"; then
3615 ${RM}r "$tmpdir"
3618 esac
3619 done
3621 for file in $staticlibs; do
3622 func_basename "$file"
3623 name="$func_basename_result"
3625 # Set up the ranlib parameters.
3626 oldlib="$destdir/$name"
3627 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3628 tool_oldlib=$func_to_tool_file_result
3630 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3632 if test -n "$stripme" && test -n "$old_striplib"; then
3633 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
3636 # Do each command in the postinstall commands.
3637 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3638 done
3640 test -n "$future_libdirs" && \
3641 func_warning "remember to run \`$progname --finish$future_libdirs'"
3643 if test -n "$current_libdirs"; then
3644 # Maybe just do a dry run.
3645 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3646 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3647 else
3648 exit $EXIT_SUCCESS
3652 test "$opt_mode" = install && func_mode_install ${1+"$@"}
3655 # func_generate_dlsyms outputname originator pic_p
3656 # Extract symbols from dlprefiles and create ${outputname}S.o with
3657 # a dlpreopen symbol table.
3658 func_generate_dlsyms ()
3660 $opt_debug
3661 my_outputname="$1"
3662 my_originator="$2"
3663 my_pic_p="${3-no}"
3664 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3665 my_dlsyms=
3667 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3668 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3669 my_dlsyms="${my_outputname}S.c"
3670 else
3671 func_error "not configured to extract global symbols from dlpreopened files"
3675 if test -n "$my_dlsyms"; then
3676 case $my_dlsyms in
3677 "") ;;
3678 *.c)
3679 # Discover the nlist of each of the dlfiles.
3680 nlist="$output_objdir/${my_outputname}.nm"
3682 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3684 # Parse the name list into a source file.
3685 func_verbose "creating $output_objdir/$my_dlsyms"
3687 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3688 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3689 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3691 #ifdef __cplusplus
3692 extern \"C\" {
3693 #endif
3695 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3696 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3697 #endif
3699 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3700 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3701 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3702 relocations are performed -- see ld's documentation on pseudo-relocs. */
3703 # define LT_DLSYM_CONST
3704 #elif defined(__osf__)
3705 /* This system does not cope well with relocations in const data. */
3706 # define LT_DLSYM_CONST
3707 #else
3708 # define LT_DLSYM_CONST const
3709 #endif
3711 /* External symbol declarations for the compiler. */\
3714 if test "$dlself" = yes; then
3715 func_verbose "generating symbol list for \`$output'"
3717 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3719 # Add our own program objects to the symbol list.
3720 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3721 for progfile in $progfiles; do
3722 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3723 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3724 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3725 done
3727 if test -n "$exclude_expsyms"; then
3728 $opt_dry_run || {
3729 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3730 eval '$MV "$nlist"T "$nlist"'
3734 if test -n "$export_symbols_regex"; then
3735 $opt_dry_run || {
3736 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3737 eval '$MV "$nlist"T "$nlist"'
3741 # Prepare the list of exported symbols
3742 if test -z "$export_symbols"; then
3743 export_symbols="$output_objdir/$outputname.exp"
3744 $opt_dry_run || {
3745 $RM $export_symbols
3746 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3747 case $host in
3748 *cygwin* | *mingw* | *cegcc* )
3749 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3750 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3752 esac
3754 else
3755 $opt_dry_run || {
3756 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3757 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3758 eval '$MV "$nlist"T "$nlist"'
3759 case $host in
3760 *cygwin* | *mingw* | *cegcc* )
3761 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3762 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3764 esac
3769 for dlprefile in $dlprefiles; do
3770 func_verbose "extracting global C symbols from \`$dlprefile'"
3771 func_basename "$dlprefile"
3772 name="$func_basename_result"
3773 case $host in
3774 *cygwin* | *mingw* | *cegcc* )
3775 # if an import library, we need to obtain dlname
3776 if func_win32_import_lib_p "$dlprefile"; then
3777 func_tr_sh "$dlprefile"
3778 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3779 dlprefile_dlbasename=""
3780 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3781 # Use subshell, to avoid clobbering current variable values
3782 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3783 if test -n "$dlprefile_dlname" ; then
3784 func_basename "$dlprefile_dlname"
3785 dlprefile_dlbasename="$func_basename_result"
3786 else
3787 # no lafile. user explicitly requested -dlpreopen <import library>.
3788 $sharedlib_from_linklib_cmd "$dlprefile"
3789 dlprefile_dlbasename=$sharedlib_from_linklib_result
3792 $opt_dry_run || {
3793 if test -n "$dlprefile_dlbasename" ; then
3794 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3795 else
3796 func_warning "Could not compute DLL name from $name"
3797 eval '$ECHO ": $name " >> "$nlist"'
3799 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3800 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3801 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3803 else # not an import lib
3804 $opt_dry_run || {
3805 eval '$ECHO ": $name " >> "$nlist"'
3806 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3807 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3812 $opt_dry_run || {
3813 eval '$ECHO ": $name " >> "$nlist"'
3814 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3815 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3818 esac
3819 done
3821 $opt_dry_run || {
3822 # Make sure we have at least an empty file.
3823 test -f "$nlist" || : > "$nlist"
3825 if test -n "$exclude_expsyms"; then
3826 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3827 $MV "$nlist"T "$nlist"
3830 # Try sorting and uniquifying the output.
3831 if $GREP -v "^: " < "$nlist" |
3832 if sort -k 3 </dev/null >/dev/null 2>&1; then
3833 sort -k 3
3834 else
3835 sort +2
3836 fi |
3837 uniq > "$nlist"S; then
3839 else
3840 $GREP -v "^: " < "$nlist" > "$nlist"S
3843 if test -f "$nlist"S; then
3844 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3845 else
3846 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3849 echo >> "$output_objdir/$my_dlsyms" "\
3851 /* The mapping between symbol names and symbols. */
3852 typedef struct {
3853 const char *name;
3854 void *address;
3855 } lt_dlsymlist;
3856 extern LT_DLSYM_CONST lt_dlsymlist
3857 lt_${my_prefix}_LTX_preloaded_symbols[];
3858 LT_DLSYM_CONST lt_dlsymlist
3859 lt_${my_prefix}_LTX_preloaded_symbols[] =
3861 { \"$my_originator\", (void *) 0 },"
3863 case $need_lib_prefix in
3865 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3868 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3870 esac
3871 echo >> "$output_objdir/$my_dlsyms" "\
3872 {0, (void *) 0}
3875 /* This works around a problem in FreeBSD linker */
3876 #ifdef FREEBSD_WORKAROUND
3877 static const void *lt_preloaded_setup() {
3878 return lt_${my_prefix}_LTX_preloaded_symbols;
3880 #endif
3882 #ifdef __cplusplus
3884 #endif\
3886 } # !$opt_dry_run
3888 pic_flag_for_symtable=
3889 case "$compile_command " in
3890 *" -static "*) ;;
3892 case $host in
3893 # compiling the symbol table file with pic_flag works around
3894 # a FreeBSD bug that causes programs to crash when -lm is
3895 # linked before any other PIC object. But we must not use
3896 # pic_flag when linking with -static. The problem exists in
3897 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3898 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3899 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3900 *-*-hpux*)
3901 pic_flag_for_symtable=" $pic_flag" ;;
3903 if test "X$my_pic_p" != Xno; then
3904 pic_flag_for_symtable=" $pic_flag"
3907 esac
3909 esac
3910 symtab_cflags=
3911 for arg in $LTCFLAGS; do
3912 case $arg in
3913 -pie | -fpie | -fPIE) ;;
3914 *) symtab_cflags+=" $arg" ;;
3915 esac
3916 done
3918 # Now compile the dynamic symbol file.
3919 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3921 # Clean up the generated files.
3922 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3924 # Transform the symbol file into the correct name.
3925 symfileobj="$output_objdir/${my_outputname}S.$objext"
3926 case $host in
3927 *cygwin* | *mingw* | *cegcc* )
3928 if test -f "$output_objdir/$my_outputname.def"; then
3929 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3930 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3931 else
3932 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3933 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3937 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3938 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3940 esac
3943 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3945 esac
3946 else
3947 # We keep going just in case the user didn't refer to
3948 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3949 # really was required.
3951 # Nullify the symbol file.
3952 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3953 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3957 # func_win32_libid arg
3958 # return the library type of file 'arg'
3960 # Need a lot of goo to handle *both* DLLs and import libs
3961 # Has to be a shell function in order to 'eat' the argument
3962 # that is supplied when $file_magic_command is called.
3963 # Despite the name, also deal with 64 bit binaries.
3964 func_win32_libid ()
3966 $opt_debug
3967 win32_libid_type="unknown"
3968 win32_fileres=`file -L $1 2>/dev/null`
3969 case $win32_fileres in
3970 *ar\ archive\ import\ library*) # definitely import
3971 win32_libid_type="x86 archive import"
3973 *ar\ archive*) # could be an import, or static
3974 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3975 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3976 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3977 func_to_tool_file "$1" func_convert_file_msys_to_w32
3978 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3979 $SED -n -e '
3980 1,100{
3981 / I /{
3982 s,.*,import,
3987 case $win32_nmres in
3988 import*) win32_libid_type="x86 archive import";;
3989 *) win32_libid_type="x86 archive static";;
3990 esac
3993 *DLL*)
3994 win32_libid_type="x86 DLL"
3996 *executable*) # but shell scripts are "executable" too...
3997 case $win32_fileres in
3998 *MS\ Windows\ PE\ Intel*)
3999 win32_libid_type="x86 DLL"
4001 esac
4003 esac
4004 $ECHO "$win32_libid_type"
4007 # func_cygming_dll_for_implib ARG
4009 # Platform-specific function to extract the
4010 # name of the DLL associated with the specified
4011 # import library ARG.
4012 # Invoked by eval'ing the libtool variable
4013 # $sharedlib_from_linklib_cmd
4014 # Result is available in the variable
4015 # $sharedlib_from_linklib_result
4016 func_cygming_dll_for_implib ()
4018 $opt_debug
4019 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
4022 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
4024 # The is the core of a fallback implementation of a
4025 # platform-specific function to extract the name of the
4026 # DLL associated with the specified import library LIBNAME.
4028 # SECTION_NAME is either .idata$6 or .idata$7, depending
4029 # on the platform and compiler that created the implib.
4031 # Echos the name of the DLL associated with the
4032 # specified import library.
4033 func_cygming_dll_for_implib_fallback_core ()
4035 $opt_debug
4036 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
4037 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
4038 $SED '/^Contents of section '"$match_literal"':/{
4039 # Place marker at beginning of archive member dllname section
4040 s/.*/====MARK====/
4044 # These lines can sometimes be longer than 43 characters, but
4045 # are always uninteresting
4046 /:[ ]*file format pe[i]\{,1\}-/d
4047 /^In archive [^:]*:/d
4048 # Ensure marker is printed
4049 /^====MARK====/p
4050 # Remove all lines with less than 43 characters
4051 /^.\{43\}/!d
4052 # From remaining lines, remove first 43 characters
4053 s/^.\{43\}//' |
4054 $SED -n '
4055 # Join marker and all lines until next marker into a single line
4056 /^====MARK====/ b para
4058 $ b para
4060 :para
4062 s/\n//g
4063 # Remove the marker
4064 s/^====MARK====//
4065 # Remove trailing dots and whitespace
4066 s/[\. \t]*$//
4067 # Print
4068 /./p' |
4069 # we now have a list, one entry per line, of the stringified
4070 # contents of the appropriate section of all members of the
4071 # archive which possess that section. Heuristic: eliminate
4072 # all those which have a first or second character that is
4073 # a '.' (that is, objdump's representation of an unprintable
4074 # character.) This should work for all archives with less than
4075 # 0x302f exports -- but will fail for DLLs whose name actually
4076 # begins with a literal '.' or a single character followed by
4077 # a '.'.
4079 # Of those that remain, print the first one.
4080 $SED -e '/^\./d;/^.\./d;q'
4083 # func_cygming_gnu_implib_p ARG
4084 # This predicate returns with zero status (TRUE) if
4085 # ARG is a GNU/binutils-style import library. Returns
4086 # with nonzero status (FALSE) otherwise.
4087 func_cygming_gnu_implib_p ()
4089 $opt_debug
4090 func_to_tool_file "$1" func_convert_file_msys_to_w32
4091 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
4092 test -n "$func_cygming_gnu_implib_tmp"
4095 # func_cygming_ms_implib_p ARG
4096 # This predicate returns with zero status (TRUE) if
4097 # ARG is an MS-style import library. Returns
4098 # with nonzero status (FALSE) otherwise.
4099 func_cygming_ms_implib_p ()
4101 $opt_debug
4102 func_to_tool_file "$1" func_convert_file_msys_to_w32
4103 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
4104 test -n "$func_cygming_ms_implib_tmp"
4107 # func_cygming_dll_for_implib_fallback ARG
4108 # Platform-specific function to extract the
4109 # name of the DLL associated with the specified
4110 # import library ARG.
4112 # This fallback implementation is for use when $DLLTOOL
4113 # does not support the --identify-strict option.
4114 # Invoked by eval'ing the libtool variable
4115 # $sharedlib_from_linklib_cmd
4116 # Result is available in the variable
4117 # $sharedlib_from_linklib_result
4118 func_cygming_dll_for_implib_fallback ()
4120 $opt_debug
4121 if func_cygming_gnu_implib_p "$1" ; then
4122 # binutils import library
4123 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
4124 elif func_cygming_ms_implib_p "$1" ; then
4125 # ms-generated import library
4126 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
4127 else
4128 # unknown
4129 sharedlib_from_linklib_result=""
4134 # func_extract_an_archive dir oldlib
4135 func_extract_an_archive ()
4137 $opt_debug
4138 f_ex_an_ar_dir="$1"; shift
4139 f_ex_an_ar_oldlib="$1"
4140 if test "$lock_old_archive_extraction" = yes; then
4141 lockfile=$f_ex_an_ar_oldlib.lock
4142 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
4143 func_echo "Waiting for $lockfile to be removed"
4144 sleep 2
4145 done
4147 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
4148 'stat=$?; rm -f "$lockfile"; exit $stat'
4149 if test "$lock_old_archive_extraction" = yes; then
4150 $opt_dry_run || rm -f "$lockfile"
4152 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
4154 else
4155 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
4160 # func_extract_archives gentop oldlib ...
4161 func_extract_archives ()
4163 $opt_debug
4164 my_gentop="$1"; shift
4165 my_oldlibs=${1+"$@"}
4166 my_oldobjs=""
4167 my_xlib=""
4168 my_xabs=""
4169 my_xdir=""
4171 for my_xlib in $my_oldlibs; do
4172 # Extract the objects.
4173 case $my_xlib in
4174 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
4175 *) my_xabs=`pwd`"/$my_xlib" ;;
4176 esac
4177 func_basename "$my_xlib"
4178 my_xlib="$func_basename_result"
4179 my_xlib_u=$my_xlib
4180 while :; do
4181 case " $extracted_archives " in
4182 *" $my_xlib_u "*)
4183 func_arith $extracted_serial + 1
4184 extracted_serial=$func_arith_result
4185 my_xlib_u=lt$extracted_serial-$my_xlib ;;
4186 *) break ;;
4187 esac
4188 done
4189 extracted_archives="$extracted_archives $my_xlib_u"
4190 my_xdir="$my_gentop/$my_xlib_u"
4192 func_mkdir_p "$my_xdir"
4194 case $host in
4195 *-darwin*)
4196 func_verbose "Extracting $my_xabs"
4197 # Do not bother doing anything if just a dry run
4198 $opt_dry_run || {
4199 darwin_orig_dir=`pwd`
4200 cd $my_xdir || exit $?
4201 darwin_archive=$my_xabs
4202 darwin_curdir=`pwd`
4203 darwin_base_archive=`basename "$darwin_archive"`
4204 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
4205 if test -n "$darwin_arches"; then
4206 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
4207 darwin_arch=
4208 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
4209 for darwin_arch in $darwin_arches ; do
4210 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4211 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
4212 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4213 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
4214 cd "$darwin_curdir"
4215 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
4216 done # $darwin_arches
4217 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
4218 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
4219 darwin_file=
4220 darwin_files=
4221 for darwin_file in $darwin_filelist; do
4222 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
4223 $LIPO -create -output "$darwin_file" $darwin_files
4224 done # $darwin_filelist
4225 $RM -rf unfat-$$
4226 cd "$darwin_orig_dir"
4227 else
4228 cd $darwin_orig_dir
4229 func_extract_an_archive "$my_xdir" "$my_xabs"
4230 fi # $darwin_arches
4231 } # !$opt_dry_run
4234 func_extract_an_archive "$my_xdir" "$my_xabs"
4236 esac
4237 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
4238 done
4240 func_extract_archives_result="$my_oldobjs"
4244 # func_emit_wrapper [arg=no]
4246 # Emit a libtool wrapper script on stdout.
4247 # Don't directly open a file because we may want to
4248 # incorporate the script contents within a cygwin/mingw
4249 # wrapper executable. Must ONLY be called from within
4250 # func_mode_link because it depends on a number of variables
4251 # set therein.
4253 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
4254 # variable will take. If 'yes', then the emitted script
4255 # will assume that the directory in which it is stored is
4256 # the $objdir directory. This is a cygwin/mingw-specific
4257 # behavior.
4258 func_emit_wrapper ()
4260 func_emit_wrapper_arg1=${1-no}
4262 $ECHO "\
4263 #! $SHELL
4265 # $output - temporary wrapper script for $objdir/$outputname
4266 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4268 # The $output program cannot be directly executed until all the libtool
4269 # libraries that it depends on are installed.
4271 # This wrapper script should never be moved out of the build directory.
4272 # If it is, it will not operate correctly.
4274 # Sed substitution that helps us do robust quoting. It backslashifies
4275 # metacharacters that are still active within double-quoted strings.
4276 sed_quote_subst='$sed_quote_subst'
4278 # Be Bourne compatible
4279 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
4280 emulate sh
4281 NULLCMD=:
4282 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
4283 # is contrary to our usage. Disable this feature.
4284 alias -g '\${1+\"\$@\"}'='\"\$@\"'
4285 setopt NO_GLOB_SUBST
4286 else
4287 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
4289 BIN_SH=xpg4; export BIN_SH # for Tru64
4290 DUALCASE=1; export DUALCASE # for MKS sh
4292 # The HP-UX ksh and POSIX shell print the target directory to stdout
4293 # if CDPATH is set.
4294 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4296 relink_command=\"$relink_command\"
4298 # This environment variable determines our operation mode.
4299 if test \"\$libtool_install_magic\" = \"$magic\"; then
4300 # install mode needs the following variables:
4301 generated_by_libtool_version='$macro_version'
4302 notinst_deplibs='$notinst_deplibs'
4303 else
4304 # When we are sourced in execute mode, \$file and \$ECHO are already set.
4305 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4306 file=\"\$0\""
4308 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
4309 $ECHO "\
4311 # A function that is used when there is no print builtin or printf.
4312 func_fallback_echo ()
4314 eval 'cat <<_LTECHO_EOF
4316 _LTECHO_EOF'
4318 ECHO=\"$qECHO\"
4321 # Very basic option parsing. These options are (a) specific to
4322 # the libtool wrapper, (b) are identical between the wrapper
4323 # /script/ and the wrapper /executable/ which is used only on
4324 # windows platforms, and (c) all begin with the string "--lt-"
4325 # (application programs are unlikely to have options which match
4326 # this pattern).
4328 # There are only two supported options: --lt-debug and
4329 # --lt-dump-script. There is, deliberately, no --lt-help.
4331 # The first argument to this parsing function should be the
4332 # script's $0 value, followed by "$@".
4333 lt_option_debug=
4334 func_parse_lt_options ()
4336 lt_script_arg0=\$0
4337 shift
4338 for lt_opt
4340 case \"\$lt_opt\" in
4341 --lt-debug) lt_option_debug=1 ;;
4342 --lt-dump-script)
4343 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
4344 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
4345 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
4346 cat \"\$lt_dump_D/\$lt_dump_F\"
4347 exit 0
4349 --lt-*)
4350 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
4351 exit 1
4353 esac
4354 done
4356 # Print the debug banner immediately:
4357 if test -n \"\$lt_option_debug\"; then
4358 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
4362 # Used when --lt-debug. Prints its arguments to stdout
4363 # (redirection is the responsibility of the caller)
4364 func_lt_dump_args ()
4366 lt_dump_args_N=1;
4367 for lt_arg
4369 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
4370 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
4371 done
4374 # Core function for launching the target application
4375 func_exec_program_core ()
4378 case $host in
4379 # Backslashes separate directories on plain windows
4380 *-*-mingw | *-*-os2* | *-cegcc*)
4381 $ECHO "\
4382 if test -n \"\$lt_option_debug\"; then
4383 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
4384 func_lt_dump_args \${1+\"\$@\"} 1>&2
4386 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4391 $ECHO "\
4392 if test -n \"\$lt_option_debug\"; then
4393 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4394 func_lt_dump_args \${1+\"\$@\"} 1>&2
4396 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4399 esac
4400 $ECHO "\
4401 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4402 exit 1
4405 # A function to encapsulate launching the target application
4406 # Strips options in the --lt-* namespace from \$@ and
4407 # launches target application with the remaining arguments.
4408 func_exec_program ()
4410 case \" \$* \" in
4411 *\\ --lt-*)
4412 for lt_wr_arg
4414 case \$lt_wr_arg in
4415 --lt-*) ;;
4416 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4417 esac
4418 shift
4419 done ;;
4420 esac
4421 func_exec_program_core \${1+\"\$@\"}
4424 # Parse options
4425 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4427 # Find the directory that this script lives in.
4428 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4429 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4431 # Follow symbolic links until we get to the real thisdir.
4432 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4433 while test -n \"\$file\"; do
4434 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4436 # If there was a directory component, then change thisdir.
4437 if test \"x\$destdir\" != \"x\$file\"; then
4438 case \"\$destdir\" in
4439 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4440 *) thisdir=\"\$thisdir/\$destdir\" ;;
4441 esac
4444 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4445 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4446 done
4448 # Usually 'no', except on cygwin/mingw when embedded into
4449 # the cwrapper.
4450 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4451 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4452 # special case for '.'
4453 if test \"\$thisdir\" = \".\"; then
4454 thisdir=\`pwd\`
4456 # remove .libs from thisdir
4457 case \"\$thisdir\" in
4458 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4459 $objdir ) thisdir=. ;;
4460 esac
4463 # Try to get the absolute directory name.
4464 absdir=\`cd \"\$thisdir\" && pwd\`
4465 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4468 if test "$fast_install" = yes; then
4469 $ECHO "\
4470 program=lt-'$outputname'$exeext
4471 progdir=\"\$thisdir/$objdir\"
4473 if test ! -f \"\$progdir/\$program\" ||
4474 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4475 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4477 file=\"\$\$-\$program\"
4479 if test ! -d \"\$progdir\"; then
4480 $MKDIR \"\$progdir\"
4481 else
4482 $RM \"\$progdir/\$file\"
4485 $ECHO "\
4487 # relink executable if necessary
4488 if test -n \"\$relink_command\"; then
4489 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4490 else
4491 $ECHO \"\$relink_command_output\" >&2
4492 $RM \"\$progdir/\$file\"
4493 exit 1
4497 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4498 { $RM \"\$progdir/\$program\";
4499 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4500 $RM \"\$progdir/\$file\"
4502 else
4503 $ECHO "\
4504 program='$outputname'
4505 progdir=\"\$thisdir/$objdir\"
4509 $ECHO "\
4511 if test -f \"\$progdir/\$program\"; then"
4513 # fixup the dll searchpath if we need to.
4515 # Fix the DLL searchpath if we need to. Do this before prepending
4516 # to shlibpath, because on Windows, both are PATH and uninstalled
4517 # libraries must come first.
4518 if test -n "$dllsearchpath"; then
4519 $ECHO "\
4520 # Add the dll search path components to the executable PATH
4521 PATH=$dllsearchpath:\$PATH
4525 # Export our shlibpath_var if we have one.
4526 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4527 $ECHO "\
4528 # Add our own library path to $shlibpath_var
4529 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4531 # Some systems cannot cope with colon-terminated $shlibpath_var
4532 # The second colon is a workaround for a bug in BeOS R4 sed
4533 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4535 export $shlibpath_var
4539 $ECHO "\
4540 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4541 # Run the actual program with our arguments.
4542 func_exec_program \${1+\"\$@\"}
4544 else
4545 # The program doesn't exist.
4546 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4547 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4548 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4549 exit 1
4556 # func_emit_cwrapperexe_src
4557 # emit the source code for a wrapper executable on stdout
4558 # Must ONLY be called from within func_mode_link because
4559 # it depends on a number of variable set therein.
4560 func_emit_cwrapperexe_src ()
4562 cat <<EOF
4564 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4565 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4567 The $output program cannot be directly executed until all the libtool
4568 libraries that it depends on are installed.
4570 This wrapper executable should never be moved out of the build directory.
4571 If it is, it will not operate correctly.
4574 cat <<"EOF"
4575 #ifdef _MSC_VER
4576 # define _CRT_SECURE_NO_DEPRECATE 1
4577 #endif
4578 #include <stdio.h>
4579 #include <stdlib.h>
4580 #ifdef _MSC_VER
4581 # include <direct.h>
4582 # include <process.h>
4583 # include <io.h>
4584 #else
4585 # include <unistd.h>
4586 # include <stdint.h>
4587 # ifdef __CYGWIN__
4588 # include <io.h>
4589 # endif
4590 #endif
4591 #include <malloc.h>
4592 #include <stdarg.h>
4593 #include <assert.h>
4594 #include <string.h>
4595 #include <ctype.h>
4596 #include <errno.h>
4597 #include <fcntl.h>
4598 #include <sys/stat.h>
4600 /* declarations of non-ANSI functions */
4601 #if defined(__MINGW32__)
4602 # ifdef __STRICT_ANSI__
4603 int _putenv (const char *);
4604 # endif
4605 #elif defined(__CYGWIN__)
4606 # ifdef __STRICT_ANSI__
4607 char *realpath (const char *, char *);
4608 int putenv (char *);
4609 int setenv (const char *, const char *, int);
4610 # endif
4611 /* #elif defined (other platforms) ... */
4612 #endif
4614 /* portability defines, excluding path handling macros */
4615 #if defined(_MSC_VER)
4616 # define setmode _setmode
4617 # define stat _stat
4618 # define chmod _chmod
4619 # define getcwd _getcwd
4620 # define putenv _putenv
4621 # define S_IXUSR _S_IEXEC
4622 # ifndef _INTPTR_T_DEFINED
4623 # define _INTPTR_T_DEFINED
4624 # define intptr_t int
4625 # endif
4626 #elif defined(__MINGW32__)
4627 # define setmode _setmode
4628 # define stat _stat
4629 # define chmod _chmod
4630 # define getcwd _getcwd
4631 # define putenv _putenv
4632 #elif defined(__CYGWIN__)
4633 # define HAVE_SETENV
4634 # define FOPEN_WB "wb"
4635 /* #elif defined (other platforms) ... */
4636 #endif
4638 #if defined(PATH_MAX)
4639 # define LT_PATHMAX PATH_MAX
4640 #elif defined(MAXPATHLEN)
4641 # define LT_PATHMAX MAXPATHLEN
4642 #else
4643 # define LT_PATHMAX 1024
4644 #endif
4646 #ifndef S_IXOTH
4647 # define S_IXOTH 0
4648 #endif
4649 #ifndef S_IXGRP
4650 # define S_IXGRP 0
4651 #endif
4653 /* path handling portability macros */
4654 #ifndef DIR_SEPARATOR
4655 # define DIR_SEPARATOR '/'
4656 # define PATH_SEPARATOR ':'
4657 #endif
4659 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4660 defined (__OS2__)
4661 # define HAVE_DOS_BASED_FILE_SYSTEM
4662 # define FOPEN_WB "wb"
4663 # ifndef DIR_SEPARATOR_2
4664 # define DIR_SEPARATOR_2 '\\'
4665 # endif
4666 # ifndef PATH_SEPARATOR_2
4667 # define PATH_SEPARATOR_2 ';'
4668 # endif
4669 #endif
4671 #ifndef DIR_SEPARATOR_2
4672 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4673 #else /* DIR_SEPARATOR_2 */
4674 # define IS_DIR_SEPARATOR(ch) \
4675 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4676 #endif /* DIR_SEPARATOR_2 */
4678 #ifndef PATH_SEPARATOR_2
4679 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4680 #else /* PATH_SEPARATOR_2 */
4681 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4682 #endif /* PATH_SEPARATOR_2 */
4684 #ifndef FOPEN_WB
4685 # define FOPEN_WB "w"
4686 #endif
4687 #ifndef _O_BINARY
4688 # define _O_BINARY 0
4689 #endif
4691 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4692 #define XFREE(stale) do { \
4693 if (stale) { free ((void *) stale); stale = 0; } \
4694 } while (0)
4696 #if defined(LT_DEBUGWRAPPER)
4697 static int lt_debug = 1;
4698 #else
4699 static int lt_debug = 0;
4700 #endif
4702 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4704 void *xmalloc (size_t num);
4705 char *xstrdup (const char *string);
4706 const char *base_name (const char *name);
4707 char *find_executable (const char *wrapper);
4708 char *chase_symlinks (const char *pathspec);
4709 int make_executable (const char *path);
4710 int check_executable (const char *path);
4711 char *strendzap (char *str, const char *pat);
4712 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4713 void lt_fatal (const char *file, int line, const char *message, ...);
4714 static const char *nonnull (const char *s);
4715 static const char *nonempty (const char *s);
4716 void lt_setenv (const char *name, const char *value);
4717 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4718 void lt_update_exe_path (const char *name, const char *value);
4719 void lt_update_lib_path (const char *name, const char *value);
4720 char **prepare_spawn (char **argv);
4721 void lt_dump_script (FILE *f);
4724 cat <<EOF
4725 volatile const char * MAGIC_EXE = "$magic_exe";
4726 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4729 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4730 func_to_host_path "$temp_rpath"
4731 cat <<EOF
4732 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4734 else
4735 cat <<"EOF"
4736 const char * LIB_PATH_VALUE = "";
4740 if test -n "$dllsearchpath"; then
4741 func_to_host_path "$dllsearchpath:"
4742 cat <<EOF
4743 const char * EXE_PATH_VARNAME = "PATH";
4744 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4746 else
4747 cat <<"EOF"
4748 const char * EXE_PATH_VARNAME = "";
4749 const char * EXE_PATH_VALUE = "";
4753 if test "$fast_install" = yes; then
4754 cat <<EOF
4755 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4757 else
4758 cat <<EOF
4759 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4764 cat <<"EOF"
4766 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4768 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4769 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4770 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4773 main (int argc, char *argv[])
4775 char **newargz;
4776 int newargc;
4777 char *tmp_pathspec;
4778 char *actual_cwrapper_path;
4779 char *actual_cwrapper_name;
4780 char *target_name;
4781 char *lt_argv_zero;
4782 intptr_t rval = 127;
4784 int i;
4786 program_name = (char *) xstrdup (base_name (argv[0]));
4787 newargz = XMALLOC (char *, argc + 1);
4789 /* very simple arg parsing; don't want to rely on getopt
4790 * also, copy all non cwrapper options to newargz, except
4791 * argz[0], which is handled differently
4793 newargc=0;
4794 for (i = 1; i < argc; i++)
4796 if (strcmp (argv[i], dumpscript_opt) == 0)
4799 case "$host" in
4800 *mingw* | *cygwin* )
4801 # make stdout use "unix" line endings
4802 echo " setmode(1,_O_BINARY);"
4804 esac
4806 cat <<"EOF"
4807 lt_dump_script (stdout);
4808 return 0;
4810 if (strcmp (argv[i], debug_opt) == 0)
4812 lt_debug = 1;
4813 continue;
4815 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4817 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4818 namespace, but it is not one of the ones we know about and
4819 have already dealt with, above (inluding dump-script), then
4820 report an error. Otherwise, targets might begin to believe
4821 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4822 namespace. The first time any user complains about this, we'll
4823 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4824 or a configure.ac-settable value.
4826 lt_fatal (__FILE__, __LINE__,
4827 "unrecognized %s option: '%s'",
4828 ltwrapper_option_prefix, argv[i]);
4830 /* otherwise ... */
4831 newargz[++newargc] = xstrdup (argv[i]);
4833 newargz[++newargc] = NULL;
4836 cat <<EOF
4837 /* The GNU banner must be the first non-error debug message */
4838 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4840 cat <<"EOF"
4841 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4842 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4844 tmp_pathspec = find_executable (argv[0]);
4845 if (tmp_pathspec == NULL)
4846 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4847 lt_debugprintf (__FILE__, __LINE__,
4848 "(main) found exe (before symlink chase) at: %s\n",
4849 tmp_pathspec);
4851 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4852 lt_debugprintf (__FILE__, __LINE__,
4853 "(main) found exe (after symlink chase) at: %s\n",
4854 actual_cwrapper_path);
4855 XFREE (tmp_pathspec);
4857 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4858 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4860 /* wrapper name transforms */
4861 strendzap (actual_cwrapper_name, ".exe");
4862 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4863 XFREE (actual_cwrapper_name);
4864 actual_cwrapper_name = tmp_pathspec;
4865 tmp_pathspec = 0;
4867 /* target_name transforms -- use actual target program name; might have lt- prefix */
4868 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4869 strendzap (target_name, ".exe");
4870 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4871 XFREE (target_name);
4872 target_name = tmp_pathspec;
4873 tmp_pathspec = 0;
4875 lt_debugprintf (__FILE__, __LINE__,
4876 "(main) libtool target name: %s\n",
4877 target_name);
4880 cat <<EOF
4881 newargz[0] =
4882 XMALLOC (char, (strlen (actual_cwrapper_path) +
4883 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4884 strcpy (newargz[0], actual_cwrapper_path);
4885 strcat (newargz[0], "$objdir");
4886 strcat (newargz[0], "/");
4889 cat <<"EOF"
4890 /* stop here, and copy so we don't have to do this twice */
4891 tmp_pathspec = xstrdup (newargz[0]);
4893 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4894 strcat (newargz[0], actual_cwrapper_name);
4896 /* DO want the lt- prefix here if it exists, so use target_name */
4897 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4898 XFREE (tmp_pathspec);
4899 tmp_pathspec = NULL;
4902 case $host_os in
4903 mingw*)
4904 cat <<"EOF"
4906 char* p;
4907 while ((p = strchr (newargz[0], '\\')) != NULL)
4909 *p = '/';
4911 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4913 *p = '/';
4918 esac
4920 cat <<"EOF"
4921 XFREE (target_name);
4922 XFREE (actual_cwrapper_path);
4923 XFREE (actual_cwrapper_name);
4925 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4926 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4927 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4928 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4929 because on Windows, both *_VARNAMEs are PATH but uninstalled
4930 libraries must come first. */
4931 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4932 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4934 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4935 nonnull (lt_argv_zero));
4936 for (i = 0; i < newargc; i++)
4938 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4939 i, nonnull (newargz[i]));
4944 case $host_os in
4945 mingw*)
4946 cat <<"EOF"
4947 /* execv doesn't actually work on mingw as expected on unix */
4948 newargz = prepare_spawn (newargz);
4949 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4950 if (rval == -1)
4952 /* failed to start process */
4953 lt_debugprintf (__FILE__, __LINE__,
4954 "(main) failed to launch target \"%s\": %s\n",
4955 lt_argv_zero, nonnull (strerror (errno)));
4956 return 127;
4958 return rval;
4962 cat <<"EOF"
4963 execv (lt_argv_zero, newargz);
4964 return rval; /* =127, but avoids unused variable warning */
4967 esac
4969 cat <<"EOF"
4972 void *
4973 xmalloc (size_t num)
4975 void *p = (void *) malloc (num);
4976 if (!p)
4977 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4979 return p;
4982 char *
4983 xstrdup (const char *string)
4985 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4986 string) : NULL;
4989 const char *
4990 base_name (const char *name)
4992 const char *base;
4994 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4995 /* Skip over the disk name in MSDOS pathnames. */
4996 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4997 name += 2;
4998 #endif
5000 for (base = name; *name; name++)
5001 if (IS_DIR_SEPARATOR (*name))
5002 base = name + 1;
5003 return base;
5007 check_executable (const char *path)
5009 struct stat st;
5011 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
5012 nonempty (path));
5013 if ((!path) || (!*path))
5014 return 0;
5016 if ((stat (path, &st) >= 0)
5017 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
5018 return 1;
5019 else
5020 return 0;
5024 make_executable (const char *path)
5026 int rval = 0;
5027 struct stat st;
5029 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
5030 nonempty (path));
5031 if ((!path) || (!*path))
5032 return 0;
5034 if (stat (path, &st) >= 0)
5036 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
5038 return rval;
5041 /* Searches for the full path of the wrapper. Returns
5042 newly allocated full path name if found, NULL otherwise
5043 Does not chase symlinks, even on platforms that support them.
5045 char *
5046 find_executable (const char *wrapper)
5048 int has_slash = 0;
5049 const char *p;
5050 const char *p_next;
5051 /* static buffer for getcwd */
5052 char tmp[LT_PATHMAX + 1];
5053 int tmp_len;
5054 char *concat_name;
5056 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
5057 nonempty (wrapper));
5059 if ((wrapper == NULL) || (*wrapper == '\0'))
5060 return NULL;
5062 /* Absolute path? */
5063 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5064 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
5066 concat_name = xstrdup (wrapper);
5067 if (check_executable (concat_name))
5068 return concat_name;
5069 XFREE (concat_name);
5071 else
5073 #endif
5074 if (IS_DIR_SEPARATOR (wrapper[0]))
5076 concat_name = xstrdup (wrapper);
5077 if (check_executable (concat_name))
5078 return concat_name;
5079 XFREE (concat_name);
5081 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5083 #endif
5085 for (p = wrapper; *p; p++)
5086 if (*p == '/')
5088 has_slash = 1;
5089 break;
5091 if (!has_slash)
5093 /* no slashes; search PATH */
5094 const char *path = getenv ("PATH");
5095 if (path != NULL)
5097 for (p = path; *p; p = p_next)
5099 const char *q;
5100 size_t p_len;
5101 for (q = p; *q; q++)
5102 if (IS_PATH_SEPARATOR (*q))
5103 break;
5104 p_len = q - p;
5105 p_next = (*q == '\0' ? q : q + 1);
5106 if (p_len == 0)
5108 /* empty path: current directory */
5109 if (getcwd (tmp, LT_PATHMAX) == NULL)
5110 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5111 nonnull (strerror (errno)));
5112 tmp_len = strlen (tmp);
5113 concat_name =
5114 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5115 memcpy (concat_name, tmp, tmp_len);
5116 concat_name[tmp_len] = '/';
5117 strcpy (concat_name + tmp_len + 1, wrapper);
5119 else
5121 concat_name =
5122 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
5123 memcpy (concat_name, p, p_len);
5124 concat_name[p_len] = '/';
5125 strcpy (concat_name + p_len + 1, wrapper);
5127 if (check_executable (concat_name))
5128 return concat_name;
5129 XFREE (concat_name);
5132 /* not found in PATH; assume curdir */
5134 /* Relative path | not found in path: prepend cwd */
5135 if (getcwd (tmp, LT_PATHMAX) == NULL)
5136 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5137 nonnull (strerror (errno)));
5138 tmp_len = strlen (tmp);
5139 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5140 memcpy (concat_name, tmp, tmp_len);
5141 concat_name[tmp_len] = '/';
5142 strcpy (concat_name + tmp_len + 1, wrapper);
5144 if (check_executable (concat_name))
5145 return concat_name;
5146 XFREE (concat_name);
5147 return NULL;
5150 char *
5151 chase_symlinks (const char *pathspec)
5153 #ifndef S_ISLNK
5154 return xstrdup (pathspec);
5155 #else
5156 char buf[LT_PATHMAX];
5157 struct stat s;
5158 char *tmp_pathspec = xstrdup (pathspec);
5159 char *p;
5160 int has_symlinks = 0;
5161 while (strlen (tmp_pathspec) && !has_symlinks)
5163 lt_debugprintf (__FILE__, __LINE__,
5164 "checking path component for symlinks: %s\n",
5165 tmp_pathspec);
5166 if (lstat (tmp_pathspec, &s) == 0)
5168 if (S_ISLNK (s.st_mode) != 0)
5170 has_symlinks = 1;
5171 break;
5174 /* search backwards for last DIR_SEPARATOR */
5175 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
5176 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5177 p--;
5178 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5180 /* no more DIR_SEPARATORS left */
5181 break;
5183 *p = '\0';
5185 else
5187 lt_fatal (__FILE__, __LINE__,
5188 "error accessing file \"%s\": %s",
5189 tmp_pathspec, nonnull (strerror (errno)));
5192 XFREE (tmp_pathspec);
5194 if (!has_symlinks)
5196 return xstrdup (pathspec);
5199 tmp_pathspec = realpath (pathspec, buf);
5200 if (tmp_pathspec == 0)
5202 lt_fatal (__FILE__, __LINE__,
5203 "could not follow symlinks for %s", pathspec);
5205 return xstrdup (tmp_pathspec);
5206 #endif
5209 char *
5210 strendzap (char *str, const char *pat)
5212 size_t len, patlen;
5214 assert (str != NULL);
5215 assert (pat != NULL);
5217 len = strlen (str);
5218 patlen = strlen (pat);
5220 if (patlen <= len)
5222 str += len - patlen;
5223 if (strcmp (str, pat) == 0)
5224 *str = '\0';
5226 return str;
5229 void
5230 lt_debugprintf (const char *file, int line, const char *fmt, ...)
5232 va_list args;
5233 if (lt_debug)
5235 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
5236 va_start (args, fmt);
5237 (void) vfprintf (stderr, fmt, args);
5238 va_end (args);
5242 static void
5243 lt_error_core (int exit_status, const char *file,
5244 int line, const char *mode,
5245 const char *message, va_list ap)
5247 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
5248 vfprintf (stderr, message, ap);
5249 fprintf (stderr, ".\n");
5251 if (exit_status >= 0)
5252 exit (exit_status);
5255 void
5256 lt_fatal (const char *file, int line, const char *message, ...)
5258 va_list ap;
5259 va_start (ap, message);
5260 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
5261 va_end (ap);
5264 static const char *
5265 nonnull (const char *s)
5267 return s ? s : "(null)";
5270 static const char *
5271 nonempty (const char *s)
5273 return (s && !*s) ? "(empty)" : nonnull (s);
5276 void
5277 lt_setenv (const char *name, const char *value)
5279 lt_debugprintf (__FILE__, __LINE__,
5280 "(lt_setenv) setting '%s' to '%s'\n",
5281 nonnull (name), nonnull (value));
5283 #ifdef HAVE_SETENV
5284 /* always make a copy, for consistency with !HAVE_SETENV */
5285 char *str = xstrdup (value);
5286 setenv (name, str, 1);
5287 #else
5288 int len = strlen (name) + 1 + strlen (value) + 1;
5289 char *str = XMALLOC (char, len);
5290 sprintf (str, "%s=%s", name, value);
5291 if (putenv (str) != EXIT_SUCCESS)
5293 XFREE (str);
5295 #endif
5299 char *
5300 lt_extend_str (const char *orig_value, const char *add, int to_end)
5302 char *new_value;
5303 if (orig_value && *orig_value)
5305 int orig_value_len = strlen (orig_value);
5306 int add_len = strlen (add);
5307 new_value = XMALLOC (char, add_len + orig_value_len + 1);
5308 if (to_end)
5310 strcpy (new_value, orig_value);
5311 strcpy (new_value + orig_value_len, add);
5313 else
5315 strcpy (new_value, add);
5316 strcpy (new_value + add_len, orig_value);
5319 else
5321 new_value = xstrdup (add);
5323 return new_value;
5326 void
5327 lt_update_exe_path (const char *name, const char *value)
5329 lt_debugprintf (__FILE__, __LINE__,
5330 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
5331 nonnull (name), nonnull (value));
5333 if (name && *name && value && *value)
5335 char *new_value = lt_extend_str (getenv (name), value, 0);
5336 /* some systems can't cope with a ':'-terminated path #' */
5337 int len = strlen (new_value);
5338 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
5340 new_value[len-1] = '\0';
5342 lt_setenv (name, new_value);
5343 XFREE (new_value);
5347 void
5348 lt_update_lib_path (const char *name, const char *value)
5350 lt_debugprintf (__FILE__, __LINE__,
5351 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
5352 nonnull (name), nonnull (value));
5354 if (name && *name && value && *value)
5356 char *new_value = lt_extend_str (getenv (name), value, 0);
5357 lt_setenv (name, new_value);
5358 XFREE (new_value);
5363 case $host_os in
5364 mingw*)
5365 cat <<"EOF"
5367 /* Prepares an argument vector before calling spawn().
5368 Note that spawn() does not by itself call the command interpreter
5369 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
5370 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
5371 GetVersionEx(&v);
5372 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
5373 }) ? "cmd.exe" : "command.com").
5374 Instead it simply concatenates the arguments, separated by ' ', and calls
5375 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
5376 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
5377 special way:
5378 - Space and tab are interpreted as delimiters. They are not treated as
5379 delimiters if they are surrounded by double quotes: "...".
5380 - Unescaped double quotes are removed from the input. Their only effect is
5381 that within double quotes, space and tab are treated like normal
5382 characters.
5383 - Backslashes not followed by double quotes are not special.
5384 - But 2*n+1 backslashes followed by a double quote become
5385 n backslashes followed by a double quote (n >= 0):
5386 \" -> "
5387 \\\" -> \"
5388 \\\\\" -> \\"
5390 #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
5391 #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
5392 char **
5393 prepare_spawn (char **argv)
5395 size_t argc;
5396 char **new_argv;
5397 size_t i;
5399 /* Count number of arguments. */
5400 for (argc = 0; argv[argc] != NULL; argc++)
5403 /* Allocate new argument vector. */
5404 new_argv = XMALLOC (char *, argc + 1);
5406 /* Put quoted arguments into the new argument vector. */
5407 for (i = 0; i < argc; i++)
5409 const char *string = argv[i];
5411 if (string[0] == '\0')
5412 new_argv[i] = xstrdup ("\"\"");
5413 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5415 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5416 size_t length;
5417 unsigned int backslashes;
5418 const char *s;
5419 char *quoted_string;
5420 char *p;
5422 length = 0;
5423 backslashes = 0;
5424 if (quote_around)
5425 length++;
5426 for (s = string; *s != '\0'; s++)
5428 char c = *s;
5429 if (c == '"')
5430 length += backslashes + 1;
5431 length++;
5432 if (c == '\\')
5433 backslashes++;
5434 else
5435 backslashes = 0;
5437 if (quote_around)
5438 length += backslashes + 1;
5440 quoted_string = XMALLOC (char, length + 1);
5442 p = quoted_string;
5443 backslashes = 0;
5444 if (quote_around)
5445 *p++ = '"';
5446 for (s = string; *s != '\0'; s++)
5448 char c = *s;
5449 if (c == '"')
5451 unsigned int j;
5452 for (j = backslashes + 1; j > 0; j--)
5453 *p++ = '\\';
5455 *p++ = c;
5456 if (c == '\\')
5457 backslashes++;
5458 else
5459 backslashes = 0;
5461 if (quote_around)
5463 unsigned int j;
5464 for (j = backslashes; j > 0; j--)
5465 *p++ = '\\';
5466 *p++ = '"';
5468 *p = '\0';
5470 new_argv[i] = quoted_string;
5472 else
5473 new_argv[i] = (char *) string;
5475 new_argv[argc] = NULL;
5477 return new_argv;
5481 esac
5483 cat <<"EOF"
5484 void lt_dump_script (FILE* f)
5487 func_emit_wrapper yes |
5488 $SED -n -e '
5489 s/^\(.\{79\}\)\(..*\)/\1\
5492 s/\([\\"]\)/\\\1/g
5493 s/$/\\n/
5494 s/\([^\n]*\).*/ fputs ("\1", f);/p
5497 cat <<"EOF"
5501 # end: func_emit_cwrapperexe_src
5503 # func_win32_import_lib_p ARG
5504 # True if ARG is an import lib, as indicated by $file_magic_cmd
5505 func_win32_import_lib_p ()
5507 $opt_debug
5508 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5509 *import*) : ;;
5510 *) false ;;
5511 esac
5514 # func_mode_link arg...
5515 func_mode_link ()
5517 $opt_debug
5518 case $host in
5519 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5520 # It is impossible to link a dll without this setting, and
5521 # we shouldn't force the makefile maintainer to figure out
5522 # which system we are compiling for in order to pass an extra
5523 # flag for every libtool invocation.
5524 # allow_undefined=no
5526 # FIXME: Unfortunately, there are problems with the above when trying
5527 # to make a dll which has undefined symbols, in which case not
5528 # even a static library is built. For now, we need to specify
5529 # -no-undefined on the libtool link line when we can be certain
5530 # that all symbols are satisfied, otherwise we get a static library.
5531 allow_undefined=yes
5534 allow_undefined=yes
5536 esac
5537 libtool_args=$nonopt
5538 base_compile="$nonopt $@"
5539 compile_command=$nonopt
5540 finalize_command=$nonopt
5542 compile_rpath=
5543 finalize_rpath=
5544 compile_shlibpath=
5545 finalize_shlibpath=
5546 convenience=
5547 old_convenience=
5548 deplibs=
5549 old_deplibs=
5550 compiler_flags=
5551 linker_flags=
5552 dllsearchpath=
5553 lib_search_path=`pwd`
5554 inst_prefix_dir=
5555 new_inherited_linker_flags=
5557 avoid_version=no
5558 bindir=
5559 dlfiles=
5560 dlprefiles=
5561 dlself=no
5562 export_dynamic=no
5563 export_symbols=
5564 export_symbols_regex=
5565 generated=
5566 libobjs=
5567 ltlibs=
5568 module=no
5569 no_install=no
5570 objs=
5571 non_pic_objects=
5572 precious_files_regex=
5573 prefer_static_libs=no
5574 preload=no
5575 prev=
5576 prevarg=
5577 release=
5578 rpath=
5579 xrpath=
5580 perm_rpath=
5581 temp_rpath=
5582 thread_safe=no
5583 vinfo=
5584 vinfo_number=no
5585 weak_libs=
5586 single_module="${wl}-single_module"
5587 func_infer_tag $base_compile
5589 # We need to know -static, to get the right output filenames.
5590 for arg
5592 case $arg in
5593 -shared)
5594 test "$build_libtool_libs" != yes && \
5595 func_fatal_configuration "can not build a shared library"
5596 build_old_libs=no
5597 break
5599 -all-static | -static | -static-libtool-libs)
5600 case $arg in
5601 -all-static)
5602 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5603 func_warning "complete static linking is impossible in this configuration"
5605 if test -n "$link_static_flag"; then
5606 dlopen_self=$dlopen_self_static
5608 prefer_static_libs=yes
5610 -static)
5611 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5612 dlopen_self=$dlopen_self_static
5614 prefer_static_libs=built
5616 -static-libtool-libs)
5617 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5618 dlopen_self=$dlopen_self_static
5620 prefer_static_libs=yes
5622 esac
5623 build_libtool_libs=no
5624 build_old_libs=yes
5625 break
5627 esac
5628 done
5630 # See if our shared archives depend on static archives.
5631 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5633 # Go through the arguments, transforming them on the way.
5634 while test "$#" -gt 0; do
5635 arg="$1"
5636 shift
5637 func_quote_for_eval "$arg"
5638 qarg=$func_quote_for_eval_unquoted_result
5639 libtool_args+=" $func_quote_for_eval_result"
5641 # If the previous option needs an argument, assign it.
5642 if test -n "$prev"; then
5643 case $prev in
5644 output)
5645 compile_command+=" @OUTPUT@"
5646 finalize_command+=" @OUTPUT@"
5648 esac
5650 case $prev in
5651 bindir)
5652 bindir="$arg"
5653 prev=
5654 continue
5656 dlfiles|dlprefiles)
5657 if test "$preload" = no; then
5658 # Add the symbol object into the linking commands.
5659 compile_command+=" @SYMFILE@"
5660 finalize_command+=" @SYMFILE@"
5661 preload=yes
5663 case $arg in
5664 *.la | *.lo) ;; # We handle these cases below.
5665 force)
5666 if test "$dlself" = no; then
5667 dlself=needless
5668 export_dynamic=yes
5670 prev=
5671 continue
5673 self)
5674 if test "$prev" = dlprefiles; then
5675 dlself=yes
5676 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5677 dlself=yes
5678 else
5679 dlself=needless
5680 export_dynamic=yes
5682 prev=
5683 continue
5686 if test "$prev" = dlfiles; then
5687 dlfiles+=" $arg"
5688 else
5689 dlprefiles+=" $arg"
5691 prev=
5692 continue
5694 esac
5696 expsyms)
5697 export_symbols="$arg"
5698 test -f "$arg" \
5699 || func_fatal_error "symbol file \`$arg' does not exist"
5700 prev=
5701 continue
5703 expsyms_regex)
5704 export_symbols_regex="$arg"
5705 prev=
5706 continue
5708 framework)
5709 case $host in
5710 *-*-darwin*)
5711 case "$deplibs " in
5712 *" $qarg.ltframework "*) ;;
5713 *) deplibs+=" $qarg.ltframework" # this is fixed later
5715 esac
5717 esac
5718 prev=
5719 continue
5721 inst_prefix)
5722 inst_prefix_dir="$arg"
5723 prev=
5724 continue
5726 objectlist)
5727 if test -f "$arg"; then
5728 save_arg=$arg
5729 moreargs=
5730 for fil in `cat "$save_arg"`
5732 # moreargs+=" $fil"
5733 arg=$fil
5734 # A libtool-controlled object.
5736 # Check to see that this really is a libtool object.
5737 if func_lalib_unsafe_p "$arg"; then
5738 pic_object=
5739 non_pic_object=
5741 # Read the .lo file
5742 func_source "$arg"
5744 if test -z "$pic_object" ||
5745 test -z "$non_pic_object" ||
5746 test "$pic_object" = none &&
5747 test "$non_pic_object" = none; then
5748 func_fatal_error "cannot find name of object for \`$arg'"
5751 # Extract subdirectory from the argument.
5752 func_dirname "$arg" "/" ""
5753 xdir="$func_dirname_result"
5755 if test "$pic_object" != none; then
5756 # Prepend the subdirectory the object is found in.
5757 pic_object="$xdir$pic_object"
5759 if test "$prev" = dlfiles; then
5760 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5761 dlfiles+=" $pic_object"
5762 prev=
5763 continue
5764 else
5765 # If libtool objects are unsupported, then we need to preload.
5766 prev=dlprefiles
5770 # CHECK ME: I think I busted this. -Ossama
5771 if test "$prev" = dlprefiles; then
5772 # Preload the old-style object.
5773 dlprefiles+=" $pic_object"
5774 prev=
5777 # A PIC object.
5778 libobjs+=" $pic_object"
5779 arg="$pic_object"
5782 # Non-PIC object.
5783 if test "$non_pic_object" != none; then
5784 # Prepend the subdirectory the object is found in.
5785 non_pic_object="$xdir$non_pic_object"
5787 # A standard non-PIC object
5788 non_pic_objects+=" $non_pic_object"
5789 if test -z "$pic_object" || test "$pic_object" = none ; then
5790 arg="$non_pic_object"
5792 else
5793 # If the PIC object exists, use it instead.
5794 # $xdir was prepended to $pic_object above.
5795 non_pic_object="$pic_object"
5796 non_pic_objects+=" $non_pic_object"
5798 else
5799 # Only an error if not doing a dry-run.
5800 if $opt_dry_run; then
5801 # Extract subdirectory from the argument.
5802 func_dirname "$arg" "/" ""
5803 xdir="$func_dirname_result"
5805 func_lo2o "$arg"
5806 pic_object=$xdir$objdir/$func_lo2o_result
5807 non_pic_object=$xdir$func_lo2o_result
5808 libobjs+=" $pic_object"
5809 non_pic_objects+=" $non_pic_object"
5810 else
5811 func_fatal_error "\`$arg' is not a valid libtool object"
5814 done
5815 else
5816 func_fatal_error "link input file \`$arg' does not exist"
5818 arg=$save_arg
5819 prev=
5820 continue
5822 precious_regex)
5823 precious_files_regex="$arg"
5824 prev=
5825 continue
5827 release)
5828 release="-$arg"
5829 prev=
5830 continue
5832 rpath | xrpath)
5833 # We need an absolute path.
5834 case $arg in
5835 [\\/]* | [A-Za-z]:[\\/]*) ;;
5837 func_fatal_error "only absolute run-paths are allowed"
5839 esac
5840 if test "$prev" = rpath; then
5841 case "$rpath " in
5842 *" $arg "*) ;;
5843 *) rpath+=" $arg" ;;
5844 esac
5845 else
5846 case "$xrpath " in
5847 *" $arg "*) ;;
5848 *) xrpath+=" $arg" ;;
5849 esac
5851 prev=
5852 continue
5854 shrext)
5855 shrext_cmds="$arg"
5856 prev=
5857 continue
5859 weak)
5860 weak_libs+=" $arg"
5861 prev=
5862 continue
5864 xcclinker)
5865 linker_flags+=" $qarg"
5866 compiler_flags+=" $qarg"
5867 prev=
5868 compile_command+=" $qarg"
5869 finalize_command+=" $qarg"
5870 continue
5872 xcompiler)
5873 compiler_flags+=" $qarg"
5874 prev=
5875 compile_command+=" $qarg"
5876 finalize_command+=" $qarg"
5877 continue
5879 xlinker)
5880 linker_flags+=" $qarg"
5881 compiler_flags+=" $wl$qarg"
5882 prev=
5883 compile_command+=" $wl$qarg"
5884 finalize_command+=" $wl$qarg"
5885 continue
5888 eval "$prev=\"\$arg\""
5889 prev=
5890 continue
5892 esac
5893 fi # test -n "$prev"
5895 prevarg="$arg"
5897 case $arg in
5898 -all-static)
5899 if test -n "$link_static_flag"; then
5900 # See comment for -static flag below, for more details.
5901 compile_command+=" $link_static_flag"
5902 finalize_command+=" $link_static_flag"
5904 continue
5907 -allow-undefined)
5908 # FIXME: remove this flag sometime in the future.
5909 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5912 -avoid-version)
5913 avoid_version=yes
5914 continue
5917 -bindir)
5918 prev=bindir
5919 continue
5922 -dlopen)
5923 prev=dlfiles
5924 continue
5927 -dlpreopen)
5928 prev=dlprefiles
5929 continue
5932 -export-dynamic)
5933 export_dynamic=yes
5934 continue
5937 -export-symbols | -export-symbols-regex)
5938 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5939 func_fatal_error "more than one -exported-symbols argument is not allowed"
5941 if test "X$arg" = "X-export-symbols"; then
5942 prev=expsyms
5943 else
5944 prev=expsyms_regex
5946 continue
5949 -framework)
5950 prev=framework
5951 continue
5954 -inst-prefix-dir)
5955 prev=inst_prefix
5956 continue
5959 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5960 # so, if we see these flags be careful not to treat them like -L
5961 -L[A-Z][A-Z]*:*)
5962 case $with_gcc/$host in
5963 no/*-*-irix* | /*-*-irix*)
5964 compile_command+=" $arg"
5965 finalize_command+=" $arg"
5967 esac
5968 continue
5971 -L*)
5972 func_stripname "-L" '' "$arg"
5973 if test -z "$func_stripname_result"; then
5974 if test "$#" -gt 0; then
5975 func_fatal_error "require no space between \`-L' and \`$1'"
5976 else
5977 func_fatal_error "need path for \`-L' option"
5980 func_resolve_sysroot "$func_stripname_result"
5981 dir=$func_resolve_sysroot_result
5982 # We need an absolute path.
5983 case $dir in
5984 [\\/]* | [A-Za-z]:[\\/]*) ;;
5986 absdir=`cd "$dir" && pwd`
5987 test -z "$absdir" && \
5988 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5989 dir="$absdir"
5991 esac
5992 case "$deplibs " in
5993 *" -L$dir "* | *" $arg "*)
5994 # Will only happen for absolute or sysroot arguments
5997 # Preserve sysroot, but never include relative directories
5998 case $dir in
5999 [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs+=" $arg" ;;
6000 *) deplibs+=" -L$dir" ;;
6001 esac
6002 lib_search_path+=" $dir"
6004 esac
6005 case $host in
6006 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6007 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
6008 case :$dllsearchpath: in
6009 *":$dir:"*) ;;
6010 ::) dllsearchpath=$dir;;
6011 *) dllsearchpath+=":$dir";;
6012 esac
6013 case :$dllsearchpath: in
6014 *":$testbindir:"*) ;;
6015 ::) dllsearchpath=$testbindir;;
6016 *) dllsearchpath+=":$testbindir";;
6017 esac
6019 esac
6020 continue
6023 -l*)
6024 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
6025 case $host in
6026 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
6027 # These systems don't actually have a C or math library (as such)
6028 continue
6030 *-*-os2*)
6031 # These systems don't actually have a C library (as such)
6032 test "X$arg" = "X-lc" && continue
6034 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6035 # Do not include libc due to us having libc/libc_r.
6036 test "X$arg" = "X-lc" && continue
6038 *-*-rhapsody* | *-*-darwin1.[012])
6039 # Rhapsody C and math libraries are in the System framework
6040 deplibs+=" System.ltframework"
6041 continue
6043 *-*-sco3.2v5* | *-*-sco5v6*)
6044 # Causes problems with __ctype
6045 test "X$arg" = "X-lc" && continue
6047 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6048 # Compiler inserts libc in the correct place for threads to work
6049 test "X$arg" = "X-lc" && continue
6051 esac
6052 elif test "X$arg" = "X-lc_r"; then
6053 case $host in
6054 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6055 # Do not include libc_r directly, use -pthread flag.
6056 continue
6058 esac
6060 deplibs+=" $arg"
6061 continue
6064 -module)
6065 module=yes
6066 continue
6069 # Tru64 UNIX uses -model [arg] to determine the layout of C++
6070 # classes, name mangling, and exception handling.
6071 # Darwin uses the -arch flag to determine output architecture.
6072 -model|-arch|-isysroot|--sysroot)
6073 compiler_flags+=" $arg"
6074 compile_command+=" $arg"
6075 finalize_command+=" $arg"
6076 prev=xcompiler
6077 continue
6080 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6081 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6082 compiler_flags+=" $arg"
6083 compile_command+=" $arg"
6084 finalize_command+=" $arg"
6085 case "$new_inherited_linker_flags " in
6086 *" $arg "*) ;;
6087 * ) new_inherited_linker_flags+=" $arg" ;;
6088 esac
6089 continue
6092 -multi_module)
6093 single_module="${wl}-multi_module"
6094 continue
6097 -no-fast-install)
6098 fast_install=no
6099 continue
6102 -no-install)
6103 case $host in
6104 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
6105 # The PATH hackery in wrapper scripts is required on Windows
6106 # and Darwin in order for the loader to find any dlls it needs.
6107 func_warning "\`-no-install' is ignored for $host"
6108 func_warning "assuming \`-no-fast-install' instead"
6109 fast_install=no
6111 *) no_install=yes ;;
6112 esac
6113 continue
6116 -no-undefined)
6117 allow_undefined=no
6118 continue
6121 -objectlist)
6122 prev=objectlist
6123 continue
6126 -o) prev=output ;;
6128 -precious-files-regex)
6129 prev=precious_regex
6130 continue
6133 -release)
6134 prev=release
6135 continue
6138 -rpath)
6139 prev=rpath
6140 continue
6144 prev=xrpath
6145 continue
6148 -R*)
6149 func_stripname '-R' '' "$arg"
6150 dir=$func_stripname_result
6151 # We need an absolute path.
6152 case $dir in
6153 [\\/]* | [A-Za-z]:[\\/]*) ;;
6155 func_stripname '=' '' "$dir"
6156 dir=$lt_sysroot$func_stripname_result
6159 func_fatal_error "only absolute run-paths are allowed"
6161 esac
6162 case "$xrpath " in
6163 *" $dir "*) ;;
6164 *) xrpath+=" $dir" ;;
6165 esac
6166 continue
6169 -shared)
6170 # The effects of -shared are defined in a previous loop.
6171 continue
6174 -shrext)
6175 prev=shrext
6176 continue
6179 -static | -static-libtool-libs)
6180 # The effects of -static are defined in a previous loop.
6181 # We used to do the same as -all-static on platforms that
6182 # didn't have a PIC flag, but the assumption that the effects
6183 # would be equivalent was wrong. It would break on at least
6184 # Digital Unix and AIX.
6185 continue
6188 -thread-safe)
6189 thread_safe=yes
6190 continue
6193 -version-info)
6194 prev=vinfo
6195 continue
6198 -version-number)
6199 prev=vinfo
6200 vinfo_number=yes
6201 continue
6204 -weak)
6205 prev=weak
6206 continue
6209 -Wc,*)
6210 func_stripname '-Wc,' '' "$arg"
6211 args=$func_stripname_result
6212 arg=
6213 save_ifs="$IFS"; IFS=','
6214 for flag in $args; do
6215 IFS="$save_ifs"
6216 func_quote_for_eval "$flag"
6217 arg+=" $func_quote_for_eval_result"
6218 compiler_flags+=" $func_quote_for_eval_result"
6219 done
6220 IFS="$save_ifs"
6221 func_stripname ' ' '' "$arg"
6222 arg=$func_stripname_result
6225 -Wl,*)
6226 func_stripname '-Wl,' '' "$arg"
6227 args=$func_stripname_result
6228 arg=
6229 save_ifs="$IFS"; IFS=','
6230 for flag in $args; do
6231 IFS="$save_ifs"
6232 func_quote_for_eval "$flag"
6233 arg+=" $wl$func_quote_for_eval_result"
6234 compiler_flags+=" $wl$func_quote_for_eval_result"
6235 linker_flags+=" $func_quote_for_eval_result"
6236 done
6237 IFS="$save_ifs"
6238 func_stripname ' ' '' "$arg"
6239 arg=$func_stripname_result
6242 -Xcompiler)
6243 prev=xcompiler
6244 continue
6247 -Xlinker)
6248 prev=xlinker
6249 continue
6252 -XCClinker)
6253 prev=xcclinker
6254 continue
6257 # -msg_* for osf cc
6258 -msg_*)
6259 func_quote_for_eval "$arg"
6260 arg="$func_quote_for_eval_result"
6263 # Flags to be passed through unchanged, with rationale:
6264 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
6265 # -r[0-9][0-9]* specify processor for the SGI compiler
6266 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
6267 # +DA*, +DD* enable 64-bit mode for the HP compiler
6268 # -q* compiler args for the IBM compiler
6269 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
6270 # -F/path path to uninstalled frameworks, gcc on darwin
6271 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
6272 # @file GCC response files
6273 # -tp=* Portland pgcc target processor selection
6274 # --sysroot=* for sysroot support
6275 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
6276 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
6277 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
6278 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
6279 func_quote_for_eval "$arg"
6280 arg="$func_quote_for_eval_result"
6281 compile_command+=" $arg"
6282 finalize_command+=" $arg"
6283 compiler_flags+=" $arg"
6284 continue
6287 # Some other compiler flag.
6288 -* | +*)
6289 func_quote_for_eval "$arg"
6290 arg="$func_quote_for_eval_result"
6293 *.$objext)
6294 # A standard object.
6295 objs+=" $arg"
6298 *.lo)
6299 # A libtool-controlled object.
6301 # Check to see that this really is a libtool object.
6302 if func_lalib_unsafe_p "$arg"; then
6303 pic_object=
6304 non_pic_object=
6306 # Read the .lo file
6307 func_source "$arg"
6309 if test -z "$pic_object" ||
6310 test -z "$non_pic_object" ||
6311 test "$pic_object" = none &&
6312 test "$non_pic_object" = none; then
6313 func_fatal_error "cannot find name of object for \`$arg'"
6316 # Extract subdirectory from the argument.
6317 func_dirname "$arg" "/" ""
6318 xdir="$func_dirname_result"
6320 if test "$pic_object" != none; then
6321 # Prepend the subdirectory the object is found in.
6322 pic_object="$xdir$pic_object"
6324 if test "$prev" = dlfiles; then
6325 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
6326 dlfiles+=" $pic_object"
6327 prev=
6328 continue
6329 else
6330 # If libtool objects are unsupported, then we need to preload.
6331 prev=dlprefiles
6335 # CHECK ME: I think I busted this. -Ossama
6336 if test "$prev" = dlprefiles; then
6337 # Preload the old-style object.
6338 dlprefiles+=" $pic_object"
6339 prev=
6342 # A PIC object.
6343 libobjs+=" $pic_object"
6344 arg="$pic_object"
6347 # Non-PIC object.
6348 if test "$non_pic_object" != none; then
6349 # Prepend the subdirectory the object is found in.
6350 non_pic_object="$xdir$non_pic_object"
6352 # A standard non-PIC object
6353 non_pic_objects+=" $non_pic_object"
6354 if test -z "$pic_object" || test "$pic_object" = none ; then
6355 arg="$non_pic_object"
6357 else
6358 # If the PIC object exists, use it instead.
6359 # $xdir was prepended to $pic_object above.
6360 non_pic_object="$pic_object"
6361 non_pic_objects+=" $non_pic_object"
6363 else
6364 # Only an error if not doing a dry-run.
6365 if $opt_dry_run; then
6366 # Extract subdirectory from the argument.
6367 func_dirname "$arg" "/" ""
6368 xdir="$func_dirname_result"
6370 func_lo2o "$arg"
6371 pic_object=$xdir$objdir/$func_lo2o_result
6372 non_pic_object=$xdir$func_lo2o_result
6373 libobjs+=" $pic_object"
6374 non_pic_objects+=" $non_pic_object"
6375 else
6376 func_fatal_error "\`$arg' is not a valid libtool object"
6381 *.$libext)
6382 # An archive.
6383 deplibs+=" $arg"
6384 old_deplibs+=" $arg"
6385 continue
6388 *.la)
6389 # A libtool-controlled library.
6391 func_resolve_sysroot "$arg"
6392 if test "$prev" = dlfiles; then
6393 # This library was specified with -dlopen.
6394 dlfiles+=" $func_resolve_sysroot_result"
6395 prev=
6396 elif test "$prev" = dlprefiles; then
6397 # The library was specified with -dlpreopen.
6398 dlprefiles+=" $func_resolve_sysroot_result"
6399 prev=
6400 else
6401 deplibs+=" $func_resolve_sysroot_result"
6403 continue
6406 # Some other compiler argument.
6408 # Unknown arguments in both finalize_command and compile_command need
6409 # to be aesthetically quoted because they are evaled later.
6410 func_quote_for_eval "$arg"
6411 arg="$func_quote_for_eval_result"
6413 esac # arg
6415 # Now actually substitute the argument into the commands.
6416 if test -n "$arg"; then
6417 compile_command+=" $arg"
6418 finalize_command+=" $arg"
6420 done # argument parsing loop
6422 test -n "$prev" && \
6423 func_fatal_help "the \`$prevarg' option requires an argument"
6425 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6426 eval arg=\"$export_dynamic_flag_spec\"
6427 compile_command+=" $arg"
6428 finalize_command+=" $arg"
6431 oldlibs=
6432 # calculate the name of the file, without its directory
6433 func_basename "$output"
6434 outputname="$func_basename_result"
6435 libobjs_save="$libobjs"
6437 if test -n "$shlibpath_var"; then
6438 # get the directories listed in $shlibpath_var
6439 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6440 else
6441 shlib_search_path=
6443 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6444 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6446 func_dirname "$output" "/" ""
6447 output_objdir="$func_dirname_result$objdir"
6448 func_to_tool_file "$output_objdir/"
6449 tool_output_objdir=$func_to_tool_file_result
6450 # Create the object directory.
6451 func_mkdir_p "$output_objdir"
6453 # Determine the type of output
6454 case $output in
6456 func_fatal_help "you must specify an output file"
6458 *.$libext) linkmode=oldlib ;;
6459 *.lo | *.$objext) linkmode=obj ;;
6460 *.la) linkmode=lib ;;
6461 *) linkmode=prog ;; # Anything else should be a program.
6462 esac
6464 specialdeplibs=
6466 libs=
6467 # Find all interdependent deplibs by searching for libraries
6468 # that are linked more than once (e.g. -la -lb -la)
6469 for deplib in $deplibs; do
6470 if $opt_preserve_dup_deps ; then
6471 case "$libs " in
6472 *" $deplib "*) specialdeplibs+=" $deplib" ;;
6473 esac
6475 libs+=" $deplib"
6476 done
6478 if test "$linkmode" = lib; then
6479 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6481 # Compute libraries that are listed more than once in $predeps
6482 # $postdeps and mark them as special (i.e., whose duplicates are
6483 # not to be eliminated).
6484 pre_post_deps=
6485 if $opt_duplicate_compiler_generated_deps; then
6486 for pre_post_dep in $predeps $postdeps; do
6487 case "$pre_post_deps " in
6488 *" $pre_post_dep "*) specialdeplibs+=" $pre_post_deps" ;;
6489 esac
6490 pre_post_deps+=" $pre_post_dep"
6491 done
6493 pre_post_deps=
6496 deplibs=
6497 newdependency_libs=
6498 newlib_search_path=
6499 need_relink=no # whether we're linking any uninstalled libtool libraries
6500 notinst_deplibs= # not-installed libtool libraries
6501 notinst_path= # paths that contain not-installed libtool libraries
6503 case $linkmode in
6504 lib)
6505 passes="conv dlpreopen link"
6506 for file in $dlfiles $dlprefiles; do
6507 case $file in
6508 *.la) ;;
6510 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6512 esac
6513 done
6515 prog)
6516 compile_deplibs=
6517 finalize_deplibs=
6518 alldeplibs=no
6519 newdlfiles=
6520 newdlprefiles=
6521 passes="conv scan dlopen dlpreopen link"
6523 *) passes="conv"
6525 esac
6527 for pass in $passes; do
6528 # The preopen pass in lib mode reverses $deplibs; put it back here
6529 # so that -L comes before libs that need it for instance...
6530 if test "$linkmode,$pass" = "lib,link"; then
6531 ## FIXME: Find the place where the list is rebuilt in the wrong
6532 ## order, and fix it there properly
6533 tmp_deplibs=
6534 for deplib in $deplibs; do
6535 tmp_deplibs="$deplib $tmp_deplibs"
6536 done
6537 deplibs="$tmp_deplibs"
6540 if test "$linkmode,$pass" = "lib,link" ||
6541 test "$linkmode,$pass" = "prog,scan"; then
6542 libs="$deplibs"
6543 deplibs=
6545 if test "$linkmode" = prog; then
6546 case $pass in
6547 dlopen) libs="$dlfiles" ;;
6548 dlpreopen) libs="$dlprefiles" ;;
6549 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6550 esac
6552 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6553 # Collect and forward deplibs of preopened libtool libs
6554 for lib in $dlprefiles; do
6555 # Ignore non-libtool-libs
6556 dependency_libs=
6557 func_resolve_sysroot "$lib"
6558 case $lib in
6559 *.la) func_source "$func_resolve_sysroot_result" ;;
6560 esac
6562 # Collect preopened libtool deplibs, except any this library
6563 # has declared as weak libs
6564 for deplib in $dependency_libs; do
6565 func_basename "$deplib"
6566 deplib_base=$func_basename_result
6567 case " $weak_libs " in
6568 *" $deplib_base "*) ;;
6569 *) deplibs+=" $deplib" ;;
6570 esac
6571 done
6572 done
6573 libs="$dlprefiles"
6575 if test "$pass" = dlopen; then
6576 # Collect dlpreopened libraries
6577 save_deplibs="$deplibs"
6578 deplibs=
6581 for deplib in $libs; do
6582 lib=
6583 found=no
6584 case $deplib in
6585 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6586 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6587 if test "$linkmode,$pass" = "prog,link"; then
6588 compile_deplibs="$deplib $compile_deplibs"
6589 finalize_deplibs="$deplib $finalize_deplibs"
6590 else
6591 compiler_flags+=" $deplib"
6592 if test "$linkmode" = lib ; then
6593 case "$new_inherited_linker_flags " in
6594 *" $deplib "*) ;;
6595 * ) new_inherited_linker_flags+=" $deplib" ;;
6596 esac
6599 continue
6601 -l*)
6602 if test "$linkmode" != lib && test "$linkmode" != prog; then
6603 func_warning "\`-l' is ignored for archives/objects"
6604 continue
6606 func_stripname '-l' '' "$deplib"
6607 name=$func_stripname_result
6608 if test "$linkmode" = lib; then
6609 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6610 else
6611 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6613 for searchdir in $searchdirs; do
6614 for search_ext in .la $std_shrext .so .a; do
6615 # Search the libtool library
6616 lib="$searchdir/lib${name}${search_ext}"
6617 if test -f "$lib"; then
6618 if test "$search_ext" = ".la"; then
6619 found=yes
6620 else
6621 found=no
6623 break 2
6625 done
6626 done
6627 if test "$found" != yes; then
6628 # deplib doesn't seem to be a libtool library
6629 if test "$linkmode,$pass" = "prog,link"; then
6630 compile_deplibs="$deplib $compile_deplibs"
6631 finalize_deplibs="$deplib $finalize_deplibs"
6632 else
6633 deplibs="$deplib $deplibs"
6634 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6636 continue
6637 else # deplib is a libtool library
6638 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6639 # We need to do some special things here, and not later.
6640 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6641 case " $predeps $postdeps " in
6642 *" $deplib "*)
6643 if func_lalib_p "$lib"; then
6644 library_names=
6645 old_library=
6646 func_source "$lib"
6647 for l in $old_library $library_names; do
6648 ll="$l"
6649 done
6650 if test "X$ll" = "X$old_library" ; then # only static version available
6651 found=no
6652 func_dirname "$lib" "" "."
6653 ladir="$func_dirname_result"
6654 lib=$ladir/$old_library
6655 if test "$linkmode,$pass" = "prog,link"; then
6656 compile_deplibs="$deplib $compile_deplibs"
6657 finalize_deplibs="$deplib $finalize_deplibs"
6658 else
6659 deplibs="$deplib $deplibs"
6660 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6662 continue
6666 *) ;;
6667 esac
6670 ;; # -l
6671 *.ltframework)
6672 if test "$linkmode,$pass" = "prog,link"; then
6673 compile_deplibs="$deplib $compile_deplibs"
6674 finalize_deplibs="$deplib $finalize_deplibs"
6675 else
6676 deplibs="$deplib $deplibs"
6677 if test "$linkmode" = lib ; then
6678 case "$new_inherited_linker_flags " in
6679 *" $deplib "*) ;;
6680 * ) new_inherited_linker_flags+=" $deplib" ;;
6681 esac
6684 continue
6686 -L*)
6687 case $linkmode in
6688 lib)
6689 deplibs="$deplib $deplibs"
6690 test "$pass" = conv && continue
6691 newdependency_libs="$deplib $newdependency_libs"
6692 func_stripname '-L' '' "$deplib"
6693 func_resolve_sysroot "$func_stripname_result"
6694 newlib_search_path+=" $func_resolve_sysroot_result"
6696 prog)
6697 if test "$pass" = conv; then
6698 deplibs="$deplib $deplibs"
6699 continue
6701 if test "$pass" = scan; then
6702 deplibs="$deplib $deplibs"
6703 else
6704 compile_deplibs="$deplib $compile_deplibs"
6705 finalize_deplibs="$deplib $finalize_deplibs"
6707 func_stripname '-L' '' "$deplib"
6708 func_resolve_sysroot "$func_stripname_result"
6709 newlib_search_path+=" $func_resolve_sysroot_result"
6712 func_warning "\`-L' is ignored for archives/objects"
6714 esac # linkmode
6715 continue
6716 ;; # -L
6717 -R*)
6718 if test "$pass" = link; then
6719 func_stripname '-R' '' "$deplib"
6720 func_resolve_sysroot "$func_stripname_result"
6721 dir=$func_resolve_sysroot_result
6722 # Make sure the xrpath contains only unique directories.
6723 case "$xrpath " in
6724 *" $dir "*) ;;
6725 *) xrpath+=" $dir" ;;
6726 esac
6728 deplibs="$deplib $deplibs"
6729 continue
6731 *.la)
6732 func_resolve_sysroot "$deplib"
6733 lib=$func_resolve_sysroot_result
6735 *.$libext)
6736 if test "$pass" = conv; then
6737 deplibs="$deplib $deplibs"
6738 continue
6740 case $linkmode in
6741 lib)
6742 # Linking convenience modules into shared libraries is allowed,
6743 # but linking other static libraries is non-portable.
6744 case " $dlpreconveniencelibs " in
6745 *" $deplib "*) ;;
6747 valid_a_lib=no
6748 case $deplibs_check_method in
6749 match_pattern*)
6750 set dummy $deplibs_check_method; shift
6751 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6752 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6753 | $EGREP "$match_pattern_regex" > /dev/null; then
6754 valid_a_lib=yes
6757 pass_all)
6758 valid_a_lib=yes
6760 esac
6761 if test "$valid_a_lib" != yes; then
6762 echo
6763 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6764 echo "*** I have the capability to make that library automatically link in when"
6765 echo "*** you link to this library. But I can only do this if you have a"
6766 echo "*** shared version of the library, which you do not appear to have"
6767 echo "*** because the file extensions .$libext of this argument makes me believe"
6768 echo "*** that it is just a static archive that I should not use here."
6769 else
6770 echo
6771 $ECHO "*** Warning: Linking the shared library $output against the"
6772 $ECHO "*** static library $deplib is not portable!"
6773 deplibs="$deplib $deplibs"
6776 esac
6777 continue
6779 prog)
6780 if test "$pass" != link; then
6781 deplibs="$deplib $deplibs"
6782 else
6783 compile_deplibs="$deplib $compile_deplibs"
6784 finalize_deplibs="$deplib $finalize_deplibs"
6786 continue
6788 esac # linkmode
6789 ;; # *.$libext
6790 *.lo | *.$objext)
6791 if test "$pass" = conv; then
6792 deplibs="$deplib $deplibs"
6793 elif test "$linkmode" = prog; then
6794 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6795 # If there is no dlopen support or we're linking statically,
6796 # we need to preload.
6797 newdlprefiles+=" $deplib"
6798 compile_deplibs="$deplib $compile_deplibs"
6799 finalize_deplibs="$deplib $finalize_deplibs"
6800 else
6801 newdlfiles+=" $deplib"
6804 continue
6806 %DEPLIBS%)
6807 alldeplibs=yes
6808 continue
6810 esac # case $deplib
6812 if test "$found" = yes || test -f "$lib"; then :
6813 else
6814 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6817 # Check to see that this really is a libtool archive.
6818 func_lalib_unsafe_p "$lib" \
6819 || func_fatal_error "\`$lib' is not a valid libtool archive"
6821 func_dirname "$lib" "" "."
6822 ladir="$func_dirname_result"
6824 dlname=
6825 dlopen=
6826 dlpreopen=
6827 libdir=
6828 library_names=
6829 old_library=
6830 inherited_linker_flags=
6831 # If the library was installed with an old release of libtool,
6832 # it will not redefine variables installed, or shouldnotlink
6833 installed=yes
6834 shouldnotlink=no
6835 avoidtemprpath=
6838 # Read the .la file
6839 func_source "$lib"
6841 # Convert "-framework foo" to "foo.ltframework"
6842 if test -n "$inherited_linker_flags"; then
6843 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6844 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6845 case " $new_inherited_linker_flags " in
6846 *" $tmp_inherited_linker_flag "*) ;;
6847 *) new_inherited_linker_flags+=" $tmp_inherited_linker_flag";;
6848 esac
6849 done
6851 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6852 if test "$linkmode,$pass" = "lib,link" ||
6853 test "$linkmode,$pass" = "prog,scan" ||
6854 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6855 test -n "$dlopen" && dlfiles+=" $dlopen"
6856 test -n "$dlpreopen" && dlprefiles+=" $dlpreopen"
6859 if test "$pass" = conv; then
6860 # Only check for convenience libraries
6861 deplibs="$lib $deplibs"
6862 if test -z "$libdir"; then
6863 if test -z "$old_library"; then
6864 func_fatal_error "cannot find name of link library for \`$lib'"
6866 # It is a libtool convenience library, so add in its objects.
6867 convenience+=" $ladir/$objdir/$old_library"
6868 old_convenience+=" $ladir/$objdir/$old_library"
6869 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6870 func_fatal_error "\`$lib' is not a convenience library"
6872 tmp_libs=
6873 for deplib in $dependency_libs; do
6874 deplibs="$deplib $deplibs"
6875 if $opt_preserve_dup_deps ; then
6876 case "$tmp_libs " in
6877 *" $deplib "*) specialdeplibs+=" $deplib" ;;
6878 esac
6880 tmp_libs+=" $deplib"
6881 done
6882 continue
6883 fi # $pass = conv
6886 # Get the name of the library we link against.
6887 linklib=
6888 if test -n "$old_library" &&
6889 { test "$prefer_static_libs" = yes ||
6890 test "$prefer_static_libs,$installed" = "built,no"; }; then
6891 linklib=$old_library
6892 else
6893 for l in $old_library $library_names; do
6894 linklib="$l"
6895 done
6897 if test -z "$linklib"; then
6898 func_fatal_error "cannot find name of link library for \`$lib'"
6901 # This library was specified with -dlopen.
6902 if test "$pass" = dlopen; then
6903 if test -z "$libdir"; then
6904 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6906 if test -z "$dlname" ||
6907 test "$dlopen_support" != yes ||
6908 test "$build_libtool_libs" = no; then
6909 # If there is no dlname, no dlopen support or we're linking
6910 # statically, we need to preload. We also need to preload any
6911 # dependent libraries so libltdl's deplib preloader doesn't
6912 # bomb out in the load deplibs phase.
6913 dlprefiles+=" $lib $dependency_libs"
6914 else
6915 newdlfiles+=" $lib"
6917 continue
6918 fi # $pass = dlopen
6920 # We need an absolute path.
6921 case $ladir in
6922 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6924 abs_ladir=`cd "$ladir" && pwd`
6925 if test -z "$abs_ladir"; then
6926 func_warning "cannot determine absolute directory name of \`$ladir'"
6927 func_warning "passing it literally to the linker, although it might fail"
6928 abs_ladir="$ladir"
6931 esac
6932 func_basename "$lib"
6933 laname="$func_basename_result"
6935 # Find the relevant object directory and library name.
6936 if test "X$installed" = Xyes; then
6937 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6938 func_warning "library \`$lib' was moved."
6939 dir="$ladir"
6940 absdir="$abs_ladir"
6941 libdir="$abs_ladir"
6942 else
6943 dir="$lt_sysroot$libdir"
6944 absdir="$lt_sysroot$libdir"
6946 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6947 else
6948 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6949 dir="$ladir"
6950 absdir="$abs_ladir"
6951 # Remove this search path later
6952 notinst_path+=" $abs_ladir"
6953 else
6954 dir="$ladir/$objdir"
6955 absdir="$abs_ladir/$objdir"
6956 # Remove this search path later
6957 notinst_path+=" $abs_ladir"
6959 fi # $installed = yes
6960 func_stripname 'lib' '.la' "$laname"
6961 name=$func_stripname_result
6963 # This library was specified with -dlpreopen.
6964 if test "$pass" = dlpreopen; then
6965 if test -z "$libdir" && test "$linkmode" = prog; then
6966 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6968 case "$host" in
6969 # special handling for platforms with PE-DLLs.
6970 *cygwin* | *mingw* | *cegcc* )
6971 # Linker will automatically link against shared library if both
6972 # static and shared are present. Therefore, ensure we extract
6973 # symbols from the import library if a shared library is present
6974 # (otherwise, the dlopen module name will be incorrect). We do
6975 # this by putting the import library name into $newdlprefiles.
6976 # We recover the dlopen module name by 'saving' the la file
6977 # name in a special purpose variable, and (later) extracting the
6978 # dlname from the la file.
6979 if test -n "$dlname"; then
6980 func_tr_sh "$dir/$linklib"
6981 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6982 newdlprefiles+=" $dir/$linklib"
6983 else
6984 newdlprefiles+=" $dir/$old_library"
6985 # Keep a list of preopened convenience libraries to check
6986 # that they are being used correctly in the link pass.
6987 test -z "$libdir" && \
6988 dlpreconveniencelibs+=" $dir/$old_library"
6992 # Prefer using a static library (so that no silly _DYNAMIC symbols
6993 # are required to link).
6994 if test -n "$old_library"; then
6995 newdlprefiles+=" $dir/$old_library"
6996 # Keep a list of preopened convenience libraries to check
6997 # that they are being used correctly in the link pass.
6998 test -z "$libdir" && \
6999 dlpreconveniencelibs+=" $dir/$old_library"
7000 # Otherwise, use the dlname, so that lt_dlopen finds it.
7001 elif test -n "$dlname"; then
7002 newdlprefiles+=" $dir/$dlname"
7003 else
7004 newdlprefiles+=" $dir/$linklib"
7007 esac
7008 fi # $pass = dlpreopen
7010 if test -z "$libdir"; then
7011 # Link the convenience library
7012 if test "$linkmode" = lib; then
7013 deplibs="$dir/$old_library $deplibs"
7014 elif test "$linkmode,$pass" = "prog,link"; then
7015 compile_deplibs="$dir/$old_library $compile_deplibs"
7016 finalize_deplibs="$dir/$old_library $finalize_deplibs"
7017 else
7018 deplibs="$lib $deplibs" # used for prog,scan pass
7020 continue
7024 if test "$linkmode" = prog && test "$pass" != link; then
7025 newlib_search_path+=" $ladir"
7026 deplibs="$lib $deplibs"
7028 linkalldeplibs=no
7029 if test "$link_all_deplibs" != no || test -z "$library_names" ||
7030 test "$build_libtool_libs" = no; then
7031 linkalldeplibs=yes
7034 tmp_libs=
7035 for deplib in $dependency_libs; do
7036 case $deplib in
7037 -L*) func_stripname '-L' '' "$deplib"
7038 func_resolve_sysroot "$func_stripname_result"
7039 newlib_search_path+=" $func_resolve_sysroot_result"
7041 esac
7042 # Need to link against all dependency_libs?
7043 if test "$linkalldeplibs" = yes; then
7044 deplibs="$deplib $deplibs"
7045 else
7046 # Need to hardcode shared library paths
7047 # or/and link against static libraries
7048 newdependency_libs="$deplib $newdependency_libs"
7050 if $opt_preserve_dup_deps ; then
7051 case "$tmp_libs " in
7052 *" $deplib "*) specialdeplibs+=" $deplib" ;;
7053 esac
7055 tmp_libs+=" $deplib"
7056 done # for deplib
7057 continue
7058 fi # $linkmode = prog...
7060 if test "$linkmode,$pass" = "prog,link"; then
7061 if test -n "$library_names" &&
7062 { { test "$prefer_static_libs" = no ||
7063 test "$prefer_static_libs,$installed" = "built,yes"; } ||
7064 test -z "$old_library"; }; then
7065 # We need to hardcode the library path
7066 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
7067 # Make sure the rpath contains only unique directories.
7068 case "$temp_rpath:" in
7069 *"$absdir:"*) ;;
7070 *) temp_rpath+="$absdir:" ;;
7071 esac
7074 # Hardcode the library path.
7075 # Skip directories that are in the system default run-time
7076 # search path.
7077 case " $sys_lib_dlsearch_path " in
7078 *" $absdir "*) ;;
7080 case "$compile_rpath " in
7081 *" $absdir "*) ;;
7082 *) compile_rpath+=" $absdir" ;;
7083 esac
7085 esac
7086 case " $sys_lib_dlsearch_path " in
7087 *" $libdir "*) ;;
7089 case "$finalize_rpath " in
7090 *" $libdir "*) ;;
7091 *) finalize_rpath+=" $libdir" ;;
7092 esac
7094 esac
7095 fi # $linkmode,$pass = prog,link...
7097 if test "$alldeplibs" = yes &&
7098 { test "$deplibs_check_method" = pass_all ||
7099 { test "$build_libtool_libs" = yes &&
7100 test -n "$library_names"; }; }; then
7101 # We only need to search for static libraries
7102 continue
7106 link_static=no # Whether the deplib will be linked statically
7107 use_static_libs=$prefer_static_libs
7108 if test "$use_static_libs" = built && test "$installed" = yes; then
7109 use_static_libs=no
7111 if test -n "$library_names" &&
7112 { test "$use_static_libs" = no || test -z "$old_library"; }; then
7113 case $host in
7114 *cygwin* | *mingw* | *cegcc*)
7115 # No point in relinking DLLs because paths are not encoded
7116 notinst_deplibs+=" $lib"
7117 need_relink=no
7120 if test "$installed" = no; then
7121 notinst_deplibs+=" $lib"
7122 need_relink=yes
7125 esac
7126 # This is a shared library
7128 # Warn about portability, can't link against -module's on some
7129 # systems (darwin). Don't bleat about dlopened modules though!
7130 dlopenmodule=""
7131 for dlpremoduletest in $dlprefiles; do
7132 if test "X$dlpremoduletest" = "X$lib"; then
7133 dlopenmodule="$dlpremoduletest"
7134 break
7136 done
7137 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
7138 echo
7139 if test "$linkmode" = prog; then
7140 $ECHO "*** Warning: Linking the executable $output against the loadable module"
7141 else
7142 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
7144 $ECHO "*** $linklib is not portable!"
7146 if test "$linkmode" = lib &&
7147 test "$hardcode_into_libs" = yes; then
7148 # Hardcode the library path.
7149 # Skip directories that are in the system default run-time
7150 # search path.
7151 case " $sys_lib_dlsearch_path " in
7152 *" $absdir "*) ;;
7154 case "$compile_rpath " in
7155 *" $absdir "*) ;;
7156 *) compile_rpath+=" $absdir" ;;
7157 esac
7159 esac
7160 case " $sys_lib_dlsearch_path " in
7161 *" $libdir "*) ;;
7163 case "$finalize_rpath " in
7164 *" $libdir "*) ;;
7165 *) finalize_rpath+=" $libdir" ;;
7166 esac
7168 esac
7171 if test -n "$old_archive_from_expsyms_cmds"; then
7172 # figure out the soname
7173 set dummy $library_names
7174 shift
7175 realname="$1"
7176 shift
7177 libname=`eval "\\$ECHO \"$libname_spec\""`
7178 # use dlname if we got it. it's perfectly good, no?
7179 if test -n "$dlname"; then
7180 soname="$dlname"
7181 elif test -n "$soname_spec"; then
7182 # bleh windows
7183 case $host in
7184 *cygwin* | mingw* | *cegcc*)
7185 func_arith $current - $age
7186 major=$func_arith_result
7187 versuffix="-$major"
7189 esac
7190 eval soname=\"$soname_spec\"
7191 else
7192 soname="$realname"
7195 # Make a new name for the extract_expsyms_cmds to use
7196 soroot="$soname"
7197 func_basename "$soroot"
7198 soname="$func_basename_result"
7199 func_stripname 'lib' '.dll' "$soname"
7200 newlib=libimp-$func_stripname_result.a
7202 # If the library has no export list, then create one now
7203 if test -f "$output_objdir/$soname-def"; then :
7204 else
7205 func_verbose "extracting exported symbol list from \`$soname'"
7206 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
7209 # Create $newlib
7210 if test -f "$output_objdir/$newlib"; then :; else
7211 func_verbose "generating import library for \`$soname'"
7212 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
7214 # make sure the library variables are pointing to the new library
7215 dir=$output_objdir
7216 linklib=$newlib
7217 fi # test -n "$old_archive_from_expsyms_cmds"
7219 if test "$linkmode" = prog || test "$opt_mode" != relink; then
7220 add_shlibpath=
7221 add_dir=
7222 add=
7223 lib_linked=yes
7224 case $hardcode_action in
7225 immediate | unsupported)
7226 if test "$hardcode_direct" = no; then
7227 add="$dir/$linklib"
7228 case $host in
7229 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
7230 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
7231 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
7232 *-*-unixware7*) add_dir="-L$dir" ;;
7233 *-*-darwin* )
7234 # if the lib is a (non-dlopened) module then we can not
7235 # link against it, someone is ignoring the earlier warnings
7236 if /usr/bin/file -L $add 2> /dev/null |
7237 $GREP ": [^:]* bundle" >/dev/null ; then
7238 if test "X$dlopenmodule" != "X$lib"; then
7239 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
7240 if test -z "$old_library" ; then
7241 echo
7242 echo "*** And there doesn't seem to be a static archive available"
7243 echo "*** The link will probably fail, sorry"
7244 else
7245 add="$dir/$old_library"
7247 elif test -n "$old_library"; then
7248 add="$dir/$old_library"
7251 esac
7252 elif test "$hardcode_minus_L" = no; then
7253 case $host in
7254 *-*-sunos*) add_shlibpath="$dir" ;;
7255 esac
7256 add_dir="-L$dir"
7257 add="-l$name"
7258 elif test "$hardcode_shlibpath_var" = no; then
7259 add_shlibpath="$dir"
7260 add="-l$name"
7261 else
7262 lib_linked=no
7265 relink)
7266 if test "$hardcode_direct" = yes &&
7267 test "$hardcode_direct_absolute" = no; then
7268 add="$dir/$linklib"
7269 elif test "$hardcode_minus_L" = yes; then
7270 add_dir="-L$absdir"
7271 # Try looking first in the location we're being installed to.
7272 if test -n "$inst_prefix_dir"; then
7273 case $libdir in
7274 [\\/]*)
7275 add_dir+=" -L$inst_prefix_dir$libdir"
7277 esac
7279 add="-l$name"
7280 elif test "$hardcode_shlibpath_var" = yes; then
7281 add_shlibpath="$dir"
7282 add="-l$name"
7283 else
7284 lib_linked=no
7287 *) lib_linked=no ;;
7288 esac
7290 if test "$lib_linked" != yes; then
7291 func_fatal_configuration "unsupported hardcode properties"
7294 if test -n "$add_shlibpath"; then
7295 case :$compile_shlibpath: in
7296 *":$add_shlibpath:"*) ;;
7297 *) compile_shlibpath+="$add_shlibpath:" ;;
7298 esac
7300 if test "$linkmode" = prog; then
7301 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
7302 test -n "$add" && compile_deplibs="$add $compile_deplibs"
7303 else
7304 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7305 test -n "$add" && deplibs="$add $deplibs"
7306 if test "$hardcode_direct" != yes &&
7307 test "$hardcode_minus_L" != yes &&
7308 test "$hardcode_shlibpath_var" = yes; then
7309 case :$finalize_shlibpath: in
7310 *":$libdir:"*) ;;
7311 *) finalize_shlibpath+="$libdir:" ;;
7312 esac
7317 if test "$linkmode" = prog || test "$opt_mode" = relink; then
7318 add_shlibpath=
7319 add_dir=
7320 add=
7321 # Finalize command for both is simple: just hardcode it.
7322 if test "$hardcode_direct" = yes &&
7323 test "$hardcode_direct_absolute" = no; then
7324 add="$libdir/$linklib"
7325 elif test "$hardcode_minus_L" = yes; then
7326 add_dir="-L$libdir"
7327 add="-l$name"
7328 elif test "$hardcode_shlibpath_var" = yes; then
7329 case :$finalize_shlibpath: in
7330 *":$libdir:"*) ;;
7331 *) finalize_shlibpath+="$libdir:" ;;
7332 esac
7333 add="-l$name"
7334 elif test "$hardcode_automatic" = yes; then
7335 if test -n "$inst_prefix_dir" &&
7336 test -f "$inst_prefix_dir$libdir/$linklib" ; then
7337 add="$inst_prefix_dir$libdir/$linklib"
7338 else
7339 add="$libdir/$linklib"
7341 else
7342 # We cannot seem to hardcode it, guess we'll fake it.
7343 add_dir="-L$libdir"
7344 # Try looking first in the location we're being installed to.
7345 if test -n "$inst_prefix_dir"; then
7346 case $libdir in
7347 [\\/]*)
7348 add_dir+=" -L$inst_prefix_dir$libdir"
7350 esac
7352 add="-l$name"
7355 if test "$linkmode" = prog; then
7356 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
7357 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
7358 else
7359 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7360 test -n "$add" && deplibs="$add $deplibs"
7363 elif test "$linkmode" = prog; then
7364 # Here we assume that one of hardcode_direct or hardcode_minus_L
7365 # is not unsupported. This is valid on all known static and
7366 # shared platforms.
7367 if test "$hardcode_direct" != unsupported; then
7368 test -n "$old_library" && linklib="$old_library"
7369 compile_deplibs="$dir/$linklib $compile_deplibs"
7370 finalize_deplibs="$dir/$linklib $finalize_deplibs"
7371 else
7372 compile_deplibs="-l$name -L$dir $compile_deplibs"
7373 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
7375 elif test "$build_libtool_libs" = yes; then
7376 # Not a shared library
7377 if test "$deplibs_check_method" != pass_all; then
7378 # We're trying link a shared library against a static one
7379 # but the system doesn't support it.
7381 # Just print a warning and add the library to dependency_libs so
7382 # that the program can be linked against the static library.
7383 echo
7384 $ECHO "*** Warning: This system can not link to static lib archive $lib."
7385 echo "*** I have the capability to make that library automatically link in when"
7386 echo "*** you link to this library. But I can only do this if you have a"
7387 echo "*** shared version of the library, which you do not appear to have."
7388 if test "$module" = yes; then
7389 echo "*** But as you try to build a module library, libtool will still create "
7390 echo "*** a static module, that should work as long as the dlopening application"
7391 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
7392 if test -z "$global_symbol_pipe"; then
7393 echo
7394 echo "*** However, this would only work if libtool was able to extract symbol"
7395 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7396 echo "*** not find such a program. So, this module is probably useless."
7397 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7399 if test "$build_old_libs" = no; then
7400 build_libtool_libs=module
7401 build_old_libs=yes
7402 else
7403 build_libtool_libs=no
7406 else
7407 deplibs="$dir/$old_library $deplibs"
7408 link_static=yes
7410 fi # link shared/static library?
7412 if test "$linkmode" = lib; then
7413 if test -n "$dependency_libs" &&
7414 { test "$hardcode_into_libs" != yes ||
7415 test "$build_old_libs" = yes ||
7416 test "$link_static" = yes; }; then
7417 # Extract -R from dependency_libs
7418 temp_deplibs=
7419 for libdir in $dependency_libs; do
7420 case $libdir in
7421 -R*) func_stripname '-R' '' "$libdir"
7422 temp_xrpath=$func_stripname_result
7423 case " $xrpath " in
7424 *" $temp_xrpath "*) ;;
7425 *) xrpath+=" $temp_xrpath";;
7426 esac;;
7427 *) temp_deplibs+=" $libdir";;
7428 esac
7429 done
7430 dependency_libs="$temp_deplibs"
7433 newlib_search_path+=" $absdir"
7434 # Link against this library
7435 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7436 # ... and its dependency_libs
7437 tmp_libs=
7438 for deplib in $dependency_libs; do
7439 newdependency_libs="$deplib $newdependency_libs"
7440 case $deplib in
7441 -L*) func_stripname '-L' '' "$deplib"
7442 func_resolve_sysroot "$func_stripname_result";;
7443 *) func_resolve_sysroot "$deplib" ;;
7444 esac
7445 if $opt_preserve_dup_deps ; then
7446 case "$tmp_libs " in
7447 *" $func_resolve_sysroot_result "*)
7448 specialdeplibs+=" $func_resolve_sysroot_result" ;;
7449 esac
7451 tmp_libs+=" $func_resolve_sysroot_result"
7452 done
7454 if test "$link_all_deplibs" != no; then
7455 # Add the search paths of all dependency libraries
7456 for deplib in $dependency_libs; do
7457 path=
7458 case $deplib in
7459 -L*) path="$deplib" ;;
7460 *.la)
7461 func_resolve_sysroot "$deplib"
7462 deplib=$func_resolve_sysroot_result
7463 func_dirname "$deplib" "" "."
7464 dir=$func_dirname_result
7465 # We need an absolute path.
7466 case $dir in
7467 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7469 absdir=`cd "$dir" && pwd`
7470 if test -z "$absdir"; then
7471 func_warning "cannot determine absolute directory name of \`$dir'"
7472 absdir="$dir"
7475 esac
7476 if $GREP "^installed=no" $deplib > /dev/null; then
7477 case $host in
7478 *-*-darwin*)
7479 depdepl=
7480 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7481 if test -n "$deplibrary_names" ; then
7482 for tmp in $deplibrary_names ; do
7483 depdepl=$tmp
7484 done
7485 if test -f "$absdir/$objdir/$depdepl" ; then
7486 depdepl="$absdir/$objdir/$depdepl"
7487 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7488 if test -z "$darwin_install_name"; then
7489 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7491 compiler_flags+=" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7492 linker_flags+=" -dylib_file ${darwin_install_name}:${depdepl}"
7493 path=
7498 path="-L$absdir/$objdir"
7500 esac
7501 else
7502 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7503 test -z "$libdir" && \
7504 func_fatal_error "\`$deplib' is not a valid libtool archive"
7505 test "$absdir" != "$libdir" && \
7506 func_warning "\`$deplib' seems to be moved"
7508 path="-L$absdir"
7511 esac
7512 case " $deplibs " in
7513 *" $path "*) ;;
7514 *) deplibs="$path $deplibs" ;;
7515 esac
7516 done
7517 fi # link_all_deplibs != no
7518 fi # linkmode = lib
7519 done # for deplib in $libs
7520 if test "$pass" = link; then
7521 if test "$linkmode" = "prog"; then
7522 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7523 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7524 else
7525 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7528 dependency_libs="$newdependency_libs"
7529 if test "$pass" = dlpreopen; then
7530 # Link the dlpreopened libraries before other libraries
7531 for deplib in $save_deplibs; do
7532 deplibs="$deplib $deplibs"
7533 done
7535 if test "$pass" != dlopen; then
7536 if test "$pass" != conv; then
7537 # Make sure lib_search_path contains only unique directories.
7538 lib_search_path=
7539 for dir in $newlib_search_path; do
7540 case "$lib_search_path " in
7541 *" $dir "*) ;;
7542 *) lib_search_path+=" $dir" ;;
7543 esac
7544 done
7545 newlib_search_path=
7548 if test "$linkmode,$pass" != "prog,link"; then
7549 vars="deplibs"
7550 else
7551 vars="compile_deplibs finalize_deplibs"
7553 for var in $vars dependency_libs; do
7554 # Add libraries to $var in reverse order
7555 eval tmp_libs=\"\$$var\"
7556 new_libs=
7557 for deplib in $tmp_libs; do
7558 # FIXME: Pedantically, this is the right thing to do, so
7559 # that some nasty dependency loop isn't accidentally
7560 # broken:
7561 #new_libs="$deplib $new_libs"
7562 # Pragmatically, this seems to cause very few problems in
7563 # practice:
7564 case $deplib in
7565 -L*) new_libs="$deplib $new_libs" ;;
7566 -R*) ;;
7568 # And here is the reason: when a library appears more
7569 # than once as an explicit dependence of a library, or
7570 # is implicitly linked in more than once by the
7571 # compiler, it is considered special, and multiple
7572 # occurrences thereof are not removed. Compare this
7573 # with having the same library being listed as a
7574 # dependency of multiple other libraries: in this case,
7575 # we know (pedantically, we assume) the library does not
7576 # need to be listed more than once, so we keep only the
7577 # last copy. This is not always right, but it is rare
7578 # enough that we require users that really mean to play
7579 # such unportable linking tricks to link the library
7580 # using -Wl,-lname, so that libtool does not consider it
7581 # for duplicate removal.
7582 case " $specialdeplibs " in
7583 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7585 case " $new_libs " in
7586 *" $deplib "*) ;;
7587 *) new_libs="$deplib $new_libs" ;;
7588 esac
7590 esac
7592 esac
7593 done
7594 tmp_libs=
7595 for deplib in $new_libs; do
7596 case $deplib in
7597 -L*)
7598 case " $tmp_libs " in
7599 *" $deplib "*) ;;
7600 *) tmp_libs+=" $deplib" ;;
7601 esac
7603 *) tmp_libs+=" $deplib" ;;
7604 esac
7605 done
7606 eval $var=\"$tmp_libs\"
7607 done # for var
7609 # Last step: remove runtime libs from dependency_libs
7610 # (they stay in deplibs)
7611 tmp_libs=
7612 for i in $dependency_libs ; do
7613 case " $predeps $postdeps $compiler_lib_search_path " in
7614 *" $i "*)
7615 i=""
7617 esac
7618 if test -n "$i" ; then
7619 tmp_libs+=" $i"
7621 done
7622 dependency_libs=$tmp_libs
7623 done # for pass
7624 if test "$linkmode" = prog; then
7625 dlfiles="$newdlfiles"
7627 if test "$linkmode" = prog || test "$linkmode" = lib; then
7628 dlprefiles="$newdlprefiles"
7631 case $linkmode in
7632 oldlib)
7633 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7634 func_warning "\`-dlopen' is ignored for archives"
7637 case " $deplibs" in
7638 *\ -l* | *\ -L*)
7639 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7640 esac
7642 test -n "$rpath" && \
7643 func_warning "\`-rpath' is ignored for archives"
7645 test -n "$xrpath" && \
7646 func_warning "\`-R' is ignored for archives"
7648 test -n "$vinfo" && \
7649 func_warning "\`-version-info/-version-number' is ignored for archives"
7651 test -n "$release" && \
7652 func_warning "\`-release' is ignored for archives"
7654 test -n "$export_symbols$export_symbols_regex" && \
7655 func_warning "\`-export-symbols' is ignored for archives"
7657 # Now set the variables for building old libraries.
7658 build_libtool_libs=no
7659 oldlibs="$output"
7660 objs+="$old_deplibs"
7663 lib)
7664 # Make sure we only generate libraries of the form `libNAME.la'.
7665 case $outputname in
7666 lib*)
7667 func_stripname 'lib' '.la' "$outputname"
7668 name=$func_stripname_result
7669 eval shared_ext=\"$shrext_cmds\"
7670 eval libname=\"$libname_spec\"
7673 test "$module" = no && \
7674 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7676 if test "$need_lib_prefix" != no; then
7677 # Add the "lib" prefix for modules if required
7678 func_stripname '' '.la' "$outputname"
7679 name=$func_stripname_result
7680 eval shared_ext=\"$shrext_cmds\"
7681 eval libname=\"$libname_spec\"
7682 else
7683 func_stripname '' '.la' "$outputname"
7684 libname=$func_stripname_result
7687 esac
7689 if test -n "$objs"; then
7690 if test "$deplibs_check_method" != pass_all; then
7691 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7692 else
7693 echo
7694 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7695 $ECHO "*** objects $objs is not portable!"
7696 libobjs+=" $objs"
7700 test "$dlself" != no && \
7701 func_warning "\`-dlopen self' is ignored for libtool libraries"
7703 set dummy $rpath
7704 shift
7705 test "$#" -gt 1 && \
7706 func_warning "ignoring multiple \`-rpath's for a libtool library"
7708 install_libdir="$1"
7710 oldlibs=
7711 if test -z "$rpath"; then
7712 if test "$build_libtool_libs" = yes; then
7713 # Building a libtool convenience library.
7714 # Some compilers have problems with a `.al' extension so
7715 # convenience libraries should have the same extension an
7716 # archive normally would.
7717 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7718 build_libtool_libs=convenience
7719 build_old_libs=yes
7722 test -n "$vinfo" && \
7723 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7725 test -n "$release" && \
7726 func_warning "\`-release' is ignored for convenience libraries"
7727 else
7729 # Parse the version information argument.
7730 save_ifs="$IFS"; IFS=':'
7731 set dummy $vinfo 0 0 0
7732 shift
7733 IFS="$save_ifs"
7735 test -n "$7" && \
7736 func_fatal_help "too many parameters to \`-version-info'"
7738 # convert absolute version numbers to libtool ages
7739 # this retains compatibility with .la files and attempts
7740 # to make the code below a bit more comprehensible
7742 case $vinfo_number in
7743 yes)
7744 number_major="$1"
7745 number_minor="$2"
7746 number_revision="$3"
7748 # There are really only two kinds -- those that
7749 # use the current revision as the major version
7750 # and those that subtract age and use age as
7751 # a minor version. But, then there is irix
7752 # which has an extra 1 added just for fun
7754 case $version_type in
7755 # correct linux to gnu/linux during the next big refactor
7756 darwin|linux|osf|windows|none)
7757 func_arith $number_major + $number_minor
7758 current=$func_arith_result
7759 age="$number_minor"
7760 revision="$number_revision"
7762 freebsd-aout|freebsd-elf|qnx|sunos)
7763 current="$number_major"
7764 revision="$number_minor"
7765 age="0"
7767 irix|nonstopux)
7768 func_arith $number_major + $number_minor
7769 current=$func_arith_result
7770 age="$number_minor"
7771 revision="$number_minor"
7772 lt_irix_increment=no
7774 esac
7777 current="$1"
7778 revision="$2"
7779 age="$3"
7781 esac
7783 # Check that each of the things are valid numbers.
7784 case $current in
7785 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]) ;;
7787 func_error "CURRENT \`$current' must be a nonnegative integer"
7788 func_fatal_error "\`$vinfo' is not valid version information"
7790 esac
7792 case $revision in
7793 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]) ;;
7795 func_error "REVISION \`$revision' must be a nonnegative integer"
7796 func_fatal_error "\`$vinfo' is not valid version information"
7798 esac
7800 case $age in
7801 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]) ;;
7803 func_error "AGE \`$age' must be a nonnegative integer"
7804 func_fatal_error "\`$vinfo' is not valid version information"
7806 esac
7808 if test "$age" -gt "$current"; then
7809 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7810 func_fatal_error "\`$vinfo' is not valid version information"
7813 # Calculate the version variables.
7814 major=
7815 versuffix=
7816 verstring=
7817 case $version_type in
7818 none) ;;
7820 darwin)
7821 # Like Linux, but with the current version available in
7822 # verstring for coding it into the library header
7823 func_arith $current - $age
7824 major=.$func_arith_result
7825 versuffix="$major.$age.$revision"
7826 # Darwin ld doesn't like 0 for these options...
7827 func_arith $current + 1
7828 minor_current=$func_arith_result
7829 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7830 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7833 freebsd-aout)
7834 major=".$current"
7835 versuffix=".$current.$revision";
7838 freebsd-elf)
7839 major=".$current"
7840 versuffix=".$current"
7843 irix | nonstopux)
7844 if test "X$lt_irix_increment" = "Xno"; then
7845 func_arith $current - $age
7846 else
7847 func_arith $current - $age + 1
7849 major=$func_arith_result
7851 case $version_type in
7852 nonstopux) verstring_prefix=nonstopux ;;
7853 *) verstring_prefix=sgi ;;
7854 esac
7855 verstring="$verstring_prefix$major.$revision"
7857 # Add in all the interfaces that we are compatible with.
7858 loop=$revision
7859 while test "$loop" -ne 0; do
7860 func_arith $revision - $loop
7861 iface=$func_arith_result
7862 func_arith $loop - 1
7863 loop=$func_arith_result
7864 verstring="$verstring_prefix$major.$iface:$verstring"
7865 done
7867 # Before this point, $major must not contain `.'.
7868 major=.$major
7869 versuffix="$major.$revision"
7872 linux) # correct to gnu/linux during the next big refactor
7873 func_arith $current - $age
7874 major=.$func_arith_result
7875 versuffix="$major.$age.$revision"
7878 osf)
7879 func_arith $current - $age
7880 major=.$func_arith_result
7881 versuffix=".$current.$age.$revision"
7882 verstring="$current.$age.$revision"
7884 # Add in all the interfaces that we are compatible with.
7885 loop=$age
7886 while test "$loop" -ne 0; do
7887 func_arith $current - $loop
7888 iface=$func_arith_result
7889 func_arith $loop - 1
7890 loop=$func_arith_result
7891 verstring="$verstring:${iface}.0"
7892 done
7894 # Make executables depend on our current version.
7895 verstring+=":${current}.0"
7898 qnx)
7899 major=".$current"
7900 versuffix=".$current"
7903 sunos)
7904 major=".$current"
7905 versuffix=".$current.$revision"
7908 windows)
7909 # Use '-' rather than '.', since we only want one
7910 # extension on DOS 8.3 filesystems.
7911 func_arith $current - $age
7912 major=$func_arith_result
7913 versuffix="-$major"
7917 func_fatal_configuration "unknown library version type \`$version_type'"
7919 esac
7921 # Clear the version info if we defaulted, and they specified a release.
7922 if test -z "$vinfo" && test -n "$release"; then
7923 major=
7924 case $version_type in
7925 darwin)
7926 # we can't check for "0.0" in archive_cmds due to quoting
7927 # problems, so we reset it completely
7928 verstring=
7931 verstring="0.0"
7933 esac
7934 if test "$need_version" = no; then
7935 versuffix=
7936 else
7937 versuffix=".0.0"
7941 # Remove version info from name if versioning should be avoided
7942 if test "$avoid_version" = yes && test "$need_version" = no; then
7943 major=
7944 versuffix=
7945 verstring=""
7948 # Check to see if the archive will have undefined symbols.
7949 if test "$allow_undefined" = yes; then
7950 if test "$allow_undefined_flag" = unsupported; then
7951 func_warning "undefined symbols not allowed in $host shared libraries"
7952 build_libtool_libs=no
7953 build_old_libs=yes
7955 else
7956 # Don't allow undefined symbols.
7957 allow_undefined_flag="$no_undefined_flag"
7962 func_generate_dlsyms "$libname" "$libname" "yes"
7963 libobjs+=" $symfileobj"
7964 test "X$libobjs" = "X " && libobjs=
7966 if test "$opt_mode" != relink; then
7967 # Remove our outputs, but don't remove object files since they
7968 # may have been created when compiling PIC objects.
7969 removelist=
7970 tempremovelist=`$ECHO "$output_objdir/*"`
7971 for p in $tempremovelist; do
7972 case $p in
7973 *.$objext | *.gcno)
7975 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7976 if test "X$precious_files_regex" != "X"; then
7977 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7978 then
7979 continue
7982 removelist+=" $p"
7984 *) ;;
7985 esac
7986 done
7987 test -n "$removelist" && \
7988 func_show_eval "${RM}r \$removelist"
7991 # Now set the variables for building old libraries.
7992 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7993 oldlibs+=" $output_objdir/$libname.$libext"
7995 # Transform .lo files to .o files.
7996 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7999 # Eliminate all temporary directories.
8000 #for path in $notinst_path; do
8001 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
8002 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
8003 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
8004 #done
8006 if test -n "$xrpath"; then
8007 # If the user specified any rpath flags, then add them.
8008 temp_xrpath=
8009 for libdir in $xrpath; do
8010 func_replace_sysroot "$libdir"
8011 temp_xrpath+=" -R$func_replace_sysroot_result"
8012 case "$finalize_rpath " in
8013 *" $libdir "*) ;;
8014 *) finalize_rpath+=" $libdir" ;;
8015 esac
8016 done
8017 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
8018 dependency_libs="$temp_xrpath $dependency_libs"
8022 # Make sure dlfiles contains only unique files that won't be dlpreopened
8023 old_dlfiles="$dlfiles"
8024 dlfiles=
8025 for lib in $old_dlfiles; do
8026 case " $dlprefiles $dlfiles " in
8027 *" $lib "*) ;;
8028 *) dlfiles+=" $lib" ;;
8029 esac
8030 done
8032 # Make sure dlprefiles contains only unique files
8033 old_dlprefiles="$dlprefiles"
8034 dlprefiles=
8035 for lib in $old_dlprefiles; do
8036 case "$dlprefiles " in
8037 *" $lib "*) ;;
8038 *) dlprefiles+=" $lib" ;;
8039 esac
8040 done
8042 if test "$build_libtool_libs" = yes; then
8043 if test -n "$rpath"; then
8044 case $host in
8045 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
8046 # these systems don't actually have a c library (as such)!
8048 *-*-rhapsody* | *-*-darwin1.[012])
8049 # Rhapsody C library is in the System framework
8050 deplibs+=" System.ltframework"
8052 *-*-netbsd*)
8053 # Don't link with libc until the a.out ld.so is fixed.
8055 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
8056 # Do not include libc due to us having libc/libc_r.
8058 *-*-sco3.2v5* | *-*-sco5v6*)
8059 # Causes problems with __ctype
8061 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
8062 # Compiler inserts libc in the correct place for threads to work
8065 # Add libc to deplibs on all other systems if necessary.
8066 if test "$build_libtool_need_lc" = "yes"; then
8067 deplibs+=" -lc"
8070 esac
8073 # Transform deplibs into only deplibs that can be linked in shared.
8074 name_save=$name
8075 libname_save=$libname
8076 release_save=$release
8077 versuffix_save=$versuffix
8078 major_save=$major
8079 # I'm not sure if I'm treating the release correctly. I think
8080 # release should show up in the -l (ie -lgmp5) so we don't want to
8081 # add it in twice. Is that correct?
8082 release=""
8083 versuffix=""
8084 major=""
8085 newdeplibs=
8086 droppeddeps=no
8087 case $deplibs_check_method in
8088 pass_all)
8089 # Don't check for shared/static. Everything works.
8090 # This might be a little naive. We might want to check
8091 # whether the library exists or not. But this is on
8092 # osf3 & osf4 and I'm not really sure... Just
8093 # implementing what was already the behavior.
8094 newdeplibs=$deplibs
8096 test_compile)
8097 # This code stresses the "libraries are programs" paradigm to its
8098 # limits. Maybe even breaks it. We compile a program, linking it
8099 # against the deplibs as a proxy for the library. Then we can check
8100 # whether they linked in statically or dynamically with ldd.
8101 $opt_dry_run || $RM conftest.c
8102 cat > conftest.c <<EOF
8103 int main() { return 0; }
8105 $opt_dry_run || $RM conftest
8106 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
8107 ldd_output=`ldd conftest`
8108 for i in $deplibs; do
8109 case $i in
8110 -l*)
8111 func_stripname -l '' "$i"
8112 name=$func_stripname_result
8113 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8114 case " $predeps $postdeps " in
8115 *" $i "*)
8116 newdeplibs+=" $i"
8117 i=""
8119 esac
8121 if test -n "$i" ; then
8122 libname=`eval "\\$ECHO \"$libname_spec\""`
8123 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8124 set dummy $deplib_matches; shift
8125 deplib_match=$1
8126 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
8127 newdeplibs+=" $i"
8128 else
8129 droppeddeps=yes
8130 echo
8131 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8132 echo "*** I have the capability to make that library automatically link in when"
8133 echo "*** you link to this library. But I can only do this if you have a"
8134 echo "*** shared version of the library, which I believe you do not have"
8135 echo "*** because a test_compile did reveal that the linker did not use it for"
8136 echo "*** its dynamic dependency list that programs get resolved with at runtime."
8141 newdeplibs+=" $i"
8143 esac
8144 done
8145 else
8146 # Error occurred in the first compile. Let's try to salvage
8147 # the situation: Compile a separate program for each library.
8148 for i in $deplibs; do
8149 case $i in
8150 -l*)
8151 func_stripname -l '' "$i"
8152 name=$func_stripname_result
8153 $opt_dry_run || $RM conftest
8154 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
8155 ldd_output=`ldd conftest`
8156 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8157 case " $predeps $postdeps " in
8158 *" $i "*)
8159 newdeplibs+=" $i"
8160 i=""
8162 esac
8164 if test -n "$i" ; then
8165 libname=`eval "\\$ECHO \"$libname_spec\""`
8166 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8167 set dummy $deplib_matches; shift
8168 deplib_match=$1
8169 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
8170 newdeplibs+=" $i"
8171 else
8172 droppeddeps=yes
8173 echo
8174 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8175 echo "*** I have the capability to make that library automatically link in when"
8176 echo "*** you link to this library. But I can only do this if you have a"
8177 echo "*** shared version of the library, which you do not appear to have"
8178 echo "*** because a test_compile did reveal that the linker did not use this one"
8179 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
8182 else
8183 droppeddeps=yes
8184 echo
8185 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
8186 echo "*** make it link in! You will probably need to install it or some"
8187 echo "*** library that it depends on before this library will be fully"
8188 echo "*** functional. Installing it before continuing would be even better."
8192 newdeplibs+=" $i"
8194 esac
8195 done
8198 file_magic*)
8199 set dummy $deplibs_check_method; shift
8200 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8201 for a_deplib in $deplibs; do
8202 case $a_deplib in
8203 -l*)
8204 func_stripname -l '' "$a_deplib"
8205 name=$func_stripname_result
8206 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8207 case " $predeps $postdeps " in
8208 *" $a_deplib "*)
8209 newdeplibs+=" $a_deplib"
8210 a_deplib=""
8212 esac
8214 if test -n "$a_deplib" ; then
8215 libname=`eval "\\$ECHO \"$libname_spec\""`
8216 if test -n "$file_magic_glob"; then
8217 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
8218 else
8219 libnameglob=$libname
8221 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
8222 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8223 if test "$want_nocaseglob" = yes; then
8224 shopt -s nocaseglob
8225 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8226 $nocaseglob
8227 else
8228 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8230 for potent_lib in $potential_libs; do
8231 # Follow soft links.
8232 if ls -lLd "$potent_lib" 2>/dev/null |
8233 $GREP " -> " >/dev/null; then
8234 continue
8236 # The statement above tries to avoid entering an
8237 # endless loop below, in case of cyclic links.
8238 # We might still enter an endless loop, since a link
8239 # loop can be closed while we follow links,
8240 # but so what?
8241 potlib="$potent_lib"
8242 while test -h "$potlib" 2>/dev/null; do
8243 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
8244 case $potliblink in
8245 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
8246 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
8247 esac
8248 done
8249 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
8250 $SED -e 10q |
8251 $EGREP "$file_magic_regex" > /dev/null; then
8252 newdeplibs+=" $a_deplib"
8253 a_deplib=""
8254 break 2
8256 done
8257 done
8259 if test -n "$a_deplib" ; then
8260 droppeddeps=yes
8261 echo
8262 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8263 echo "*** I have the capability to make that library automatically link in when"
8264 echo "*** you link to this library. But I can only do this if you have a"
8265 echo "*** shared version of the library, which you do not appear to have"
8266 echo "*** because I did check the linker path looking for a file starting"
8267 if test -z "$potlib" ; then
8268 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
8269 else
8270 $ECHO "*** with $libname and none of the candidates passed a file format test"
8271 $ECHO "*** using a file magic. Last file checked: $potlib"
8276 # Add a -L argument.
8277 newdeplibs+=" $a_deplib"
8279 esac
8280 done # Gone through all deplibs.
8282 match_pattern*)
8283 set dummy $deplibs_check_method; shift
8284 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8285 for a_deplib in $deplibs; do
8286 case $a_deplib in
8287 -l*)
8288 func_stripname -l '' "$a_deplib"
8289 name=$func_stripname_result
8290 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8291 case " $predeps $postdeps " in
8292 *" $a_deplib "*)
8293 newdeplibs+=" $a_deplib"
8294 a_deplib=""
8296 esac
8298 if test -n "$a_deplib" ; then
8299 libname=`eval "\\$ECHO \"$libname_spec\""`
8300 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8301 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
8302 for potent_lib in $potential_libs; do
8303 potlib="$potent_lib" # see symlink-check above in file_magic test
8304 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
8305 $EGREP "$match_pattern_regex" > /dev/null; then
8306 newdeplibs+=" $a_deplib"
8307 a_deplib=""
8308 break 2
8310 done
8311 done
8313 if test -n "$a_deplib" ; then
8314 droppeddeps=yes
8315 echo
8316 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8317 echo "*** I have the capability to make that library automatically link in when"
8318 echo "*** you link to this library. But I can only do this if you have a"
8319 echo "*** shared version of the library, which you do not appear to have"
8320 echo "*** because I did check the linker path looking for a file starting"
8321 if test -z "$potlib" ; then
8322 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
8323 else
8324 $ECHO "*** with $libname and none of the candidates passed a file format test"
8325 $ECHO "*** using a regex pattern. Last file checked: $potlib"
8330 # Add a -L argument.
8331 newdeplibs+=" $a_deplib"
8333 esac
8334 done # Gone through all deplibs.
8336 none | unknown | *)
8337 newdeplibs=""
8338 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
8339 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8340 for i in $predeps $postdeps ; do
8341 # can't use Xsed below, because $i might contain '/'
8342 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
8343 done
8345 case $tmp_deplibs in
8346 *[!\ \ ]*)
8347 echo
8348 if test "X$deplibs_check_method" = "Xnone"; then
8349 echo "*** Warning: inter-library dependencies are not supported in this platform."
8350 else
8351 echo "*** Warning: inter-library dependencies are not known to be supported."
8353 echo "*** All declared inter-library dependencies are being dropped."
8354 droppeddeps=yes
8356 esac
8358 esac
8359 versuffix=$versuffix_save
8360 major=$major_save
8361 release=$release_save
8362 libname=$libname_save
8363 name=$name_save
8365 case $host in
8366 *-*-rhapsody* | *-*-darwin1.[012])
8367 # On Rhapsody replace the C library with the System framework
8368 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
8370 esac
8372 if test "$droppeddeps" = yes; then
8373 if test "$module" = yes; then
8374 echo
8375 echo "*** Warning: libtool could not satisfy all declared inter-library"
8376 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
8377 echo "*** a static module, that should work as long as the dlopening"
8378 echo "*** application is linked with the -dlopen flag."
8379 if test -z "$global_symbol_pipe"; then
8380 echo
8381 echo "*** However, this would only work if libtool was able to extract symbol"
8382 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
8383 echo "*** not find such a program. So, this module is probably useless."
8384 echo "*** \`nm' from GNU binutils and a full rebuild may help."
8386 if test "$build_old_libs" = no; then
8387 oldlibs="$output_objdir/$libname.$libext"
8388 build_libtool_libs=module
8389 build_old_libs=yes
8390 else
8391 build_libtool_libs=no
8393 else
8394 echo "*** The inter-library dependencies that have been dropped here will be"
8395 echo "*** automatically added whenever a program is linked with this library"
8396 echo "*** or is declared to -dlopen it."
8398 if test "$allow_undefined" = no; then
8399 echo
8400 echo "*** Since this library must not contain undefined symbols,"
8401 echo "*** because either the platform does not support them or"
8402 echo "*** it was explicitly requested with -no-undefined,"
8403 echo "*** libtool will only create a static version of it."
8404 if test "$build_old_libs" = no; then
8405 oldlibs="$output_objdir/$libname.$libext"
8406 build_libtool_libs=module
8407 build_old_libs=yes
8408 else
8409 build_libtool_libs=no
8414 # Done checking deplibs!
8415 deplibs=$newdeplibs
8417 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8418 case $host in
8419 *-*-darwin*)
8420 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8421 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8422 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8424 esac
8426 # move library search paths that coincide with paths to not yet
8427 # installed libraries to the beginning of the library search list
8428 new_libs=
8429 for path in $notinst_path; do
8430 case " $new_libs " in
8431 *" -L$path/$objdir "*) ;;
8433 case " $deplibs " in
8434 *" -L$path/$objdir "*)
8435 new_libs+=" -L$path/$objdir" ;;
8436 esac
8438 esac
8439 done
8440 for deplib in $deplibs; do
8441 case $deplib in
8442 -L*)
8443 case " $new_libs " in
8444 *" $deplib "*) ;;
8445 *) new_libs+=" $deplib" ;;
8446 esac
8448 *) new_libs+=" $deplib" ;;
8449 esac
8450 done
8451 deplibs="$new_libs"
8453 # All the library-specific variables (install_libdir is set above).
8454 library_names=
8455 old_library=
8456 dlname=
8458 # Test again, we may have decided not to build it any more
8459 if test "$build_libtool_libs" = yes; then
8460 # Remove ${wl} instances when linking with ld.
8461 # FIXME: should test the right _cmds variable.
8462 case $archive_cmds in
8463 *\$LD\ *) wl= ;;
8464 esac
8465 if test "$hardcode_into_libs" = yes; then
8466 # Hardcode the library paths
8467 hardcode_libdirs=
8468 dep_rpath=
8469 rpath="$finalize_rpath"
8470 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8471 for libdir in $rpath; do
8472 if test -n "$hardcode_libdir_flag_spec"; then
8473 if test -n "$hardcode_libdir_separator"; then
8474 func_replace_sysroot "$libdir"
8475 libdir=$func_replace_sysroot_result
8476 if test -z "$hardcode_libdirs"; then
8477 hardcode_libdirs="$libdir"
8478 else
8479 # Just accumulate the unique libdirs.
8480 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8481 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8484 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
8486 esac
8488 else
8489 eval flag=\"$hardcode_libdir_flag_spec\"
8490 dep_rpath+=" $flag"
8492 elif test -n "$runpath_var"; then
8493 case "$perm_rpath " in
8494 *" $libdir "*) ;;
8495 *) perm_rpath+=" $libdir" ;;
8496 esac
8498 done
8499 # Substitute the hardcoded libdirs into the rpath.
8500 if test -n "$hardcode_libdir_separator" &&
8501 test -n "$hardcode_libdirs"; then
8502 libdir="$hardcode_libdirs"
8503 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
8505 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8506 # We should set the runpath_var.
8507 rpath=
8508 for dir in $perm_rpath; do
8509 rpath+="$dir:"
8510 done
8511 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8513 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8516 shlibpath="$finalize_shlibpath"
8517 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8518 if test -n "$shlibpath"; then
8519 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8522 # Get the real and link names of the library.
8523 eval shared_ext=\"$shrext_cmds\"
8524 eval library_names=\"$library_names_spec\"
8525 set dummy $library_names
8526 shift
8527 realname="$1"
8528 shift
8530 if test -n "$soname_spec"; then
8531 eval soname=\"$soname_spec\"
8532 else
8533 soname="$realname"
8535 if test -z "$dlname"; then
8536 dlname=$soname
8539 lib="$output_objdir/$realname"
8540 linknames=
8541 for link
8543 linknames+=" $link"
8544 done
8546 # Use standard objects if they are pic
8547 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8548 test "X$libobjs" = "X " && libobjs=
8550 delfiles=
8551 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8552 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8553 export_symbols="$output_objdir/$libname.uexp"
8554 delfiles+=" $export_symbols"
8557 orig_export_symbols=
8558 case $host_os in
8559 cygwin* | mingw* | cegcc*)
8560 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8561 # exporting using user supplied symfile
8562 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8563 # and it's NOT already a .def file. Must figure out
8564 # which of the given symbols are data symbols and tag
8565 # them as such. So, trigger use of export_symbols_cmds.
8566 # export_symbols gets reassigned inside the "prepare
8567 # the list of exported symbols" if statement, so the
8568 # include_expsyms logic still works.
8569 orig_export_symbols="$export_symbols"
8570 export_symbols=
8571 always_export_symbols=yes
8575 esac
8577 # Prepare the list of exported symbols
8578 if test -z "$export_symbols"; then
8579 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8580 func_verbose "generating symbol list for \`$libname.la'"
8581 export_symbols="$output_objdir/$libname.exp"
8582 $opt_dry_run || $RM $export_symbols
8583 cmds=$export_symbols_cmds
8584 save_ifs="$IFS"; IFS='~'
8585 for cmd1 in $cmds; do
8586 IFS="$save_ifs"
8587 # Take the normal branch if the nm_file_list_spec branch
8588 # doesn't work or if tool conversion is not needed.
8589 case $nm_file_list_spec~$to_tool_file_cmd in
8590 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8591 try_normal_branch=yes
8592 eval cmd=\"$cmd1\"
8593 func_len " $cmd"
8594 len=$func_len_result
8597 try_normal_branch=no
8599 esac
8600 if test "$try_normal_branch" = yes \
8601 && { test "$len" -lt "$max_cmd_len" \
8602 || test "$max_cmd_len" -le -1; }
8603 then
8604 func_show_eval "$cmd" 'exit $?'
8605 skipped_export=false
8606 elif test -n "$nm_file_list_spec"; then
8607 func_basename "$output"
8608 output_la=$func_basename_result
8609 save_libobjs=$libobjs
8610 save_output=$output
8611 output=${output_objdir}/${output_la}.nm
8612 func_to_tool_file "$output"
8613 libobjs=$nm_file_list_spec$func_to_tool_file_result
8614 delfiles+=" $output"
8615 func_verbose "creating $NM input file list: $output"
8616 for obj in $save_libobjs; do
8617 func_to_tool_file "$obj"
8618 $ECHO "$func_to_tool_file_result"
8619 done > "$output"
8620 eval cmd=\"$cmd1\"
8621 func_show_eval "$cmd" 'exit $?'
8622 output=$save_output
8623 libobjs=$save_libobjs
8624 skipped_export=false
8625 else
8626 # The command line is too long to execute in one step.
8627 func_verbose "using reloadable object file for export list..."
8628 skipped_export=:
8629 # Break out early, otherwise skipped_export may be
8630 # set to false by a later but shorter cmd.
8631 break
8633 done
8634 IFS="$save_ifs"
8635 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8636 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8637 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8642 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8643 tmp_export_symbols="$export_symbols"
8644 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8645 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8648 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8649 # The given exports_symbols file has to be filtered, so filter it.
8650 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8651 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8652 # 's' commands which not all seds can handle. GNU sed should be fine
8653 # though. Also, the filter scales superlinearly with the number of
8654 # global variables. join(1) would be nice here, but unfortunately
8655 # isn't a blessed tool.
8656 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8657 delfiles+=" $export_symbols $output_objdir/$libname.filter"
8658 export_symbols=$output_objdir/$libname.def
8659 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8662 tmp_deplibs=
8663 for test_deplib in $deplibs; do
8664 case " $convenience " in
8665 *" $test_deplib "*) ;;
8667 tmp_deplibs+=" $test_deplib"
8669 esac
8670 done
8671 deplibs="$tmp_deplibs"
8673 if test -n "$convenience"; then
8674 if test -n "$whole_archive_flag_spec" &&
8675 test "$compiler_needs_object" = yes &&
8676 test -z "$libobjs"; then
8677 # extract the archives, so we have objects to list.
8678 # TODO: could optimize this to just extract one archive.
8679 whole_archive_flag_spec=
8681 if test -n "$whole_archive_flag_spec"; then
8682 save_libobjs=$libobjs
8683 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8684 test "X$libobjs" = "X " && libobjs=
8685 else
8686 gentop="$output_objdir/${outputname}x"
8687 generated+=" $gentop"
8689 func_extract_archives $gentop $convenience
8690 libobjs+=" $func_extract_archives_result"
8691 test "X$libobjs" = "X " && libobjs=
8695 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8696 eval flag=\"$thread_safe_flag_spec\"
8697 linker_flags+=" $flag"
8700 # Make a backup of the uninstalled library when relinking
8701 if test "$opt_mode" = relink; then
8702 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8705 # Do each of the archive commands.
8706 if test "$module" = yes && test -n "$module_cmds" ; then
8707 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8708 eval test_cmds=\"$module_expsym_cmds\"
8709 cmds=$module_expsym_cmds
8710 else
8711 eval test_cmds=\"$module_cmds\"
8712 cmds=$module_cmds
8714 else
8715 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8716 eval test_cmds=\"$archive_expsym_cmds\"
8717 cmds=$archive_expsym_cmds
8718 else
8719 eval test_cmds=\"$archive_cmds\"
8720 cmds=$archive_cmds
8724 if test "X$skipped_export" != "X:" &&
8725 func_len " $test_cmds" &&
8726 len=$func_len_result &&
8727 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8729 else
8730 # The command line is too long to link in one step, link piecewise
8731 # or, if using GNU ld and skipped_export is not :, use a linker
8732 # script.
8734 # Save the value of $output and $libobjs because we want to
8735 # use them later. If we have whole_archive_flag_spec, we
8736 # want to use save_libobjs as it was before
8737 # whole_archive_flag_spec was expanded, because we can't
8738 # assume the linker understands whole_archive_flag_spec.
8739 # This may have to be revisited, in case too many
8740 # convenience libraries get linked in and end up exceeding
8741 # the spec.
8742 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8743 save_libobjs=$libobjs
8745 save_output=$output
8746 func_basename "$output"
8747 output_la=$func_basename_result
8749 # Clear the reloadable object creation command queue and
8750 # initialize k to one.
8751 test_cmds=
8752 concat_cmds=
8753 objlist=
8754 last_robj=
8757 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8758 output=${output_objdir}/${output_la}.lnkscript
8759 func_verbose "creating GNU ld script: $output"
8760 echo 'INPUT (' > $output
8761 for obj in $save_libobjs
8763 func_to_tool_file "$obj"
8764 $ECHO "$func_to_tool_file_result" >> $output
8765 done
8766 echo ')' >> $output
8767 delfiles+=" $output"
8768 func_to_tool_file "$output"
8769 output=$func_to_tool_file_result
8770 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8771 output=${output_objdir}/${output_la}.lnk
8772 func_verbose "creating linker input file list: $output"
8773 : > $output
8774 set x $save_libobjs
8775 shift
8776 firstobj=
8777 if test "$compiler_needs_object" = yes; then
8778 firstobj="$1 "
8779 shift
8781 for obj
8783 func_to_tool_file "$obj"
8784 $ECHO "$func_to_tool_file_result" >> $output
8785 done
8786 delfiles+=" $output"
8787 func_to_tool_file "$output"
8788 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8789 else
8790 if test -n "$save_libobjs"; then
8791 func_verbose "creating reloadable object files..."
8792 output=$output_objdir/$output_la-${k}.$objext
8793 eval test_cmds=\"$reload_cmds\"
8794 func_len " $test_cmds"
8795 len0=$func_len_result
8796 len=$len0
8798 # Loop over the list of objects to be linked.
8799 for obj in $save_libobjs
8801 func_len " $obj"
8802 func_arith $len + $func_len_result
8803 len=$func_arith_result
8804 if test "X$objlist" = X ||
8805 test "$len" -lt "$max_cmd_len"; then
8806 objlist+=" $obj"
8807 else
8808 # The command $test_cmds is almost too long, add a
8809 # command to the queue.
8810 if test "$k" -eq 1 ; then
8811 # The first file doesn't have a previous command to add.
8812 reload_objs=$objlist
8813 eval concat_cmds=\"$reload_cmds\"
8814 else
8815 # All subsequent reloadable object files will link in
8816 # the last one created.
8817 reload_objs="$objlist $last_robj"
8818 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8820 last_robj=$output_objdir/$output_la-${k}.$objext
8821 func_arith $k + 1
8822 k=$func_arith_result
8823 output=$output_objdir/$output_la-${k}.$objext
8824 objlist=" $obj"
8825 func_len " $last_robj"
8826 func_arith $len0 + $func_len_result
8827 len=$func_arith_result
8829 done
8830 # Handle the remaining objects by creating one last
8831 # reloadable object file. All subsequent reloadable object
8832 # files will link in the last one created.
8833 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8834 reload_objs="$objlist $last_robj"
8835 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8836 if test -n "$last_robj"; then
8837 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8839 delfiles+=" $output"
8841 else
8842 output=
8845 if ${skipped_export-false}; then
8846 func_verbose "generating symbol list for \`$libname.la'"
8847 export_symbols="$output_objdir/$libname.exp"
8848 $opt_dry_run || $RM $export_symbols
8849 libobjs=$output
8850 # Append the command to create the export file.
8851 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8852 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8853 if test -n "$last_robj"; then
8854 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8858 test -n "$save_libobjs" &&
8859 func_verbose "creating a temporary reloadable object file: $output"
8861 # Loop through the commands generated above and execute them.
8862 save_ifs="$IFS"; IFS='~'
8863 for cmd in $concat_cmds; do
8864 IFS="$save_ifs"
8865 $opt_silent || {
8866 func_quote_for_expand "$cmd"
8867 eval "func_echo $func_quote_for_expand_result"
8869 $opt_dry_run || eval "$cmd" || {
8870 lt_exit=$?
8872 # Restore the uninstalled library and exit
8873 if test "$opt_mode" = relink; then
8874 ( cd "$output_objdir" && \
8875 $RM "${realname}T" && \
8876 $MV "${realname}U" "$realname" )
8879 exit $lt_exit
8881 done
8882 IFS="$save_ifs"
8884 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8885 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8886 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8890 if ${skipped_export-false}; then
8891 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8892 tmp_export_symbols="$export_symbols"
8893 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8894 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8897 if test -n "$orig_export_symbols"; then
8898 # The given exports_symbols file has to be filtered, so filter it.
8899 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8900 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8901 # 's' commands which not all seds can handle. GNU sed should be fine
8902 # though. Also, the filter scales superlinearly with the number of
8903 # global variables. join(1) would be nice here, but unfortunately
8904 # isn't a blessed tool.
8905 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8906 delfiles+=" $export_symbols $output_objdir/$libname.filter"
8907 export_symbols=$output_objdir/$libname.def
8908 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8912 libobjs=$output
8913 # Restore the value of output.
8914 output=$save_output
8916 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8917 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8918 test "X$libobjs" = "X " && libobjs=
8920 # Expand the library linking commands again to reset the
8921 # value of $libobjs for piecewise linking.
8923 # Do each of the archive commands.
8924 if test "$module" = yes && test -n "$module_cmds" ; then
8925 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8926 cmds=$module_expsym_cmds
8927 else
8928 cmds=$module_cmds
8930 else
8931 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8932 cmds=$archive_expsym_cmds
8933 else
8934 cmds=$archive_cmds
8939 if test -n "$delfiles"; then
8940 # Append the command to remove temporary files to $cmds.
8941 eval cmds=\"\$cmds~\$RM $delfiles\"
8944 # Add any objects from preloaded convenience libraries
8945 if test -n "$dlprefiles"; then
8946 gentop="$output_objdir/${outputname}x"
8947 generated+=" $gentop"
8949 func_extract_archives $gentop $dlprefiles
8950 libobjs+=" $func_extract_archives_result"
8951 test "X$libobjs" = "X " && libobjs=
8954 save_ifs="$IFS"; IFS='~'
8955 for cmd in $cmds; do
8956 IFS="$save_ifs"
8957 eval cmd=\"$cmd\"
8958 $opt_silent || {
8959 func_quote_for_expand "$cmd"
8960 eval "func_echo $func_quote_for_expand_result"
8962 $opt_dry_run || eval "$cmd" || {
8963 lt_exit=$?
8965 # Restore the uninstalled library and exit
8966 if test "$opt_mode" = relink; then
8967 ( cd "$output_objdir" && \
8968 $RM "${realname}T" && \
8969 $MV "${realname}U" "$realname" )
8972 exit $lt_exit
8974 done
8975 IFS="$save_ifs"
8977 # Restore the uninstalled library and exit
8978 if test "$opt_mode" = relink; then
8979 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8981 if test -n "$convenience"; then
8982 if test -z "$whole_archive_flag_spec"; then
8983 func_show_eval '${RM}r "$gentop"'
8987 exit $EXIT_SUCCESS
8990 # Create links to the real library.
8991 for linkname in $linknames; do
8992 if test "$realname" != "$linkname"; then
8993 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8995 done
8997 # If -module or -export-dynamic was specified, set the dlname.
8998 if test "$module" = yes || test "$export_dynamic" = yes; then
8999 # On all known operating systems, these are identical.
9000 dlname="$soname"
9005 obj)
9006 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
9007 func_warning "\`-dlopen' is ignored for objects"
9010 case " $deplibs" in
9011 *\ -l* | *\ -L*)
9012 func_warning "\`-l' and \`-L' are ignored for objects" ;;
9013 esac
9015 test -n "$rpath" && \
9016 func_warning "\`-rpath' is ignored for objects"
9018 test -n "$xrpath" && \
9019 func_warning "\`-R' is ignored for objects"
9021 test -n "$vinfo" && \
9022 func_warning "\`-version-info' is ignored for objects"
9024 test -n "$release" && \
9025 func_warning "\`-release' is ignored for objects"
9027 case $output in
9028 *.lo)
9029 test -n "$objs$old_deplibs" && \
9030 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
9032 libobj=$output
9033 func_lo2o "$libobj"
9034 obj=$func_lo2o_result
9037 libobj=
9038 obj="$output"
9040 esac
9042 # Delete the old objects.
9043 $opt_dry_run || $RM $obj $libobj
9045 # Objects from convenience libraries. This assumes
9046 # single-version convenience libraries. Whenever we create
9047 # different ones for PIC/non-PIC, this we'll have to duplicate
9048 # the extraction.
9049 reload_conv_objs=
9050 gentop=
9051 # reload_cmds runs $LD directly, so let us get rid of
9052 # -Wl from whole_archive_flag_spec and hope we can get by with
9053 # turning comma into space..
9056 if test -n "$convenience"; then
9057 if test -n "$whole_archive_flag_spec"; then
9058 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
9059 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
9060 else
9061 gentop="$output_objdir/${obj}x"
9062 generated+=" $gentop"
9064 func_extract_archives $gentop $convenience
9065 reload_conv_objs="$reload_objs $func_extract_archives_result"
9069 # If we're not building shared, we need to use non_pic_objs
9070 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
9072 # Create the old-style object.
9073 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
9075 output="$obj"
9076 func_execute_cmds "$reload_cmds" 'exit $?'
9078 # Exit if we aren't doing a library object file.
9079 if test -z "$libobj"; then
9080 if test -n "$gentop"; then
9081 func_show_eval '${RM}r "$gentop"'
9084 exit $EXIT_SUCCESS
9087 if test "$build_libtool_libs" != yes; then
9088 if test -n "$gentop"; then
9089 func_show_eval '${RM}r "$gentop"'
9092 # Create an invalid libtool object if no PIC, so that we don't
9093 # accidentally link it into a program.
9094 # $show "echo timestamp > $libobj"
9095 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
9096 exit $EXIT_SUCCESS
9099 if test -n "$pic_flag" || test "$pic_mode" != default; then
9100 # Only do commands if we really have different PIC objects.
9101 reload_objs="$libobjs $reload_conv_objs"
9102 output="$libobj"
9103 func_execute_cmds "$reload_cmds" 'exit $?'
9106 if test -n "$gentop"; then
9107 func_show_eval '${RM}r "$gentop"'
9110 exit $EXIT_SUCCESS
9113 prog)
9114 case $host in
9115 *cygwin*) func_stripname '' '.exe' "$output"
9116 output=$func_stripname_result.exe;;
9117 esac
9118 test -n "$vinfo" && \
9119 func_warning "\`-version-info' is ignored for programs"
9121 test -n "$release" && \
9122 func_warning "\`-release' is ignored for programs"
9124 test "$preload" = yes \
9125 && test "$dlopen_support" = unknown \
9126 && test "$dlopen_self" = unknown \
9127 && test "$dlopen_self_static" = unknown && \
9128 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
9130 case $host in
9131 *-*-rhapsody* | *-*-darwin1.[012])
9132 # On Rhapsody replace the C library is the System framework
9133 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
9134 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
9136 esac
9138 case $host in
9139 *-*-darwin*)
9140 # Don't allow lazy linking, it breaks C++ global constructors
9141 # But is supposedly fixed on 10.4 or later (yay!).
9142 if test "$tagname" = CXX ; then
9143 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
9144 10.[0123])
9145 compile_command+=" ${wl}-bind_at_load"
9146 finalize_command+=" ${wl}-bind_at_load"
9148 esac
9150 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9151 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9152 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9154 esac
9157 # move library search paths that coincide with paths to not yet
9158 # installed libraries to the beginning of the library search list
9159 new_libs=
9160 for path in $notinst_path; do
9161 case " $new_libs " in
9162 *" -L$path/$objdir "*) ;;
9164 case " $compile_deplibs " in
9165 *" -L$path/$objdir "*)
9166 new_libs+=" -L$path/$objdir" ;;
9167 esac
9169 esac
9170 done
9171 for deplib in $compile_deplibs; do
9172 case $deplib in
9173 -L*)
9174 case " $new_libs " in
9175 *" $deplib "*) ;;
9176 *) new_libs+=" $deplib" ;;
9177 esac
9179 *) new_libs+=" $deplib" ;;
9180 esac
9181 done
9182 compile_deplibs="$new_libs"
9185 compile_command+=" $compile_deplibs"
9186 finalize_command+=" $finalize_deplibs"
9188 if test -n "$rpath$xrpath"; then
9189 # If the user specified any rpath flags, then add them.
9190 for libdir in $rpath $xrpath; do
9191 # This is the magic to use -rpath.
9192 case "$finalize_rpath " in
9193 *" $libdir "*) ;;
9194 *) finalize_rpath+=" $libdir" ;;
9195 esac
9196 done
9199 # Now hardcode the library paths
9200 rpath=
9201 hardcode_libdirs=
9202 for libdir in $compile_rpath $finalize_rpath; do
9203 if test -n "$hardcode_libdir_flag_spec"; then
9204 if test -n "$hardcode_libdir_separator"; then
9205 if test -z "$hardcode_libdirs"; then
9206 hardcode_libdirs="$libdir"
9207 else
9208 # Just accumulate the unique libdirs.
9209 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9210 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9213 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
9215 esac
9217 else
9218 eval flag=\"$hardcode_libdir_flag_spec\"
9219 rpath+=" $flag"
9221 elif test -n "$runpath_var"; then
9222 case "$perm_rpath " in
9223 *" $libdir "*) ;;
9224 *) perm_rpath+=" $libdir" ;;
9225 esac
9227 case $host in
9228 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
9229 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
9230 case :$dllsearchpath: in
9231 *":$libdir:"*) ;;
9232 ::) dllsearchpath=$libdir;;
9233 *) dllsearchpath+=":$libdir";;
9234 esac
9235 case :$dllsearchpath: in
9236 *":$testbindir:"*) ;;
9237 ::) dllsearchpath=$testbindir;;
9238 *) dllsearchpath+=":$testbindir";;
9239 esac
9241 esac
9242 done
9243 # Substitute the hardcoded libdirs into the rpath.
9244 if test -n "$hardcode_libdir_separator" &&
9245 test -n "$hardcode_libdirs"; then
9246 libdir="$hardcode_libdirs"
9247 eval rpath=\" $hardcode_libdir_flag_spec\"
9249 compile_rpath="$rpath"
9251 rpath=
9252 hardcode_libdirs=
9253 for libdir in $finalize_rpath; do
9254 if test -n "$hardcode_libdir_flag_spec"; then
9255 if test -n "$hardcode_libdir_separator"; then
9256 if test -z "$hardcode_libdirs"; then
9257 hardcode_libdirs="$libdir"
9258 else
9259 # Just accumulate the unique libdirs.
9260 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9261 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9264 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
9266 esac
9268 else
9269 eval flag=\"$hardcode_libdir_flag_spec\"
9270 rpath+=" $flag"
9272 elif test -n "$runpath_var"; then
9273 case "$finalize_perm_rpath " in
9274 *" $libdir "*) ;;
9275 *) finalize_perm_rpath+=" $libdir" ;;
9276 esac
9278 done
9279 # Substitute the hardcoded libdirs into the rpath.
9280 if test -n "$hardcode_libdir_separator" &&
9281 test -n "$hardcode_libdirs"; then
9282 libdir="$hardcode_libdirs"
9283 eval rpath=\" $hardcode_libdir_flag_spec\"
9285 finalize_rpath="$rpath"
9287 if test -n "$libobjs" && test "$build_old_libs" = yes; then
9288 # Transform all the library objects into standard objects.
9289 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9290 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9293 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
9295 # template prelinking step
9296 if test -n "$prelink_cmds"; then
9297 func_execute_cmds "$prelink_cmds" 'exit $?'
9300 wrappers_required=yes
9301 case $host in
9302 *cegcc* | *mingw32ce*)
9303 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
9304 wrappers_required=no
9306 *cygwin* | *mingw* )
9307 if test "$build_libtool_libs" != yes; then
9308 wrappers_required=no
9312 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
9313 wrappers_required=no
9316 esac
9317 if test "$wrappers_required" = no; then
9318 # Replace the output file specification.
9319 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9320 link_command="$compile_command$compile_rpath"
9322 # We have no uninstalled library dependencies, so finalize right now.
9323 exit_status=0
9324 func_show_eval "$link_command" 'exit_status=$?'
9326 if test -n "$postlink_cmds"; then
9327 func_to_tool_file "$output"
9328 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9329 func_execute_cmds "$postlink_cmds" 'exit $?'
9332 # Delete the generated files.
9333 if test -f "$output_objdir/${outputname}S.${objext}"; then
9334 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
9337 exit $exit_status
9340 if test -n "$compile_shlibpath$finalize_shlibpath"; then
9341 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
9343 if test -n "$finalize_shlibpath"; then
9344 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
9347 compile_var=
9348 finalize_var=
9349 if test -n "$runpath_var"; then
9350 if test -n "$perm_rpath"; then
9351 # We should set the runpath_var.
9352 rpath=
9353 for dir in $perm_rpath; do
9354 rpath+="$dir:"
9355 done
9356 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
9358 if test -n "$finalize_perm_rpath"; then
9359 # We should set the runpath_var.
9360 rpath=
9361 for dir in $finalize_perm_rpath; do
9362 rpath+="$dir:"
9363 done
9364 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
9368 if test "$no_install" = yes; then
9369 # We don't need to create a wrapper script.
9370 link_command="$compile_var$compile_command$compile_rpath"
9371 # Replace the output file specification.
9372 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9373 # Delete the old output file.
9374 $opt_dry_run || $RM $output
9375 # Link the executable and exit
9376 func_show_eval "$link_command" 'exit $?'
9378 if test -n "$postlink_cmds"; then
9379 func_to_tool_file "$output"
9380 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9381 func_execute_cmds "$postlink_cmds" 'exit $?'
9384 exit $EXIT_SUCCESS
9387 if test "$hardcode_action" = relink; then
9388 # Fast installation is not supported
9389 link_command="$compile_var$compile_command$compile_rpath"
9390 relink_command="$finalize_var$finalize_command$finalize_rpath"
9392 func_warning "this platform does not like uninstalled shared libraries"
9393 func_warning "\`$output' will be relinked during installation"
9394 else
9395 if test "$fast_install" != no; then
9396 link_command="$finalize_var$compile_command$finalize_rpath"
9397 if test "$fast_install" = yes; then
9398 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
9399 else
9400 # fast_install is set to needless
9401 relink_command=
9403 else
9404 link_command="$compile_var$compile_command$compile_rpath"
9405 relink_command="$finalize_var$finalize_command$finalize_rpath"
9409 # Replace the output file specification.
9410 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9412 # Delete the old output files.
9413 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9415 func_show_eval "$link_command" 'exit $?'
9417 if test -n "$postlink_cmds"; then
9418 func_to_tool_file "$output_objdir/$outputname"
9419 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9420 func_execute_cmds "$postlink_cmds" 'exit $?'
9423 # Now create the wrapper script.
9424 func_verbose "creating $output"
9426 # Quote the relink command for shipping.
9427 if test -n "$relink_command"; then
9428 # Preserve any variables that may affect compiler behavior
9429 for var in $variables_saved_for_relink; do
9430 if eval test -z \"\${$var+set}\"; then
9431 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9432 elif eval var_value=\$$var; test -z "$var_value"; then
9433 relink_command="$var=; export $var; $relink_command"
9434 else
9435 func_quote_for_eval "$var_value"
9436 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9438 done
9439 relink_command="(cd `pwd`; $relink_command)"
9440 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9443 # Only actually do things if not in dry run mode.
9444 $opt_dry_run || {
9445 # win32 will think the script is a binary if it has
9446 # a .exe suffix, so we strip it off here.
9447 case $output in
9448 *.exe) func_stripname '' '.exe' "$output"
9449 output=$func_stripname_result ;;
9450 esac
9451 # test for cygwin because mv fails w/o .exe extensions
9452 case $host in
9453 *cygwin*)
9454 exeext=.exe
9455 func_stripname '' '.exe' "$outputname"
9456 outputname=$func_stripname_result ;;
9457 *) exeext= ;;
9458 esac
9459 case $host in
9460 *cygwin* | *mingw* )
9461 func_dirname_and_basename "$output" "" "."
9462 output_name=$func_basename_result
9463 output_path=$func_dirname_result
9464 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9465 cwrapper="$output_path/$output_name.exe"
9466 $RM $cwrappersource $cwrapper
9467 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9469 func_emit_cwrapperexe_src > $cwrappersource
9471 # The wrapper executable is built using the $host compiler,
9472 # because it contains $host paths and files. If cross-
9473 # compiling, it, like the target executable, must be
9474 # executed on the $host or under an emulation environment.
9475 $opt_dry_run || {
9476 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9477 $STRIP $cwrapper
9480 # Now, create the wrapper script for func_source use:
9481 func_ltwrapper_scriptname $cwrapper
9482 $RM $func_ltwrapper_scriptname_result
9483 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9484 $opt_dry_run || {
9485 # note: this script will not be executed, so do not chmod.
9486 if test "x$build" = "x$host" ; then
9487 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9488 else
9489 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9494 $RM $output
9495 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9497 func_emit_wrapper no > $output
9498 chmod +x $output
9500 esac
9502 exit $EXIT_SUCCESS
9504 esac
9506 # See if we need to build an old-fashioned archive.
9507 for oldlib in $oldlibs; do
9509 if test "$build_libtool_libs" = convenience; then
9510 oldobjs="$libobjs_save $symfileobj"
9511 addlibs="$convenience"
9512 build_libtool_libs=no
9513 else
9514 if test "$build_libtool_libs" = module; then
9515 oldobjs="$libobjs_save"
9516 build_libtool_libs=no
9517 else
9518 oldobjs="$old_deplibs $non_pic_objects"
9519 if test "$preload" = yes && test -f "$symfileobj"; then
9520 oldobjs+=" $symfileobj"
9523 addlibs="$old_convenience"
9526 if test -n "$addlibs"; then
9527 gentop="$output_objdir/${outputname}x"
9528 generated+=" $gentop"
9530 func_extract_archives $gentop $addlibs
9531 oldobjs+=" $func_extract_archives_result"
9534 # Do each command in the archive commands.
9535 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9536 cmds=$old_archive_from_new_cmds
9537 else
9539 # Add any objects from preloaded convenience libraries
9540 if test -n "$dlprefiles"; then
9541 gentop="$output_objdir/${outputname}x"
9542 generated+=" $gentop"
9544 func_extract_archives $gentop $dlprefiles
9545 oldobjs+=" $func_extract_archives_result"
9548 # POSIX demands no paths to be encoded in archives. We have
9549 # to avoid creating archives with duplicate basenames if we
9550 # might have to extract them afterwards, e.g., when creating a
9551 # static archive out of a convenience library, or when linking
9552 # the entirety of a libtool archive into another (currently
9553 # not supported by libtool).
9554 if (for obj in $oldobjs
9556 func_basename "$obj"
9557 $ECHO "$func_basename_result"
9558 done | sort | sort -uc >/dev/null 2>&1); then
9560 else
9561 echo "copying selected object files to avoid basename conflicts..."
9562 gentop="$output_objdir/${outputname}x"
9563 generated+=" $gentop"
9564 func_mkdir_p "$gentop"
9565 save_oldobjs=$oldobjs
9566 oldobjs=
9567 counter=1
9568 for obj in $save_oldobjs
9570 func_basename "$obj"
9571 objbase="$func_basename_result"
9572 case " $oldobjs " in
9573 " ") oldobjs=$obj ;;
9574 *[\ /]"$objbase "*)
9575 while :; do
9576 # Make sure we don't pick an alternate name that also
9577 # overlaps.
9578 newobj=lt$counter-$objbase
9579 func_arith $counter + 1
9580 counter=$func_arith_result
9581 case " $oldobjs " in
9582 *[\ /]"$newobj "*) ;;
9583 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9584 esac
9585 done
9586 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9587 oldobjs+=" $gentop/$newobj"
9589 *) oldobjs+=" $obj" ;;
9590 esac
9591 done
9593 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
9594 tool_oldlib=$func_to_tool_file_result
9595 eval cmds=\"$old_archive_cmds\"
9597 func_len " $cmds"
9598 len=$func_len_result
9599 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9600 cmds=$old_archive_cmds
9601 elif test -n "$archiver_list_spec"; then
9602 func_verbose "using command file archive linking..."
9603 for obj in $oldobjs
9605 func_to_tool_file "$obj"
9606 $ECHO "$func_to_tool_file_result"
9607 done > $output_objdir/$libname.libcmd
9608 func_to_tool_file "$output_objdir/$libname.libcmd"
9609 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9610 cmds=$old_archive_cmds
9611 else
9612 # the command line is too long to link in one step, link in parts
9613 func_verbose "using piecewise archive linking..."
9614 save_RANLIB=$RANLIB
9615 RANLIB=:
9616 objlist=
9617 concat_cmds=
9618 save_oldobjs=$oldobjs
9619 oldobjs=
9620 # Is there a better way of finding the last object in the list?
9621 for obj in $save_oldobjs
9623 last_oldobj=$obj
9624 done
9625 eval test_cmds=\"$old_archive_cmds\"
9626 func_len " $test_cmds"
9627 len0=$func_len_result
9628 len=$len0
9629 for obj in $save_oldobjs
9631 func_len " $obj"
9632 func_arith $len + $func_len_result
9633 len=$func_arith_result
9634 objlist+=" $obj"
9635 if test "$len" -lt "$max_cmd_len"; then
9637 else
9638 # the above command should be used before it gets too long
9639 oldobjs=$objlist
9640 if test "$obj" = "$last_oldobj" ; then
9641 RANLIB=$save_RANLIB
9643 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9644 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9645 objlist=
9646 len=$len0
9648 done
9649 RANLIB=$save_RANLIB
9650 oldobjs=$objlist
9651 if test "X$oldobjs" = "X" ; then
9652 eval cmds=\"\$concat_cmds\"
9653 else
9654 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9658 func_execute_cmds "$cmds" 'exit $?'
9659 done
9661 test -n "$generated" && \
9662 func_show_eval "${RM}r$generated"
9664 # Now create the libtool archive.
9665 case $output in
9666 *.la)
9667 old_library=
9668 test "$build_old_libs" = yes && old_library="$libname.$libext"
9669 func_verbose "creating $output"
9671 # Preserve any variables that may affect compiler behavior
9672 for var in $variables_saved_for_relink; do
9673 if eval test -z \"\${$var+set}\"; then
9674 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9675 elif eval var_value=\$$var; test -z "$var_value"; then
9676 relink_command="$var=; export $var; $relink_command"
9677 else
9678 func_quote_for_eval "$var_value"
9679 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9681 done
9682 # Quote the link command for shipping.
9683 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9684 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9685 if test "$hardcode_automatic" = yes ; then
9686 relink_command=
9689 # Only create the output if not a dry run.
9690 $opt_dry_run || {
9691 for installed in no yes; do
9692 if test "$installed" = yes; then
9693 if test -z "$install_libdir"; then
9694 break
9696 output="$output_objdir/$outputname"i
9697 # Replace all uninstalled libtool libraries with the installed ones
9698 newdependency_libs=
9699 for deplib in $dependency_libs; do
9700 case $deplib in
9701 *.la)
9702 func_basename "$deplib"
9703 name="$func_basename_result"
9704 func_resolve_sysroot "$deplib"
9705 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9706 test -z "$libdir" && \
9707 func_fatal_error "\`$deplib' is not a valid libtool archive"
9708 newdependency_libs+=" ${lt_sysroot:+=}$libdir/$name"
9710 -L*)
9711 func_stripname -L '' "$deplib"
9712 func_replace_sysroot "$func_stripname_result"
9713 newdependency_libs+=" -L$func_replace_sysroot_result"
9715 -R*)
9716 func_stripname -R '' "$deplib"
9717 func_replace_sysroot "$func_stripname_result"
9718 newdependency_libs+=" -R$func_replace_sysroot_result"
9720 *) newdependency_libs+=" $deplib" ;;
9721 esac
9722 done
9723 dependency_libs="$newdependency_libs"
9724 newdlfiles=
9726 for lib in $dlfiles; do
9727 case $lib in
9728 *.la)
9729 func_basename "$lib"
9730 name="$func_basename_result"
9731 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9732 test -z "$libdir" && \
9733 func_fatal_error "\`$lib' is not a valid libtool archive"
9734 newdlfiles+=" ${lt_sysroot:+=}$libdir/$name"
9736 *) newdlfiles+=" $lib" ;;
9737 esac
9738 done
9739 dlfiles="$newdlfiles"
9740 newdlprefiles=
9741 for lib in $dlprefiles; do
9742 case $lib in
9743 *.la)
9744 # Only pass preopened files to the pseudo-archive (for
9745 # eventual linking with the app. that links it) if we
9746 # didn't already link the preopened objects directly into
9747 # the library:
9748 func_basename "$lib"
9749 name="$func_basename_result"
9750 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9751 test -z "$libdir" && \
9752 func_fatal_error "\`$lib' is not a valid libtool archive"
9753 newdlprefiles+=" ${lt_sysroot:+=}$libdir/$name"
9755 esac
9756 done
9757 dlprefiles="$newdlprefiles"
9758 else
9759 newdlfiles=
9760 for lib in $dlfiles; do
9761 case $lib in
9762 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9763 *) abs=`pwd`"/$lib" ;;
9764 esac
9765 newdlfiles+=" $abs"
9766 done
9767 dlfiles="$newdlfiles"
9768 newdlprefiles=
9769 for lib in $dlprefiles; do
9770 case $lib in
9771 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9772 *) abs=`pwd`"/$lib" ;;
9773 esac
9774 newdlprefiles+=" $abs"
9775 done
9776 dlprefiles="$newdlprefiles"
9778 $RM $output
9779 # place dlname in correct position for cygwin
9780 # In fact, it would be nice if we could use this code for all target
9781 # systems that can't hard-code library paths into their executables
9782 # and that have no shared library path variable independent of PATH,
9783 # but it turns out we can't easily determine that from inspecting
9784 # libtool variables, so we have to hard-code the OSs to which it
9785 # applies here; at the moment, that means platforms that use the PE
9786 # object format with DLL files. See the long comment at the top of
9787 # tests/bindir.at for full details.
9788 tdlname=$dlname
9789 case $host,$output,$installed,$module,$dlname in
9790 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9791 # If a -bindir argument was supplied, place the dll there.
9792 if test "x$bindir" != x ;
9793 then
9794 func_relative_path "$install_libdir" "$bindir"
9795 tdlname=$func_relative_path_result$dlname
9796 else
9797 # Otherwise fall back on heuristic.
9798 tdlname=../bin/$dlname
9801 esac
9802 $ECHO > $output "\
9803 # $outputname - a libtool library file
9804 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9806 # Please DO NOT delete this file!
9807 # It is necessary for linking the library.
9809 # The name that we can dlopen(3).
9810 dlname='$tdlname'
9812 # Names of this library.
9813 library_names='$library_names'
9815 # The name of the static archive.
9816 old_library='$old_library'
9818 # Linker flags that can not go in dependency_libs.
9819 inherited_linker_flags='$new_inherited_linker_flags'
9821 # Libraries that this one depends upon.
9822 dependency_libs='$dependency_libs'
9824 # Names of additional weak libraries provided by this library
9825 weak_library_names='$weak_libs'
9827 # Version information for $libname.
9828 current=$current
9829 age=$age
9830 revision=$revision
9832 # Is this an already installed library?
9833 installed=$installed
9835 # Should we warn about portability when linking against -modules?
9836 shouldnotlink=$module
9838 # Files to dlopen/dlpreopen
9839 dlopen='$dlfiles'
9840 dlpreopen='$dlprefiles'
9842 # Directory that this library needs to be installed in:
9843 libdir='$install_libdir'"
9844 if test "$installed" = no && test "$need_relink" = yes; then
9845 $ECHO >> $output "\
9846 relink_command=\"$relink_command\""
9848 done
9851 # Do a symbolic link so that the libtool archive can be found in
9852 # LD_LIBRARY_PATH before the program is installed.
9853 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9855 esac
9856 exit $EXIT_SUCCESS
9859 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9860 func_mode_link ${1+"$@"}
9863 # func_mode_uninstall arg...
9864 func_mode_uninstall ()
9866 $opt_debug
9867 RM="$nonopt"
9868 files=
9869 rmforce=
9870 exit_status=0
9872 # This variable tells wrapper scripts just to set variables rather
9873 # than running their programs.
9874 libtool_install_magic="$magic"
9876 for arg
9878 case $arg in
9879 -f) RM+=" $arg"; rmforce=yes ;;
9880 -*) RM+=" $arg" ;;
9881 *) files+=" $arg" ;;
9882 esac
9883 done
9885 test -z "$RM" && \
9886 func_fatal_help "you must specify an RM program"
9888 rmdirs=
9890 for file in $files; do
9891 func_dirname "$file" "" "."
9892 dir="$func_dirname_result"
9893 if test "X$dir" = X.; then
9894 odir="$objdir"
9895 else
9896 odir="$dir/$objdir"
9898 func_basename "$file"
9899 name="$func_basename_result"
9900 test "$opt_mode" = uninstall && odir="$dir"
9902 # Remember odir for removal later, being careful to avoid duplicates
9903 if test "$opt_mode" = clean; then
9904 case " $rmdirs " in
9905 *" $odir "*) ;;
9906 *) rmdirs+=" $odir" ;;
9907 esac
9910 # Don't error if the file doesn't exist and rm -f was used.
9911 if { test -L "$file"; } >/dev/null 2>&1 ||
9912 { test -h "$file"; } >/dev/null 2>&1 ||
9913 test -f "$file"; then
9915 elif test -d "$file"; then
9916 exit_status=1
9917 continue
9918 elif test "$rmforce" = yes; then
9919 continue
9922 rmfiles="$file"
9924 case $name in
9925 *.la)
9926 # Possibly a libtool archive, so verify it.
9927 if func_lalib_p "$file"; then
9928 func_source $dir/$name
9930 # Delete the libtool libraries and symlinks.
9931 for n in $library_names; do
9932 rmfiles+=" $odir/$n"
9933 done
9934 test -n "$old_library" && rmfiles+=" $odir/$old_library"
9936 case "$opt_mode" in
9937 clean)
9938 case " $library_names " in
9939 *" $dlname "*) ;;
9940 *) test -n "$dlname" && rmfiles+=" $odir/$dlname" ;;
9941 esac
9942 test -n "$libdir" && rmfiles+=" $odir/$name $odir/${name}i"
9944 uninstall)
9945 if test -n "$library_names"; then
9946 # Do each command in the postuninstall commands.
9947 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9950 if test -n "$old_library"; then
9951 # Do each command in the old_postuninstall commands.
9952 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9954 # FIXME: should reinstall the best remaining shared library.
9956 esac
9960 *.lo)
9961 # Possibly a libtool object, so verify it.
9962 if func_lalib_p "$file"; then
9964 # Read the .lo file
9965 func_source $dir/$name
9967 # Add PIC object to the list of files to remove.
9968 if test -n "$pic_object" &&
9969 test "$pic_object" != none; then
9970 rmfiles+=" $dir/$pic_object"
9973 # Add non-PIC object to the list of files to remove.
9974 if test -n "$non_pic_object" &&
9975 test "$non_pic_object" != none; then
9976 rmfiles+=" $dir/$non_pic_object"
9982 if test "$opt_mode" = clean ; then
9983 noexename=$name
9984 case $file in
9985 *.exe)
9986 func_stripname '' '.exe' "$file"
9987 file=$func_stripname_result
9988 func_stripname '' '.exe' "$name"
9989 noexename=$func_stripname_result
9990 # $file with .exe has already been added to rmfiles,
9991 # add $file without .exe
9992 rmfiles+=" $file"
9994 esac
9995 # Do a test to see if this is a libtool program.
9996 if func_ltwrapper_p "$file"; then
9997 if func_ltwrapper_executable_p "$file"; then
9998 func_ltwrapper_scriptname "$file"
9999 relink_command=
10000 func_source $func_ltwrapper_scriptname_result
10001 rmfiles+=" $func_ltwrapper_scriptname_result"
10002 else
10003 relink_command=
10004 func_source $dir/$noexename
10007 # note $name still contains .exe if it was in $file originally
10008 # as does the version of $file that was added into $rmfiles
10009 rmfiles+=" $odir/$name $odir/${name}S.${objext}"
10010 if test "$fast_install" = yes && test -n "$relink_command"; then
10011 rmfiles+=" $odir/lt-$name"
10013 if test "X$noexename" != "X$name" ; then
10014 rmfiles+=" $odir/lt-${noexename}.c"
10019 esac
10020 func_show_eval "$RM $rmfiles" 'exit_status=1'
10021 done
10023 # Try to remove the ${objdir}s in the directories where we deleted files
10024 for dir in $rmdirs; do
10025 if test -d "$dir"; then
10026 func_show_eval "rmdir $dir >/dev/null 2>&1"
10028 done
10030 exit $exit_status
10033 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
10034 func_mode_uninstall ${1+"$@"}
10036 test -z "$opt_mode" && {
10037 help="$generic_help"
10038 func_fatal_help "you must specify a MODE"
10041 test -z "$exec_cmd" && \
10042 func_fatal_help "invalid operation mode \`$opt_mode'"
10044 if test -n "$exec_cmd"; then
10045 eval exec "$exec_cmd"
10046 exit $EXIT_FAILURE
10049 exit $exit_status
10052 # The TAGs below are defined such that we never get into a situation
10053 # in which we disable both kinds of libraries. Given conflicting
10054 # choices, we go for a static library, that is the most portable,
10055 # since we can't tell whether shared libraries were disabled because
10056 # the user asked for that or because the platform doesn't support
10057 # them. This is particularly important on AIX, because we don't
10058 # support having both static and shared libraries enabled at the same
10059 # time on that platform, so we default to a shared-only configuration.
10060 # If a disable-shared tag is given, we'll fallback to a static-only
10061 # configuration. But we'll never go from static-only to shared-only.
10063 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
10064 build_libtool_libs=no
10065 build_old_libs=yes
10066 # ### END LIBTOOL TAG CONFIG: disable-shared
10068 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
10069 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
10070 # ### END LIBTOOL TAG CONFIG: disable-static
10072 # Local Variables:
10073 # mode:shell-script
10074 # sh-indentation:2
10075 # End:
10076 # vi:sw=2