Changes to update Tomato RAF.
[tomato.git] / release / src / router / dnscrypt / libtool
blob3bb82ed5bad35098595bdd108ef3cfe015385896
1 #! /bin/sh
3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (dnscrypt-proxy) 1.0
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, 2011 Free Software
10 # Foundation, Inc.
11 # Written by Gordon Matzigkeit, 1996
13 # This file is part of GNU Libtool.
15 # GNU Libtool is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License as
17 # published by the Free Software Foundation; either version 2 of
18 # the License, or (at your option) any later version.
20 # As a special exception to the GNU General Public License,
21 # if you distribute this file as part of a program or library that
22 # is built using GNU Libtool, you may include this file under the
23 # same distribution terms that you use for the rest of that program.
25 # GNU Libtool is distributed in the hope that it will be useful,
26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 # GNU General Public License for more details.
30 # You should have received a copy of the GNU General Public License
31 # along with GNU Libtool; see the file COPYING. If not, a copy
32 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
33 # obtained by writing to the Free Software Foundation, Inc.,
34 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
37 # The names of the tagged configurations supported by this script.
38 available_tags=""
40 # ### BEGIN LIBTOOL CONFIG
42 # Which release of libtool.m4 was used?
43 macro_version=2.4.2
44 macro_revision=1.3337
46 # Whether or not to build shared libraries.
47 build_libtool_libs=yes
49 # Whether or not to build static libraries.
50 build_old_libs=yes
52 # What type of objects to build.
53 pic_mode=default
55 # Whether or not to optimize for fast installation.
56 fast_install=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 PATH separator for the build system.
65 PATH_SEPARATOR=":"
67 # The host system.
68 host_alias=mipsel-linux
69 host=mipsel-unknown-linux-gnu
70 host_os=linux-gnu
72 # The build system.
73 build_alias=x86_64-linux-gnu
74 build=x86_64-pc-linux-gnu
75 build_os=linux-gnu
77 # A sed program that does not truncate output.
78 SED="/bin/sed"
80 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
81 Xsed="$SED -e 1s/^X//"
83 # A grep program that handles long lines.
84 GREP="/bin/grep"
86 # An ERE matcher.
87 EGREP="/bin/grep -E"
89 # A literal string matcher.
90 FGREP="/bin/grep -F"
92 # A BSD- or MS-compatible name lister.
93 NM="mipsel-uclibc-nm"
95 # Whether we need soft or hard links.
96 LN_S="ln -s"
98 # What is the maximum length of a command?
99 max_cmd_len=3458764513820540925
101 # Object file suffix (normally "o").
102 objext=o
104 # Executable file suffix (normally "").
105 exeext=
107 # whether the shell understands "unset".
108 lt_unset=unset
110 # turn spaces into newlines.
111 SP2NL="tr \\040 \\012"
113 # turn newlines into spaces.
114 NL2SP="tr \\015\\012 \\040\\040"
116 # convert $build file names to $host format.
117 to_host_file_cmd=func_convert_file_noop
119 # convert $build files to toolchain format.
120 to_tool_file_cmd=func_convert_file_noop
122 # An object symbol dumper.
123 OBJDUMP="mipsel-linux-objdump"
125 # Method to check whether dependent libraries are shared objects.
126 deplibs_check_method="pass_all"
128 # Command to use when deplibs_check_method = "file_magic".
129 file_magic_cmd="\$MAGIC_CMD"
131 # How to find potential files when deplibs_check_method = "file_magic".
132 file_magic_glob=""
134 # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
135 want_nocaseglob="no"
137 # DLL creation program.
138 DLLTOOL="false"
140 # Command to associate shared and link libraries.
141 sharedlib_from_linklib_cmd="printf %s\\n"
143 # The archiver.
144 AR="mipsel-uclibc-ar"
146 # Flags to create an archive.
147 AR_FLAGS="cru"
149 # How to feed a file listing to the archiver.
150 archiver_list_spec="@"
152 # A symbol stripping program.
153 STRIP="mipsel-uclibc-strip"
155 # Commands used to install an old-style archive.
156 RANLIB="mipsel-uclibc-ranlib"
157 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
158 old_postuninstall_cmds=""
160 # Whether to use a lock for old archive extraction.
161 lock_old_archive_extraction=no
163 # A C compiler.
164 LTCC="mipsel-uclibc-gcc -std=gnu99"
166 # LTCC compiler flags.
167 LTCFLAGS=" -g -O2 -fPIC -fPIE -fwrapv -fno-strict-aliasing -fno-strict-overflow -Winit-self -Wwrite-strings -Wdiv-by-zero"
169 # Take the output of nm and produce a listing of raw symbols and C names.
170 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
172 # Transform the output of nm in a proper C declaration.
173 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
175 # Transform the output of nm in a C name address pair.
176 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
178 # Transform the output of nm in a C name address pair when lib prefix is needed.
179 global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'"
181 # Specify filename containing input files for $NM.
182 nm_file_list_spec="@"
184 # The root where to search for dependent libraries,and in which our libraries should be installed.
185 lt_sysroot=
187 # The name of the directory that contains temporary libtool files.
188 objdir=.libs
190 # Used to examine libraries when file_magic_cmd begins with "file".
191 MAGIC_CMD=file
193 # Must we lock files when doing compilation?
194 need_locks="no"
196 # Manifest tool.
197 MANIFEST_TOOL=":"
199 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
200 DSYMUTIL=""
202 # Tool to change global to local symbols on Mac OS X.
203 NMEDIT=""
205 # Tool to manipulate fat objects and archives on Mac OS X.
206 LIPO=""
208 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
209 OTOOL=""
211 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
212 OTOOL64=""
214 # Old archive suffix (normally "a").
215 libext=a
217 # Shared library suffix (normally ".so").
218 shrext_cmds=".so"
220 # The commands to extract the exported symbol list from a shared archive.
221 extract_expsyms_cmds=""
223 # Variables whose values should be saved in libtool wrapper scripts and
224 # restored at link time.
225 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
227 # Do we need the "lib" prefix for modules?
228 need_lib_prefix=no
230 # Do we need a version for libraries?
231 need_version=no
233 # Library versioning type.
234 version_type=linux
236 # Shared library runtime path variable.
237 runpath_var=LD_RUN_PATH
239 # Shared library path variable.
240 shlibpath_var=LD_LIBRARY_PATH
242 # Is shlibpath searched before the hard-coded library search path?
243 shlibpath_overrides_runpath=no
245 # Format of library name prefix.
246 libname_spec="lib\$name"
248 # List of archive names. First name is the real one, the rest are links.
249 # The last name is the one that the linker finds with -lNAME
250 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
252 # The coded name of the library, if different from the real name.
253 soname_spec="\${libname}\${release}\${shared_ext}\$major"
255 # Permission mode override for installation of shared libraries.
256 install_override_mode=""
258 # Command to use after installation of a shared archive.
259 postinstall_cmds=""
261 # Command to use after uninstallation of a shared archive.
262 postuninstall_cmds=""
264 # Commands used to finish a libtool library installation in a directory.
265 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
267 # As "finish_cmds", except a single script fragment to be evaled but
268 # not shown.
269 finish_eval=""
271 # Whether we should hardcode library paths into libraries.
272 hardcode_into_libs=yes
274 # Compile-time system search path for libraries.
275 sys_lib_search_path_spec="/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 "
277 # Run-time system search path for libraries.
278 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 "
280 # Whether dlopen is supported.
281 dlopen_support=unknown
283 # Whether dlopen of programs is supported.
284 dlopen_self=unknown
286 # Whether dlopen of statically linked programs is supported.
287 dlopen_self_static=unknown
289 # Commands to strip libraries.
290 old_striplib="mipsel-uclibc-strip --strip-debug"
291 striplib="mipsel-uclibc-strip --strip-unneeded"
294 # The linker used to build libraries.
295 LD="mipsel-uclibc-ld"
297 # How to create reloadable object files.
298 reload_flag=" -r"
299 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
301 # Commands used to build an old-style archive.
302 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
304 # A language specific compiler.
305 CC="mipsel-uclibc-gcc -std=gnu99"
307 # Is the compiler the GNU compiler?
308 with_gcc=yes
310 # Compiler flag to turn off builtin functions.
311 no_builtin_flag=" -fno-builtin"
313 # Additional compiler flags for building library objects.
314 pic_flag=" -fPIC -DPIC"
316 # How to pass a linker flag through the compiler.
317 wl="-Wl,"
319 # Compiler flag to prevent dynamic linking.
320 link_static_flag="-static"
322 # Does compiler simultaneously support -c and -o options?
323 compiler_c_o="yes"
325 # Whether or not to add -lc for building shared libraries.
326 build_libtool_need_lc=no
328 # Whether or not to disallow shared libs when runtime libs are static.
329 allow_libtool_libs_with_static_runtimes=no
331 # Compiler flag to allow reflexive dlopens.
332 export_dynamic_flag_spec="\${wl}--export-dynamic"
334 # Compiler flag to generate shared objects directly from archives.
335 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
337 # Whether the compiler copes with passing no objects directly.
338 compiler_needs_object="no"
340 # Create an old-style archive from a shared archive.
341 old_archive_from_new_cmds=""
343 # Create a temporary old-style archive to link instead of a shared archive.
344 old_archive_from_expsyms_cmds=""
346 # Commands used to build a shared archive.
347 archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
348 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
349 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
350 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
351 \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
353 # Commands used to build a loadable module if different from building
354 # a shared archive.
355 module_cmds=""
356 module_expsym_cmds=""
358 # Whether we are building with GNU ld or not.
359 with_gnu_ld="yes"
361 # Flag that allows shared libraries with undefined symbols to be built.
362 allow_undefined_flag=""
364 # Flag that enforces no undefined symbols.
365 no_undefined_flag=""
367 # Flag to hardcode $libdir into a binary during linking.
368 # This must work even if $libdir does not exist
369 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
371 # Whether we need a single "-rpath" flag with a separated argument.
372 hardcode_libdir_separator=""
374 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
375 # DIR into the resulting binary.
376 hardcode_direct=no
378 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
379 # DIR into the resulting binary and the resulting library dependency is
380 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
381 # library is relocated.
382 hardcode_direct_absolute=no
384 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
385 # into the resulting binary.
386 hardcode_minus_L=no
388 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
389 # into the resulting binary.
390 hardcode_shlibpath_var=unsupported
392 # Set to "yes" if building a shared library automatically hardcodes DIR
393 # into the library and all subsequent libraries and executables linked
394 # against it.
395 hardcode_automatic=no
397 # Set to yes if linker adds runtime paths of dependent libraries
398 # to runtime path list.
399 inherit_rpath=no
401 # Whether libtool must link a program against all its dependency libraries.
402 link_all_deplibs=unknown
404 # Set to "yes" if exported symbols are required.
405 always_export_symbols=no
407 # The commands to list exported symbols.
408 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
410 # Symbols that should not be listed in the preloaded symbols.
411 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
413 # Symbols that must always be exported.
414 include_expsyms=""
416 # Commands necessary for linking programs (against libraries) with templates.
417 prelink_cmds=""
419 # Commands necessary for finishing linking programs.
420 postlink_cmds=""
422 # Specify filename containing input files.
423 file_list_spec=""
425 # How to hardcode a shared library path into an executable.
426 hardcode_action=immediate
428 # ### END LIBTOOL CONFIG
431 # libtool (GNU libtool) 2.4.2
432 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
434 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
435 # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
436 # This is free software; see the source for copying conditions. There is NO
437 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
439 # GNU Libtool is free software; you can redistribute it and/or modify
440 # it under the terms of the GNU General Public License as published by
441 # the Free Software Foundation; either version 2 of the License, or
442 # (at your option) any later version.
444 # As a special exception to the GNU General Public License,
445 # if you distribute this file as part of a program or library that
446 # is built using GNU Libtool, you may include this file under the
447 # same distribution terms that you use for the rest of that program.
449 # GNU Libtool is distributed in the hope that it will be useful, but
450 # WITHOUT ANY WARRANTY; without even the implied warranty of
451 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
452 # General Public License for more details.
454 # You should have received a copy of the GNU General Public License
455 # along with GNU Libtool; see the file COPYING. If not, a copy
456 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
457 # or obtained by writing to the Free Software Foundation, Inc.,
458 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
460 # Usage: $progname [OPTION]... [MODE-ARG]...
462 # Provide generalized library-building support services.
464 # --config show all configuration variables
465 # --debug enable verbose shell tracing
466 # -n, --dry-run display commands without modifying any files
467 # --features display basic configuration information and exit
468 # --mode=MODE use operation mode MODE
469 # --preserve-dup-deps don't remove duplicate dependency libraries
470 # --quiet, --silent don't print informational messages
471 # --no-quiet, --no-silent
472 # print informational messages (default)
473 # --no-warn don't display warning messages
474 # --tag=TAG use configuration variables from tag TAG
475 # -v, --verbose print more informational messages than default
476 # --no-verbose don't print the extra informational messages
477 # --version print version information
478 # -h, --help, --help-all print short, long, or detailed help message
480 # MODE must be one of the following:
482 # clean remove files from the build directory
483 # compile compile a source file into a libtool object
484 # execute automatically set library path, then run a program
485 # finish complete the installation of libtool libraries
486 # install install libraries or executables
487 # link create a library or an executable
488 # uninstall remove libraries from an installed directory
490 # MODE-ARGS vary depending on the MODE. When passed as first option,
491 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
492 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
494 # When reporting a bug, please describe a test case to reproduce it and
495 # include the following information:
497 # host-triplet: $host
498 # shell: $SHELL
499 # compiler: $LTCC
500 # compiler flags: $LTCFLAGS
501 # linker: $LD (gnu? $with_gnu_ld)
502 # $progname: (GNU libtool) 2.4.2
503 # automake: $automake_version
504 # autoconf: $autoconf_version
506 # Report bugs to <bug-libtool@gnu.org>.
507 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
508 # General help using GNU software: <http://www.gnu.org/gethelp/>.
510 PROGRAM=libtool
511 PACKAGE=libtool
512 VERSION=2.4.2
513 TIMESTAMP=""
514 package_revision=1.3337
516 # Be Bourne compatible
517 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
518 emulate sh
519 NULLCMD=:
520 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
521 # is contrary to our usage. Disable this feature.
522 alias -g '${1+"$@"}'='"$@"'
523 setopt NO_GLOB_SUBST
524 else
525 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
527 BIN_SH=xpg4; export BIN_SH # for Tru64
528 DUALCASE=1; export DUALCASE # for MKS sh
530 # A function that is used when there is no print builtin or printf.
531 func_fallback_echo ()
533 eval 'cat <<_LTECHO_EOF
535 _LTECHO_EOF'
538 # NLS nuisances: We save the old values to restore during execute mode.
539 lt_user_locale=
540 lt_safe_locale=
541 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
543 eval "if test \"\${$lt_var+set}\" = set; then
544 save_$lt_var=\$$lt_var
545 $lt_var=C
546 export $lt_var
547 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
548 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
550 done
551 LC_ALL=C
552 LANGUAGE=C
553 export LANGUAGE LC_ALL
555 $lt_unset CDPATH
558 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
559 # is ksh but when the shell is invoked as "sh" and the current value of
560 # the _XPG environment variable is not equal to 1 (one), the special
561 # positional parameter $0, within a function call, is the name of the
562 # function.
563 progpath="$0"
567 : ${CP="cp -f"}
568 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
569 : ${MAKE="make"}
570 : ${MKDIR="mkdir"}
571 : ${MV="mv -f"}
572 : ${RM="rm -f"}
573 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
574 : ${Xsed="$SED -e 1s/^X//"}
576 # Global variables:
577 EXIT_SUCCESS=0
578 EXIT_FAILURE=1
579 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
580 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
582 exit_status=$EXIT_SUCCESS
584 # Make sure IFS has a sensible default
585 lt_nl='
587 IFS=" $lt_nl"
589 dirname="s,/[^/]*$,,"
590 basename="s,^.*/,,"
592 # func_dirname file append nondir_replacement
593 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
594 # otherwise set result to NONDIR_REPLACEMENT.
595 func_dirname ()
597 case ${1} in
598 */*) func_dirname_result="${1%/*}${2}" ;;
599 * ) func_dirname_result="${3}" ;;
600 esac
601 } # Extended-shell func_dirname implementation
604 # func_basename file
605 func_basename ()
607 func_basename_result="${1##*/}"
608 } # Extended-shell func_basename implementation
611 # func_dirname_and_basename file append nondir_replacement
612 # perform func_basename and func_dirname in a single function
613 # call:
614 # dirname: Compute the dirname of FILE. If nonempty,
615 # add APPEND to the result, otherwise set result
616 # to NONDIR_REPLACEMENT.
617 # value returned in "$func_dirname_result"
618 # basename: Compute filename of FILE.
619 # value retuned in "$func_basename_result"
620 # Implementation must be kept synchronized with func_dirname
621 # and func_basename. For efficiency, we do not delegate to
622 # those functions but instead duplicate the functionality here.
623 func_dirname_and_basename ()
625 case ${1} in
626 */*) func_dirname_result="${1%/*}${2}" ;;
627 * ) func_dirname_result="${3}" ;;
628 esac
629 func_basename_result="${1##*/}"
630 } # Extended-shell func_dirname_and_basename implementation
633 # func_stripname prefix suffix name
634 # strip PREFIX and SUFFIX off of NAME.
635 # PREFIX and SUFFIX must not contain globbing or regex special
636 # characters, hashes, percent signs, but SUFFIX may contain a leading
637 # dot (in which case that matches only a dot).
638 # func_strip_suffix prefix name
639 func_stripname ()
641 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
642 # positional parameters, so assign one to ordinary parameter first.
643 func_stripname_result=${3}
644 func_stripname_result=${func_stripname_result#"${1}"}
645 func_stripname_result=${func_stripname_result%"${2}"}
646 } # Extended-shell func_stripname implementation
649 # These SED scripts presuppose an absolute path with a trailing slash.
650 pathcar='s,^/\([^/]*\).*$,\1,'
651 pathcdr='s,^/[^/]*,,'
652 removedotparts=':dotsl
653 s@/\./@/@g
654 t dotsl
655 s,/\.$,/,'
656 collapseslashes='s@/\{1,\}@/@g'
657 finalslash='s,/*$,/,'
659 # func_normal_abspath PATH
660 # Remove doubled-up and trailing slashes, "." path components,
661 # and cancel out any ".." path components in PATH after making
662 # it an absolute path.
663 # value returned in "$func_normal_abspath_result"
664 func_normal_abspath ()
666 # Start from root dir and reassemble the path.
667 func_normal_abspath_result=
668 func_normal_abspath_tpath=$1
669 func_normal_abspath_altnamespace=
670 case $func_normal_abspath_tpath in
672 # Empty path, that just means $cwd.
673 func_stripname '' '/' "`pwd`"
674 func_normal_abspath_result=$func_stripname_result
675 return
677 # The next three entries are used to spot a run of precisely
678 # two leading slashes without using negated character classes;
679 # we take advantage of case's first-match behaviour.
680 ///*)
681 # Unusual form of absolute path, do nothing.
683 //*)
684 # Not necessarily an ordinary path; POSIX reserves leading '//'
685 # and for example Cygwin uses it to access remote file shares
686 # over CIFS/SMB, so we conserve a leading double slash if found.
687 func_normal_abspath_altnamespace=/
690 # Absolute path, do nothing.
693 # Relative path, prepend $cwd.
694 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
696 esac
697 # Cancel out all the simple stuff to save iterations. We also want
698 # the path to end with a slash for ease of parsing, so make sure
699 # there is one (and only one) here.
700 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
701 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
702 while :; do
703 # Processed it all yet?
704 if test "$func_normal_abspath_tpath" = / ; then
705 # If we ascended to the root using ".." the result may be empty now.
706 if test -z "$func_normal_abspath_result" ; then
707 func_normal_abspath_result=/
709 break
711 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
712 -e "$pathcar"`
713 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
714 -e "$pathcdr"`
715 # Figure out what to do with it
716 case $func_normal_abspath_tcomponent in
718 # Trailing empty path component, ignore it.
721 # Parent dir; strip last assembled component from result.
722 func_dirname "$func_normal_abspath_result"
723 func_normal_abspath_result=$func_dirname_result
726 # Actual path component, append it.
727 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
729 esac
730 done
731 # Restore leading double-slash if one was found on entry.
732 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
735 # func_relative_path SRCDIR DSTDIR
736 # generates a relative path from SRCDIR to DSTDIR, with a trailing
737 # slash if non-empty, suitable for immediately appending a filename
738 # without needing to append a separator.
739 # value returned in "$func_relative_path_result"
740 func_relative_path ()
742 func_relative_path_result=
743 func_normal_abspath "$1"
744 func_relative_path_tlibdir=$func_normal_abspath_result
745 func_normal_abspath "$2"
746 func_relative_path_tbindir=$func_normal_abspath_result
748 # Ascend the tree starting from libdir
749 while :; do
750 # check if we have found a prefix of bindir
751 case $func_relative_path_tbindir in
752 $func_relative_path_tlibdir)
753 # found an exact match
754 func_relative_path_tcancelled=
755 break
757 $func_relative_path_tlibdir*)
758 # found a matching prefix
759 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
760 func_relative_path_tcancelled=$func_stripname_result
761 if test -z "$func_relative_path_result"; then
762 func_relative_path_result=.
764 break
767 func_dirname $func_relative_path_tlibdir
768 func_relative_path_tlibdir=${func_dirname_result}
769 if test "x$func_relative_path_tlibdir" = x ; then
770 # Have to descend all the way to the root!
771 func_relative_path_result=../$func_relative_path_result
772 func_relative_path_tcancelled=$func_relative_path_tbindir
773 break
775 func_relative_path_result=../$func_relative_path_result
777 esac
778 done
780 # Now calculate path; take care to avoid doubling-up slashes.
781 func_stripname '' '/' "$func_relative_path_result"
782 func_relative_path_result=$func_stripname_result
783 func_stripname '/' '/' "$func_relative_path_tcancelled"
784 if test "x$func_stripname_result" != x ; then
785 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
788 # Normalisation. If bindir is libdir, return empty string,
789 # else relative path ending with a slash; either way, target
790 # file name can be directly appended.
791 if test ! -z "$func_relative_path_result"; then
792 func_stripname './' '' "$func_relative_path_result/"
793 func_relative_path_result=$func_stripname_result
797 # The name of this program:
798 func_dirname_and_basename "$progpath"
799 progname=$func_basename_result
801 # Make sure we have an absolute path for reexecution:
802 case $progpath in
803 [\\/]*|[A-Za-z]:\\*) ;;
804 *[\\/]*)
805 progdir=$func_dirname_result
806 progdir=`cd "$progdir" && pwd`
807 progpath="$progdir/$progname"
810 save_IFS="$IFS"
811 IFS=${PATH_SEPARATOR-:}
812 for progdir in $PATH; do
813 IFS="$save_IFS"
814 test -x "$progdir/$progname" && break
815 done
816 IFS="$save_IFS"
817 test -n "$progdir" || progdir=`pwd`
818 progpath="$progdir/$progname"
820 esac
822 # Sed substitution that helps us do robust quoting. It backslashifies
823 # metacharacters that are still active within double-quoted strings.
824 Xsed="${SED}"' -e 1s/^X//'
825 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
827 # Same as above, but do not quote variable references.
828 double_quote_subst='s/\(["`\\]\)/\\\1/g'
830 # Sed substitution that turns a string into a regex matching for the
831 # string literally.
832 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
834 # Sed substitution that converts a w32 file name or path
835 # which contains forward slashes, into one that contains
836 # (escaped) backslashes. A very naive implementation.
837 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
839 # Re-`\' parameter expansions in output of double_quote_subst that were
840 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
841 # in input to double_quote_subst, that '$' was protected from expansion.
842 # Since each input `\' is now two `\'s, look for any number of runs of
843 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
844 bs='\\'
845 bs2='\\\\'
846 bs4='\\\\\\\\'
847 dollar='\$'
848 sed_double_backslash="\
849 s/$bs4/&\\
851 s/^$bs2$dollar/$bs&/
852 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
853 s/\n//g"
855 # Standard options:
856 opt_dry_run=false
857 opt_help=false
858 opt_quiet=false
859 opt_verbose=false
860 opt_warning=:
862 # func_echo arg...
863 # Echo program name prefixed message, along with the current mode
864 # name if it has been set yet.
865 func_echo ()
867 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
870 # func_verbose arg...
871 # Echo program name prefixed message in verbose mode only.
872 func_verbose ()
874 $opt_verbose && func_echo ${1+"$@"}
876 # A bug in bash halts the script if the last line of a function
877 # fails when set -e is in force, so we need another command to
878 # work around that:
882 # func_echo_all arg...
883 # Invoke $ECHO with all args, space-separated.
884 func_echo_all ()
886 $ECHO "$*"
889 # func_error arg...
890 # Echo program name prefixed message to standard error.
891 func_error ()
893 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
896 # func_warning arg...
897 # Echo program name prefixed warning message to standard error.
898 func_warning ()
900 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
902 # bash bug again:
906 # func_fatal_error arg...
907 # Echo program name prefixed message to standard error, and exit.
908 func_fatal_error ()
910 func_error ${1+"$@"}
911 exit $EXIT_FAILURE
914 # func_fatal_help arg...
915 # Echo program name prefixed message to standard error, followed by
916 # a help hint, and exit.
917 func_fatal_help ()
919 func_error ${1+"$@"}
920 func_fatal_error "$help"
922 help="Try \`$progname --help' for more information." ## default
925 # func_grep expression filename
926 # Check whether EXPRESSION matches any line of FILENAME, without output.
927 func_grep ()
929 $GREP "$1" "$2" >/dev/null 2>&1
933 # func_mkdir_p directory-path
934 # Make sure the entire path to DIRECTORY-PATH is available.
935 func_mkdir_p ()
937 my_directory_path="$1"
938 my_dir_list=
940 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
942 # Protect directory names starting with `-'
943 case $my_directory_path in
944 -*) my_directory_path="./$my_directory_path" ;;
945 esac
947 # While some portion of DIR does not yet exist...
948 while test ! -d "$my_directory_path"; do
949 # ...make a list in topmost first order. Use a colon delimited
950 # list incase some portion of path contains whitespace.
951 my_dir_list="$my_directory_path:$my_dir_list"
953 # If the last portion added has no slash in it, the list is done
954 case $my_directory_path in */*) ;; *) break ;; esac
956 # ...otherwise throw away the child directory and loop
957 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
958 done
959 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
961 save_mkdir_p_IFS="$IFS"; IFS=':'
962 for my_dir in $my_dir_list; do
963 IFS="$save_mkdir_p_IFS"
964 # mkdir can fail with a `File exist' error if two processes
965 # try to create one of the directories concurrently. Don't
966 # stop in that case!
967 $MKDIR "$my_dir" 2>/dev/null || :
968 done
969 IFS="$save_mkdir_p_IFS"
971 # Bail out if we (or some other process) failed to create a directory.
972 test -d "$my_directory_path" || \
973 func_fatal_error "Failed to create \`$1'"
978 # func_mktempdir [string]
979 # Make a temporary directory that won't clash with other running
980 # libtool processes, and avoids race conditions if possible. If
981 # given, STRING is the basename for that directory.
982 func_mktempdir ()
984 my_template="${TMPDIR-/tmp}/${1-$progname}"
986 if test "$opt_dry_run" = ":"; then
987 # Return a directory name, but don't create it in dry-run mode
988 my_tmpdir="${my_template}-$$"
989 else
991 # If mktemp works, use that first and foremost
992 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
994 if test ! -d "$my_tmpdir"; then
995 # Failing that, at least try and use $RANDOM to avoid a race
996 my_tmpdir="${my_template}-${RANDOM-0}$$"
998 save_mktempdir_umask=`umask`
999 umask 0077
1000 $MKDIR "$my_tmpdir"
1001 umask $save_mktempdir_umask
1004 # If we're not in dry-run mode, bomb out on failure
1005 test -d "$my_tmpdir" || \
1006 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1009 $ECHO "$my_tmpdir"
1013 # func_quote_for_eval arg
1014 # Aesthetically quote ARG to be evaled later.
1015 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1016 # is double-quoted, suitable for a subsequent eval, whereas
1017 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1018 # which are still active within double quotes backslashified.
1019 func_quote_for_eval ()
1021 case $1 in
1022 *[\\\`\"\$]*)
1023 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
1025 func_quote_for_eval_unquoted_result="$1" ;;
1026 esac
1028 case $func_quote_for_eval_unquoted_result in
1029 # Double-quote args containing shell metacharacters to delay
1030 # word splitting, command substitution and and variable
1031 # expansion for a subsequent eval.
1032 # Many Bourne shells cannot handle close brackets correctly
1033 # in scan sets, so we specify it separately.
1034 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1035 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1038 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1039 esac
1043 # func_quote_for_expand arg
1044 # Aesthetically quote ARG to be evaled later; same as above,
1045 # but do not quote variable references.
1046 func_quote_for_expand ()
1048 case $1 in
1049 *[\\\`\"]*)
1050 my_arg=`$ECHO "$1" | $SED \
1051 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1053 my_arg="$1" ;;
1054 esac
1056 case $my_arg in
1057 # Double-quote args containing shell metacharacters to delay
1058 # word splitting and command substitution for a subsequent eval.
1059 # Many Bourne shells cannot handle close brackets correctly
1060 # in scan sets, so we specify it separately.
1061 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1062 my_arg="\"$my_arg\""
1064 esac
1066 func_quote_for_expand_result="$my_arg"
1070 # func_show_eval cmd [fail_exp]
1071 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1072 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1073 # is given, then evaluate it.
1074 func_show_eval ()
1076 my_cmd="$1"
1077 my_fail_exp="${2-:}"
1079 ${opt_silent-false} || {
1080 func_quote_for_expand "$my_cmd"
1081 eval "func_echo $func_quote_for_expand_result"
1084 if ${opt_dry_run-false}; then :; else
1085 eval "$my_cmd"
1086 my_status=$?
1087 if test "$my_status" -eq 0; then :; else
1088 eval "(exit $my_status); $my_fail_exp"
1094 # func_show_eval_locale cmd [fail_exp]
1095 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1096 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1097 # is given, then evaluate it. Use the saved locale for evaluation.
1098 func_show_eval_locale ()
1100 my_cmd="$1"
1101 my_fail_exp="${2-:}"
1103 ${opt_silent-false} || {
1104 func_quote_for_expand "$my_cmd"
1105 eval "func_echo $func_quote_for_expand_result"
1108 if ${opt_dry_run-false}; then :; else
1109 eval "$lt_user_locale
1110 $my_cmd"
1111 my_status=$?
1112 eval "$lt_safe_locale"
1113 if test "$my_status" -eq 0; then :; else
1114 eval "(exit $my_status); $my_fail_exp"
1119 # func_tr_sh
1120 # Turn $1 into a string suitable for a shell variable name.
1121 # Result is stored in $func_tr_sh_result. All characters
1122 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1123 # if $1 begins with a digit, a '_' is prepended as well.
1124 func_tr_sh ()
1126 case $1 in
1127 [0-9]* | *[!a-zA-Z0-9_]*)
1128 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
1131 func_tr_sh_result=$1
1133 esac
1137 # func_version
1138 # Echo version message to standard output and exit.
1139 func_version ()
1141 $opt_debug
1143 $SED -n '/(C)/!b go
1144 :more
1145 /\./!{
1147 s/\n# / /
1148 b more
1151 /^# '$PROGRAM' (GNU /,/# warranty; / {
1152 s/^# //
1153 s/^# *$//
1154 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1156 }' < "$progpath"
1157 exit $?
1160 # func_usage
1161 # Echo short help message to standard output and exit.
1162 func_usage ()
1164 $opt_debug
1166 $SED -n '/^# Usage:/,/^# *.*--help/ {
1167 s/^# //
1168 s/^# *$//
1169 s/\$progname/'$progname'/
1171 }' < "$progpath"
1172 echo
1173 $ECHO "run \`$progname --help | more' for full usage"
1174 exit $?
1177 # func_help [NOEXIT]
1178 # Echo long help message to standard output and exit,
1179 # unless 'noexit' is passed as argument.
1180 func_help ()
1182 $opt_debug
1184 $SED -n '/^# Usage:/,/# Report bugs to/ {
1185 :print
1186 s/^# //
1187 s/^# *$//
1188 s*\$progname*'$progname'*
1189 s*\$host*'"$host"'*
1190 s*\$SHELL*'"$SHELL"'*
1191 s*\$LTCC*'"$LTCC"'*
1192 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1193 s*\$LD*'"$LD"'*
1194 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1195 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
1196 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
1200 /^# .* home page:/b print
1201 /^# General help using/b print
1202 ' < "$progpath"
1203 ret=$?
1204 if test -z "$1"; then
1205 exit $ret
1209 # func_missing_arg argname
1210 # Echo program name prefixed message to standard error and set global
1211 # exit_cmd.
1212 func_missing_arg ()
1214 $opt_debug
1216 func_error "missing argument for $1."
1217 exit_cmd=exit
1221 # func_split_short_opt shortopt
1222 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1223 # variables after splitting SHORTOPT after the 2nd character.
1224 func_split_short_opt ()
1226 func_split_short_opt_arg=${1#??}
1227 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1228 } # Extended-shell func_split_short_opt implementation
1231 # func_split_long_opt longopt
1232 # Set func_split_long_opt_name and func_split_long_opt_arg shell
1233 # variables after splitting LONGOPT at the `=' sign.
1234 func_split_long_opt ()
1236 func_split_long_opt_name=${1%%=*}
1237 func_split_long_opt_arg=${1#*=}
1238 } # Extended-shell func_split_long_opt implementation
1240 exit_cmd=:
1246 magic="%%%MAGIC variable%%%"
1247 magic_exe="%%%MAGIC EXE variable%%%"
1249 # Global variables.
1250 nonopt=
1251 preserve_args=
1252 lo2o="s/\\.lo\$/.${objext}/"
1253 o2lo="s/\\.${objext}\$/.lo/"
1254 extracted_archives=
1255 extracted_serial=0
1257 # If this variable is set in any of the actions, the command in it
1258 # will be execed at the end. This prevents here-documents from being
1259 # left over by shells.
1260 exec_cmd=
1262 # func_append var value
1263 # Append VALUE to the end of shell variable VAR.
1264 func_append ()
1266 eval "${1}+=\${2}"
1267 } # Extended-shell func_append implementation
1269 # func_append_quoted var value
1270 # Quote VALUE and append to the end of shell variable VAR, separated
1271 # by a space.
1272 func_append_quoted ()
1274 func_quote_for_eval "${2}"
1275 eval "${1}+=\\ \$func_quote_for_eval_result"
1276 } # Extended-shell func_append_quoted implementation
1279 # func_arith arithmetic-term...
1280 func_arith ()
1282 func_arith_result=$(( $* ))
1283 } # Extended-shell func_arith implementation
1286 # func_len string
1287 # STRING may not start with a hyphen.
1288 func_len ()
1290 func_len_result=${#1}
1291 } # Extended-shell func_len implementation
1294 # func_lo2o object
1295 func_lo2o ()
1297 case ${1} in
1298 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
1299 *) func_lo2o_result=${1} ;;
1300 esac
1301 } # Extended-shell func_lo2o implementation
1304 # func_xform libobj-or-source
1305 func_xform ()
1307 func_xform_result=${1%.*}.lo
1308 } # Extended-shell func_xform implementation
1311 # func_fatal_configuration arg...
1312 # Echo program name prefixed message to standard error, followed by
1313 # a configuration failure hint, and exit.
1314 func_fatal_configuration ()
1316 func_error ${1+"$@"}
1317 func_error "See the $PACKAGE documentation for more information."
1318 func_fatal_error "Fatal configuration error."
1322 # func_config
1323 # Display the configuration for all the tags in this script.
1324 func_config ()
1326 re_begincf='^# ### BEGIN LIBTOOL'
1327 re_endcf='^# ### END LIBTOOL'
1329 # Default configuration.
1330 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1332 # Now print the configurations for the tags.
1333 for tagname in $taglist; do
1334 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1335 done
1337 exit $?
1340 # func_features
1341 # Display the features supported by this script.
1342 func_features ()
1344 echo "host: $host"
1345 if test "$build_libtool_libs" = yes; then
1346 echo "enable shared libraries"
1347 else
1348 echo "disable shared libraries"
1350 if test "$build_old_libs" = yes; then
1351 echo "enable static libraries"
1352 else
1353 echo "disable static libraries"
1356 exit $?
1359 # func_enable_tag tagname
1360 # Verify that TAGNAME is valid, and either flag an error and exit, or
1361 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1362 # variable here.
1363 func_enable_tag ()
1365 # Global variable:
1366 tagname="$1"
1368 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1369 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1370 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1372 # Validate tagname.
1373 case $tagname in
1374 *[!-_A-Za-z0-9,/]*)
1375 func_fatal_error "invalid tag name: $tagname"
1377 esac
1379 # Don't test for the "default" C tag, as we know it's
1380 # there but not specially marked.
1381 case $tagname in
1382 CC) ;;
1384 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1385 taglist="$taglist $tagname"
1387 # Evaluate the configuration. Be careful to quote the path
1388 # and the sed script, to avoid splitting on whitespace, but
1389 # also don't use non-portable quotes within backquotes within
1390 # quotes we have to do it in 2 steps:
1391 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1392 eval "$extractedcf"
1393 else
1394 func_error "ignoring unknown tag $tagname"
1397 esac
1400 # func_check_version_match
1401 # Ensure that we are using m4 macros, and libtool script from the same
1402 # release of libtool.
1403 func_check_version_match ()
1405 if test "$package_revision" != "$macro_revision"; then
1406 if test "$VERSION" != "$macro_version"; then
1407 if test -z "$macro_version"; then
1408 cat >&2 <<_LT_EOF
1409 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1410 $progname: definition of this LT_INIT comes from an older release.
1411 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1412 $progname: and run autoconf again.
1413 _LT_EOF
1414 else
1415 cat >&2 <<_LT_EOF
1416 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1417 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1418 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1419 $progname: and run autoconf again.
1420 _LT_EOF
1422 else
1423 cat >&2 <<_LT_EOF
1424 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1425 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1426 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1427 $progname: of $PACKAGE $VERSION and run autoconf again.
1428 _LT_EOF
1431 exit $EXIT_MISMATCH
1436 # Shorthand for --mode=foo, only valid as the first argument
1437 case $1 in
1438 clean|clea|cle|cl)
1439 shift; set dummy --mode clean ${1+"$@"}; shift
1441 compile|compil|compi|comp|com|co|c)
1442 shift; set dummy --mode compile ${1+"$@"}; shift
1444 execute|execut|execu|exec|exe|ex|e)
1445 shift; set dummy --mode execute ${1+"$@"}; shift
1447 finish|finis|fini|fin|fi|f)
1448 shift; set dummy --mode finish ${1+"$@"}; shift
1450 install|instal|insta|inst|ins|in|i)
1451 shift; set dummy --mode install ${1+"$@"}; shift
1453 link|lin|li|l)
1454 shift; set dummy --mode link ${1+"$@"}; shift
1456 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1457 shift; set dummy --mode uninstall ${1+"$@"}; shift
1459 esac
1463 # Option defaults:
1464 opt_debug=:
1465 opt_dry_run=false
1466 opt_config=false
1467 opt_preserve_dup_deps=false
1468 opt_features=false
1469 opt_finish=false
1470 opt_help=false
1471 opt_help_all=false
1472 opt_silent=:
1473 opt_warning=:
1474 opt_verbose=:
1475 opt_silent=false
1476 opt_verbose=false
1479 # Parse options once, thoroughly. This comes as soon as possible in the
1480 # script to make things like `--version' happen as quickly as we can.
1482 # this just eases exit handling
1483 while test $# -gt 0; do
1484 opt="$1"
1485 shift
1486 case $opt in
1487 --debug|-x) opt_debug='set -x'
1488 func_echo "enabling shell trace mode"
1489 $opt_debug
1491 --dry-run|--dryrun|-n)
1492 opt_dry_run=:
1494 --config)
1495 opt_config=:
1496 func_config
1498 --dlopen|-dlopen)
1499 optarg="$1"
1500 opt_dlopen="${opt_dlopen+$opt_dlopen
1501 }$optarg"
1502 shift
1504 --preserve-dup-deps)
1505 opt_preserve_dup_deps=:
1507 --features)
1508 opt_features=:
1509 func_features
1511 --finish)
1512 opt_finish=:
1513 set dummy --mode finish ${1+"$@"}; shift
1515 --help)
1516 opt_help=:
1518 --help-all)
1519 opt_help_all=:
1520 opt_help=': help-all'
1522 --mode)
1523 test $# = 0 && func_missing_arg $opt && break
1524 optarg="$1"
1525 opt_mode="$optarg"
1526 case $optarg in
1527 # Valid mode arguments:
1528 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1530 # Catch anything else as an error
1531 *) func_error "invalid argument for $opt"
1532 exit_cmd=exit
1533 break
1535 esac
1536 shift
1538 --no-silent|--no-quiet)
1539 opt_silent=false
1540 preserve_args+=" $opt"
1542 --no-warning|--no-warn)
1543 opt_warning=false
1544 preserve_args+=" $opt"
1546 --no-verbose)
1547 opt_verbose=false
1548 preserve_args+=" $opt"
1550 --silent|--quiet)
1551 opt_silent=:
1552 preserve_args+=" $opt"
1553 opt_verbose=false
1555 --verbose|-v)
1556 opt_verbose=:
1557 preserve_args+=" $opt"
1558 opt_silent=false
1560 --tag)
1561 test $# = 0 && func_missing_arg $opt && break
1562 optarg="$1"
1563 opt_tag="$optarg"
1564 preserve_args+=" $opt $optarg"
1565 func_enable_tag "$optarg"
1566 shift
1569 -\?|-h) func_usage ;;
1570 --help) func_help ;;
1571 --version) func_version ;;
1573 # Separate optargs to long options:
1574 --*=*)
1575 func_split_long_opt "$opt"
1576 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1577 shift
1580 # Separate non-argument short options:
1581 -\?*|-h*|-n*|-v*)
1582 func_split_short_opt "$opt"
1583 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1584 shift
1587 --) break ;;
1588 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1589 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
1590 esac
1591 done
1593 # Validate options:
1595 # save first non-option argument
1596 if test "$#" -gt 0; then
1597 nonopt="$opt"
1598 shift
1601 # preserve --debug
1602 test "$opt_debug" = : || preserve_args+=" --debug"
1604 case $host in
1605 *cygwin* | *mingw* | *pw32* | *cegcc*)
1606 # don't eliminate duplications in $postdeps and $predeps
1607 opt_duplicate_compiler_generated_deps=:
1610 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1612 esac
1614 $opt_help || {
1615 # Sanity checks first:
1616 func_check_version_match
1618 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1619 func_fatal_configuration "not configured to build any kind of library"
1622 # Darwin sucks
1623 eval std_shrext=\"$shrext_cmds\"
1625 # Only execute mode is allowed to have -dlopen flags.
1626 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1627 func_error "unrecognized option \`-dlopen'"
1628 $ECHO "$help" 1>&2
1629 exit $EXIT_FAILURE
1632 # Change the help message to a mode-specific one.
1633 generic_help="$help"
1634 help="Try \`$progname --help --mode=$opt_mode' for more information."
1638 # Bail if the options were screwed
1639 $exit_cmd $EXIT_FAILURE
1645 ## ----------- ##
1646 ## Main. ##
1647 ## ----------- ##
1649 # func_lalib_p file
1650 # True iff FILE is a libtool `.la' library or `.lo' object file.
1651 # This function is only a basic sanity check; it will hardly flush out
1652 # determined imposters.
1653 func_lalib_p ()
1655 test -f "$1" &&
1656 $SED -e 4q "$1" 2>/dev/null \
1657 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1660 # func_lalib_unsafe_p file
1661 # True iff FILE is a libtool `.la' library or `.lo' object file.
1662 # This function implements the same check as func_lalib_p without
1663 # resorting to external programs. To this end, it redirects stdin and
1664 # closes it afterwards, without saving the original file descriptor.
1665 # As a safety measure, use it only where a negative result would be
1666 # fatal anyway. Works if `file' does not exist.
1667 func_lalib_unsafe_p ()
1669 lalib_p=no
1670 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1671 for lalib_p_l in 1 2 3 4
1673 read lalib_p_line
1674 case "$lalib_p_line" in
1675 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1676 esac
1677 done
1678 exec 0<&5 5<&-
1680 test "$lalib_p" = yes
1683 # func_ltwrapper_script_p file
1684 # True iff FILE is a libtool wrapper script
1685 # This function is only a basic sanity check; it will hardly flush out
1686 # determined imposters.
1687 func_ltwrapper_script_p ()
1689 func_lalib_p "$1"
1692 # func_ltwrapper_executable_p file
1693 # True iff FILE is a libtool wrapper executable
1694 # This function is only a basic sanity check; it will hardly flush out
1695 # determined imposters.
1696 func_ltwrapper_executable_p ()
1698 func_ltwrapper_exec_suffix=
1699 case $1 in
1700 *.exe) ;;
1701 *) func_ltwrapper_exec_suffix=.exe ;;
1702 esac
1703 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1706 # func_ltwrapper_scriptname file
1707 # Assumes file is an ltwrapper_executable
1708 # uses $file to determine the appropriate filename for a
1709 # temporary ltwrapper_script.
1710 func_ltwrapper_scriptname ()
1712 func_dirname_and_basename "$1" "" "."
1713 func_stripname '' '.exe' "$func_basename_result"
1714 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1717 # func_ltwrapper_p file
1718 # True iff FILE is a libtool wrapper script or wrapper executable
1719 # This function is only a basic sanity check; it will hardly flush out
1720 # determined imposters.
1721 func_ltwrapper_p ()
1723 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1727 # func_execute_cmds commands fail_cmd
1728 # Execute tilde-delimited COMMANDS.
1729 # If FAIL_CMD is given, eval that upon failure.
1730 # FAIL_CMD may read-access the current command in variable CMD!
1731 func_execute_cmds ()
1733 $opt_debug
1734 save_ifs=$IFS; IFS='~'
1735 for cmd in $1; do
1736 IFS=$save_ifs
1737 eval cmd=\"$cmd\"
1738 func_show_eval "$cmd" "${2-:}"
1739 done
1740 IFS=$save_ifs
1744 # func_source file
1745 # Source FILE, adding directory component if necessary.
1746 # Note that it is not necessary on cygwin/mingw to append a dot to
1747 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1748 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1749 # `FILE.' does not work on cygwin managed mounts.
1750 func_source ()
1752 $opt_debug
1753 case $1 in
1754 */* | *\\*) . "$1" ;;
1755 *) . "./$1" ;;
1756 esac
1760 # func_resolve_sysroot PATH
1761 # Replace a leading = in PATH with a sysroot. Store the result into
1762 # func_resolve_sysroot_result
1763 func_resolve_sysroot ()
1765 func_resolve_sysroot_result=$1
1766 case $func_resolve_sysroot_result in
1768 func_stripname '=' '' "$func_resolve_sysroot_result"
1769 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1771 esac
1774 # func_replace_sysroot PATH
1775 # If PATH begins with the sysroot, replace it with = and
1776 # store the result into func_replace_sysroot_result.
1777 func_replace_sysroot ()
1779 case "$lt_sysroot:$1" in
1780 ?*:"$lt_sysroot"*)
1781 func_stripname "$lt_sysroot" '' "$1"
1782 func_replace_sysroot_result="=$func_stripname_result"
1785 # Including no sysroot.
1786 func_replace_sysroot_result=$1
1788 esac
1791 # func_infer_tag arg
1792 # Infer tagged configuration to use if any are available and
1793 # if one wasn't chosen via the "--tag" command line option.
1794 # Only attempt this if the compiler in the base compile
1795 # command doesn't match the default compiler.
1796 # arg is usually of the form 'gcc ...'
1797 func_infer_tag ()
1799 $opt_debug
1800 if test -n "$available_tags" && test -z "$tagname"; then
1801 CC_quoted=
1802 for arg in $CC; do
1803 func_append_quoted CC_quoted "$arg"
1804 done
1805 CC_expanded=`func_echo_all $CC`
1806 CC_quoted_expanded=`func_echo_all $CC_quoted`
1807 case $@ in
1808 # Blanks in the command may have been stripped by the calling shell,
1809 # but not from the CC environment variable when configure was run.
1810 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1811 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1812 # Blanks at the start of $base_compile will cause this to fail
1813 # if we don't check for them as well.
1815 for z in $available_tags; do
1816 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1817 # Evaluate the configuration.
1818 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1819 CC_quoted=
1820 for arg in $CC; do
1821 # Double-quote args containing other shell metacharacters.
1822 func_append_quoted CC_quoted "$arg"
1823 done
1824 CC_expanded=`func_echo_all $CC`
1825 CC_quoted_expanded=`func_echo_all $CC_quoted`
1826 case "$@ " in
1827 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1828 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1829 # The compiler in the base compile command matches
1830 # the one in the tagged configuration.
1831 # Assume this is the tagged configuration we want.
1832 tagname=$z
1833 break
1835 esac
1837 done
1838 # If $tagname still isn't set, then no tagged configuration
1839 # was found and let the user know that the "--tag" command
1840 # line option must be used.
1841 if test -z "$tagname"; then
1842 func_echo "unable to infer tagged configuration"
1843 func_fatal_error "specify a tag with \`--tag'"
1844 # else
1845 # func_verbose "using $tagname tagged configuration"
1848 esac
1854 # func_write_libtool_object output_name pic_name nonpic_name
1855 # Create a libtool object file (analogous to a ".la" file),
1856 # but don't create it if we're doing a dry run.
1857 func_write_libtool_object ()
1859 write_libobj=${1}
1860 if test "$build_libtool_libs" = yes; then
1861 write_lobj=\'${2}\'
1862 else
1863 write_lobj=none
1866 if test "$build_old_libs" = yes; then
1867 write_oldobj=\'${3}\'
1868 else
1869 write_oldobj=none
1872 $opt_dry_run || {
1873 cat >${write_libobj}T <<EOF
1874 # $write_libobj - a libtool object file
1875 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1877 # Please DO NOT delete this file!
1878 # It is necessary for linking the library.
1880 # Name of the PIC object.
1881 pic_object=$write_lobj
1883 # Name of the non-PIC object
1884 non_pic_object=$write_oldobj
1887 $MV "${write_libobj}T" "${write_libobj}"
1892 ##################################################
1893 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1894 ##################################################
1896 # func_convert_core_file_wine_to_w32 ARG
1897 # Helper function used by file name conversion functions when $build is *nix,
1898 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
1899 # correctly configured wine environment available, with the winepath program
1900 # in $build's $PATH.
1902 # ARG is the $build file name to be converted to w32 format.
1903 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
1904 # be empty on error (or when ARG is empty)
1905 func_convert_core_file_wine_to_w32 ()
1907 $opt_debug
1908 func_convert_core_file_wine_to_w32_result="$1"
1909 if test -n "$1"; then
1910 # Unfortunately, winepath does not exit with a non-zero error code, so we
1911 # are forced to check the contents of stdout. On the other hand, if the
1912 # command is not found, the shell will set an exit code of 127 and print
1913 # *an error message* to stdout. So we must check for both error code of
1914 # zero AND non-empty stdout, which explains the odd construction:
1915 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1916 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1917 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1918 $SED -e "$lt_sed_naive_backslashify"`
1919 else
1920 func_convert_core_file_wine_to_w32_result=
1924 # end: func_convert_core_file_wine_to_w32
1927 # func_convert_core_path_wine_to_w32 ARG
1928 # Helper function used by path conversion functions when $build is *nix, and
1929 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1930 # configured wine environment available, with the winepath program in $build's
1931 # $PATH. Assumes ARG has no leading or trailing path separator characters.
1933 # ARG is path to be converted from $build format to win32.
1934 # Result is available in $func_convert_core_path_wine_to_w32_result.
1935 # Unconvertible file (directory) names in ARG are skipped; if no directory names
1936 # are convertible, then the result may be empty.
1937 func_convert_core_path_wine_to_w32 ()
1939 $opt_debug
1940 # unfortunately, winepath doesn't convert paths, only file names
1941 func_convert_core_path_wine_to_w32_result=""
1942 if test -n "$1"; then
1943 oldIFS=$IFS
1944 IFS=:
1945 for func_convert_core_path_wine_to_w32_f in $1; do
1946 IFS=$oldIFS
1947 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1948 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1949 if test -z "$func_convert_core_path_wine_to_w32_result"; then
1950 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1951 else
1952 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1955 done
1956 IFS=$oldIFS
1959 # end: func_convert_core_path_wine_to_w32
1962 # func_cygpath ARGS...
1963 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1964 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1965 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1966 # (2), returns the Cygwin file name or path in func_cygpath_result (input
1967 # file name or path is assumed to be in w32 format, as previously converted
1968 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
1969 # or path in func_cygpath_result (input file name or path is assumed to be in
1970 # Cygwin format). Returns an empty string on error.
1972 # ARGS are passed to cygpath, with the last one being the file name or path to
1973 # be converted.
1975 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1976 # environment variable; do not put it in $PATH.
1977 func_cygpath ()
1979 $opt_debug
1980 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1981 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1982 if test "$?" -ne 0; then
1983 # on failure, ensure result is empty
1984 func_cygpath_result=
1986 else
1987 func_cygpath_result=
1988 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1991 #end: func_cygpath
1994 # func_convert_core_msys_to_w32 ARG
1995 # Convert file name or path ARG from MSYS format to w32 format. Return
1996 # result in func_convert_core_msys_to_w32_result.
1997 func_convert_core_msys_to_w32 ()
1999 $opt_debug
2000 # awkward: cmd appends spaces to result
2001 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
2002 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
2004 #end: func_convert_core_msys_to_w32
2007 # func_convert_file_check ARG1 ARG2
2008 # Verify that ARG1 (a file name in $build format) was converted to $host
2009 # format in ARG2. Otherwise, emit an error message, but continue (resetting
2010 # func_to_host_file_result to ARG1).
2011 func_convert_file_check ()
2013 $opt_debug
2014 if test -z "$2" && test -n "$1" ; then
2015 func_error "Could not determine host file name corresponding to"
2016 func_error " \`$1'"
2017 func_error "Continuing, but uninstalled executables may not work."
2018 # Fallback:
2019 func_to_host_file_result="$1"
2022 # end func_convert_file_check
2025 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
2026 # Verify that FROM_PATH (a path in $build format) was converted to $host
2027 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
2028 # func_to_host_file_result to a simplistic fallback value (see below).
2029 func_convert_path_check ()
2031 $opt_debug
2032 if test -z "$4" && test -n "$3"; then
2033 func_error "Could not determine the host path corresponding to"
2034 func_error " \`$3'"
2035 func_error "Continuing, but uninstalled executables may not work."
2036 # Fallback. This is a deliberately simplistic "conversion" and
2037 # should not be "improved". See libtool.info.
2038 if test "x$1" != "x$2"; then
2039 lt_replace_pathsep_chars="s|$1|$2|g"
2040 func_to_host_path_result=`echo "$3" |
2041 $SED -e "$lt_replace_pathsep_chars"`
2042 else
2043 func_to_host_path_result="$3"
2047 # end func_convert_path_check
2050 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
2051 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
2052 # and appending REPL if ORIG matches BACKPAT.
2053 func_convert_path_front_back_pathsep ()
2055 $opt_debug
2056 case $4 in
2057 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
2059 esac
2060 case $4 in
2061 $2 ) func_to_host_path_result+="$3"
2063 esac
2065 # end func_convert_path_front_back_pathsep
2068 ##################################################
2069 # $build to $host FILE NAME CONVERSION FUNCTIONS #
2070 ##################################################
2071 # invoked via `$to_host_file_cmd ARG'
2073 # In each case, ARG is the path to be converted from $build to $host format.
2074 # Result will be available in $func_to_host_file_result.
2077 # func_to_host_file ARG
2078 # Converts the file name ARG from $build format to $host format. Return result
2079 # in func_to_host_file_result.
2080 func_to_host_file ()
2082 $opt_debug
2083 $to_host_file_cmd "$1"
2085 # end func_to_host_file
2088 # func_to_tool_file ARG LAZY
2089 # converts the file name ARG from $build format to toolchain format. Return
2090 # result in func_to_tool_file_result. If the conversion in use is listed
2091 # in (the comma separated) LAZY, no conversion takes place.
2092 func_to_tool_file ()
2094 $opt_debug
2095 case ,$2, in
2096 *,"$to_tool_file_cmd",*)
2097 func_to_tool_file_result=$1
2100 $to_tool_file_cmd "$1"
2101 func_to_tool_file_result=$func_to_host_file_result
2103 esac
2105 # end func_to_tool_file
2108 # func_convert_file_noop ARG
2109 # Copy ARG to func_to_host_file_result.
2110 func_convert_file_noop ()
2112 func_to_host_file_result="$1"
2114 # end func_convert_file_noop
2117 # func_convert_file_msys_to_w32 ARG
2118 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
2119 # conversion to w32 is not available inside the cwrapper. Returns result in
2120 # func_to_host_file_result.
2121 func_convert_file_msys_to_w32 ()
2123 $opt_debug
2124 func_to_host_file_result="$1"
2125 if test -n "$1"; then
2126 func_convert_core_msys_to_w32 "$1"
2127 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
2129 func_convert_file_check "$1" "$func_to_host_file_result"
2131 # end func_convert_file_msys_to_w32
2134 # func_convert_file_cygwin_to_w32 ARG
2135 # Convert file name ARG from Cygwin to w32 format. Returns result in
2136 # func_to_host_file_result.
2137 func_convert_file_cygwin_to_w32 ()
2139 $opt_debug
2140 func_to_host_file_result="$1"
2141 if test -n "$1"; then
2142 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
2143 # LT_CYGPATH in this case.
2144 func_to_host_file_result=`cygpath -m "$1"`
2146 func_convert_file_check "$1" "$func_to_host_file_result"
2148 # end func_convert_file_cygwin_to_w32
2151 # func_convert_file_nix_to_w32 ARG
2152 # Convert file name ARG from *nix to w32 format. Requires a wine environment
2153 # and a working winepath. Returns result in func_to_host_file_result.
2154 func_convert_file_nix_to_w32 ()
2156 $opt_debug
2157 func_to_host_file_result="$1"
2158 if test -n "$1"; then
2159 func_convert_core_file_wine_to_w32 "$1"
2160 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
2162 func_convert_file_check "$1" "$func_to_host_file_result"
2164 # end func_convert_file_nix_to_w32
2167 # func_convert_file_msys_to_cygwin ARG
2168 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
2169 # Returns result in func_to_host_file_result.
2170 func_convert_file_msys_to_cygwin ()
2172 $opt_debug
2173 func_to_host_file_result="$1"
2174 if test -n "$1"; then
2175 func_convert_core_msys_to_w32 "$1"
2176 func_cygpath -u "$func_convert_core_msys_to_w32_result"
2177 func_to_host_file_result="$func_cygpath_result"
2179 func_convert_file_check "$1" "$func_to_host_file_result"
2181 # end func_convert_file_msys_to_cygwin
2184 # func_convert_file_nix_to_cygwin ARG
2185 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
2186 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
2187 # in func_to_host_file_result.
2188 func_convert_file_nix_to_cygwin ()
2190 $opt_debug
2191 func_to_host_file_result="$1"
2192 if test -n "$1"; then
2193 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
2194 func_convert_core_file_wine_to_w32 "$1"
2195 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
2196 func_to_host_file_result="$func_cygpath_result"
2198 func_convert_file_check "$1" "$func_to_host_file_result"
2200 # end func_convert_file_nix_to_cygwin
2203 #############################################
2204 # $build to $host PATH CONVERSION FUNCTIONS #
2205 #############################################
2206 # invoked via `$to_host_path_cmd ARG'
2208 # In each case, ARG is the path to be converted from $build to $host format.
2209 # The result will be available in $func_to_host_path_result.
2211 # Path separators are also converted from $build format to $host format. If
2212 # ARG begins or ends with a path separator character, it is preserved (but
2213 # converted to $host format) on output.
2215 # All path conversion functions are named using the following convention:
2216 # file name conversion function : func_convert_file_X_to_Y ()
2217 # path conversion function : func_convert_path_X_to_Y ()
2218 # where, for any given $build/$host combination the 'X_to_Y' value is the
2219 # same. If conversion functions are added for new $build/$host combinations,
2220 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
2221 # will break.
2224 # func_init_to_host_path_cmd
2225 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
2226 # appropriate value, based on the value of $to_host_file_cmd.
2227 to_host_path_cmd=
2228 func_init_to_host_path_cmd ()
2230 $opt_debug
2231 if test -z "$to_host_path_cmd"; then
2232 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
2233 to_host_path_cmd="func_convert_path_${func_stripname_result}"
2238 # func_to_host_path ARG
2239 # Converts the path ARG from $build format to $host format. Return result
2240 # in func_to_host_path_result.
2241 func_to_host_path ()
2243 $opt_debug
2244 func_init_to_host_path_cmd
2245 $to_host_path_cmd "$1"
2247 # end func_to_host_path
2250 # func_convert_path_noop ARG
2251 # Copy ARG to func_to_host_path_result.
2252 func_convert_path_noop ()
2254 func_to_host_path_result="$1"
2256 # end func_convert_path_noop
2259 # func_convert_path_msys_to_w32 ARG
2260 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
2261 # conversion to w32 is not available inside the cwrapper. Returns result in
2262 # func_to_host_path_result.
2263 func_convert_path_msys_to_w32 ()
2265 $opt_debug
2266 func_to_host_path_result="$1"
2267 if test -n "$1"; then
2268 # Remove leading and trailing path separator characters from ARG. MSYS
2269 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
2270 # and winepath ignores them completely.
2271 func_stripname : : "$1"
2272 func_to_host_path_tmp1=$func_stripname_result
2273 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
2274 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
2275 func_convert_path_check : ";" \
2276 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2277 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2280 # end func_convert_path_msys_to_w32
2283 # func_convert_path_cygwin_to_w32 ARG
2284 # Convert path ARG from Cygwin to w32 format. Returns result in
2285 # func_to_host_file_result.
2286 func_convert_path_cygwin_to_w32 ()
2288 $opt_debug
2289 func_to_host_path_result="$1"
2290 if test -n "$1"; then
2291 # See func_convert_path_msys_to_w32:
2292 func_stripname : : "$1"
2293 func_to_host_path_tmp1=$func_stripname_result
2294 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
2295 func_convert_path_check : ";" \
2296 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2297 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2300 # end func_convert_path_cygwin_to_w32
2303 # func_convert_path_nix_to_w32 ARG
2304 # Convert path ARG from *nix to w32 format. Requires a wine environment and
2305 # a working winepath. Returns result in func_to_host_file_result.
2306 func_convert_path_nix_to_w32 ()
2308 $opt_debug
2309 func_to_host_path_result="$1"
2310 if test -n "$1"; then
2311 # See func_convert_path_msys_to_w32:
2312 func_stripname : : "$1"
2313 func_to_host_path_tmp1=$func_stripname_result
2314 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
2315 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
2316 func_convert_path_check : ";" \
2317 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2318 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2321 # end func_convert_path_nix_to_w32
2324 # func_convert_path_msys_to_cygwin ARG
2325 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
2326 # Returns result in func_to_host_file_result.
2327 func_convert_path_msys_to_cygwin ()
2329 $opt_debug
2330 func_to_host_path_result="$1"
2331 if test -n "$1"; then
2332 # See func_convert_path_msys_to_w32:
2333 func_stripname : : "$1"
2334 func_to_host_path_tmp1=$func_stripname_result
2335 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
2336 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
2337 func_to_host_path_result="$func_cygpath_result"
2338 func_convert_path_check : : \
2339 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2340 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
2343 # end func_convert_path_msys_to_cygwin
2346 # func_convert_path_nix_to_cygwin ARG
2347 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
2348 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
2349 # func_to_host_file_result.
2350 func_convert_path_nix_to_cygwin ()
2352 $opt_debug
2353 func_to_host_path_result="$1"
2354 if test -n "$1"; then
2355 # Remove leading and trailing path separator characters from
2356 # ARG. msys behavior is inconsistent here, cygpath turns them
2357 # into '.;' and ';.', and winepath ignores them completely.
2358 func_stripname : : "$1"
2359 func_to_host_path_tmp1=$func_stripname_result
2360 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
2361 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
2362 func_to_host_path_result="$func_cygpath_result"
2363 func_convert_path_check : : \
2364 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2365 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
2368 # end func_convert_path_nix_to_cygwin
2371 # func_mode_compile arg...
2372 func_mode_compile ()
2374 $opt_debug
2375 # Get the compilation command and the source file.
2376 base_compile=
2377 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
2378 suppress_opt=yes
2379 suppress_output=
2380 arg_mode=normal
2381 libobj=
2382 later=
2383 pie_flag=
2385 for arg
2387 case $arg_mode in
2388 arg )
2389 # do not "continue". Instead, add this to base_compile
2390 lastarg="$arg"
2391 arg_mode=normal
2394 target )
2395 libobj="$arg"
2396 arg_mode=normal
2397 continue
2400 normal )
2401 # Accept any command-line options.
2402 case $arg in
2404 test -n "$libobj" && \
2405 func_fatal_error "you cannot specify \`-o' more than once"
2406 arg_mode=target
2407 continue
2410 -pie | -fpie | -fPIE)
2411 pie_flag+=" $arg"
2412 continue
2415 -shared | -static | -prefer-pic | -prefer-non-pic)
2416 later+=" $arg"
2417 continue
2420 -no-suppress)
2421 suppress_opt=no
2422 continue
2425 -Xcompiler)
2426 arg_mode=arg # the next one goes into the "base_compile" arg list
2427 continue # The current "srcfile" will either be retained or
2428 ;; # replaced later. I would guess that would be a bug.
2430 -Wc,*)
2431 func_stripname '-Wc,' '' "$arg"
2432 args=$func_stripname_result
2433 lastarg=
2434 save_ifs="$IFS"; IFS=','
2435 for arg in $args; do
2436 IFS="$save_ifs"
2437 func_append_quoted lastarg "$arg"
2438 done
2439 IFS="$save_ifs"
2440 func_stripname ' ' '' "$lastarg"
2441 lastarg=$func_stripname_result
2443 # Add the arguments to base_compile.
2444 base_compile+=" $lastarg"
2445 continue
2449 # Accept the current argument as the source file.
2450 # The previous "srcfile" becomes the current argument.
2452 lastarg="$srcfile"
2453 srcfile="$arg"
2455 esac # case $arg
2457 esac # case $arg_mode
2459 # Aesthetically quote the previous argument.
2460 func_append_quoted base_compile "$lastarg"
2461 done # for arg
2463 case $arg_mode in
2464 arg)
2465 func_fatal_error "you must specify an argument for -Xcompile"
2467 target)
2468 func_fatal_error "you must specify a target with \`-o'"
2471 # Get the name of the library object.
2472 test -z "$libobj" && {
2473 func_basename "$srcfile"
2474 libobj="$func_basename_result"
2477 esac
2479 # Recognize several different file suffixes.
2480 # If the user specifies -o file.o, it is replaced with file.lo
2481 case $libobj in
2482 *.[cCFSifmso] | \
2483 *.ada | *.adb | *.ads | *.asm | \
2484 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
2485 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
2486 func_xform "$libobj"
2487 libobj=$func_xform_result
2489 esac
2491 case $libobj in
2492 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2494 func_fatal_error "cannot determine name of library object from \`$libobj'"
2496 esac
2498 func_infer_tag $base_compile
2500 for arg in $later; do
2501 case $arg in
2502 -shared)
2503 test "$build_libtool_libs" != yes && \
2504 func_fatal_configuration "can not build a shared library"
2505 build_old_libs=no
2506 continue
2509 -static)
2510 build_libtool_libs=no
2511 build_old_libs=yes
2512 continue
2515 -prefer-pic)
2516 pic_mode=yes
2517 continue
2520 -prefer-non-pic)
2521 pic_mode=no
2522 continue
2524 esac
2525 done
2527 func_quote_for_eval "$libobj"
2528 test "X$libobj" != "X$func_quote_for_eval_result" \
2529 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2530 && func_warning "libobj name \`$libobj' may not contain shell special characters."
2531 func_dirname_and_basename "$obj" "/" ""
2532 objname="$func_basename_result"
2533 xdir="$func_dirname_result"
2534 lobj=${xdir}$objdir/$objname
2536 test -z "$base_compile" && \
2537 func_fatal_help "you must specify a compilation command"
2539 # Delete any leftover library objects.
2540 if test "$build_old_libs" = yes; then
2541 removelist="$obj $lobj $libobj ${libobj}T"
2542 else
2543 removelist="$lobj $libobj ${libobj}T"
2546 # On Cygwin there's no "real" PIC flag so we must build both object types
2547 case $host_os in
2548 cygwin* | mingw* | pw32* | os2* | cegcc*)
2549 pic_mode=default
2551 esac
2552 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2553 # non-PIC code in shared libraries is not supported
2554 pic_mode=default
2557 # Calculate the filename of the output object if compiler does
2558 # not support -o with -c
2559 if test "$compiler_c_o" = no; then
2560 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2561 lockfile="$output_obj.lock"
2562 else
2563 output_obj=
2564 need_locks=no
2565 lockfile=
2568 # Lock this critical section if it is needed
2569 # We use this script file to make the link, it avoids creating a new file
2570 if test "$need_locks" = yes; then
2571 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2572 func_echo "Waiting for $lockfile to be removed"
2573 sleep 2
2574 done
2575 elif test "$need_locks" = warn; then
2576 if test -f "$lockfile"; then
2577 $ECHO "\
2578 *** ERROR, $lockfile exists and contains:
2579 `cat $lockfile 2>/dev/null`
2581 This indicates that another process is trying to use the same
2582 temporary object file, and libtool could not work around it because
2583 your compiler does not support \`-c' and \`-o' together. If you
2584 repeat this compilation, it may succeed, by chance, but you had better
2585 avoid parallel builds (make -j) in this platform, or get a better
2586 compiler."
2588 $opt_dry_run || $RM $removelist
2589 exit $EXIT_FAILURE
2591 removelist+=" $output_obj"
2592 $ECHO "$srcfile" > "$lockfile"
2595 $opt_dry_run || $RM $removelist
2596 removelist+=" $lockfile"
2597 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2599 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2600 srcfile=$func_to_tool_file_result
2601 func_quote_for_eval "$srcfile"
2602 qsrcfile=$func_quote_for_eval_result
2604 # Only build a PIC object if we are building libtool libraries.
2605 if test "$build_libtool_libs" = yes; then
2606 # Without this assignment, base_compile gets emptied.
2607 fbsd_hideous_sh_bug=$base_compile
2609 if test "$pic_mode" != no; then
2610 command="$base_compile $qsrcfile $pic_flag"
2611 else
2612 # Don't build PIC code
2613 command="$base_compile $qsrcfile"
2616 func_mkdir_p "$xdir$objdir"
2618 if test -z "$output_obj"; then
2619 # Place PIC objects in $objdir
2620 command+=" -o $lobj"
2623 func_show_eval_locale "$command" \
2624 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2626 if test "$need_locks" = warn &&
2627 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2628 $ECHO "\
2629 *** ERROR, $lockfile contains:
2630 `cat $lockfile 2>/dev/null`
2632 but it should contain:
2633 $srcfile
2635 This indicates that another process is trying to use the same
2636 temporary object file, and libtool could not work around it because
2637 your compiler does not support \`-c' and \`-o' together. If you
2638 repeat this compilation, it may succeed, by chance, but you had better
2639 avoid parallel builds (make -j) in this platform, or get a better
2640 compiler."
2642 $opt_dry_run || $RM $removelist
2643 exit $EXIT_FAILURE
2646 # Just move the object if needed, then go on to compile the next one
2647 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2648 func_show_eval '$MV "$output_obj" "$lobj"' \
2649 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2652 # Allow error messages only from the first compilation.
2653 if test "$suppress_opt" = yes; then
2654 suppress_output=' >/dev/null 2>&1'
2658 # Only build a position-dependent object if we build old libraries.
2659 if test "$build_old_libs" = yes; then
2660 if test "$pic_mode" != yes; then
2661 # Don't build PIC code
2662 command="$base_compile $qsrcfile$pie_flag"
2663 else
2664 command="$base_compile $qsrcfile $pic_flag"
2666 if test "$compiler_c_o" = yes; then
2667 command+=" -o $obj"
2670 # Suppress compiler output if we already did a PIC compilation.
2671 command+="$suppress_output"
2672 func_show_eval_locale "$command" \
2673 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2675 if test "$need_locks" = warn &&
2676 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2677 $ECHO "\
2678 *** ERROR, $lockfile contains:
2679 `cat $lockfile 2>/dev/null`
2681 but it should contain:
2682 $srcfile
2684 This indicates that another process is trying to use the same
2685 temporary object file, and libtool could not work around it because
2686 your compiler does not support \`-c' and \`-o' together. If you
2687 repeat this compilation, it may succeed, by chance, but you had better
2688 avoid parallel builds (make -j) in this platform, or get a better
2689 compiler."
2691 $opt_dry_run || $RM $removelist
2692 exit $EXIT_FAILURE
2695 # Just move the object if needed
2696 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2697 func_show_eval '$MV "$output_obj" "$obj"' \
2698 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2702 $opt_dry_run || {
2703 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2705 # Unlock the critical section if it was locked
2706 if test "$need_locks" != no; then
2707 removelist=$lockfile
2708 $RM "$lockfile"
2712 exit $EXIT_SUCCESS
2715 $opt_help || {
2716 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2719 func_mode_help ()
2721 # We need to display help for each of the modes.
2722 case $opt_mode in
2724 # Generic help is extracted from the usage comments
2725 # at the start of this file.
2726 func_help
2729 clean)
2730 $ECHO \
2731 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2733 Remove files from the build directory.
2735 RM is the name of the program to use to delete files associated with each FILE
2736 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2737 to RM.
2739 If FILE is a libtool library, object or program, all the files associated
2740 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2743 compile)
2744 $ECHO \
2745 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2747 Compile a source file into a libtool library object.
2749 This mode accepts the following additional options:
2751 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2752 -no-suppress do not suppress compiler output for multiple passes
2753 -prefer-pic try to build PIC objects only
2754 -prefer-non-pic try to build non-PIC objects only
2755 -shared do not build a \`.o' file suitable for static linking
2756 -static only build a \`.o' file suitable for static linking
2757 -Wc,FLAG pass FLAG directly to the compiler
2759 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2760 from the given SOURCEFILE.
2762 The output file name is determined by removing the directory component from
2763 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2764 library object suffix, \`.lo'."
2767 execute)
2768 $ECHO \
2769 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2771 Automatically set library path, then run a program.
2773 This mode accepts the following additional options:
2775 -dlopen FILE add the directory containing FILE to the library path
2777 This mode sets the library path environment variable according to \`-dlopen'
2778 flags.
2780 If any of the ARGS are libtool executable wrappers, then they are translated
2781 into their corresponding uninstalled binary, and any of their required library
2782 directories are added to the library path.
2784 Then, COMMAND is executed, with ARGS as arguments."
2787 finish)
2788 $ECHO \
2789 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2791 Complete the installation of libtool libraries.
2793 Each LIBDIR is a directory that contains libtool libraries.
2795 The commands that this mode executes may require superuser privileges. Use
2796 the \`--dry-run' option if you just want to see what would be executed."
2799 install)
2800 $ECHO \
2801 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2803 Install executables or libraries.
2805 INSTALL-COMMAND is the installation command. The first component should be
2806 either the \`install' or \`cp' program.
2808 The following components of INSTALL-COMMAND are treated specially:
2810 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2812 The rest of the components are interpreted as arguments to that command (only
2813 BSD-compatible install options are recognized)."
2816 link)
2817 $ECHO \
2818 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2820 Link object files or libraries together to form another library, or to
2821 create an executable program.
2823 LINK-COMMAND is a command using the C compiler that you would use to create
2824 a program from several object files.
2826 The following components of LINK-COMMAND are treated specially:
2828 -all-static do not do any dynamic linking at all
2829 -avoid-version do not add a version suffix if possible
2830 -bindir BINDIR specify path to binaries directory (for systems where
2831 libraries must be found in the PATH setting at runtime)
2832 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2833 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2834 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2835 -export-symbols SYMFILE
2836 try to export only the symbols listed in SYMFILE
2837 -export-symbols-regex REGEX
2838 try to export only the symbols matching REGEX
2839 -LLIBDIR search LIBDIR for required installed libraries
2840 -lNAME OUTPUT-FILE requires the installed library libNAME
2841 -module build a library that can dlopened
2842 -no-fast-install disable the fast-install mode
2843 -no-install link a not-installable executable
2844 -no-undefined declare that a library does not refer to external symbols
2845 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2846 -objectlist FILE Use a list of object files found in FILE to specify objects
2847 -precious-files-regex REGEX
2848 don't remove output files matching REGEX
2849 -release RELEASE specify package release information
2850 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2851 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2852 -shared only do dynamic linking of libtool libraries
2853 -shrext SUFFIX override the standard shared library file extension
2854 -static do not do any dynamic linking of uninstalled libtool libraries
2855 -static-libtool-libs
2856 do not do any dynamic linking of libtool libraries
2857 -version-info CURRENT[:REVISION[:AGE]]
2858 specify library version info [each variable defaults to 0]
2859 -weak LIBNAME declare that the target provides the LIBNAME interface
2860 -Wc,FLAG
2861 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2862 -Wl,FLAG
2863 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2864 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2866 All other options (arguments beginning with \`-') are ignored.
2868 Every other argument is treated as a filename. Files ending in \`.la' are
2869 treated as uninstalled libtool libraries, other files are standard or library
2870 object files.
2872 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2873 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2874 required, except when creating a convenience library.
2876 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2877 using \`ar' and \`ranlib', or on Windows using \`lib'.
2879 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2880 is created, otherwise an executable program is created."
2883 uninstall)
2884 $ECHO \
2885 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2887 Remove libraries from an installation directory.
2889 RM is the name of the program to use to delete files associated with each FILE
2890 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2891 to RM.
2893 If FILE is a libtool library, all the files associated with it are deleted.
2894 Otherwise, only FILE itself is deleted using RM."
2898 func_fatal_help "invalid operation mode \`$opt_mode'"
2900 esac
2902 echo
2903 $ECHO "Try \`$progname --help' for more information about other modes."
2906 # Now that we've collected a possible --mode arg, show help if necessary
2907 if $opt_help; then
2908 if test "$opt_help" = :; then
2909 func_mode_help
2910 else
2912 func_help noexit
2913 for opt_mode in compile link execute install finish uninstall clean; do
2914 func_mode_help
2915 done
2916 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2918 func_help noexit
2919 for opt_mode in compile link execute install finish uninstall clean; do
2920 echo
2921 func_mode_help
2922 done
2924 sed '1d
2925 /^When reporting/,/^Report/{
2930 /information about other modes/d
2931 /more detailed .*MODE/d
2932 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2934 exit $?
2938 # func_mode_execute arg...
2939 func_mode_execute ()
2941 $opt_debug
2942 # The first argument is the command name.
2943 cmd="$nonopt"
2944 test -z "$cmd" && \
2945 func_fatal_help "you must specify a COMMAND"
2947 # Handle -dlopen flags immediately.
2948 for file in $opt_dlopen; do
2949 test -f "$file" \
2950 || func_fatal_help "\`$file' is not a file"
2952 dir=
2953 case $file in
2954 *.la)
2955 func_resolve_sysroot "$file"
2956 file=$func_resolve_sysroot_result
2958 # Check to see that this really is a libtool archive.
2959 func_lalib_unsafe_p "$file" \
2960 || func_fatal_help "\`$lib' is not a valid libtool archive"
2962 # Read the libtool library.
2963 dlname=
2964 library_names=
2965 func_source "$file"
2967 # Skip this library if it cannot be dlopened.
2968 if test -z "$dlname"; then
2969 # Warn if it was a shared library.
2970 test -n "$library_names" && \
2971 func_warning "\`$file' was not linked with \`-export-dynamic'"
2972 continue
2975 func_dirname "$file" "" "."
2976 dir="$func_dirname_result"
2978 if test -f "$dir/$objdir/$dlname"; then
2979 dir+="/$objdir"
2980 else
2981 if test ! -f "$dir/$dlname"; then
2982 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2987 *.lo)
2988 # Just add the directory containing the .lo file.
2989 func_dirname "$file" "" "."
2990 dir="$func_dirname_result"
2994 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2995 continue
2997 esac
2999 # Get the absolute pathname.
3000 absdir=`cd "$dir" && pwd`
3001 test -n "$absdir" && dir="$absdir"
3003 # Now add the directory to shlibpath_var.
3004 if eval "test -z \"\$$shlibpath_var\""; then
3005 eval "$shlibpath_var=\"\$dir\""
3006 else
3007 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3009 done
3011 # This variable tells wrapper scripts just to set shlibpath_var
3012 # rather than running their programs.
3013 libtool_execute_magic="$magic"
3015 # Check if any of the arguments is a wrapper script.
3016 args=
3017 for file
3019 case $file in
3020 -* | *.la | *.lo ) ;;
3022 # Do a test to see if this is really a libtool program.
3023 if func_ltwrapper_script_p "$file"; then
3024 func_source "$file"
3025 # Transform arg to wrapped name.
3026 file="$progdir/$program"
3027 elif func_ltwrapper_executable_p "$file"; then
3028 func_ltwrapper_scriptname "$file"
3029 func_source "$func_ltwrapper_scriptname_result"
3030 # Transform arg to wrapped name.
3031 file="$progdir/$program"
3034 esac
3035 # Quote arguments (to preserve shell metacharacters).
3036 func_append_quoted args "$file"
3037 done
3039 if test "X$opt_dry_run" = Xfalse; then
3040 if test -n "$shlibpath_var"; then
3041 # Export the shlibpath_var.
3042 eval "export $shlibpath_var"
3045 # Restore saved environment variables
3046 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
3048 eval "if test \"\${save_$lt_var+set}\" = set; then
3049 $lt_var=\$save_$lt_var; export $lt_var
3050 else
3051 $lt_unset $lt_var
3053 done
3055 # Now prepare to actually exec the command.
3056 exec_cmd="\$cmd$args"
3057 else
3058 # Display what would be done.
3059 if test -n "$shlibpath_var"; then
3060 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
3061 echo "export $shlibpath_var"
3063 $ECHO "$cmd$args"
3064 exit $EXIT_SUCCESS
3068 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
3071 # func_mode_finish arg...
3072 func_mode_finish ()
3074 $opt_debug
3075 libs=
3076 libdirs=
3077 admincmds=
3079 for opt in "$nonopt" ${1+"$@"}
3081 if test -d "$opt"; then
3082 libdirs+=" $opt"
3084 elif test -f "$opt"; then
3085 if func_lalib_unsafe_p "$opt"; then
3086 libs+=" $opt"
3087 else
3088 func_warning "\`$opt' is not a valid libtool archive"
3091 else
3092 func_fatal_error "invalid argument \`$opt'"
3094 done
3096 if test -n "$libs"; then
3097 if test -n "$lt_sysroot"; then
3098 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
3099 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
3100 else
3101 sysroot_cmd=
3104 # Remove sysroot references
3105 if $opt_dry_run; then
3106 for lib in $libs; do
3107 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
3108 done
3109 else
3110 tmpdir=`func_mktempdir`
3111 for lib in $libs; do
3112 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
3113 > $tmpdir/tmp-la
3114 mv -f $tmpdir/tmp-la $lib
3115 done
3116 ${RM}r "$tmpdir"
3120 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3121 for libdir in $libdirs; do
3122 if test -n "$finish_cmds"; then
3123 # Do each command in the finish commands.
3124 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
3125 '"$cmd"'"'
3127 if test -n "$finish_eval"; then
3128 # Do the single finish_eval.
3129 eval cmds=\"$finish_eval\"
3130 $opt_dry_run || eval "$cmds" || admincmds+="
3131 $cmds"
3133 done
3136 # Exit here if they wanted silent mode.
3137 $opt_silent && exit $EXIT_SUCCESS
3139 exit $EXIT_SUCCESS
3142 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
3145 # func_mode_install arg...
3146 func_mode_install ()
3148 $opt_debug
3149 # There may be an optional sh(1) argument at the beginning of
3150 # install_prog (especially on Windows NT).
3151 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3152 # Allow the use of GNU shtool's install command.
3153 case $nonopt in *shtool*) :;; *) false;; esac; then
3154 # Aesthetically quote it.
3155 func_quote_for_eval "$nonopt"
3156 install_prog="$func_quote_for_eval_result "
3157 arg=$1
3158 shift
3159 else
3160 install_prog=
3161 arg=$nonopt
3164 # The real first argument should be the name of the installation program.
3165 # Aesthetically quote it.
3166 func_quote_for_eval "$arg"
3167 install_prog+="$func_quote_for_eval_result"
3168 install_shared_prog=$install_prog
3169 case " $install_prog " in
3170 *[\\\ /]cp\ *) install_cp=: ;;
3171 *) install_cp=false ;;
3172 esac
3174 # We need to accept at least all the BSD install flags.
3175 dest=
3176 files=
3177 opts=
3178 prev=
3179 install_type=
3180 isdir=no
3181 stripme=
3182 no_mode=:
3183 for arg
3185 arg2=
3186 if test -n "$dest"; then
3187 files+=" $dest"
3188 dest=$arg
3189 continue
3192 case $arg in
3193 -d) isdir=yes ;;
3195 if $install_cp; then :; else
3196 prev=$arg
3199 -g | -m | -o)
3200 prev=$arg
3203 stripme=" -s"
3204 continue
3209 # If the previous option needed an argument, then skip it.
3210 if test -n "$prev"; then
3211 if test "x$prev" = x-m && test -n "$install_override_mode"; then
3212 arg2=$install_override_mode
3213 no_mode=false
3215 prev=
3216 else
3217 dest=$arg
3218 continue
3221 esac
3223 # Aesthetically quote the argument.
3224 func_quote_for_eval "$arg"
3225 install_prog+=" $func_quote_for_eval_result"
3226 if test -n "$arg2"; then
3227 func_quote_for_eval "$arg2"
3229 install_shared_prog+=" $func_quote_for_eval_result"
3230 done
3231 case " $install_prog " in
3232 *[\\\ /]cp\ *) extra_mode=;;
3233 *) extra_mode='-m 644';;
3234 esac
3236 test -z "$install_prog" && \
3237 func_fatal_help "you must specify an install program"
3239 test -n "$prev" && \
3240 func_fatal_help "the \`$prev' option requires an argument"
3242 if test -n "$install_override_mode" && $no_mode; then
3243 if $install_cp; then :; else
3244 func_quote_for_eval "$install_override_mode"
3245 install_shared_prog+=" -m $func_quote_for_eval_result"
3249 if test -z "$files"; then
3250 if test -z "$dest"; then
3251 func_fatal_help "no file or destination specified"
3252 else
3253 func_fatal_help "you must specify a destination"
3257 # Strip any trailing slash from the destination.
3258 func_stripname '' '/' "$dest"
3259 dest=$func_stripname_result
3261 # Check to see that the destination is a directory.
3262 test -d "$dest" && isdir=yes
3263 if test "$isdir" = yes; then
3264 destdir="$dest"
3265 destname=
3266 else
3267 func_dirname_and_basename "$dest" "" "."
3268 destdir="$func_dirname_result"
3269 destname="$func_basename_result"
3271 # Not a directory, so check to see that there is only one file specified.
3272 set dummy $files; shift
3273 test "$#" -gt 1 && \
3274 func_fatal_help "\`$dest' is not a directory"
3276 case $destdir in
3277 [\\/]* | [A-Za-z]:[\\/]*) ;;
3279 for file in $files; do
3280 case $file in
3281 *.lo) ;;
3283 func_fatal_help "\`$destdir' must be an absolute directory name"
3285 esac
3286 done
3288 esac
3290 # This variable tells wrapper scripts just to set variables rather
3291 # than running their programs.
3292 libtool_install_magic="$magic"
3294 staticlibs=
3295 future_libdirs=
3296 current_libdirs=
3297 for file in $files; do
3299 # Do each installation.
3300 case $file in
3301 *.$libext)
3302 # Do the static libraries later.
3303 staticlibs+=" $file"
3306 *.la)
3307 func_resolve_sysroot "$file"
3308 file=$func_resolve_sysroot_result
3310 # Check to see that this really is a libtool archive.
3311 func_lalib_unsafe_p "$file" \
3312 || func_fatal_help "\`$file' is not a valid libtool archive"
3314 library_names=
3315 old_library=
3316 relink_command=
3317 func_source "$file"
3319 # Add the libdir to current_libdirs if it is the destination.
3320 if test "X$destdir" = "X$libdir"; then
3321 case "$current_libdirs " in
3322 *" $libdir "*) ;;
3323 *) current_libdirs+=" $libdir" ;;
3324 esac
3325 else
3326 # Note the libdir as a future libdir.
3327 case "$future_libdirs " in
3328 *" $libdir "*) ;;
3329 *) future_libdirs+=" $libdir" ;;
3330 esac
3333 func_dirname "$file" "/" ""
3334 dir="$func_dirname_result"
3335 dir+="$objdir"
3337 if test -n "$relink_command"; then
3338 # Determine the prefix the user has applied to our future dir.
3339 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
3341 # Don't allow the user to place us outside of our expected
3342 # location b/c this prevents finding dependent libraries that
3343 # are installed to the same prefix.
3344 # At present, this check doesn't affect windows .dll's that
3345 # are installed into $libdir/../bin (currently, that works fine)
3346 # but it's something to keep an eye on.
3347 test "$inst_prefix_dir" = "$destdir" && \
3348 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
3350 if test -n "$inst_prefix_dir"; then
3351 # Stick the inst_prefix_dir data into the link command.
3352 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
3353 else
3354 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
3357 func_warning "relinking \`$file'"
3358 func_show_eval "$relink_command" \
3359 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
3362 # See the names of the shared library.
3363 set dummy $library_names; shift
3364 if test -n "$1"; then
3365 realname="$1"
3366 shift
3368 srcname="$realname"
3369 test -n "$relink_command" && srcname="$realname"T
3371 # Install the shared library and build the symlinks.
3372 func_show_eval "$install_shared_prog $extra_mode $dir/$srcname $destdir/$realname" \
3373 'exit $?'
3374 tstripme="$stripme"
3375 case $host_os in
3376 cygwin* | mingw* | pw32* | cegcc*)
3377 case $realname in
3378 *.dll.a)
3379 tstripme=""
3381 esac
3383 esac
3384 if test -n "$tstripme" && test -n "$striplib"; then
3385 func_show_eval "$striplib $destdir/$realname" 'exit $?'
3388 if test "$#" -gt 0; then
3389 # Delete the old symlinks, and create new ones.
3390 # Try `ln -sf' first, because the `ln' binary might depend on
3391 # the symlink we replace! Solaris /bin/ln does not understand -f,
3392 # so we also need to try rm && ln -s.
3393 for linkname
3395 test "$linkname" != "$realname" \
3396 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3397 done
3400 # Do each command in the postinstall commands.
3401 lib="$destdir/$realname"
3402 func_execute_cmds "$postinstall_cmds" 'exit $?'
3405 # Install the pseudo-library for information purposes.
3406 func_basename "$file"
3407 name="$func_basename_result"
3408 instname="$dir/$name"i
3409 func_show_eval "$install_prog $extra_mode $instname $destdir/$name" 'exit $?'
3411 # Maybe install the static library, too.
3412 test -n "$old_library" && staticlibs+=" $dir/$old_library"
3415 *.lo)
3416 # Install (i.e. copy) a libtool object.
3418 # Figure out destination file name, if it wasn't already specified.
3419 if test -n "$destname"; then
3420 destfile="$destdir/$destname"
3421 else
3422 func_basename "$file"
3423 destfile="$func_basename_result"
3424 destfile="$destdir/$destfile"
3427 # Deduce the name of the destination old-style object file.
3428 case $destfile in
3429 *.lo)
3430 func_lo2o "$destfile"
3431 staticdest=$func_lo2o_result
3433 *.$objext)
3434 staticdest="$destfile"
3435 destfile=
3438 func_fatal_help "cannot copy a libtool object to \`$destfile'"
3440 esac
3442 # Install the libtool object if requested.
3443 test -n "$destfile" && \
3444 func_show_eval "$install_prog $extra_mode $file $destfile" 'exit $?'
3446 # Install the old object if enabled.
3447 if test "$build_old_libs" = yes; then
3448 # Deduce the name of the old-style object file.
3449 func_lo2o "$file"
3450 staticobj=$func_lo2o_result
3451 func_show_eval "$install_prog $extra_mode \$staticobj \$staticdest" 'exit $?'
3453 exit $EXIT_SUCCESS
3457 # Figure out destination file name, if it wasn't already specified.
3458 if test -n "$destname"; then
3459 destfile="$destdir/$destname"
3460 else
3461 func_basename "$file"
3462 destfile="$func_basename_result"
3463 destfile="$destdir/$destfile"
3466 # If the file is missing, and there is a .exe on the end, strip it
3467 # because it is most likely a libtool script we actually want to
3468 # install
3469 stripped_ext=""
3470 case $file in
3471 *.exe)
3472 if test ! -f "$file"; then
3473 func_stripname '' '.exe' "$file"
3474 file=$func_stripname_result
3475 stripped_ext=".exe"
3478 esac
3480 # Do a test to see if this is really a libtool program.
3481 case $host in
3482 *cygwin* | *mingw*)
3483 if func_ltwrapper_executable_p "$file"; then
3484 func_ltwrapper_scriptname "$file"
3485 wrapper=$func_ltwrapper_scriptname_result
3486 else
3487 func_stripname '' '.exe' "$file"
3488 wrapper=$func_stripname_result
3492 wrapper=$file
3494 esac
3495 if func_ltwrapper_script_p "$wrapper"; then
3496 notinst_deplibs=
3497 relink_command=
3499 func_source "$wrapper"
3501 # Check the variables that should have been set.
3502 test -z "$generated_by_libtool_version" && \
3503 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3505 finalize=yes
3506 for lib in $notinst_deplibs; do
3507 # Check to see that each library is installed.
3508 libdir=
3509 if test -f "$lib"; then
3510 func_source "$lib"
3512 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3513 if test -n "$libdir" && test ! -f "$libfile"; then
3514 func_warning "\`$lib' has not been installed in \`$libdir'"
3515 finalize=no
3517 done
3519 relink_command=
3520 func_source "$wrapper"
3522 outputname=
3523 if test "$fast_install" = no && test -n "$relink_command"; then
3524 $opt_dry_run || {
3525 if test "$finalize" = yes; then
3526 tmpdir=`func_mktempdir`
3527 func_basename "$file$stripped_ext"
3528 file="$func_basename_result"
3529 outputname="$tmpdir/$file"
3530 # Replace the output file specification.
3531 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3533 $opt_silent || {
3534 func_quote_for_expand "$relink_command"
3535 eval "func_echo $func_quote_for_expand_result"
3537 if eval "$relink_command"; then :
3538 else
3539 func_error "error: relink \`$file' with the above command before installing it"
3540 $opt_dry_run || ${RM}r "$tmpdir"
3541 continue
3543 file="$outputname"
3544 else
3545 func_warning "cannot relink \`$file'"
3548 else
3549 # Install the binary that we compiled earlier.
3550 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3554 # remove .exe since cygwin /usr/bin/install will append another
3555 # one anyway
3556 case $install_prog,$host in
3557 */usr/bin/install*,*cygwin*)
3558 case $file:$destfile in
3559 *.exe:*.exe)
3560 # this is ok
3562 *.exe:*)
3563 destfile=$destfile.exe
3565 *:*.exe)
3566 func_stripname '' '.exe' "$destfile"
3567 destfile=$func_stripname_result
3569 esac
3571 esac
3572 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3573 $opt_dry_run || if test -n "$outputname"; then
3574 ${RM}r "$tmpdir"
3577 esac
3578 done
3580 for file in $staticlibs; do
3581 func_basename "$file"
3582 name="$func_basename_result"
3584 # Set up the ranlib parameters.
3585 oldlib="$destdir/$name"
3586 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3587 tool_oldlib=$func_to_tool_file_result
3589 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3591 if test -n "$stripme" && test -n "$old_striplib"; then
3592 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
3595 # Do each command in the postinstall commands.
3596 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3597 done
3599 test -n "$future_libdirs" && \
3600 func_warning "remember to run \`$progname --finish$future_libdirs'"
3602 if test -n "$current_libdirs"; then
3603 # Maybe just do a dry run.
3604 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3605 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3606 else
3607 exit $EXIT_SUCCESS
3611 test "$opt_mode" = install && func_mode_install ${1+"$@"}
3614 # func_generate_dlsyms outputname originator pic_p
3615 # Extract symbols from dlprefiles and create ${outputname}S.o with
3616 # a dlpreopen symbol table.
3617 func_generate_dlsyms ()
3619 $opt_debug
3620 my_outputname="$1"
3621 my_originator="$2"
3622 my_pic_p="${3-no}"
3623 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3624 my_dlsyms=
3626 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3627 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3628 my_dlsyms="${my_outputname}S.c"
3629 else
3630 func_error "not configured to extract global symbols from dlpreopened files"
3634 if test -n "$my_dlsyms"; then
3635 case $my_dlsyms in
3636 "") ;;
3637 *.c)
3638 # Discover the nlist of each of the dlfiles.
3639 nlist="$output_objdir/${my_outputname}.nm"
3641 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3643 # Parse the name list into a source file.
3644 func_verbose "creating $output_objdir/$my_dlsyms"
3646 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3647 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3648 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3650 #ifdef __cplusplus
3651 extern \"C\" {
3652 #endif
3654 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3655 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3656 #endif
3658 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3659 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3660 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3661 relocations are performed -- see ld's documentation on pseudo-relocs. */
3662 # define LT_DLSYM_CONST
3663 #elif defined(__osf__)
3664 /* This system does not cope well with relocations in const data. */
3665 # define LT_DLSYM_CONST
3666 #else
3667 # define LT_DLSYM_CONST const
3668 #endif
3670 /* External symbol declarations for the compiler. */\
3673 if test "$dlself" = yes; then
3674 func_verbose "generating symbol list for \`$output'"
3676 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3678 # Add our own program objects to the symbol list.
3679 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3680 for progfile in $progfiles; do
3681 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3682 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3683 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3684 done
3686 if test -n "$exclude_expsyms"; then
3687 $opt_dry_run || {
3688 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3689 eval '$MV "$nlist"T "$nlist"'
3693 if test -n "$export_symbols_regex"; then
3694 $opt_dry_run || {
3695 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3696 eval '$MV "$nlist"T "$nlist"'
3700 # Prepare the list of exported symbols
3701 if test -z "$export_symbols"; then
3702 export_symbols="$output_objdir/$outputname.exp"
3703 $opt_dry_run || {
3704 $RM $export_symbols
3705 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3706 case $host in
3707 *cygwin* | *mingw* | *cegcc* )
3708 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3709 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3711 esac
3713 else
3714 $opt_dry_run || {
3715 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3716 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3717 eval '$MV "$nlist"T "$nlist"'
3718 case $host in
3719 *cygwin* | *mingw* | *cegcc* )
3720 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3721 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3723 esac
3728 for dlprefile in $dlprefiles; do
3729 func_verbose "extracting global C symbols from \`$dlprefile'"
3730 func_basename "$dlprefile"
3731 name="$func_basename_result"
3732 case $host in
3733 *cygwin* | *mingw* | *cegcc* )
3734 # if an import library, we need to obtain dlname
3735 if func_win32_import_lib_p "$dlprefile"; then
3736 func_tr_sh "$dlprefile"
3737 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3738 dlprefile_dlbasename=""
3739 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3740 # Use subshell, to avoid clobbering current variable values
3741 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3742 if test -n "$dlprefile_dlname" ; then
3743 func_basename "$dlprefile_dlname"
3744 dlprefile_dlbasename="$func_basename_result"
3745 else
3746 # no lafile. user explicitly requested -dlpreopen <import library>.
3747 $sharedlib_from_linklib_cmd "$dlprefile"
3748 dlprefile_dlbasename=$sharedlib_from_linklib_result
3751 $opt_dry_run || {
3752 if test -n "$dlprefile_dlbasename" ; then
3753 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3754 else
3755 func_warning "Could not compute DLL name from $name"
3756 eval '$ECHO ": $name " >> "$nlist"'
3758 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3759 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3760 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3762 else # not an import lib
3763 $opt_dry_run || {
3764 eval '$ECHO ": $name " >> "$nlist"'
3765 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3766 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3771 $opt_dry_run || {
3772 eval '$ECHO ": $name " >> "$nlist"'
3773 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3774 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3777 esac
3778 done
3780 $opt_dry_run || {
3781 # Make sure we have at least an empty file.
3782 test -f "$nlist" || : > "$nlist"
3784 if test -n "$exclude_expsyms"; then
3785 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3786 $MV "$nlist"T "$nlist"
3789 # Try sorting and uniquifying the output.
3790 if $GREP -v "^: " < "$nlist" |
3791 if sort -k 3 </dev/null >/dev/null 2>&1; then
3792 sort -k 3
3793 else
3794 sort +2
3795 fi |
3796 uniq > "$nlist"S; then
3798 else
3799 $GREP -v "^: " < "$nlist" > "$nlist"S
3802 if test -f "$nlist"S; then
3803 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3804 else
3805 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3808 echo >> "$output_objdir/$my_dlsyms" "\
3810 /* The mapping between symbol names and symbols. */
3811 typedef struct {
3812 const char *name;
3813 void *address;
3814 } lt_dlsymlist;
3815 extern LT_DLSYM_CONST lt_dlsymlist
3816 lt_${my_prefix}_LTX_preloaded_symbols[];
3817 LT_DLSYM_CONST lt_dlsymlist
3818 lt_${my_prefix}_LTX_preloaded_symbols[] =
3820 { \"$my_originator\", (void *) 0 },"
3822 case $need_lib_prefix in
3824 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3827 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3829 esac
3830 echo >> "$output_objdir/$my_dlsyms" "\
3831 {0, (void *) 0}
3834 /* This works around a problem in FreeBSD linker */
3835 #ifdef FREEBSD_WORKAROUND
3836 static const void *lt_preloaded_setup() {
3837 return lt_${my_prefix}_LTX_preloaded_symbols;
3839 #endif
3841 #ifdef __cplusplus
3843 #endif\
3845 } # !$opt_dry_run
3847 pic_flag_for_symtable=
3848 case "$compile_command " in
3849 *" -static "*) ;;
3851 case $host in
3852 # compiling the symbol table file with pic_flag works around
3853 # a FreeBSD bug that causes programs to crash when -lm is
3854 # linked before any other PIC object. But we must not use
3855 # pic_flag when linking with -static. The problem exists in
3856 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3857 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3858 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3859 *-*-hpux*)
3860 pic_flag_for_symtable=" $pic_flag" ;;
3862 if test "X$my_pic_p" != Xno; then
3863 pic_flag_for_symtable=" $pic_flag"
3866 esac
3868 esac
3869 symtab_cflags=
3870 for arg in $LTCFLAGS; do
3871 case $arg in
3872 -pie | -fpie | -fPIE) ;;
3873 *) symtab_cflags+=" $arg" ;;
3874 esac
3875 done
3877 # Now compile the dynamic symbol file.
3878 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3880 # Clean up the generated files.
3881 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3883 # Transform the symbol file into the correct name.
3884 symfileobj="$output_objdir/${my_outputname}S.$objext"
3885 case $host in
3886 *cygwin* | *mingw* | *cegcc* )
3887 if test -f "$output_objdir/$my_outputname.def"; then
3888 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3889 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3890 else
3891 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3892 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3896 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3897 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3899 esac
3902 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3904 esac
3905 else
3906 # We keep going just in case the user didn't refer to
3907 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3908 # really was required.
3910 # Nullify the symbol file.
3911 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3912 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3916 # func_win32_libid arg
3917 # return the library type of file 'arg'
3919 # Need a lot of goo to handle *both* DLLs and import libs
3920 # Has to be a shell function in order to 'eat' the argument
3921 # that is supplied when $file_magic_command is called.
3922 # Despite the name, also deal with 64 bit binaries.
3923 func_win32_libid ()
3925 $opt_debug
3926 win32_libid_type="unknown"
3927 win32_fileres=`file -L $1 2>/dev/null`
3928 case $win32_fileres in
3929 *ar\ archive\ import\ library*) # definitely import
3930 win32_libid_type="x86 archive import"
3932 *ar\ archive*) # could be an import, or static
3933 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3934 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3935 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3936 func_to_tool_file "$1" func_convert_file_msys_to_w32
3937 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3938 $SED -n -e '
3939 1,100{
3940 / I /{
3941 s,.*,import,
3946 case $win32_nmres in
3947 import*) win32_libid_type="x86 archive import";;
3948 *) win32_libid_type="x86 archive static";;
3949 esac
3952 *DLL*)
3953 win32_libid_type="x86 DLL"
3955 *executable*) # but shell scripts are "executable" too...
3956 case $win32_fileres in
3957 *MS\ Windows\ PE\ Intel*)
3958 win32_libid_type="x86 DLL"
3960 esac
3962 esac
3963 $ECHO "$win32_libid_type"
3966 # func_cygming_dll_for_implib ARG
3968 # Platform-specific function to extract the
3969 # name of the DLL associated with the specified
3970 # import library ARG.
3971 # Invoked by eval'ing the libtool variable
3972 # $sharedlib_from_linklib_cmd
3973 # Result is available in the variable
3974 # $sharedlib_from_linklib_result
3975 func_cygming_dll_for_implib ()
3977 $opt_debug
3978 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
3981 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
3983 # The is the core of a fallback implementation of a
3984 # platform-specific function to extract the name of the
3985 # DLL associated with the specified import library LIBNAME.
3987 # SECTION_NAME is either .idata$6 or .idata$7, depending
3988 # on the platform and compiler that created the implib.
3990 # Echos the name of the DLL associated with the
3991 # specified import library.
3992 func_cygming_dll_for_implib_fallback_core ()
3994 $opt_debug
3995 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3996 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
3997 $SED '/^Contents of section '"$match_literal"':/{
3998 # Place marker at beginning of archive member dllname section
3999 s/.*/====MARK====/
4003 # These lines can sometimes be longer than 43 characters, but
4004 # are always uninteresting
4005 /:[ ]*file format pe[i]\{,1\}-/d
4006 /^In archive [^:]*:/d
4007 # Ensure marker is printed
4008 /^====MARK====/p
4009 # Remove all lines with less than 43 characters
4010 /^.\{43\}/!d
4011 # From remaining lines, remove first 43 characters
4012 s/^.\{43\}//' |
4013 $SED -n '
4014 # Join marker and all lines until next marker into a single line
4015 /^====MARK====/ b para
4017 $ b para
4019 :para
4021 s/\n//g
4022 # Remove the marker
4023 s/^====MARK====//
4024 # Remove trailing dots and whitespace
4025 s/[\. \t]*$//
4026 # Print
4027 /./p' |
4028 # we now have a list, one entry per line, of the stringified
4029 # contents of the appropriate section of all members of the
4030 # archive which possess that section. Heuristic: eliminate
4031 # all those which have a first or second character that is
4032 # a '.' (that is, objdump's representation of an unprintable
4033 # character.) This should work for all archives with less than
4034 # 0x302f exports -- but will fail for DLLs whose name actually
4035 # begins with a literal '.' or a single character followed by
4036 # a '.'.
4038 # Of those that remain, print the first one.
4039 $SED -e '/^\./d;/^.\./d;q'
4042 # func_cygming_gnu_implib_p ARG
4043 # This predicate returns with zero status (TRUE) if
4044 # ARG is a GNU/binutils-style import library. Returns
4045 # with nonzero status (FALSE) otherwise.
4046 func_cygming_gnu_implib_p ()
4048 $opt_debug
4049 func_to_tool_file "$1" func_convert_file_msys_to_w32
4050 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)$'`
4051 test -n "$func_cygming_gnu_implib_tmp"
4054 # func_cygming_ms_implib_p ARG
4055 # This predicate returns with zero status (TRUE) if
4056 # ARG is an MS-style import library. Returns
4057 # with nonzero status (FALSE) otherwise.
4058 func_cygming_ms_implib_p ()
4060 $opt_debug
4061 func_to_tool_file "$1" func_convert_file_msys_to_w32
4062 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
4063 test -n "$func_cygming_ms_implib_tmp"
4066 # func_cygming_dll_for_implib_fallback ARG
4067 # Platform-specific function to extract the
4068 # name of the DLL associated with the specified
4069 # import library ARG.
4071 # This fallback implementation is for use when $DLLTOOL
4072 # does not support the --identify-strict option.
4073 # Invoked by eval'ing the libtool variable
4074 # $sharedlib_from_linklib_cmd
4075 # Result is available in the variable
4076 # $sharedlib_from_linklib_result
4077 func_cygming_dll_for_implib_fallback ()
4079 $opt_debug
4080 if func_cygming_gnu_implib_p "$1" ; then
4081 # binutils import library
4082 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
4083 elif func_cygming_ms_implib_p "$1" ; then
4084 # ms-generated import library
4085 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
4086 else
4087 # unknown
4088 sharedlib_from_linklib_result=""
4093 # func_extract_an_archive dir oldlib
4094 func_extract_an_archive ()
4096 $opt_debug
4097 f_ex_an_ar_dir="$1"; shift
4098 f_ex_an_ar_oldlib="$1"
4099 if test "$lock_old_archive_extraction" = yes; then
4100 lockfile=$f_ex_an_ar_oldlib.lock
4101 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
4102 func_echo "Waiting for $lockfile to be removed"
4103 sleep 2
4104 done
4106 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
4107 'stat=$?; rm -f "$lockfile"; exit $stat'
4108 if test "$lock_old_archive_extraction" = yes; then
4109 $opt_dry_run || rm -f "$lockfile"
4111 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
4113 else
4114 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
4119 # func_extract_archives gentop oldlib ...
4120 func_extract_archives ()
4122 $opt_debug
4123 my_gentop="$1"; shift
4124 my_oldlibs=${1+"$@"}
4125 my_oldobjs=""
4126 my_xlib=""
4127 my_xabs=""
4128 my_xdir=""
4130 for my_xlib in $my_oldlibs; do
4131 # Extract the objects.
4132 case $my_xlib in
4133 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
4134 *) my_xabs=`pwd`"/$my_xlib" ;;
4135 esac
4136 func_basename "$my_xlib"
4137 my_xlib="$func_basename_result"
4138 my_xlib_u=$my_xlib
4139 while :; do
4140 case " $extracted_archives " in
4141 *" $my_xlib_u "*)
4142 func_arith $extracted_serial + 1
4143 extracted_serial=$func_arith_result
4144 my_xlib_u=lt$extracted_serial-$my_xlib ;;
4145 *) break ;;
4146 esac
4147 done
4148 extracted_archives="$extracted_archives $my_xlib_u"
4149 my_xdir="$my_gentop/$my_xlib_u"
4151 func_mkdir_p "$my_xdir"
4153 case $host in
4154 *-darwin*)
4155 func_verbose "Extracting $my_xabs"
4156 # Do not bother doing anything if just a dry run
4157 $opt_dry_run || {
4158 darwin_orig_dir=`pwd`
4159 cd $my_xdir || exit $?
4160 darwin_archive=$my_xabs
4161 darwin_curdir=`pwd`
4162 darwin_base_archive=`basename "$darwin_archive"`
4163 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
4164 if test -n "$darwin_arches"; then
4165 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
4166 darwin_arch=
4167 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
4168 for darwin_arch in $darwin_arches ; do
4169 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4170 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
4171 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4172 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
4173 cd "$darwin_curdir"
4174 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
4175 done # $darwin_arches
4176 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
4177 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
4178 darwin_file=
4179 darwin_files=
4180 for darwin_file in $darwin_filelist; do
4181 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
4182 $LIPO -create -output "$darwin_file" $darwin_files
4183 done # $darwin_filelist
4184 $RM -rf unfat-$$
4185 cd "$darwin_orig_dir"
4186 else
4187 cd $darwin_orig_dir
4188 func_extract_an_archive "$my_xdir" "$my_xabs"
4189 fi # $darwin_arches
4190 } # !$opt_dry_run
4193 func_extract_an_archive "$my_xdir" "$my_xabs"
4195 esac
4196 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
4197 done
4199 func_extract_archives_result="$my_oldobjs"
4203 # func_emit_wrapper [arg=no]
4205 # Emit a libtool wrapper script on stdout.
4206 # Don't directly open a file because we may want to
4207 # incorporate the script contents within a cygwin/mingw
4208 # wrapper executable. Must ONLY be called from within
4209 # func_mode_link because it depends on a number of variables
4210 # set therein.
4212 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
4213 # variable will take. If 'yes', then the emitted script
4214 # will assume that the directory in which it is stored is
4215 # the $objdir directory. This is a cygwin/mingw-specific
4216 # behavior.
4217 func_emit_wrapper ()
4219 func_emit_wrapper_arg1=${1-no}
4221 $ECHO "\
4222 #! $SHELL
4224 # $output - temporary wrapper script for $objdir/$outputname
4225 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4227 # The $output program cannot be directly executed until all the libtool
4228 # libraries that it depends on are installed.
4230 # This wrapper script should never be moved out of the build directory.
4231 # If it is, it will not operate correctly.
4233 # Sed substitution that helps us do robust quoting. It backslashifies
4234 # metacharacters that are still active within double-quoted strings.
4235 sed_quote_subst='$sed_quote_subst'
4237 # Be Bourne compatible
4238 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
4239 emulate sh
4240 NULLCMD=:
4241 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
4242 # is contrary to our usage. Disable this feature.
4243 alias -g '\${1+\"\$@\"}'='\"\$@\"'
4244 setopt NO_GLOB_SUBST
4245 else
4246 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
4248 BIN_SH=xpg4; export BIN_SH # for Tru64
4249 DUALCASE=1; export DUALCASE # for MKS sh
4251 # The HP-UX ksh and POSIX shell print the target directory to stdout
4252 # if CDPATH is set.
4253 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4255 relink_command=\"$relink_command\"
4257 # This environment variable determines our operation mode.
4258 if test \"\$libtool_install_magic\" = \"$magic\"; then
4259 # install mode needs the following variables:
4260 generated_by_libtool_version='$macro_version'
4261 notinst_deplibs='$notinst_deplibs'
4262 else
4263 # When we are sourced in execute mode, \$file and \$ECHO are already set.
4264 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4265 file=\"\$0\""
4267 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
4268 $ECHO "\
4270 # A function that is used when there is no print builtin or printf.
4271 func_fallback_echo ()
4273 eval 'cat <<_LTECHO_EOF
4275 _LTECHO_EOF'
4277 ECHO=\"$qECHO\"
4280 # Very basic option parsing. These options are (a) specific to
4281 # the libtool wrapper, (b) are identical between the wrapper
4282 # /script/ and the wrapper /executable/ which is used only on
4283 # windows platforms, and (c) all begin with the string "--lt-"
4284 # (application programs are unlikely to have options which match
4285 # this pattern).
4287 # There are only two supported options: --lt-debug and
4288 # --lt-dump-script. There is, deliberately, no --lt-help.
4290 # The first argument to this parsing function should be the
4291 # script's $0 value, followed by "$@".
4292 lt_option_debug=
4293 func_parse_lt_options ()
4295 lt_script_arg0=\$0
4296 shift
4297 for lt_opt
4299 case \"\$lt_opt\" in
4300 --lt-debug) lt_option_debug=1 ;;
4301 --lt-dump-script)
4302 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
4303 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
4304 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
4305 cat \"\$lt_dump_D/\$lt_dump_F\"
4306 exit 0
4308 --lt-*)
4309 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
4310 exit 1
4312 esac
4313 done
4315 # Print the debug banner immediately:
4316 if test -n \"\$lt_option_debug\"; then
4317 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
4321 # Used when --lt-debug. Prints its arguments to stdout
4322 # (redirection is the responsibility of the caller)
4323 func_lt_dump_args ()
4325 lt_dump_args_N=1;
4326 for lt_arg
4328 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
4329 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
4330 done
4333 # Core function for launching the target application
4334 func_exec_program_core ()
4337 case $host in
4338 # Backslashes separate directories on plain windows
4339 *-*-mingw | *-*-os2* | *-cegcc*)
4340 $ECHO "\
4341 if test -n \"\$lt_option_debug\"; then
4342 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
4343 func_lt_dump_args \${1+\"\$@\"} 1>&2
4345 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4350 $ECHO "\
4351 if test -n \"\$lt_option_debug\"; then
4352 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4353 func_lt_dump_args \${1+\"\$@\"} 1>&2
4355 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4358 esac
4359 $ECHO "\
4360 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4361 exit 1
4364 # A function to encapsulate launching the target application
4365 # Strips options in the --lt-* namespace from \$@ and
4366 # launches target application with the remaining arguments.
4367 func_exec_program ()
4369 case \" \$* \" in
4370 *\\ --lt-*)
4371 for lt_wr_arg
4373 case \$lt_wr_arg in
4374 --lt-*) ;;
4375 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4376 esac
4377 shift
4378 done ;;
4379 esac
4380 func_exec_program_core \${1+\"\$@\"}
4383 # Parse options
4384 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4386 # Find the directory that this script lives in.
4387 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4388 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4390 # Follow symbolic links until we get to the real thisdir.
4391 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4392 while test -n \"\$file\"; do
4393 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4395 # If there was a directory component, then change thisdir.
4396 if test \"x\$destdir\" != \"x\$file\"; then
4397 case \"\$destdir\" in
4398 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4399 *) thisdir=\"\$thisdir/\$destdir\" ;;
4400 esac
4403 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4404 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4405 done
4407 # Usually 'no', except on cygwin/mingw when embedded into
4408 # the cwrapper.
4409 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4410 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4411 # special case for '.'
4412 if test \"\$thisdir\" = \".\"; then
4413 thisdir=\`pwd\`
4415 # remove .libs from thisdir
4416 case \"\$thisdir\" in
4417 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4418 $objdir ) thisdir=. ;;
4419 esac
4422 # Try to get the absolute directory name.
4423 absdir=\`cd \"\$thisdir\" && pwd\`
4424 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4427 if test "$fast_install" = yes; then
4428 $ECHO "\
4429 program=lt-'$outputname'$exeext
4430 progdir=\"\$thisdir/$objdir\"
4432 if test ! -f \"\$progdir/\$program\" ||
4433 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4434 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4436 file=\"\$\$-\$program\"
4438 if test ! -d \"\$progdir\"; then
4439 $MKDIR \"\$progdir\"
4440 else
4441 $RM \"\$progdir/\$file\"
4444 $ECHO "\
4446 # relink executable if necessary
4447 if test -n \"\$relink_command\"; then
4448 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4449 else
4450 $ECHO \"\$relink_command_output\" >&2
4451 $RM \"\$progdir/\$file\"
4452 exit 1
4456 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4457 { $RM \"\$progdir/\$program\";
4458 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4459 $RM \"\$progdir/\$file\"
4461 else
4462 $ECHO "\
4463 program='$outputname'
4464 progdir=\"\$thisdir/$objdir\"
4468 $ECHO "\
4470 if test -f \"\$progdir/\$program\"; then"
4472 # fixup the dll searchpath if we need to.
4474 # Fix the DLL searchpath if we need to. Do this before prepending
4475 # to shlibpath, because on Windows, both are PATH and uninstalled
4476 # libraries must come first.
4477 if test -n "$dllsearchpath"; then
4478 $ECHO "\
4479 # Add the dll search path components to the executable PATH
4480 PATH=$dllsearchpath:\$PATH
4484 # Export our shlibpath_var if we have one.
4485 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4486 $ECHO "\
4487 # Add our own library path to $shlibpath_var
4488 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4490 # Some systems cannot cope with colon-terminated $shlibpath_var
4491 # The second colon is a workaround for a bug in BeOS R4 sed
4492 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4494 export $shlibpath_var
4498 $ECHO "\
4499 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4500 # Run the actual program with our arguments.
4501 func_exec_program \${1+\"\$@\"}
4503 else
4504 # The program doesn't exist.
4505 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4506 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4507 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4508 exit 1
4515 # func_emit_cwrapperexe_src
4516 # emit the source code for a wrapper executable on stdout
4517 # Must ONLY be called from within func_mode_link because
4518 # it depends on a number of variable set therein.
4519 func_emit_cwrapperexe_src ()
4521 cat <<EOF
4523 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4524 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4526 The $output program cannot be directly executed until all the libtool
4527 libraries that it depends on are installed.
4529 This wrapper executable should never be moved out of the build directory.
4530 If it is, it will not operate correctly.
4533 cat <<"EOF"
4534 #ifdef _MSC_VER
4535 # define _CRT_SECURE_NO_DEPRECATE 1
4536 #endif
4537 #include <stdio.h>
4538 #include <stdlib.h>
4539 #ifdef _MSC_VER
4540 # include <direct.h>
4541 # include <process.h>
4542 # include <io.h>
4543 #else
4544 # include <unistd.h>
4545 # include <stdint.h>
4546 # ifdef __CYGWIN__
4547 # include <io.h>
4548 # endif
4549 #endif
4550 #include <malloc.h>
4551 #include <stdarg.h>
4552 #include <assert.h>
4553 #include <string.h>
4554 #include <ctype.h>
4555 #include <errno.h>
4556 #include <fcntl.h>
4557 #include <sys/stat.h>
4559 /* declarations of non-ANSI functions */
4560 #if defined(__MINGW32__)
4561 # ifdef __STRICT_ANSI__
4562 int _putenv (const char *);
4563 # endif
4564 #elif defined(__CYGWIN__)
4565 # ifdef __STRICT_ANSI__
4566 char *realpath (const char *, char *);
4567 int putenv (char *);
4568 int setenv (const char *, const char *, int);
4569 # endif
4570 /* #elif defined (other platforms) ... */
4571 #endif
4573 /* portability defines, excluding path handling macros */
4574 #if defined(_MSC_VER)
4575 # define setmode _setmode
4576 # define stat _stat
4577 # define chmod _chmod
4578 # define getcwd _getcwd
4579 # define putenv _putenv
4580 # define S_IXUSR _S_IEXEC
4581 # ifndef _INTPTR_T_DEFINED
4582 # define _INTPTR_T_DEFINED
4583 # define intptr_t int
4584 # endif
4585 #elif defined(__MINGW32__)
4586 # define setmode _setmode
4587 # define stat _stat
4588 # define chmod _chmod
4589 # define getcwd _getcwd
4590 # define putenv _putenv
4591 #elif defined(__CYGWIN__)
4592 # define HAVE_SETENV
4593 # define FOPEN_WB "wb"
4594 /* #elif defined (other platforms) ... */
4595 #endif
4597 #if defined(PATH_MAX)
4598 # define LT_PATHMAX PATH_MAX
4599 #elif defined(MAXPATHLEN)
4600 # define LT_PATHMAX MAXPATHLEN
4601 #else
4602 # define LT_PATHMAX 1024
4603 #endif
4605 #ifndef S_IXOTH
4606 # define S_IXOTH 0
4607 #endif
4608 #ifndef S_IXGRP
4609 # define S_IXGRP 0
4610 #endif
4612 /* path handling portability macros */
4613 #ifndef DIR_SEPARATOR
4614 # define DIR_SEPARATOR '/'
4615 # define PATH_SEPARATOR ':'
4616 #endif
4618 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4619 defined (__OS2__)
4620 # define HAVE_DOS_BASED_FILE_SYSTEM
4621 # define FOPEN_WB "wb"
4622 # ifndef DIR_SEPARATOR_2
4623 # define DIR_SEPARATOR_2 '\\'
4624 # endif
4625 # ifndef PATH_SEPARATOR_2
4626 # define PATH_SEPARATOR_2 ';'
4627 # endif
4628 #endif
4630 #ifndef DIR_SEPARATOR_2
4631 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4632 #else /* DIR_SEPARATOR_2 */
4633 # define IS_DIR_SEPARATOR(ch) \
4634 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4635 #endif /* DIR_SEPARATOR_2 */
4637 #ifndef PATH_SEPARATOR_2
4638 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4639 #else /* PATH_SEPARATOR_2 */
4640 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4641 #endif /* PATH_SEPARATOR_2 */
4643 #ifndef FOPEN_WB
4644 # define FOPEN_WB "w"
4645 #endif
4646 #ifndef _O_BINARY
4647 # define _O_BINARY 0
4648 #endif
4650 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4651 #define XFREE(stale) do { \
4652 if (stale) { free ((void *) stale); stale = 0; } \
4653 } while (0)
4655 #if defined(LT_DEBUGWRAPPER)
4656 static int lt_debug = 1;
4657 #else
4658 static int lt_debug = 0;
4659 #endif
4661 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4663 void *xmalloc (size_t num);
4664 char *xstrdup (const char *string);
4665 const char *base_name (const char *name);
4666 char *find_executable (const char *wrapper);
4667 char *chase_symlinks (const char *pathspec);
4668 int make_executable (const char *path);
4669 int check_executable (const char *path);
4670 char *strendzap (char *str, const char *pat);
4671 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4672 void lt_fatal (const char *file, int line, const char *message, ...);
4673 static const char *nonnull (const char *s);
4674 static const char *nonempty (const char *s);
4675 void lt_setenv (const char *name, const char *value);
4676 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4677 void lt_update_exe_path (const char *name, const char *value);
4678 void lt_update_lib_path (const char *name, const char *value);
4679 char **prepare_spawn (char **argv);
4680 void lt_dump_script (FILE *f);
4683 cat <<EOF
4684 volatile const char * MAGIC_EXE = "$magic_exe";
4685 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4688 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4689 func_to_host_path "$temp_rpath"
4690 cat <<EOF
4691 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4693 else
4694 cat <<"EOF"
4695 const char * LIB_PATH_VALUE = "";
4699 if test -n "$dllsearchpath"; then
4700 func_to_host_path "$dllsearchpath:"
4701 cat <<EOF
4702 const char * EXE_PATH_VARNAME = "PATH";
4703 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4705 else
4706 cat <<"EOF"
4707 const char * EXE_PATH_VARNAME = "";
4708 const char * EXE_PATH_VALUE = "";
4712 if test "$fast_install" = yes; then
4713 cat <<EOF
4714 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4716 else
4717 cat <<EOF
4718 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4723 cat <<"EOF"
4725 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4727 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4728 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4729 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4732 main (int argc, char *argv[])
4734 char **newargz;
4735 int newargc;
4736 char *tmp_pathspec;
4737 char *actual_cwrapper_path;
4738 char *actual_cwrapper_name;
4739 char *target_name;
4740 char *lt_argv_zero;
4741 intptr_t rval = 127;
4743 int i;
4745 program_name = (char *) xstrdup (base_name (argv[0]));
4746 newargz = XMALLOC (char *, argc + 1);
4748 /* very simple arg parsing; don't want to rely on getopt
4749 * also, copy all non cwrapper options to newargz, except
4750 * argz[0], which is handled differently
4752 newargc=0;
4753 for (i = 1; i < argc; i++)
4755 if (strcmp (argv[i], dumpscript_opt) == 0)
4758 case "$host" in
4759 *mingw* | *cygwin* )
4760 # make stdout use "unix" line endings
4761 echo " setmode(1,_O_BINARY);"
4763 esac
4765 cat <<"EOF"
4766 lt_dump_script (stdout);
4767 return 0;
4769 if (strcmp (argv[i], debug_opt) == 0)
4771 lt_debug = 1;
4772 continue;
4774 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4776 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4777 namespace, but it is not one of the ones we know about and
4778 have already dealt with, above (inluding dump-script), then
4779 report an error. Otherwise, targets might begin to believe
4780 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4781 namespace. The first time any user complains about this, we'll
4782 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4783 or a configure.ac-settable value.
4785 lt_fatal (__FILE__, __LINE__,
4786 "unrecognized %s option: '%s'",
4787 ltwrapper_option_prefix, argv[i]);
4789 /* otherwise ... */
4790 newargz[++newargc] = xstrdup (argv[i]);
4792 newargz[++newargc] = NULL;
4795 cat <<EOF
4796 /* The GNU banner must be the first non-error debug message */
4797 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4799 cat <<"EOF"
4800 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4801 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4803 tmp_pathspec = find_executable (argv[0]);
4804 if (tmp_pathspec == NULL)
4805 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4806 lt_debugprintf (__FILE__, __LINE__,
4807 "(main) found exe (before symlink chase) at: %s\n",
4808 tmp_pathspec);
4810 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4811 lt_debugprintf (__FILE__, __LINE__,
4812 "(main) found exe (after symlink chase) at: %s\n",
4813 actual_cwrapper_path);
4814 XFREE (tmp_pathspec);
4816 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4817 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4819 /* wrapper name transforms */
4820 strendzap (actual_cwrapper_name, ".exe");
4821 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4822 XFREE (actual_cwrapper_name);
4823 actual_cwrapper_name = tmp_pathspec;
4824 tmp_pathspec = 0;
4826 /* target_name transforms -- use actual target program name; might have lt- prefix */
4827 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4828 strendzap (target_name, ".exe");
4829 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4830 XFREE (target_name);
4831 target_name = tmp_pathspec;
4832 tmp_pathspec = 0;
4834 lt_debugprintf (__FILE__, __LINE__,
4835 "(main) libtool target name: %s\n",
4836 target_name);
4839 cat <<EOF
4840 newargz[0] =
4841 XMALLOC (char, (strlen (actual_cwrapper_path) +
4842 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4843 strcpy (newargz[0], actual_cwrapper_path);
4844 strcat (newargz[0], "$objdir");
4845 strcat (newargz[0], "/");
4848 cat <<"EOF"
4849 /* stop here, and copy so we don't have to do this twice */
4850 tmp_pathspec = xstrdup (newargz[0]);
4852 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4853 strcat (newargz[0], actual_cwrapper_name);
4855 /* DO want the lt- prefix here if it exists, so use target_name */
4856 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4857 XFREE (tmp_pathspec);
4858 tmp_pathspec = NULL;
4861 case $host_os in
4862 mingw*)
4863 cat <<"EOF"
4865 char* p;
4866 while ((p = strchr (newargz[0], '\\')) != NULL)
4868 *p = '/';
4870 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4872 *p = '/';
4877 esac
4879 cat <<"EOF"
4880 XFREE (target_name);
4881 XFREE (actual_cwrapper_path);
4882 XFREE (actual_cwrapper_name);
4884 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4885 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4886 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4887 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4888 because on Windows, both *_VARNAMEs are PATH but uninstalled
4889 libraries must come first. */
4890 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4891 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4893 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4894 nonnull (lt_argv_zero));
4895 for (i = 0; i < newargc; i++)
4897 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4898 i, nonnull (newargz[i]));
4903 case $host_os in
4904 mingw*)
4905 cat <<"EOF"
4906 /* execv doesn't actually work on mingw as expected on unix */
4907 newargz = prepare_spawn (newargz);
4908 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4909 if (rval == -1)
4911 /* failed to start process */
4912 lt_debugprintf (__FILE__, __LINE__,
4913 "(main) failed to launch target \"%s\": %s\n",
4914 lt_argv_zero, nonnull (strerror (errno)));
4915 return 127;
4917 return rval;
4921 cat <<"EOF"
4922 execv (lt_argv_zero, newargz);
4923 return rval; /* =127, but avoids unused variable warning */
4926 esac
4928 cat <<"EOF"
4931 void *
4932 xmalloc (size_t num)
4934 void *p = (void *) malloc (num);
4935 if (!p)
4936 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4938 return p;
4941 char *
4942 xstrdup (const char *string)
4944 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4945 string) : NULL;
4948 const char *
4949 base_name (const char *name)
4951 const char *base;
4953 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4954 /* Skip over the disk name in MSDOS pathnames. */
4955 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4956 name += 2;
4957 #endif
4959 for (base = name; *name; name++)
4960 if (IS_DIR_SEPARATOR (*name))
4961 base = name + 1;
4962 return base;
4966 check_executable (const char *path)
4968 struct stat st;
4970 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4971 nonempty (path));
4972 if ((!path) || (!*path))
4973 return 0;
4975 if ((stat (path, &st) >= 0)
4976 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4977 return 1;
4978 else
4979 return 0;
4983 make_executable (const char *path)
4985 int rval = 0;
4986 struct stat st;
4988 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4989 nonempty (path));
4990 if ((!path) || (!*path))
4991 return 0;
4993 if (stat (path, &st) >= 0)
4995 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4997 return rval;
5000 /* Searches for the full path of the wrapper. Returns
5001 newly allocated full path name if found, NULL otherwise
5002 Does not chase symlinks, even on platforms that support them.
5004 char *
5005 find_executable (const char *wrapper)
5007 int has_slash = 0;
5008 const char *p;
5009 const char *p_next;
5010 /* static buffer for getcwd */
5011 char tmp[LT_PATHMAX + 1];
5012 int tmp_len;
5013 char *concat_name;
5015 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
5016 nonempty (wrapper));
5018 if ((wrapper == NULL) || (*wrapper == '\0'))
5019 return NULL;
5021 /* Absolute path? */
5022 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5023 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
5025 concat_name = xstrdup (wrapper);
5026 if (check_executable (concat_name))
5027 return concat_name;
5028 XFREE (concat_name);
5030 else
5032 #endif
5033 if (IS_DIR_SEPARATOR (wrapper[0]))
5035 concat_name = xstrdup (wrapper);
5036 if (check_executable (concat_name))
5037 return concat_name;
5038 XFREE (concat_name);
5040 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5042 #endif
5044 for (p = wrapper; *p; p++)
5045 if (*p == '/')
5047 has_slash = 1;
5048 break;
5050 if (!has_slash)
5052 /* no slashes; search PATH */
5053 const char *path = getenv ("PATH");
5054 if (path != NULL)
5056 for (p = path; *p; p = p_next)
5058 const char *q;
5059 size_t p_len;
5060 for (q = p; *q; q++)
5061 if (IS_PATH_SEPARATOR (*q))
5062 break;
5063 p_len = q - p;
5064 p_next = (*q == '\0' ? q : q + 1);
5065 if (p_len == 0)
5067 /* empty path: current directory */
5068 if (getcwd (tmp, LT_PATHMAX) == NULL)
5069 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5070 nonnull (strerror (errno)));
5071 tmp_len = strlen (tmp);
5072 concat_name =
5073 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5074 memcpy (concat_name, tmp, tmp_len);
5075 concat_name[tmp_len] = '/';
5076 strcpy (concat_name + tmp_len + 1, wrapper);
5078 else
5080 concat_name =
5081 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
5082 memcpy (concat_name, p, p_len);
5083 concat_name[p_len] = '/';
5084 strcpy (concat_name + p_len + 1, wrapper);
5086 if (check_executable (concat_name))
5087 return concat_name;
5088 XFREE (concat_name);
5091 /* not found in PATH; assume curdir */
5093 /* Relative path | not found in path: prepend cwd */
5094 if (getcwd (tmp, LT_PATHMAX) == NULL)
5095 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5096 nonnull (strerror (errno)));
5097 tmp_len = strlen (tmp);
5098 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5099 memcpy (concat_name, tmp, tmp_len);
5100 concat_name[tmp_len] = '/';
5101 strcpy (concat_name + tmp_len + 1, wrapper);
5103 if (check_executable (concat_name))
5104 return concat_name;
5105 XFREE (concat_name);
5106 return NULL;
5109 char *
5110 chase_symlinks (const char *pathspec)
5112 #ifndef S_ISLNK
5113 return xstrdup (pathspec);
5114 #else
5115 char buf[LT_PATHMAX];
5116 struct stat s;
5117 char *tmp_pathspec = xstrdup (pathspec);
5118 char *p;
5119 int has_symlinks = 0;
5120 while (strlen (tmp_pathspec) && !has_symlinks)
5122 lt_debugprintf (__FILE__, __LINE__,
5123 "checking path component for symlinks: %s\n",
5124 tmp_pathspec);
5125 if (lstat (tmp_pathspec, &s) == 0)
5127 if (S_ISLNK (s.st_mode) != 0)
5129 has_symlinks = 1;
5130 break;
5133 /* search backwards for last DIR_SEPARATOR */
5134 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
5135 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5136 p--;
5137 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5139 /* no more DIR_SEPARATORS left */
5140 break;
5142 *p = '\0';
5144 else
5146 lt_fatal (__FILE__, __LINE__,
5147 "error accessing file \"%s\": %s",
5148 tmp_pathspec, nonnull (strerror (errno)));
5151 XFREE (tmp_pathspec);
5153 if (!has_symlinks)
5155 return xstrdup (pathspec);
5158 tmp_pathspec = realpath (pathspec, buf);
5159 if (tmp_pathspec == 0)
5161 lt_fatal (__FILE__, __LINE__,
5162 "could not follow symlinks for %s", pathspec);
5164 return xstrdup (tmp_pathspec);
5165 #endif
5168 char *
5169 strendzap (char *str, const char *pat)
5171 size_t len, patlen;
5173 assert (str != NULL);
5174 assert (pat != NULL);
5176 len = strlen (str);
5177 patlen = strlen (pat);
5179 if (patlen <= len)
5181 str += len - patlen;
5182 if (strcmp (str, pat) == 0)
5183 *str = '\0';
5185 return str;
5188 void
5189 lt_debugprintf (const char *file, int line, const char *fmt, ...)
5191 va_list args;
5192 if (lt_debug)
5194 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
5195 va_start (args, fmt);
5196 (void) vfprintf (stderr, fmt, args);
5197 va_end (args);
5201 static void
5202 lt_error_core (int exit_status, const char *file,
5203 int line, const char *mode,
5204 const char *message, va_list ap)
5206 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
5207 vfprintf (stderr, message, ap);
5208 fprintf (stderr, ".\n");
5210 if (exit_status >= 0)
5211 exit (exit_status);
5214 void
5215 lt_fatal (const char *file, int line, const char *message, ...)
5217 va_list ap;
5218 va_start (ap, message);
5219 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
5220 va_end (ap);
5223 static const char *
5224 nonnull (const char *s)
5226 return s ? s : "(null)";
5229 static const char *
5230 nonempty (const char *s)
5232 return (s && !*s) ? "(empty)" : nonnull (s);
5235 void
5236 lt_setenv (const char *name, const char *value)
5238 lt_debugprintf (__FILE__, __LINE__,
5239 "(lt_setenv) setting '%s' to '%s'\n",
5240 nonnull (name), nonnull (value));
5242 #ifdef HAVE_SETENV
5243 /* always make a copy, for consistency with !HAVE_SETENV */
5244 char *str = xstrdup (value);
5245 setenv (name, str, 1);
5246 #else
5247 int len = strlen (name) + 1 + strlen (value) + 1;
5248 char *str = XMALLOC (char, len);
5249 sprintf (str, "%s=%s", name, value);
5250 if (putenv (str) != EXIT_SUCCESS)
5252 XFREE (str);
5254 #endif
5258 char *
5259 lt_extend_str (const char *orig_value, const char *add, int to_end)
5261 char *new_value;
5262 if (orig_value && *orig_value)
5264 int orig_value_len = strlen (orig_value);
5265 int add_len = strlen (add);
5266 new_value = XMALLOC (char, add_len + orig_value_len + 1);
5267 if (to_end)
5269 strcpy (new_value, orig_value);
5270 strcpy (new_value + orig_value_len, add);
5272 else
5274 strcpy (new_value, add);
5275 strcpy (new_value + add_len, orig_value);
5278 else
5280 new_value = xstrdup (add);
5282 return new_value;
5285 void
5286 lt_update_exe_path (const char *name, const char *value)
5288 lt_debugprintf (__FILE__, __LINE__,
5289 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
5290 nonnull (name), nonnull (value));
5292 if (name && *name && value && *value)
5294 char *new_value = lt_extend_str (getenv (name), value, 0);
5295 /* some systems can't cope with a ':'-terminated path #' */
5296 int len = strlen (new_value);
5297 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
5299 new_value[len-1] = '\0';
5301 lt_setenv (name, new_value);
5302 XFREE (new_value);
5306 void
5307 lt_update_lib_path (const char *name, const char *value)
5309 lt_debugprintf (__FILE__, __LINE__,
5310 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
5311 nonnull (name), nonnull (value));
5313 if (name && *name && value && *value)
5315 char *new_value = lt_extend_str (getenv (name), value, 0);
5316 lt_setenv (name, new_value);
5317 XFREE (new_value);
5322 case $host_os in
5323 mingw*)
5324 cat <<"EOF"
5326 /* Prepares an argument vector before calling spawn().
5327 Note that spawn() does not by itself call the command interpreter
5328 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
5329 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
5330 GetVersionEx(&v);
5331 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
5332 }) ? "cmd.exe" : "command.com").
5333 Instead it simply concatenates the arguments, separated by ' ', and calls
5334 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
5335 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
5336 special way:
5337 - Space and tab are interpreted as delimiters. They are not treated as
5338 delimiters if they are surrounded by double quotes: "...".
5339 - Unescaped double quotes are removed from the input. Their only effect is
5340 that within double quotes, space and tab are treated like normal
5341 characters.
5342 - Backslashes not followed by double quotes are not special.
5343 - But 2*n+1 backslashes followed by a double quote become
5344 n backslashes followed by a double quote (n >= 0):
5345 \" -> "
5346 \\\" -> \"
5347 \\\\\" -> \\"
5349 #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"
5350 #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"
5351 char **
5352 prepare_spawn (char **argv)
5354 size_t argc;
5355 char **new_argv;
5356 size_t i;
5358 /* Count number of arguments. */
5359 for (argc = 0; argv[argc] != NULL; argc++)
5362 /* Allocate new argument vector. */
5363 new_argv = XMALLOC (char *, argc + 1);
5365 /* Put quoted arguments into the new argument vector. */
5366 for (i = 0; i < argc; i++)
5368 const char *string = argv[i];
5370 if (string[0] == '\0')
5371 new_argv[i] = xstrdup ("\"\"");
5372 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5374 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5375 size_t length;
5376 unsigned int backslashes;
5377 const char *s;
5378 char *quoted_string;
5379 char *p;
5381 length = 0;
5382 backslashes = 0;
5383 if (quote_around)
5384 length++;
5385 for (s = string; *s != '\0'; s++)
5387 char c = *s;
5388 if (c == '"')
5389 length += backslashes + 1;
5390 length++;
5391 if (c == '\\')
5392 backslashes++;
5393 else
5394 backslashes = 0;
5396 if (quote_around)
5397 length += backslashes + 1;
5399 quoted_string = XMALLOC (char, length + 1);
5401 p = quoted_string;
5402 backslashes = 0;
5403 if (quote_around)
5404 *p++ = '"';
5405 for (s = string; *s != '\0'; s++)
5407 char c = *s;
5408 if (c == '"')
5410 unsigned int j;
5411 for (j = backslashes + 1; j > 0; j--)
5412 *p++ = '\\';
5414 *p++ = c;
5415 if (c == '\\')
5416 backslashes++;
5417 else
5418 backslashes = 0;
5420 if (quote_around)
5422 unsigned int j;
5423 for (j = backslashes; j > 0; j--)
5424 *p++ = '\\';
5425 *p++ = '"';
5427 *p = '\0';
5429 new_argv[i] = quoted_string;
5431 else
5432 new_argv[i] = (char *) string;
5434 new_argv[argc] = NULL;
5436 return new_argv;
5440 esac
5442 cat <<"EOF"
5443 void lt_dump_script (FILE* f)
5446 func_emit_wrapper yes |
5447 $SED -n -e '
5448 s/^\(.\{79\}\)\(..*\)/\1\
5451 s/\([\\"]\)/\\\1/g
5452 s/$/\\n/
5453 s/\([^\n]*\).*/ fputs ("\1", f);/p
5456 cat <<"EOF"
5460 # end: func_emit_cwrapperexe_src
5462 # func_win32_import_lib_p ARG
5463 # True if ARG is an import lib, as indicated by $file_magic_cmd
5464 func_win32_import_lib_p ()
5466 $opt_debug
5467 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5468 *import*) : ;;
5469 *) false ;;
5470 esac
5473 # func_mode_link arg...
5474 func_mode_link ()
5476 $opt_debug
5477 case $host in
5478 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5479 # It is impossible to link a dll without this setting, and
5480 # we shouldn't force the makefile maintainer to figure out
5481 # which system we are compiling for in order to pass an extra
5482 # flag for every libtool invocation.
5483 # allow_undefined=no
5485 # FIXME: Unfortunately, there are problems with the above when trying
5486 # to make a dll which has undefined symbols, in which case not
5487 # even a static library is built. For now, we need to specify
5488 # -no-undefined on the libtool link line when we can be certain
5489 # that all symbols are satisfied, otherwise we get a static library.
5490 allow_undefined=yes
5493 allow_undefined=yes
5495 esac
5496 libtool_args=$nonopt
5497 base_compile="$nonopt $@"
5498 compile_command=$nonopt
5499 finalize_command=$nonopt
5501 compile_rpath=
5502 finalize_rpath=
5503 compile_shlibpath=
5504 finalize_shlibpath=
5505 convenience=
5506 old_convenience=
5507 deplibs=
5508 old_deplibs=
5509 compiler_flags=
5510 linker_flags=
5511 dllsearchpath=
5512 lib_search_path=`pwd`
5513 inst_prefix_dir=
5514 new_inherited_linker_flags=
5516 avoid_version=no
5517 bindir=
5518 dlfiles=
5519 dlprefiles=
5520 dlself=no
5521 export_dynamic=no
5522 export_symbols=
5523 export_symbols_regex=
5524 generated=
5525 libobjs=
5526 ltlibs=
5527 module=no
5528 no_install=no
5529 objs=
5530 non_pic_objects=
5531 precious_files_regex=
5532 prefer_static_libs=no
5533 preload=no
5534 prev=
5535 prevarg=
5536 release=
5537 rpath=
5538 xrpath=
5539 perm_rpath=
5540 temp_rpath=
5541 thread_safe=no
5542 vinfo=
5543 vinfo_number=no
5544 weak_libs=
5545 single_module="${wl}-single_module"
5546 func_infer_tag $base_compile
5548 # We need to know -static, to get the right output filenames.
5549 for arg
5551 case $arg in
5552 -shared)
5553 test "$build_libtool_libs" != yes && \
5554 func_fatal_configuration "can not build a shared library"
5555 build_old_libs=no
5556 break
5558 -all-static | -static | -static-libtool-libs)
5559 case $arg in
5560 -all-static)
5561 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5562 func_warning "complete static linking is impossible in this configuration"
5564 if test -n "$link_static_flag"; then
5565 dlopen_self=$dlopen_self_static
5567 prefer_static_libs=yes
5569 -static)
5570 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5571 dlopen_self=$dlopen_self_static
5573 prefer_static_libs=built
5575 -static-libtool-libs)
5576 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5577 dlopen_self=$dlopen_self_static
5579 prefer_static_libs=yes
5581 esac
5582 build_libtool_libs=no
5583 build_old_libs=yes
5584 break
5586 esac
5587 done
5589 # See if our shared archives depend on static archives.
5590 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5592 # Go through the arguments, transforming them on the way.
5593 while test "$#" -gt 0; do
5594 arg="$1"
5595 shift
5596 func_quote_for_eval "$arg"
5597 qarg=$func_quote_for_eval_unquoted_result
5598 libtool_args+=" $func_quote_for_eval_result"
5600 # If the previous option needs an argument, assign it.
5601 if test -n "$prev"; then
5602 case $prev in
5603 output)
5604 compile_command+=" @OUTPUT@"
5605 finalize_command+=" @OUTPUT@"
5607 esac
5609 case $prev in
5610 bindir)
5611 bindir="$arg"
5612 prev=
5613 continue
5615 dlfiles|dlprefiles)
5616 if test "$preload" = no; then
5617 # Add the symbol object into the linking commands.
5618 compile_command+=" @SYMFILE@"
5619 finalize_command+=" @SYMFILE@"
5620 preload=yes
5622 case $arg in
5623 *.la | *.lo) ;; # We handle these cases below.
5624 force)
5625 if test "$dlself" = no; then
5626 dlself=needless
5627 export_dynamic=yes
5629 prev=
5630 continue
5632 self)
5633 if test "$prev" = dlprefiles; then
5634 dlself=yes
5635 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5636 dlself=yes
5637 else
5638 dlself=needless
5639 export_dynamic=yes
5641 prev=
5642 continue
5645 if test "$prev" = dlfiles; then
5646 dlfiles+=" $arg"
5647 else
5648 dlprefiles+=" $arg"
5650 prev=
5651 continue
5653 esac
5655 expsyms)
5656 export_symbols="$arg"
5657 test -f "$arg" \
5658 || func_fatal_error "symbol file \`$arg' does not exist"
5659 prev=
5660 continue
5662 expsyms_regex)
5663 export_symbols_regex="$arg"
5664 prev=
5665 continue
5667 framework)
5668 case $host in
5669 *-*-darwin*)
5670 case "$deplibs " in
5671 *" $qarg.ltframework "*) ;;
5672 *) deplibs+=" $qarg.ltframework" # this is fixed later
5674 esac
5676 esac
5677 prev=
5678 continue
5680 inst_prefix)
5681 inst_prefix_dir="$arg"
5682 prev=
5683 continue
5685 objectlist)
5686 if test -f "$arg"; then
5687 save_arg=$arg
5688 moreargs=
5689 for fil in `cat "$save_arg"`
5691 # moreargs+=" $fil"
5692 arg=$fil
5693 # A libtool-controlled object.
5695 # Check to see that this really is a libtool object.
5696 if func_lalib_unsafe_p "$arg"; then
5697 pic_object=
5698 non_pic_object=
5700 # Read the .lo file
5701 func_source "$arg"
5703 if test -z "$pic_object" ||
5704 test -z "$non_pic_object" ||
5705 test "$pic_object" = none &&
5706 test "$non_pic_object" = none; then
5707 func_fatal_error "cannot find name of object for \`$arg'"
5710 # Extract subdirectory from the argument.
5711 func_dirname "$arg" "/" ""
5712 xdir="$func_dirname_result"
5714 if test "$pic_object" != none; then
5715 # Prepend the subdirectory the object is found in.
5716 pic_object="$xdir$pic_object"
5718 if test "$prev" = dlfiles; then
5719 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5720 dlfiles+=" $pic_object"
5721 prev=
5722 continue
5723 else
5724 # If libtool objects are unsupported, then we need to preload.
5725 prev=dlprefiles
5729 # CHECK ME: I think I busted this. -Ossama
5730 if test "$prev" = dlprefiles; then
5731 # Preload the old-style object.
5732 dlprefiles+=" $pic_object"
5733 prev=
5736 # A PIC object.
5737 libobjs+=" $pic_object"
5738 arg="$pic_object"
5741 # Non-PIC object.
5742 if test "$non_pic_object" != none; then
5743 # Prepend the subdirectory the object is found in.
5744 non_pic_object="$xdir$non_pic_object"
5746 # A standard non-PIC object
5747 non_pic_objects+=" $non_pic_object"
5748 if test -z "$pic_object" || test "$pic_object" = none ; then
5749 arg="$non_pic_object"
5751 else
5752 # If the PIC object exists, use it instead.
5753 # $xdir was prepended to $pic_object above.
5754 non_pic_object="$pic_object"
5755 non_pic_objects+=" $non_pic_object"
5757 else
5758 # Only an error if not doing a dry-run.
5759 if $opt_dry_run; then
5760 # Extract subdirectory from the argument.
5761 func_dirname "$arg" "/" ""
5762 xdir="$func_dirname_result"
5764 func_lo2o "$arg"
5765 pic_object=$xdir$objdir/$func_lo2o_result
5766 non_pic_object=$xdir$func_lo2o_result
5767 libobjs+=" $pic_object"
5768 non_pic_objects+=" $non_pic_object"
5769 else
5770 func_fatal_error "\`$arg' is not a valid libtool object"
5773 done
5774 else
5775 func_fatal_error "link input file \`$arg' does not exist"
5777 arg=$save_arg
5778 prev=
5779 continue
5781 precious_regex)
5782 precious_files_regex="$arg"
5783 prev=
5784 continue
5786 release)
5787 release="-$arg"
5788 prev=
5789 continue
5791 rpath | xrpath)
5792 # We need an absolute path.
5793 case $arg in
5794 [\\/]* | [A-Za-z]:[\\/]*) ;;
5796 func_fatal_error "only absolute run-paths are allowed"
5798 esac
5799 if test "$prev" = rpath; then
5800 case "$rpath " in
5801 *" $arg "*) ;;
5802 *) rpath+=" $arg" ;;
5803 esac
5804 else
5805 case "$xrpath " in
5806 *" $arg "*) ;;
5807 *) xrpath+=" $arg" ;;
5808 esac
5810 prev=
5811 continue
5813 shrext)
5814 shrext_cmds="$arg"
5815 prev=
5816 continue
5818 weak)
5819 weak_libs+=" $arg"
5820 prev=
5821 continue
5823 xcclinker)
5824 linker_flags+=" $qarg"
5825 compiler_flags+=" $qarg"
5826 prev=
5827 compile_command+=" $qarg"
5828 finalize_command+=" $qarg"
5829 continue
5831 xcompiler)
5832 compiler_flags+=" $qarg"
5833 prev=
5834 compile_command+=" $qarg"
5835 finalize_command+=" $qarg"
5836 continue
5838 xlinker)
5839 linker_flags+=" $qarg"
5840 compiler_flags+=" $wl$qarg"
5841 prev=
5842 compile_command+=" $wl$qarg"
5843 finalize_command+=" $wl$qarg"
5844 continue
5847 eval "$prev=\"\$arg\""
5848 prev=
5849 continue
5851 esac
5852 fi # test -n "$prev"
5854 prevarg="$arg"
5856 case $arg in
5857 -all-static)
5858 if test -n "$link_static_flag"; then
5859 # See comment for -static flag below, for more details.
5860 compile_command+=" $link_static_flag"
5861 finalize_command+=" $link_static_flag"
5863 continue
5866 -allow-undefined)
5867 # FIXME: remove this flag sometime in the future.
5868 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5871 -avoid-version)
5872 avoid_version=yes
5873 continue
5876 -bindir)
5877 prev=bindir
5878 continue
5881 -dlopen)
5882 prev=dlfiles
5883 continue
5886 -dlpreopen)
5887 prev=dlprefiles
5888 continue
5891 -export-dynamic)
5892 export_dynamic=yes
5893 continue
5896 -export-symbols | -export-symbols-regex)
5897 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5898 func_fatal_error "more than one -exported-symbols argument is not allowed"
5900 if test "X$arg" = "X-export-symbols"; then
5901 prev=expsyms
5902 else
5903 prev=expsyms_regex
5905 continue
5908 -framework)
5909 prev=framework
5910 continue
5913 -inst-prefix-dir)
5914 prev=inst_prefix
5915 continue
5918 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5919 # so, if we see these flags be careful not to treat them like -L
5920 -L[A-Z][A-Z]*:*)
5921 case $with_gcc/$host in
5922 no/*-*-irix* | /*-*-irix*)
5923 compile_command+=" $arg"
5924 finalize_command+=" $arg"
5926 esac
5927 continue
5930 -L*)
5931 func_stripname "-L" '' "$arg"
5932 if test -z "$func_stripname_result"; then
5933 if test "$#" -gt 0; then
5934 func_fatal_error "require no space between \`-L' and \`$1'"
5935 else
5936 func_fatal_error "need path for \`-L' option"
5939 func_resolve_sysroot "$func_stripname_result"
5940 dir=$func_resolve_sysroot_result
5941 # We need an absolute path.
5942 case $dir in
5943 [\\/]* | [A-Za-z]:[\\/]*) ;;
5945 absdir=`cd "$dir" && pwd`
5946 test -z "$absdir" && \
5947 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5948 dir="$absdir"
5950 esac
5951 case "$deplibs " in
5952 *" -L$dir "* | *" $arg "*)
5953 # Will only happen for absolute or sysroot arguments
5956 # Preserve sysroot, but never include relative directories
5957 case $dir in
5958 [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs+=" $arg" ;;
5959 *) deplibs+=" -L$dir" ;;
5960 esac
5961 lib_search_path+=" $dir"
5963 esac
5964 case $host in
5965 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5966 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5967 case :$dllsearchpath: in
5968 *":$dir:"*) ;;
5969 ::) dllsearchpath=$dir;;
5970 *) dllsearchpath+=":$dir";;
5971 esac
5972 case :$dllsearchpath: in
5973 *":$testbindir:"*) ;;
5974 ::) dllsearchpath=$testbindir;;
5975 *) dllsearchpath+=":$testbindir";;
5976 esac
5978 esac
5979 continue
5982 -l*)
5983 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5984 case $host in
5985 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5986 # These systems don't actually have a C or math library (as such)
5987 continue
5989 *-*-os2*)
5990 # These systems don't actually have a C library (as such)
5991 test "X$arg" = "X-lc" && continue
5993 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
5994 # Do not include libc due to us having libc/libc_r.
5995 test "X$arg" = "X-lc" && continue
5997 *-*-rhapsody* | *-*-darwin1.[012])
5998 # Rhapsody C and math libraries are in the System framework
5999 deplibs+=" System.ltframework"
6000 continue
6002 *-*-sco3.2v5* | *-*-sco5v6*)
6003 # Causes problems with __ctype
6004 test "X$arg" = "X-lc" && continue
6006 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6007 # Compiler inserts libc in the correct place for threads to work
6008 test "X$arg" = "X-lc" && continue
6010 esac
6011 elif test "X$arg" = "X-lc_r"; then
6012 case $host in
6013 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
6014 # Do not include libc_r directly, use -pthread flag.
6015 continue
6017 esac
6019 deplibs+=" $arg"
6020 continue
6023 -module)
6024 module=yes
6025 continue
6028 # Tru64 UNIX uses -model [arg] to determine the layout of C++
6029 # classes, name mangling, and exception handling.
6030 # Darwin uses the -arch flag to determine output architecture.
6031 -model|-arch|-isysroot|--sysroot)
6032 compiler_flags+=" $arg"
6033 compile_command+=" $arg"
6034 finalize_command+=" $arg"
6035 prev=xcompiler
6036 continue
6039 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6040 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6041 compiler_flags+=" $arg"
6042 compile_command+=" $arg"
6043 finalize_command+=" $arg"
6044 deplibs+=" $arg"
6045 case "$new_inherited_linker_flags " in
6046 *" $arg "*) ;;
6047 * ) new_inherited_linker_flags+=" $arg" ;;
6048 esac
6049 continue
6052 -multi_module)
6053 single_module="${wl}-multi_module"
6054 continue
6057 -no-fast-install)
6058 fast_install=no
6059 continue
6062 -no-install)
6063 case $host in
6064 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
6065 # The PATH hackery in wrapper scripts is required on Windows
6066 # and Darwin in order for the loader to find any dlls it needs.
6067 func_warning "\`-no-install' is ignored for $host"
6068 func_warning "assuming \`-no-fast-install' instead"
6069 fast_install=no
6071 *) no_install=yes ;;
6072 esac
6073 continue
6076 -no-undefined)
6077 allow_undefined=no
6078 continue
6081 -objectlist)
6082 prev=objectlist
6083 continue
6086 -o) prev=output ;;
6088 -precious-files-regex)
6089 prev=precious_regex
6090 continue
6093 -release)
6094 prev=release
6095 continue
6098 -rpath)
6099 prev=rpath
6100 continue
6104 prev=xrpath
6105 continue
6108 -R*)
6109 func_stripname '-R' '' "$arg"
6110 dir=$func_stripname_result
6111 # We need an absolute path.
6112 case $dir in
6113 [\\/]* | [A-Za-z]:[\\/]*) ;;
6115 func_stripname '=' '' "$dir"
6116 dir=$lt_sysroot$func_stripname_result
6119 func_fatal_error "only absolute run-paths are allowed"
6121 esac
6122 case "$xrpath " in
6123 *" $dir "*) ;;
6124 *) xrpath+=" $dir" ;;
6125 esac
6126 continue
6129 -shared)
6130 # The effects of -shared are defined in a previous loop.
6131 continue
6134 -shrext)
6135 prev=shrext
6136 continue
6139 -static | -static-libtool-libs)
6140 # The effects of -static are defined in a previous loop.
6141 # We used to do the same as -all-static on platforms that
6142 # didn't have a PIC flag, but the assumption that the effects
6143 # would be equivalent was wrong. It would break on at least
6144 # Digital Unix and AIX.
6145 continue
6148 -thread-safe)
6149 thread_safe=yes
6150 continue
6153 -version-info)
6154 prev=vinfo
6155 continue
6158 -version-number)
6159 prev=vinfo
6160 vinfo_number=yes
6161 continue
6164 -weak)
6165 prev=weak
6166 continue
6169 -Wc,*)
6170 func_stripname '-Wc,' '' "$arg"
6171 args=$func_stripname_result
6172 arg=
6173 save_ifs="$IFS"; IFS=','
6174 for flag in $args; do
6175 IFS="$save_ifs"
6176 func_quote_for_eval "$flag"
6177 arg+=" $func_quote_for_eval_result"
6178 compiler_flags+=" $func_quote_for_eval_result"
6179 done
6180 IFS="$save_ifs"
6181 func_stripname ' ' '' "$arg"
6182 arg=$func_stripname_result
6185 -Wl,*)
6186 func_stripname '-Wl,' '' "$arg"
6187 args=$func_stripname_result
6188 arg=
6189 save_ifs="$IFS"; IFS=','
6190 for flag in $args; do
6191 IFS="$save_ifs"
6192 func_quote_for_eval "$flag"
6193 arg+=" $wl$func_quote_for_eval_result"
6194 compiler_flags+=" $wl$func_quote_for_eval_result"
6195 linker_flags+=" $func_quote_for_eval_result"
6196 done
6197 IFS="$save_ifs"
6198 func_stripname ' ' '' "$arg"
6199 arg=$func_stripname_result
6202 -Xcompiler)
6203 prev=xcompiler
6204 continue
6207 -Xlinker)
6208 prev=xlinker
6209 continue
6212 -XCClinker)
6213 prev=xcclinker
6214 continue
6217 # -msg_* for osf cc
6218 -msg_*)
6219 func_quote_for_eval "$arg"
6220 arg="$func_quote_for_eval_result"
6223 # Flags to be passed through unchanged, with rationale:
6224 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
6225 # -r[0-9][0-9]* specify processor for the SGI compiler
6226 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
6227 # +DA*, +DD* enable 64-bit mode for the HP compiler
6228 # -q* compiler args for the IBM compiler
6229 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
6230 # -F/path path to uninstalled frameworks, gcc on darwin
6231 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
6232 # @file GCC response files
6233 # -tp=* Portland pgcc target processor selection
6234 # --sysroot=* for sysroot support
6235 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
6236 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
6237 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
6238 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
6239 func_quote_for_eval "$arg"
6240 arg="$func_quote_for_eval_result"
6241 compile_command+=" $arg"
6242 finalize_command+=" $arg"
6243 compiler_flags+=" $arg"
6244 continue
6247 # Some other compiler flag.
6248 -* | +*)
6249 func_quote_for_eval "$arg"
6250 arg="$func_quote_for_eval_result"
6253 *.$objext)
6254 # A standard object.
6255 objs+=" $arg"
6258 *.lo)
6259 # A libtool-controlled object.
6261 # Check to see that this really is a libtool object.
6262 if func_lalib_unsafe_p "$arg"; then
6263 pic_object=
6264 non_pic_object=
6266 # Read the .lo file
6267 func_source "$arg"
6269 if test -z "$pic_object" ||
6270 test -z "$non_pic_object" ||
6271 test "$pic_object" = none &&
6272 test "$non_pic_object" = none; then
6273 func_fatal_error "cannot find name of object for \`$arg'"
6276 # Extract subdirectory from the argument.
6277 func_dirname "$arg" "/" ""
6278 xdir="$func_dirname_result"
6280 if test "$pic_object" != none; then
6281 # Prepend the subdirectory the object is found in.
6282 pic_object="$xdir$pic_object"
6284 if test "$prev" = dlfiles; then
6285 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
6286 dlfiles+=" $pic_object"
6287 prev=
6288 continue
6289 else
6290 # If libtool objects are unsupported, then we need to preload.
6291 prev=dlprefiles
6295 # CHECK ME: I think I busted this. -Ossama
6296 if test "$prev" = dlprefiles; then
6297 # Preload the old-style object.
6298 dlprefiles+=" $pic_object"
6299 prev=
6302 # A PIC object.
6303 libobjs+=" $pic_object"
6304 arg="$pic_object"
6307 # Non-PIC object.
6308 if test "$non_pic_object" != none; then
6309 # Prepend the subdirectory the object is found in.
6310 non_pic_object="$xdir$non_pic_object"
6312 # A standard non-PIC object
6313 non_pic_objects+=" $non_pic_object"
6314 if test -z "$pic_object" || test "$pic_object" = none ; then
6315 arg="$non_pic_object"
6317 else
6318 # If the PIC object exists, use it instead.
6319 # $xdir was prepended to $pic_object above.
6320 non_pic_object="$pic_object"
6321 non_pic_objects+=" $non_pic_object"
6323 else
6324 # Only an error if not doing a dry-run.
6325 if $opt_dry_run; then
6326 # Extract subdirectory from the argument.
6327 func_dirname "$arg" "/" ""
6328 xdir="$func_dirname_result"
6330 func_lo2o "$arg"
6331 pic_object=$xdir$objdir/$func_lo2o_result
6332 non_pic_object=$xdir$func_lo2o_result
6333 libobjs+=" $pic_object"
6334 non_pic_objects+=" $non_pic_object"
6335 else
6336 func_fatal_error "\`$arg' is not a valid libtool object"
6341 *.$libext)
6342 # An archive.
6343 deplibs+=" $arg"
6344 old_deplibs+=" $arg"
6345 continue
6348 *.la)
6349 # A libtool-controlled library.
6351 func_resolve_sysroot "$arg"
6352 if test "$prev" = dlfiles; then
6353 # This library was specified with -dlopen.
6354 dlfiles+=" $func_resolve_sysroot_result"
6355 prev=
6356 elif test "$prev" = dlprefiles; then
6357 # The library was specified with -dlpreopen.
6358 dlprefiles+=" $func_resolve_sysroot_result"
6359 prev=
6360 else
6361 deplibs+=" $func_resolve_sysroot_result"
6363 continue
6366 # Some other compiler argument.
6368 # Unknown arguments in both finalize_command and compile_command need
6369 # to be aesthetically quoted because they are evaled later.
6370 func_quote_for_eval "$arg"
6371 arg="$func_quote_for_eval_result"
6373 esac # arg
6375 # Now actually substitute the argument into the commands.
6376 if test -n "$arg"; then
6377 compile_command+=" $arg"
6378 finalize_command+=" $arg"
6380 done # argument parsing loop
6382 test -n "$prev" && \
6383 func_fatal_help "the \`$prevarg' option requires an argument"
6385 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6386 eval arg=\"$export_dynamic_flag_spec\"
6387 compile_command+=" $arg"
6388 finalize_command+=" $arg"
6391 oldlibs=
6392 # calculate the name of the file, without its directory
6393 func_basename "$output"
6394 outputname="$func_basename_result"
6395 libobjs_save="$libobjs"
6397 if test -n "$shlibpath_var"; then
6398 # get the directories listed in $shlibpath_var
6399 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6400 else
6401 shlib_search_path=
6403 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6404 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6406 func_dirname "$output" "/" ""
6407 output_objdir="$func_dirname_result$objdir"
6408 func_to_tool_file "$output_objdir/"
6409 tool_output_objdir=$func_to_tool_file_result
6410 # Create the object directory.
6411 func_mkdir_p "$output_objdir"
6413 # Determine the type of output
6414 case $output in
6416 func_fatal_help "you must specify an output file"
6418 *.$libext) linkmode=oldlib ;;
6419 *.lo | *.$objext) linkmode=obj ;;
6420 *.la) linkmode=lib ;;
6421 *) linkmode=prog ;; # Anything else should be a program.
6422 esac
6424 specialdeplibs=
6426 libs=
6427 # Find all interdependent deplibs by searching for libraries
6428 # that are linked more than once (e.g. -la -lb -la)
6429 for deplib in $deplibs; do
6430 if $opt_preserve_dup_deps ; then
6431 case "$libs " in
6432 *" $deplib "*) specialdeplibs+=" $deplib" ;;
6433 esac
6435 libs+=" $deplib"
6436 done
6438 if test "$linkmode" = lib; then
6439 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6441 # Compute libraries that are listed more than once in $predeps
6442 # $postdeps and mark them as special (i.e., whose duplicates are
6443 # not to be eliminated).
6444 pre_post_deps=
6445 if $opt_duplicate_compiler_generated_deps; then
6446 for pre_post_dep in $predeps $postdeps; do
6447 case "$pre_post_deps " in
6448 *" $pre_post_dep "*) specialdeplibs+=" $pre_post_deps" ;;
6449 esac
6450 pre_post_deps+=" $pre_post_dep"
6451 done
6453 pre_post_deps=
6456 deplibs=
6457 newdependency_libs=
6458 newlib_search_path=
6459 need_relink=no # whether we're linking any uninstalled libtool libraries
6460 notinst_deplibs= # not-installed libtool libraries
6461 notinst_path= # paths that contain not-installed libtool libraries
6463 case $linkmode in
6464 lib)
6465 passes="conv dlpreopen link"
6466 for file in $dlfiles $dlprefiles; do
6467 case $file in
6468 *.la) ;;
6470 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6472 esac
6473 done
6475 prog)
6476 compile_deplibs=
6477 finalize_deplibs=
6478 alldeplibs=no
6479 newdlfiles=
6480 newdlprefiles=
6481 passes="conv scan dlopen dlpreopen link"
6483 *) passes="conv"
6485 esac
6487 for pass in $passes; do
6488 # The preopen pass in lib mode reverses $deplibs; put it back here
6489 # so that -L comes before libs that need it for instance...
6490 if test "$linkmode,$pass" = "lib,link"; then
6491 ## FIXME: Find the place where the list is rebuilt in the wrong
6492 ## order, and fix it there properly
6493 tmp_deplibs=
6494 for deplib in $deplibs; do
6495 tmp_deplibs="$deplib $tmp_deplibs"
6496 done
6497 deplibs="$tmp_deplibs"
6500 if test "$linkmode,$pass" = "lib,link" ||
6501 test "$linkmode,$pass" = "prog,scan"; then
6502 libs="$deplibs"
6503 deplibs=
6505 if test "$linkmode" = prog; then
6506 case $pass in
6507 dlopen) libs="$dlfiles" ;;
6508 dlpreopen) libs="$dlprefiles" ;;
6509 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6510 esac
6512 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6513 # Collect and forward deplibs of preopened libtool libs
6514 for lib in $dlprefiles; do
6515 # Ignore non-libtool-libs
6516 dependency_libs=
6517 func_resolve_sysroot "$lib"
6518 case $lib in
6519 *.la) func_source "$func_resolve_sysroot_result" ;;
6520 esac
6522 # Collect preopened libtool deplibs, except any this library
6523 # has declared as weak libs
6524 for deplib in $dependency_libs; do
6525 func_basename "$deplib"
6526 deplib_base=$func_basename_result
6527 case " $weak_libs " in
6528 *" $deplib_base "*) ;;
6529 *) deplibs+=" $deplib" ;;
6530 esac
6531 done
6532 done
6533 libs="$dlprefiles"
6535 if test "$pass" = dlopen; then
6536 # Collect dlpreopened libraries
6537 save_deplibs="$deplibs"
6538 deplibs=
6541 for deplib in $libs; do
6542 lib=
6543 found=no
6544 case $deplib in
6545 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6546 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6547 if test "$linkmode,$pass" = "prog,link"; then
6548 compile_deplibs="$deplib $compile_deplibs"
6549 finalize_deplibs="$deplib $finalize_deplibs"
6550 else
6551 compiler_flags+=" $deplib"
6552 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6553 if test "$linkmode" = lib ; then
6554 case "$new_inherited_linker_flags " in
6555 *" $deplib "*) ;;
6556 * ) new_inherited_linker_flags+=" $deplib" ;;
6557 esac
6560 continue
6562 -l*)
6563 if test "$linkmode" != lib && test "$linkmode" != prog; then
6564 func_warning "\`-l' is ignored for archives/objects"
6565 continue
6567 func_stripname '-l' '' "$deplib"
6568 name=$func_stripname_result
6569 if test "$linkmode" = lib; then
6570 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6571 else
6572 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6574 for searchdir in $searchdirs; do
6575 for search_ext in .la $std_shrext .so .a; do
6576 # Search the libtool library
6577 lib="$searchdir/lib${name}${search_ext}"
6578 if test -f "$lib"; then
6579 if test "$search_ext" = ".la"; then
6580 found=yes
6581 else
6582 found=no
6584 break 2
6586 done
6587 done
6588 if test "$found" != yes; then
6589 # deplib doesn't seem to be a libtool library
6590 if test "$linkmode,$pass" = "prog,link"; then
6591 compile_deplibs="$deplib $compile_deplibs"
6592 finalize_deplibs="$deplib $finalize_deplibs"
6593 else
6594 deplibs="$deplib $deplibs"
6595 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6597 continue
6598 else # deplib is a libtool library
6599 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6600 # We need to do some special things here, and not later.
6601 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6602 case " $predeps $postdeps " in
6603 *" $deplib "*)
6604 if func_lalib_p "$lib"; then
6605 library_names=
6606 old_library=
6607 func_source "$lib"
6608 for l in $old_library $library_names; do
6609 ll="$l"
6610 done
6611 if test "X$ll" = "X$old_library" ; then # only static version available
6612 found=no
6613 func_dirname "$lib" "" "."
6614 ladir="$func_dirname_result"
6615 lib=$ladir/$old_library
6616 if test "$linkmode,$pass" = "prog,link"; then
6617 compile_deplibs="$deplib $compile_deplibs"
6618 finalize_deplibs="$deplib $finalize_deplibs"
6619 else
6620 deplibs="$deplib $deplibs"
6621 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6623 continue
6627 *) ;;
6628 esac
6631 ;; # -l
6632 *.ltframework)
6633 if test "$linkmode,$pass" = "prog,link"; then
6634 compile_deplibs="$deplib $compile_deplibs"
6635 finalize_deplibs="$deplib $finalize_deplibs"
6636 else
6637 deplibs="$deplib $deplibs"
6638 if test "$linkmode" = lib ; then
6639 case "$new_inherited_linker_flags " in
6640 *" $deplib "*) ;;
6641 * ) new_inherited_linker_flags+=" $deplib" ;;
6642 esac
6645 continue
6647 -L*)
6648 case $linkmode in
6649 lib)
6650 deplibs="$deplib $deplibs"
6651 test "$pass" = conv && continue
6652 newdependency_libs="$deplib $newdependency_libs"
6653 func_stripname '-L' '' "$deplib"
6654 func_resolve_sysroot "$func_stripname_result"
6655 newlib_search_path+=" $func_resolve_sysroot_result"
6657 prog)
6658 if test "$pass" = conv; then
6659 deplibs="$deplib $deplibs"
6660 continue
6662 if test "$pass" = scan; then
6663 deplibs="$deplib $deplibs"
6664 else
6665 compile_deplibs="$deplib $compile_deplibs"
6666 finalize_deplibs="$deplib $finalize_deplibs"
6668 func_stripname '-L' '' "$deplib"
6669 func_resolve_sysroot "$func_stripname_result"
6670 newlib_search_path+=" $func_resolve_sysroot_result"
6673 func_warning "\`-L' is ignored for archives/objects"
6675 esac # linkmode
6676 continue
6677 ;; # -L
6678 -R*)
6679 if test "$pass" = link; then
6680 func_stripname '-R' '' "$deplib"
6681 func_resolve_sysroot "$func_stripname_result"
6682 dir=$func_resolve_sysroot_result
6683 # Make sure the xrpath contains only unique directories.
6684 case "$xrpath " in
6685 *" $dir "*) ;;
6686 *) xrpath+=" $dir" ;;
6687 esac
6689 deplibs="$deplib $deplibs"
6690 continue
6692 *.la)
6693 func_resolve_sysroot "$deplib"
6694 lib=$func_resolve_sysroot_result
6696 *.$libext)
6697 if test "$pass" = conv; then
6698 deplibs="$deplib $deplibs"
6699 continue
6701 case $linkmode in
6702 lib)
6703 # Linking convenience modules into shared libraries is allowed,
6704 # but linking other static libraries is non-portable.
6705 case " $dlpreconveniencelibs " in
6706 *" $deplib "*) ;;
6708 valid_a_lib=no
6709 case $deplibs_check_method in
6710 match_pattern*)
6711 set dummy $deplibs_check_method; shift
6712 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6713 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6714 | $EGREP "$match_pattern_regex" > /dev/null; then
6715 valid_a_lib=yes
6718 pass_all)
6719 valid_a_lib=yes
6721 esac
6722 if test "$valid_a_lib" != yes; then
6723 echo
6724 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6725 echo "*** I have the capability to make that library automatically link in when"
6726 echo "*** you link to this library. But I can only do this if you have a"
6727 echo "*** shared version of the library, which you do not appear to have"
6728 echo "*** because the file extensions .$libext of this argument makes me believe"
6729 echo "*** that it is just a static archive that I should not use here."
6730 else
6731 echo
6732 $ECHO "*** Warning: Linking the shared library $output against the"
6733 $ECHO "*** static library $deplib is not portable!"
6734 deplibs="$deplib $deplibs"
6737 esac
6738 continue
6740 prog)
6741 if test "$pass" != link; then
6742 deplibs="$deplib $deplibs"
6743 else
6744 compile_deplibs="$deplib $compile_deplibs"
6745 finalize_deplibs="$deplib $finalize_deplibs"
6747 continue
6749 esac # linkmode
6750 ;; # *.$libext
6751 *.lo | *.$objext)
6752 if test "$pass" = conv; then
6753 deplibs="$deplib $deplibs"
6754 elif test "$linkmode" = prog; then
6755 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6756 # If there is no dlopen support or we're linking statically,
6757 # we need to preload.
6758 newdlprefiles+=" $deplib"
6759 compile_deplibs="$deplib $compile_deplibs"
6760 finalize_deplibs="$deplib $finalize_deplibs"
6761 else
6762 newdlfiles+=" $deplib"
6765 continue
6767 %DEPLIBS%)
6768 alldeplibs=yes
6769 continue
6771 esac # case $deplib
6773 if test "$found" = yes || test -f "$lib"; then :
6774 else
6775 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6778 # Check to see that this really is a libtool archive.
6779 func_lalib_unsafe_p "$lib" \
6780 || func_fatal_error "\`$lib' is not a valid libtool archive"
6782 func_dirname "$lib" "" "."
6783 ladir="$func_dirname_result"
6785 dlname=
6786 dlopen=
6787 dlpreopen=
6788 libdir=
6789 library_names=
6790 old_library=
6791 inherited_linker_flags=
6792 # If the library was installed with an old release of libtool,
6793 # it will not redefine variables installed, or shouldnotlink
6794 installed=yes
6795 shouldnotlink=no
6796 avoidtemprpath=
6799 # Read the .la file
6800 func_source "$lib"
6802 # Convert "-framework foo" to "foo.ltframework"
6803 if test -n "$inherited_linker_flags"; then
6804 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6805 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6806 case " $new_inherited_linker_flags " in
6807 *" $tmp_inherited_linker_flag "*) ;;
6808 *) new_inherited_linker_flags+=" $tmp_inherited_linker_flag";;
6809 esac
6810 done
6812 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6813 if test "$linkmode,$pass" = "lib,link" ||
6814 test "$linkmode,$pass" = "prog,scan" ||
6815 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6816 test -n "$dlopen" && dlfiles+=" $dlopen"
6817 test -n "$dlpreopen" && dlprefiles+=" $dlpreopen"
6820 if test "$pass" = conv; then
6821 # Only check for convenience libraries
6822 deplibs="$lib $deplibs"
6823 if test -z "$libdir"; then
6824 if test -z "$old_library"; then
6825 func_fatal_error "cannot find name of link library for \`$lib'"
6827 # It is a libtool convenience library, so add in its objects.
6828 convenience+=" $ladir/$objdir/$old_library"
6829 old_convenience+=" $ladir/$objdir/$old_library"
6830 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6831 func_fatal_error "\`$lib' is not a convenience library"
6833 tmp_libs=
6834 for deplib in $dependency_libs; do
6835 deplibs="$deplib $deplibs"
6836 if $opt_preserve_dup_deps ; then
6837 case "$tmp_libs " in
6838 *" $deplib "*) specialdeplibs+=" $deplib" ;;
6839 esac
6841 tmp_libs+=" $deplib"
6842 done
6843 continue
6844 fi # $pass = conv
6847 # Get the name of the library we link against.
6848 linklib=
6849 if test -n "$old_library" &&
6850 { test "$prefer_static_libs" = yes ||
6851 test "$prefer_static_libs,$installed" = "built,no"; }; then
6852 linklib=$old_library
6853 else
6854 for l in $old_library $library_names; do
6855 linklib="$l"
6856 done
6858 if test -z "$linklib"; then
6859 func_fatal_error "cannot find name of link library for \`$lib'"
6862 # This library was specified with -dlopen.
6863 if test "$pass" = dlopen; then
6864 if test -z "$libdir"; then
6865 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6867 if test -z "$dlname" ||
6868 test "$dlopen_support" != yes ||
6869 test "$build_libtool_libs" = no; then
6870 # If there is no dlname, no dlopen support or we're linking
6871 # statically, we need to preload. We also need to preload any
6872 # dependent libraries so libltdl's deplib preloader doesn't
6873 # bomb out in the load deplibs phase.
6874 dlprefiles+=" $lib $dependency_libs"
6875 else
6876 newdlfiles+=" $lib"
6878 continue
6879 fi # $pass = dlopen
6881 # We need an absolute path.
6882 case $ladir in
6883 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6885 abs_ladir=`cd "$ladir" && pwd`
6886 if test -z "$abs_ladir"; then
6887 func_warning "cannot determine absolute directory name of \`$ladir'"
6888 func_warning "passing it literally to the linker, although it might fail"
6889 abs_ladir="$ladir"
6892 esac
6893 func_basename "$lib"
6894 laname="$func_basename_result"
6896 # Find the relevant object directory and library name.
6897 if test "X$installed" = Xyes; then
6898 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6899 func_warning "library \`$lib' was moved."
6900 dir="$ladir"
6901 absdir="$abs_ladir"
6902 libdir="$abs_ladir"
6903 else
6904 dir="$lt_sysroot$libdir"
6905 absdir="$lt_sysroot$libdir"
6907 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6908 else
6909 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6910 dir="$ladir"
6911 absdir="$abs_ladir"
6912 # Remove this search path later
6913 notinst_path+=" $abs_ladir"
6914 else
6915 dir="$ladir/$objdir"
6916 absdir="$abs_ladir/$objdir"
6917 # Remove this search path later
6918 notinst_path+=" $abs_ladir"
6920 fi # $installed = yes
6921 func_stripname 'lib' '.la' "$laname"
6922 name=$func_stripname_result
6924 # This library was specified with -dlpreopen.
6925 if test "$pass" = dlpreopen; then
6926 if test -z "$libdir" && test "$linkmode" = prog; then
6927 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6929 case "$host" in
6930 # special handling for platforms with PE-DLLs.
6931 *cygwin* | *mingw* | *cegcc* )
6932 # Linker will automatically link against shared library if both
6933 # static and shared are present. Therefore, ensure we extract
6934 # symbols from the import library if a shared library is present
6935 # (otherwise, the dlopen module name will be incorrect). We do
6936 # this by putting the import library name into $newdlprefiles.
6937 # We recover the dlopen module name by 'saving' the la file
6938 # name in a special purpose variable, and (later) extracting the
6939 # dlname from the la file.
6940 if test -n "$dlname"; then
6941 func_tr_sh "$dir/$linklib"
6942 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6943 newdlprefiles+=" $dir/$linklib"
6944 else
6945 newdlprefiles+=" $dir/$old_library"
6946 # Keep a list of preopened convenience libraries to check
6947 # that they are being used correctly in the link pass.
6948 test -z "$libdir" && \
6949 dlpreconveniencelibs+=" $dir/$old_library"
6953 # Prefer using a static library (so that no silly _DYNAMIC symbols
6954 # are required to link).
6955 if test -n "$old_library"; then
6956 newdlprefiles+=" $dir/$old_library"
6957 # Keep a list of preopened convenience libraries to check
6958 # that they are being used correctly in the link pass.
6959 test -z "$libdir" && \
6960 dlpreconveniencelibs+=" $dir/$old_library"
6961 # Otherwise, use the dlname, so that lt_dlopen finds it.
6962 elif test -n "$dlname"; then
6963 newdlprefiles+=" $dir/$dlname"
6964 else
6965 newdlprefiles+=" $dir/$linklib"
6968 esac
6969 fi # $pass = dlpreopen
6971 if test -z "$libdir"; then
6972 # Link the convenience library
6973 if test "$linkmode" = lib; then
6974 deplibs="$dir/$old_library $deplibs"
6975 elif test "$linkmode,$pass" = "prog,link"; then
6976 compile_deplibs="$dir/$old_library $compile_deplibs"
6977 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6978 else
6979 deplibs="$lib $deplibs" # used for prog,scan pass
6981 continue
6985 if test "$linkmode" = prog && test "$pass" != link; then
6986 newlib_search_path+=" $ladir"
6987 deplibs="$lib $deplibs"
6989 linkalldeplibs=no
6990 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6991 test "$build_libtool_libs" = no; then
6992 linkalldeplibs=yes
6995 tmp_libs=
6996 for deplib in $dependency_libs; do
6997 case $deplib in
6998 -L*) func_stripname '-L' '' "$deplib"
6999 func_resolve_sysroot "$func_stripname_result"
7000 newlib_search_path+=" $func_resolve_sysroot_result"
7002 esac
7003 # Need to link against all dependency_libs?
7004 if test "$linkalldeplibs" = yes; then
7005 deplibs="$deplib $deplibs"
7006 else
7007 # Need to hardcode shared library paths
7008 # or/and link against static libraries
7009 newdependency_libs="$deplib $newdependency_libs"
7011 if $opt_preserve_dup_deps ; then
7012 case "$tmp_libs " in
7013 *" $deplib "*) specialdeplibs+=" $deplib" ;;
7014 esac
7016 tmp_libs+=" $deplib"
7017 done # for deplib
7018 continue
7019 fi # $linkmode = prog...
7021 if test "$linkmode,$pass" = "prog,link"; then
7022 if test -n "$library_names" &&
7023 { { test "$prefer_static_libs" = no ||
7024 test "$prefer_static_libs,$installed" = "built,yes"; } ||
7025 test -z "$old_library"; }; then
7026 # We need to hardcode the library path
7027 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
7028 # Make sure the rpath contains only unique directories.
7029 case "$temp_rpath:" in
7030 *"$absdir:"*) ;;
7031 *) temp_rpath+="$absdir:" ;;
7032 esac
7035 # Hardcode the library path.
7036 # Skip directories that are in the system default run-time
7037 # search path.
7038 case " $sys_lib_dlsearch_path " in
7039 *" $absdir "*) ;;
7041 case "$compile_rpath " in
7042 *" $absdir "*) ;;
7043 *) compile_rpath+=" $absdir" ;;
7044 esac
7046 esac
7047 case " $sys_lib_dlsearch_path " in
7048 *" $libdir "*) ;;
7050 case "$finalize_rpath " in
7051 *" $libdir "*) ;;
7052 *) finalize_rpath+=" $libdir" ;;
7053 esac
7055 esac
7056 fi # $linkmode,$pass = prog,link...
7058 if test "$alldeplibs" = yes &&
7059 { test "$deplibs_check_method" = pass_all ||
7060 { test "$build_libtool_libs" = yes &&
7061 test -n "$library_names"; }; }; then
7062 # We only need to search for static libraries
7063 continue
7067 link_static=no # Whether the deplib will be linked statically
7068 use_static_libs=$prefer_static_libs
7069 if test "$use_static_libs" = built && test "$installed" = yes; then
7070 use_static_libs=no
7072 if test -n "$library_names" &&
7073 { test "$use_static_libs" = no || test -z "$old_library"; }; then
7074 case $host in
7075 *cygwin* | *mingw* | *cegcc*)
7076 # No point in relinking DLLs because paths are not encoded
7077 notinst_deplibs+=" $lib"
7078 need_relink=no
7081 if test "$installed" = no; then
7082 notinst_deplibs+=" $lib"
7083 test -z "$DESTDIR" && need_relink=yes
7086 esac
7087 # This is a shared library
7089 # Warn about portability, can't link against -module's on some
7090 # systems (darwin). Don't bleat about dlopened modules though!
7091 dlopenmodule=""
7092 for dlpremoduletest in $dlprefiles; do
7093 if test "X$dlpremoduletest" = "X$lib"; then
7094 dlopenmodule="$dlpremoduletest"
7095 break
7097 done
7098 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
7099 echo
7100 if test "$linkmode" = prog; then
7101 $ECHO "*** Warning: Linking the executable $output against the loadable module"
7102 else
7103 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
7105 $ECHO "*** $linklib is not portable!"
7107 if test "$linkmode" = lib &&
7108 test "$hardcode_into_libs" = yes; then
7109 # Hardcode the library path.
7110 # Skip directories that are in the system default run-time
7111 # search path.
7112 case " $sys_lib_dlsearch_path " in
7113 *" $absdir "*) ;;
7115 case "$compile_rpath " in
7116 *" $absdir "*) ;;
7117 *) compile_rpath+=" $absdir" ;;
7118 esac
7120 esac
7121 case " $sys_lib_dlsearch_path " in
7122 *" $libdir "*) ;;
7124 case "$finalize_rpath " in
7125 *" $libdir "*) ;;
7126 *) finalize_rpath+=" $libdir" ;;
7127 esac
7129 esac
7132 if test -n "$old_archive_from_expsyms_cmds"; then
7133 # figure out the soname
7134 set dummy $library_names
7135 shift
7136 realname="$1"
7137 shift
7138 libname=`eval "\\$ECHO \"$libname_spec\""`
7139 # use dlname if we got it. it's perfectly good, no?
7140 if test -n "$dlname"; then
7141 soname="$dlname"
7142 elif test -n "$soname_spec"; then
7143 # bleh windows
7144 case $host in
7145 *cygwin* | mingw* | *cegcc*)
7146 func_arith $current - $age
7147 major=$func_arith_result
7148 versuffix="-$major"
7150 esac
7151 eval soname=\"$soname_spec\"
7152 else
7153 soname="$realname"
7156 # Make a new name for the extract_expsyms_cmds to use
7157 soroot="$soname"
7158 func_basename "$soroot"
7159 soname="$func_basename_result"
7160 func_stripname 'lib' '.dll' "$soname"
7161 newlib=libimp-$func_stripname_result.a
7163 # If the library has no export list, then create one now
7164 if test -f "$output_objdir/$soname-def"; then :
7165 else
7166 func_verbose "extracting exported symbol list from \`$soname'"
7167 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
7170 # Create $newlib
7171 if test -f "$output_objdir/$newlib"; then :; else
7172 func_verbose "generating import library for \`$soname'"
7173 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
7175 # make sure the library variables are pointing to the new library
7176 dir=$output_objdir
7177 linklib=$newlib
7178 fi # test -n "$old_archive_from_expsyms_cmds"
7180 if test "$linkmode" = prog || test "$opt_mode" != relink; then
7181 add_shlibpath=
7182 add_dir=
7183 add=
7184 lib_linked=yes
7185 case $hardcode_action in
7186 immediate | unsupported)
7187 if test "$hardcode_direct" = no; then
7188 add="$dir/$linklib"
7189 case $host in
7190 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
7191 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
7192 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
7193 *-*-unixware7*) add_dir="-L$dir" ;;
7194 *-*-darwin* )
7195 # if the lib is a (non-dlopened) module then we can not
7196 # link against it, someone is ignoring the earlier warnings
7197 if /usr/bin/file -L $add 2> /dev/null |
7198 $GREP ": [^:]* bundle" >/dev/null ; then
7199 if test "X$dlopenmodule" != "X$lib"; then
7200 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
7201 if test -z "$old_library" ; then
7202 echo
7203 echo "*** And there doesn't seem to be a static archive available"
7204 echo "*** The link will probably fail, sorry"
7205 else
7206 add="$dir/$old_library"
7208 elif test -n "$old_library"; then
7209 add="$dir/$old_library"
7212 esac
7213 elif test "$hardcode_minus_L" = no; then
7214 case $host in
7215 *-*-sunos*) add_shlibpath="$dir" ;;
7216 esac
7217 add_dir="-L$dir"
7218 add="-l$name"
7219 elif test "$hardcode_shlibpath_var" = no; then
7220 add_shlibpath="$dir"
7221 add="-l$name"
7222 else
7223 lib_linked=no
7226 relink)
7227 if test "$hardcode_direct" = yes &&
7228 test "$hardcode_direct_absolute" = no; then
7229 add="$dir/$linklib"
7230 elif test "$hardcode_minus_L" = yes; then
7231 add_dir="-L$absdir"
7232 # Try looking first in the location we're being installed to.
7233 if test -n "$inst_prefix_dir"; then
7234 case $libdir in
7235 [\\/]*)
7236 add_dir+=" -L$inst_prefix_dir$libdir"
7238 esac
7240 add="-l$name"
7241 elif test "$hardcode_shlibpath_var" = yes; then
7242 add_shlibpath="$dir"
7243 add="-l$name"
7244 else
7245 lib_linked=no
7248 *) lib_linked=no ;;
7249 esac
7251 if test "$lib_linked" != yes; then
7252 func_fatal_configuration "unsupported hardcode properties"
7255 if test -n "$add_shlibpath"; then
7256 case :$compile_shlibpath: in
7257 *":$add_shlibpath:"*) ;;
7258 *) compile_shlibpath+="$add_shlibpath:" ;;
7259 esac
7261 if test "$linkmode" = prog; then
7262 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
7263 test -n "$add" && compile_deplibs="$add $compile_deplibs"
7264 else
7265 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7266 test -n "$add" && deplibs="$add $deplibs"
7267 if test "$hardcode_direct" != yes &&
7268 test "$hardcode_minus_L" != yes &&
7269 test "$hardcode_shlibpath_var" = yes; then
7270 case :$finalize_shlibpath: in
7271 *":$libdir:"*) ;;
7272 *) finalize_shlibpath+="$libdir:" ;;
7273 esac
7278 if test "$linkmode" = prog || test "$opt_mode" = relink; then
7279 add_shlibpath=
7280 add_dir=
7281 add=
7282 # Finalize command for both is simple: just hardcode it.
7283 if test "$hardcode_direct" = yes &&
7284 test "$hardcode_direct_absolute" = no; then
7285 add="$libdir/$linklib"
7286 elif test "$hardcode_minus_L" = yes; then
7287 add_dir="-L$libdir"
7288 add="-l$name"
7289 elif test "$hardcode_shlibpath_var" = yes; then
7290 case :$finalize_shlibpath: in
7291 *":$libdir:"*) ;;
7292 *) finalize_shlibpath+="$libdir:" ;;
7293 esac
7294 add="-l$name"
7295 elif test "$hardcode_automatic" = yes; then
7296 if test -n "$inst_prefix_dir" &&
7297 test -f "$inst_prefix_dir$libdir/$linklib" ; then
7298 add="$inst_prefix_dir$libdir/$linklib"
7299 else
7300 add="$libdir/$linklib"
7302 else
7303 # We cannot seem to hardcode it, guess we'll fake it.
7304 add_dir="-L$libdir"
7305 # Try looking first in the location we're being installed to.
7306 if test -n "$inst_prefix_dir"; then
7307 case $libdir in
7308 [\\/]*)
7309 add_dir+=" -L$inst_prefix_dir$libdir"
7311 esac
7313 add="-l$name"
7316 if test "$linkmode" = prog; then
7317 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
7318 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
7319 else
7320 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7321 test -n "$add" && deplibs="$add $deplibs"
7324 elif test "$linkmode" = prog; then
7325 # Here we assume that one of hardcode_direct or hardcode_minus_L
7326 # is not unsupported. This is valid on all known static and
7327 # shared platforms.
7328 if test "$hardcode_direct" != unsupported; then
7329 test -n "$old_library" && linklib="$old_library"
7330 compile_deplibs="$dir/$linklib $compile_deplibs"
7331 finalize_deplibs="$dir/$linklib $finalize_deplibs"
7332 else
7333 compile_deplibs="-l$name -L$dir $compile_deplibs"
7334 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
7336 elif test "$build_libtool_libs" = yes; then
7337 # Not a shared library
7338 if test "$deplibs_check_method" != pass_all; then
7339 # We're trying link a shared library against a static one
7340 # but the system doesn't support it.
7342 # Just print a warning and add the library to dependency_libs so
7343 # that the program can be linked against the static library.
7344 echo
7345 $ECHO "*** Warning: This system can not link to static lib archive $lib."
7346 echo "*** I have the capability to make that library automatically link in when"
7347 echo "*** you link to this library. But I can only do this if you have a"
7348 echo "*** shared version of the library, which you do not appear to have."
7349 if test "$module" = yes; then
7350 echo "*** But as you try to build a module library, libtool will still create "
7351 echo "*** a static module, that should work as long as the dlopening application"
7352 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
7353 if test -z "$global_symbol_pipe"; then
7354 echo
7355 echo "*** However, this would only work if libtool was able to extract symbol"
7356 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7357 echo "*** not find such a program. So, this module is probably useless."
7358 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7360 if test "$build_old_libs" = no; then
7361 build_libtool_libs=module
7362 build_old_libs=yes
7363 else
7364 build_libtool_libs=no
7367 else
7368 deplibs="$dir/$old_library $deplibs"
7369 link_static=yes
7371 fi # link shared/static library?
7373 if test "$linkmode" = lib; then
7374 if test -n "$dependency_libs" &&
7375 { test "$hardcode_into_libs" != yes ||
7376 test "$build_old_libs" = yes ||
7377 test "$link_static" = yes; }; then
7378 # Extract -R from dependency_libs
7379 temp_deplibs=
7380 for libdir in $dependency_libs; do
7381 case $libdir in
7382 -R*) func_stripname '-R' '' "$libdir"
7383 temp_xrpath=$func_stripname_result
7384 case " $xrpath " in
7385 *" $temp_xrpath "*) ;;
7386 *) xrpath+=" $temp_xrpath";;
7387 esac;;
7388 *) temp_deplibs+=" $libdir";;
7389 esac
7390 done
7391 dependency_libs="$temp_deplibs"
7394 newlib_search_path+=" $absdir"
7395 # Link against this library
7396 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7397 # ... and its dependency_libs
7398 tmp_libs=
7399 for deplib in $dependency_libs; do
7400 newdependency_libs="$deplib $newdependency_libs"
7401 case $deplib in
7402 -L*) func_stripname '-L' '' "$deplib"
7403 func_resolve_sysroot "$func_stripname_result";;
7404 *) func_resolve_sysroot "$deplib" ;;
7405 esac
7406 if $opt_preserve_dup_deps ; then
7407 case "$tmp_libs " in
7408 *" $func_resolve_sysroot_result "*)
7409 specialdeplibs+=" $func_resolve_sysroot_result" ;;
7410 esac
7412 tmp_libs+=" $func_resolve_sysroot_result"
7413 done
7415 if test "$link_all_deplibs" != no; then
7416 # Add the search paths of all dependency libraries
7417 for deplib in $dependency_libs; do
7418 path=
7419 case $deplib in
7420 -L*) path="$deplib" ;;
7421 *.la)
7422 func_resolve_sysroot "$deplib"
7423 deplib=$func_resolve_sysroot_result
7424 func_dirname "$deplib" "" "."
7425 dir=$func_dirname_result
7426 # We need an absolute path.
7427 case $dir in
7428 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7430 absdir=`cd "$dir" && pwd`
7431 if test -z "$absdir"; then
7432 func_warning "cannot determine absolute directory name of \`$dir'"
7433 absdir="$dir"
7436 esac
7437 if $GREP "^installed=no" $deplib > /dev/null; then
7438 case $host in
7439 *-*-darwin*)
7440 depdepl=
7441 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7442 if test -n "$deplibrary_names" ; then
7443 for tmp in $deplibrary_names ; do
7444 depdepl=$tmp
7445 done
7446 if test -f "$absdir/$objdir/$depdepl" ; then
7447 depdepl="$absdir/$objdir/$depdepl"
7448 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7449 if test -z "$darwin_install_name"; then
7450 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7452 compiler_flags+=" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7453 linker_flags+=" -dylib_file ${darwin_install_name}:${depdepl}"
7454 path=
7459 path="-L$absdir/$objdir"
7461 esac
7462 else
7463 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7464 test -z "$libdir" && \
7465 func_fatal_error "\`$deplib' is not a valid libtool archive"
7466 test "$absdir" != "$libdir" && \
7467 func_warning "\`$deplib' seems to be moved"
7469 path="-L$absdir"
7472 esac
7473 case " $deplibs " in
7474 *" $path "*) ;;
7475 *) deplibs="$path $deplibs" ;;
7476 esac
7477 done
7478 fi # link_all_deplibs != no
7479 fi # linkmode = lib
7480 done # for deplib in $libs
7481 if test "$pass" = link; then
7482 if test "$linkmode" = "prog"; then
7483 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7484 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7485 else
7486 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7489 dependency_libs="$newdependency_libs"
7490 if test "$pass" = dlpreopen; then
7491 # Link the dlpreopened libraries before other libraries
7492 for deplib in $save_deplibs; do
7493 deplibs="$deplib $deplibs"
7494 done
7496 if test "$pass" != dlopen; then
7497 if test "$pass" != conv; then
7498 # Make sure lib_search_path contains only unique directories.
7499 lib_search_path=
7500 for dir in $newlib_search_path; do
7501 case "$lib_search_path " in
7502 *" $dir "*) ;;
7503 *) lib_search_path+=" $dir" ;;
7504 esac
7505 done
7506 newlib_search_path=
7509 if test "$linkmode,$pass" != "prog,link"; then
7510 vars="deplibs"
7511 else
7512 vars="compile_deplibs finalize_deplibs"
7514 for var in $vars dependency_libs; do
7515 # Add libraries to $var in reverse order
7516 eval tmp_libs=\"\$$var\"
7517 new_libs=
7518 for deplib in $tmp_libs; do
7519 # FIXME: Pedantically, this is the right thing to do, so
7520 # that some nasty dependency loop isn't accidentally
7521 # broken:
7522 #new_libs="$deplib $new_libs"
7523 # Pragmatically, this seems to cause very few problems in
7524 # practice:
7525 case $deplib in
7526 -L*) new_libs="$deplib $new_libs" ;;
7527 -R*) ;;
7529 # And here is the reason: when a library appears more
7530 # than once as an explicit dependence of a library, or
7531 # is implicitly linked in more than once by the
7532 # compiler, it is considered special, and multiple
7533 # occurrences thereof are not removed. Compare this
7534 # with having the same library being listed as a
7535 # dependency of multiple other libraries: in this case,
7536 # we know (pedantically, we assume) the library does not
7537 # need to be listed more than once, so we keep only the
7538 # last copy. This is not always right, but it is rare
7539 # enough that we require users that really mean to play
7540 # such unportable linking tricks to link the library
7541 # using -Wl,-lname, so that libtool does not consider it
7542 # for duplicate removal.
7543 case " $specialdeplibs " in
7544 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7546 case " $new_libs " in
7547 *" $deplib "*) ;;
7548 *) new_libs="$deplib $new_libs" ;;
7549 esac
7551 esac
7553 esac
7554 done
7555 tmp_libs=
7556 for deplib in $new_libs; do
7557 case $deplib in
7558 -L*)
7559 case " $tmp_libs " in
7560 *" $deplib "*) ;;
7561 *) tmp_libs+=" $deplib" ;;
7562 esac
7564 *) tmp_libs+=" $deplib" ;;
7565 esac
7566 done
7567 eval $var=\"$tmp_libs\"
7568 done # for var
7570 # Last step: remove runtime libs from dependency_libs
7571 # (they stay in deplibs)
7572 tmp_libs=
7573 for i in $dependency_libs ; do
7574 case " $predeps $postdeps $compiler_lib_search_path " in
7575 *" $i "*)
7576 i=""
7578 esac
7579 if test -n "$i" ; then
7580 tmp_libs+=" $i"
7582 done
7583 dependency_libs=$tmp_libs
7584 done # for pass
7585 if test "$linkmode" = prog; then
7586 dlfiles="$newdlfiles"
7588 if test "$linkmode" = prog || test "$linkmode" = lib; then
7589 dlprefiles="$newdlprefiles"
7592 case $linkmode in
7593 oldlib)
7594 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7595 func_warning "\`-dlopen' is ignored for archives"
7598 case " $deplibs" in
7599 *\ -l* | *\ -L*)
7600 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7601 esac
7603 test -n "$rpath" && \
7604 func_warning "\`-rpath' is ignored for archives"
7606 test -n "$xrpath" && \
7607 func_warning "\`-R' is ignored for archives"
7609 test -n "$vinfo" && \
7610 func_warning "\`-version-info/-version-number' is ignored for archives"
7612 test -n "$release" && \
7613 func_warning "\`-release' is ignored for archives"
7615 test -n "$export_symbols$export_symbols_regex" && \
7616 func_warning "\`-export-symbols' is ignored for archives"
7618 # Now set the variables for building old libraries.
7619 build_libtool_libs=no
7620 oldlibs="$output"
7621 objs+="$old_deplibs"
7624 lib)
7625 # Make sure we only generate libraries of the form `libNAME.la'.
7626 case $outputname in
7627 lib*)
7628 func_stripname 'lib' '.la' "$outputname"
7629 name=$func_stripname_result
7630 eval shared_ext=\"$shrext_cmds\"
7631 eval libname=\"$libname_spec\"
7634 test "$module" = no && \
7635 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7637 if test "$need_lib_prefix" != no; then
7638 # Add the "lib" prefix for modules if required
7639 func_stripname '' '.la' "$outputname"
7640 name=$func_stripname_result
7641 eval shared_ext=\"$shrext_cmds\"
7642 eval libname=\"$libname_spec\"
7643 else
7644 func_stripname '' '.la' "$outputname"
7645 libname=$func_stripname_result
7648 esac
7650 if test -n "$objs"; then
7651 if test "$deplibs_check_method" != pass_all; then
7652 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7653 else
7654 echo
7655 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7656 $ECHO "*** objects $objs is not portable!"
7657 libobjs+=" $objs"
7661 test "$dlself" != no && \
7662 func_warning "\`-dlopen self' is ignored for libtool libraries"
7664 set dummy $rpath
7665 shift
7666 test "$#" -gt 1 && \
7667 func_warning "ignoring multiple \`-rpath's for a libtool library"
7669 install_libdir="$1"
7671 oldlibs=
7672 if test -z "$rpath"; then
7673 if test "$build_libtool_libs" = yes; then
7674 # Building a libtool convenience library.
7675 # Some compilers have problems with a `.al' extension so
7676 # convenience libraries should have the same extension an
7677 # archive normally would.
7678 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7679 build_libtool_libs=convenience
7680 build_old_libs=yes
7683 test -n "$vinfo" && \
7684 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7686 test -n "$release" && \
7687 func_warning "\`-release' is ignored for convenience libraries"
7688 else
7690 # Parse the version information argument.
7691 save_ifs="$IFS"; IFS=':'
7692 set dummy $vinfo 0 0 0
7693 shift
7694 IFS="$save_ifs"
7696 test -n "$7" && \
7697 func_fatal_help "too many parameters to \`-version-info'"
7699 # convert absolute version numbers to libtool ages
7700 # this retains compatibility with .la files and attempts
7701 # to make the code below a bit more comprehensible
7703 case $vinfo_number in
7704 yes)
7705 number_major="$1"
7706 number_minor="$2"
7707 number_revision="$3"
7709 # There are really only two kinds -- those that
7710 # use the current revision as the major version
7711 # and those that subtract age and use age as
7712 # a minor version. But, then there is irix
7713 # which has an extra 1 added just for fun
7715 case $version_type in
7716 # correct linux to gnu/linux during the next big refactor
7717 darwin|linux|osf|windows|none)
7718 func_arith $number_major + $number_minor
7719 current=$func_arith_result
7720 age="$number_minor"
7721 revision="$number_revision"
7723 freebsd-aout|freebsd-elf|qnx|sunos)
7724 current="$number_major"
7725 revision="$number_minor"
7726 age="0"
7728 irix|nonstopux)
7729 func_arith $number_major + $number_minor
7730 current=$func_arith_result
7731 age="$number_minor"
7732 revision="$number_minor"
7733 lt_irix_increment=no
7735 esac
7738 current="$1"
7739 revision="$2"
7740 age="$3"
7742 esac
7744 # Check that each of the things are valid numbers.
7745 case $current in
7746 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]) ;;
7748 func_error "CURRENT \`$current' must be a nonnegative integer"
7749 func_fatal_error "\`$vinfo' is not valid version information"
7751 esac
7753 case $revision in
7754 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]) ;;
7756 func_error "REVISION \`$revision' must be a nonnegative integer"
7757 func_fatal_error "\`$vinfo' is not valid version information"
7759 esac
7761 case $age in
7762 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]) ;;
7764 func_error "AGE \`$age' must be a nonnegative integer"
7765 func_fatal_error "\`$vinfo' is not valid version information"
7767 esac
7769 if test "$age" -gt "$current"; then
7770 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7771 func_fatal_error "\`$vinfo' is not valid version information"
7774 # Calculate the version variables.
7775 major=
7776 versuffix=
7777 verstring=
7778 case $version_type in
7779 none) ;;
7781 darwin)
7782 # Like Linux, but with the current version available in
7783 # verstring for coding it into the library header
7784 func_arith $current - $age
7785 major=.$func_arith_result
7786 versuffix="$major.$age.$revision"
7787 # Darwin ld doesn't like 0 for these options...
7788 func_arith $current + 1
7789 minor_current=$func_arith_result
7790 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7791 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7794 freebsd-aout)
7795 major=".$current"
7796 versuffix=".$current.$revision";
7799 freebsd-elf)
7800 major=".$current"
7801 versuffix=".$current"
7804 irix | nonstopux)
7805 if test "X$lt_irix_increment" = "Xno"; then
7806 func_arith $current - $age
7807 else
7808 func_arith $current - $age + 1
7810 major=$func_arith_result
7812 case $version_type in
7813 nonstopux) verstring_prefix=nonstopux ;;
7814 *) verstring_prefix=sgi ;;
7815 esac
7816 verstring="$verstring_prefix$major.$revision"
7818 # Add in all the interfaces that we are compatible with.
7819 loop=$revision
7820 while test "$loop" -ne 0; do
7821 func_arith $revision - $loop
7822 iface=$func_arith_result
7823 func_arith $loop - 1
7824 loop=$func_arith_result
7825 verstring="$verstring_prefix$major.$iface:$verstring"
7826 done
7828 # Before this point, $major must not contain `.'.
7829 major=.$major
7830 versuffix="$major.$revision"
7833 linux) # correct to gnu/linux during the next big refactor
7834 func_arith $current - $age
7835 major=.$func_arith_result
7836 versuffix="$major.$age.$revision"
7839 osf)
7840 func_arith $current - $age
7841 major=.$func_arith_result
7842 versuffix=".$current.$age.$revision"
7843 verstring="$current.$age.$revision"
7845 # Add in all the interfaces that we are compatible with.
7846 loop=$age
7847 while test "$loop" -ne 0; do
7848 func_arith $current - $loop
7849 iface=$func_arith_result
7850 func_arith $loop - 1
7851 loop=$func_arith_result
7852 verstring="$verstring:${iface}.0"
7853 done
7855 # Make executables depend on our current version.
7856 verstring+=":${current}.0"
7859 qnx)
7860 major=".$current"
7861 versuffix=".$current"
7864 sunos)
7865 major=".$current"
7866 versuffix=".$current.$revision"
7869 windows)
7870 # Use '-' rather than '.', since we only want one
7871 # extension on DOS 8.3 filesystems.
7872 func_arith $current - $age
7873 major=$func_arith_result
7874 versuffix="-$major"
7878 func_fatal_configuration "unknown library version type \`$version_type'"
7880 esac
7882 # Clear the version info if we defaulted, and they specified a release.
7883 if test -z "$vinfo" && test -n "$release"; then
7884 major=
7885 case $version_type in
7886 darwin)
7887 # we can't check for "0.0" in archive_cmds due to quoting
7888 # problems, so we reset it completely
7889 verstring=
7892 verstring="0.0"
7894 esac
7895 if test "$need_version" = no; then
7896 versuffix=
7897 else
7898 versuffix=".0.0"
7902 # Remove version info from name if versioning should be avoided
7903 if test "$avoid_version" = yes && test "$need_version" = no; then
7904 major=
7905 versuffix=
7906 verstring=""
7907 else
7908 # XXX
7909 tmp=`echo $libname|sed -e 's,+,_,g' -e 's,-,_,g' -e 's,\.,_,g'`
7910 eval tmp2=\$${tmp}_ltversion
7911 if ! test -z "${SHARED_LIBS_LOG}"; then
7912 if ! test -f ${SHARED_LIBS_LOG}; then
7913 echo "# SHARED_LIBS+= <libname> <obsd version> # <orig version>" >${SHARED_LIBS_LOG}
7915 tmp4=`echo $libname|sed -e 's/^lib//'`
7916 printf "SHARED_LIBS +=\t%-20s %-8s # %s\n" "$tmp4" "$tmp2" "$versuffix" >>${SHARED_LIBS_LOG}
7918 if test -n "$versuffix" && test -n "$tmp2"; then
7919 versuffix=".$tmp2"
7923 # Check to see if the archive will have undefined symbols.
7924 if test "$allow_undefined" = yes; then
7925 if test "$allow_undefined_flag" = unsupported; then
7926 func_warning "undefined symbols not allowed in $host shared libraries"
7927 build_libtool_libs=no
7928 build_old_libs=yes
7930 else
7931 # Don't allow undefined symbols.
7932 allow_undefined_flag="$no_undefined_flag"
7937 func_generate_dlsyms "$libname" "$libname" "yes"
7938 libobjs+=" $symfileobj"
7939 test "X$libobjs" = "X " && libobjs=
7941 if test "$opt_mode" != relink; then
7942 # Remove our outputs, but don't remove object files since they
7943 # may have been created when compiling PIC objects.
7944 removelist=
7945 tempremovelist=`$ECHO "$output_objdir/*"`
7946 for p in $tempremovelist; do
7947 case $p in
7948 *.$objext | *.gcno)
7950 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7951 if test "X$precious_files_regex" != "X"; then
7952 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7953 then
7954 continue
7957 removelist+=" $p"
7959 *) ;;
7960 esac
7961 done
7962 test -n "$removelist" && \
7963 func_show_eval "${RM}r \$removelist"
7966 # Now set the variables for building old libraries.
7967 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7968 oldlibs+=" $output_objdir/$libname.$libext"
7970 # Transform .lo files to .o files.
7971 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7974 # Eliminate all temporary directories.
7975 #for path in $notinst_path; do
7976 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7977 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7978 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7979 #done
7981 if test -n "$xrpath"; then
7982 # If the user specified any rpath flags, then add them.
7983 temp_xrpath=
7984 for libdir in $xrpath; do
7985 func_replace_sysroot "$libdir"
7986 temp_xrpath+=" -R$func_replace_sysroot_result"
7987 case "$finalize_rpath " in
7988 *" $libdir "*) ;;
7989 *) finalize_rpath+=" $libdir" ;;
7990 esac
7991 done
7992 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7993 dependency_libs="$temp_xrpath $dependency_libs"
7997 # Make sure dlfiles contains only unique files that won't be dlpreopened
7998 old_dlfiles="$dlfiles"
7999 dlfiles=
8000 for lib in $old_dlfiles; do
8001 case " $dlprefiles $dlfiles " in
8002 *" $lib "*) ;;
8003 *) dlfiles+=" $lib" ;;
8004 esac
8005 done
8007 # Make sure dlprefiles contains only unique files
8008 old_dlprefiles="$dlprefiles"
8009 dlprefiles=
8010 for lib in $old_dlprefiles; do
8011 case "$dlprefiles " in
8012 *" $lib "*) ;;
8013 *) dlprefiles+=" $lib" ;;
8014 esac
8015 done
8017 if test "$build_libtool_libs" = yes; then
8018 if test -n "$rpath"; then
8019 case $host in
8020 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
8021 # these systems don't actually have a c library (as such)!
8023 *-*-rhapsody* | *-*-darwin1.[012])
8024 # Rhapsody C library is in the System framework
8025 deplibs+=" System.ltframework"
8027 *-*-netbsd*)
8028 # Don't link with libc until the a.out ld.so is fixed.
8030 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
8031 # Do not include libc due to us having libc/libc_r.
8033 *-*-sco3.2v5* | *-*-sco5v6*)
8034 # Causes problems with __ctype
8036 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
8037 # Compiler inserts libc in the correct place for threads to work
8040 # Add libc to deplibs on all other systems if necessary.
8041 if test "$build_libtool_need_lc" = "yes"; then
8042 deplibs+=" -lc"
8045 esac
8048 # Transform deplibs into only deplibs that can be linked in shared.
8049 name_save=$name
8050 libname_save=$libname
8051 release_save=$release
8052 versuffix_save=$versuffix
8053 major_save=$major
8054 # I'm not sure if I'm treating the release correctly. I think
8055 # release should show up in the -l (ie -lgmp5) so we don't want to
8056 # add it in twice. Is that correct?
8057 release=""
8058 versuffix=""
8059 major=""
8060 newdeplibs=
8061 droppeddeps=no
8062 case $deplibs_check_method in
8063 pass_all)
8064 # Don't check for shared/static. Everything works.
8065 # This might be a little naive. We might want to check
8066 # whether the library exists or not. But this is on
8067 # osf3 & osf4 and I'm not really sure... Just
8068 # implementing what was already the behavior.
8069 newdeplibs=$deplibs
8071 test_compile)
8072 # This code stresses the "libraries are programs" paradigm to its
8073 # limits. Maybe even breaks it. We compile a program, linking it
8074 # against the deplibs as a proxy for the library. Then we can check
8075 # whether they linked in statically or dynamically with ldd.
8076 $opt_dry_run || $RM conftest.c
8077 cat > conftest.c <<EOF
8078 int main() { return 0; }
8080 $opt_dry_run || $RM conftest
8081 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
8082 ldd_output=`ldd conftest`
8083 for i in $deplibs; do
8084 case $i in
8085 -l*)
8086 func_stripname -l '' "$i"
8087 name=$func_stripname_result
8088 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8089 case " $predeps $postdeps " in
8090 *" $i "*)
8091 newdeplibs+=" $i"
8092 i=""
8094 esac
8096 if test -n "$i" ; then
8097 libname=`eval "\\$ECHO \"$libname_spec\""`
8098 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8099 set dummy $deplib_matches; shift
8100 deplib_match=$1
8101 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
8102 newdeplibs+=" $i"
8103 else
8104 droppeddeps=yes
8105 echo
8106 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8107 echo "*** I have the capability to make that library automatically link in when"
8108 echo "*** you link to this library. But I can only do this if you have a"
8109 echo "*** shared version of the library, which I believe you do not have"
8110 echo "*** because a test_compile did reveal that the linker did not use it for"
8111 echo "*** its dynamic dependency list that programs get resolved with at runtime."
8116 newdeplibs+=" $i"
8118 esac
8119 done
8120 else
8121 # Error occurred in the first compile. Let's try to salvage
8122 # the situation: Compile a separate program for each library.
8123 for i in $deplibs; do
8124 case $i in
8125 -l*)
8126 func_stripname -l '' "$i"
8127 name=$func_stripname_result
8128 $opt_dry_run || $RM conftest
8129 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
8130 ldd_output=`ldd conftest`
8131 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8132 case " $predeps $postdeps " in
8133 *" $i "*)
8134 newdeplibs+=" $i"
8135 i=""
8137 esac
8139 if test -n "$i" ; then
8140 libname=`eval "\\$ECHO \"$libname_spec\""`
8141 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8142 set dummy $deplib_matches; shift
8143 deplib_match=$1
8144 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
8145 newdeplibs+=" $i"
8146 else
8147 droppeddeps=yes
8148 echo
8149 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8150 echo "*** I have the capability to make that library automatically link in when"
8151 echo "*** you link to this library. But I can only do this if you have a"
8152 echo "*** shared version of the library, which you do not appear to have"
8153 echo "*** because a test_compile did reveal that the linker did not use this one"
8154 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
8157 else
8158 droppeddeps=yes
8159 echo
8160 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
8161 echo "*** make it link in! You will probably need to install it or some"
8162 echo "*** library that it depends on before this library will be fully"
8163 echo "*** functional. Installing it before continuing would be even better."
8167 newdeplibs+=" $i"
8169 esac
8170 done
8173 file_magic*)
8174 set dummy $deplibs_check_method; shift
8175 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8176 for a_deplib in $deplibs; do
8177 case $a_deplib in
8178 -l*)
8179 func_stripname -l '' "$a_deplib"
8180 name=$func_stripname_result
8181 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8182 case " $predeps $postdeps " in
8183 *" $a_deplib "*)
8184 newdeplibs+=" $a_deplib"
8185 a_deplib=""
8187 esac
8189 if test -n "$a_deplib" ; then
8190 libname=`eval "\\$ECHO \"$libname_spec\""`
8191 if test -n "$file_magic_glob"; then
8192 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
8193 else
8194 libnameglob=$libname
8196 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
8197 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8198 if test "$want_nocaseglob" = yes; then
8199 shopt -s nocaseglob
8200 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8201 $nocaseglob
8202 else
8203 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8205 for potent_lib in $potential_libs; do
8206 # Follow soft links.
8207 if ls -lLd "$potent_lib" 2>/dev/null |
8208 $GREP " -> " >/dev/null; then
8209 continue
8211 # The statement above tries to avoid entering an
8212 # endless loop below, in case of cyclic links.
8213 # We might still enter an endless loop, since a link
8214 # loop can be closed while we follow links,
8215 # but so what?
8216 potlib="$potent_lib"
8217 while test -h "$potlib" 2>/dev/null; do
8218 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
8219 case $potliblink in
8220 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
8221 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
8222 esac
8223 done
8224 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
8225 $SED -e 10q |
8226 $EGREP "$file_magic_regex" > /dev/null; then
8227 newdeplibs+=" $a_deplib"
8228 a_deplib=""
8229 break 2
8231 done
8232 done
8234 if test -n "$a_deplib" ; then
8235 droppeddeps=yes
8236 echo
8237 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8238 echo "*** I have the capability to make that library automatically link in when"
8239 echo "*** you link to this library. But I can only do this if you have a"
8240 echo "*** shared version of the library, which you do not appear to have"
8241 echo "*** because I did check the linker path looking for a file starting"
8242 if test -z "$potlib" ; then
8243 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
8244 else
8245 $ECHO "*** with $libname and none of the candidates passed a file format test"
8246 $ECHO "*** using a file magic. Last file checked: $potlib"
8251 # Add a -L argument.
8252 newdeplibs+=" $a_deplib"
8254 esac
8255 done # Gone through all deplibs.
8257 match_pattern*)
8258 set dummy $deplibs_check_method; shift
8259 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8260 for a_deplib in $deplibs; do
8261 case $a_deplib in
8262 -l*)
8263 func_stripname -l '' "$a_deplib"
8264 name=$func_stripname_result
8265 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8266 case " $predeps $postdeps " in
8267 *" $a_deplib "*)
8268 newdeplibs+=" $a_deplib"
8269 a_deplib=""
8271 esac
8273 if test -n "$a_deplib" ; then
8274 libname=`eval "\\$ECHO \"$libname_spec\""`
8275 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8276 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
8277 for potent_lib in $potential_libs; do
8278 potlib="$potent_lib" # see symlink-check above in file_magic test
8279 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
8280 $EGREP "$match_pattern_regex" > /dev/null; then
8281 newdeplibs+=" $a_deplib"
8282 a_deplib=""
8283 break 2
8285 done
8286 done
8288 if test -n "$a_deplib" ; then
8289 droppeddeps=yes
8290 echo
8291 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8292 echo "*** I have the capability to make that library automatically link in when"
8293 echo "*** you link to this library. But I can only do this if you have a"
8294 echo "*** shared version of the library, which you do not appear to have"
8295 echo "*** because I did check the linker path looking for a file starting"
8296 if test -z "$potlib" ; then
8297 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
8298 else
8299 $ECHO "*** with $libname and none of the candidates passed a file format test"
8300 $ECHO "*** using a regex pattern. Last file checked: $potlib"
8305 # Add a -L argument.
8306 newdeplibs+=" $a_deplib"
8308 esac
8309 done # Gone through all deplibs.
8311 none | unknown | *)
8312 newdeplibs=""
8313 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
8314 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8315 for i in $predeps $postdeps ; do
8316 # can't use Xsed below, because $i might contain '/'
8317 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
8318 done
8320 case $tmp_deplibs in
8321 *[!\ \ ]*)
8322 echo
8323 if test "X$deplibs_check_method" = "Xnone"; then
8324 echo "*** Warning: inter-library dependencies are not supported in this platform."
8325 else
8326 echo "*** Warning: inter-library dependencies are not known to be supported."
8328 echo "*** All declared inter-library dependencies are being dropped."
8329 droppeddeps=yes
8331 esac
8333 esac
8334 versuffix=$versuffix_save
8335 major=$major_save
8336 release=$release_save
8337 libname=$libname_save
8338 name=$name_save
8340 case $host in
8341 *-*-rhapsody* | *-*-darwin1.[012])
8342 # On Rhapsody replace the C library with the System framework
8343 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
8345 esac
8347 if test "$droppeddeps" = yes; then
8348 if test "$module" = yes; then
8349 echo
8350 echo "*** Warning: libtool could not satisfy all declared inter-library"
8351 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
8352 echo "*** a static module, that should work as long as the dlopening"
8353 echo "*** application is linked with the -dlopen flag."
8354 if test -z "$global_symbol_pipe"; then
8355 echo
8356 echo "*** However, this would only work if libtool was able to extract symbol"
8357 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
8358 echo "*** not find such a program. So, this module is probably useless."
8359 echo "*** \`nm' from GNU binutils and a full rebuild may help."
8361 if test "$build_old_libs" = no; then
8362 oldlibs="$output_objdir/$libname.$libext"
8363 build_libtool_libs=module
8364 build_old_libs=yes
8365 else
8366 build_libtool_libs=no
8368 else
8369 echo "*** The inter-library dependencies that have been dropped here will be"
8370 echo "*** automatically added whenever a program is linked with this library"
8371 echo "*** or is declared to -dlopen it."
8373 if test "$allow_undefined" = no; then
8374 echo
8375 echo "*** Since this library must not contain undefined symbols,"
8376 echo "*** because either the platform does not support them or"
8377 echo "*** it was explicitly requested with -no-undefined,"
8378 echo "*** libtool will only create a static version of it."
8379 if test "$build_old_libs" = no; then
8380 oldlibs="$output_objdir/$libname.$libext"
8381 build_libtool_libs=module
8382 build_old_libs=yes
8383 else
8384 build_libtool_libs=no
8389 # Done checking deplibs!
8390 deplibs=$newdeplibs
8392 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8393 case $host in
8394 *-*-darwin*)
8395 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8396 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8397 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8399 esac
8401 # move library search paths that coincide with paths to not yet
8402 # installed libraries to the beginning of the library search list
8403 new_libs=
8404 for path in $notinst_path; do
8405 case " $new_libs " in
8406 *" -L$path/$objdir "*) ;;
8408 case " $deplibs " in
8409 *" -L$path/$objdir "*)
8410 new_libs+=" -L$path/$objdir" ;;
8411 esac
8413 esac
8414 done
8415 for deplib in $deplibs; do
8416 case $deplib in
8417 -L*)
8418 case " $new_libs " in
8419 *" $deplib "*) ;;
8420 *) new_libs+=" $deplib" ;;
8421 esac
8423 *) new_libs+=" $deplib" ;;
8424 esac
8425 done
8426 deplibs="$new_libs"
8428 # All the library-specific variables (install_libdir is set above).
8429 library_names=
8430 old_library=
8431 dlname=
8433 # Test again, we may have decided not to build it any more
8434 if test "$build_libtool_libs" = yes; then
8435 # Remove ${wl} instances when linking with ld.
8436 # FIXME: should test the right _cmds variable.
8437 case $archive_cmds in
8438 *\$LD\ *) wl= ;;
8439 esac
8440 if test "$hardcode_into_libs" = yes; then
8441 # Hardcode the library paths
8442 hardcode_libdirs=
8443 dep_rpath=
8444 rpath="$finalize_rpath"
8445 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8446 for libdir in $rpath; do
8447 if test -n "$hardcode_libdir_flag_spec"; then
8448 if test -n "$hardcode_libdir_separator"; then
8449 func_replace_sysroot "$libdir"
8450 libdir=$func_replace_sysroot_result
8451 if test -z "$hardcode_libdirs"; then
8452 hardcode_libdirs="$libdir"
8453 else
8454 # Just accumulate the unique libdirs.
8455 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8456 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8459 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
8461 esac
8463 else
8464 eval flag=\"$hardcode_libdir_flag_spec\"
8465 dep_rpath+=" $flag"
8467 elif test -n "$runpath_var"; then
8468 case "$perm_rpath " in
8469 *" $libdir "*) ;;
8470 *) perm_rpath+=" $libdir" ;;
8471 esac
8473 done
8474 # Substitute the hardcoded libdirs into the rpath.
8475 if test -n "$hardcode_libdir_separator" &&
8476 test -n "$hardcode_libdirs"; then
8477 libdir="$hardcode_libdirs"
8478 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
8480 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8481 # We should set the runpath_var.
8482 rpath=
8483 for dir in $perm_rpath; do
8484 rpath+="$dir:"
8485 done
8486 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8488 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8491 shlibpath="$finalize_shlibpath"
8492 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8493 if test -n "$shlibpath"; then
8494 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8497 # Get the real and link names of the library.
8498 eval shared_ext=\"$shrext_cmds\"
8499 eval library_names=\"$library_names_spec\"
8500 set dummy $library_names
8501 shift
8502 realname="$1"
8503 shift
8505 if test -n "$soname_spec"; then
8506 eval soname=\"$soname_spec\"
8507 else
8508 soname="$realname"
8510 if test -z "$dlname"; then
8511 dlname=$soname
8514 lib="$output_objdir/$realname"
8515 linknames=
8516 for link
8518 linknames+=" $link"
8519 done
8521 # Use standard objects if they are pic
8522 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8523 test "X$libobjs" = "X " && libobjs=
8525 delfiles=
8526 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8527 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8528 export_symbols="$output_objdir/$libname.uexp"
8529 delfiles+=" $export_symbols"
8532 orig_export_symbols=
8533 case $host_os in
8534 cygwin* | mingw* | cegcc*)
8535 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8536 # exporting using user supplied symfile
8537 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8538 # and it's NOT already a .def file. Must figure out
8539 # which of the given symbols are data symbols and tag
8540 # them as such. So, trigger use of export_symbols_cmds.
8541 # export_symbols gets reassigned inside the "prepare
8542 # the list of exported symbols" if statement, so the
8543 # include_expsyms logic still works.
8544 orig_export_symbols="$export_symbols"
8545 export_symbols=
8546 always_export_symbols=yes
8550 esac
8552 # Prepare the list of exported symbols
8553 if test -z "$export_symbols"; then
8554 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8555 func_verbose "generating symbol list for \`$libname.la'"
8556 export_symbols="$output_objdir/$libname.exp"
8557 $opt_dry_run || $RM $export_symbols
8558 cmds=$export_symbols_cmds
8559 save_ifs="$IFS"; IFS='~'
8560 for cmd1 in $cmds; do
8561 IFS="$save_ifs"
8562 # Take the normal branch if the nm_file_list_spec branch
8563 # doesn't work or if tool conversion is not needed.
8564 case $nm_file_list_spec~$to_tool_file_cmd in
8565 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8566 try_normal_branch=yes
8567 eval cmd=\"$cmd1\"
8568 func_len " $cmd"
8569 len=$func_len_result
8572 try_normal_branch=no
8574 esac
8575 if test "$try_normal_branch" = yes \
8576 && { test "$len" -lt "$max_cmd_len" \
8577 || test "$max_cmd_len" -le -1; }
8578 then
8579 func_show_eval "$cmd" 'exit $?'
8580 skipped_export=false
8581 elif test -n "$nm_file_list_spec"; then
8582 func_basename "$output"
8583 output_la=$func_basename_result
8584 save_libobjs=$libobjs
8585 save_output=$output
8586 output=${output_objdir}/${output_la}.nm
8587 func_to_tool_file "$output"
8588 libobjs=$nm_file_list_spec$func_to_tool_file_result
8589 delfiles+=" $output"
8590 func_verbose "creating $NM input file list: $output"
8591 for obj in $save_libobjs; do
8592 func_to_tool_file "$obj"
8593 $ECHO "$func_to_tool_file_result"
8594 done > "$output"
8595 eval cmd=\"$cmd1\"
8596 func_show_eval "$cmd" 'exit $?'
8597 output=$save_output
8598 libobjs=$save_libobjs
8599 skipped_export=false
8600 else
8601 # The command line is too long to execute in one step.
8602 func_verbose "using reloadable object file for export list..."
8603 skipped_export=:
8604 # Break out early, otherwise skipped_export may be
8605 # set to false by a later but shorter cmd.
8606 break
8608 done
8609 IFS="$save_ifs"
8610 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8611 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8612 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8617 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8618 tmp_export_symbols="$export_symbols"
8619 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8620 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8623 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8624 # The given exports_symbols file has to be filtered, so filter it.
8625 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8626 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8627 # 's' commands which not all seds can handle. GNU sed should be fine
8628 # though. Also, the filter scales superlinearly with the number of
8629 # global variables. join(1) would be nice here, but unfortunately
8630 # isn't a blessed tool.
8631 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8632 delfiles+=" $export_symbols $output_objdir/$libname.filter"
8633 export_symbols=$output_objdir/$libname.def
8634 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8637 tmp_deplibs=
8638 for test_deplib in $deplibs; do
8639 case " $convenience " in
8640 *" $test_deplib "*) ;;
8642 tmp_deplibs+=" $test_deplib"
8644 esac
8645 done
8646 deplibs="$tmp_deplibs"
8648 if test -n "$convenience"; then
8649 if test -n "$whole_archive_flag_spec" &&
8650 test "$compiler_needs_object" = yes &&
8651 test -z "$libobjs"; then
8652 # extract the archives, so we have objects to list.
8653 # TODO: could optimize this to just extract one archive.
8654 whole_archive_flag_spec=
8656 if test -n "$whole_archive_flag_spec"; then
8657 save_libobjs=$libobjs
8658 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8659 test "X$libobjs" = "X " && libobjs=
8660 else
8661 gentop="$output_objdir/${outputname}x"
8662 generated+=" $gentop"
8664 func_extract_archives $gentop $convenience
8665 libobjs+=" $func_extract_archives_result"
8666 test "X$libobjs" = "X " && libobjs=
8670 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8671 eval flag=\"$thread_safe_flag_spec\"
8672 linker_flags+=" $flag"
8675 # Make a backup of the uninstalled library when relinking
8676 if test "$opt_mode" = relink; then
8677 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8680 # Do each of the archive commands.
8681 if test "$module" = yes && test -n "$module_cmds" ; then
8682 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8683 eval test_cmds=\"$module_expsym_cmds\"
8684 cmds=$module_expsym_cmds
8685 else
8686 eval test_cmds=\"$module_cmds\"
8687 cmds=$module_cmds
8689 else
8690 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8691 eval test_cmds=\"$archive_expsym_cmds\"
8692 cmds=$archive_expsym_cmds
8693 else
8694 eval test_cmds=\"$archive_cmds\"
8695 cmds=$archive_cmds
8699 if test "X$skipped_export" != "X:" &&
8700 func_len " $test_cmds" &&
8701 len=$func_len_result &&
8702 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8704 else
8705 # The command line is too long to link in one step, link piecewise
8706 # or, if using GNU ld and skipped_export is not :, use a linker
8707 # script.
8709 # Save the value of $output and $libobjs because we want to
8710 # use them later. If we have whole_archive_flag_spec, we
8711 # want to use save_libobjs as it was before
8712 # whole_archive_flag_spec was expanded, because we can't
8713 # assume the linker understands whole_archive_flag_spec.
8714 # This may have to be revisited, in case too many
8715 # convenience libraries get linked in and end up exceeding
8716 # the spec.
8717 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8718 save_libobjs=$libobjs
8720 save_output=$output
8721 func_basename "$output"
8722 output_la=$func_basename_result
8724 # Clear the reloadable object creation command queue and
8725 # initialize k to one.
8726 test_cmds=
8727 concat_cmds=
8728 objlist=
8729 last_robj=
8732 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8733 output=${output_objdir}/${output_la}.lnkscript
8734 func_verbose "creating GNU ld script: $output"
8735 echo 'INPUT (' > $output
8736 for obj in $save_libobjs
8738 func_to_tool_file "$obj"
8739 $ECHO "$func_to_tool_file_result" >> $output
8740 done
8741 echo ')' >> $output
8742 delfiles+=" $output"
8743 func_to_tool_file "$output"
8744 output=$func_to_tool_file_result
8745 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8746 output=${output_objdir}/${output_la}.lnk
8747 func_verbose "creating linker input file list: $output"
8748 : > $output
8749 set x $save_libobjs
8750 shift
8751 firstobj=
8752 if test "$compiler_needs_object" = yes; then
8753 firstobj="$1 "
8754 shift
8756 for obj
8758 func_to_tool_file "$obj"
8759 $ECHO "$func_to_tool_file_result" >> $output
8760 done
8761 delfiles+=" $output"
8762 func_to_tool_file "$output"
8763 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8764 else
8765 if test -n "$save_libobjs"; then
8766 func_verbose "creating reloadable object files..."
8767 output=$output_objdir/$output_la-${k}.$objext
8768 eval test_cmds=\"$reload_cmds\"
8769 func_len " $test_cmds"
8770 len0=$func_len_result
8771 len=$len0
8773 # Loop over the list of objects to be linked.
8774 for obj in $save_libobjs
8776 func_len " $obj"
8777 func_arith $len + $func_len_result
8778 len=$func_arith_result
8779 if test "X$objlist" = X ||
8780 test "$len" -lt "$max_cmd_len"; then
8781 objlist+=" $obj"
8782 else
8783 # The command $test_cmds is almost too long, add a
8784 # command to the queue.
8785 if test "$k" -eq 1 ; then
8786 # The first file doesn't have a previous command to add.
8787 reload_objs=$objlist
8788 eval concat_cmds=\"$reload_cmds\"
8789 else
8790 # All subsequent reloadable object files will link in
8791 # the last one created.
8792 reload_objs="$objlist $last_robj"
8793 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8795 last_robj=$output_objdir/$output_la-${k}.$objext
8796 func_arith $k + 1
8797 k=$func_arith_result
8798 output=$output_objdir/$output_la-${k}.$objext
8799 objlist=" $obj"
8800 func_len " $last_robj"
8801 func_arith $len0 + $func_len_result
8802 len=$func_arith_result
8804 done
8805 # Handle the remaining objects by creating one last
8806 # reloadable object file. All subsequent reloadable object
8807 # files will link in the last one created.
8808 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8809 reload_objs="$objlist $last_robj"
8810 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8811 if test -n "$last_robj"; then
8812 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8814 delfiles+=" $output"
8816 else
8817 output=
8820 if ${skipped_export-false}; then
8821 func_verbose "generating symbol list for \`$libname.la'"
8822 export_symbols="$output_objdir/$libname.exp"
8823 $opt_dry_run || $RM $export_symbols
8824 libobjs=$output
8825 # Append the command to create the export file.
8826 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8827 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8828 if test -n "$last_robj"; then
8829 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8833 test -n "$save_libobjs" &&
8834 func_verbose "creating a temporary reloadable object file: $output"
8836 # Loop through the commands generated above and execute them.
8837 save_ifs="$IFS"; IFS='~'
8838 for cmd in $concat_cmds; do
8839 IFS="$save_ifs"
8840 $opt_silent || {
8841 func_quote_for_expand "$cmd"
8842 eval "func_echo $func_quote_for_expand_result"
8844 $opt_dry_run || eval "$cmd" || {
8845 lt_exit=$?
8847 # Restore the uninstalled library and exit
8848 if test "$opt_mode" = relink; then
8849 ( cd "$output_objdir" && \
8850 $RM "${realname}T" && \
8851 $MV "${realname}U" "$realname" )
8854 exit $lt_exit
8856 done
8857 IFS="$save_ifs"
8859 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8860 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8861 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8865 if ${skipped_export-false}; then
8866 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8867 tmp_export_symbols="$export_symbols"
8868 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8869 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8872 if test -n "$orig_export_symbols"; then
8873 # The given exports_symbols file has to be filtered, so filter it.
8874 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8875 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8876 # 's' commands which not all seds can handle. GNU sed should be fine
8877 # though. Also, the filter scales superlinearly with the number of
8878 # global variables. join(1) would be nice here, but unfortunately
8879 # isn't a blessed tool.
8880 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8881 delfiles+=" $export_symbols $output_objdir/$libname.filter"
8882 export_symbols=$output_objdir/$libname.def
8883 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8887 libobjs=$output
8888 # Restore the value of output.
8889 output=$save_output
8891 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8892 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8893 test "X$libobjs" = "X " && libobjs=
8895 # Expand the library linking commands again to reset the
8896 # value of $libobjs for piecewise linking.
8898 # Do each of the archive commands.
8899 if test "$module" = yes && test -n "$module_cmds" ; then
8900 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8901 cmds=$module_expsym_cmds
8902 else
8903 cmds=$module_cmds
8905 else
8906 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8907 cmds=$archive_expsym_cmds
8908 else
8909 cmds=$archive_cmds
8914 if test -n "$delfiles"; then
8915 # Append the command to remove temporary files to $cmds.
8916 eval cmds=\"\$cmds~\$RM $delfiles\"
8919 # Add any objects from preloaded convenience libraries
8920 if test -n "$dlprefiles"; then
8921 gentop="$output_objdir/${outputname}x"
8922 generated+=" $gentop"
8924 func_extract_archives $gentop $dlprefiles
8925 libobjs+=" $func_extract_archives_result"
8926 test "X$libobjs" = "X " && libobjs=
8929 save_ifs="$IFS"; IFS='~'
8930 for cmd in $cmds; do
8931 IFS="$save_ifs"
8932 eval cmd=\"$cmd\"
8933 $opt_silent || {
8934 func_quote_for_expand "$cmd"
8935 eval "func_echo $func_quote_for_expand_result"
8937 $opt_dry_run || eval "$cmd" || {
8938 lt_exit=$?
8940 # Restore the uninstalled library and exit
8941 if test "$opt_mode" = relink; then
8942 ( cd "$output_objdir" && \
8943 $RM "${realname}T" && \
8944 $MV "${realname}U" "$realname" )
8947 exit $lt_exit
8949 done
8950 IFS="$save_ifs"
8952 # Restore the uninstalled library and exit
8953 if test "$opt_mode" = relink; then
8954 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8956 if test -n "$convenience"; then
8957 if test -z "$whole_archive_flag_spec"; then
8958 func_show_eval '${RM}r "$gentop"'
8962 exit $EXIT_SUCCESS
8965 # Create links to the real library.
8966 for linkname in $linknames; do
8967 if test "$realname" != "$linkname"; then
8968 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8970 done
8972 # If -module or -export-dynamic was specified, set the dlname.
8973 if test "$module" = yes || test "$export_dynamic" = yes; then
8974 # On all known operating systems, these are identical.
8975 dlname="$soname"
8980 obj)
8981 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8982 func_warning "\`-dlopen' is ignored for objects"
8985 case " $deplibs" in
8986 *\ -l* | *\ -L*)
8987 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8988 esac
8990 test -n "$rpath" && \
8991 func_warning "\`-rpath' is ignored for objects"
8993 test -n "$xrpath" && \
8994 func_warning "\`-R' is ignored for objects"
8996 test -n "$vinfo" && \
8997 func_warning "\`-version-info' is ignored for objects"
8999 test -n "$release" && \
9000 func_warning "\`-release' is ignored for objects"
9002 case $output in
9003 *.lo)
9004 test -n "$objs$old_deplibs" && \
9005 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
9007 libobj=$output
9008 func_lo2o "$libobj"
9009 obj=$func_lo2o_result
9012 libobj=
9013 obj="$output"
9015 esac
9017 # Delete the old objects.
9018 $opt_dry_run || $RM $obj $libobj
9020 # Objects from convenience libraries. This assumes
9021 # single-version convenience libraries. Whenever we create
9022 # different ones for PIC/non-PIC, this we'll have to duplicate
9023 # the extraction.
9024 reload_conv_objs=
9025 gentop=
9026 # reload_cmds runs $LD directly, so let us get rid of
9027 # -Wl from whole_archive_flag_spec and hope we can get by with
9028 # turning comma into space..
9031 if test -n "$convenience"; then
9032 if test -n "$whole_archive_flag_spec"; then
9033 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
9034 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
9035 else
9036 gentop="$output_objdir/${obj}x"
9037 generated+=" $gentop"
9039 func_extract_archives $gentop $convenience
9040 reload_conv_objs="$reload_objs $func_extract_archives_result"
9044 # If we're not building shared, we need to use non_pic_objs
9045 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
9047 # Create the old-style object.
9048 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
9050 output="$obj"
9051 func_execute_cmds "$reload_cmds" 'exit $?'
9053 # Exit if we aren't doing a library object file.
9054 if test -z "$libobj"; then
9055 if test -n "$gentop"; then
9056 func_show_eval '${RM}r "$gentop"'
9059 exit $EXIT_SUCCESS
9062 if test "$build_libtool_libs" != yes; then
9063 if test -n "$gentop"; then
9064 func_show_eval '${RM}r "$gentop"'
9067 # Create an invalid libtool object if no PIC, so that we don't
9068 # accidentally link it into a program.
9069 # $show "echo timestamp > $libobj"
9070 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
9071 exit $EXIT_SUCCESS
9074 if test -n "$pic_flag" || test "$pic_mode" != default; then
9075 # Only do commands if we really have different PIC objects.
9076 reload_objs="$libobjs $reload_conv_objs"
9077 output="$libobj"
9078 func_execute_cmds "$reload_cmds" 'exit $?'
9081 if test -n "$gentop"; then
9082 func_show_eval '${RM}r "$gentop"'
9085 exit $EXIT_SUCCESS
9088 prog)
9089 case $host in
9090 *cygwin*) func_stripname '' '.exe' "$output"
9091 output=$func_stripname_result.exe;;
9092 esac
9093 test -n "$vinfo" && \
9094 func_warning "\`-version-info' is ignored for programs"
9096 test -n "$release" && \
9097 func_warning "\`-release' is ignored for programs"
9099 test "$preload" = yes \
9100 && test "$dlopen_support" = unknown \
9101 && test "$dlopen_self" = unknown \
9102 && test "$dlopen_self_static" = unknown && \
9103 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
9105 case $host in
9106 *-*-rhapsody* | *-*-darwin1.[012])
9107 # On Rhapsody replace the C library is the System framework
9108 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
9109 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
9111 esac
9113 case $host in
9114 *-*-darwin*)
9115 # Don't allow lazy linking, it breaks C++ global constructors
9116 # But is supposedly fixed on 10.4 or later (yay!).
9117 if test "$tagname" = CXX ; then
9118 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
9119 10.[0123])
9120 compile_command+=" ${wl}-bind_at_load"
9121 finalize_command+=" ${wl}-bind_at_load"
9123 esac
9125 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9126 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9127 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9129 esac
9132 # move library search paths that coincide with paths to not yet
9133 # installed libraries to the beginning of the library search list
9134 new_libs=
9135 for path in $notinst_path; do
9136 case " $new_libs " in
9137 *" -L$path/$objdir "*) ;;
9139 case " $compile_deplibs " in
9140 *" -L$path/$objdir "*)
9141 new_libs+=" -L$path/$objdir" ;;
9142 esac
9144 esac
9145 done
9146 for deplib in $compile_deplibs; do
9147 case $deplib in
9148 -L*)
9149 case " $new_libs " in
9150 *" $deplib "*) ;;
9151 *) new_libs+=" $deplib" ;;
9152 esac
9154 *) new_libs+=" $deplib" ;;
9155 esac
9156 done
9157 compile_deplibs="$new_libs"
9160 compile_command+=" $compile_deplibs"
9161 finalize_command+=" $finalize_deplibs"
9163 if test -n "$rpath$xrpath"; then
9164 # If the user specified any rpath flags, then add them.
9165 for libdir in $rpath $xrpath; do
9166 # This is the magic to use -rpath.
9167 case "$finalize_rpath " in
9168 *" $libdir "*) ;;
9169 *) finalize_rpath+=" $libdir" ;;
9170 esac
9171 done
9174 # Now hardcode the library paths
9175 rpath=
9176 hardcode_libdirs=
9177 for libdir in $compile_rpath $finalize_rpath; do
9178 if test -n "$hardcode_libdir_flag_spec"; then
9179 if test -n "$hardcode_libdir_separator"; then
9180 if test -z "$hardcode_libdirs"; then
9181 hardcode_libdirs="$libdir"
9182 else
9183 # Just accumulate the unique libdirs.
9184 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9185 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9188 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
9190 esac
9192 else
9193 eval flag=\"$hardcode_libdir_flag_spec\"
9194 rpath+=" $flag"
9196 elif test -n "$runpath_var"; then
9197 case "$perm_rpath " in
9198 *" $libdir "*) ;;
9199 *) perm_rpath+=" $libdir" ;;
9200 esac
9202 case $host in
9203 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
9204 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
9205 case :$dllsearchpath: in
9206 *":$libdir:"*) ;;
9207 ::) dllsearchpath=$libdir;;
9208 *) dllsearchpath+=":$libdir";;
9209 esac
9210 case :$dllsearchpath: in
9211 *":$testbindir:"*) ;;
9212 ::) dllsearchpath=$testbindir;;
9213 *) dllsearchpath+=":$testbindir";;
9214 esac
9216 esac
9217 done
9218 # Substitute the hardcoded libdirs into the rpath.
9219 if test -n "$hardcode_libdir_separator" &&
9220 test -n "$hardcode_libdirs"; then
9221 libdir="$hardcode_libdirs"
9222 eval rpath=\" $hardcode_libdir_flag_spec\"
9224 compile_rpath="$rpath"
9226 rpath=
9227 hardcode_libdirs=
9228 for libdir in $finalize_rpath; do
9229 if test -n "$hardcode_libdir_flag_spec"; then
9230 if test -n "$hardcode_libdir_separator"; then
9231 if test -z "$hardcode_libdirs"; then
9232 hardcode_libdirs="$libdir"
9233 else
9234 # Just accumulate the unique libdirs.
9235 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9236 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9239 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
9241 esac
9243 else
9244 eval flag=\"$hardcode_libdir_flag_spec\"
9245 rpath+=" $flag"
9247 elif test -n "$runpath_var"; then
9248 case "$finalize_perm_rpath " in
9249 *" $libdir "*) ;;
9250 *) finalize_perm_rpath+=" $libdir" ;;
9251 esac
9253 done
9254 # Substitute the hardcoded libdirs into the rpath.
9255 if test -n "$hardcode_libdir_separator" &&
9256 test -n "$hardcode_libdirs"; then
9257 libdir="$hardcode_libdirs"
9258 eval rpath=\" $hardcode_libdir_flag_spec\"
9260 finalize_rpath="$rpath"
9262 if test -n "$libobjs" && test "$build_old_libs" = yes; then
9263 # Transform all the library objects into standard objects.
9264 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9265 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9268 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
9270 # template prelinking step
9271 if test -n "$prelink_cmds"; then
9272 func_execute_cmds "$prelink_cmds" 'exit $?'
9275 wrappers_required=yes
9276 case $host in
9277 *cegcc* | *mingw32ce*)
9278 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
9279 wrappers_required=no
9281 *cygwin* | *mingw* )
9282 if test "$build_libtool_libs" != yes; then
9283 wrappers_required=no
9287 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
9288 wrappers_required=no
9291 esac
9292 if test "$wrappers_required" = no; then
9293 # Replace the output file specification.
9294 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9295 link_command="$compile_command$compile_rpath"
9297 # We have no uninstalled library dependencies, so finalize right now.
9298 exit_status=0
9299 func_show_eval "$link_command" 'exit_status=$?'
9301 if test -n "$postlink_cmds"; then
9302 func_to_tool_file "$output"
9303 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9304 func_execute_cmds "$postlink_cmds" 'exit $?'
9307 # Delete the generated files.
9308 if test -f "$output_objdir/${outputname}S.${objext}"; then
9309 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
9312 exit $exit_status
9315 if test -n "$compile_shlibpath$finalize_shlibpath"; then
9316 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
9318 if test -n "$finalize_shlibpath"; then
9319 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
9322 compile_var=
9323 finalize_var=
9324 if test -n "$runpath_var"; then
9325 if test -n "$perm_rpath"; then
9326 # We should set the runpath_var.
9327 rpath=
9328 for dir in $perm_rpath; do
9329 rpath+="$dir:"
9330 done
9331 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
9333 if test -n "$finalize_perm_rpath"; then
9334 # We should set the runpath_var.
9335 rpath=
9336 for dir in $finalize_perm_rpath; do
9337 rpath+="$dir:"
9338 done
9339 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
9343 if test "$no_install" = yes; then
9344 # We don't need to create a wrapper script.
9345 link_command="$compile_var$compile_command$compile_rpath"
9346 # Replace the output file specification.
9347 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9348 # Delete the old output file.
9349 $opt_dry_run || $RM $output
9350 # Link the executable and exit
9351 func_show_eval "$link_command" 'exit $?'
9353 if test -n "$postlink_cmds"; then
9354 func_to_tool_file "$output"
9355 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9356 func_execute_cmds "$postlink_cmds" 'exit $?'
9359 exit $EXIT_SUCCESS
9362 if test "$hardcode_action" = relink; then
9363 # Fast installation is not supported
9364 link_command="$compile_var$compile_command$compile_rpath"
9365 relink_command="$finalize_var$finalize_command$finalize_rpath"
9367 func_warning "this platform does not like uninstalled shared libraries"
9368 func_warning "\`$output' will be relinked during installation"
9369 else
9370 if test "$fast_install" != no; then
9371 link_command="$finalize_var$compile_command$finalize_rpath"
9372 if test "$fast_install" = yes; then
9373 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
9374 else
9375 # fast_install is set to needless
9376 relink_command=
9378 else
9379 link_command="$compile_var$compile_command$compile_rpath"
9380 relink_command="$finalize_var$finalize_command$finalize_rpath"
9384 # Replace the output file specification.
9385 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9387 # Delete the old output files.
9388 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9390 func_show_eval "$link_command" 'exit $?'
9392 if test -n "$postlink_cmds"; then
9393 func_to_tool_file "$output_objdir/$outputname"
9394 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'`
9395 func_execute_cmds "$postlink_cmds" 'exit $?'
9398 # Now create the wrapper script.
9399 func_verbose "creating $output"
9401 # Quote the relink command for shipping.
9402 if test -n "$relink_command"; then
9403 # Preserve any variables that may affect compiler behavior
9404 for var in $variables_saved_for_relink; do
9405 if eval test -z \"\${$var+set}\"; then
9406 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9407 elif eval var_value=\$$var; test -z "$var_value"; then
9408 relink_command="$var=; export $var; $relink_command"
9409 else
9410 func_quote_for_eval "$var_value"
9411 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9413 done
9414 relink_command="(cd `pwd`; $relink_command)"
9415 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9418 # Only actually do things if not in dry run mode.
9419 $opt_dry_run || {
9420 # win32 will think the script is a binary if it has
9421 # a .exe suffix, so we strip it off here.
9422 case $output in
9423 *.exe) func_stripname '' '.exe' "$output"
9424 output=$func_stripname_result ;;
9425 esac
9426 # test for cygwin because mv fails w/o .exe extensions
9427 case $host in
9428 *cygwin*)
9429 exeext=.exe
9430 func_stripname '' '.exe' "$outputname"
9431 outputname=$func_stripname_result ;;
9432 *) exeext= ;;
9433 esac
9434 case $host in
9435 *cygwin* | *mingw* )
9436 func_dirname_and_basename "$output" "" "."
9437 output_name=$func_basename_result
9438 output_path=$func_dirname_result
9439 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9440 cwrapper="$output_path/$output_name.exe"
9441 $RM $cwrappersource $cwrapper
9442 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9444 func_emit_cwrapperexe_src > $cwrappersource
9446 # The wrapper executable is built using the $host compiler,
9447 # because it contains $host paths and files. If cross-
9448 # compiling, it, like the target executable, must be
9449 # executed on the $host or under an emulation environment.
9450 $opt_dry_run || {
9451 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9452 $STRIP $cwrapper
9455 # Now, create the wrapper script for func_source use:
9456 func_ltwrapper_scriptname $cwrapper
9457 $RM $func_ltwrapper_scriptname_result
9458 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9459 $opt_dry_run || {
9460 # note: this script will not be executed, so do not chmod.
9461 if test "x$build" = "x$host" ; then
9462 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9463 else
9464 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9469 $RM $output
9470 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9472 func_emit_wrapper no > $output
9473 chmod +x $output
9475 esac
9477 exit $EXIT_SUCCESS
9479 esac
9481 # See if we need to build an old-fashioned archive.
9482 for oldlib in $oldlibs; do
9484 if test "$build_libtool_libs" = convenience; then
9485 oldobjs="$libobjs_save $symfileobj"
9486 addlibs="$convenience"
9487 build_libtool_libs=no
9488 else
9489 if test "$build_libtool_libs" = module; then
9490 oldobjs="$libobjs_save"
9491 build_libtool_libs=no
9492 else
9493 oldobjs="$old_deplibs $non_pic_objects"
9494 if test "$preload" = yes && test -f "$symfileobj"; then
9495 oldobjs+=" $symfileobj"
9498 addlibs="$old_convenience"
9501 if test -n "$addlibs"; then
9502 gentop="$output_objdir/${outputname}x"
9503 generated+=" $gentop"
9505 func_extract_archives $gentop $addlibs
9506 oldobjs+=" $func_extract_archives_result"
9509 # Do each command in the archive commands.
9510 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9511 cmds=$old_archive_from_new_cmds
9512 else
9514 # Add any objects from preloaded convenience libraries
9515 if test -n "$dlprefiles"; then
9516 gentop="$output_objdir/${outputname}x"
9517 generated+=" $gentop"
9519 func_extract_archives $gentop $dlprefiles
9520 oldobjs+=" $func_extract_archives_result"
9523 # POSIX demands no paths to be encoded in archives. We have
9524 # to avoid creating archives with duplicate basenames if we
9525 # might have to extract them afterwards, e.g., when creating a
9526 # static archive out of a convenience library, or when linking
9527 # the entirety of a libtool archive into another (currently
9528 # not supported by libtool).
9529 if (for obj in $oldobjs
9531 func_basename "$obj"
9532 $ECHO "$func_basename_result"
9533 done | sort | sort -uc >/dev/null 2>&1); then
9535 else
9536 echo "copying selected object files to avoid basename conflicts..."
9537 gentop="$output_objdir/${outputname}x"
9538 generated+=" $gentop"
9539 func_mkdir_p "$gentop"
9540 save_oldobjs=$oldobjs
9541 oldobjs=
9542 counter=1
9543 for obj in $save_oldobjs
9545 func_basename "$obj"
9546 objbase="$func_basename_result"
9547 case " $oldobjs " in
9548 " ") oldobjs=$obj ;;
9549 *[\ /]"$objbase "*)
9550 while :; do
9551 # Make sure we don't pick an alternate name that also
9552 # overlaps.
9553 newobj=lt$counter-$objbase
9554 func_arith $counter + 1
9555 counter=$func_arith_result
9556 case " $oldobjs " in
9557 *[\ /]"$newobj "*) ;;
9558 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9559 esac
9560 done
9561 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9562 oldobjs+=" $gentop/$newobj"
9564 *) oldobjs+=" $obj" ;;
9565 esac
9566 done
9568 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
9569 tool_oldlib=$func_to_tool_file_result
9570 eval cmds=\"$old_archive_cmds\"
9572 func_len " $cmds"
9573 len=$func_len_result
9574 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9575 cmds=$old_archive_cmds
9576 elif test -n "$archiver_list_spec"; then
9577 func_verbose "using command file archive linking..."
9578 for obj in $oldobjs
9580 func_to_tool_file "$obj"
9581 $ECHO "$func_to_tool_file_result"
9582 done > $output_objdir/$libname.libcmd
9583 func_to_tool_file "$output_objdir/$libname.libcmd"
9584 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9585 cmds=$old_archive_cmds
9586 else
9587 # the command line is too long to link in one step, link in parts
9588 func_verbose "using piecewise archive linking..."
9589 save_RANLIB=$RANLIB
9590 RANLIB=:
9591 objlist=
9592 concat_cmds=
9593 save_oldobjs=$oldobjs
9594 oldobjs=
9595 # Is there a better way of finding the last object in the list?
9596 for obj in $save_oldobjs
9598 last_oldobj=$obj
9599 done
9600 eval test_cmds=\"$old_archive_cmds\"
9601 func_len " $test_cmds"
9602 len0=$func_len_result
9603 len=$len0
9604 for obj in $save_oldobjs
9606 func_len " $obj"
9607 func_arith $len + $func_len_result
9608 len=$func_arith_result
9609 objlist+=" $obj"
9610 if test "$len" -lt "$max_cmd_len"; then
9612 else
9613 # the above command should be used before it gets too long
9614 oldobjs=$objlist
9615 if test "$obj" = "$last_oldobj" ; then
9616 RANLIB=$save_RANLIB
9618 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9619 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9620 objlist=
9621 len=$len0
9623 done
9624 RANLIB=$save_RANLIB
9625 oldobjs=$objlist
9626 if test "X$oldobjs" = "X" ; then
9627 eval cmds=\"\$concat_cmds\"
9628 else
9629 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9633 func_execute_cmds "$cmds" 'exit $?'
9634 done
9636 test -n "$generated" && \
9637 func_show_eval "${RM}r$generated"
9639 # Now create the libtool archive.
9640 case $output in
9641 *.la)
9642 old_library=
9643 test "$build_old_libs" = yes && old_library="$libname.$libext"
9644 func_verbose "creating $output"
9646 # Preserve any variables that may affect compiler behavior
9647 for var in $variables_saved_for_relink; do
9648 if eval test -z \"\${$var+set}\"; then
9649 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9650 elif eval var_value=\$$var; test -z "$var_value"; then
9651 relink_command="$var=; export $var; $relink_command"
9652 else
9653 func_quote_for_eval "$var_value"
9654 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9656 done
9657 # Quote the link command for shipping.
9658 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9659 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9660 if test "$hardcode_automatic" = yes ; then
9661 relink_command=
9664 # Only create the output if not a dry run.
9665 $opt_dry_run || {
9666 for installed in no yes; do
9667 if test "$installed" = yes; then
9668 if test -z "$install_libdir"; then
9669 break
9671 output="$output_objdir/$outputname"i
9672 # Replace all uninstalled libtool libraries with the installed ones
9673 newdependency_libs=
9674 for deplib in $dependency_libs; do
9675 case $deplib in
9676 *.la)
9677 func_basename "$deplib"
9678 name="$func_basename_result"
9679 func_resolve_sysroot "$deplib"
9680 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9681 test -z "$libdir" && \
9682 func_fatal_error "\`$deplib' is not a valid libtool archive"
9683 newdependency_libs+=" ${lt_sysroot:+=}$libdir/$name"
9685 -L*)
9686 func_stripname -L '' "$deplib"
9687 func_replace_sysroot "$func_stripname_result"
9688 newdependency_libs+=" -L$func_replace_sysroot_result"
9690 -R*)
9691 func_stripname -R '' "$deplib"
9692 func_replace_sysroot "$func_stripname_result"
9693 newdependency_libs+=" -R$func_replace_sysroot_result"
9695 *) newdependency_libs+=" $deplib" ;;
9696 esac
9697 done
9698 dependency_libs="$newdependency_libs"
9699 newdlfiles=
9701 for lib in $dlfiles; do
9702 case $lib in
9703 *.la)
9704 func_basename "$lib"
9705 name="$func_basename_result"
9706 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9707 test -z "$libdir" && \
9708 func_fatal_error "\`$lib' is not a valid libtool archive"
9709 newdlfiles+=" ${lt_sysroot:+=}$libdir/$name"
9711 *) newdlfiles+=" $lib" ;;
9712 esac
9713 done
9714 dlfiles="$newdlfiles"
9715 newdlprefiles=
9716 for lib in $dlprefiles; do
9717 case $lib in
9718 *.la)
9719 # Only pass preopened files to the pseudo-archive (for
9720 # eventual linking with the app. that links it) if we
9721 # didn't already link the preopened objects directly into
9722 # the library:
9723 func_basename "$lib"
9724 name="$func_basename_result"
9725 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9726 test -z "$libdir" && \
9727 func_fatal_error "\`$lib' is not a valid libtool archive"
9728 newdlprefiles+=" ${lt_sysroot:+=}$libdir/$name"
9730 esac
9731 done
9732 dlprefiles="$newdlprefiles"
9733 else
9734 newdlfiles=
9735 for lib in $dlfiles; do
9736 case $lib in
9737 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9738 *) abs=`pwd`"/$lib" ;;
9739 esac
9740 newdlfiles+=" $abs"
9741 done
9742 dlfiles="$newdlfiles"
9743 newdlprefiles=
9744 for lib in $dlprefiles; do
9745 case $lib in
9746 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9747 *) abs=`pwd`"/$lib" ;;
9748 esac
9749 newdlprefiles+=" $abs"
9750 done
9751 dlprefiles="$newdlprefiles"
9753 $RM $output
9754 # place dlname in correct position for cygwin
9755 # In fact, it would be nice if we could use this code for all target
9756 # systems that can't hard-code library paths into their executables
9757 # and that have no shared library path variable independent of PATH,
9758 # but it turns out we can't easily determine that from inspecting
9759 # libtool variables, so we have to hard-code the OSs to which it
9760 # applies here; at the moment, that means platforms that use the PE
9761 # object format with DLL files. See the long comment at the top of
9762 # tests/bindir.at for full details.
9763 tdlname=$dlname
9764 case $host,$output,$installed,$module,$dlname in
9765 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9766 # If a -bindir argument was supplied, place the dll there.
9767 if test "x$bindir" != x ;
9768 then
9769 func_relative_path "$install_libdir" "$bindir"
9770 tdlname=$func_relative_path_result$dlname
9771 else
9772 # Otherwise fall back on heuristic.
9773 tdlname=../bin/$dlname
9776 esac
9777 $ECHO > $output "\
9778 # $outputname - a libtool library file
9779 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9781 # Please DO NOT delete this file!
9782 # It is necessary for linking the library.
9784 # The name that we can dlopen(3).
9785 dlname='$tdlname'
9787 # Names of this library.
9788 library_names='$library_names'
9790 # The name of the static archive.
9791 old_library='$old_library'
9793 # Linker flags that can not go in dependency_libs.
9794 inherited_linker_flags='$new_inherited_linker_flags'
9796 # Libraries that this one depends upon.
9797 dependency_libs='$dependency_libs'
9799 # Names of additional weak libraries provided by this library
9800 weak_library_names='$weak_libs'
9802 # Version information for $libname.
9803 current=$current
9804 age=$age
9805 revision=$revision
9807 # Is this an already installed library?
9808 installed=$installed
9810 # Should we warn about portability when linking against -modules?
9811 shouldnotlink=$module
9813 # Files to dlopen/dlpreopen
9814 dlopen='$dlfiles'
9815 dlpreopen='$dlprefiles'
9817 # Directory that this library needs to be installed in:
9818 libdir='$install_libdir'"
9819 if test "$installed" = no && test "$need_relink" = yes; then
9820 $ECHO >> $output "\
9821 relink_command=\"$relink_command\""
9823 done
9826 # Do a symbolic link so that the libtool archive can be found in
9827 # LD_LIBRARY_PATH before the program is installed.
9828 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9830 esac
9831 exit $EXIT_SUCCESS
9834 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9835 func_mode_link ${1+"$@"}
9838 # func_mode_uninstall arg...
9839 func_mode_uninstall ()
9841 $opt_debug
9842 RM="$nonopt"
9843 files=
9844 rmforce=
9845 exit_status=0
9847 # This variable tells wrapper scripts just to set variables rather
9848 # than running their programs.
9849 libtool_install_magic="$magic"
9851 for arg
9853 case $arg in
9854 -f) RM+=" $arg"; rmforce=yes ;;
9855 -*) RM+=" $arg" ;;
9856 *) files+=" $arg" ;;
9857 esac
9858 done
9860 test -z "$RM" && \
9861 func_fatal_help "you must specify an RM program"
9863 rmdirs=
9865 for file in $files; do
9866 func_dirname "$file" "" "."
9867 dir="$func_dirname_result"
9868 if test "X$dir" = X.; then
9869 odir="$objdir"
9870 else
9871 odir="$dir/$objdir"
9873 func_basename "$file"
9874 name="$func_basename_result"
9875 test "$opt_mode" = uninstall && odir="$dir"
9877 # Remember odir for removal later, being careful to avoid duplicates
9878 if test "$opt_mode" = clean; then
9879 case " $rmdirs " in
9880 *" $odir "*) ;;
9881 *) rmdirs+=" $odir" ;;
9882 esac
9885 # Don't error if the file doesn't exist and rm -f was used.
9886 if { test -L "$file"; } >/dev/null 2>&1 ||
9887 { test -h "$file"; } >/dev/null 2>&1 ||
9888 test -f "$file"; then
9890 elif test -d "$file"; then
9891 exit_status=1
9892 continue
9893 elif test "$rmforce" = yes; then
9894 continue
9897 rmfiles="$file"
9899 case $name in
9900 *.la)
9901 # Possibly a libtool archive, so verify it.
9902 if func_lalib_p "$file"; then
9903 func_source $dir/$name
9905 # Delete the libtool libraries and symlinks.
9906 for n in $library_names; do
9907 rmfiles+=" $odir/$n"
9908 done
9909 test -n "$old_library" && rmfiles+=" $odir/$old_library"
9911 case "$opt_mode" in
9912 clean)
9913 case " $library_names " in
9914 *" $dlname "*) ;;
9915 *) test -n "$dlname" && rmfiles+=" $odir/$dlname" ;;
9916 esac
9917 test -n "$libdir" && rmfiles+=" $odir/$name $odir/${name}i"
9919 uninstall)
9920 if test -n "$library_names"; then
9921 # Do each command in the postuninstall commands.
9922 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9925 if test -n "$old_library"; then
9926 # Do each command in the old_postuninstall commands.
9927 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9929 # FIXME: should reinstall the best remaining shared library.
9931 esac
9935 *.lo)
9936 # Possibly a libtool object, so verify it.
9937 if func_lalib_p "$file"; then
9939 # Read the .lo file
9940 func_source $dir/$name
9942 # Add PIC object to the list of files to remove.
9943 if test -n "$pic_object" &&
9944 test "$pic_object" != none; then
9945 rmfiles+=" $dir/$pic_object"
9948 # Add non-PIC object to the list of files to remove.
9949 if test -n "$non_pic_object" &&
9950 test "$non_pic_object" != none; then
9951 rmfiles+=" $dir/$non_pic_object"
9957 if test "$opt_mode" = clean ; then
9958 noexename=$name
9959 case $file in
9960 *.exe)
9961 func_stripname '' '.exe' "$file"
9962 file=$func_stripname_result
9963 func_stripname '' '.exe' "$name"
9964 noexename=$func_stripname_result
9965 # $file with .exe has already been added to rmfiles,
9966 # add $file without .exe
9967 rmfiles+=" $file"
9969 esac
9970 # Do a test to see if this is a libtool program.
9971 if func_ltwrapper_p "$file"; then
9972 if func_ltwrapper_executable_p "$file"; then
9973 func_ltwrapper_scriptname "$file"
9974 relink_command=
9975 func_source $func_ltwrapper_scriptname_result
9976 rmfiles+=" $func_ltwrapper_scriptname_result"
9977 else
9978 relink_command=
9979 func_source $dir/$noexename
9982 # note $name still contains .exe if it was in $file originally
9983 # as does the version of $file that was added into $rmfiles
9984 rmfiles+=" $odir/$name $odir/${name}S.${objext}"
9985 if test "$fast_install" = yes && test -n "$relink_command"; then
9986 rmfiles+=" $odir/lt-$name"
9988 if test "X$noexename" != "X$name" ; then
9989 rmfiles+=" $odir/lt-${noexename}.c"
9994 esac
9995 func_show_eval "$RM $rmfiles" 'exit_status=1'
9996 done
9998 # Try to remove the ${objdir}s in the directories where we deleted files
9999 for dir in $rmdirs; do
10000 if test -d "$dir"; then
10001 func_show_eval "rmdir $dir >/dev/null 2>&1"
10003 done
10005 exit $exit_status
10008 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
10009 func_mode_uninstall ${1+"$@"}
10011 test -z "$opt_mode" && {
10012 help="$generic_help"
10013 func_fatal_help "you must specify a MODE"
10016 test -z "$exec_cmd" && \
10017 func_fatal_help "invalid operation mode \`$opt_mode'"
10019 if test -n "$exec_cmd"; then
10020 eval exec "$exec_cmd"
10021 exit $EXIT_FAILURE
10024 exit $exit_status
10027 # The TAGs below are defined such that we never get into a situation
10028 # in which we disable both kinds of libraries. Given conflicting
10029 # choices, we go for a static library, that is the most portable,
10030 # since we can't tell whether shared libraries were disabled because
10031 # the user asked for that or because the platform doesn't support
10032 # them. This is particularly important on AIX, because we don't
10033 # support having both static and shared libraries enabled at the same
10034 # time on that platform, so we default to a shared-only configuration.
10035 # If a disable-shared tag is given, we'll fallback to a static-only
10036 # configuration. But we'll never go from static-only to shared-only.
10038 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
10039 build_libtool_libs=no
10040 build_old_libs=yes
10041 # ### END LIBTOOL TAG CONFIG: disable-shared
10043 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
10044 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
10045 # ### END LIBTOOL TAG CONFIG: disable-static
10047 # Local Variables:
10048 # mode:shell-script
10049 # sh-indentation:2
10050 # End:
10051 # vi:sw=2