Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / glib / libtool
blobac14c3b0fe426c5d2470ed8a431e6470d3f473d4
1 #! /bin/sh
3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (glib) 1.2.10
5 # Libtool was configured on host vicente-P5K-E:
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 Free Software Foundation,
10 # 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
44 macro_revision=1.3293
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=yes
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 host system.
65 host_alias=mipsel-linux
66 host=mipsel-unknown-linux-gnu
67 host_os=linux-gnu
69 # The build system.
70 build_alias=x86_64-linux-gnu
71 build=x86_64-pc-linux-gnu
72 build_os=linux-gnu
74 # A sed program that does not truncate output.
75 SED="/bin/sed"
77 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
78 Xsed="$SED -e 1s/^X//"
80 # A grep program that handles long lines.
81 GREP="/bin/grep"
83 # An ERE matcher.
84 EGREP="/bin/grep -E"
86 # A literal string matcher.
87 FGREP="/bin/grep -F"
89 # A BSD- or MS-compatible name lister.
90 NM="mipsel-uclibc-nm"
92 # Whether we need soft or hard links.
93 LN_S="ln -s"
95 # What is the maximum length of a command?
96 max_cmd_len=3458764513820540925
98 # Object file suffix (normally "o").
99 objext=o
101 # Executable file suffix (normally "").
102 exeext=
104 # whether the shell understands "unset".
105 lt_unset=unset
107 # turn spaces into newlines.
108 SP2NL="tr \\040 \\012"
110 # turn newlines into spaces.
111 NL2SP="tr \\015\\012 \\040\\040"
113 # convert $build file names to $host format.
114 to_host_file_cmd=func_convert_file_noop
116 # convert $build files to toolchain format.
117 to_tool_file_cmd=func_convert_file_noop
119 # An object symbol dumper.
120 OBJDUMP="mipsel-linux-objdump"
122 # Method to check whether dependent libraries are shared objects.
123 deplibs_check_method="pass_all"
125 # Command to use when deplibs_check_method = "file_magic".
126 file_magic_cmd="\$MAGIC_CMD"
128 # How to find potential files when deplibs_check_method = "file_magic".
129 file_magic_glob=""
131 # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
132 want_nocaseglob="no"
134 # DLL creation program.
135 DLLTOOL="false"
137 # Command to associate shared and link libraries.
138 sharedlib_from_linklib_cmd="printf %s\\n"
140 # The archiver.
141 AR="mipsel-uclibc-ar"
143 # Flags to create an archive.
144 AR_FLAGS="cru"
146 # How to feed a file listing to the archiver.
147 archiver_list_spec="@"
149 # A symbol stripping program.
150 STRIP="mipsel-uclibc-strip -R .note -R .comment"
152 # Commands used to install an old-style archive.
153 RANLIB="mipsel-uclibc-ranlib"
154 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
155 old_postuninstall_cmds=""
157 # Whether to use a lock for old archive extraction.
158 lock_old_archive_extraction=no
160 # A C compiler.
161 LTCC="mipsel-uclibc-gcc"
163 # LTCC compiler flags.
164 LTCFLAGS="-g -O2 -Wall -D_REENTRANT"
166 # Take the output of nm and produce a listing of raw symbols and C names.
167 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
169 # Transform the output of nm in a proper C declaration.
170 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
172 # Transform the output of nm in a C name address pair.
173 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
175 # Transform the output of nm in a C name address pair when lib prefix is needed.
176 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'"
178 # Specify filename containing input files for $NM.
179 nm_file_list_spec="@"
181 # The root where to search for dependent libraries,and in which our libraries should be installed.
182 lt_sysroot=
184 # The name of the directory that contains temporary libtool files.
185 objdir=.libs
187 # Used to examine libraries when file_magic_cmd begins with "file".
188 MAGIC_CMD=file
190 # Must we lock files when doing compilation?
191 need_locks="no"
193 # Manifest tool.
194 MANIFEST_TOOL=":"
196 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
197 DSYMUTIL=""
199 # Tool to change global to local symbols on Mac OS X.
200 NMEDIT=""
202 # Tool to manipulate fat objects and archives on Mac OS X.
203 LIPO=""
205 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
206 OTOOL=""
208 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
209 OTOOL64=""
211 # Old archive suffix (normally "a").
212 libext=a
214 # Shared library suffix (normally ".so").
215 shrext_cmds=".so"
217 # The commands to extract the exported symbol list from a shared archive.
218 extract_expsyms_cmds=""
220 # Variables whose values should be saved in libtool wrapper scripts and
221 # restored at link time.
222 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
224 # Do we need the "lib" prefix for modules?
225 need_lib_prefix=no
227 # Do we need a version for libraries?
228 need_version=no
230 # Library versioning type.
231 version_type=linux
233 # Shared library runtime path variable.
234 runpath_var=LD_RUN_PATH
236 # Shared library path variable.
237 shlibpath_var=LD_LIBRARY_PATH
239 # Is shlibpath searched before the hard-coded library search path?
240 shlibpath_overrides_runpath=no
242 # Format of library name prefix.
243 libname_spec="lib\$name"
245 # List of archive names. First name is the real one, the rest are links.
246 # The last name is the one that the linker finds with -lNAME
247 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
249 # The coded name of the library, if different from the real name.
250 soname_spec="\${libname}\${release}\${shared_ext}\$major"
252 # Permission mode override for installation of shared libraries.
253 install_override_mode=""
255 # Command to use after installation of a shared archive.
256 postinstall_cmds=""
258 # Command to use after uninstallation of a shared archive.
259 postuninstall_cmds=""
261 # Commands used to finish a libtool library installation in a directory.
262 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
264 # As "finish_cmds", except a single script fragment to be evaled but
265 # not shown.
266 finish_eval=""
268 # Whether we should hardcode library paths into libraries.
269 hardcode_into_libs=yes
271 # Compile-time system search path for libraries.
272 sys_lib_search_path_spec="/home/vicente/tomato/tools/brcm/K26/hndtools-mipsel-uclibc-4.2.4/lib/gcc/mipsel-linux-uclibc/4.2.4 /home/vicente/tomato/tools/brcm/K26/hndtools-mipsel-uclibc-4.2.4/lib/gcc /home/vicente/tomato/tools/brcm/K26/hndtools-mipsel-uclibc-4.2.4/mipsel-linux-uclibc/lib "
274 # Run-time system search path for libraries.
275 sys_lib_dlsearch_path_spec="/lib /usr/lib /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib /usr/lib/nvidia-settings /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /usr/lib/nvidia-current /usr/lib32/nvidia-current /lib32 /usr/lib32 "
277 # Whether dlopen is supported.
278 dlopen_support=unknown
280 # Whether dlopen of programs is supported.
281 dlopen_self=unknown
283 # Whether dlopen of statically linked programs is supported.
284 dlopen_self_static=unknown
286 # Commands to strip libraries.
287 old_striplib="mipsel-uclibc-strip -R .note -R .comment --strip-debug"
288 striplib="mipsel-uclibc-strip -R .note -R .comment --strip-unneeded"
291 # The linker used to build libraries.
292 LD="mipsel-uclibc-ld"
294 # How to create reloadable object files.
295 reload_flag=" -r"
296 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
298 # Commands used to build an old-style archive.
299 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
301 # A language specific compiler.
302 CC="mipsel-uclibc-gcc"
304 # Is the compiler the GNU compiler?
305 with_gcc=yes
307 # Compiler flag to turn off builtin functions.
308 no_builtin_flag=" -fno-builtin"
310 # Additional compiler flags for building library objects.
311 pic_flag=" -fPIC -DPIC"
313 # How to pass a linker flag through the compiler.
314 wl="-Wl,"
316 # Compiler flag to prevent dynamic linking.
317 link_static_flag="-static"
319 # Does compiler simultaneously support -c and -o options?
320 compiler_c_o="yes"
322 # Whether or not to add -lc for building shared libraries.
323 build_libtool_need_lc=no
325 # Whether or not to disallow shared libs when runtime libs are static.
326 allow_libtool_libs_with_static_runtimes=no
328 # Compiler flag to allow reflexive dlopens.
329 export_dynamic_flag_spec="\${wl}--export-dynamic"
331 # Compiler flag to generate shared objects directly from archives.
332 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
334 # Whether the compiler copes with passing no objects directly.
335 compiler_needs_object="no"
337 # Create an old-style archive from a shared archive.
338 old_archive_from_new_cmds=""
340 # Create a temporary old-style archive to link instead of a shared archive.
341 old_archive_from_expsyms_cmds=""
343 # Commands used to build a shared archive.
344 archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
345 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
346 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
347 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
348 \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
350 # Commands used to build a loadable module if different from building
351 # a shared archive.
352 module_cmds=""
353 module_expsym_cmds=""
355 # Whether we are building with GNU ld or not.
356 with_gnu_ld="yes"
358 # Flag that allows shared libraries with undefined symbols to be built.
359 allow_undefined_flag=""
361 # Flag that enforces no undefined symbols.
362 no_undefined_flag=""
364 # Flag to hardcode $libdir into a binary during linking.
365 # This must work even if $libdir does not exist
366 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
368 # If ld is used when linking, flag to hardcode $libdir into a binary
369 # during linking. This must work even if $libdir does not exist.
370 hardcode_libdir_flag_spec_ld=""
372 # Whether we need a single "-rpath" flag with a separated argument.
373 hardcode_libdir_separator=""
375 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
376 # DIR into the resulting binary.
377 hardcode_direct=no
379 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
380 # DIR into the resulting binary and the resulting library dependency is
381 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
382 # library is relocated.
383 hardcode_direct_absolute=no
385 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
386 # into the resulting binary.
387 hardcode_minus_L=no
389 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
390 # into the resulting binary.
391 hardcode_shlibpath_var=unsupported
393 # Set to "yes" if building a shared library automatically hardcodes DIR
394 # into the library and all subsequent libraries and executables linked
395 # against it.
396 hardcode_automatic=no
398 # Set to yes if linker adds runtime paths of dependent libraries
399 # to runtime path list.
400 inherit_rpath=no
402 # Whether libtool must link a program against all its dependency libraries.
403 link_all_deplibs=unknown
405 # Set to "yes" if exported symbols are required.
406 always_export_symbols=no
408 # The commands to list exported symbols.
409 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
411 # Symbols that should not be listed in the preloaded symbols.
412 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
414 # Symbols that must always be exported.
415 include_expsyms=""
417 # Commands necessary for linking programs (against libraries) with templates.
418 prelink_cmds=""
420 # Commands necessary for finishing linking programs.
421 postlink_cmds=""
423 # Specify filename containing input files.
424 file_list_spec=""
426 # How to hardcode a shared library path into an executable.
427 hardcode_action=immediate
429 # ### END LIBTOOL CONFIG
432 # libtool (GNU libtool) 2.4
433 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
435 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
436 # 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
437 # This is free software; see the source for copying conditions. There is NO
438 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
440 # GNU Libtool is free software; you can redistribute it and/or modify
441 # it under the terms of the GNU General Public License as published by
442 # the Free Software Foundation; either version 2 of the License, or
443 # (at your option) any later version.
445 # As a special exception to the GNU General Public License,
446 # if you distribute this file as part of a program or library that
447 # is built using GNU Libtool, you may include this file under the
448 # same distribution terms that you use for the rest of that program.
450 # GNU Libtool is distributed in the hope that it will be useful, but
451 # WITHOUT ANY WARRANTY; without even the implied warranty of
452 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
453 # General Public License for more details.
455 # You should have received a copy of the GNU General Public License
456 # along with GNU Libtool; see the file COPYING. If not, a copy
457 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
458 # or obtained by writing to the Free Software Foundation, Inc.,
459 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
461 # Usage: $progname [OPTION]... [MODE-ARG]...
463 # Provide generalized library-building support services.
465 # --config show all configuration variables
466 # --debug enable verbose shell tracing
467 # -n, --dry-run display commands without modifying any files
468 # --features display basic configuration information and exit
469 # --mode=MODE use operation mode MODE
470 # --preserve-dup-deps don't remove duplicate dependency libraries
471 # --quiet, --silent don't print informational messages
472 # --no-quiet, --no-silent
473 # print informational messages (default)
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
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
513 TIMESTAMP=""
514 package_revision=1.3293
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 : ${EGREP="grep -E"}
570 : ${FGREP="grep -F"}
571 : ${GREP="grep"}
572 : ${LN_S="ln -s"}
573 : ${MAKE="make"}
574 : ${MKDIR="mkdir"}
575 : ${MV="mv -f"}
576 : ${RM="rm -f"}
577 : ${SED="sed"}
578 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
579 : ${Xsed="$SED -e 1s/^X//"}
581 # Global variables:
582 EXIT_SUCCESS=0
583 EXIT_FAILURE=1
584 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
585 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
587 exit_status=$EXIT_SUCCESS
589 # Make sure IFS has a sensible default
590 lt_nl='
592 IFS=" $lt_nl"
594 dirname="s,/[^/]*$,,"
595 basename="s,^.*/,,"
597 # func_dirname file append nondir_replacement
598 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
599 # otherwise set result to NONDIR_REPLACEMENT.
600 func_dirname ()
602 case ${1} in
603 */*) func_dirname_result="${1%/*}${2}" ;;
604 * ) func_dirname_result="${3}" ;;
605 esac
606 } # Extended-shell func_dirname implementation
609 # func_basename file
610 func_basename ()
612 func_basename_result="${1##*/}"
613 } # Extended-shell func_basename implementation
616 # func_dirname_and_basename file append nondir_replacement
617 # perform func_basename and func_dirname in a single function
618 # call:
619 # dirname: Compute the dirname of FILE. If nonempty,
620 # add APPEND to the result, otherwise set result
621 # to NONDIR_REPLACEMENT.
622 # value returned in "$func_dirname_result"
623 # basename: Compute filename of FILE.
624 # value retuned in "$func_basename_result"
625 # Implementation must be kept synchronized with func_dirname
626 # and func_basename. For efficiency, we do not delegate to
627 # those functions but instead duplicate the functionality here.
628 func_dirname_and_basename ()
630 case ${1} in
631 */*) func_dirname_result="${1%/*}${2}" ;;
632 * ) func_dirname_result="${3}" ;;
633 esac
634 func_basename_result="${1##*/}"
635 } # Extended-shell func_dirname_and_basename implementation
638 # func_stripname prefix suffix name
639 # strip PREFIX and SUFFIX off of NAME.
640 # PREFIX and SUFFIX must not contain globbing or regex special
641 # characters, hashes, percent signs, but SUFFIX may contain a leading
642 # dot (in which case that matches only a dot).
643 # func_strip_suffix prefix name
644 func_stripname ()
646 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
647 # positional parameters, so assign one to ordinary parameter first.
648 func_stripname_result=${3}
649 func_stripname_result=${func_stripname_result#"${1}"}
650 func_stripname_result=${func_stripname_result%"${2}"}
651 } # Extended-shell func_stripname implementation
654 # These SED scripts presuppose an absolute path with a trailing slash.
655 pathcar='s,^/\([^/]*\).*$,\1,'
656 pathcdr='s,^/[^/]*,,'
657 removedotparts=':dotsl
658 s@/\./@/@g
659 t dotsl
660 s,/\.$,/,'
661 collapseslashes='s@/\{1,\}@/@g'
662 finalslash='s,/*$,/,'
664 # func_normal_abspath PATH
665 # Remove doubled-up and trailing slashes, "." path components,
666 # and cancel out any ".." path components in PATH after making
667 # it an absolute path.
668 # value returned in "$func_normal_abspath_result"
669 func_normal_abspath ()
671 # Start from root dir and reassemble the path.
672 func_normal_abspath_result=
673 func_normal_abspath_tpath=$1
674 func_normal_abspath_altnamespace=
675 case $func_normal_abspath_tpath in
677 # Empty path, that just means $cwd.
678 func_stripname '' '/' "`pwd`"
679 func_normal_abspath_result=$func_stripname_result
680 return
682 # The next three entries are used to spot a run of precisely
683 # two leading slashes without using negated character classes;
684 # we take advantage of case's first-match behaviour.
685 ///*)
686 # Unusual form of absolute path, do nothing.
688 //*)
689 # Not necessarily an ordinary path; POSIX reserves leading '//'
690 # and for example Cygwin uses it to access remote file shares
691 # over CIFS/SMB, so we conserve a leading double slash if found.
692 func_normal_abspath_altnamespace=/
695 # Absolute path, do nothing.
698 # Relative path, prepend $cwd.
699 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
701 esac
702 # Cancel out all the simple stuff to save iterations. We also want
703 # the path to end with a slash for ease of parsing, so make sure
704 # there is one (and only one) here.
705 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
706 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
707 while :; do
708 # Processed it all yet?
709 if test "$func_normal_abspath_tpath" = / ; then
710 # If we ascended to the root using ".." the result may be empty now.
711 if test -z "$func_normal_abspath_result" ; then
712 func_normal_abspath_result=/
714 break
716 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
717 -e "$pathcar"`
718 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
719 -e "$pathcdr"`
720 # Figure out what to do with it
721 case $func_normal_abspath_tcomponent in
723 # Trailing empty path component, ignore it.
726 # Parent dir; strip last assembled component from result.
727 func_dirname "$func_normal_abspath_result"
728 func_normal_abspath_result=$func_dirname_result
731 # Actual path component, append it.
732 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
734 esac
735 done
736 # Restore leading double-slash if one was found on entry.
737 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
740 # func_relative_path SRCDIR DSTDIR
741 # generates a relative path from SRCDIR to DSTDIR, with a trailing
742 # slash if non-empty, suitable for immediately appending a filename
743 # without needing to append a separator.
744 # value returned in "$func_relative_path_result"
745 func_relative_path ()
747 func_relative_path_result=
748 func_normal_abspath "$1"
749 func_relative_path_tlibdir=$func_normal_abspath_result
750 func_normal_abspath "$2"
751 func_relative_path_tbindir=$func_normal_abspath_result
753 # Ascend the tree starting from libdir
754 while :; do
755 # check if we have found a prefix of bindir
756 case $func_relative_path_tbindir in
757 $func_relative_path_tlibdir)
758 # found an exact match
759 func_relative_path_tcancelled=
760 break
762 $func_relative_path_tlibdir*)
763 # found a matching prefix
764 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
765 func_relative_path_tcancelled=$func_stripname_result
766 if test -z "$func_relative_path_result"; then
767 func_relative_path_result=.
769 break
772 func_dirname $func_relative_path_tlibdir
773 func_relative_path_tlibdir=${func_dirname_result}
774 if test "x$func_relative_path_tlibdir" = x ; then
775 # Have to descend all the way to the root!
776 func_relative_path_result=../$func_relative_path_result
777 func_relative_path_tcancelled=$func_relative_path_tbindir
778 break
780 func_relative_path_result=../$func_relative_path_result
782 esac
783 done
785 # Now calculate path; take care to avoid doubling-up slashes.
786 func_stripname '' '/' "$func_relative_path_result"
787 func_relative_path_result=$func_stripname_result
788 func_stripname '/' '/' "$func_relative_path_tcancelled"
789 if test "x$func_stripname_result" != x ; then
790 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
793 # Normalisation. If bindir is libdir, return empty string,
794 # else relative path ending with a slash; either way, target
795 # file name can be directly appended.
796 if test ! -z "$func_relative_path_result"; then
797 func_stripname './' '' "$func_relative_path_result/"
798 func_relative_path_result=$func_stripname_result
802 # The name of this program:
803 func_dirname_and_basename "$progpath"
804 progname=$func_basename_result
806 # Make sure we have an absolute path for reexecution:
807 case $progpath in
808 [\\/]*|[A-Za-z]:\\*) ;;
809 *[\\/]*)
810 progdir=$func_dirname_result
811 progdir=`cd "$progdir" && pwd`
812 progpath="$progdir/$progname"
815 save_IFS="$IFS"
816 IFS=:
817 for progdir in $PATH; do
818 IFS="$save_IFS"
819 test -x "$progdir/$progname" && break
820 done
821 IFS="$save_IFS"
822 test -n "$progdir" || progdir=`pwd`
823 progpath="$progdir/$progname"
825 esac
827 # Sed substitution that helps us do robust quoting. It backslashifies
828 # metacharacters that are still active within double-quoted strings.
829 Xsed="${SED}"' -e 1s/^X//'
830 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
832 # Same as above, but do not quote variable references.
833 double_quote_subst='s/\(["`\\]\)/\\\1/g'
835 # Sed substitution that turns a string into a regex matching for the
836 # string literally.
837 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
839 # Sed substitution that converts a w32 file name or path
840 # which contains forward slashes, into one that contains
841 # (escaped) backslashes. A very naive implementation.
842 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
844 # Re-`\' parameter expansions in output of double_quote_subst that were
845 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
846 # in input to double_quote_subst, that '$' was protected from expansion.
847 # Since each input `\' is now two `\'s, look for any number of runs of
848 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
849 bs='\\'
850 bs2='\\\\'
851 bs4='\\\\\\\\'
852 dollar='\$'
853 sed_double_backslash="\
854 s/$bs4/&\\
856 s/^$bs2$dollar/$bs&/
857 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
858 s/\n//g"
860 # Standard options:
861 opt_dry_run=false
862 opt_help=false
863 opt_quiet=false
864 opt_verbose=false
865 opt_warning=:
867 # func_echo arg...
868 # Echo program name prefixed message, along with the current mode
869 # name if it has been set yet.
870 func_echo ()
872 $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }$*"
875 # func_verbose arg...
876 # Echo program name prefixed message in verbose mode only.
877 func_verbose ()
879 $opt_verbose && func_echo ${1+"$@"}
881 # A bug in bash halts the script if the last line of a function
882 # fails when set -e is in force, so we need another command to
883 # work around that:
887 # func_echo_all arg...
888 # Invoke $ECHO with all args, space-separated.
889 func_echo_all ()
891 $ECHO "$*"
894 # func_error arg...
895 # Echo program name prefixed message to standard error.
896 func_error ()
898 $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
901 # func_warning arg...
902 # Echo program name prefixed warning message to standard error.
903 func_warning ()
905 $opt_warning && $ECHO "OpenWrt-$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
907 # bash bug again:
911 # func_fatal_error arg...
912 # Echo program name prefixed message to standard error, and exit.
913 func_fatal_error ()
915 func_error ${1+"$@"}
916 exit $EXIT_FAILURE
919 # func_fatal_help arg...
920 # Echo program name prefixed message to standard error, followed by
921 # a help hint, and exit.
922 func_fatal_help ()
924 func_error ${1+"$@"}
925 func_fatal_error "$help"
927 help="Try \`$progname --help' for more information." ## default
930 # func_grep expression filename
931 # Check whether EXPRESSION matches any line of FILENAME, without output.
932 func_grep ()
934 $GREP "$1" "$2" >/dev/null 2>&1
938 # func_mkdir_p directory-path
939 # Make sure the entire path to DIRECTORY-PATH is available.
940 func_mkdir_p ()
942 my_directory_path="$1"
943 my_dir_list=
945 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
947 # Protect directory names starting with `-'
948 case $my_directory_path in
949 -*) my_directory_path="./$my_directory_path" ;;
950 esac
952 # While some portion of DIR does not yet exist...
953 while test ! -d "$my_directory_path"; do
954 # ...make a list in topmost first order. Use a colon delimited
955 # list incase some portion of path contains whitespace.
956 my_dir_list="$my_directory_path:$my_dir_list"
958 # If the last portion added has no slash in it, the list is done
959 case $my_directory_path in */*) ;; *) break ;; esac
961 # ...otherwise throw away the child directory and loop
962 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
963 done
964 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
966 save_mkdir_p_IFS="$IFS"; IFS=':'
967 for my_dir in $my_dir_list; do
968 IFS="$save_mkdir_p_IFS"
969 # mkdir can fail with a `File exist' error if two processes
970 # try to create one of the directories concurrently. Don't
971 # stop in that case!
972 $MKDIR "$my_dir" 2>/dev/null || :
973 done
974 IFS="$save_mkdir_p_IFS"
976 # Bail out if we (or some other process) failed to create a directory.
977 test -d "$my_directory_path" || \
978 func_fatal_error "Failed to create \`$1'"
983 # func_mktempdir [string]
984 # Make a temporary directory that won't clash with other running
985 # libtool processes, and avoids race conditions if possible. If
986 # given, STRING is the basename for that directory.
987 func_mktempdir ()
989 my_template="${TMPDIR-/tmp}/${1-$progname}"
991 if test "$opt_dry_run" = ":"; then
992 # Return a directory name, but don't create it in dry-run mode
993 my_tmpdir="${my_template}-$$"
994 else
996 # If mktemp works, use that first and foremost
997 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
999 if test ! -d "$my_tmpdir"; then
1000 # Failing that, at least try and use $RANDOM to avoid a race
1001 my_tmpdir="${my_template}-${RANDOM-0}$$"
1003 save_mktempdir_umask=`umask`
1004 umask 0077
1005 $MKDIR "$my_tmpdir"
1006 umask $save_mktempdir_umask
1009 # If we're not in dry-run mode, bomb out on failure
1010 test -d "$my_tmpdir" || \
1011 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1014 $ECHO "$my_tmpdir"
1018 # func_quote_for_eval arg
1019 # Aesthetically quote ARG to be evaled later.
1020 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1021 # is double-quoted, suitable for a subsequent eval, whereas
1022 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1023 # which are still active within double quotes backslashified.
1024 func_quote_for_eval ()
1026 case $1 in
1027 *[\\\`\"\$]*)
1028 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
1030 func_quote_for_eval_unquoted_result="$1" ;;
1031 esac
1033 case $func_quote_for_eval_unquoted_result in
1034 # Double-quote args containing shell metacharacters to delay
1035 # word splitting, command substitution and and variable
1036 # expansion for a subsequent eval.
1037 # Many Bourne shells cannot handle close brackets correctly
1038 # in scan sets, so we specify it separately.
1039 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1040 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1043 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1044 esac
1048 # func_quote_for_expand arg
1049 # Aesthetically quote ARG to be evaled later; same as above,
1050 # but do not quote variable references.
1051 func_quote_for_expand ()
1053 case $1 in
1054 *[\\\`\"]*)
1055 my_arg=`$ECHO "$1" | $SED \
1056 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1058 my_arg="$1" ;;
1059 esac
1061 case $my_arg in
1062 # Double-quote args containing shell metacharacters to delay
1063 # word splitting and command substitution for a subsequent eval.
1064 # Many Bourne shells cannot handle close brackets correctly
1065 # in scan sets, so we specify it separately.
1066 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1067 my_arg="\"$my_arg\""
1069 esac
1071 func_quote_for_expand_result="$my_arg"
1075 # func_show_eval cmd [fail_exp]
1076 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1077 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1078 # is given, then evaluate it.
1079 func_show_eval ()
1081 my_cmd="$1"
1082 my_fail_exp="${2-:}"
1084 ${opt_silent-false} || {
1085 func_quote_for_expand "$my_cmd"
1086 eval "func_echo $func_quote_for_expand_result"
1089 if ${opt_dry_run-false}; then :; else
1090 eval "$my_cmd"
1091 my_status=$?
1092 if test "$my_status" -eq 0; then :; else
1093 eval "(exit $my_status); $my_fail_exp"
1099 # func_show_eval_locale cmd [fail_exp]
1100 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1101 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1102 # is given, then evaluate it. Use the saved locale for evaluation.
1103 func_show_eval_locale ()
1105 my_cmd="$1"
1106 my_fail_exp="${2-:}"
1108 ${opt_silent-false} || {
1109 func_quote_for_expand "$my_cmd"
1110 eval "func_echo $func_quote_for_expand_result"
1113 if ${opt_dry_run-false}; then :; else
1114 eval "$lt_user_locale
1115 $my_cmd"
1116 my_status=$?
1117 eval "$lt_safe_locale"
1118 if test "$my_status" -eq 0; then :; else
1119 eval "(exit $my_status); $my_fail_exp"
1124 # func_tr_sh
1125 # Turn $1 into a string suitable for a shell variable name.
1126 # Result is stored in $func_tr_sh_result. All characters
1127 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1128 # if $1 begins with a digit, a '_' is prepended as well.
1129 func_tr_sh ()
1131 case $1 in
1132 [0-9]* | *[!a-zA-Z0-9_]*)
1133 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
1136 func_tr_sh_result=$1
1138 esac
1142 # func_version
1143 # Echo version message to standard output and exit.
1144 func_version ()
1146 $opt_debug
1148 $SED -n '/(C)/!b go
1149 :more
1150 /\./!{
1152 s/\n# / /
1153 b more
1156 /^# '$PROGRAM' (GNU /,/# warranty; / {
1157 s/^# //
1158 s/^# *$//
1159 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1161 }' < "$progpath"
1162 exit $?
1165 # func_usage
1166 # Echo short help message to standard output and exit.
1167 func_usage ()
1169 $opt_debug
1171 $SED -n '/^# Usage:/,/^# *.*--help/ {
1172 s/^# //
1173 s/^# *$//
1174 s/\$progname/'$progname'/
1176 }' < "$progpath"
1177 echo
1178 $ECHO "run \`$progname --help | more' for full usage"
1179 exit $?
1182 # func_help [NOEXIT]
1183 # Echo long help message to standard output and exit,
1184 # unless 'noexit' is passed as argument.
1185 func_help ()
1187 $opt_debug
1189 $SED -n '/^# Usage:/,/# Report bugs to/ {
1190 :print
1191 s/^# //
1192 s/^# *$//
1193 s*\$progname*'$progname'*
1194 s*\$host*'"$host"'*
1195 s*\$SHELL*'"$SHELL"'*
1196 s*\$LTCC*'"$LTCC"'*
1197 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1198 s*\$LD*'"$LD"'*
1199 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1200 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1201 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1205 /^# .* home page:/b print
1206 /^# General help using/b print
1207 ' < "$progpath"
1208 ret=$?
1209 if test -z "$1"; then
1210 exit $ret
1214 # func_missing_arg argname
1215 # Echo program name prefixed message to standard error and set global
1216 # exit_cmd.
1217 func_missing_arg ()
1219 $opt_debug
1221 func_error "missing argument for $1."
1222 exit_cmd=exit
1226 # func_split_short_opt shortopt
1227 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1228 # variables after splitting SHORTOPT after the 2nd character.
1229 func_split_short_opt ()
1231 func_split_short_opt_arg=${1#??}
1232 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1233 } # Extended-shell func_split_short_opt implementation
1236 # func_split_long_opt longopt
1237 # Set func_split_long_opt_name and func_split_long_opt_arg shell
1238 # variables after splitting LONGOPT at the `=' sign.
1239 func_split_long_opt ()
1241 func_split_long_opt_name=${1%%=*}
1242 func_split_long_opt_arg=${1#*=}
1243 } # Extended-shell func_split_long_opt implementation
1245 exit_cmd=:
1251 magic="%%%MAGIC variable%%%"
1252 magic_exe="%%%MAGIC EXE variable%%%"
1254 # Global variables.
1255 nonopt=
1256 preserve_args=
1257 lo2o="s/\\.lo\$/.${objext}/"
1258 o2lo="s/\\.${objext}\$/.lo/"
1259 extracted_archives=
1260 extracted_serial=0
1262 # If this variable is set in any of the actions, the command in it
1263 # will be execed at the end. This prevents here-documents from being
1264 # left over by shells.
1265 exec_cmd=
1267 # func_append var value
1268 # Append VALUE to the end of shell variable VAR.
1269 func_append ()
1271 eval "${1}+=\${2}"
1272 } # Extended-shell func_append implementation
1274 # func_append_quoted var value
1275 # Quote VALUE and append to the end of shell variable VAR, separated
1276 # by a space.
1277 func_append_quoted ()
1279 func_quote_for_eval "${2}"
1280 eval "${1}+=\\ \$func_quote_for_eval_result"
1281 } # Extended-shell func_append_quoted implementation
1284 # func_arith arithmetic-term...
1285 func_arith ()
1287 func_arith_result=$(( $* ))
1288 } # Extended-shell func_arith implementation
1291 # func_len string
1292 # STRING may not start with a hyphen.
1293 func_len ()
1295 func_len_result=${#1}
1296 } # Extended-shell func_len implementation
1299 # func_lo2o object
1300 func_lo2o ()
1302 case ${1} in
1303 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
1304 *) func_lo2o_result=${1} ;;
1305 esac
1306 } # Extended-shell func_lo2o implementation
1309 # func_xform libobj-or-source
1310 func_xform ()
1312 func_xform_result=${1%.*}.lo
1313 } # Extended-shell func_xform implementation
1316 # func_fatal_configuration arg...
1317 # Echo program name prefixed message to standard error, followed by
1318 # a configuration failure hint, and exit.
1319 func_fatal_configuration ()
1321 func_error ${1+"$@"}
1322 func_error "See the $PACKAGE documentation for more information."
1323 func_fatal_error "Fatal configuration error."
1327 # func_config
1328 # Display the configuration for all the tags in this script.
1329 func_config ()
1331 re_begincf='^# ### BEGIN LIBTOOL'
1332 re_endcf='^# ### END LIBTOOL'
1334 # Default configuration.
1335 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1337 # Now print the configurations for the tags.
1338 for tagname in $taglist; do
1339 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1340 done
1342 exit $?
1345 # func_features
1346 # Display the features supported by this script.
1347 func_features ()
1349 echo "host: $host"
1350 if test "$build_libtool_libs" = yes; then
1351 echo "enable shared libraries"
1352 else
1353 echo "disable shared libraries"
1355 if test "$build_old_libs" = yes; then
1356 echo "enable static libraries"
1357 else
1358 echo "disable static libraries"
1361 exit $?
1364 # func_enable_tag tagname
1365 # Verify that TAGNAME is valid, and either flag an error and exit, or
1366 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1367 # variable here.
1368 func_enable_tag ()
1370 # Global variable:
1371 tagname="$1"
1373 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1374 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1375 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1377 # Validate tagname.
1378 case $tagname in
1379 *[!-_A-Za-z0-9,/]*)
1380 func_fatal_error "invalid tag name: $tagname"
1382 esac
1384 # Don't test for the "default" C tag, as we know it's
1385 # there but not specially marked.
1386 case $tagname in
1387 CC) ;;
1389 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1390 taglist="$taglist $tagname"
1392 # Evaluate the configuration. Be careful to quote the path
1393 # and the sed script, to avoid splitting on whitespace, but
1394 # also don't use non-portable quotes within backquotes within
1395 # quotes we have to do it in 2 steps:
1396 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1397 eval "$extractedcf"
1398 else
1399 func_error "ignoring unknown tag $tagname"
1402 esac
1405 # func_check_version_match
1406 # Ensure that we are using m4 macros, and libtool script from the same
1407 # release of libtool.
1408 func_check_version_match ()
1410 if test "$package_revision" != "$macro_revision"; then
1411 if test "$VERSION" != "$macro_version"; then
1412 if test -z "$macro_version"; then
1413 cat >&2 <<_LT_EOF
1414 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1415 $progname: definition of this LT_INIT comes from an older release.
1416 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1417 $progname: and run autoconf again.
1418 _LT_EOF
1419 else
1420 cat >&2 <<_LT_EOF
1421 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1422 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1423 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1424 $progname: and run autoconf again.
1425 _LT_EOF
1427 else
1428 cat >&2 <<_LT_EOF
1429 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1430 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1431 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1432 $progname: of $PACKAGE $VERSION and run autoconf again.
1433 _LT_EOF
1436 exit $EXIT_MISMATCH
1441 # Shorthand for --mode=foo, only valid as the first argument
1442 case $1 in
1443 clean|clea|cle|cl)
1444 shift; set dummy --mode clean ${1+"$@"}; shift
1446 compile|compil|compi|comp|com|co|c)
1447 shift; set dummy --mode compile ${1+"$@"}; shift
1449 execute|execut|execu|exec|exe|ex|e)
1450 shift; set dummy --mode execute ${1+"$@"}; shift
1452 finish|finis|fini|fin|fi|f)
1453 shift; set dummy --mode finish ${1+"$@"}; shift
1455 install|instal|insta|inst|ins|in|i)
1456 shift; set dummy --mode install ${1+"$@"}; shift
1458 link|lin|li|l)
1459 shift; set dummy --mode link ${1+"$@"}; shift
1461 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1462 shift; set dummy --mode uninstall ${1+"$@"}; shift
1464 esac
1468 # Option defaults:
1469 opt_debug=:
1470 opt_dry_run=false
1471 opt_config=false
1472 opt_preserve_dup_deps=false
1473 opt_features=false
1474 opt_finish=false
1475 opt_help=false
1476 opt_help_all=false
1477 opt_silent=:
1478 opt_verbose=:
1479 opt_silent=false
1480 opt_verbose=false
1483 # Parse options once, thoroughly. This comes as soon as possible in the
1484 # script to make things like `--version' happen as quickly as we can.
1486 # this just eases exit handling
1487 while test $# -gt 0; do
1488 opt="$1"
1489 shift
1490 case $opt in
1491 --debug|-x) opt_debug='set -x'
1492 func_echo "enabling shell trace mode"
1493 $opt_debug
1495 --dry-run|--dryrun|-n)
1496 opt_dry_run=:
1498 --config)
1499 opt_config=:
1500 func_config
1502 --dlopen|-dlopen)
1503 optarg="$1"
1504 opt_dlopen="${opt_dlopen+$opt_dlopen
1505 }$optarg"
1506 shift
1508 --preserve-dup-deps)
1509 opt_preserve_dup_deps=:
1511 --features)
1512 opt_features=:
1513 func_features
1515 --finish)
1516 opt_finish=:
1517 set dummy --mode finish ${1+"$@"}; shift
1519 --help)
1520 opt_help=:
1522 --help-all)
1523 opt_help_all=:
1524 opt_help=': help-all'
1526 --mode)
1527 test $# = 0 && func_missing_arg $opt && break
1528 optarg="$1"
1529 opt_mode="$optarg"
1530 case $optarg in
1531 # Valid mode arguments:
1532 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1534 # Catch anything else as an error
1535 *) func_error "invalid argument for $opt"
1536 exit_cmd=exit
1537 break
1539 esac
1540 shift
1542 --no-silent|--no-quiet)
1543 opt_silent=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 | *.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 # Strip any trailing slash from the destination.
3380 func_stripname '' '/' "$libdir"
3381 destlibdir=$func_stripname_result
3383 func_stripname '' '/' "$destdir"
3384 s_destdir=$func_stripname_result
3386 # Determine the prefix the user has applied to our future dir.
3387 inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$destlibdir\$%%"`
3389 # Don't allow the user to place us outside of our expected
3390 # location b/c this prevents finding dependent libraries that
3391 # are installed to the same prefix.
3392 # At present, this check doesn't affect windows .dll's that
3393 # are installed into $libdir/../bin (currently, that works fine)
3394 # but it's something to keep an eye on.
3395 test "$inst_prefix_dir" = "$destdir" && \
3396 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
3398 if test -n "$inst_prefix_dir"; then
3399 # Stick the inst_prefix_dir data into the link command.
3400 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
3401 else
3402 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
3405 relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/lib[^[:space:]]*%%"`
3406 relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/usr/lib[^[:space:]]*%%"`
3408 func_warning "relinking \`$file'"
3409 func_show_eval "$relink_command" \
3410 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
3413 # See the names of the shared library.
3414 set dummy $library_names; shift
3415 if test -n "$1"; then
3416 realname="$1"
3417 shift
3419 srcname="$realname"
3420 test -n "$relink_command" && srcname="$realname"T
3422 # Install the shared library and build the symlinks.
3423 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
3424 'exit $?'
3425 tstripme="$stripme"
3426 case $host_os in
3427 cygwin* | mingw* | pw32* | cegcc*)
3428 case $realname in
3429 *.dll.a)
3430 tstripme=""
3432 esac
3434 esac
3435 if test -n "$tstripme" && test -n "$striplib"; then
3436 func_show_eval "$striplib $destdir/$realname" 'exit $?'
3439 if test "$#" -gt 0; then
3440 # Delete the old symlinks, and create new ones.
3441 # Try `ln -sf' first, because the `ln' binary might depend on
3442 # the symlink we replace! Solaris /bin/ln does not understand -f,
3443 # so we also need to try rm && ln -s.
3444 for linkname
3446 test "$linkname" != "$realname" \
3447 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3448 done
3451 # Do each command in the postinstall commands.
3452 lib="$destdir/$realname"
3453 func_execute_cmds "$postinstall_cmds" 'exit $?'
3456 # Install the pseudo-library for information purposes.
3457 func_basename "$file"
3458 name="$func_basename_result"
3459 instname="$dir/$name"i
3460 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3462 # Maybe install the static library, too.
3463 test -n "$old_library" && staticlibs+=" $dir/$old_library"
3466 *.lo)
3467 # Install (i.e. copy) a libtool object.
3469 # Figure out destination file name, if it wasn't already specified.
3470 if test -n "$destname"; then
3471 destfile="$destdir/$destname"
3472 else
3473 func_basename "$file"
3474 destfile="$func_basename_result"
3475 destfile="$destdir/$destfile"
3478 # Deduce the name of the destination old-style object file.
3479 case $destfile in
3480 *.lo)
3481 func_lo2o "$destfile"
3482 staticdest=$func_lo2o_result
3484 *.$objext)
3485 staticdest="$destfile"
3486 destfile=
3489 func_fatal_help "cannot copy a libtool object to \`$destfile'"
3491 esac
3493 # Install the libtool object if requested.
3494 test -n "$destfile" && \
3495 func_show_eval "$install_prog $file $destfile" 'exit $?'
3497 # Install the old object if enabled.
3498 if test "$build_old_libs" = yes; then
3499 # Deduce the name of the old-style object file.
3500 func_lo2o "$file"
3501 staticobj=$func_lo2o_result
3502 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3504 exit $EXIT_SUCCESS
3508 # Figure out destination file name, if it wasn't already specified.
3509 if test -n "$destname"; then
3510 destfile="$destdir/$destname"
3511 else
3512 func_basename "$file"
3513 destfile="$func_basename_result"
3514 destfile="$destdir/$destfile"
3517 # If the file is missing, and there is a .exe on the end, strip it
3518 # because it is most likely a libtool script we actually want to
3519 # install
3520 stripped_ext=""
3521 case $file in
3522 *.exe)
3523 if test ! -f "$file"; then
3524 func_stripname '' '.exe' "$file"
3525 file=$func_stripname_result
3526 stripped_ext=".exe"
3529 esac
3531 # Do a test to see if this is really a libtool program.
3532 case $host in
3533 *cygwin* | *mingw*)
3534 if func_ltwrapper_executable_p "$file"; then
3535 func_ltwrapper_scriptname "$file"
3536 wrapper=$func_ltwrapper_scriptname_result
3537 else
3538 func_stripname '' '.exe' "$file"
3539 wrapper=$func_stripname_result
3543 wrapper=$file
3545 esac
3546 if func_ltwrapper_script_p "$wrapper"; then
3547 notinst_deplibs=
3548 relink_command=
3550 func_source "$wrapper"
3552 # Check the variables that should have been set.
3553 test -z "$generated_by_libtool_version" && \
3554 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3556 finalize=yes
3557 for lib in $notinst_deplibs; do
3558 # Check to see that each library is installed.
3559 libdir=
3560 if test -f "$lib"; then
3561 func_source "$lib"
3563 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3564 if test -n "$libdir" && test ! -f "$libfile"; then
3565 func_warning "\`$lib' has not been installed in \`$libdir'"
3566 finalize=no
3568 done
3570 relink_command=
3571 func_source "$wrapper"
3573 outputname=
3574 if test "$fast_install" = no && test -n "$relink_command"; then
3575 $opt_dry_run || {
3576 if test "$finalize" = yes; then
3577 tmpdir=`func_mktempdir`
3578 func_basename "$file$stripped_ext"
3579 file="$func_basename_result"
3580 outputname="$tmpdir/$file"
3581 # Replace the output file specification.
3582 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3584 $opt_silent || {
3585 func_quote_for_expand "$relink_command"
3586 eval "func_echo $func_quote_for_expand_result"
3588 if eval "$relink_command"; then :
3589 else
3590 func_error "error: relink \`$file' with the above command before installing it"
3591 $opt_dry_run || ${RM}r "$tmpdir"
3592 continue
3594 file="$outputname"
3595 else
3596 func_warning "cannot relink \`$file'"
3599 else
3600 # Install the binary that we compiled earlier.
3601 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3605 # remove .exe since cygwin /usr/bin/install will append another
3606 # one anyway
3607 case $install_prog,$host in
3608 */usr/bin/install*,*cygwin*)
3609 case $file:$destfile in
3610 *.exe:*.exe)
3611 # this is ok
3613 *.exe:*)
3614 destfile=$destfile.exe
3616 *:*.exe)
3617 func_stripname '' '.exe' "$destfile"
3618 destfile=$func_stripname_result
3620 esac
3622 esac
3623 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3624 $opt_dry_run || if test -n "$outputname"; then
3625 ${RM}r "$tmpdir"
3628 esac
3629 done
3631 for file in $staticlibs; do
3632 func_basename "$file"
3633 name="$func_basename_result"
3635 # Set up the ranlib parameters.
3636 oldlib="$destdir/$name"
3638 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3640 if test -n "$stripme" && test -n "$old_striplib"; then
3641 func_show_eval "$old_striplib $oldlib" 'exit $?'
3644 # Do each command in the postinstall commands.
3645 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3646 done
3648 test -n "$future_libdirs" && \
3649 func_warning "remember to run \`$progname --finish$future_libdirs'"
3651 if test -n "$current_libdirs"; then
3652 # Maybe just do a dry run.
3653 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3654 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3655 else
3656 exit $EXIT_SUCCESS
3660 test "$opt_mode" = install && func_mode_install ${1+"$@"}
3663 # func_generate_dlsyms outputname originator pic_p
3664 # Extract symbols from dlprefiles and create ${outputname}S.o with
3665 # a dlpreopen symbol table.
3666 func_generate_dlsyms ()
3668 $opt_debug
3669 my_outputname="$1"
3670 my_originator="$2"
3671 my_pic_p="${3-no}"
3672 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3673 my_dlsyms=
3675 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3676 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3677 my_dlsyms="${my_outputname}S.c"
3678 else
3679 func_error "not configured to extract global symbols from dlpreopened files"
3683 if test -n "$my_dlsyms"; then
3684 case $my_dlsyms in
3685 "") ;;
3686 *.c)
3687 # Discover the nlist of each of the dlfiles.
3688 nlist="$output_objdir/${my_outputname}.nm"
3690 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3692 # Parse the name list into a source file.
3693 func_verbose "creating $output_objdir/$my_dlsyms"
3695 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3696 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3697 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3699 #ifdef __cplusplus
3700 extern \"C\" {
3701 #endif
3703 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3704 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3705 #endif
3707 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3708 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3709 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3710 relocations are performed -- see ld's documentation on pseudo-relocs. */
3711 # define LT_DLSYM_CONST
3712 #elif defined(__osf__)
3713 /* This system does not cope well with relocations in const data. */
3714 # define LT_DLSYM_CONST
3715 #else
3716 # define LT_DLSYM_CONST const
3717 #endif
3719 /* External symbol declarations for the compiler. */\
3722 if test "$dlself" = yes; then
3723 func_verbose "generating symbol list for \`$output'"
3725 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3727 # Add our own program objects to the symbol list.
3728 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3729 for progfile in $progfiles; do
3730 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3731 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3732 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3733 done
3735 if test -n "$exclude_expsyms"; then
3736 $opt_dry_run || {
3737 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3738 eval '$MV "$nlist"T "$nlist"'
3742 if test -n "$export_symbols_regex"; then
3743 $opt_dry_run || {
3744 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3745 eval '$MV "$nlist"T "$nlist"'
3749 # Prepare the list of exported symbols
3750 if test -z "$export_symbols"; then
3751 export_symbols="$output_objdir/$outputname.exp"
3752 $opt_dry_run || {
3753 $RM $export_symbols
3754 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3755 case $host in
3756 *cygwin* | *mingw* | *cegcc* )
3757 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3758 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3760 esac
3762 else
3763 $opt_dry_run || {
3764 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3765 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3766 eval '$MV "$nlist"T "$nlist"'
3767 case $host in
3768 *cygwin* | *mingw* | *cegcc* )
3769 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3770 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3772 esac
3777 for dlprefile in $dlprefiles; do
3778 func_verbose "extracting global C symbols from \`$dlprefile'"
3779 func_basename "$dlprefile"
3780 name="$func_basename_result"
3781 case $host in
3782 *cygwin* | *mingw* | *cegcc* )
3783 # if an import library, we need to obtain dlname
3784 if func_win32_import_lib_p "$dlprefile"; then
3785 func_tr_sh "$dlprefile"
3786 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3787 dlprefile_dlbasename=""
3788 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3789 # Use subshell, to avoid clobbering current variable values
3790 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3791 if test -n "$dlprefile_dlname" ; then
3792 func_basename "$dlprefile_dlname"
3793 dlprefile_dlbasename="$func_basename_result"
3794 else
3795 # no lafile. user explicitly requested -dlpreopen <import library>.
3796 $sharedlib_from_linklib_cmd "$dlprefile"
3797 dlprefile_dlbasename=$sharedlib_from_linklib_result
3800 $opt_dry_run || {
3801 if test -n "$dlprefile_dlbasename" ; then
3802 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3803 else
3804 func_warning "Could not compute DLL name from $name"
3805 eval '$ECHO ": $name " >> "$nlist"'
3807 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3808 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3809 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3811 else # not an import lib
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'"
3820 $opt_dry_run || {
3821 eval '$ECHO ": $name " >> "$nlist"'
3822 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3823 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3826 esac
3827 done
3829 $opt_dry_run || {
3830 # Make sure we have at least an empty file.
3831 test -f "$nlist" || : > "$nlist"
3833 if test -n "$exclude_expsyms"; then
3834 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3835 $MV "$nlist"T "$nlist"
3838 # Try sorting and uniquifying the output.
3839 if $GREP -v "^: " < "$nlist" |
3840 if sort -k 3 </dev/null >/dev/null 2>&1; then
3841 sort -k 3
3842 else
3843 sort +2
3844 fi |
3845 uniq > "$nlist"S; then
3847 else
3848 $GREP -v "^: " < "$nlist" > "$nlist"S
3851 if test -f "$nlist"S; then
3852 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3853 else
3854 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3857 echo >> "$output_objdir/$my_dlsyms" "\
3859 /* The mapping between symbol names and symbols. */
3860 typedef struct {
3861 const char *name;
3862 void *address;
3863 } lt_dlsymlist;
3864 extern LT_DLSYM_CONST lt_dlsymlist
3865 lt_${my_prefix}_LTX_preloaded_symbols[];
3866 LT_DLSYM_CONST lt_dlsymlist
3867 lt_${my_prefix}_LTX_preloaded_symbols[] =
3869 { \"$my_originator\", (void *) 0 },"
3871 case $need_lib_prefix in
3873 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3876 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3878 esac
3879 echo >> "$output_objdir/$my_dlsyms" "\
3880 {0, (void *) 0}
3883 /* This works around a problem in FreeBSD linker */
3884 #ifdef FREEBSD_WORKAROUND
3885 static const void *lt_preloaded_setup() {
3886 return lt_${my_prefix}_LTX_preloaded_symbols;
3888 #endif
3890 #ifdef __cplusplus
3892 #endif\
3894 } # !$opt_dry_run
3896 pic_flag_for_symtable=
3897 case "$compile_command " in
3898 *" -static "*) ;;
3900 case $host in
3901 # compiling the symbol table file with pic_flag works around
3902 # a FreeBSD bug that causes programs to crash when -lm is
3903 # linked before any other PIC object. But we must not use
3904 # pic_flag when linking with -static. The problem exists in
3905 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3906 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3907 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3908 *-*-hpux*)
3909 pic_flag_for_symtable=" $pic_flag" ;;
3911 if test "X$my_pic_p" != Xno; then
3912 pic_flag_for_symtable=" $pic_flag"
3915 esac
3917 esac
3918 symtab_cflags=
3919 for arg in $LTCFLAGS; do
3920 case $arg in
3921 -pie | -fpie | -fPIE) ;;
3922 *) symtab_cflags+=" $arg" ;;
3923 esac
3924 done
3926 # Now compile the dynamic symbol file.
3927 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3929 # Clean up the generated files.
3930 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3932 # Transform the symbol file into the correct name.
3933 symfileobj="$output_objdir/${my_outputname}S.$objext"
3934 case $host in
3935 *cygwin* | *mingw* | *cegcc* )
3936 if test -f "$output_objdir/$my_outputname.def"; then
3937 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3938 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3939 else
3940 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3941 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3945 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3946 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3948 esac
3951 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3953 esac
3954 else
3955 # We keep going just in case the user didn't refer to
3956 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3957 # really was required.
3959 # Nullify the symbol file.
3960 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3961 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3965 # func_win32_libid arg
3966 # return the library type of file 'arg'
3968 # Need a lot of goo to handle *both* DLLs and import libs
3969 # Has to be a shell function in order to 'eat' the argument
3970 # that is supplied when $file_magic_command is called.
3971 # Despite the name, also deal with 64 bit binaries.
3972 func_win32_libid ()
3974 $opt_debug
3975 win32_libid_type="unknown"
3976 win32_fileres=`file -L $1 2>/dev/null`
3977 case $win32_fileres in
3978 *ar\ archive\ import\ library*) # definitely import
3979 win32_libid_type="x86 archive import"
3981 *ar\ archive*) # could be an import, or static
3982 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3983 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3984 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3985 func_to_tool_file "$1" func_convert_file_msys_to_w32
3986 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3987 $SED -n -e '
3988 1,100{
3989 / I /{
3990 s,.*,import,
3995 case $win32_nmres in
3996 import*) win32_libid_type="x86 archive import";;
3997 *) win32_libid_type="x86 archive static";;
3998 esac
4001 *DLL*)
4002 win32_libid_type="x86 DLL"
4004 *executable*) # but shell scripts are "executable" too...
4005 case $win32_fileres in
4006 *MS\ Windows\ PE\ Intel*)
4007 win32_libid_type="x86 DLL"
4009 esac
4011 esac
4012 $ECHO "$win32_libid_type"
4015 # func_cygming_dll_for_implib ARG
4017 # Platform-specific function to extract the
4018 # name of the DLL associated with the specified
4019 # import library ARG.
4020 # Invoked by eval'ing the libtool variable
4021 # $sharedlib_from_linklib_cmd
4022 # Result is available in the variable
4023 # $sharedlib_from_linklib_result
4024 func_cygming_dll_for_implib ()
4026 $opt_debug
4027 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
4030 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
4032 # The is the core of a fallback implementation of a
4033 # platform-specific function to extract the name of the
4034 # DLL associated with the specified import library LIBNAME.
4036 # SECTION_NAME is either .idata$6 or .idata$7, depending
4037 # on the platform and compiler that created the implib.
4039 # Echos the name of the DLL associated with the
4040 # specified import library.
4041 func_cygming_dll_for_implib_fallback_core ()
4043 $opt_debug
4044 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
4045 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
4046 $SED '/^Contents of section '"$match_literal"':/{
4047 # Place marker at beginning of archive member dllname section
4048 s/.*/====MARK====/
4052 # These lines can sometimes be longer than 43 characters, but
4053 # are always uninteresting
4054 /:[ ]*file format pe[i]\{,1\}-/d
4055 /^In archive [^:]*:/d
4056 # Ensure marker is printed
4057 /^====MARK====/p
4058 # Remove all lines with less than 43 characters
4059 /^.\{43\}/!d
4060 # From remaining lines, remove first 43 characters
4061 s/^.\{43\}//' |
4062 $SED -n '
4063 # Join marker and all lines until next marker into a single line
4064 /^====MARK====/ b para
4066 $ b para
4068 :para
4070 s/\n//g
4071 # Remove the marker
4072 s/^====MARK====//
4073 # Remove trailing dots and whitespace
4074 s/[\. \t]*$//
4075 # Print
4076 /./p' |
4077 # we now have a list, one entry per line, of the stringified
4078 # contents of the appropriate section of all members of the
4079 # archive which possess that section. Heuristic: eliminate
4080 # all those which have a first or second character that is
4081 # a '.' (that is, objdump's representation of an unprintable
4082 # character.) This should work for all archives with less than
4083 # 0x302f exports -- but will fail for DLLs whose name actually
4084 # begins with a literal '.' or a single character followed by
4085 # a '.'.
4087 # Of those that remain, print the first one.
4088 $SED -e '/^\./d;/^.\./d;q'
4091 # func_cygming_gnu_implib_p ARG
4092 # This predicate returns with zero status (TRUE) if
4093 # ARG is a GNU/binutils-style import library. Returns
4094 # with nonzero status (FALSE) otherwise.
4095 func_cygming_gnu_implib_p ()
4097 $opt_debug
4098 func_to_tool_file "$1" func_convert_file_msys_to_w32
4099 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)$'`
4100 test -n "$func_cygming_gnu_implib_tmp"
4103 # func_cygming_ms_implib_p ARG
4104 # This predicate returns with zero status (TRUE) if
4105 # ARG is an MS-style import library. Returns
4106 # with nonzero status (FALSE) otherwise.
4107 func_cygming_ms_implib_p ()
4109 $opt_debug
4110 func_to_tool_file "$1" func_convert_file_msys_to_w32
4111 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
4112 test -n "$func_cygming_ms_implib_tmp"
4115 # func_cygming_dll_for_implib_fallback ARG
4116 # Platform-specific function to extract the
4117 # name of the DLL associated with the specified
4118 # import library ARG.
4120 # This fallback implementation is for use when $DLLTOOL
4121 # does not support the --identify-strict option.
4122 # Invoked by eval'ing the libtool variable
4123 # $sharedlib_from_linklib_cmd
4124 # Result is available in the variable
4125 # $sharedlib_from_linklib_result
4126 func_cygming_dll_for_implib_fallback ()
4128 $opt_debug
4129 if func_cygming_gnu_implib_p "$1" ; then
4130 # binutils import library
4131 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
4132 elif func_cygming_ms_implib_p "$1" ; then
4133 # ms-generated import library
4134 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
4135 else
4136 # unknown
4137 sharedlib_from_linklib_result=""
4142 # func_extract_an_archive dir oldlib
4143 func_extract_an_archive ()
4145 $opt_debug
4146 f_ex_an_ar_dir="$1"; shift
4147 f_ex_an_ar_oldlib="$1"
4148 if test "$lock_old_archive_extraction" = yes; then
4149 lockfile=$f_ex_an_ar_oldlib.lock
4150 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
4151 func_echo "Waiting for $lockfile to be removed"
4152 sleep 2
4153 done
4155 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
4156 'stat=$?; rm -f "$lockfile"; exit $stat'
4157 if test "$lock_old_archive_extraction" = yes; then
4158 $opt_dry_run || rm -f "$lockfile"
4160 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
4162 else
4163 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
4168 # func_extract_archives gentop oldlib ...
4169 func_extract_archives ()
4171 $opt_debug
4172 my_gentop="$1"; shift
4173 my_oldlibs=${1+"$@"}
4174 my_oldobjs=""
4175 my_xlib=""
4176 my_xabs=""
4177 my_xdir=""
4179 for my_xlib in $my_oldlibs; do
4180 # Extract the objects.
4181 case $my_xlib in
4182 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
4183 *) my_xabs=`pwd`"/$my_xlib" ;;
4184 esac
4185 func_basename "$my_xlib"
4186 my_xlib="$func_basename_result"
4187 my_xlib_u=$my_xlib
4188 while :; do
4189 case " $extracted_archives " in
4190 *" $my_xlib_u "*)
4191 func_arith $extracted_serial + 1
4192 extracted_serial=$func_arith_result
4193 my_xlib_u=lt$extracted_serial-$my_xlib ;;
4194 *) break ;;
4195 esac
4196 done
4197 extracted_archives="$extracted_archives $my_xlib_u"
4198 my_xdir="$my_gentop/$my_xlib_u"
4200 func_mkdir_p "$my_xdir"
4202 case $host in
4203 *-darwin*)
4204 func_verbose "Extracting $my_xabs"
4205 # Do not bother doing anything if just a dry run
4206 $opt_dry_run || {
4207 darwin_orig_dir=`pwd`
4208 cd $my_xdir || exit $?
4209 darwin_archive=$my_xabs
4210 darwin_curdir=`pwd`
4211 darwin_base_archive=`basename "$darwin_archive"`
4212 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
4213 if test -n "$darwin_arches"; then
4214 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
4215 darwin_arch=
4216 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
4217 for darwin_arch in $darwin_arches ; do
4218 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4219 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
4220 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4221 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
4222 cd "$darwin_curdir"
4223 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
4224 done # $darwin_arches
4225 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
4226 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
4227 darwin_file=
4228 darwin_files=
4229 for darwin_file in $darwin_filelist; do
4230 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
4231 $LIPO -create -output "$darwin_file" $darwin_files
4232 done # $darwin_filelist
4233 $RM -rf unfat-$$
4234 cd "$darwin_orig_dir"
4235 else
4236 cd $darwin_orig_dir
4237 func_extract_an_archive "$my_xdir" "$my_xabs"
4238 fi # $darwin_arches
4239 } # !$opt_dry_run
4242 func_extract_an_archive "$my_xdir" "$my_xabs"
4244 esac
4245 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
4246 done
4248 func_extract_archives_result="$my_oldobjs"
4252 # func_emit_wrapper [arg=no]
4254 # Emit a libtool wrapper script on stdout.
4255 # Don't directly open a file because we may want to
4256 # incorporate the script contents within a cygwin/mingw
4257 # wrapper executable. Must ONLY be called from within
4258 # func_mode_link because it depends on a number of variables
4259 # set therein.
4261 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
4262 # variable will take. If 'yes', then the emitted script
4263 # will assume that the directory in which it is stored is
4264 # the $objdir directory. This is a cygwin/mingw-specific
4265 # behavior.
4266 func_emit_wrapper ()
4268 func_emit_wrapper_arg1=${1-no}
4270 $ECHO "\
4271 #! $SHELL
4273 # $output - temporary wrapper script for $objdir/$outputname
4274 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4276 # The $output program cannot be directly executed until all the libtool
4277 # libraries that it depends on are installed.
4279 # This wrapper script should never be moved out of the build directory.
4280 # If it is, it will not operate correctly.
4282 # Sed substitution that helps us do robust quoting. It backslashifies
4283 # metacharacters that are still active within double-quoted strings.
4284 sed_quote_subst='$sed_quote_subst'
4286 # Be Bourne compatible
4287 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
4288 emulate sh
4289 NULLCMD=:
4290 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
4291 # is contrary to our usage. Disable this feature.
4292 alias -g '\${1+\"\$@\"}'='\"\$@\"'
4293 setopt NO_GLOB_SUBST
4294 else
4295 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
4297 BIN_SH=xpg4; export BIN_SH # for Tru64
4298 DUALCASE=1; export DUALCASE # for MKS sh
4300 # The HP-UX ksh and POSIX shell print the target directory to stdout
4301 # if CDPATH is set.
4302 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4304 relink_command=\"$relink_command\"
4306 # This environment variable determines our operation mode.
4307 if test \"\$libtool_install_magic\" = \"$magic\"; then
4308 # install mode needs the following variables:
4309 generated_by_libtool_version='$macro_version'
4310 notinst_deplibs='$notinst_deplibs'
4311 else
4312 # When we are sourced in execute mode, \$file and \$ECHO are already set.
4313 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4314 file=\"\$0\""
4316 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
4317 $ECHO "\
4319 # A function that is used when there is no print builtin or printf.
4320 func_fallback_echo ()
4322 eval 'cat <<_LTECHO_EOF
4324 _LTECHO_EOF'
4326 ECHO=\"$qECHO\"
4329 # Very basic option parsing. These options are (a) specific to
4330 # the libtool wrapper, (b) are identical between the wrapper
4331 # /script/ and the wrapper /executable/ which is used only on
4332 # windows platforms, and (c) all begin with the string "--lt-"
4333 # (application programs are unlikely to have options which match
4334 # this pattern).
4336 # There are only two supported options: --lt-debug and
4337 # --lt-dump-script. There is, deliberately, no --lt-help.
4339 # The first argument to this parsing function should be the
4340 # script's $0 value, followed by "$@".
4341 lt_option_debug=
4342 func_parse_lt_options ()
4344 lt_script_arg0=\$0
4345 shift
4346 for lt_opt
4348 case \"\$lt_opt\" in
4349 --lt-debug) lt_option_debug=1 ;;
4350 --lt-dump-script)
4351 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
4352 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
4353 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
4354 cat \"\$lt_dump_D/\$lt_dump_F\"
4355 exit 0
4357 --lt-*)
4358 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
4359 exit 1
4361 esac
4362 done
4364 # Print the debug banner immediately:
4365 if test -n \"\$lt_option_debug\"; then
4366 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
4370 # Used when --lt-debug. Prints its arguments to stdout
4371 # (redirection is the responsibility of the caller)
4372 func_lt_dump_args ()
4374 lt_dump_args_N=1;
4375 for lt_arg
4377 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
4378 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
4379 done
4382 # Core function for launching the target application
4383 func_exec_program_core ()
4386 case $host in
4387 # Backslashes separate directories on plain windows
4388 *-*-mingw | *-*-os2* | *-cegcc*)
4389 $ECHO "\
4390 if test -n \"\$lt_option_debug\"; then
4391 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
4392 func_lt_dump_args \${1+\"\$@\"} 1>&2
4394 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4399 $ECHO "\
4400 if test -n \"\$lt_option_debug\"; then
4401 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4402 func_lt_dump_args \${1+\"\$@\"} 1>&2
4404 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4407 esac
4408 $ECHO "\
4409 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4410 exit 1
4413 # A function to encapsulate launching the target application
4414 # Strips options in the --lt-* namespace from \$@ and
4415 # launches target application with the remaining arguments.
4416 func_exec_program ()
4418 for lt_wr_arg
4420 case \$lt_wr_arg in
4421 --lt-*) ;;
4422 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4423 esac
4424 shift
4425 done
4426 func_exec_program_core \${1+\"\$@\"}
4429 # Parse options
4430 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4432 # Find the directory that this script lives in.
4433 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4434 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4436 # Follow symbolic links until we get to the real thisdir.
4437 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4438 while test -n \"\$file\"; do
4439 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4441 # If there was a directory component, then change thisdir.
4442 if test \"x\$destdir\" != \"x\$file\"; then
4443 case \"\$destdir\" in
4444 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4445 *) thisdir=\"\$thisdir/\$destdir\" ;;
4446 esac
4449 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4450 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4451 done
4453 # Usually 'no', except on cygwin/mingw when embedded into
4454 # the cwrapper.
4455 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4456 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4457 # special case for '.'
4458 if test \"\$thisdir\" = \".\"; then
4459 thisdir=\`pwd\`
4461 # remove .libs from thisdir
4462 case \"\$thisdir\" in
4463 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4464 $objdir ) thisdir=. ;;
4465 esac
4468 # Try to get the absolute directory name.
4469 absdir=\`cd \"\$thisdir\" && pwd\`
4470 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4473 if test "$fast_install" = yes; then
4474 $ECHO "\
4475 program=lt-'$outputname'$exeext
4476 progdir=\"\$thisdir/$objdir\"
4478 if test ! -f \"\$progdir/\$program\" ||
4479 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4480 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4482 file=\"\$\$-\$program\"
4484 if test ! -d \"\$progdir\"; then
4485 $MKDIR \"\$progdir\"
4486 else
4487 $RM \"\$progdir/\$file\"
4490 $ECHO "\
4492 # relink executable if necessary
4493 if test -n \"\$relink_command\"; then
4494 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4495 else
4496 $ECHO \"\$relink_command_output\" >&2
4497 $RM \"\$progdir/\$file\"
4498 exit 1
4502 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4503 { $RM \"\$progdir/\$program\";
4504 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4505 $RM \"\$progdir/\$file\"
4507 else
4508 $ECHO "\
4509 program='$outputname'
4510 progdir=\"\$thisdir/$objdir\"
4514 $ECHO "\
4516 if test -f \"\$progdir/\$program\"; then"
4518 # fixup the dll searchpath if we need to.
4520 # Fix the DLL searchpath if we need to. Do this before prepending
4521 # to shlibpath, because on Windows, both are PATH and uninstalled
4522 # libraries must come first.
4523 if test -n "$dllsearchpath"; then
4524 $ECHO "\
4525 # Add the dll search path components to the executable PATH
4526 PATH=$dllsearchpath:\$PATH
4530 # Export our shlibpath_var if we have one.
4531 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4532 $ECHO "\
4533 # Add our own library path to $shlibpath_var
4534 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4536 # Some systems cannot cope with colon-terminated $shlibpath_var
4537 # The second colon is a workaround for a bug in BeOS R4 sed
4538 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4540 export $shlibpath_var
4544 $ECHO "\
4545 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4546 # Run the actual program with our arguments.
4547 func_exec_program \${1+\"\$@\"}
4549 else
4550 # The program doesn't exist.
4551 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4552 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4553 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4554 exit 1
4561 # func_emit_cwrapperexe_src
4562 # emit the source code for a wrapper executable on stdout
4563 # Must ONLY be called from within func_mode_link because
4564 # it depends on a number of variable set therein.
4565 func_emit_cwrapperexe_src ()
4567 cat <<EOF
4569 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4570 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4572 The $output program cannot be directly executed until all the libtool
4573 libraries that it depends on are installed.
4575 This wrapper executable should never be moved out of the build directory.
4576 If it is, it will not operate correctly.
4579 cat <<"EOF"
4580 #ifdef _MSC_VER
4581 # define _CRT_SECURE_NO_DEPRECATE 1
4582 #endif
4583 #include <stdio.h>
4584 #include <stdlib.h>
4585 #ifdef _MSC_VER
4586 # include <direct.h>
4587 # include <process.h>
4588 # include <io.h>
4589 #else
4590 # include <unistd.h>
4591 # include <stdint.h>
4592 # ifdef __CYGWIN__
4593 # include <io.h>
4594 # endif
4595 #endif
4596 #include <malloc.h>
4597 #include <stdarg.h>
4598 #include <assert.h>
4599 #include <string.h>
4600 #include <ctype.h>
4601 #include <errno.h>
4602 #include <fcntl.h>
4603 #include <sys/stat.h>
4605 /* declarations of non-ANSI functions */
4606 #if defined(__MINGW32__)
4607 # ifdef __STRICT_ANSI__
4608 int _putenv (const char *);
4609 # endif
4610 #elif defined(__CYGWIN__)
4611 # ifdef __STRICT_ANSI__
4612 char *realpath (const char *, char *);
4613 int putenv (char *);
4614 int setenv (const char *, const char *, int);
4615 # endif
4616 /* #elif defined (other platforms) ... */
4617 #endif
4619 /* portability defines, excluding path handling macros */
4620 #if defined(_MSC_VER)
4621 # define setmode _setmode
4622 # define stat _stat
4623 # define chmod _chmod
4624 # define getcwd _getcwd
4625 # define putenv _putenv
4626 # define S_IXUSR _S_IEXEC
4627 # ifndef _INTPTR_T_DEFINED
4628 # define _INTPTR_T_DEFINED
4629 # define intptr_t int
4630 # endif
4631 #elif defined(__MINGW32__)
4632 # define setmode _setmode
4633 # define stat _stat
4634 # define chmod _chmod
4635 # define getcwd _getcwd
4636 # define putenv _putenv
4637 #elif defined(__CYGWIN__)
4638 # define HAVE_SETENV
4639 # define FOPEN_WB "wb"
4640 /* #elif defined (other platforms) ... */
4641 #endif
4643 #if defined(PATH_MAX)
4644 # define LT_PATHMAX PATH_MAX
4645 #elif defined(MAXPATHLEN)
4646 # define LT_PATHMAX MAXPATHLEN
4647 #else
4648 # define LT_PATHMAX 1024
4649 #endif
4651 #ifndef S_IXOTH
4652 # define S_IXOTH 0
4653 #endif
4654 #ifndef S_IXGRP
4655 # define S_IXGRP 0
4656 #endif
4658 /* path handling portability macros */
4659 #ifndef DIR_SEPARATOR
4660 # define DIR_SEPARATOR '/'
4661 # define PATH_SEPARATOR ':'
4662 #endif
4664 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4665 defined (__OS2__)
4666 # define HAVE_DOS_BASED_FILE_SYSTEM
4667 # define FOPEN_WB "wb"
4668 # ifndef DIR_SEPARATOR_2
4669 # define DIR_SEPARATOR_2 '\\'
4670 # endif
4671 # ifndef PATH_SEPARATOR_2
4672 # define PATH_SEPARATOR_2 ';'
4673 # endif
4674 #endif
4676 #ifndef DIR_SEPARATOR_2
4677 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4678 #else /* DIR_SEPARATOR_2 */
4679 # define IS_DIR_SEPARATOR(ch) \
4680 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4681 #endif /* DIR_SEPARATOR_2 */
4683 #ifndef PATH_SEPARATOR_2
4684 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4685 #else /* PATH_SEPARATOR_2 */
4686 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4687 #endif /* PATH_SEPARATOR_2 */
4689 #ifndef FOPEN_WB
4690 # define FOPEN_WB "w"
4691 #endif
4692 #ifndef _O_BINARY
4693 # define _O_BINARY 0
4694 #endif
4696 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4697 #define XFREE(stale) do { \
4698 if (stale) { free ((void *) stale); stale = 0; } \
4699 } while (0)
4701 #if defined(LT_DEBUGWRAPPER)
4702 static int lt_debug = 1;
4703 #else
4704 static int lt_debug = 0;
4705 #endif
4707 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4709 void *xmalloc (size_t num);
4710 char *xstrdup (const char *string);
4711 const char *base_name (const char *name);
4712 char *find_executable (const char *wrapper);
4713 char *chase_symlinks (const char *pathspec);
4714 int make_executable (const char *path);
4715 int check_executable (const char *path);
4716 char *strendzap (char *str, const char *pat);
4717 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4718 void lt_fatal (const char *file, int line, const char *message, ...);
4719 static const char *nonnull (const char *s);
4720 static const char *nonempty (const char *s);
4721 void lt_setenv (const char *name, const char *value);
4722 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4723 void lt_update_exe_path (const char *name, const char *value);
4724 void lt_update_lib_path (const char *name, const char *value);
4725 char **prepare_spawn (char **argv);
4726 void lt_dump_script (FILE *f);
4729 cat <<EOF
4730 volatile const char * MAGIC_EXE = "$magic_exe";
4731 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4734 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4735 func_to_host_path "$temp_rpath"
4736 cat <<EOF
4737 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4739 else
4740 cat <<"EOF"
4741 const char * LIB_PATH_VALUE = "";
4745 if test -n "$dllsearchpath"; then
4746 func_to_host_path "$dllsearchpath:"
4747 cat <<EOF
4748 const char * EXE_PATH_VARNAME = "PATH";
4749 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4751 else
4752 cat <<"EOF"
4753 const char * EXE_PATH_VARNAME = "";
4754 const char * EXE_PATH_VALUE = "";
4758 if test "$fast_install" = yes; then
4759 cat <<EOF
4760 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4762 else
4763 cat <<EOF
4764 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4769 cat <<"EOF"
4771 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4773 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4774 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4775 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4778 main (int argc, char *argv[])
4780 char **newargz;
4781 int newargc;
4782 char *tmp_pathspec;
4783 char *actual_cwrapper_path;
4784 char *actual_cwrapper_name;
4785 char *target_name;
4786 char *lt_argv_zero;
4787 intptr_t rval = 127;
4789 int i;
4791 program_name = (char *) xstrdup (base_name (argv[0]));
4792 newargz = XMALLOC (char *, argc + 1);
4794 /* very simple arg parsing; don't want to rely on getopt
4795 * also, copy all non cwrapper options to newargz, except
4796 * argz[0], which is handled differently
4798 newargc=0;
4799 for (i = 1; i < argc; i++)
4801 if (strcmp (argv[i], dumpscript_opt) == 0)
4804 case "$host" in
4805 *mingw* | *cygwin* )
4806 # make stdout use "unix" line endings
4807 echo " setmode(1,_O_BINARY);"
4809 esac
4811 cat <<"EOF"
4812 lt_dump_script (stdout);
4813 return 0;
4815 if (strcmp (argv[i], debug_opt) == 0)
4817 lt_debug = 1;
4818 continue;
4820 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4822 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4823 namespace, but it is not one of the ones we know about and
4824 have already dealt with, above (inluding dump-script), then
4825 report an error. Otherwise, targets might begin to believe
4826 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4827 namespace. The first time any user complains about this, we'll
4828 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4829 or a configure.ac-settable value.
4831 lt_fatal (__FILE__, __LINE__,
4832 "unrecognized %s option: '%s'",
4833 ltwrapper_option_prefix, argv[i]);
4835 /* otherwise ... */
4836 newargz[++newargc] = xstrdup (argv[i]);
4838 newargz[++newargc] = NULL;
4841 cat <<EOF
4842 /* The GNU banner must be the first non-error debug message */
4843 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4845 cat <<"EOF"
4846 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4847 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4849 tmp_pathspec = find_executable (argv[0]);
4850 if (tmp_pathspec == NULL)
4851 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4852 lt_debugprintf (__FILE__, __LINE__,
4853 "(main) found exe (before symlink chase) at: %s\n",
4854 tmp_pathspec);
4856 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4857 lt_debugprintf (__FILE__, __LINE__,
4858 "(main) found exe (after symlink chase) at: %s\n",
4859 actual_cwrapper_path);
4860 XFREE (tmp_pathspec);
4862 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4863 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4865 /* wrapper name transforms */
4866 strendzap (actual_cwrapper_name, ".exe");
4867 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4868 XFREE (actual_cwrapper_name);
4869 actual_cwrapper_name = tmp_pathspec;
4870 tmp_pathspec = 0;
4872 /* target_name transforms -- use actual target program name; might have lt- prefix */
4873 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4874 strendzap (target_name, ".exe");
4875 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4876 XFREE (target_name);
4877 target_name = tmp_pathspec;
4878 tmp_pathspec = 0;
4880 lt_debugprintf (__FILE__, __LINE__,
4881 "(main) libtool target name: %s\n",
4882 target_name);
4885 cat <<EOF
4886 newargz[0] =
4887 XMALLOC (char, (strlen (actual_cwrapper_path) +
4888 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4889 strcpy (newargz[0], actual_cwrapper_path);
4890 strcat (newargz[0], "$objdir");
4891 strcat (newargz[0], "/");
4894 cat <<"EOF"
4895 /* stop here, and copy so we don't have to do this twice */
4896 tmp_pathspec = xstrdup (newargz[0]);
4898 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4899 strcat (newargz[0], actual_cwrapper_name);
4901 /* DO want the lt- prefix here if it exists, so use target_name */
4902 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4903 XFREE (tmp_pathspec);
4904 tmp_pathspec = NULL;
4907 case $host_os in
4908 mingw*)
4909 cat <<"EOF"
4911 char* p;
4912 while ((p = strchr (newargz[0], '\\')) != NULL)
4914 *p = '/';
4916 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4918 *p = '/';
4923 esac
4925 cat <<"EOF"
4926 XFREE (target_name);
4927 XFREE (actual_cwrapper_path);
4928 XFREE (actual_cwrapper_name);
4930 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4931 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4932 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4933 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4934 because on Windows, both *_VARNAMEs are PATH but uninstalled
4935 libraries must come first. */
4936 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4937 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4939 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4940 nonnull (lt_argv_zero));
4941 for (i = 0; i < newargc; i++)
4943 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4944 i, nonnull (newargz[i]));
4949 case $host_os in
4950 mingw*)
4951 cat <<"EOF"
4952 /* execv doesn't actually work on mingw as expected on unix */
4953 newargz = prepare_spawn (newargz);
4954 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4955 if (rval == -1)
4957 /* failed to start process */
4958 lt_debugprintf (__FILE__, __LINE__,
4959 "(main) failed to launch target \"%s\": %s\n",
4960 lt_argv_zero, nonnull (strerror (errno)));
4961 return 127;
4963 return rval;
4967 cat <<"EOF"
4968 execv (lt_argv_zero, newargz);
4969 return rval; /* =127, but avoids unused variable warning */
4972 esac
4974 cat <<"EOF"
4977 void *
4978 xmalloc (size_t num)
4980 void *p = (void *) malloc (num);
4981 if (!p)
4982 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4984 return p;
4987 char *
4988 xstrdup (const char *string)
4990 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4991 string) : NULL;
4994 const char *
4995 base_name (const char *name)
4997 const char *base;
4999 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5000 /* Skip over the disk name in MSDOS pathnames. */
5001 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
5002 name += 2;
5003 #endif
5005 for (base = name; *name; name++)
5006 if (IS_DIR_SEPARATOR (*name))
5007 base = name + 1;
5008 return base;
5012 check_executable (const char *path)
5014 struct stat st;
5016 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
5017 nonempty (path));
5018 if ((!path) || (!*path))
5019 return 0;
5021 if ((stat (path, &st) >= 0)
5022 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
5023 return 1;
5024 else
5025 return 0;
5029 make_executable (const char *path)
5031 int rval = 0;
5032 struct stat st;
5034 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
5035 nonempty (path));
5036 if ((!path) || (!*path))
5037 return 0;
5039 if (stat (path, &st) >= 0)
5041 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
5043 return rval;
5046 /* Searches for the full path of the wrapper. Returns
5047 newly allocated full path name if found, NULL otherwise
5048 Does not chase symlinks, even on platforms that support them.
5050 char *
5051 find_executable (const char *wrapper)
5053 int has_slash = 0;
5054 const char *p;
5055 const char *p_next;
5056 /* static buffer for getcwd */
5057 char tmp[LT_PATHMAX + 1];
5058 int tmp_len;
5059 char *concat_name;
5061 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
5062 nonempty (wrapper));
5064 if ((wrapper == NULL) || (*wrapper == '\0'))
5065 return NULL;
5067 /* Absolute path? */
5068 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5069 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
5071 concat_name = xstrdup (wrapper);
5072 if (check_executable (concat_name))
5073 return concat_name;
5074 XFREE (concat_name);
5076 else
5078 #endif
5079 if (IS_DIR_SEPARATOR (wrapper[0]))
5081 concat_name = xstrdup (wrapper);
5082 if (check_executable (concat_name))
5083 return concat_name;
5084 XFREE (concat_name);
5086 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5088 #endif
5090 for (p = wrapper; *p; p++)
5091 if (*p == '/')
5093 has_slash = 1;
5094 break;
5096 if (!has_slash)
5098 /* no slashes; search PATH */
5099 const char *path = getenv ("PATH");
5100 if (path != NULL)
5102 for (p = path; *p; p = p_next)
5104 const char *q;
5105 size_t p_len;
5106 for (q = p; *q; q++)
5107 if (IS_PATH_SEPARATOR (*q))
5108 break;
5109 p_len = q - p;
5110 p_next = (*q == '\0' ? q : q + 1);
5111 if (p_len == 0)
5113 /* empty path: current directory */
5114 if (getcwd (tmp, LT_PATHMAX) == NULL)
5115 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5116 nonnull (strerror (errno)));
5117 tmp_len = strlen (tmp);
5118 concat_name =
5119 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5120 memcpy (concat_name, tmp, tmp_len);
5121 concat_name[tmp_len] = '/';
5122 strcpy (concat_name + tmp_len + 1, wrapper);
5124 else
5126 concat_name =
5127 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
5128 memcpy (concat_name, p, p_len);
5129 concat_name[p_len] = '/';
5130 strcpy (concat_name + p_len + 1, wrapper);
5132 if (check_executable (concat_name))
5133 return concat_name;
5134 XFREE (concat_name);
5137 /* not found in PATH; assume curdir */
5139 /* Relative path | not found in path: prepend cwd */
5140 if (getcwd (tmp, LT_PATHMAX) == NULL)
5141 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5142 nonnull (strerror (errno)));
5143 tmp_len = strlen (tmp);
5144 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5145 memcpy (concat_name, tmp, tmp_len);
5146 concat_name[tmp_len] = '/';
5147 strcpy (concat_name + tmp_len + 1, wrapper);
5149 if (check_executable (concat_name))
5150 return concat_name;
5151 XFREE (concat_name);
5152 return NULL;
5155 char *
5156 chase_symlinks (const char *pathspec)
5158 #ifndef S_ISLNK
5159 return xstrdup (pathspec);
5160 #else
5161 char buf[LT_PATHMAX];
5162 struct stat s;
5163 char *tmp_pathspec = xstrdup (pathspec);
5164 char *p;
5165 int has_symlinks = 0;
5166 while (strlen (tmp_pathspec) && !has_symlinks)
5168 lt_debugprintf (__FILE__, __LINE__,
5169 "checking path component for symlinks: %s\n",
5170 tmp_pathspec);
5171 if (lstat (tmp_pathspec, &s) == 0)
5173 if (S_ISLNK (s.st_mode) != 0)
5175 has_symlinks = 1;
5176 break;
5179 /* search backwards for last DIR_SEPARATOR */
5180 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
5181 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5182 p--;
5183 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5185 /* no more DIR_SEPARATORS left */
5186 break;
5188 *p = '\0';
5190 else
5192 lt_fatal (__FILE__, __LINE__,
5193 "error accessing file \"%s\": %s",
5194 tmp_pathspec, nonnull (strerror (errno)));
5197 XFREE (tmp_pathspec);
5199 if (!has_symlinks)
5201 return xstrdup (pathspec);
5204 tmp_pathspec = realpath (pathspec, buf);
5205 if (tmp_pathspec == 0)
5207 lt_fatal (__FILE__, __LINE__,
5208 "could not follow symlinks for %s", pathspec);
5210 return xstrdup (tmp_pathspec);
5211 #endif
5214 char *
5215 strendzap (char *str, const char *pat)
5217 size_t len, patlen;
5219 assert (str != NULL);
5220 assert (pat != NULL);
5222 len = strlen (str);
5223 patlen = strlen (pat);
5225 if (patlen <= len)
5227 str += len - patlen;
5228 if (strcmp (str, pat) == 0)
5229 *str = '\0';
5231 return str;
5234 void
5235 lt_debugprintf (const char *file, int line, const char *fmt, ...)
5237 va_list args;
5238 if (lt_debug)
5240 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
5241 va_start (args, fmt);
5242 (void) vfprintf (stderr, fmt, args);
5243 va_end (args);
5247 static void
5248 lt_error_core (int exit_status, const char *file,
5249 int line, const char *mode,
5250 const char *message, va_list ap)
5252 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
5253 vfprintf (stderr, message, ap);
5254 fprintf (stderr, ".\n");
5256 if (exit_status >= 0)
5257 exit (exit_status);
5260 void
5261 lt_fatal (const char *file, int line, const char *message, ...)
5263 va_list ap;
5264 va_start (ap, message);
5265 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
5266 va_end (ap);
5269 static const char *
5270 nonnull (const char *s)
5272 return s ? s : "(null)";
5275 static const char *
5276 nonempty (const char *s)
5278 return (s && !*s) ? "(empty)" : nonnull (s);
5281 void
5282 lt_setenv (const char *name, const char *value)
5284 lt_debugprintf (__FILE__, __LINE__,
5285 "(lt_setenv) setting '%s' to '%s'\n",
5286 nonnull (name), nonnull (value));
5288 #ifdef HAVE_SETENV
5289 /* always make a copy, for consistency with !HAVE_SETENV */
5290 char *str = xstrdup (value);
5291 setenv (name, str, 1);
5292 #else
5293 int len = strlen (name) + 1 + strlen (value) + 1;
5294 char *str = XMALLOC (char, len);
5295 sprintf (str, "%s=%s", name, value);
5296 if (putenv (str) != EXIT_SUCCESS)
5298 XFREE (str);
5300 #endif
5304 char *
5305 lt_extend_str (const char *orig_value, const char *add, int to_end)
5307 char *new_value;
5308 if (orig_value && *orig_value)
5310 int orig_value_len = strlen (orig_value);
5311 int add_len = strlen (add);
5312 new_value = XMALLOC (char, add_len + orig_value_len + 1);
5313 if (to_end)
5315 strcpy (new_value, orig_value);
5316 strcpy (new_value + orig_value_len, add);
5318 else
5320 strcpy (new_value, add);
5321 strcpy (new_value + add_len, orig_value);
5324 else
5326 new_value = xstrdup (add);
5328 return new_value;
5331 void
5332 lt_update_exe_path (const char *name, const char *value)
5334 lt_debugprintf (__FILE__, __LINE__,
5335 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
5336 nonnull (name), nonnull (value));
5338 if (name && *name && value && *value)
5340 char *new_value = lt_extend_str (getenv (name), value, 0);
5341 /* some systems can't cope with a ':'-terminated path #' */
5342 int len = strlen (new_value);
5343 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
5345 new_value[len-1] = '\0';
5347 lt_setenv (name, new_value);
5348 XFREE (new_value);
5352 void
5353 lt_update_lib_path (const char *name, const char *value)
5355 lt_debugprintf (__FILE__, __LINE__,
5356 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
5357 nonnull (name), nonnull (value));
5359 if (name && *name && value && *value)
5361 char *new_value = lt_extend_str (getenv (name), value, 0);
5362 lt_setenv (name, new_value);
5363 XFREE (new_value);
5368 case $host_os in
5369 mingw*)
5370 cat <<"EOF"
5372 /* Prepares an argument vector before calling spawn().
5373 Note that spawn() does not by itself call the command interpreter
5374 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
5375 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
5376 GetVersionEx(&v);
5377 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
5378 }) ? "cmd.exe" : "command.com").
5379 Instead it simply concatenates the arguments, separated by ' ', and calls
5380 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
5381 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
5382 special way:
5383 - Space and tab are interpreted as delimiters. They are not treated as
5384 delimiters if they are surrounded by double quotes: "...".
5385 - Unescaped double quotes are removed from the input. Their only effect is
5386 that within double quotes, space and tab are treated like normal
5387 characters.
5388 - Backslashes not followed by double quotes are not special.
5389 - But 2*n+1 backslashes followed by a double quote become
5390 n backslashes followed by a double quote (n >= 0):
5391 \" -> "
5392 \\\" -> \"
5393 \\\\\" -> \\"
5395 #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"
5396 #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"
5397 char **
5398 prepare_spawn (char **argv)
5400 size_t argc;
5401 char **new_argv;
5402 size_t i;
5404 /* Count number of arguments. */
5405 for (argc = 0; argv[argc] != NULL; argc++)
5408 /* Allocate new argument vector. */
5409 new_argv = XMALLOC (char *, argc + 1);
5411 /* Put quoted arguments into the new argument vector. */
5412 for (i = 0; i < argc; i++)
5414 const char *string = argv[i];
5416 if (string[0] == '\0')
5417 new_argv[i] = xstrdup ("\"\"");
5418 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5420 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5421 size_t length;
5422 unsigned int backslashes;
5423 const char *s;
5424 char *quoted_string;
5425 char *p;
5427 length = 0;
5428 backslashes = 0;
5429 if (quote_around)
5430 length++;
5431 for (s = string; *s != '\0'; s++)
5433 char c = *s;
5434 if (c == '"')
5435 length += backslashes + 1;
5436 length++;
5437 if (c == '\\')
5438 backslashes++;
5439 else
5440 backslashes = 0;
5442 if (quote_around)
5443 length += backslashes + 1;
5445 quoted_string = XMALLOC (char, length + 1);
5447 p = quoted_string;
5448 backslashes = 0;
5449 if (quote_around)
5450 *p++ = '"';
5451 for (s = string; *s != '\0'; s++)
5453 char c = *s;
5454 if (c == '"')
5456 unsigned int j;
5457 for (j = backslashes + 1; j > 0; j--)
5458 *p++ = '\\';
5460 *p++ = c;
5461 if (c == '\\')
5462 backslashes++;
5463 else
5464 backslashes = 0;
5466 if (quote_around)
5468 unsigned int j;
5469 for (j = backslashes; j > 0; j--)
5470 *p++ = '\\';
5471 *p++ = '"';
5473 *p = '\0';
5475 new_argv[i] = quoted_string;
5477 else
5478 new_argv[i] = (char *) string;
5480 new_argv[argc] = NULL;
5482 return new_argv;
5486 esac
5488 cat <<"EOF"
5489 void lt_dump_script (FILE* f)
5492 func_emit_wrapper yes |
5493 $SED -e 's/\([\\"]\)/\\\1/g' \
5494 -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
5496 cat <<"EOF"
5500 # end: func_emit_cwrapperexe_src
5502 # func_win32_import_lib_p ARG
5503 # True if ARG is an import lib, as indicated by $file_magic_cmd
5504 func_win32_import_lib_p ()
5506 $opt_debug
5507 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5508 *import*) : ;;
5509 *) false ;;
5510 esac
5513 # func_mode_link arg...
5514 func_mode_link ()
5516 $opt_debug
5517 case $host in
5518 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5519 # It is impossible to link a dll without this setting, and
5520 # we shouldn't force the makefile maintainer to figure out
5521 # which system we are compiling for in order to pass an extra
5522 # flag for every libtool invocation.
5523 # allow_undefined=no
5525 # FIXME: Unfortunately, there are problems with the above when trying
5526 # to make a dll which has undefined symbols, in which case not
5527 # even a static library is built. For now, we need to specify
5528 # -no-undefined on the libtool link line when we can be certain
5529 # that all symbols are satisfied, otherwise we get a static library.
5530 allow_undefined=yes
5533 allow_undefined=yes
5535 esac
5536 libtool_args=$nonopt
5537 base_compile="$nonopt $@"
5538 compile_command=$nonopt
5539 finalize_command=$nonopt
5541 compile_rpath=
5542 finalize_rpath=
5543 compile_shlibpath=
5544 finalize_shlibpath=
5545 convenience=
5546 old_convenience=
5547 deplibs=
5548 old_deplibs=
5549 compiler_flags=
5550 linker_flags=
5551 dllsearchpath=
5552 lib_search_path=`pwd`
5553 inst_prefix_dir=
5554 new_inherited_linker_flags=
5556 avoid_version=no
5557 bindir=
5558 dlfiles=
5559 dlprefiles=
5560 dlself=no
5561 export_dynamic=no
5562 export_symbols=
5563 export_symbols_regex=
5564 generated=
5565 libobjs=
5566 ltlibs=
5567 module=no
5568 no_install=no
5569 objs=
5570 non_pic_objects=
5571 precious_files_regex=
5572 prefer_static_libs=no
5573 preload=no
5574 prev=
5575 prevarg=
5576 release=
5577 rpath=
5578 xrpath=
5579 perm_rpath=
5580 temp_rpath=
5581 thread_safe=no
5582 vinfo=
5583 vinfo_number=no
5584 weak_libs=
5585 single_module="${wl}-single_module"
5586 func_infer_tag $base_compile
5588 # We need to know -static, to get the right output filenames.
5589 for arg
5591 case $arg in
5592 -shared)
5593 test "$build_libtool_libs" != yes && \
5594 func_fatal_configuration "can not build a shared library"
5595 build_old_libs=no
5596 break
5598 -all-static | -static | -static-libtool-libs)
5599 case $arg in
5600 -all-static)
5601 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5602 func_warning "complete static linking is impossible in this configuration"
5604 if test -n "$link_static_flag"; then
5605 dlopen_self=$dlopen_self_static
5607 prefer_static_libs=yes
5609 -static)
5610 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5611 dlopen_self=$dlopen_self_static
5613 prefer_static_libs=built
5615 -static-libtool-libs)
5616 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5617 dlopen_self=$dlopen_self_static
5619 prefer_static_libs=yes
5621 esac
5622 build_libtool_libs=no
5623 build_old_libs=yes
5624 break
5626 esac
5627 done
5629 # See if our shared archives depend on static archives.
5630 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5632 # Go through the arguments, transforming them on the way.
5633 while test "$#" -gt 0; do
5634 arg="$1"
5635 shift
5636 func_quote_for_eval "$arg"
5637 qarg=$func_quote_for_eval_unquoted_result
5638 libtool_args+=" $func_quote_for_eval_result"
5640 # If the previous option needs an argument, assign it.
5641 if test -n "$prev"; then
5642 case $prev in
5643 output)
5644 compile_command+=" @OUTPUT@"
5645 finalize_command+=" @OUTPUT@"
5647 esac
5649 case $prev in
5650 bindir)
5651 bindir="$arg"
5652 prev=
5653 continue
5655 dlfiles|dlprefiles)
5656 if test "$preload" = no; then
5657 # Add the symbol object into the linking commands.
5658 compile_command+=" @SYMFILE@"
5659 finalize_command+=" @SYMFILE@"
5660 preload=yes
5662 case $arg in
5663 *.la | *.lo) ;; # We handle these cases below.
5664 force)
5665 if test "$dlself" = no; then
5666 dlself=needless
5667 export_dynamic=yes
5669 prev=
5670 continue
5672 self)
5673 if test "$prev" = dlprefiles; then
5674 dlself=yes
5675 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5676 dlself=yes
5677 else
5678 dlself=needless
5679 export_dynamic=yes
5681 prev=
5682 continue
5685 if test "$prev" = dlfiles; then
5686 dlfiles+=" $arg"
5687 else
5688 dlprefiles+=" $arg"
5690 prev=
5691 continue
5693 esac
5695 expsyms)
5696 export_symbols="$arg"
5697 test -f "$arg" \
5698 || func_fatal_error "symbol file \`$arg' does not exist"
5699 prev=
5700 continue
5702 expsyms_regex)
5703 export_symbols_regex="$arg"
5704 prev=
5705 continue
5707 framework)
5708 case $host in
5709 *-*-darwin*)
5710 case "$deplibs " in
5711 *" $qarg.ltframework "*) ;;
5712 *) deplibs+=" $qarg.ltframework" # this is fixed later
5714 esac
5716 esac
5717 prev=
5718 continue
5720 inst_prefix)
5721 inst_prefix_dir="$arg"
5722 prev=
5723 continue
5725 objectlist)
5726 if test -f "$arg"; then
5727 save_arg=$arg
5728 moreargs=
5729 for fil in `cat "$save_arg"`
5731 # moreargs+=" $fil"
5732 arg=$fil
5733 # A libtool-controlled object.
5735 # Check to see that this really is a libtool object.
5736 if func_lalib_unsafe_p "$arg"; then
5737 pic_object=
5738 non_pic_object=
5740 # Read the .lo file
5741 func_source "$arg"
5743 if test -z "$pic_object" ||
5744 test -z "$non_pic_object" ||
5745 test "$pic_object" = none &&
5746 test "$non_pic_object" = none; then
5747 func_fatal_error "cannot find name of object for \`$arg'"
5750 # Extract subdirectory from the argument.
5751 func_dirname "$arg" "/" ""
5752 xdir="$func_dirname_result"
5754 if test "$pic_object" != none; then
5755 # Prepend the subdirectory the object is found in.
5756 pic_object="$xdir$pic_object"
5758 if test "$prev" = dlfiles; then
5759 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5760 dlfiles+=" $pic_object"
5761 prev=
5762 continue
5763 else
5764 # If libtool objects are unsupported, then we need to preload.
5765 prev=dlprefiles
5769 # CHECK ME: I think I busted this. -Ossama
5770 if test "$prev" = dlprefiles; then
5771 # Preload the old-style object.
5772 dlprefiles+=" $pic_object"
5773 prev=
5776 # A PIC object.
5777 libobjs+=" $pic_object"
5778 arg="$pic_object"
5781 # Non-PIC object.
5782 if test "$non_pic_object" != none; then
5783 # Prepend the subdirectory the object is found in.
5784 non_pic_object="$xdir$non_pic_object"
5786 # A standard non-PIC object
5787 non_pic_objects+=" $non_pic_object"
5788 if test -z "$pic_object" || test "$pic_object" = none ; then
5789 arg="$non_pic_object"
5791 else
5792 # If the PIC object exists, use it instead.
5793 # $xdir was prepended to $pic_object above.
5794 non_pic_object="$pic_object"
5795 non_pic_objects+=" $non_pic_object"
5797 else
5798 # Only an error if not doing a dry-run.
5799 if $opt_dry_run; then
5800 # Extract subdirectory from the argument.
5801 func_dirname "$arg" "/" ""
5802 xdir="$func_dirname_result"
5804 func_lo2o "$arg"
5805 pic_object=$xdir$objdir/$func_lo2o_result
5806 non_pic_object=$xdir$func_lo2o_result
5807 libobjs+=" $pic_object"
5808 non_pic_objects+=" $non_pic_object"
5809 else
5810 func_fatal_error "\`$arg' is not a valid libtool object"
5813 done
5814 else
5815 func_fatal_error "link input file \`$arg' does not exist"
5817 arg=$save_arg
5818 prev=
5819 continue
5821 precious_regex)
5822 precious_files_regex="$arg"
5823 prev=
5824 continue
5826 release)
5827 release="-$arg"
5828 prev=
5829 continue
5831 rpath | xrpath)
5832 # We need an absolute path.
5833 case $arg in
5834 [\\/]* | [A-Za-z]:[\\/]*) ;;
5836 func_fatal_error "only absolute run-paths are allowed"
5838 esac
5839 if test "$prev" = rpath; then
5840 case "$rpath " in
5841 *" $arg "*) ;;
5842 *) rpath+=" $arg" ;;
5843 esac
5844 else
5845 case "$xrpath " in
5846 *" $arg "*) ;;
5847 *) xrpath+=" $arg" ;;
5848 esac
5850 prev=
5851 continue
5853 shrext)
5854 shrext_cmds="$arg"
5855 prev=
5856 continue
5858 weak)
5859 weak_libs+=" $arg"
5860 prev=
5861 continue
5863 xcclinker)
5864 linker_flags+=" $qarg"
5865 compiler_flags+=" $qarg"
5866 prev=
5867 compile_command+=" $qarg"
5868 finalize_command+=" $qarg"
5869 continue
5871 xcompiler)
5872 compiler_flags+=" $qarg"
5873 prev=
5874 compile_command+=" $qarg"
5875 finalize_command+=" $qarg"
5876 continue
5878 xlinker)
5879 linker_flags+=" $qarg"
5880 compiler_flags+=" $wl$qarg"
5881 prev=
5882 compile_command+=" $wl$qarg"
5883 finalize_command+=" $wl$qarg"
5884 continue
5887 eval "$prev=\"\$arg\""
5888 prev=
5889 continue
5891 esac
5892 fi # test -n "$prev"
5894 prevarg="$arg"
5896 case $arg in
5897 -all-static)
5898 if test -n "$link_static_flag"; then
5899 # See comment for -static flag below, for more details.
5900 compile_command+=" $link_static_flag"
5901 finalize_command+=" $link_static_flag"
5903 continue
5906 -allow-undefined)
5907 # FIXME: remove this flag sometime in the future.
5908 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5911 -avoid-version)
5912 avoid_version=yes
5913 continue
5916 -bindir)
5917 prev=bindir
5918 continue
5921 -dlopen)
5922 prev=dlfiles
5923 continue
5926 -dlpreopen)
5927 prev=dlprefiles
5928 continue
5931 -export-dynamic)
5932 export_dynamic=yes
5933 continue
5936 -export-symbols | -export-symbols-regex)
5937 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5938 func_fatal_error "more than one -exported-symbols argument is not allowed"
5940 if test "X$arg" = "X-export-symbols"; then
5941 prev=expsyms
5942 else
5943 prev=expsyms_regex
5945 continue
5948 -framework)
5949 prev=framework
5950 continue
5953 -inst-prefix-dir)
5954 prev=inst_prefix
5955 continue
5958 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5959 # so, if we see these flags be careful not to treat them like -L
5960 -L[A-Z][A-Z]*:*)
5961 case $with_gcc/$host in
5962 no/*-*-irix* | /*-*-irix*)
5963 compile_command+=" $arg"
5964 finalize_command+=" $arg"
5966 esac
5967 continue
5970 -L*)
5971 func_stripname "-L" '' "$arg"
5972 if test -z "$func_stripname_result"; then
5973 if test "$#" -gt 0; then
5974 func_fatal_error "require no space between \`-L' and \`$1'"
5975 else
5976 func_fatal_error "need path for \`-L' option"
5979 func_resolve_sysroot "$func_stripname_result"
5980 dir=$func_resolve_sysroot_result
5981 # We need an absolute path.
5982 case $dir in
5983 [\\/]* | [A-Za-z]:[\\/]*) ;;
5985 absdir=`cd "$dir" && pwd`
5986 test -z "$absdir" && \
5987 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5988 dir="$absdir"
5990 esac
5991 case "$deplibs " in
5992 *" -L$dir "* | *" $arg "*)
5993 # Will only happen for absolute or sysroot arguments
5996 # Preserve sysroot, but never include relative directories
5997 case $dir in
5998 [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs+=" $arg" ;;
5999 *) deplibs+=" -L$dir" ;;
6000 esac
6001 lib_search_path+=" $dir"
6003 esac
6004 case $host in
6005 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6006 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
6007 case :$dllsearchpath: in
6008 *":$dir:"*) ;;
6009 ::) dllsearchpath=$dir;;
6010 *) dllsearchpath+=":$dir";;
6011 esac
6012 case :$dllsearchpath: in
6013 *":$testbindir:"*) ;;
6014 ::) dllsearchpath=$testbindir;;
6015 *) dllsearchpath+=":$testbindir";;
6016 esac
6018 esac
6019 continue
6022 -l*)
6023 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
6024 case $host in
6025 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
6026 # These systems don't actually have a C or math library (as such)
6027 continue
6029 *-*-os2*)
6030 # These systems don't actually have a C library (as such)
6031 test "X$arg" = "X-lc" && continue
6033 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6034 # Do not include libc due to us having libc/libc_r.
6035 test "X$arg" = "X-lc" && continue
6037 *-*-rhapsody* | *-*-darwin1.[012])
6038 # Rhapsody C and math libraries are in the System framework
6039 deplibs+=" System.ltframework"
6040 continue
6042 *-*-sco3.2v5* | *-*-sco5v6*)
6043 # Causes problems with __ctype
6044 test "X$arg" = "X-lc" && continue
6046 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6047 # Compiler inserts libc in the correct place for threads to work
6048 test "X$arg" = "X-lc" && continue
6050 esac
6051 elif test "X$arg" = "X-lc_r"; then
6052 case $host in
6053 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6054 # Do not include libc_r directly, use -pthread flag.
6055 continue
6057 esac
6059 deplibs+=" $arg"
6060 continue
6063 -module)
6064 module=yes
6065 continue
6068 # Tru64 UNIX uses -model [arg] to determine the layout of C++
6069 # classes, name mangling, and exception handling.
6070 # Darwin uses the -arch flag to determine output architecture.
6071 -model|-arch|-isysroot|--sysroot)
6072 compiler_flags+=" $arg"
6073 compile_command+=" $arg"
6074 finalize_command+=" $arg"
6075 prev=xcompiler
6076 continue
6079 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
6080 compiler_flags+=" $arg"
6081 compile_command+=" $arg"
6082 finalize_command+=" $arg"
6083 case "$new_inherited_linker_flags " in
6084 *" $arg "*) ;;
6085 * ) new_inherited_linker_flags+=" $arg" ;;
6086 esac
6087 continue
6090 -multi_module)
6091 single_module="${wl}-multi_module"
6092 continue
6095 -no-fast-install)
6096 fast_install=no
6097 continue
6100 -no-install)
6101 case $host in
6102 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
6103 # The PATH hackery in wrapper scripts is required on Windows
6104 # and Darwin in order for the loader to find any dlls it needs.
6105 func_warning "\`-no-install' is ignored for $host"
6106 func_warning "assuming \`-no-fast-install' instead"
6107 fast_install=no
6109 *) no_install=yes ;;
6110 esac
6111 continue
6114 -no-undefined)
6115 allow_undefined=no
6116 continue
6119 -objectlist)
6120 prev=objectlist
6121 continue
6124 -o) prev=output ;;
6126 -precious-files-regex)
6127 prev=precious_regex
6128 continue
6131 -release)
6132 prev=release
6133 continue
6136 -rpath)
6137 prev=rpath
6138 continue
6142 prev=xrpath
6143 continue
6146 -R*)
6147 func_stripname '-R' '' "$arg"
6148 dir=$func_stripname_result
6149 # We need an absolute path.
6150 case $dir in
6151 [\\/]* | [A-Za-z]:[\\/]*) ;;
6153 func_stripname '=' '' "$dir"
6154 dir=$lt_sysroot$func_stripname_result
6157 func_fatal_error "only absolute run-paths are allowed"
6159 esac
6160 case "$xrpath " in
6161 *" $dir "*) ;;
6162 *) xrpath+=" $dir" ;;
6163 esac
6164 continue
6167 -shared)
6168 # The effects of -shared are defined in a previous loop.
6169 continue
6172 -shrext)
6173 prev=shrext
6174 continue
6177 -static | -static-libtool-libs)
6178 # The effects of -static are defined in a previous loop.
6179 # We used to do the same as -all-static on platforms that
6180 # didn't have a PIC flag, but the assumption that the effects
6181 # would be equivalent was wrong. It would break on at least
6182 # Digital Unix and AIX.
6183 continue
6186 -thread-safe)
6187 thread_safe=yes
6188 continue
6191 -version-info)
6192 prev=vinfo
6193 continue
6196 -version-number)
6197 prev=vinfo
6198 vinfo_number=yes
6199 continue
6202 -weak)
6203 prev=weak
6204 continue
6207 -Wc,*)
6208 func_stripname '-Wc,' '' "$arg"
6209 args=$func_stripname_result
6210 arg=
6211 save_ifs="$IFS"; IFS=','
6212 for flag in $args; do
6213 IFS="$save_ifs"
6214 func_quote_for_eval "$flag"
6215 arg+=" $func_quote_for_eval_result"
6216 compiler_flags+=" $func_quote_for_eval_result"
6217 done
6218 IFS="$save_ifs"
6219 func_stripname ' ' '' "$arg"
6220 arg=$func_stripname_result
6223 -Wl,*)
6224 func_stripname '-Wl,' '' "$arg"
6225 args=$func_stripname_result
6226 arg=
6227 save_ifs="$IFS"; IFS=','
6228 for flag in $args; do
6229 IFS="$save_ifs"
6230 func_quote_for_eval "$flag"
6231 arg+=" $wl$func_quote_for_eval_result"
6232 compiler_flags+=" $wl$func_quote_for_eval_result"
6233 linker_flags+=" $func_quote_for_eval_result"
6234 done
6235 IFS="$save_ifs"
6236 func_stripname ' ' '' "$arg"
6237 arg=$func_stripname_result
6240 -Xcompiler)
6241 prev=xcompiler
6242 continue
6245 -Xlinker)
6246 prev=xlinker
6247 continue
6250 -XCClinker)
6251 prev=xcclinker
6252 continue
6255 # -msg_* for osf cc
6256 -msg_*)
6257 func_quote_for_eval "$arg"
6258 arg="$func_quote_for_eval_result"
6261 # Flags to be passed through unchanged, with rationale:
6262 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
6263 # -r[0-9][0-9]* specify processor for the SGI compiler
6264 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
6265 # +DA*, +DD* enable 64-bit mode for the HP compiler
6266 # -q* compiler args for the IBM compiler
6267 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
6268 # -F/path path to uninstalled frameworks, gcc on darwin
6269 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
6270 # @file GCC response files
6271 # -tp=* Portland pgcc target processor selection
6272 # --sysroot=* for sysroot support
6273 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
6274 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
6275 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
6276 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
6277 func_quote_for_eval "$arg"
6278 arg="$func_quote_for_eval_result"
6279 compile_command+=" $arg"
6280 finalize_command+=" $arg"
6281 compiler_flags+=" $arg"
6282 continue
6285 # Some other compiler flag.
6286 -* | +*)
6287 func_quote_for_eval "$arg"
6288 arg="$func_quote_for_eval_result"
6291 *.$objext)
6292 # A standard object.
6293 objs+=" $arg"
6296 *.lo)
6297 # A libtool-controlled object.
6299 # Check to see that this really is a libtool object.
6300 if func_lalib_unsafe_p "$arg"; then
6301 pic_object=
6302 non_pic_object=
6304 # Read the .lo file
6305 func_source "$arg"
6307 if test -z "$pic_object" ||
6308 test -z "$non_pic_object" ||
6309 test "$pic_object" = none &&
6310 test "$non_pic_object" = none; then
6311 func_fatal_error "cannot find name of object for \`$arg'"
6314 # Extract subdirectory from the argument.
6315 func_dirname "$arg" "/" ""
6316 xdir="$func_dirname_result"
6318 if test "$pic_object" != none; then
6319 # Prepend the subdirectory the object is found in.
6320 pic_object="$xdir$pic_object"
6322 if test "$prev" = dlfiles; then
6323 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
6324 dlfiles+=" $pic_object"
6325 prev=
6326 continue
6327 else
6328 # If libtool objects are unsupported, then we need to preload.
6329 prev=dlprefiles
6333 # CHECK ME: I think I busted this. -Ossama
6334 if test "$prev" = dlprefiles; then
6335 # Preload the old-style object.
6336 dlprefiles+=" $pic_object"
6337 prev=
6340 # A PIC object.
6341 libobjs+=" $pic_object"
6342 arg="$pic_object"
6345 # Non-PIC object.
6346 if test "$non_pic_object" != none; then
6347 # Prepend the subdirectory the object is found in.
6348 non_pic_object="$xdir$non_pic_object"
6350 # A standard non-PIC object
6351 non_pic_objects+=" $non_pic_object"
6352 if test -z "$pic_object" || test "$pic_object" = none ; then
6353 arg="$non_pic_object"
6355 else
6356 # If the PIC object exists, use it instead.
6357 # $xdir was prepended to $pic_object above.
6358 non_pic_object="$pic_object"
6359 non_pic_objects+=" $non_pic_object"
6361 else
6362 # Only an error if not doing a dry-run.
6363 if $opt_dry_run; then
6364 # Extract subdirectory from the argument.
6365 func_dirname "$arg" "/" ""
6366 xdir="$func_dirname_result"
6368 func_lo2o "$arg"
6369 pic_object=$xdir$objdir/$func_lo2o_result
6370 non_pic_object=$xdir$func_lo2o_result
6371 libobjs+=" $pic_object"
6372 non_pic_objects+=" $non_pic_object"
6373 else
6374 func_fatal_error "\`$arg' is not a valid libtool object"
6379 *.$libext)
6380 # An archive.
6381 deplibs+=" $arg"
6382 old_deplibs+=" $arg"
6383 continue
6386 *.la)
6387 # A libtool-controlled library.
6389 func_resolve_sysroot "$arg"
6390 if test "$prev" = dlfiles; then
6391 # This library was specified with -dlopen.
6392 dlfiles+=" $func_resolve_sysroot_result"
6393 prev=
6394 elif test "$prev" = dlprefiles; then
6395 # The library was specified with -dlpreopen.
6396 dlprefiles+=" $func_resolve_sysroot_result"
6397 prev=
6398 else
6399 deplibs+=" $func_resolve_sysroot_result"
6401 continue
6404 # Some other compiler argument.
6406 # Unknown arguments in both finalize_command and compile_command need
6407 # to be aesthetically quoted because they are evaled later.
6408 func_quote_for_eval "$arg"
6409 arg="$func_quote_for_eval_result"
6411 esac # arg
6413 # Now actually substitute the argument into the commands.
6414 if test -n "$arg"; then
6415 compile_command+=" $arg"
6416 finalize_command+=" $arg"
6418 done # argument parsing loop
6420 test -n "$prev" && \
6421 func_fatal_help "the \`$prevarg' option requires an argument"
6423 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6424 eval arg=\"$export_dynamic_flag_spec\"
6425 compile_command+=" $arg"
6426 finalize_command+=" $arg"
6429 oldlibs=
6430 # calculate the name of the file, without its directory
6431 func_basename "$output"
6432 outputname="$func_basename_result"
6433 libobjs_save="$libobjs"
6435 if test -n "$shlibpath_var"; then
6436 # get the directories listed in $shlibpath_var
6437 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6438 else
6439 shlib_search_path=
6441 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6442 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6444 func_dirname "$output" "/" ""
6445 output_objdir="$func_dirname_result$objdir"
6446 func_to_tool_file "$output_objdir/"
6447 tool_output_objdir=$func_to_tool_file_result
6448 # Create the object directory.
6449 func_mkdir_p "$output_objdir"
6451 # Determine the type of output
6452 case $output in
6454 func_fatal_help "you must specify an output file"
6456 *.$libext) linkmode=oldlib ;;
6457 *.lo | *.$objext) linkmode=obj ;;
6458 *.la) linkmode=lib ;;
6459 *) linkmode=prog ;; # Anything else should be a program.
6460 esac
6462 specialdeplibs=
6464 libs=
6465 # Find all interdependent deplibs by searching for libraries
6466 # that are linked more than once (e.g. -la -lb -la)
6467 for deplib in $deplibs; do
6468 if $opt_preserve_dup_deps ; then
6469 case "$libs " in
6470 *" $deplib "*) specialdeplibs+=" $deplib" ;;
6471 esac
6473 libs+=" $deplib"
6474 done
6476 if test "$linkmode" = lib; then
6477 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6479 # Compute libraries that are listed more than once in $predeps
6480 # $postdeps and mark them as special (i.e., whose duplicates are
6481 # not to be eliminated).
6482 pre_post_deps=
6483 if $opt_duplicate_compiler_generated_deps; then
6484 for pre_post_dep in $predeps $postdeps; do
6485 case "$pre_post_deps " in
6486 *" $pre_post_dep "*) specialdeplibs+=" $pre_post_deps" ;;
6487 esac
6488 pre_post_deps+=" $pre_post_dep"
6489 done
6491 pre_post_deps=
6494 deplibs=
6495 newdependency_libs=
6496 newlib_search_path=
6497 need_relink=no # whether we're linking any uninstalled libtool libraries
6498 notinst_deplibs= # not-installed libtool libraries
6499 notinst_path= # paths that contain not-installed libtool libraries
6501 case $linkmode in
6502 lib)
6503 passes="conv dlpreopen link"
6504 for file in $dlfiles $dlprefiles; do
6505 case $file in
6506 *.la) ;;
6508 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6510 esac
6511 done
6513 prog)
6514 compile_deplibs=
6515 finalize_deplibs=
6516 alldeplibs=no
6517 newdlfiles=
6518 newdlprefiles=
6519 passes="conv scan dlopen dlpreopen link"
6521 *) passes="conv"
6523 esac
6525 for pass in $passes; do
6526 # The preopen pass in lib mode reverses $deplibs; put it back here
6527 # so that -L comes before libs that need it for instance...
6528 if test "$linkmode,$pass" = "lib,link"; then
6529 ## FIXME: Find the place where the list is rebuilt in the wrong
6530 ## order, and fix it there properly
6531 tmp_deplibs=
6532 for deplib in $deplibs; do
6533 tmp_deplibs="$deplib $tmp_deplibs"
6534 done
6535 deplibs="$tmp_deplibs"
6538 if test "$linkmode,$pass" = "lib,link" ||
6539 test "$linkmode,$pass" = "prog,scan"; then
6540 libs="$deplibs"
6541 deplibs=
6543 if test "$linkmode" = prog; then
6544 case $pass in
6545 dlopen) libs="$dlfiles" ;;
6546 dlpreopen) libs="$dlprefiles" ;;
6547 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6548 esac
6550 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6551 # Collect and forward deplibs of preopened libtool libs
6552 for lib in $dlprefiles; do
6553 # Ignore non-libtool-libs
6554 dependency_libs=
6555 func_resolve_sysroot "$lib"
6556 case $lib in
6557 *.la) func_source "$func_resolve_sysroot_result" ;;
6558 esac
6560 # Collect preopened libtool deplibs, except any this library
6561 # has declared as weak libs
6562 for deplib in $dependency_libs; do
6563 func_basename "$deplib"
6564 deplib_base=$func_basename_result
6565 case " $weak_libs " in
6566 *" $deplib_base "*) ;;
6567 *) deplibs+=" $deplib" ;;
6568 esac
6569 done
6570 done
6571 libs="$dlprefiles"
6573 if test "$pass" = dlopen; then
6574 # Collect dlpreopened libraries
6575 save_deplibs="$deplibs"
6576 deplibs=
6579 for deplib in $libs; do
6580 lib=
6581 found=no
6582 case $deplib in
6583 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
6584 if test "$linkmode,$pass" = "prog,link"; then
6585 compile_deplibs="$deplib $compile_deplibs"
6586 finalize_deplibs="$deplib $finalize_deplibs"
6587 else
6588 compiler_flags+=" $deplib"
6589 if test "$linkmode" = lib ; then
6590 case "$new_inherited_linker_flags " in
6591 *" $deplib "*) ;;
6592 * ) new_inherited_linker_flags+=" $deplib" ;;
6593 esac
6596 continue
6598 -l*)
6599 if test "$linkmode" != lib && test "$linkmode" != prog; then
6600 func_warning "\`-l' is ignored for archives/objects"
6601 continue
6603 func_stripname '-l' '' "$deplib"
6604 name=$func_stripname_result
6605 if test "$linkmode" = lib; then
6606 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6607 else
6608 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6610 for searchdir in $searchdirs; do
6611 for search_ext in .la $std_shrext .so .a; do
6612 # Search the libtool library
6613 lib="$searchdir/lib${name}${search_ext}"
6614 if test -f "$lib"; then
6615 if test "$search_ext" = ".la"; then
6616 found=yes
6617 else
6618 found=no
6620 break 2
6622 done
6623 done
6624 if test "$found" != yes; then
6625 # deplib doesn't seem to be a libtool library
6626 if test "$linkmode,$pass" = "prog,link"; then
6627 compile_deplibs="$deplib $compile_deplibs"
6628 finalize_deplibs="$deplib $finalize_deplibs"
6629 else
6630 deplibs="$deplib $deplibs"
6631 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6633 continue
6634 else # deplib is a libtool library
6635 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6636 # We need to do some special things here, and not later.
6637 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6638 case " $predeps $postdeps " in
6639 *" $deplib "*)
6640 if func_lalib_p "$lib"; then
6641 library_names=
6642 old_library=
6643 func_source "$lib"
6644 for l in $old_library $library_names; do
6645 ll="$l"
6646 done
6647 if test "X$ll" = "X$old_library" ; then # only static version available
6648 found=no
6649 func_dirname "$lib" "" "."
6650 ladir="$func_dirname_result"
6651 lib=$ladir/$old_library
6652 if test "$linkmode,$pass" = "prog,link"; then
6653 compile_deplibs="$deplib $compile_deplibs"
6654 finalize_deplibs="$deplib $finalize_deplibs"
6655 else
6656 deplibs="$deplib $deplibs"
6657 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6659 continue
6663 *) ;;
6664 esac
6667 ;; # -l
6668 *.ltframework)
6669 if test "$linkmode,$pass" = "prog,link"; then
6670 compile_deplibs="$deplib $compile_deplibs"
6671 finalize_deplibs="$deplib $finalize_deplibs"
6672 else
6673 deplibs="$deplib $deplibs"
6674 if test "$linkmode" = lib ; then
6675 case "$new_inherited_linker_flags " in
6676 *" $deplib "*) ;;
6677 * ) new_inherited_linker_flags+=" $deplib" ;;
6678 esac
6681 continue
6683 -L*)
6684 case $linkmode in
6685 lib)
6686 deplibs="$deplib $deplibs"
6687 test "$pass" = conv && continue
6688 newdependency_libs="$deplib $newdependency_libs"
6689 func_stripname '-L' '' "$deplib"
6690 func_resolve_sysroot "$func_stripname_result"
6691 newlib_search_path+=" $func_resolve_sysroot_result"
6693 prog)
6694 if test "$pass" = conv; then
6695 deplibs="$deplib $deplibs"
6696 continue
6698 if test "$pass" = scan; then
6699 deplibs="$deplib $deplibs"
6700 else
6701 compile_deplibs="$deplib $compile_deplibs"
6702 finalize_deplibs="$deplib $finalize_deplibs"
6704 func_stripname '-L' '' "$deplib"
6705 func_resolve_sysroot "$func_stripname_result"
6706 newlib_search_path+=" $func_resolve_sysroot_result"
6709 func_warning "\`-L' is ignored for archives/objects"
6711 esac # linkmode
6712 continue
6713 ;; # -L
6714 -R*)
6715 if test "$pass" = link; then
6716 func_stripname '-R' '' "$deplib"
6717 func_resolve_sysroot "$func_stripname_result"
6718 dir=$func_resolve_sysroot_result
6719 # Make sure the xrpath contains only unique directories.
6720 case "$xrpath " in
6721 *" $dir "*) ;;
6722 *) xrpath+=" $dir" ;;
6723 esac
6725 deplibs="$deplib $deplibs"
6726 continue
6728 *.la)
6729 func_resolve_sysroot "$deplib"
6730 lib=$func_resolve_sysroot_result
6732 *.$libext)
6733 if test "$pass" = conv; then
6734 deplibs="$deplib $deplibs"
6735 continue
6737 case $linkmode in
6738 lib)
6739 # Linking convenience modules into shared libraries is allowed,
6740 # but linking other static libraries is non-portable.
6741 case " $dlpreconveniencelibs " in
6742 *" $deplib "*) ;;
6744 valid_a_lib=no
6745 case $deplibs_check_method in
6746 match_pattern*)
6747 set dummy $deplibs_check_method; shift
6748 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6749 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6750 | $EGREP "$match_pattern_regex" > /dev/null; then
6751 valid_a_lib=yes
6754 pass_all)
6755 valid_a_lib=yes
6757 esac
6758 if test "$valid_a_lib" != yes; then
6759 echo
6760 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6761 echo "*** I have the capability to make that library automatically link in when"
6762 echo "*** you link to this library. But I can only do this if you have a"
6763 echo "*** shared version of the library, which you do not appear to have"
6764 echo "*** because the file extensions .$libext of this argument makes me believe"
6765 echo "*** that it is just a static archive that I should not use here."
6766 else
6767 echo
6768 $ECHO "*** Warning: Linking the shared library $output against the"
6769 $ECHO "*** static library $deplib is not portable!"
6770 deplibs="$deplib $deplibs"
6773 esac
6774 continue
6776 prog)
6777 if test "$pass" != link; then
6778 deplibs="$deplib $deplibs"
6779 else
6780 compile_deplibs="$deplib $compile_deplibs"
6781 finalize_deplibs="$deplib $finalize_deplibs"
6783 continue
6785 esac # linkmode
6786 ;; # *.$libext
6787 *.lo | *.$objext)
6788 if test "$pass" = conv; then
6789 deplibs="$deplib $deplibs"
6790 elif test "$linkmode" = prog; then
6791 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6792 # If there is no dlopen support or we're linking statically,
6793 # we need to preload.
6794 newdlprefiles+=" $deplib"
6795 compile_deplibs="$deplib $compile_deplibs"
6796 finalize_deplibs="$deplib $finalize_deplibs"
6797 else
6798 newdlfiles+=" $deplib"
6801 continue
6803 %DEPLIBS%)
6804 alldeplibs=yes
6805 continue
6807 esac # case $deplib
6809 if test "$found" = yes || test -f "$lib"; then :
6810 else
6811 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6814 # Check to see that this really is a libtool archive.
6815 func_lalib_unsafe_p "$lib" \
6816 || func_fatal_error "\`$lib' is not a valid libtool archive"
6818 func_dirname "$lib" "" "."
6819 ladir="$func_dirname_result"
6821 dlname=
6822 dlopen=
6823 dlpreopen=
6824 libdir=
6825 library_names=
6826 old_library=
6827 inherited_linker_flags=
6828 # If the library was installed with an old release of libtool,
6829 # it will not redefine variables installed, or shouldnotlink
6830 installed=yes
6831 shouldnotlink=no
6832 avoidtemprpath=
6835 # Read the .la file
6836 func_source "$lib"
6838 # Convert "-framework foo" to "foo.ltframework"
6839 if test -n "$inherited_linker_flags"; then
6840 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6841 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6842 case " $new_inherited_linker_flags " in
6843 *" $tmp_inherited_linker_flag "*) ;;
6844 *) new_inherited_linker_flags+=" $tmp_inherited_linker_flag";;
6845 esac
6846 done
6848 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6849 if test "$linkmode,$pass" = "lib,link" ||
6850 test "$linkmode,$pass" = "prog,scan" ||
6851 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6852 test -n "$dlopen" && dlfiles+=" $dlopen"
6853 test -n "$dlpreopen" && dlprefiles+=" $dlpreopen"
6856 if test "$pass" = conv; then
6857 # Only check for convenience libraries
6858 deplibs="$lib $deplibs"
6859 if test -z "$libdir"; then
6860 if test -z "$old_library"; then
6861 func_fatal_error "cannot find name of link library for \`$lib'"
6863 # It is a libtool convenience library, so add in its objects.
6864 convenience+=" $ladir/$objdir/$old_library"
6865 old_convenience+=" $ladir/$objdir/$old_library"
6866 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6867 func_fatal_error "\`$lib' is not a convenience library"
6869 tmp_libs=
6870 for deplib in $dependency_libs; do
6871 deplibs="$deplib $deplibs"
6872 if $opt_preserve_dup_deps ; then
6873 case "$tmp_libs " in
6874 *" $deplib "*) specialdeplibs+=" $deplib" ;;
6875 esac
6877 tmp_libs+=" $deplib"
6878 done
6879 continue
6880 fi # $pass = conv
6883 # Get the name of the library we link against.
6884 linklib=
6885 if test -n "$old_library" &&
6886 { test "$prefer_static_libs" = yes ||
6887 test "$prefer_static_libs,$installed" = "built,no"; }; then
6888 linklib=$old_library
6889 else
6890 for l in $old_library $library_names; do
6891 linklib="$l"
6892 done
6894 if test -z "$linklib"; then
6895 func_fatal_error "cannot find name of link library for \`$lib'"
6898 # This library was specified with -dlopen.
6899 if test "$pass" = dlopen; then
6900 if test -z "$libdir"; then
6901 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6903 if test -z "$dlname" ||
6904 test "$dlopen_support" != yes ||
6905 test "$build_libtool_libs" = no; then
6906 # If there is no dlname, no dlopen support or we're linking
6907 # statically, we need to preload. We also need to preload any
6908 # dependent libraries so libltdl's deplib preloader doesn't
6909 # bomb out in the load deplibs phase.
6910 dlprefiles+=" $lib $dependency_libs"
6911 else
6912 newdlfiles+=" $lib"
6914 continue
6915 fi # $pass = dlopen
6917 # We need an absolute path.
6918 case $ladir in
6919 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6921 abs_ladir=`cd "$ladir" && pwd`
6922 if test -z "$abs_ladir"; then
6923 func_warning "cannot determine absolute directory name of \`$ladir'"
6924 func_warning "passing it literally to the linker, although it might fail"
6925 abs_ladir="$ladir"
6928 esac
6929 func_basename "$lib"
6930 laname="$func_basename_result"
6932 # Find the relevant object directory and library name.
6933 if test "X$installed" = Xyes; then
6934 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6935 func_warning "library \`$lib' was moved."
6936 dir="$ladir"
6937 absdir="$abs_ladir"
6938 libdir="$abs_ladir"
6939 else
6940 # Adding 'libdir' from the .la file to our library search paths
6941 # breaks crosscompilation horribly. We cheat here and don't add
6942 # it, instead adding the path where we found the .la. -CL
6943 dir="$lt_sysroot$abs_ladir"
6944 absdir="$abs_ladir"
6945 libdir="$abs_ladir"
6946 #dir="$libdir"
6947 #absdir="$lt_sysroot$libdir"
6949 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6950 else
6951 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6952 dir="$ladir"
6953 absdir="$abs_ladir"
6954 # Remove this search path later
6955 notinst_path+=" $abs_ladir"
6956 else
6957 dir="$ladir/$objdir"
6958 absdir="$abs_ladir/$objdir"
6959 # Remove this search path later
6960 notinst_path+=" $abs_ladir"
6962 fi # $installed = yes
6963 func_stripname 'lib' '.la' "$laname"
6964 name=$func_stripname_result
6966 # This library was specified with -dlpreopen.
6967 if test "$pass" = dlpreopen; then
6968 if test -z "$libdir" && test "$linkmode" = prog; then
6969 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6971 case "$host" in
6972 # special handling for platforms with PE-DLLs.
6973 *cygwin* | *mingw* | *cegcc* )
6974 # Linker will automatically link against shared library if both
6975 # static and shared are present. Therefore, ensure we extract
6976 # symbols from the import library if a shared library is present
6977 # (otherwise, the dlopen module name will be incorrect). We do
6978 # this by putting the import library name into $newdlprefiles.
6979 # We recover the dlopen module name by 'saving' the la file
6980 # name in a special purpose variable, and (later) extracting the
6981 # dlname from the la file.
6982 if test -n "$dlname"; then
6983 func_tr_sh "$dir/$linklib"
6984 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6985 newdlprefiles+=" $dir/$linklib"
6986 else
6987 newdlprefiles+=" $dir/$old_library"
6988 # Keep a list of preopened convenience libraries to check
6989 # that they are being used correctly in the link pass.
6990 test -z "$libdir" && \
6991 dlpreconveniencelibs+=" $dir/$old_library"
6995 # Prefer using a static library (so that no silly _DYNAMIC symbols
6996 # are required to link).
6997 if test -n "$old_library"; then
6998 newdlprefiles+=" $dir/$old_library"
6999 # Keep a list of preopened convenience libraries to check
7000 # that they are being used correctly in the link pass.
7001 test -z "$libdir" && \
7002 dlpreconveniencelibs+=" $dir/$old_library"
7003 # Otherwise, use the dlname, so that lt_dlopen finds it.
7004 elif test -n "$dlname"; then
7005 newdlprefiles+=" $dir/$dlname"
7006 else
7007 newdlprefiles+=" $dir/$linklib"
7010 esac
7011 fi # $pass = dlpreopen
7013 if test -z "$libdir"; then
7014 # Link the convenience library
7015 if test "$linkmode" = lib; then
7016 deplibs="$dir/$old_library $deplibs"
7017 elif test "$linkmode,$pass" = "prog,link"; then
7018 compile_deplibs="$dir/$old_library $compile_deplibs"
7019 finalize_deplibs="$dir/$old_library $finalize_deplibs"
7020 else
7021 deplibs="$lib $deplibs" # used for prog,scan pass
7023 continue
7027 if test "$linkmode" = prog && test "$pass" != link; then
7028 newlib_search_path+=" $ladir"
7029 deplibs="$lib $deplibs"
7031 linkalldeplibs=no
7032 if test "$link_all_deplibs" != no || test -z "$library_names" ||
7033 test "$build_libtool_libs" = no; then
7034 linkalldeplibs=yes
7037 tmp_libs=
7038 for deplib in $dependency_libs; do
7039 case $deplib in
7040 -L*) func_stripname '-L' '' "$deplib"
7041 func_resolve_sysroot "$func_stripname_result"
7042 newlib_search_path+=" $func_resolve_sysroot_result"
7044 esac
7045 # Need to link against all dependency_libs?
7046 if test "$linkalldeplibs" = yes; then
7047 deplibs="$deplib $deplibs"
7048 else
7049 # Need to hardcode shared library paths
7050 # or/and link against static libraries
7051 newdependency_libs="$deplib $newdependency_libs"
7053 if $opt_preserve_dup_deps ; then
7054 case "$tmp_libs " in
7055 *" $deplib "*) specialdeplibs+=" $deplib" ;;
7056 esac
7058 tmp_libs+=" $deplib"
7059 done # for deplib
7060 continue
7061 fi # $linkmode = prog...
7063 if test "$linkmode,$pass" = "prog,link"; then
7064 if test -n "$library_names" &&
7065 { { test "$prefer_static_libs" = no ||
7066 test "$prefer_static_libs,$installed" = "built,yes"; } ||
7067 test -z "$old_library"; }; then
7068 # We need to hardcode the library path
7069 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
7070 # Make sure the rpath contains only unique directories.
7071 case "$temp_rpath:" in
7072 *"$absdir:"*) ;;
7073 *) temp_rpath+="$absdir:" ;;
7074 esac
7077 # Hardcode the library path.
7078 # Skip directories that are in the system default run-time
7079 # search path.
7080 case " $sys_lib_dlsearch_path " in
7081 *" $absdir "*) ;;
7083 case "$compile_rpath " in
7084 *" $absdir "*) ;;
7085 *) compile_rpath+=" $absdir" ;;
7086 esac
7088 esac
7089 case " $sys_lib_dlsearch_path " in
7090 *" $libdir "*) ;;
7092 case "$finalize_rpath " in
7093 *" $libdir "*) ;;
7094 *) finalize_rpath+=" $libdir" ;;
7095 esac
7097 esac
7098 fi # $linkmode,$pass = prog,link...
7100 if test "$alldeplibs" = yes &&
7101 { test "$deplibs_check_method" = pass_all ||
7102 { test "$build_libtool_libs" = yes &&
7103 test -n "$library_names"; }; }; then
7104 # We only need to search for static libraries
7105 continue
7109 link_static=no # Whether the deplib will be linked statically
7110 use_static_libs=$prefer_static_libs
7111 if test "$use_static_libs" = built && test "$installed" = yes; then
7112 use_static_libs=no
7114 if test -n "$library_names" &&
7115 { test "$use_static_libs" = no || test -z "$old_library"; }; then
7116 case $host in
7117 *cygwin* | *mingw* | *cegcc*)
7118 # No point in relinking DLLs because paths are not encoded
7119 notinst_deplibs+=" $lib"
7120 need_relink=no
7123 if test "$installed" = no; then
7124 notinst_deplibs+=" $lib"
7125 need_relink=yes
7128 esac
7129 # This is a shared library
7131 # Warn about portability, can't link against -module's on some
7132 # systems (darwin). Don't bleat about dlopened modules though!
7133 dlopenmodule=""
7134 for dlpremoduletest in $dlprefiles; do
7135 if test "X$dlpremoduletest" = "X$lib"; then
7136 dlopenmodule="$dlpremoduletest"
7137 break
7139 done
7140 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
7141 echo
7142 if test "$linkmode" = prog; then
7143 $ECHO "*** Warning: Linking the executable $output against the loadable module"
7144 else
7145 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
7147 $ECHO "*** $linklib is not portable!"
7149 if test "$linkmode" = lib &&
7150 test "$hardcode_into_libs" = yes; then
7151 # Hardcode the library path.
7152 # Skip directories that are in the system default run-time
7153 # search path.
7154 case " $sys_lib_dlsearch_path " in
7155 *" $absdir "*) ;;
7157 case "$compile_rpath " in
7158 *" $absdir "*) ;;
7159 *) compile_rpath+=" $absdir" ;;
7160 esac
7162 esac
7163 case " $sys_lib_dlsearch_path " in
7164 *" $libdir "*) ;;
7166 case "$finalize_rpath " in
7167 *" $libdir "*) ;;
7168 *) finalize_rpath+=" $libdir" ;;
7169 esac
7171 esac
7174 if test -n "$old_archive_from_expsyms_cmds"; then
7175 # figure out the soname
7176 set dummy $library_names
7177 shift
7178 realname="$1"
7179 shift
7180 libname=`eval "\\$ECHO \"$libname_spec\""`
7181 # use dlname if we got it. it's perfectly good, no?
7182 if test -n "$dlname"; then
7183 soname="$dlname"
7184 elif test -n "$soname_spec"; then
7185 # bleh windows
7186 case $host in
7187 *cygwin* | mingw* | *cegcc*)
7188 func_arith $current - $age
7189 major=$func_arith_result
7190 versuffix="-$major"
7192 esac
7193 eval soname=\"$soname_spec\"
7194 else
7195 soname="$realname"
7198 # Make a new name for the extract_expsyms_cmds to use
7199 soroot="$soname"
7200 func_basename "$soroot"
7201 soname="$func_basename_result"
7202 func_stripname 'lib' '.dll' "$soname"
7203 newlib=libimp-$func_stripname_result.a
7205 # If the library has no export list, then create one now
7206 if test -f "$output_objdir/$soname-def"; then :
7207 else
7208 func_verbose "extracting exported symbol list from \`$soname'"
7209 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
7212 # Create $newlib
7213 if test -f "$output_objdir/$newlib"; then :; else
7214 func_verbose "generating import library for \`$soname'"
7215 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
7217 # make sure the library variables are pointing to the new library
7218 dir=$output_objdir
7219 linklib=$newlib
7220 fi # test -n "$old_archive_from_expsyms_cmds"
7222 if test "$linkmode" = prog || test "$opt_mode" != relink; then
7223 add_shlibpath=
7224 add_dir=
7225 add=
7226 lib_linked=yes
7227 case $hardcode_action in
7228 immediate | unsupported)
7229 if test "$hardcode_direct" = no; then
7230 add="$dir/$linklib"
7231 case $host in
7232 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
7233 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
7234 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
7235 *-*-unixware7*) add_dir="-L$dir" ;;
7236 *-*-darwin* )
7237 # if the lib is a (non-dlopened) module then we can not
7238 # link against it, someone is ignoring the earlier warnings
7239 if /usr/bin/file -L $add 2> /dev/null |
7240 $GREP ": [^:]* bundle" >/dev/null ; then
7241 if test "X$dlopenmodule" != "X$lib"; then
7242 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
7243 if test -z "$old_library" ; then
7244 echo
7245 echo "*** And there doesn't seem to be a static archive available"
7246 echo "*** The link will probably fail, sorry"
7247 else
7248 add="$dir/$old_library"
7250 elif test -n "$old_library"; then
7251 add="$dir/$old_library"
7254 esac
7255 elif test "$hardcode_minus_L" = no; then
7256 case $host in
7257 *-*-sunos*) add_shlibpath="$dir" ;;
7258 esac
7259 add_dir="-L$dir"
7260 add="-l$name"
7261 elif test "$hardcode_shlibpath_var" = no; then
7262 add_shlibpath="$dir"
7263 add="-l$name"
7264 else
7265 lib_linked=no
7268 relink)
7269 if test "$hardcode_direct" = yes &&
7270 test "$hardcode_direct_absolute" = no; then
7271 add="$dir/$linklib"
7272 elif test "$hardcode_minus_L" = yes; then
7273 add_dir="-L$dir"
7274 # Try looking first in the location we're being installed to.
7275 if test -n "$inst_prefix_dir"; then
7276 case $libdir in
7277 [\\/]*)
7278 add_dir+=" -L$inst_prefix_dir$libdir"
7280 esac
7282 add="-l$name"
7283 elif test "$hardcode_shlibpath_var" = yes; then
7284 add_shlibpath="$dir"
7285 add="-l$name"
7286 else
7287 lib_linked=no
7290 *) lib_linked=no ;;
7291 esac
7293 if test "$lib_linked" != yes; then
7294 func_fatal_configuration "unsupported hardcode properties"
7297 if test -n "$add_shlibpath"; then
7298 case :$compile_shlibpath: in
7299 *":$add_shlibpath:"*) ;;
7300 *) compile_shlibpath+="$add_shlibpath:" ;;
7301 esac
7303 if test "$linkmode" = prog; then
7304 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
7305 test -n "$add" && compile_deplibs="$add $compile_deplibs"
7306 else
7307 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7308 test -n "$add" && deplibs="$add $deplibs"
7309 if test "$hardcode_direct" != yes &&
7310 test "$hardcode_minus_L" != yes &&
7311 test "$hardcode_shlibpath_var" = yes; then
7312 case :$finalize_shlibpath: in
7313 *":$libdir:"*) ;;
7314 *) finalize_shlibpath+="$libdir:" ;;
7315 esac
7320 if test "$linkmode" = prog || test "$opt_mode" = relink; then
7321 add_shlibpath=
7322 add_dir=
7323 add=
7324 # Finalize command for both is simple: just hardcode it.
7325 if test "$hardcode_direct" = yes &&
7326 test "$hardcode_direct_absolute" = no; then
7327 add="$libdir/$linklib"
7328 elif test "$hardcode_minus_L" = yes; then
7329 add="-l$name"
7330 elif test "$hardcode_shlibpath_var" = yes; then
7331 case :$finalize_shlibpath: in
7332 *":$libdir:"*) ;;
7333 *) finalize_shlibpath+="$libdir:" ;;
7334 esac
7335 add="-l$name"
7336 elif test "$hardcode_automatic" = yes; then
7337 if test -n "$inst_prefix_dir" &&
7338 test -f "$inst_prefix_dir$libdir/$linklib" ; then
7339 add="$inst_prefix_dir$libdir/$linklib"
7340 else
7341 add="$libdir/$linklib"
7343 else
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 # OE sets installed=no in staging. We need to look in $objdir and $absdir,
7499 # preferring $objdir. RP 31/04/2008
7500 if test -f "$absdir/$objdir/$depdepl" ; then
7501 depdepl="$absdir/$objdir/$depdepl"
7502 path="-L$absdir/$objdir"
7503 elif test -f "$absdir/$depdepl" ; then
7504 depdepl="$absdir/$depdepl"
7505 path="-L$absdir"
7506 else
7507 path="-L$absdir/$objdir"
7510 esac
7511 else
7512 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7513 test -z "$libdir" && \
7514 func_fatal_error "\`$deplib' is not a valid libtool archive"
7515 test "$absdir" != "$libdir" && \
7516 func_warning "\`$deplib' seems to be moved"
7518 path="-L$absdir"
7521 esac
7522 case " $deplibs " in
7523 *" $path "*) ;;
7524 *) deplibs="$path $deplibs" ;;
7525 esac
7526 done
7527 fi # link_all_deplibs != no
7528 fi # linkmode = lib
7529 done # for deplib in $libs
7530 if test "$pass" = link; then
7531 if test "$linkmode" = "prog"; then
7532 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7533 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7534 else
7535 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7538 dependency_libs="$newdependency_libs"
7539 if test "$pass" = dlpreopen; then
7540 # Link the dlpreopened libraries before other libraries
7541 for deplib in $save_deplibs; do
7542 deplibs="$deplib $deplibs"
7543 done
7545 if test "$pass" != dlopen; then
7546 if test "$pass" != conv; then
7547 # Make sure lib_search_path contains only unique directories.
7548 lib_search_path=
7549 for dir in $newlib_search_path; do
7550 case "$lib_search_path " in
7551 *" $dir "*) ;;
7552 *) lib_search_path+=" $dir" ;;
7553 esac
7554 done
7555 newlib_search_path=
7558 if test "$linkmode,$pass" != "prog,link"; then
7559 vars="deplibs"
7560 else
7561 vars="compile_deplibs finalize_deplibs"
7563 for var in $vars dependency_libs; do
7564 # Add libraries to $var in reverse order
7565 eval tmp_libs=\"\$$var\"
7566 new_libs=
7567 for deplib in $tmp_libs; do
7568 # FIXME: Pedantically, this is the right thing to do, so
7569 # that some nasty dependency loop isn't accidentally
7570 # broken:
7571 #new_libs="$deplib $new_libs"
7572 # Pragmatically, this seems to cause very few problems in
7573 # practice:
7574 case $deplib in
7575 -L*) new_libs="$deplib $new_libs" ;;
7576 -R*) ;;
7578 # And here is the reason: when a library appears more
7579 # than once as an explicit dependence of a library, or
7580 # is implicitly linked in more than once by the
7581 # compiler, it is considered special, and multiple
7582 # occurrences thereof are not removed. Compare this
7583 # with having the same library being listed as a
7584 # dependency of multiple other libraries: in this case,
7585 # we know (pedantically, we assume) the library does not
7586 # need to be listed more than once, so we keep only the
7587 # last copy. This is not always right, but it is rare
7588 # enough that we require users that really mean to play
7589 # such unportable linking tricks to link the library
7590 # using -Wl,-lname, so that libtool does not consider it
7591 # for duplicate removal.
7592 case " $specialdeplibs " in
7593 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7595 case " $new_libs " in
7596 *" $deplib "*) ;;
7597 *) new_libs="$deplib $new_libs" ;;
7598 esac
7600 esac
7602 esac
7603 done
7604 tmp_libs=
7605 for deplib in $new_libs; do
7606 case $deplib in
7607 -L*)
7608 case " $tmp_libs " in
7609 *" $deplib "*) ;;
7610 *) tmp_libs+=" $deplib" ;;
7611 esac
7613 *) tmp_libs+=" $deplib" ;;
7614 esac
7615 done
7616 eval $var=\"$tmp_libs\"
7617 done # for var
7619 # Last step: remove runtime libs from dependency_libs
7620 # (they stay in deplibs)
7621 tmp_libs=
7622 for i in $dependency_libs ; do
7623 case " $predeps $postdeps $compiler_lib_search_path " in
7624 *" $i "*)
7625 i=""
7627 esac
7628 if test -n "$i" ; then
7629 tmp_libs+=" $i"
7631 done
7632 dependency_libs=$tmp_libs
7633 done # for pass
7634 if test "$linkmode" = prog; then
7635 dlfiles="$newdlfiles"
7637 if test "$linkmode" = prog || test "$linkmode" = lib; then
7638 dlprefiles="$newdlprefiles"
7641 case $linkmode in
7642 oldlib)
7643 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7644 func_warning "\`-dlopen' is ignored for archives"
7647 case " $deplibs" in
7648 *\ -l* | *\ -L*)
7649 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7650 esac
7652 test -n "$rpath" && \
7653 func_warning "\`-rpath' is ignored for archives"
7655 test -n "$xrpath" && \
7656 func_warning "\`-R' is ignored for archives"
7658 test -n "$vinfo" && \
7659 func_warning "\`-version-info/-version-number' is ignored for archives"
7661 test -n "$release" && \
7662 func_warning "\`-release' is ignored for archives"
7664 test -n "$export_symbols$export_symbols_regex" && \
7665 func_warning "\`-export-symbols' is ignored for archives"
7667 # Now set the variables for building old libraries.
7668 build_libtool_libs=no
7669 oldlibs="$output"
7670 objs+="$old_deplibs"
7673 lib)
7674 # Make sure we only generate libraries of the form `libNAME.la'.
7675 case $outputname in
7676 lib*)
7677 func_stripname 'lib' '.la' "$outputname"
7678 name=$func_stripname_result
7679 eval shared_ext=\"$shrext_cmds\"
7680 eval libname=\"$libname_spec\"
7683 test "$module" = no && \
7684 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7686 if test "$need_lib_prefix" != no; then
7687 # Add the "lib" prefix for modules if required
7688 func_stripname '' '.la' "$outputname"
7689 name=$func_stripname_result
7690 eval shared_ext=\"$shrext_cmds\"
7691 eval libname=\"$libname_spec\"
7692 else
7693 func_stripname '' '.la' "$outputname"
7694 libname=$func_stripname_result
7697 esac
7699 if test -n "$objs"; then
7700 if test "$deplibs_check_method" != pass_all; then
7701 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7702 else
7703 echo
7704 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7705 $ECHO "*** objects $objs is not portable!"
7706 libobjs+=" $objs"
7710 test "$dlself" != no && \
7711 func_warning "\`-dlopen self' is ignored for libtool libraries"
7713 set dummy $rpath
7714 shift
7715 test "$#" -gt 1 && \
7716 func_warning "ignoring multiple \`-rpath's for a libtool library"
7718 install_libdir="$1"
7720 oldlibs=
7721 if test -z "$rpath"; then
7722 if test "$build_libtool_libs" = yes; then
7723 # Building a libtool convenience library.
7724 # Some compilers have problems with a `.al' extension so
7725 # convenience libraries should have the same extension an
7726 # archive normally would.
7727 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7728 build_libtool_libs=convenience
7729 build_old_libs=yes
7732 test -n "$vinfo" && \
7733 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7735 test -n "$release" && \
7736 func_warning "\`-release' is ignored for convenience libraries"
7737 else
7739 # Parse the version information argument.
7740 save_ifs="$IFS"; IFS=':'
7741 set dummy $vinfo 0 0 0
7742 shift
7743 IFS="$save_ifs"
7745 test -n "$7" && \
7746 func_fatal_help "too many parameters to \`-version-info'"
7748 # convert absolute version numbers to libtool ages
7749 # this retains compatibility with .la files and attempts
7750 # to make the code below a bit more comprehensible
7752 case $vinfo_number in
7753 yes)
7754 number_major="$1"
7755 number_minor="$2"
7756 number_revision="$3"
7758 # There are really only two kinds -- those that
7759 # use the current revision as the major version
7760 # and those that subtract age and use age as
7761 # a minor version. But, then there is irix
7762 # which has an extra 1 added just for fun
7764 case $version_type in
7765 darwin|linux|osf|windows|none)
7766 func_arith $number_major + $number_minor
7767 current=$func_arith_result
7768 age="$number_minor"
7769 revision="$number_revision"
7771 freebsd-aout|freebsd-elf|qnx|sunos)
7772 current="$number_major"
7773 revision="$number_minor"
7774 age="0"
7776 irix|nonstopux)
7777 func_arith $number_major + $number_minor
7778 current=$func_arith_result
7779 age="$number_minor"
7780 revision="$number_minor"
7781 lt_irix_increment=no
7783 esac
7786 current="$1"
7787 revision="$2"
7788 age="$3"
7790 esac
7792 # Check that each of the things are valid numbers.
7793 case $current in
7794 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]) ;;
7796 func_error "CURRENT \`$current' must be a nonnegative integer"
7797 func_fatal_error "\`$vinfo' is not valid version information"
7799 esac
7801 case $revision in
7802 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]) ;;
7804 func_error "REVISION \`$revision' must be a nonnegative integer"
7805 func_fatal_error "\`$vinfo' is not valid version information"
7807 esac
7809 case $age in
7810 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]) ;;
7812 func_error "AGE \`$age' must be a nonnegative integer"
7813 func_fatal_error "\`$vinfo' is not valid version information"
7815 esac
7817 if test "$age" -gt "$current"; then
7818 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7819 func_fatal_error "\`$vinfo' is not valid version information"
7822 # Calculate the version variables.
7823 major=
7824 versuffix=
7825 verstring=
7826 case $version_type in
7827 none) ;;
7829 darwin)
7830 # Like Linux, but with the current version available in
7831 # verstring for coding it into the library header
7832 func_arith $current - $age
7833 major=.$func_arith_result
7834 versuffix="$major.$age.$revision"
7835 # Darwin ld doesn't like 0 for these options...
7836 func_arith $current + 1
7837 minor_current=$func_arith_result
7838 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7839 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7842 freebsd-aout)
7843 major=".$current"
7844 versuffix=".$current.$revision";
7847 freebsd-elf)
7848 major=".$current"
7849 versuffix=".$current"
7852 irix | nonstopux)
7853 if test "X$lt_irix_increment" = "Xno"; then
7854 func_arith $current - $age
7855 else
7856 func_arith $current - $age + 1
7858 major=$func_arith_result
7860 case $version_type in
7861 nonstopux) verstring_prefix=nonstopux ;;
7862 *) verstring_prefix=sgi ;;
7863 esac
7864 verstring="$verstring_prefix$major.$revision"
7866 # Add in all the interfaces that we are compatible with.
7867 loop=$revision
7868 while test "$loop" -ne 0; do
7869 func_arith $revision - $loop
7870 iface=$func_arith_result
7871 func_arith $loop - 1
7872 loop=$func_arith_result
7873 verstring="$verstring_prefix$major.$iface:$verstring"
7874 done
7876 # Before this point, $major must not contain `.'.
7877 major=.$major
7878 versuffix="$major.$revision"
7881 linux)
7882 func_arith $current - $age
7883 major=.$func_arith_result
7884 versuffix="$major.$age.$revision"
7887 osf)
7888 func_arith $current - $age
7889 major=.$func_arith_result
7890 versuffix=".$current.$age.$revision"
7891 verstring="$current.$age.$revision"
7893 # Add in all the interfaces that we are compatible with.
7894 loop=$age
7895 while test "$loop" -ne 0; do
7896 func_arith $current - $loop
7897 iface=$func_arith_result
7898 func_arith $loop - 1
7899 loop=$func_arith_result
7900 verstring="$verstring:${iface}.0"
7901 done
7903 # Make executables depend on our current version.
7904 verstring+=":${current}.0"
7907 qnx)
7908 major=".$current"
7909 versuffix=".$current"
7912 sunos)
7913 major=".$current"
7914 versuffix=".$current.$revision"
7917 windows)
7918 # Use '-' rather than '.', since we only want one
7919 # extension on DOS 8.3 filesystems.
7920 func_arith $current - $age
7921 major=$func_arith_result
7922 versuffix="-$major"
7926 func_fatal_configuration "unknown library version type \`$version_type'"
7928 esac
7930 # Clear the version info if we defaulted, and they specified a release.
7931 if test -z "$vinfo" && test -n "$release"; then
7932 major=
7933 case $version_type in
7934 darwin)
7935 # we can't check for "0.0" in archive_cmds due to quoting
7936 # problems, so we reset it completely
7937 verstring=
7940 verstring="0.0"
7942 esac
7943 if test "$need_version" = no; then
7944 versuffix=
7945 else
7946 versuffix=".0.0"
7950 # Remove version info from name if versioning should be avoided
7951 if test "$avoid_version" = yes && test "$need_version" = no; then
7952 major=
7953 versuffix=
7954 verstring=""
7957 # Check to see if the archive will have undefined symbols.
7958 if test "$allow_undefined" = yes; then
7959 if test "$allow_undefined_flag" = unsupported; then
7960 func_warning "undefined symbols not allowed in $host shared libraries"
7961 build_libtool_libs=no
7962 build_old_libs=yes
7964 else
7965 # Don't allow undefined symbols.
7966 allow_undefined_flag="$no_undefined_flag"
7971 func_generate_dlsyms "$libname" "$libname" "yes"
7972 libobjs+=" $symfileobj"
7973 test "X$libobjs" = "X " && libobjs=
7975 if test "$opt_mode" != relink; then
7976 # Remove our outputs, but don't remove object files since they
7977 # may have been created when compiling PIC objects.
7978 removelist=
7979 tempremovelist=`$ECHO "$output_objdir/*"`
7980 for p in $tempremovelist; do
7981 case $p in
7982 *.$objext | *.gcno)
7984 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7985 if test "X$precious_files_regex" != "X"; then
7986 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7987 then
7988 continue
7991 removelist+=" $p"
7993 *) ;;
7994 esac
7995 done
7996 test -n "$removelist" && \
7997 func_show_eval "${RM}r \$removelist"
8000 # Now set the variables for building old libraries.
8001 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
8002 oldlibs+=" $output_objdir/$libname.$libext"
8004 # Transform .lo files to .o files.
8005 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
8008 # Eliminate all temporary directories.
8009 #for path in $notinst_path; do
8010 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
8011 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
8012 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
8013 #done
8015 if test -n "$xrpath"; then
8016 # If the user specified any rpath flags, then add them.
8017 temp_xrpath=
8018 for libdir in $xrpath; do
8019 func_replace_sysroot "$libdir"
8020 temp_xrpath+=" -R$func_replace_sysroot_result"
8021 case "$finalize_rpath " in
8022 *" $libdir "*) ;;
8023 *) finalize_rpath+=" $libdir" ;;
8024 esac
8025 done
8026 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
8027 dependency_libs="$temp_xrpath $dependency_libs"
8031 # Make sure dlfiles contains only unique files that won't be dlpreopened
8032 old_dlfiles="$dlfiles"
8033 dlfiles=
8034 for lib in $old_dlfiles; do
8035 case " $dlprefiles $dlfiles " in
8036 *" $lib "*) ;;
8037 *) dlfiles+=" $lib" ;;
8038 esac
8039 done
8041 # Make sure dlprefiles contains only unique files
8042 old_dlprefiles="$dlprefiles"
8043 dlprefiles=
8044 for lib in $old_dlprefiles; do
8045 case "$dlprefiles " in
8046 *" $lib "*) ;;
8047 *) dlprefiles+=" $lib" ;;
8048 esac
8049 done
8051 if test "$build_libtool_libs" = yes; then
8052 if test -n "$rpath"; then
8053 case $host in
8054 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
8055 # these systems don't actually have a c library (as such)!
8057 *-*-rhapsody* | *-*-darwin1.[012])
8058 # Rhapsody C library is in the System framework
8059 deplibs+=" System.ltframework"
8061 *-*-netbsd*)
8062 # Don't link with libc until the a.out ld.so is fixed.
8064 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
8065 # Do not include libc due to us having libc/libc_r.
8067 *-*-sco3.2v5* | *-*-sco5v6*)
8068 # Causes problems with __ctype
8070 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
8071 # Compiler inserts libc in the correct place for threads to work
8074 # Add libc to deplibs on all other systems if necessary.
8075 if test "$build_libtool_need_lc" = "yes"; then
8076 deplibs+=" -lc"
8079 esac
8082 # Transform deplibs into only deplibs that can be linked in shared.
8083 name_save=$name
8084 libname_save=$libname
8085 release_save=$release
8086 versuffix_save=$versuffix
8087 major_save=$major
8088 # I'm not sure if I'm treating the release correctly. I think
8089 # release should show up in the -l (ie -lgmp5) so we don't want to
8090 # add it in twice. Is that correct?
8091 release=""
8092 versuffix=""
8093 major=""
8094 newdeplibs=
8095 droppeddeps=no
8096 case $deplibs_check_method in
8097 pass_all)
8098 # Don't check for shared/static. Everything works.
8099 # This might be a little naive. We might want to check
8100 # whether the library exists or not. But this is on
8101 # osf3 & osf4 and I'm not really sure... Just
8102 # implementing what was already the behavior.
8103 newdeplibs=$deplibs
8105 test_compile)
8106 # This code stresses the "libraries are programs" paradigm to its
8107 # limits. Maybe even breaks it. We compile a program, linking it
8108 # against the deplibs as a proxy for the library. Then we can check
8109 # whether they linked in statically or dynamically with ldd.
8110 $opt_dry_run || $RM conftest.c
8111 cat > conftest.c <<EOF
8112 int main() { return 0; }
8114 $opt_dry_run || $RM conftest
8115 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
8116 ldd_output=`ldd conftest`
8117 for i in $deplibs; do
8118 case $i in
8119 -l*)
8120 func_stripname -l '' "$i"
8121 name=$func_stripname_result
8122 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8123 case " $predeps $postdeps " in
8124 *" $i "*)
8125 newdeplibs+=" $i"
8126 i=""
8128 esac
8130 if test -n "$i" ; then
8131 libname=`eval "\\$ECHO \"$libname_spec\""`
8132 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8133 set dummy $deplib_matches; shift
8134 deplib_match=$1
8135 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
8136 newdeplibs+=" $i"
8137 else
8138 droppeddeps=yes
8139 echo
8140 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8141 echo "*** I have the capability to make that library automatically link in when"
8142 echo "*** you link to this library. But I can only do this if you have a"
8143 echo "*** shared version of the library, which I believe you do not have"
8144 echo "*** because a test_compile did reveal that the linker did not use it for"
8145 echo "*** its dynamic dependency list that programs get resolved with at runtime."
8150 newdeplibs+=" $i"
8152 esac
8153 done
8154 else
8155 # Error occurred in the first compile. Let's try to salvage
8156 # the situation: Compile a separate program for each library.
8157 for i in $deplibs; do
8158 case $i in
8159 -l*)
8160 func_stripname -l '' "$i"
8161 name=$func_stripname_result
8162 $opt_dry_run || $RM conftest
8163 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
8164 ldd_output=`ldd conftest`
8165 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8166 case " $predeps $postdeps " in
8167 *" $i "*)
8168 newdeplibs+=" $i"
8169 i=""
8171 esac
8173 if test -n "$i" ; then
8174 libname=`eval "\\$ECHO \"$libname_spec\""`
8175 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8176 set dummy $deplib_matches; shift
8177 deplib_match=$1
8178 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
8179 newdeplibs+=" $i"
8180 else
8181 droppeddeps=yes
8182 echo
8183 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8184 echo "*** I have the capability to make that library automatically link in when"
8185 echo "*** you link to this library. But I can only do this if you have a"
8186 echo "*** shared version of the library, which you do not appear to have"
8187 echo "*** because a test_compile did reveal that the linker did not use this one"
8188 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
8191 else
8192 droppeddeps=yes
8193 echo
8194 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
8195 echo "*** make it link in! You will probably need to install it or some"
8196 echo "*** library that it depends on before this library will be fully"
8197 echo "*** functional. Installing it before continuing would be even better."
8201 newdeplibs+=" $i"
8203 esac
8204 done
8207 file_magic*)
8208 set dummy $deplibs_check_method; shift
8209 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8210 for a_deplib in $deplibs; do
8211 case $a_deplib in
8212 -l*)
8213 func_stripname -l '' "$a_deplib"
8214 name=$func_stripname_result
8215 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8216 case " $predeps $postdeps " in
8217 *" $a_deplib "*)
8218 newdeplibs+=" $a_deplib"
8219 a_deplib=""
8221 esac
8223 if test -n "$a_deplib" ; then
8224 libname=`eval "\\$ECHO \"$libname_spec\""`
8225 if test -n "$file_magic_glob"; then
8226 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
8227 else
8228 libnameglob=$libname
8230 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
8231 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8232 if test "$want_nocaseglob" = yes; then
8233 shopt -s nocaseglob
8234 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8235 $nocaseglob
8236 else
8237 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8239 for potent_lib in $potential_libs; do
8240 # Follow soft links.
8241 if ls -lLd "$potent_lib" 2>/dev/null |
8242 $GREP " -> " >/dev/null; then
8243 continue
8245 # The statement above tries to avoid entering an
8246 # endless loop below, in case of cyclic links.
8247 # We might still enter an endless loop, since a link
8248 # loop can be closed while we follow links,
8249 # but so what?
8250 potlib="$potent_lib"
8251 while test -h "$potlib" 2>/dev/null; do
8252 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
8253 case $potliblink in
8254 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
8255 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
8256 esac
8257 done
8258 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
8259 $SED -e 10q |
8260 $EGREP "$file_magic_regex" > /dev/null; then
8261 newdeplibs+=" $a_deplib"
8262 a_deplib=""
8263 break 2
8265 done
8266 done
8268 if test -n "$a_deplib" ; then
8269 droppeddeps=yes
8270 echo
8271 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8272 echo "*** I have the capability to make that library automatically link in when"
8273 echo "*** you link to this library. But I can only do this if you have a"
8274 echo "*** shared version of the library, which you do not appear to have"
8275 echo "*** because I did check the linker path looking for a file starting"
8276 if test -z "$potlib" ; then
8277 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
8278 else
8279 $ECHO "*** with $libname and none of the candidates passed a file format test"
8280 $ECHO "*** using a file magic. Last file checked: $potlib"
8285 # Add a -L argument.
8286 newdeplibs+=" $a_deplib"
8288 esac
8289 done # Gone through all deplibs.
8291 match_pattern*)
8292 set dummy $deplibs_check_method; shift
8293 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8294 for a_deplib in $deplibs; do
8295 case $a_deplib in
8296 -l*)
8297 func_stripname -l '' "$a_deplib"
8298 name=$func_stripname_result
8299 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8300 case " $predeps $postdeps " in
8301 *" $a_deplib "*)
8302 newdeplibs+=" $a_deplib"
8303 a_deplib=""
8305 esac
8307 if test -n "$a_deplib" ; then
8308 libname=`eval "\\$ECHO \"$libname_spec\""`
8309 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8310 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
8311 for potent_lib in $potential_libs; do
8312 potlib="$potent_lib" # see symlink-check above in file_magic test
8313 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
8314 $EGREP "$match_pattern_regex" > /dev/null; then
8315 newdeplibs+=" $a_deplib"
8316 a_deplib=""
8317 break 2
8319 done
8320 done
8322 if test -n "$a_deplib" ; then
8323 droppeddeps=yes
8324 echo
8325 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8326 echo "*** I have the capability to make that library automatically link in when"
8327 echo "*** you link to this library. But I can only do this if you have a"
8328 echo "*** shared version of the library, which you do not appear to have"
8329 echo "*** because I did check the linker path looking for a file starting"
8330 if test -z "$potlib" ; then
8331 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
8332 else
8333 $ECHO "*** with $libname and none of the candidates passed a file format test"
8334 $ECHO "*** using a regex pattern. Last file checked: $potlib"
8339 # Add a -L argument.
8340 newdeplibs+=" $a_deplib"
8342 esac
8343 done # Gone through all deplibs.
8345 none | unknown | *)
8346 newdeplibs=""
8347 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
8348 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8349 for i in $predeps $postdeps ; do
8350 # can't use Xsed below, because $i might contain '/'
8351 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
8352 done
8354 case $tmp_deplibs in
8355 *[!\ \ ]*)
8356 echo
8357 if test "X$deplibs_check_method" = "Xnone"; then
8358 echo "*** Warning: inter-library dependencies are not supported in this platform."
8359 else
8360 echo "*** Warning: inter-library dependencies are not known to be supported."
8362 echo "*** All declared inter-library dependencies are being dropped."
8363 droppeddeps=yes
8365 esac
8367 esac
8368 versuffix=$versuffix_save
8369 major=$major_save
8370 release=$release_save
8371 libname=$libname_save
8372 name=$name_save
8374 case $host in
8375 *-*-rhapsody* | *-*-darwin1.[012])
8376 # On Rhapsody replace the C library with the System framework
8377 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
8379 esac
8381 if test "$droppeddeps" = yes; then
8382 if test "$module" = yes; then
8383 echo
8384 echo "*** Warning: libtool could not satisfy all declared inter-library"
8385 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
8386 echo "*** a static module, that should work as long as the dlopening"
8387 echo "*** application is linked with the -dlopen flag."
8388 if test -z "$global_symbol_pipe"; then
8389 echo
8390 echo "*** However, this would only work if libtool was able to extract symbol"
8391 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
8392 echo "*** not find such a program. So, this module is probably useless."
8393 echo "*** \`nm' from GNU binutils and a full rebuild may help."
8395 if test "$build_old_libs" = no; then
8396 oldlibs="$output_objdir/$libname.$libext"
8397 build_libtool_libs=module
8398 build_old_libs=yes
8399 else
8400 build_libtool_libs=no
8402 else
8403 echo "*** The inter-library dependencies that have been dropped here will be"
8404 echo "*** automatically added whenever a program is linked with this library"
8405 echo "*** or is declared to -dlopen it."
8407 if test "$allow_undefined" = no; then
8408 echo
8409 echo "*** Since this library must not contain undefined symbols,"
8410 echo "*** because either the platform does not support them or"
8411 echo "*** it was explicitly requested with -no-undefined,"
8412 echo "*** libtool will only create a static version of it."
8413 if test "$build_old_libs" = no; then
8414 oldlibs="$output_objdir/$libname.$libext"
8415 build_libtool_libs=module
8416 build_old_libs=yes
8417 else
8418 build_libtool_libs=no
8423 # Done checking deplibs!
8424 deplibs=$newdeplibs
8426 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8427 case $host in
8428 *-*-darwin*)
8429 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8430 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8431 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8433 esac
8435 # move library search paths that coincide with paths to not yet
8436 # installed libraries to the beginning of the library search list
8437 new_libs=
8438 for path in $notinst_path; do
8439 case " $new_libs " in
8440 *" -L$path/$objdir "*) ;;
8442 case " $deplibs " in
8443 *" -L$path/$objdir "*)
8444 new_libs+=" -L$path/$objdir" ;;
8445 esac
8447 esac
8448 done
8449 for deplib in $deplibs; do
8450 case $deplib in
8451 -L*)
8452 case " $new_libs " in
8453 *" $deplib "*) ;;
8454 *) new_libs+=" $deplib" ;;
8455 esac
8457 *) new_libs+=" $deplib" ;;
8458 esac
8459 done
8460 deplibs="$new_libs"
8462 # All the library-specific variables (install_libdir is set above).
8463 library_names=
8464 old_library=
8465 dlname=
8467 # Test again, we may have decided not to build it any more
8468 if test "$build_libtool_libs" = yes; then
8469 if test "$hardcode_into_libs" = yes; then
8470 # Hardcode the library paths
8471 hardcode_libdirs=
8472 dep_rpath=
8473 rpath="$finalize_rpath"
8474 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8475 for libdir in $rpath; do
8476 if test -n "$hardcode_libdir_flag_spec"; then
8477 if test -n "$hardcode_libdir_separator"; then
8478 func_replace_sysroot "$libdir"
8479 libdir=$func_replace_sysroot_result
8480 if test -z "$hardcode_libdirs"; then
8481 hardcode_libdirs="$libdir"
8482 else
8483 # Just accumulate the unique libdirs.
8484 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8485 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8488 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
8490 esac
8492 else
8493 eval flag=\"$hardcode_libdir_flag_spec\"
8494 dep_rpath+=" $flag"
8496 elif test -n "$runpath_var"; then
8497 case "$perm_rpath " in
8498 *" $libdir "*) ;;
8499 *) perm_rpath+=" $libdir" ;;
8500 esac
8502 done
8503 # Substitute the hardcoded libdirs into the rpath.
8504 if test -n "$hardcode_libdir_separator" &&
8505 test -n "$hardcode_libdirs"; then
8506 libdir="$hardcode_libdirs"
8507 if test -n "$hardcode_libdir_flag_spec_ld"; then
8508 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
8509 else
8510 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
8513 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8514 # We should set the runpath_var.
8515 rpath=
8516 for dir in $perm_rpath; do
8517 rpath+="$dir:"
8518 done
8519 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8521 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8524 shlibpath="$finalize_shlibpath"
8525 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8526 if test -n "$shlibpath"; then
8527 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8530 # Get the real and link names of the library.
8531 eval shared_ext=\"$shrext_cmds\"
8532 eval library_names=\"$library_names_spec\"
8533 set dummy $library_names
8534 shift
8535 realname="$1"
8536 shift
8538 if test -n "$soname_spec"; then
8539 eval soname=\"$soname_spec\"
8540 else
8541 soname="$realname"
8543 if test -z "$dlname"; then
8544 dlname=$soname
8547 lib="$output_objdir/$realname"
8548 linknames=
8549 for link
8551 linknames+=" $link"
8552 done
8554 # Use standard objects if they are pic
8555 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8556 test "X$libobjs" = "X " && libobjs=
8558 delfiles=
8559 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8560 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8561 export_symbols="$output_objdir/$libname.uexp"
8562 delfiles+=" $export_symbols"
8565 orig_export_symbols=
8566 case $host_os in
8567 cygwin* | mingw* | cegcc*)
8568 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8569 # exporting using user supplied symfile
8570 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8571 # and it's NOT already a .def file. Must figure out
8572 # which of the given symbols are data symbols and tag
8573 # them as such. So, trigger use of export_symbols_cmds.
8574 # export_symbols gets reassigned inside the "prepare
8575 # the list of exported symbols" if statement, so the
8576 # include_expsyms logic still works.
8577 orig_export_symbols="$export_symbols"
8578 export_symbols=
8579 always_export_symbols=yes
8583 esac
8585 # Prepare the list of exported symbols
8586 if test -z "$export_symbols"; then
8587 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8588 func_verbose "generating symbol list for \`$libname.la'"
8589 export_symbols="$output_objdir/$libname.exp"
8590 $opt_dry_run || $RM $export_symbols
8591 cmds=$export_symbols_cmds
8592 save_ifs="$IFS"; IFS='~'
8593 for cmd1 in $cmds; do
8594 IFS="$save_ifs"
8595 # Take the normal branch if the nm_file_list_spec branch
8596 # doesn't work or if tool conversion is not needed.
8597 case $nm_file_list_spec~$to_tool_file_cmd in
8598 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8599 try_normal_branch=yes
8600 eval cmd=\"$cmd1\"
8601 func_len " $cmd"
8602 len=$func_len_result
8605 try_normal_branch=no
8607 esac
8608 if test "$try_normal_branch" = yes \
8609 && { test "$len" -lt "$max_cmd_len" \
8610 || test "$max_cmd_len" -le -1; }
8611 then
8612 func_show_eval "$cmd" 'exit $?'
8613 skipped_export=false
8614 elif test -n "$nm_file_list_spec"; then
8615 func_basename "$output"
8616 output_la=$func_basename_result
8617 save_libobjs=$libobjs
8618 save_output=$output
8619 output=${output_objdir}/${output_la}.nm
8620 func_to_tool_file "$output"
8621 libobjs=$nm_file_list_spec$func_to_tool_file_result
8622 delfiles+=" $output"
8623 func_verbose "creating $NM input file list: $output"
8624 for obj in $save_libobjs; do
8625 func_to_tool_file "$obj"
8626 $ECHO "$func_to_tool_file_result"
8627 done > "$output"
8628 eval cmd=\"$cmd1\"
8629 func_show_eval "$cmd" 'exit $?'
8630 output=$save_output
8631 libobjs=$save_libobjs
8632 skipped_export=false
8633 else
8634 # The command line is too long to execute in one step.
8635 func_verbose "using reloadable object file for export list..."
8636 skipped_export=:
8637 # Break out early, otherwise skipped_export may be
8638 # set to false by a later but shorter cmd.
8639 break
8641 done
8642 IFS="$save_ifs"
8643 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8644 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8645 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8650 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8651 tmp_export_symbols="$export_symbols"
8652 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8653 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8656 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8657 # The given exports_symbols file has to be filtered, so filter it.
8658 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8659 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8660 # 's' commands which not all seds can handle. GNU sed should be fine
8661 # though. Also, the filter scales superlinearly with the number of
8662 # global variables. join(1) would be nice here, but unfortunately
8663 # isn't a blessed tool.
8664 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8665 delfiles+=" $export_symbols $output_objdir/$libname.filter"
8666 export_symbols=$output_objdir/$libname.def
8667 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8670 tmp_deplibs=
8671 for test_deplib in $deplibs; do
8672 case " $convenience " in
8673 *" $test_deplib "*) ;;
8675 tmp_deplibs+=" $test_deplib"
8677 esac
8678 done
8679 deplibs="$tmp_deplibs"
8681 if test -n "$convenience"; then
8682 if test -n "$whole_archive_flag_spec" &&
8683 test "$compiler_needs_object" = yes &&
8684 test -z "$libobjs"; then
8685 # extract the archives, so we have objects to list.
8686 # TODO: could optimize this to just extract one archive.
8687 whole_archive_flag_spec=
8689 if test -n "$whole_archive_flag_spec"; then
8690 save_libobjs=$libobjs
8691 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8692 test "X$libobjs" = "X " && libobjs=
8693 else
8694 gentop="$output_objdir/${outputname}x"
8695 generated+=" $gentop"
8697 func_extract_archives $gentop $convenience
8698 libobjs+=" $func_extract_archives_result"
8699 test "X$libobjs" = "X " && libobjs=
8703 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8704 eval flag=\"$thread_safe_flag_spec\"
8705 linker_flags+=" $flag"
8708 # Make a backup of the uninstalled library when relinking
8709 if test "$opt_mode" = relink; then
8710 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8713 # Do each of the archive commands.
8714 if test "$module" = yes && test -n "$module_cmds" ; then
8715 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8716 eval test_cmds=\"$module_expsym_cmds\"
8717 cmds=$module_expsym_cmds
8718 else
8719 eval test_cmds=\"$module_cmds\"
8720 cmds=$module_cmds
8722 else
8723 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8724 eval test_cmds=\"$archive_expsym_cmds\"
8725 cmds=$archive_expsym_cmds
8726 else
8727 eval test_cmds=\"$archive_cmds\"
8728 cmds=$archive_cmds
8732 if test "X$skipped_export" != "X:" &&
8733 func_len " $test_cmds" &&
8734 len=$func_len_result &&
8735 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8737 else
8738 # The command line is too long to link in one step, link piecewise
8739 # or, if using GNU ld and skipped_export is not :, use a linker
8740 # script.
8742 # Save the value of $output and $libobjs because we want to
8743 # use them later. If we have whole_archive_flag_spec, we
8744 # want to use save_libobjs as it was before
8745 # whole_archive_flag_spec was expanded, because we can't
8746 # assume the linker understands whole_archive_flag_spec.
8747 # This may have to be revisited, in case too many
8748 # convenience libraries get linked in and end up exceeding
8749 # the spec.
8750 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8751 save_libobjs=$libobjs
8753 save_output=$output
8754 func_basename "$output"
8755 output_la=$func_basename_result
8757 # Clear the reloadable object creation command queue and
8758 # initialize k to one.
8759 test_cmds=
8760 concat_cmds=
8761 objlist=
8762 last_robj=
8765 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8766 output=${output_objdir}/${output_la}.lnkscript
8767 func_verbose "creating GNU ld script: $output"
8768 echo 'INPUT (' > $output
8769 for obj in $save_libobjs
8771 func_to_tool_file "$obj"
8772 $ECHO "$func_to_tool_file_result" >> $output
8773 done
8774 echo ')' >> $output
8775 delfiles+=" $output"
8776 func_to_tool_file "$output"
8777 output=$func_to_tool_file_result
8778 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8779 output=${output_objdir}/${output_la}.lnk
8780 func_verbose "creating linker input file list: $output"
8781 : > $output
8782 set x $save_libobjs
8783 shift
8784 firstobj=
8785 if test "$compiler_needs_object" = yes; then
8786 firstobj="$1 "
8787 shift
8789 for obj
8791 func_to_tool_file "$obj"
8792 $ECHO "$func_to_tool_file_result" >> $output
8793 done
8794 delfiles+=" $output"
8795 func_to_tool_file "$output"
8796 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8797 else
8798 if test -n "$save_libobjs"; then
8799 func_verbose "creating reloadable object files..."
8800 output=$output_objdir/$output_la-${k}.$objext
8801 eval test_cmds=\"$reload_cmds\"
8802 func_len " $test_cmds"
8803 len0=$func_len_result
8804 len=$len0
8806 # Loop over the list of objects to be linked.
8807 for obj in $save_libobjs
8809 func_len " $obj"
8810 func_arith $len + $func_len_result
8811 len=$func_arith_result
8812 if test "X$objlist" = X ||
8813 test "$len" -lt "$max_cmd_len"; then
8814 objlist+=" $obj"
8815 else
8816 # The command $test_cmds is almost too long, add a
8817 # command to the queue.
8818 if test "$k" -eq 1 ; then
8819 # The first file doesn't have a previous command to add.
8820 reload_objs=$objlist
8821 eval concat_cmds=\"$reload_cmds\"
8822 else
8823 # All subsequent reloadable object files will link in
8824 # the last one created.
8825 reload_objs="$objlist $last_robj"
8826 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8828 last_robj=$output_objdir/$output_la-${k}.$objext
8829 func_arith $k + 1
8830 k=$func_arith_result
8831 output=$output_objdir/$output_la-${k}.$objext
8832 objlist=" $obj"
8833 func_len " $last_robj"
8834 func_arith $len0 + $func_len_result
8835 len=$func_arith_result
8837 done
8838 # Handle the remaining objects by creating one last
8839 # reloadable object file. All subsequent reloadable object
8840 # files will link in the last one created.
8841 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8842 reload_objs="$objlist $last_robj"
8843 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8844 if test -n "$last_robj"; then
8845 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8847 delfiles+=" $output"
8849 else
8850 output=
8853 if ${skipped_export-false}; then
8854 func_verbose "generating symbol list for \`$libname.la'"
8855 export_symbols="$output_objdir/$libname.exp"
8856 $opt_dry_run || $RM $export_symbols
8857 libobjs=$output
8858 # Append the command to create the export file.
8859 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8860 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8861 if test -n "$last_robj"; then
8862 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8866 test -n "$save_libobjs" &&
8867 func_verbose "creating a temporary reloadable object file: $output"
8869 # Loop through the commands generated above and execute them.
8870 save_ifs="$IFS"; IFS='~'
8871 for cmd in $concat_cmds; do
8872 IFS="$save_ifs"
8873 $opt_silent || {
8874 func_quote_for_expand "$cmd"
8875 eval "func_echo $func_quote_for_expand_result"
8877 $opt_dry_run || eval "$cmd" || {
8878 lt_exit=$?
8880 # Restore the uninstalled library and exit
8881 if test "$opt_mode" = relink; then
8882 ( cd "$output_objdir" && \
8883 $RM "${realname}T" && \
8884 $MV "${realname}U" "$realname" )
8887 exit $lt_exit
8889 done
8890 IFS="$save_ifs"
8892 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8893 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8894 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8898 if ${skipped_export-false}; then
8899 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8900 tmp_export_symbols="$export_symbols"
8901 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8902 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8905 if test -n "$orig_export_symbols"; then
8906 # The given exports_symbols file has to be filtered, so filter it.
8907 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8908 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8909 # 's' commands which not all seds can handle. GNU sed should be fine
8910 # though. Also, the filter scales superlinearly with the number of
8911 # global variables. join(1) would be nice here, but unfortunately
8912 # isn't a blessed tool.
8913 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8914 delfiles+=" $export_symbols $output_objdir/$libname.filter"
8915 export_symbols=$output_objdir/$libname.def
8916 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8920 libobjs=$output
8921 # Restore the value of output.
8922 output=$save_output
8924 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8925 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8926 test "X$libobjs" = "X " && libobjs=
8928 # Expand the library linking commands again to reset the
8929 # value of $libobjs for piecewise linking.
8931 # Do each of the archive commands.
8932 if test "$module" = yes && test -n "$module_cmds" ; then
8933 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8934 cmds=$module_expsym_cmds
8935 else
8936 cmds=$module_cmds
8938 else
8939 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8940 cmds=$archive_expsym_cmds
8941 else
8942 cmds=$archive_cmds
8947 if test -n "$delfiles"; then
8948 # Append the command to remove temporary files to $cmds.
8949 eval cmds=\"\$cmds~\$RM $delfiles\"
8952 # Add any objects from preloaded convenience libraries
8953 if test -n "$dlprefiles"; then
8954 gentop="$output_objdir/${outputname}x"
8955 generated+=" $gentop"
8957 func_extract_archives $gentop $dlprefiles
8958 libobjs+=" $func_extract_archives_result"
8959 test "X$libobjs" = "X " && libobjs=
8962 save_ifs="$IFS"; IFS='~'
8963 for cmd in $cmds; do
8964 IFS="$save_ifs"
8965 eval cmd=\"$cmd\"
8966 $opt_silent || {
8967 func_quote_for_expand "$cmd"
8968 eval "func_echo $func_quote_for_expand_result"
8970 $opt_dry_run || eval "$cmd" || {
8971 lt_exit=$?
8973 # Restore the uninstalled library and exit
8974 if test "$opt_mode" = relink; then
8975 ( cd "$output_objdir" && \
8976 $RM "${realname}T" && \
8977 $MV "${realname}U" "$realname" )
8980 exit $lt_exit
8982 done
8983 IFS="$save_ifs"
8985 # Restore the uninstalled library and exit
8986 if test "$opt_mode" = relink; then
8987 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8989 if test -n "$convenience"; then
8990 if test -z "$whole_archive_flag_spec"; then
8991 func_show_eval '${RM}r "$gentop"'
8995 exit $EXIT_SUCCESS
8998 # Create links to the real library.
8999 for linkname in $linknames; do
9000 if test "$realname" != "$linkname"; then
9001 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
9003 done
9005 # If -module or -export-dynamic was specified, set the dlname.
9006 if test "$module" = yes || test "$export_dynamic" = yes; then
9007 # On all known operating systems, these are identical.
9008 dlname="$soname"
9013 obj)
9014 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
9015 func_warning "\`-dlopen' is ignored for objects"
9018 case " $deplibs" in
9019 *\ -l* | *\ -L*)
9020 func_warning "\`-l' and \`-L' are ignored for objects" ;;
9021 esac
9023 test -n "$rpath" && \
9024 func_warning "\`-rpath' is ignored for objects"
9026 test -n "$xrpath" && \
9027 func_warning "\`-R' is ignored for objects"
9029 test -n "$vinfo" && \
9030 func_warning "\`-version-info' is ignored for objects"
9032 test -n "$release" && \
9033 func_warning "\`-release' is ignored for objects"
9035 case $output in
9036 *.lo)
9037 test -n "$objs$old_deplibs" && \
9038 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
9040 libobj=$output
9041 func_lo2o "$libobj"
9042 obj=$func_lo2o_result
9045 libobj=
9046 obj="$output"
9048 esac
9050 # Delete the old objects.
9051 $opt_dry_run || $RM $obj $libobj
9053 # Objects from convenience libraries. This assumes
9054 # single-version convenience libraries. Whenever we create
9055 # different ones for PIC/non-PIC, this we'll have to duplicate
9056 # the extraction.
9057 reload_conv_objs=
9058 gentop=
9059 # reload_cmds runs $LD directly, so let us get rid of
9060 # -Wl from whole_archive_flag_spec and hope we can get by with
9061 # turning comma into space..
9064 if test -n "$convenience"; then
9065 if test -n "$whole_archive_flag_spec"; then
9066 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
9067 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
9068 else
9069 gentop="$output_objdir/${obj}x"
9070 generated+=" $gentop"
9072 func_extract_archives $gentop $convenience
9073 reload_conv_objs="$reload_objs $func_extract_archives_result"
9077 # If we're not building shared, we need to use non_pic_objs
9078 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
9080 # Create the old-style object.
9081 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
9083 output="$obj"
9084 func_execute_cmds "$reload_cmds" 'exit $?'
9086 # Exit if we aren't doing a library object file.
9087 if test -z "$libobj"; then
9088 if test -n "$gentop"; then
9089 func_show_eval '${RM}r "$gentop"'
9092 exit $EXIT_SUCCESS
9095 if test "$build_libtool_libs" != yes; then
9096 if test -n "$gentop"; then
9097 func_show_eval '${RM}r "$gentop"'
9100 # Create an invalid libtool object if no PIC, so that we don't
9101 # accidentally link it into a program.
9102 # $show "echo timestamp > $libobj"
9103 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
9104 exit $EXIT_SUCCESS
9107 if test -n "$pic_flag" || test "$pic_mode" != default; then
9108 # Only do commands if we really have different PIC objects.
9109 reload_objs="$libobjs $reload_conv_objs"
9110 output="$libobj"
9111 func_execute_cmds "$reload_cmds" 'exit $?'
9114 if test -n "$gentop"; then
9115 func_show_eval '${RM}r "$gentop"'
9118 exit $EXIT_SUCCESS
9121 prog)
9122 case $host in
9123 *cygwin*) func_stripname '' '.exe' "$output"
9124 output=$func_stripname_result.exe;;
9125 esac
9126 test -n "$vinfo" && \
9127 func_warning "\`-version-info' is ignored for programs"
9129 test -n "$release" && \
9130 func_warning "\`-release' is ignored for programs"
9132 test "$preload" = yes \
9133 && test "$dlopen_support" = unknown \
9134 && test "$dlopen_self" = unknown \
9135 && test "$dlopen_self_static" = unknown && \
9136 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
9138 case $host in
9139 *-*-rhapsody* | *-*-darwin1.[012])
9140 # On Rhapsody replace the C library is the System framework
9141 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
9142 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
9144 esac
9146 case $host in
9147 *-*-darwin*)
9148 # Don't allow lazy linking, it breaks C++ global constructors
9149 # But is supposedly fixed on 10.4 or later (yay!).
9150 if test "$tagname" = CXX ; then
9151 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
9152 10.[0123])
9153 compile_command+=" ${wl}-bind_at_load"
9154 finalize_command+=" ${wl}-bind_at_load"
9156 esac
9158 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9159 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9160 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9162 esac
9165 # move library search paths that coincide with paths to not yet
9166 # installed libraries to the beginning of the library search list
9167 new_libs=
9168 for path in $notinst_path; do
9169 case " $new_libs " in
9170 *" -L$path/$objdir "*) ;;
9172 case " $compile_deplibs " in
9173 *" -L$path/$objdir "*)
9174 new_libs+=" -L$path/$objdir" ;;
9175 esac
9177 esac
9178 done
9179 for deplib in $compile_deplibs; do
9180 case $deplib in
9181 -L*)
9182 case " $new_libs " in
9183 *" $deplib "*) ;;
9184 *) new_libs+=" $deplib" ;;
9185 esac
9187 *) new_libs+=" $deplib" ;;
9188 esac
9189 done
9190 compile_deplibs="$new_libs"
9193 compile_command+=" $compile_deplibs"
9194 finalize_command+=" $finalize_deplibs"
9196 if test -n "$rpath$xrpath"; then
9197 # If the user specified any rpath flags, then add them.
9198 for libdir in $rpath $xrpath; do
9199 # This is the magic to use -rpath.
9200 case "$finalize_rpath " in
9201 *" $libdir "*) ;;
9202 *) finalize_rpath+=" $libdir" ;;
9203 esac
9204 done
9207 # Now hardcode the library paths
9208 rpath=
9209 hardcode_libdirs=
9210 for libdir in $compile_rpath $finalize_rpath; do
9211 if test -n "$hardcode_libdir_flag_spec"; then
9212 if test -n "$hardcode_libdir_separator"; then
9213 if test -z "$hardcode_libdirs"; then
9214 hardcode_libdirs="$libdir"
9215 else
9216 # Just accumulate the unique libdirs.
9217 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9218 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9221 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
9223 esac
9225 else
9226 eval flag=\"$hardcode_libdir_flag_spec\"
9227 rpath+=" $flag"
9229 elif test -n "$runpath_var"; then
9230 case "$perm_rpath " in
9231 *" $libdir "*) ;;
9232 *) perm_rpath+=" $libdir" ;;
9233 esac
9235 case $host in
9236 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
9237 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
9238 case :$dllsearchpath: in
9239 *":$libdir:"*) ;;
9240 ::) dllsearchpath=$libdir;;
9241 *) dllsearchpath+=":$libdir";;
9242 esac
9243 case :$dllsearchpath: in
9244 *":$testbindir:"*) ;;
9245 ::) dllsearchpath=$testbindir;;
9246 *) dllsearchpath+=":$testbindir";;
9247 esac
9249 esac
9250 done
9251 # Substitute the hardcoded libdirs into the rpath.
9252 if test -n "$hardcode_libdir_separator" &&
9253 test -n "$hardcode_libdirs"; then
9254 libdir="$hardcode_libdirs"
9255 eval rpath=\" $hardcode_libdir_flag_spec\"
9257 compile_rpath="$rpath"
9259 rpath=
9260 hardcode_libdirs=
9261 for libdir in $finalize_rpath; do
9262 if test -n "$hardcode_libdir_flag_spec"; then
9263 if test -n "$hardcode_libdir_separator"; then
9264 if test -z "$hardcode_libdirs"; then
9265 hardcode_libdirs="$libdir"
9266 else
9267 # Just accumulate the unique libdirs.
9268 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9269 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9272 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
9274 esac
9276 else
9277 eval flag=\"$hardcode_libdir_flag_spec\"
9278 rpath+=" $flag"
9280 elif test -n "$runpath_var"; then
9281 case "$finalize_perm_rpath " in
9282 *" $libdir "*) ;;
9283 *) finalize_perm_rpath+=" $libdir" ;;
9284 esac
9286 done
9287 # Substitute the hardcoded libdirs into the rpath.
9288 if test -n "$hardcode_libdir_separator" &&
9289 test -n "$hardcode_libdirs"; then
9290 libdir="$hardcode_libdirs"
9291 eval rpath=\" $hardcode_libdir_flag_spec\"
9293 finalize_rpath="$rpath"
9295 if test -n "$libobjs" && test "$build_old_libs" = yes; then
9296 # Transform all the library objects into standard objects.
9297 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9298 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9301 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
9303 # template prelinking step
9304 if test -n "$prelink_cmds"; then
9305 func_execute_cmds "$prelink_cmds" 'exit $?'
9308 wrappers_required=yes
9309 case $host in
9310 *cegcc* | *mingw32ce*)
9311 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
9312 wrappers_required=no
9314 *cygwin* | *mingw* )
9315 if test "$build_libtool_libs" != yes; then
9316 wrappers_required=no
9320 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
9321 wrappers_required=no
9324 esac
9325 if test "$wrappers_required" = no; then
9326 # Replace the output file specification.
9327 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9328 link_command="$compile_command$compile_rpath"
9330 # We have no uninstalled library dependencies, so finalize right now.
9331 exit_status=0
9332 func_show_eval "$link_command" 'exit_status=$?'
9334 if test -n "$postlink_cmds"; then
9335 func_to_tool_file "$output"
9336 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9337 func_execute_cmds "$postlink_cmds" 'exit $?'
9340 # Delete the generated files.
9341 if test -f "$output_objdir/${outputname}S.${objext}"; then
9342 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
9345 exit $exit_status
9348 if test -n "$compile_shlibpath$finalize_shlibpath"; then
9349 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
9351 if test -n "$finalize_shlibpath"; then
9352 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
9355 compile_var=
9356 finalize_var=
9357 if test -n "$runpath_var"; then
9358 if test -n "$perm_rpath"; then
9359 # We should set the runpath_var.
9360 rpath=
9361 for dir in $perm_rpath; do
9362 rpath+="$dir:"
9363 done
9364 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
9366 if test -n "$finalize_perm_rpath"; then
9367 # We should set the runpath_var.
9368 rpath=
9369 for dir in $finalize_perm_rpath; do
9370 rpath+="$dir:"
9371 done
9372 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
9376 if test "$no_install" = yes; then
9377 # We don't need to create a wrapper script.
9378 link_command="$compile_var$compile_command$compile_rpath"
9379 # Replace the output file specification.
9380 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9381 # Delete the old output file.
9382 $opt_dry_run || $RM $output
9383 # Link the executable and exit
9384 func_show_eval "$link_command" 'exit $?'
9386 if test -n "$postlink_cmds"; then
9387 func_to_tool_file "$output"
9388 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9389 func_execute_cmds "$postlink_cmds" 'exit $?'
9392 exit $EXIT_SUCCESS
9395 if test "$hardcode_action" = relink; then
9396 # Fast installation is not supported
9397 link_command="$compile_var$compile_command$compile_rpath"
9398 relink_command="$finalize_var$finalize_command$finalize_rpath"
9400 func_warning "this platform does not like uninstalled shared libraries"
9401 func_warning "\`$output' will be relinked during installation"
9402 else
9403 if test "$fast_install" != no; then
9404 link_command="$finalize_var$compile_command$finalize_rpath"
9405 if test "$fast_install" = yes; then
9406 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
9407 else
9408 # fast_install is set to needless
9409 relink_command=
9411 else
9412 link_command="$compile_var$compile_command$compile_rpath"
9413 relink_command="$finalize_var$finalize_command$finalize_rpath"
9417 # Replace the output file specification.
9418 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9420 # Delete the old output files.
9421 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9423 func_show_eval "$link_command" 'exit $?'
9425 if test -n "$postlink_cmds"; then
9426 func_to_tool_file "$output_objdir/$outputname"
9427 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'`
9428 func_execute_cmds "$postlink_cmds" 'exit $?'
9431 # Now create the wrapper script.
9432 func_verbose "creating $output"
9434 # Quote the relink command for shipping.
9435 if test -n "$relink_command"; then
9436 # Preserve any variables that may affect compiler behavior
9437 for var in $variables_saved_for_relink; do
9438 if eval test -z \"\${$var+set}\"; then
9439 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9440 elif eval var_value=\$$var; test -z "$var_value"; then
9441 relink_command="$var=; export $var; $relink_command"
9442 else
9443 func_quote_for_eval "$var_value"
9444 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9446 done
9447 relink_command="(cd `pwd`; $relink_command)"
9448 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9451 # Only actually do things if not in dry run mode.
9452 $opt_dry_run || {
9453 # win32 will think the script is a binary if it has
9454 # a .exe suffix, so we strip it off here.
9455 case $output in
9456 *.exe) func_stripname '' '.exe' "$output"
9457 output=$func_stripname_result ;;
9458 esac
9459 # test for cygwin because mv fails w/o .exe extensions
9460 case $host in
9461 *cygwin*)
9462 exeext=.exe
9463 func_stripname '' '.exe' "$outputname"
9464 outputname=$func_stripname_result ;;
9465 *) exeext= ;;
9466 esac
9467 case $host in
9468 *cygwin* | *mingw* )
9469 func_dirname_and_basename "$output" "" "."
9470 output_name=$func_basename_result
9471 output_path=$func_dirname_result
9472 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9473 cwrapper="$output_path/$output_name.exe"
9474 $RM $cwrappersource $cwrapper
9475 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9477 func_emit_cwrapperexe_src > $cwrappersource
9479 # The wrapper executable is built using the $host compiler,
9480 # because it contains $host paths and files. If cross-
9481 # compiling, it, like the target executable, must be
9482 # executed on the $host or under an emulation environment.
9483 $opt_dry_run || {
9484 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9485 $STRIP $cwrapper
9488 # Now, create the wrapper script for func_source use:
9489 func_ltwrapper_scriptname $cwrapper
9490 $RM $func_ltwrapper_scriptname_result
9491 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9492 $opt_dry_run || {
9493 # note: this script will not be executed, so do not chmod.
9494 if test "x$build" = "x$host" ; then
9495 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9496 else
9497 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9502 $RM $output
9503 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9505 func_emit_wrapper no > $output
9506 chmod +x $output
9508 esac
9510 exit $EXIT_SUCCESS
9512 esac
9514 # See if we need to build an old-fashioned archive.
9515 for oldlib in $oldlibs; do
9517 if test "$build_libtool_libs" = convenience; then
9518 oldobjs="$libobjs_save $symfileobj"
9519 addlibs="$convenience"
9520 build_libtool_libs=no
9521 else
9522 if test "$build_libtool_libs" = module; then
9523 oldobjs="$libobjs_save"
9524 build_libtool_libs=no
9525 else
9526 oldobjs="$old_deplibs $non_pic_objects"
9527 if test "$preload" = yes && test -f "$symfileobj"; then
9528 oldobjs+=" $symfileobj"
9531 addlibs="$old_convenience"
9534 if test -n "$addlibs"; then
9535 gentop="$output_objdir/${outputname}x"
9536 generated+=" $gentop"
9538 func_extract_archives $gentop $addlibs
9539 oldobjs+=" $func_extract_archives_result"
9542 # Do each command in the archive commands.
9543 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9544 cmds=$old_archive_from_new_cmds
9545 else
9547 # Add any objects from preloaded convenience libraries
9548 if test -n "$dlprefiles"; then
9549 gentop="$output_objdir/${outputname}x"
9550 generated+=" $gentop"
9552 func_extract_archives $gentop $dlprefiles
9553 oldobjs+=" $func_extract_archives_result"
9556 # POSIX demands no paths to be encoded in archives. We have
9557 # to avoid creating archives with duplicate basenames if we
9558 # might have to extract them afterwards, e.g., when creating a
9559 # static archive out of a convenience library, or when linking
9560 # the entirety of a libtool archive into another (currently
9561 # not supported by libtool).
9562 if (for obj in $oldobjs
9564 func_basename "$obj"
9565 $ECHO "$func_basename_result"
9566 done | sort | sort -uc >/dev/null 2>&1); then
9568 else
9569 echo "copying selected object files to avoid basename conflicts..."
9570 gentop="$output_objdir/${outputname}x"
9571 generated+=" $gentop"
9572 func_mkdir_p "$gentop"
9573 save_oldobjs=$oldobjs
9574 oldobjs=
9575 counter=1
9576 for obj in $save_oldobjs
9578 func_basename "$obj"
9579 objbase="$func_basename_result"
9580 case " $oldobjs " in
9581 " ") oldobjs=$obj ;;
9582 *[\ /]"$objbase "*)
9583 while :; do
9584 # Make sure we don't pick an alternate name that also
9585 # overlaps.
9586 newobj=lt$counter-$objbase
9587 func_arith $counter + 1
9588 counter=$func_arith_result
9589 case " $oldobjs " in
9590 *[\ /]"$newobj "*) ;;
9591 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9592 esac
9593 done
9594 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9595 oldobjs+=" $gentop/$newobj"
9597 *) oldobjs+=" $obj" ;;
9598 esac
9599 done
9601 eval cmds=\"$old_archive_cmds\"
9603 func_len " $cmds"
9604 len=$func_len_result
9605 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9606 cmds=$old_archive_cmds
9607 elif test -n "$archiver_list_spec"; then
9608 func_verbose "using command file archive linking..."
9609 for obj in $oldobjs
9611 func_to_tool_file "$obj"
9612 $ECHO "$func_to_tool_file_result"
9613 done > $output_objdir/$libname.libcmd
9614 func_to_tool_file "$output_objdir/$libname.libcmd"
9615 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9616 cmds=$old_archive_cmds
9617 else
9618 # the command line is too long to link in one step, link in parts
9619 func_verbose "using piecewise archive linking..."
9620 save_RANLIB=$RANLIB
9621 RANLIB=:
9622 objlist=
9623 concat_cmds=
9624 save_oldobjs=$oldobjs
9625 oldobjs=
9626 # Is there a better way of finding the last object in the list?
9627 for obj in $save_oldobjs
9629 last_oldobj=$obj
9630 done
9631 eval test_cmds=\"$old_archive_cmds\"
9632 func_len " $test_cmds"
9633 len0=$func_len_result
9634 len=$len0
9635 for obj in $save_oldobjs
9637 func_len " $obj"
9638 func_arith $len + $func_len_result
9639 len=$func_arith_result
9640 objlist+=" $obj"
9641 if test "$len" -lt "$max_cmd_len"; then
9643 else
9644 # the above command should be used before it gets too long
9645 oldobjs=$objlist
9646 if test "$obj" = "$last_oldobj" ; then
9647 RANLIB=$save_RANLIB
9649 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9650 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9651 objlist=
9652 len=$len0
9654 done
9655 RANLIB=$save_RANLIB
9656 oldobjs=$objlist
9657 if test "X$oldobjs" = "X" ; then
9658 eval cmds=\"\$concat_cmds\"
9659 else
9660 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9664 func_execute_cmds "$cmds" 'exit $?'
9665 done
9667 test -n "$generated" && \
9668 func_show_eval "${RM}r$generated"
9670 # Now create the libtool archive.
9671 case $output in
9672 *.la)
9673 old_library=
9674 test "$build_old_libs" = yes && old_library="$libname.$libext"
9675 func_verbose "creating $output"
9677 # Preserve any variables that may affect compiler behavior
9678 for var in $variables_saved_for_relink; do
9679 if eval test -z \"\${$var+set}\"; then
9680 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9681 elif eval var_value=\$$var; test -z "$var_value"; then
9682 relink_command="$var=; export $var; $relink_command"
9683 else
9684 func_quote_for_eval "$var_value"
9685 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9687 done
9688 # Quote the link command for shipping.
9689 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9690 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9691 if test "$hardcode_automatic" = yes ; then
9692 relink_command=
9695 # Only create the output if not a dry run.
9696 $opt_dry_run || {
9697 for installed in no yes; do
9698 if test "$installed" = yes; then
9699 if test -z "$install_libdir"; then
9700 break
9702 output="$output_objdir/$outputname"i
9703 # Replace all uninstalled libtool libraries with the installed ones
9704 newdependency_libs=
9705 for deplib in $dependency_libs; do
9706 case $deplib in
9707 *.la)
9708 func_basename "$deplib"
9709 name="$func_basename_result"
9710 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
9711 test -z "$libdir" && \
9712 func_fatal_error "\`$deplib' is not a valid libtool archive"
9713 newdependency_libs+=" ${lt_sysroot:+=}$libdir/$name"
9715 -L*)
9716 func_stripname -L '' "$deplib"
9717 func_replace_sysroot "$func_stripname_result"
9718 newdependency_libs+=" -L$func_replace_sysroot_result"
9720 -R*)
9721 func_stripname -R '' "$deplib"
9722 func_replace_sysroot "$func_stripname_result"
9723 newdependency_libs+=" -R$func_replace_sysroot_result"
9725 *) newdependency_libs+=" $deplib" ;;
9726 esac
9727 done
9728 dependency_libs="$newdependency_libs"
9729 newdlfiles=
9731 for lib in $dlfiles; do
9732 case $lib in
9733 *.la)
9734 func_basename "$lib"
9735 name="$func_basename_result"
9736 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9737 test -z "$libdir" && \
9738 func_fatal_error "\`$lib' is not a valid libtool archive"
9739 newdlfiles+=" ${lt_sysroot:+=}$libdir/$name"
9741 *) newdlfiles+=" $lib" ;;
9742 esac
9743 done
9744 dlfiles="$newdlfiles"
9745 newdlprefiles=
9746 for lib in $dlprefiles; do
9747 case $lib in
9748 *.la)
9749 # Only pass preopened files to the pseudo-archive (for
9750 # eventual linking with the app. that links it) if we
9751 # didn't already link the preopened objects directly into
9752 # the library:
9753 func_basename "$lib"
9754 name="$func_basename_result"
9755 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9756 test -z "$libdir" && \
9757 func_fatal_error "\`$lib' is not a valid libtool archive"
9758 newdlprefiles+=" ${lt_sysroot:+=}$libdir/$name"
9760 esac
9761 done
9762 dlprefiles="$newdlprefiles"
9763 else
9764 newdlfiles=
9765 for lib in $dlfiles; do
9766 case $lib in
9767 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9768 *) abs=`pwd`"/$lib" ;;
9769 esac
9770 newdlfiles+=" $abs"
9771 done
9772 dlfiles="$newdlfiles"
9773 newdlprefiles=
9774 for lib in $dlprefiles; do
9775 case $lib in
9776 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9777 *) abs=`pwd`"/$lib" ;;
9778 esac
9779 newdlprefiles+=" $abs"
9780 done
9781 dlprefiles="$newdlprefiles"
9783 $RM $output
9784 # place dlname in correct position for cygwin
9785 # In fact, it would be nice if we could use this code for all target
9786 # systems that can't hard-code library paths into their executables
9787 # and that have no shared library path variable independent of PATH,
9788 # but it turns out we can't easily determine that from inspecting
9789 # libtool variables, so we have to hard-code the OSs to which it
9790 # applies here; at the moment, that means platforms that use the PE
9791 # object format with DLL files. See the long comment at the top of
9792 # tests/bindir.at for full details.
9793 tdlname=$dlname
9794 case $host,$output,$installed,$module,$dlname in
9795 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9796 # If a -bindir argument was supplied, place the dll there.
9797 if test "x$bindir" != x ;
9798 then
9799 func_relative_path "$install_libdir" "$bindir"
9800 tdlname=$func_relative_path_result$dlname
9801 else
9802 # Otherwise fall back on heuristic.
9803 tdlname=../bin/$dlname
9806 esac
9807 $ECHO > $output "\
9808 # $outputname - a libtool library file
9809 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9811 # Please DO NOT delete this file!
9812 # It is necessary for linking the library.
9814 # The name that we can dlopen(3).
9815 dlname='$tdlname'
9817 # Names of this library.
9818 library_names='$library_names'
9820 # The name of the static archive.
9821 old_library='$old_library'
9823 # Linker flags that can not go in dependency_libs.
9824 inherited_linker_flags='$new_inherited_linker_flags'
9826 # Libraries that this one depends upon.
9827 dependency_libs='$dependency_libs'
9829 # Names of additional weak libraries provided by this library
9830 weak_library_names='$weak_libs'
9832 # Version information for $libname.
9833 current=$current
9834 age=$age
9835 revision=$revision
9837 # Is this an already installed library?
9838 installed=$installed
9840 # Should we warn about portability when linking against -modules?
9841 shouldnotlink=$module
9843 # Files to dlopen/dlpreopen
9844 dlopen='$dlfiles'
9845 dlpreopen='$dlprefiles'
9847 # Directory that this library needs to be installed in:
9848 libdir='$install_libdir'"
9849 if test "$installed" = no && test "$need_relink" = yes; then
9850 $ECHO >> $output "\
9851 relink_command=\"$relink_command\""
9853 done
9856 # Do a symbolic link so that the libtool archive can be found in
9857 # LD_LIBRARY_PATH before the program is installed.
9858 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9860 esac
9861 exit $EXIT_SUCCESS
9864 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9865 func_mode_link ${1+"$@"}
9868 # func_mode_uninstall arg...
9869 func_mode_uninstall ()
9871 $opt_debug
9872 RM="$nonopt"
9873 files=
9874 rmforce=
9875 exit_status=0
9877 # This variable tells wrapper scripts just to set variables rather
9878 # than running their programs.
9879 libtool_install_magic="$magic"
9881 for arg
9883 case $arg in
9884 -f) RM+=" $arg"; rmforce=yes ;;
9885 -*) RM+=" $arg" ;;
9886 *) files+=" $arg" ;;
9887 esac
9888 done
9890 test -z "$RM" && \
9891 func_fatal_help "you must specify an RM program"
9893 rmdirs=
9895 for file in $files; do
9896 func_dirname "$file" "" "."
9897 dir="$func_dirname_result"
9898 if test "X$dir" = X.; then
9899 odir="$objdir"
9900 else
9901 odir="$dir/$objdir"
9903 func_basename "$file"
9904 name="$func_basename_result"
9905 test "$opt_mode" = uninstall && odir="$dir"
9907 # Remember odir for removal later, being careful to avoid duplicates
9908 if test "$opt_mode" = clean; then
9909 case " $rmdirs " in
9910 *" $odir "*) ;;
9911 *) rmdirs+=" $odir" ;;
9912 esac
9915 # Don't error if the file doesn't exist and rm -f was used.
9916 if { test -L "$file"; } >/dev/null 2>&1 ||
9917 { test -h "$file"; } >/dev/null 2>&1 ||
9918 test -f "$file"; then
9920 elif test -d "$file"; then
9921 exit_status=1
9922 continue
9923 elif test "$rmforce" = yes; then
9924 continue
9927 rmfiles="$file"
9929 case $name in
9930 *.la)
9931 # Possibly a libtool archive, so verify it.
9932 if func_lalib_p "$file"; then
9933 func_source $dir/$name
9935 # Delete the libtool libraries and symlinks.
9936 for n in $library_names; do
9937 rmfiles+=" $odir/$n"
9938 done
9939 test -n "$old_library" && rmfiles+=" $odir/$old_library"
9941 case "$opt_mode" in
9942 clean)
9943 case " $library_names " in
9944 *" $dlname "*) ;;
9945 *) test -n "$dlname" && rmfiles+=" $odir/$dlname" ;;
9946 esac
9947 test -n "$libdir" && rmfiles+=" $odir/$name $odir/${name}i"
9949 uninstall)
9950 if test -n "$library_names"; then
9951 # Do each command in the postuninstall commands.
9952 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9955 if test -n "$old_library"; then
9956 # Do each command in the old_postuninstall commands.
9957 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9959 # FIXME: should reinstall the best remaining shared library.
9961 esac
9965 *.lo)
9966 # Possibly a libtool object, so verify it.
9967 if func_lalib_p "$file"; then
9969 # Read the .lo file
9970 func_source $dir/$name
9972 # Add PIC object to the list of files to remove.
9973 if test -n "$pic_object" &&
9974 test "$pic_object" != none; then
9975 rmfiles+=" $dir/$pic_object"
9978 # Add non-PIC object to the list of files to remove.
9979 if test -n "$non_pic_object" &&
9980 test "$non_pic_object" != none; then
9981 rmfiles+=" $dir/$non_pic_object"
9987 if test "$opt_mode" = clean ; then
9988 noexename=$name
9989 case $file in
9990 *.exe)
9991 func_stripname '' '.exe' "$file"
9992 file=$func_stripname_result
9993 func_stripname '' '.exe' "$name"
9994 noexename=$func_stripname_result
9995 # $file with .exe has already been added to rmfiles,
9996 # add $file without .exe
9997 rmfiles+=" $file"
9999 esac
10000 # Do a test to see if this is a libtool program.
10001 if func_ltwrapper_p "$file"; then
10002 if func_ltwrapper_executable_p "$file"; then
10003 func_ltwrapper_scriptname "$file"
10004 relink_command=
10005 func_source $func_ltwrapper_scriptname_result
10006 rmfiles+=" $func_ltwrapper_scriptname_result"
10007 else
10008 relink_command=
10009 func_source $dir/$noexename
10012 # note $name still contains .exe if it was in $file originally
10013 # as does the version of $file that was added into $rmfiles
10014 rmfiles+=" $odir/$name $odir/${name}S.${objext}"
10015 if test "$fast_install" = yes && test -n "$relink_command"; then
10016 rmfiles+=" $odir/lt-$name"
10018 if test "X$noexename" != "X$name" ; then
10019 rmfiles+=" $odir/lt-${noexename}.c"
10024 esac
10025 func_show_eval "$RM $rmfiles" 'exit_status=1'
10026 done
10028 # Try to remove the ${objdir}s in the directories where we deleted files
10029 for dir in $rmdirs; do
10030 if test -d "$dir"; then
10031 func_show_eval "rmdir $dir >/dev/null 2>&1"
10033 done
10035 exit $exit_status
10038 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
10039 func_mode_uninstall ${1+"$@"}
10041 test -z "$opt_mode" && {
10042 help="$generic_help"
10043 func_fatal_help "you must specify a MODE"
10046 test -z "$exec_cmd" && \
10047 func_fatal_help "invalid operation mode \`$opt_mode'"
10049 if test -n "$exec_cmd"; then
10050 eval exec "$exec_cmd"
10051 exit $EXIT_FAILURE
10054 exit $exit_status
10057 # The TAGs below are defined such that we never get into a situation
10058 # in which we disable both kinds of libraries. Given conflicting
10059 # choices, we go for a static library, that is the most portable,
10060 # since we can't tell whether shared libraries were disabled because
10061 # the user asked for that or because the platform doesn't support
10062 # them. This is particularly important on AIX, because we don't
10063 # support having both static and shared libraries enabled at the same
10064 # time on that platform, so we default to a shared-only configuration.
10065 # If a disable-shared tag is given, we'll fallback to a static-only
10066 # configuration. But we'll never go from static-only to shared-only.
10068 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
10069 build_libtool_libs=no
10070 build_old_libs=yes
10071 # ### END LIBTOOL TAG CONFIG: disable-shared
10073 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
10074 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
10075 # ### END LIBTOOL TAG CONFIG: disable-static
10077 # Local Variables:
10078 # mode:shell-script
10079 # sh-indentation:2
10080 # End:
10081 # vi:sw=2