Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / cyassl / libtool
blob36db58afbd96762844891543b635bfdb8484d214
1 #! /bin/sh
3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (cyassl) 1.9.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 Free Software Foundation, Inc.
10 # Written by Gordon Matzigkeit, 1996
12 # This file is part of GNU Libtool.
14 # GNU Libtool is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License as
16 # published by the Free Software Foundation; either version 2 of
17 # the License, or (at your option) any later version.
19 # As a special exception to the GNU General Public License,
20 # if you distribute this file as part of a program or library that
21 # is built using GNU Libtool, you may include this file under the
22 # same distribution terms that you use for the rest of that program.
24 # GNU Libtool is distributed in the hope that it will be useful,
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 # GNU General Public License for more details.
29 # You should have received a copy of the GNU General Public License
30 # along with GNU Libtool; see the file COPYING. If not, a copy
31 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
32 # obtained by writing to the Free Software Foundation, Inc.,
33 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
36 # The names of the tagged configurations supported by this script.
37 available_tags=""
39 # ### BEGIN LIBTOOL CONFIG
41 # Assembler program.
42 AS=mipsel-uclibc-as
44 # DLL creation program.
45 DLLTOOL=dlltool
47 # Object dumper program.
48 OBJDUMP=objdump
50 # Which release of libtool.m4 was used?
51 macro_version=2.2.4
52 macro_revision=1.2976
54 # Whether or not to build shared libraries.
55 build_libtool_libs=yes
57 # Whether or not to build static libraries.
58 build_old_libs=yes
60 # What type of objects to build.
61 pic_mode=default
63 # Whether or not to optimize for fast installation.
64 fast_install=yes
66 # The host system.
67 host_alias=mipsel-linux
68 host=mipsel-unknown-linux-gnu
69 host_os=linux-gnu
71 # The build system.
72 build_alias=x86_64-linux-gnu
73 build=x86_64-pc-linux-gnu
74 build_os=linux-gnu
76 # A sed program that does not truncate output.
77 SED="/bin/sed"
79 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
80 Xsed="$SED -e 1s/^X//"
82 # A grep program that handles long lines.
83 GREP="/bin/grep"
85 # An ERE matcher.
86 EGREP="/bin/grep -E"
88 # A literal string matcher.
89 FGREP="/bin/grep -F"
91 # A BSD- or MS-compatible name lister.
92 NM="mipsel-uclibc-nm"
94 # Whether we need soft or hard links.
95 LN_S="ln -s"
97 # What is the maximum length of a command?
98 max_cmd_len=3458764513820540925
100 # Object file suffix (normally "o").
101 objext=o
103 # Executable file suffix (normally "").
104 exeext=
106 # whether the shell understands "unset".
107 lt_unset=unset
109 # turn spaces into newlines.
110 SP2NL="tr \\040 \\012"
112 # turn newlines into spaces.
113 NL2SP="tr \\015\\012 \\040\\040"
115 # How to create reloadable object files.
116 reload_flag=" -r"
117 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
119 # Method to check whether dependent libraries are shared objects.
120 deplibs_check_method="pass_all"
122 # Command to use when deplibs_check_method == "file_magic".
123 file_magic_cmd="\$MAGIC_CMD"
125 # The archiver.
126 AR="mipsel-uclibc-ar"
127 AR_FLAGS="cru"
129 # A symbol stripping program.
130 STRIP="mipsel-uclibc-strip -R .note -R .comment"
132 # Commands used to install an old-style archive.
133 RANLIB="mipsel-uclibc-ranlib"
134 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
135 old_postuninstall_cmds=""
137 # A C compiler.
138 LTCC="mipsel-uclibc-gcc"
140 # LTCC compiler flags.
141 LTCFLAGS="-Os -Wall -DLINUX26 -DCONFIG_BCMWL5 -pipe -DBCMWPA2 -funit-at-a-time -Wno-pointer-sign -mtune=mips32 -mips32 -fPIC -ffunction-sections -fdata-sections -DNO_MD4 -DNO_AES -DNO_ERROR_STRINGS -DNO_HC128 -DNO_RABBIT -DNO_PSK -DNO_DSA -DNO_DH -DNO_PWDBASED -DNDEBUG -DNO_HC128 -DNO_PSK -Wall -Wno-unused -Os -fomit-frame-pointer "
143 # Take the output of nm and produce a listing of raw symbols and C names.
144 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
146 # Transform the output of nm in a proper C declaration.
147 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
149 # Transform the output of nm in a C name address pair.
150 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
152 # Transform the output of nm in a C name address pair when lib prefix is needed.
153 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'"
155 # The name of the directory that contains temporary libtool files.
156 objdir=.libs
158 # Shell to use when invoking shell scripts.
159 SHELL="/bin/sh"
161 # An echo program that does not interpret backslashes.
162 ECHO="echo"
164 # Used to examine libraries when file_magic_cmd begins with "file".
165 MAGIC_CMD=file
167 # Must we lock files when doing compilation?
168 need_locks="no"
170 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
171 DSYMUTIL=""
173 # Tool to change global to local symbols on Mac OS X.
174 NMEDIT=""
176 # Tool to manipulate fat objects and archives on Mac OS X.
177 LIPO=""
179 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
180 OTOOL=""
182 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
183 OTOOL64=""
185 # Old archive suffix (normally "a").
186 libext=a
188 # Shared library suffix (normally ".so").
189 shrext_cmds=".so"
191 # The commands to extract the exported symbol list from a shared archive.
192 extract_expsyms_cmds=""
194 # Variables whose values should be saved in libtool wrapper scripts and
195 # restored at link time.
196 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
198 # Do we need the "lib" prefix for modules?
199 need_lib_prefix=no
201 # Do we need a version for libraries?
202 need_version=no
204 # Library versioning type.
205 version_type=linux
207 # Shared library runtime path variable.
208 runpath_var=LD_RUN_PATH
210 # Shared library path variable.
211 shlibpath_var=LD_LIBRARY_PATH
213 # Is shlibpath searched before the hard-coded library search path?
214 shlibpath_overrides_runpath=no
216 # Format of library name prefix.
217 libname_spec="lib\$name"
219 # List of archive names. First name is the real one, the rest are links.
220 # The last name is the one that the linker finds with -lNAME
221 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
223 # The coded name of the library, if different from the real name.
224 soname_spec="\${libname}\${release}\${shared_ext}\$major"
226 # Command to use after installation of a shared archive.
227 postinstall_cmds=""
229 # Command to use after uninstallation of a shared archive.
230 postuninstall_cmds=""
232 # Commands used to finish a libtool library installation in a directory.
233 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
235 # As "finish_cmds", except a single script fragment to be evaled but
236 # not shown.
237 finish_eval=""
239 # Whether we should hardcode library paths into libraries.
240 hardcode_into_libs=yes
242 # Compile-time system search path for libraries.
243 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"
245 # Run-time system search path for libraries.
246 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 "
248 # Whether dlopen is supported.
249 dlopen_support=unknown
251 # Whether dlopen of programs is supported.
252 dlopen_self=unknown
254 # Whether dlopen of statically linked programs is supported.
255 dlopen_self_static=unknown
257 # Commands to strip libraries.
258 old_striplib="mipsel-uclibc-strip -R .note -R .comment --strip-debug"
259 striplib="mipsel-uclibc-strip -R .note -R .comment --strip-unneeded"
262 # The linker used to build libraries.
263 LD="mipsel-uclibc-ld"
265 # Commands used to build an old-style archive.
266 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
268 # A language specific compiler.
269 CC="mipsel-uclibc-gcc"
271 # Is the compiler the GNU compiler?
272 with_gcc=yes
274 # Compiler flag to turn off builtin functions.
275 no_builtin_flag=" -fno-builtin"
277 # How to pass a linker flag through the compiler.
278 wl="-Wl,"
280 # Additional compiler flags for building library objects.
281 pic_flag=" -fPIC -DPIC"
283 # Compiler flag to prevent dynamic linking.
284 link_static_flag="-static"
286 # Does compiler simultaneously support -c and -o options?
287 compiler_c_o="yes"
289 # Whether or not to add -lc for building shared libraries.
290 build_libtool_need_lc=no
292 # Whether or not to disallow shared libs when runtime libs are static.
293 allow_libtool_libs_with_static_runtimes=no
295 # Compiler flag to allow reflexive dlopens.
296 export_dynamic_flag_spec="\${wl}--export-dynamic"
298 # Compiler flag to generate shared objects directly from archives.
299 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
301 # Whether the compiler copes with passing no objects directly.
302 compiler_needs_object="no"
304 # Create an old-style archive from a shared archive.
305 old_archive_from_new_cmds=""
307 # Create a temporary old-style archive to link instead of a shared archive.
308 old_archive_from_expsyms_cmds=""
310 # Commands used to build a shared archive.
311 archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
312 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
313 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
314 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
315 \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
317 # Commands used to build a loadable module if different from building
318 # a shared archive.
319 module_cmds=""
320 module_expsym_cmds=""
322 # Whether we are building with GNU ld or not.
323 with_gnu_ld="yes"
325 # Flag that allows shared libraries with undefined symbols to be built.
326 allow_undefined_flag=""
328 # Flag that enforces no undefined symbols.
329 no_undefined_flag=""
331 # Flag to hardcode $libdir into a binary during linking.
332 # This must work even if $libdir does not exist
333 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
335 # If ld is used when linking, flag to hardcode $libdir into a binary
336 # during linking. This must work even if $libdir does not exist.
337 hardcode_libdir_flag_spec_ld=""
339 # Whether we need a single "-rpath" flag with a separated argument.
340 hardcode_libdir_separator=""
342 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
343 # DIR into the resulting binary.
344 hardcode_direct=no
346 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
347 # DIR into the resulting binary and the resulting library dependency is
348 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
349 # library is relocated.
350 hardcode_direct_absolute=no
352 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
353 # into the resulting binary.
354 hardcode_minus_L=no
356 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
357 # into the resulting binary.
358 hardcode_shlibpath_var=unsupported
360 # Set to "yes" if building a shared library automatically hardcodes DIR
361 # into the library and all subsequent libraries and executables linked
362 # against it.
363 hardcode_automatic=no
365 # Set to yes if linker adds runtime paths of dependent libraries
366 # to runtime path list.
367 inherit_rpath=no
369 # Whether libtool must link a program against all its dependency libraries.
370 link_all_deplibs=unknown
372 # Fix the shell variable $srcfile for the compiler.
373 fix_srcfile_path=""
375 # Set to "yes" if exported symbols are required.
376 always_export_symbols=no
378 # The commands to list exported symbols.
379 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
381 # Symbols that should not be listed in the preloaded symbols.
382 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
384 # Symbols that must always be exported.
385 include_expsyms=""
387 # Commands necessary for linking programs (against libraries) with templates.
388 prelink_cmds=""
390 # Specify filename containing input files.
391 file_list_spec=""
393 # How to hardcode a shared library path into an executable.
394 hardcode_action=immediate
396 # ### END LIBTOOL CONFIG
398 # Generated from ltmain.m4sh.
400 # ltmain.sh (GNU libtool) 2.2.4
401 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
403 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
404 # This is free software; see the source for copying conditions. There is NO
405 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
407 # GNU Libtool is free software; you can redistribute it and/or modify
408 # it under the terms of the GNU General Public License as published by
409 # the Free Software Foundation; either version 2 of the License, or
410 # (at your option) any later version.
412 # As a special exception to the GNU General Public License,
413 # if you distribute this file as part of a program or library that
414 # is built using GNU Libtool, you may include this file under the
415 # same distribution terms that you use for the rest of that program.
417 # GNU Libtool is distributed in the hope that it will be useful, but
418 # WITHOUT ANY WARRANTY; without even the implied warranty of
419 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
420 # General Public License for more details.
422 # You should have received a copy of the GNU General Public License
423 # along with GNU Libtool; see the file COPYING. If not, a copy
424 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
425 # or obtained by writing to the Free Software Foundation, Inc.,
426 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
428 # Usage: $progname [OPTION]... [MODE-ARG]...
430 # Provide generalized library-building support services.
432 # --config show all configuration variables
433 # --debug enable verbose shell tracing
434 # -n, --dry-run display commands without modifying any files
435 # --features display basic configuration information and exit
436 # --mode=MODE use operation mode MODE
437 # --preserve-dup-deps don't remove duplicate dependency libraries
438 # --quiet, --silent don't print informational messages
439 # --tag=TAG use configuration variables from tag TAG
440 # -v, --verbose print informational messages (default)
441 # --version print version information
442 # -h, --help print short or long help message
444 # MODE must be one of the following:
446 # clean remove files from the build directory
447 # compile compile a source file into a libtool object
448 # execute automatically set library path, then run a program
449 # finish complete the installation of libtool libraries
450 # install install libraries or executables
451 # link create a library or an executable
452 # uninstall remove libraries from an installed directory
454 # MODE-ARGS vary depending on the MODE.
455 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
457 # When reporting a bug, please describe a test case to reproduce it and
458 # include the following information:
460 # host-triplet: $host
461 # shell: $SHELL
462 # compiler: $LTCC
463 # compiler flags: $LTCFLAGS
464 # linker: $LD (gnu? $with_gnu_ld)
465 # $progname: (GNU libtool) 2.2.4
466 # automake: $automake_version
467 # autoconf: $autoconf_version
469 # Report bugs to <bug-libtool@gnu.org>.
471 PROGRAM=ltmain.sh
472 PACKAGE=libtool
473 VERSION=2.2.4
474 TIMESTAMP=""
475 package_revision=1.2976
477 # Be Bourne compatible
478 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
479 emulate sh
480 NULLCMD=:
481 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
482 # is contrary to our usage. Disable this feature.
483 alias -g '${1+"$@"}'='"$@"'
484 setopt NO_GLOB_SUBST
485 else
486 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
488 BIN_SH=xpg4; export BIN_SH # for Tru64
489 DUALCASE=1; export DUALCASE # for MKS sh
491 # NLS nuisances: We save the old values to restore during execute mode.
492 # Only set LANG and LC_ALL to C if already set.
493 # These must not be set unconditionally because not all systems understand
494 # e.g. LANG=C (notably SCO).
495 lt_user_locale=
496 lt_safe_locale=
497 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
499 eval "if test \"\${$lt_var+set}\" = set; then
500 save_$lt_var=\$$lt_var
501 $lt_var=C
502 export $lt_var
503 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
504 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
506 done
508 $lt_unset CDPATH
514 : ${CP="cp -f"}
515 : ${ECHO="echo"}
516 : ${EGREP="/usr/bin/grep -E"}
517 : ${FGREP="/usr/bin/grep -F"}
518 : ${GREP="/usr/bin/grep"}
519 : ${LN_S="ln -s"}
520 : ${MAKE="make"}
521 : ${MKDIR="mkdir"}
522 : ${MV="mv -f"}
523 : ${RM="rm -f"}
524 : ${SED="/opt/local/bin/gsed"}
525 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
526 : ${Xsed="$SED -e 1s/^X//"}
528 # Global variables:
529 EXIT_SUCCESS=0
530 EXIT_FAILURE=1
531 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
532 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
534 exit_status=$EXIT_SUCCESS
536 # Make sure IFS has a sensible default
537 lt_nl='
539 IFS=" $lt_nl"
541 dirname="s,/[^/]*$,,"
542 basename="s,^.*/,,"
544 # func_dirname_and_basename file append nondir_replacement
545 # perform func_basename and func_dirname in a single function
546 # call:
547 # dirname: Compute the dirname of FILE. If nonempty,
548 # add APPEND to the result, otherwise set result
549 # to NONDIR_REPLACEMENT.
550 # value returned in "$func_dirname_result"
551 # basename: Compute filename of FILE.
552 # value retuned in "$func_basename_result"
553 # Implementation must be kept synchronized with func_dirname
554 # and func_basename. For efficiency, we do not delegate to
555 # those functions but instead duplicate the functionality here.
556 func_dirname_and_basename ()
558 # Extract subdirectory from the argument.
559 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
560 if test "X$func_dirname_result" = "X${1}"; then
561 func_dirname_result="${3}"
562 else
563 func_dirname_result="$func_dirname_result${2}"
565 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
568 # Generated shell functions inserted here.
570 # func_dirname file append nondir_replacement
571 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
572 # otherwise set result to NONDIR_REPLACEMENT.
573 func_dirname ()
575 case ${1} in
576 */*) func_dirname_result="${1%/*}${2}" ;;
577 * ) func_dirname_result="${3}" ;;
578 esac
581 # func_basename file
582 func_basename ()
584 func_basename_result="${1##*/}"
587 # func_dirname_and_basename file append nondir_replacement
588 # perform func_basename and func_dirname in a single function
589 # call:
590 # dirname: Compute the dirname of FILE. If nonempty,
591 # add APPEND to the result, otherwise set result
592 # to NONDIR_REPLACEMENT.
593 # value returned in "$func_dirname_result"
594 # basename: Compute filename of FILE.
595 # value retuned in "$func_basename_result"
596 # Implementation must be kept synchronized with func_dirname
597 # and func_basename. For efficiency, we do not delegate to
598 # those functions but instead duplicate the functionality here.
599 func_dirname_and_basename ()
601 case ${1} in
602 */*) func_dirname_result="${1%/*}${2}" ;;
603 * ) func_dirname_result="${3}" ;;
604 esac
605 func_basename_result="${1##*/}"
608 # func_stripname prefix suffix name
609 # strip PREFIX and SUFFIX off of NAME.
610 # PREFIX and SUFFIX must not contain globbing or regex special
611 # characters, hashes, percent signs, but SUFFIX may contain a leading
612 # dot (in which case that matches only a dot).
613 func_stripname ()
615 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
616 # positional parameters, so assign one to ordinary parameter first.
617 func_stripname_result=${3}
618 func_stripname_result=${func_stripname_result#"${1}"}
619 func_stripname_result=${func_stripname_result%"${2}"}
622 # func_opt_split
623 func_opt_split ()
625 func_opt_split_opt=${1%%=*}
626 func_opt_split_arg=${1#*=}
629 # func_lo2o object
630 func_lo2o ()
632 case ${1} in
633 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
634 *) func_lo2o_result=${1} ;;
635 esac
638 # func_xform libobj-or-source
639 func_xform ()
641 func_xform_result=${1%.*}.lo
644 # func_arith arithmetic-term...
645 func_arith ()
647 func_arith_result=$(( $* ))
650 # func_len string
651 # STRING may not start with a hyphen.
652 func_len ()
654 func_len_result=${#1}
658 # func_append var value
659 # Append VALUE to the end of shell variable VAR.
660 func_append ()
662 eval "$1+=\$2"
664 # Generated shell functions inserted here.
666 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
667 # is ksh but when the shell is invoked as "sh" and the current value of
668 # the _XPG environment variable is not equal to 1 (one), the special
669 # positional parameter $0, within a function call, is the name of the
670 # function.
671 progpath="$0"
673 # The name of this program:
674 # In the unlikely event $progname began with a '-', it would play havoc with
675 # func_echo (imagine progname=-n), so we prepend ./ in that case:
676 func_dirname_and_basename "$progpath"
677 progname=$func_basename_result
678 case $progname in
679 -*) progname=./$progname ;;
680 esac
682 # Make sure we have an absolute path for reexecution:
683 case $progpath in
684 [\\/]*|[A-Za-z]:\\*) ;;
685 *[\\/]*)
686 progdir=$func_dirname_result
687 progdir=`cd "$progdir" && pwd`
688 progpath="$progdir/$progname"
691 save_IFS="$IFS"
692 IFS=:
693 for progdir in $PATH; do
694 IFS="$save_IFS"
695 test -x "$progdir/$progname" && break
696 done
697 IFS="$save_IFS"
698 test -n "$progdir" || progdir=`pwd`
699 progpath="$progdir/$progname"
701 esac
703 # Sed substitution that helps us do robust quoting. It backslashifies
704 # metacharacters that are still active within double-quoted strings.
705 Xsed="${SED}"' -e 1s/^X//'
706 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
708 # Same as above, but do not quote variable references.
709 double_quote_subst='s/\(["`\\]\)/\\\1/g'
711 # Re-`\' parameter expansions in output of double_quote_subst that were
712 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
713 # in input to double_quote_subst, that '$' was protected from expansion.
714 # Since each input `\' is now two `\'s, look for any number of runs of
715 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
716 bs='\\'
717 bs2='\\\\'
718 bs4='\\\\\\\\'
719 dollar='\$'
720 sed_double_backslash="\
721 s/$bs4/&\\
723 s/^$bs2$dollar/$bs&/
724 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
725 s/\n//g"
727 # Standard options:
728 opt_dry_run=false
729 opt_help=false
730 opt_quiet=false
731 opt_verbose=false
732 opt_warning=:
734 # func_echo arg...
735 # Echo program name prefixed message, along with the current mode
736 # name if it has been set yet.
737 func_echo ()
739 $ECHO "$progname${mode+: }$mode: $*"
742 # func_verbose arg...
743 # Echo program name prefixed message in verbose mode only.
744 func_verbose ()
746 $opt_verbose && func_echo ${1+"$@"}
748 # A bug in bash halts the script if the last line of a function
749 # fails when set -e is in force, so we need another command to
750 # work around that:
754 # func_error arg...
755 # Echo program name prefixed message to standard error.
756 func_error ()
758 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
761 # func_warning arg...
762 # Echo program name prefixed warning message to standard error.
763 func_warning ()
765 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
767 # bash bug again:
771 # func_fatal_error arg...
772 # Echo program name prefixed message to standard error, and exit.
773 func_fatal_error ()
775 func_error ${1+"$@"}
776 exit $EXIT_FAILURE
779 # func_fatal_help arg...
780 # Echo program name prefixed message to standard error, followed by
781 # a help hint, and exit.
782 func_fatal_help ()
784 func_error ${1+"$@"}
785 func_fatal_error "$help"
787 help="Try \`$progname --help' for more information." ## default
790 # func_grep expression filename
791 # Check whether EXPRESSION matches any line of FILENAME, without output.
792 func_grep ()
794 $GREP "$1" "$2" >/dev/null 2>&1
798 # func_mkdir_p directory-path
799 # Make sure the entire path to DIRECTORY-PATH is available.
800 func_mkdir_p ()
802 my_directory_path="$1"
803 my_dir_list=
805 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
807 # Protect directory names starting with `-'
808 case $my_directory_path in
809 -*) my_directory_path="./$my_directory_path" ;;
810 esac
812 # While some portion of DIR does not yet exist...
813 while test ! -d "$my_directory_path"; do
814 # ...make a list in topmost first order. Use a colon delimited
815 # list incase some portion of path contains whitespace.
816 my_dir_list="$my_directory_path:$my_dir_list"
818 # If the last portion added has no slash in it, the list is done
819 case $my_directory_path in */*) ;; *) break ;; esac
821 # ...otherwise throw away the child directory and loop
822 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
823 done
824 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
826 save_mkdir_p_IFS="$IFS"; IFS=':'
827 for my_dir in $my_dir_list; do
828 IFS="$save_mkdir_p_IFS"
829 # mkdir can fail with a `File exist' error if two processes
830 # try to create one of the directories concurrently. Don't
831 # stop in that case!
832 $MKDIR "$my_dir" 2>/dev/null || :
833 done
834 IFS="$save_mkdir_p_IFS"
836 # Bail out if we (or some other process) failed to create a directory.
837 test -d "$my_directory_path" || \
838 func_fatal_error "Failed to create \`$1'"
843 # func_mktempdir [string]
844 # Make a temporary directory that won't clash with other running
845 # libtool processes, and avoids race conditions if possible. If
846 # given, STRING is the basename for that directory.
847 func_mktempdir ()
849 my_template="${TMPDIR-/tmp}/${1-$progname}"
851 if test "$opt_dry_run" = ":"; then
852 # Return a directory name, but don't create it in dry-run mode
853 my_tmpdir="${my_template}-$$"
854 else
856 # If mktemp works, use that first and foremost
857 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
859 if test ! -d "$my_tmpdir"; then
860 # Failing that, at least try and use $RANDOM to avoid a race
861 my_tmpdir="${my_template}-${RANDOM-0}$$"
863 save_mktempdir_umask=`umask`
864 umask 0077
865 $MKDIR "$my_tmpdir"
866 umask $save_mktempdir_umask
869 # If we're not in dry-run mode, bomb out on failure
870 test -d "$my_tmpdir" || \
871 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
874 $ECHO "X$my_tmpdir" | $Xsed
878 # func_quote_for_eval arg
879 # Aesthetically quote ARG to be evaled later.
880 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
881 # is double-quoted, suitable for a subsequent eval, whereas
882 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
883 # which are still active within double quotes backslashified.
884 func_quote_for_eval ()
886 case $1 in
887 *[\\\`\"\$]*)
888 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
890 func_quote_for_eval_unquoted_result="$1" ;;
891 esac
893 case $func_quote_for_eval_unquoted_result in
894 # Double-quote args containing shell metacharacters to delay
895 # word splitting, command substitution and and variable
896 # expansion for a subsequent eval.
897 # Many Bourne shells cannot handle close brackets correctly
898 # in scan sets, so we specify it separately.
899 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
900 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
903 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
904 esac
908 # func_quote_for_expand arg
909 # Aesthetically quote ARG to be evaled later; same as above,
910 # but do not quote variable references.
911 func_quote_for_expand ()
913 case $1 in
914 *[\\\`\"]*)
915 my_arg=`$ECHO "X$1" | $Xsed \
916 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
918 my_arg="$1" ;;
919 esac
921 case $my_arg in
922 # Double-quote args containing shell metacharacters to delay
923 # word splitting and command substitution for a subsequent eval.
924 # Many Bourne shells cannot handle close brackets correctly
925 # in scan sets, so we specify it separately.
926 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
927 my_arg="\"$my_arg\""
929 esac
931 func_quote_for_expand_result="$my_arg"
935 # func_show_eval cmd [fail_exp]
936 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
937 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
938 # is given, then evaluate it.
939 func_show_eval ()
941 my_cmd="$1"
942 my_fail_exp="${2-:}"
944 ${opt_silent-false} || {
945 func_quote_for_expand "$my_cmd"
946 eval "func_echo $func_quote_for_expand_result"
949 if ${opt_dry_run-false}; then :; else
950 eval "$my_cmd"
951 my_status=$?
952 if test "$my_status" -eq 0; then :; else
953 eval "(exit $my_status); $my_fail_exp"
959 # func_show_eval_locale cmd [fail_exp]
960 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
961 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
962 # is given, then evaluate it. Use the saved locale for evaluation.
963 func_show_eval_locale ()
965 my_cmd="$1"
966 my_fail_exp="${2-:}"
968 ${opt_silent-false} || {
969 func_quote_for_expand "$my_cmd"
970 eval "func_echo $func_quote_for_expand_result"
973 if ${opt_dry_run-false}; then :; else
974 eval "$lt_user_locale
975 $my_cmd"
976 my_status=$?
977 eval "$lt_safe_locale"
978 if test "$my_status" -eq 0; then :; else
979 eval "(exit $my_status); $my_fail_exp"
988 # func_version
989 # Echo version message to standard output and exit.
990 func_version ()
992 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
993 s/^# //
994 s/^# *$//
995 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
997 }' < "$progpath"
998 exit $?
1001 # func_usage
1002 # Echo short help message to standard output and exit.
1003 func_usage ()
1005 $SED -n '/^# Usage:/,/# -h/ {
1006 s/^# //
1007 s/^# *$//
1008 s/\$progname/'$progname'/
1010 }' < "$progpath"
1011 $ECHO
1012 $ECHO "run \`$progname --help | more' for full usage"
1013 exit $?
1016 # func_help
1017 # Echo long help message to standard output and exit.
1018 func_help ()
1020 $SED -n '/^# Usage:/,/# Report bugs to/ {
1021 s/^# //
1022 s/^# *$//
1023 s*\$progname*'$progname'*
1024 s*\$host*'"$host"'*
1025 s*\$SHELL*'"$SHELL"'*
1026 s*\$LTCC*'"$LTCC"'*
1027 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1028 s*\$LD*'"$LD"'*
1029 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1030 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1031 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1033 }' < "$progpath"
1034 exit $?
1037 # func_missing_arg argname
1038 # Echo program name prefixed message to standard error and set global
1039 # exit_cmd.
1040 func_missing_arg ()
1042 func_error "missing argument for $1"
1043 exit_cmd=exit
1046 exit_cmd=:
1052 # Check that we have a working $ECHO.
1053 if test "X$1" = X--no-reexec; then
1054 # Discard the --no-reexec flag, and continue.
1055 shift
1056 elif test "X$1" = X--fallback-echo; then
1057 # Avoid inline document here, it may be left over
1059 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
1060 # Yippee, $ECHO works!
1062 else
1063 # Restart under the correct shell, and then maybe $ECHO will work.
1064 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
1067 if test "X$1" = X--fallback-echo; then
1068 # used as fallback echo
1069 shift
1070 cat <<EOF
1073 exit $EXIT_SUCCESS
1076 magic="%%%MAGIC variable%%%"
1077 magic_exe="%%%MAGIC EXE variable%%%"
1079 # Global variables.
1080 # $mode is unset
1081 nonopt=
1082 execute_dlfiles=
1083 preserve_args=
1084 lo2o="s/\\.lo\$/.${objext}/"
1085 o2lo="s/\\.${objext}\$/.lo/"
1086 extracted_archives=
1087 extracted_serial=0
1089 opt_dry_run=false
1090 opt_duplicate_deps=false
1091 opt_silent=false
1092 opt_debug=:
1094 # If this variable is set in any of the actions, the command in it
1095 # will be execed at the end. This prevents here-documents from being
1096 # left over by shells.
1097 exec_cmd=
1099 # func_fatal_configuration arg...
1100 # Echo program name prefixed message to standard error, followed by
1101 # a configuration failure hint, and exit.
1102 func_fatal_configuration ()
1104 func_error ${1+"$@"}
1105 func_error "See the $PACKAGE documentation for more information."
1106 func_fatal_error "Fatal configuration error."
1110 # func_config
1111 # Display the configuration for all the tags in this script.
1112 func_config ()
1114 re_begincf='^# ### BEGIN LIBTOOL'
1115 re_endcf='^# ### END LIBTOOL'
1117 # Default configuration.
1118 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1120 # Now print the configurations for the tags.
1121 for tagname in $taglist; do
1122 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1123 done
1125 exit $?
1128 # func_features
1129 # Display the features supported by this script.
1130 func_features ()
1132 $ECHO "host: $host"
1133 if test "$build_libtool_libs" = yes; then
1134 $ECHO "enable shared libraries"
1135 else
1136 $ECHO "disable shared libraries"
1138 if test "$build_old_libs" = yes; then
1139 $ECHO "enable static libraries"
1140 else
1141 $ECHO "disable static libraries"
1144 exit $?
1147 # func_enable_tag tagname
1148 # Verify that TAGNAME is valid, and either flag an error and exit, or
1149 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1150 # variable here.
1151 func_enable_tag ()
1153 # Global variable:
1154 tagname="$1"
1156 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1157 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1158 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1160 # Validate tagname.
1161 case $tagname in
1162 *[!-_A-Za-z0-9,/]*)
1163 func_fatal_error "invalid tag name: $tagname"
1165 esac
1167 # Don't test for the "default" C tag, as we know it's
1168 # there but not specially marked.
1169 case $tagname in
1170 CC) ;;
1172 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1173 taglist="$taglist $tagname"
1175 # Evaluate the configuration. Be careful to quote the path
1176 # and the sed script, to avoid splitting on whitespace, but
1177 # also don't use non-portable quotes within backquotes within
1178 # quotes we have to do it in 2 steps:
1179 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1180 eval "$extractedcf"
1181 else
1182 func_error "ignoring unknown tag $tagname"
1185 esac
1188 # Parse options once, thoroughly. This comes as soon as possible in
1189 # the script to make things like `libtool --version' happen quickly.
1192 # Shorthand for --mode=foo, only valid as the first argument
1193 case $1 in
1194 clean|clea|cle|cl)
1195 shift; set dummy --mode clean ${1+"$@"}; shift
1197 compile|compil|compi|comp|com|co|c)
1198 shift; set dummy --mode compile ${1+"$@"}; shift
1200 execute|execut|execu|exec|exe|ex|e)
1201 shift; set dummy --mode execute ${1+"$@"}; shift
1203 finish|finis|fini|fin|fi|f)
1204 shift; set dummy --mode finish ${1+"$@"}; shift
1206 install|instal|insta|inst|ins|in|i)
1207 shift; set dummy --mode install ${1+"$@"}; shift
1209 link|lin|li|l)
1210 shift; set dummy --mode link ${1+"$@"}; shift
1212 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1213 shift; set dummy --mode uninstall ${1+"$@"}; shift
1215 esac
1217 # Parse non-mode specific arguments:
1218 while test "$#" -gt 0; do
1219 opt="$1"
1220 shift
1222 case $opt in
1223 --config) func_config ;;
1225 --debug) preserve_args="$preserve_args $opt"
1226 func_echo "enabling shell trace mode"
1227 opt_debug='set -x'
1228 $opt_debug
1231 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
1232 execute_dlfiles="$execute_dlfiles $1"
1233 shift
1236 --dry-run | -n) opt_dry_run=: ;;
1237 --features) func_features ;;
1238 --finish) mode="finish" ;;
1240 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
1241 case $1 in
1242 # Valid mode arguments:
1243 clean) ;;
1244 compile) ;;
1245 execute) ;;
1246 finish) ;;
1247 install) ;;
1248 link) ;;
1249 relink) ;;
1250 uninstall) ;;
1252 # Catch anything else as an error
1253 *) func_error "invalid argument for $opt"
1254 exit_cmd=exit
1255 break
1257 esac
1259 mode="$1"
1260 shift
1263 --preserve-dup-deps)
1264 opt_duplicate_deps=: ;;
1266 --quiet|--silent) preserve_args="$preserve_args $opt"
1267 opt_silent=:
1270 --verbose| -v) preserve_args="$preserve_args $opt"
1271 opt_silent=false
1274 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
1275 preserve_args="$preserve_args $opt $1"
1276 func_enable_tag "$1" # tagname is set here
1277 shift
1280 # Separate optargs to long options:
1281 -dlopen=*|--mode=*|--tag=*)
1282 func_opt_split "$opt"
1283 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
1284 shift
1287 -\?|-h) func_usage ;;
1288 --help) opt_help=: ;;
1289 --version) func_version ;;
1291 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1293 *) nonopt="$opt"
1294 break
1296 esac
1297 done
1300 case $host in
1301 *cygwin* | *mingw* | *pw32*)
1302 # don't eliminate duplications in $postdeps and $predeps
1303 opt_duplicate_compiler_generated_deps=:
1306 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
1308 esac
1310 # Having warned about all mis-specified options, bail out if
1311 # anything was wrong.
1312 $exit_cmd $EXIT_FAILURE
1315 # func_check_version_match
1316 # Ensure that we are using m4 macros, and libtool script from the same
1317 # release of libtool.
1318 func_check_version_match ()
1320 if test "$package_revision" != "$macro_revision"; then
1321 if test "$VERSION" != "$macro_version"; then
1322 if test -z "$macro_version"; then
1323 cat >&2 <<_LT_EOF
1324 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1325 $progname: definition of this LT_INIT comes from an older release.
1326 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1327 $progname: and run autoconf again.
1328 _LT_EOF
1329 else
1330 cat >&2 <<_LT_EOF
1331 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1332 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1333 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1334 $progname: and run autoconf again.
1335 _LT_EOF
1337 else
1338 cat >&2 <<_LT_EOF
1339 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1340 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1341 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1342 $progname: of $PACKAGE $VERSION and run autoconf again.
1343 _LT_EOF
1346 exit $EXIT_MISMATCH
1351 ## ----------- ##
1352 ## Main. ##
1353 ## ----------- ##
1355 $opt_help || {
1356 # Sanity checks first:
1357 func_check_version_match
1359 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1360 func_fatal_configuration "not configured to build any kind of library"
1363 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1366 # Darwin sucks
1367 eval std_shrext=\"$shrext_cmds\"
1370 # Only execute mode is allowed to have -dlopen flags.
1371 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1372 func_error "unrecognized option \`-dlopen'"
1373 $ECHO "$help" 1>&2
1374 exit $EXIT_FAILURE
1377 # Change the help message to a mode-specific one.
1378 generic_help="$help"
1379 help="Try \`$progname --help --mode=$mode' for more information."
1383 # func_lalib_p file
1384 # True iff FILE is a libtool `.la' library or `.lo' object file.
1385 # This function is only a basic sanity check; it will hardly flush out
1386 # determined imposters.
1387 func_lalib_p ()
1389 $SED -e 4q "$1" 2>/dev/null \
1390 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1393 # func_lalib_unsafe_p file
1394 # True iff FILE is a libtool `.la' library or `.lo' object file.
1395 # This function implements the same check as func_lalib_p without
1396 # resorting to external programs. To this end, it redirects stdin and
1397 # closes it afterwards, without saving the original file descriptor.
1398 # As a safety measure, use it only where a negative result would be
1399 # fatal anyway. Works if `file' does not exist.
1400 func_lalib_unsafe_p ()
1402 lalib_p=no
1403 if test -r "$1" && exec 5<&0 <"$1"; then
1404 for lalib_p_l in 1 2 3 4
1406 read lalib_p_line
1407 case "$lalib_p_line" in
1408 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1409 esac
1410 done
1411 exec 0<&5 5<&-
1413 test "$lalib_p" = yes
1416 # func_ltwrapper_script_p file
1417 # True iff FILE is a libtool wrapper script
1418 # This function is only a basic sanity check; it will hardly flush out
1419 # determined imposters.
1420 func_ltwrapper_script_p ()
1422 func_lalib_p "$1"
1425 # func_ltwrapper_executable_p file
1426 # True iff FILE is a libtool wrapper executable
1427 # This function is only a basic sanity check; it will hardly flush out
1428 # determined imposters.
1429 func_ltwrapper_executable_p ()
1431 func_ltwrapper_exec_suffix=
1432 case $1 in
1433 *.exe) ;;
1434 *) func_ltwrapper_exec_suffix=.exe ;;
1435 esac
1436 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1439 # func_ltwrapper_scriptname file
1440 # Assumes file is an ltwrapper_executable
1441 # uses $file to determine the appropriate filename for a
1442 # temporary ltwrapper_script.
1443 func_ltwrapper_scriptname ()
1445 func_ltwrapper_scriptname_result=""
1446 if func_ltwrapper_executable_p "$1"; then
1447 func_dirname_and_basename "$1" "" "."
1448 func_stripname '' '.exe' "$func_basename_result"
1449 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1453 # func_ltwrapper_p file
1454 # True iff FILE is a libtool wrapper script or wrapper executable
1455 # This function is only a basic sanity check; it will hardly flush out
1456 # determined imposters.
1457 func_ltwrapper_p ()
1459 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1463 # func_execute_cmds commands fail_cmd
1464 # Execute tilde-delimited COMMANDS.
1465 # If FAIL_CMD is given, eval that upon failure.
1466 # FAIL_CMD may read-access the current command in variable CMD!
1467 func_execute_cmds ()
1469 $opt_debug
1470 save_ifs=$IFS; IFS='~'
1471 for cmd in $1; do
1472 IFS=$save_ifs
1473 eval cmd=\"$cmd\"
1474 func_show_eval "$cmd" "${2-:}"
1475 done
1476 IFS=$save_ifs
1480 # func_source file
1481 # Source FILE, adding directory component if necessary.
1482 # Note that it is not necessary on cygwin/mingw to append a dot to
1483 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1484 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1485 # `FILE.' does not work on cygwin managed mounts.
1486 func_source ()
1488 $opt_debug
1489 case $1 in
1490 */* | *\\*) . "$1" ;;
1491 *) . "./$1" ;;
1492 esac
1496 # func_infer_tag arg
1497 # Infer tagged configuration to use if any are available and
1498 # if one wasn't chosen via the "--tag" command line option.
1499 # Only attempt this if the compiler in the base compile
1500 # command doesn't match the default compiler.
1501 # arg is usually of the form 'gcc ...'
1502 func_infer_tag ()
1504 $opt_debug
1505 if test -n "$available_tags" && test -z "$tagname"; then
1506 CC_quoted=
1507 for arg in $CC; do
1508 func_quote_for_eval "$arg"
1509 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1510 done
1511 case $@ in
1512 # Blanks in the command may have been stripped by the calling shell,
1513 # but not from the CC environment variable when configure was run.
1514 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1515 # Blanks at the start of $base_compile will cause this to fail
1516 # if we don't check for them as well.
1518 for z in $available_tags; do
1519 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1520 # Evaluate the configuration.
1521 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1522 CC_quoted=
1523 for arg in $CC; do
1524 # Double-quote args containing other shell metacharacters.
1525 func_quote_for_eval "$arg"
1526 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1527 done
1528 case "$@ " in
1529 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1530 # The compiler in the base compile command matches
1531 # the one in the tagged configuration.
1532 # Assume this is the tagged configuration we want.
1533 tagname=$z
1534 break
1536 esac
1538 done
1539 # If $tagname still isn't set, then no tagged configuration
1540 # was found and let the user know that the "--tag" command
1541 # line option must be used.
1542 if test -z "$tagname"; then
1543 func_echo "unable to infer tagged configuration"
1544 func_fatal_error "specify a tag with \`--tag'"
1545 # else
1546 # func_verbose "using $tagname tagged configuration"
1549 esac
1555 # func_write_libtool_object output_name pic_name nonpic_name
1556 # Create a libtool object file (analogous to a ".la" file),
1557 # but don't create it if we're doing a dry run.
1558 func_write_libtool_object ()
1560 write_libobj=${1}
1561 if test "$build_libtool_libs" = yes; then
1562 write_lobj=\'${2}\'
1563 else
1564 write_lobj=none
1567 if test "$build_old_libs" = yes; then
1568 write_oldobj=\'${3}\'
1569 else
1570 write_oldobj=none
1573 $opt_dry_run || {
1574 cat >${write_libobj}T <<EOF
1575 # $write_libobj - a libtool object file
1576 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1578 # Please DO NOT delete this file!
1579 # It is necessary for linking the library.
1581 # Name of the PIC object.
1582 pic_object=$write_lobj
1584 # Name of the non-PIC object
1585 non_pic_object=$write_oldobj
1588 $MV "${write_libobj}T" "${write_libobj}"
1592 # func_mode_compile arg...
1593 func_mode_compile ()
1595 $opt_debug
1596 # Get the compilation command and the source file.
1597 base_compile=
1598 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1599 suppress_opt=yes
1600 suppress_output=
1601 arg_mode=normal
1602 libobj=
1603 later=
1604 pie_flag=
1606 for arg
1608 case $arg_mode in
1609 arg )
1610 # do not "continue". Instead, add this to base_compile
1611 lastarg="$arg"
1612 arg_mode=normal
1615 target )
1616 libobj="$arg"
1617 arg_mode=normal
1618 continue
1621 normal )
1622 # Accept any command-line options.
1623 case $arg in
1625 test -n "$libobj" && \
1626 func_fatal_error "you cannot specify \`-o' more than once"
1627 arg_mode=target
1628 continue
1631 -pie | -fpie | -fPIE)
1632 pie_flag="$pie_flag $arg"
1633 continue
1636 -shared | -static | -prefer-pic | -prefer-non-pic)
1637 later="$later $arg"
1638 continue
1641 -no-suppress)
1642 suppress_opt=no
1643 continue
1646 -Xcompiler)
1647 arg_mode=arg # the next one goes into the "base_compile" arg list
1648 continue # The current "srcfile" will either be retained or
1649 ;; # replaced later. I would guess that would be a bug.
1651 -Wc,*)
1652 func_stripname '-Wc,' '' "$arg"
1653 args=$func_stripname_result
1654 lastarg=
1655 save_ifs="$IFS"; IFS=','
1656 for arg in $args; do
1657 IFS="$save_ifs"
1658 func_quote_for_eval "$arg"
1659 lastarg="$lastarg $func_quote_for_eval_result"
1660 done
1661 IFS="$save_ifs"
1662 func_stripname ' ' '' "$lastarg"
1663 lastarg=$func_stripname_result
1665 # Add the arguments to base_compile.
1666 base_compile="$base_compile $lastarg"
1667 continue
1671 # Accept the current argument as the source file.
1672 # The previous "srcfile" becomes the current argument.
1674 lastarg="$srcfile"
1675 srcfile="$arg"
1677 esac # case $arg
1679 esac # case $arg_mode
1681 # Aesthetically quote the previous argument.
1682 func_quote_for_eval "$lastarg"
1683 base_compile="$base_compile $func_quote_for_eval_result"
1684 done # for arg
1686 case $arg_mode in
1687 arg)
1688 func_fatal_error "you must specify an argument for -Xcompile"
1690 target)
1691 func_fatal_error "you must specify a target with \`-o'"
1694 # Get the name of the library object.
1695 test -z "$libobj" && {
1696 func_basename "$srcfile"
1697 libobj="$func_basename_result"
1700 esac
1702 # Recognize several different file suffixes.
1703 # If the user specifies -o file.o, it is replaced with file.lo
1704 case $libobj in
1705 *.[cCFSifmso] | \
1706 *.ada | *.adb | *.ads | *.asm | \
1707 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1708 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1709 func_xform "$libobj"
1710 libobj=$func_xform_result
1712 esac
1714 case $libobj in
1715 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1717 func_fatal_error "cannot determine name of library object from \`$libobj'"
1719 esac
1721 func_infer_tag $base_compile
1723 for arg in $later; do
1724 case $arg in
1725 -shared)
1726 test "$build_libtool_libs" != yes && \
1727 func_fatal_configuration "can not build a shared library"
1728 build_old_libs=no
1729 continue
1732 -static)
1733 build_libtool_libs=no
1734 build_old_libs=yes
1735 continue
1738 -prefer-pic)
1739 pic_mode=yes
1740 continue
1743 -prefer-non-pic)
1744 pic_mode=no
1745 continue
1747 esac
1748 done
1750 func_quote_for_eval "$libobj"
1751 test "X$libobj" != "X$func_quote_for_eval_result" \
1752 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1753 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1754 func_dirname_and_basename "$obj" "/" ""
1755 objname="$func_basename_result"
1756 xdir="$func_dirname_result"
1757 lobj=${xdir}$objdir/$objname
1759 test -z "$base_compile" && \
1760 func_fatal_help "you must specify a compilation command"
1762 # Delete any leftover library objects.
1763 if test "$build_old_libs" = yes; then
1764 removelist="$obj $lobj $libobj ${libobj}T"
1765 else
1766 removelist="$lobj $libobj ${libobj}T"
1769 # On Cygwin there's no "real" PIC flag so we must build both object types
1770 case $host_os in
1771 cygwin* | mingw* | pw32* | os2*)
1772 pic_mode=default
1774 esac
1775 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1776 # non-PIC code in shared libraries is not supported
1777 pic_mode=default
1780 # Calculate the filename of the output object if compiler does
1781 # not support -o with -c
1782 if test "$compiler_c_o" = no; then
1783 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1784 lockfile="$output_obj.lock"
1785 else
1786 output_obj=
1787 need_locks=no
1788 lockfile=
1791 # Lock this critical section if it is needed
1792 # We use this script file to make the link, it avoids creating a new file
1793 if test "$need_locks" = yes; then
1794 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1795 func_echo "Waiting for $lockfile to be removed"
1796 sleep 2
1797 done
1798 elif test "$need_locks" = warn; then
1799 if test -f "$lockfile"; then
1800 $ECHO "\
1801 *** ERROR, $lockfile exists and contains:
1802 `cat $lockfile 2>/dev/null`
1804 This indicates that another process is trying to use the same
1805 temporary object file, and libtool could not work around it because
1806 your compiler does not support \`-c' and \`-o' together. If you
1807 repeat this compilation, it may succeed, by chance, but you had better
1808 avoid parallel builds (make -j) in this platform, or get a better
1809 compiler."
1811 $opt_dry_run || $RM $removelist
1812 exit $EXIT_FAILURE
1814 removelist="$removelist $output_obj"
1815 $ECHO "$srcfile" > "$lockfile"
1818 $opt_dry_run || $RM $removelist
1819 removelist="$removelist $lockfile"
1820 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1822 if test -n "$fix_srcfile_path"; then
1823 eval srcfile=\"$fix_srcfile_path\"
1825 func_quote_for_eval "$srcfile"
1826 qsrcfile=$func_quote_for_eval_result
1828 # Only build a PIC object if we are building libtool libraries.
1829 if test "$build_libtool_libs" = yes; then
1830 # Without this assignment, base_compile gets emptied.
1831 fbsd_hideous_sh_bug=$base_compile
1833 if test "$pic_mode" != no; then
1834 command="$base_compile $qsrcfile $pic_flag"
1835 else
1836 # Don't build PIC code
1837 command="$base_compile $qsrcfile"
1840 func_mkdir_p "$xdir$objdir"
1842 if test -z "$output_obj"; then
1843 # Place PIC objects in $objdir
1844 command="$command -o $lobj"
1847 func_show_eval_locale "$command" \
1848 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1850 if test "$need_locks" = warn &&
1851 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1852 $ECHO "\
1853 *** ERROR, $lockfile contains:
1854 `cat $lockfile 2>/dev/null`
1856 but it should contain:
1857 $srcfile
1859 This indicates that another process is trying to use the same
1860 temporary object file, and libtool could not work around it because
1861 your compiler does not support \`-c' and \`-o' together. If you
1862 repeat this compilation, it may succeed, by chance, but you had better
1863 avoid parallel builds (make -j) in this platform, or get a better
1864 compiler."
1866 $opt_dry_run || $RM $removelist
1867 exit $EXIT_FAILURE
1870 # Just move the object if needed, then go on to compile the next one
1871 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1872 func_show_eval '$MV "$output_obj" "$lobj"' \
1873 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1876 # Allow error messages only from the first compilation.
1877 if test "$suppress_opt" = yes; then
1878 suppress_output=' >/dev/null 2>&1'
1882 # Only build a position-dependent object if we build old libraries.
1883 if test "$build_old_libs" = yes; then
1884 if test "$pic_mode" != yes; then
1885 # Don't build PIC code
1886 command="$base_compile $qsrcfile$pie_flag"
1887 else
1888 command="$base_compile $qsrcfile $pic_flag"
1890 if test "$compiler_c_o" = yes; then
1891 command="$command -o $obj"
1894 # Suppress compiler output if we already did a PIC compilation.
1895 command="$command$suppress_output"
1896 func_show_eval_locale "$command" \
1897 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1899 if test "$need_locks" = warn &&
1900 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1901 $ECHO "\
1902 *** ERROR, $lockfile contains:
1903 `cat $lockfile 2>/dev/null`
1905 but it should contain:
1906 $srcfile
1908 This indicates that another process is trying to use the same
1909 temporary object file, and libtool could not work around it because
1910 your compiler does not support \`-c' and \`-o' together. If you
1911 repeat this compilation, it may succeed, by chance, but you had better
1912 avoid parallel builds (make -j) in this platform, or get a better
1913 compiler."
1915 $opt_dry_run || $RM $removelist
1916 exit $EXIT_FAILURE
1919 # Just move the object if needed
1920 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1921 func_show_eval '$MV "$output_obj" "$obj"' \
1922 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1926 $opt_dry_run || {
1927 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1929 # Unlock the critical section if it was locked
1930 if test "$need_locks" != no; then
1931 removelist=$lockfile
1932 $RM "$lockfile"
1936 exit $EXIT_SUCCESS
1939 $opt_help || {
1940 test "$mode" = compile && func_mode_compile ${1+"$@"}
1943 func_mode_help ()
1945 # We need to display help for each of the modes.
1946 case $mode in
1948 # Generic help is extracted from the usage comments
1949 # at the start of this file.
1950 func_help
1953 clean)
1954 $ECHO \
1955 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1957 Remove files from the build directory.
1959 RM is the name of the program to use to delete files associated with each FILE
1960 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1961 to RM.
1963 If FILE is a libtool library, object or program, all the files associated
1964 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1967 compile)
1968 $ECHO \
1969 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1971 Compile a source file into a libtool library object.
1973 This mode accepts the following additional options:
1975 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1976 -no-suppress do not suppress compiler output for multiple passes
1977 -prefer-pic try to building PIC objects only
1978 -prefer-non-pic try to building non-PIC objects only
1979 -shared do not build a \`.o' file suitable for static linking
1980 -static only build a \`.o' file suitable for static linking
1982 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1983 from the given SOURCEFILE.
1985 The output file name is determined by removing the directory component from
1986 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1987 library object suffix, \`.lo'."
1990 execute)
1991 $ECHO \
1992 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1994 Automatically set library path, then run a program.
1996 This mode accepts the following additional options:
1998 -dlopen FILE add the directory containing FILE to the library path
2000 This mode sets the library path environment variable according to \`-dlopen'
2001 flags.
2003 If any of the ARGS are libtool executable wrappers, then they are translated
2004 into their corresponding uninstalled binary, and any of their required library
2005 directories are added to the library path.
2007 Then, COMMAND is executed, with ARGS as arguments."
2010 finish)
2011 $ECHO \
2012 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2014 Complete the installation of libtool libraries.
2016 Each LIBDIR is a directory that contains libtool libraries.
2018 The commands that this mode executes may require superuser privileges. Use
2019 the \`--dry-run' option if you just want to see what would be executed."
2022 install)
2023 $ECHO \
2024 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2026 Install executables or libraries.
2028 INSTALL-COMMAND is the installation command. The first component should be
2029 either the \`install' or \`cp' program.
2031 The following components of INSTALL-COMMAND are treated specially:
2033 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2035 The rest of the components are interpreted as arguments to that command (only
2036 BSD-compatible install options are recognized)."
2039 link)
2040 $ECHO \
2041 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2043 Link object files or libraries together to form another library, or to
2044 create an executable program.
2046 LINK-COMMAND is a command using the C compiler that you would use to create
2047 a program from several object files.
2049 The following components of LINK-COMMAND are treated specially:
2051 -all-static do not do any dynamic linking at all
2052 -avoid-version do not add a version suffix if possible
2053 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2054 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2055 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2056 -export-symbols SYMFILE
2057 try to export only the symbols listed in SYMFILE
2058 -export-symbols-regex REGEX
2059 try to export only the symbols matching REGEX
2060 -LLIBDIR search LIBDIR for required installed libraries
2061 -lNAME OUTPUT-FILE requires the installed library libNAME
2062 -module build a library that can dlopened
2063 -no-fast-install disable the fast-install mode
2064 -no-install link a not-installable executable
2065 -no-undefined declare that a library does not refer to external symbols
2066 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2067 -objectlist FILE Use a list of object files found in FILE to specify objects
2068 -precious-files-regex REGEX
2069 don't remove output files matching REGEX
2070 -release RELEASE specify package release information
2071 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2072 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2073 -shared only do dynamic linking of libtool libraries
2074 -shrext SUFFIX override the standard shared library file extension
2075 -static do not do any dynamic linking of uninstalled libtool libraries
2076 -static-libtool-libs
2077 do not do any dynamic linking of libtool libraries
2078 -version-info CURRENT[:REVISION[:AGE]]
2079 specify library version info [each variable defaults to 0]
2080 -weak LIBNAME declare that the target provides the LIBNAME interface
2082 All other options (arguments beginning with \`-') are ignored.
2084 Every other argument is treated as a filename. Files ending in \`.la' are
2085 treated as uninstalled libtool libraries, other files are standard or library
2086 object files.
2088 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2089 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2090 required, except when creating a convenience library.
2092 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2093 using \`ar' and \`ranlib', or on Windows using \`lib'.
2095 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2096 is created, otherwise an executable program is created."
2099 uninstall)
2100 $ECHO \
2101 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2103 Remove libraries from an installation directory.
2105 RM is the name of the program to use to delete files associated with each FILE
2106 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2107 to RM.
2109 If FILE is a libtool library, all the files associated with it are deleted.
2110 Otherwise, only FILE itself is deleted using RM."
2114 func_fatal_help "invalid operation mode \`$mode'"
2116 esac
2118 $ECHO
2119 $ECHO "Try \`$progname --help' for more information about other modes."
2121 exit $?
2124 # Now that we've collected a possible --mode arg, show help if necessary
2125 $opt_help && func_mode_help
2128 # func_mode_execute arg...
2129 func_mode_execute ()
2131 $opt_debug
2132 # The first argument is the command name.
2133 cmd="$nonopt"
2134 test -z "$cmd" && \
2135 func_fatal_help "you must specify a COMMAND"
2137 # Handle -dlopen flags immediately.
2138 for file in $execute_dlfiles; do
2139 test -f "$file" \
2140 || func_fatal_help "\`$file' is not a file"
2142 dir=
2143 case $file in
2144 *.la)
2145 # Check to see that this really is a libtool archive.
2146 func_lalib_unsafe_p "$file" \
2147 || func_fatal_help "\`$lib' is not a valid libtool archive"
2149 # Read the libtool library.
2150 dlname=
2151 library_names=
2152 func_source "$file"
2154 # Skip this library if it cannot be dlopened.
2155 if test -z "$dlname"; then
2156 # Warn if it was a shared library.
2157 test -n "$library_names" && \
2158 func_warning "\`$file' was not linked with \`-export-dynamic'"
2159 continue
2162 func_dirname "$file" "" "."
2163 dir="$func_dirname_result"
2165 if test -f "$dir/$objdir/$dlname"; then
2166 dir="$dir/$objdir"
2167 else
2168 if test ! -f "$dir/$dlname"; then
2169 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2174 *.lo)
2175 # Just add the directory containing the .lo file.
2176 func_dirname "$file" "" "."
2177 dir="$func_dirname_result"
2181 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2182 continue
2184 esac
2186 # Get the absolute pathname.
2187 absdir=`cd "$dir" && pwd`
2188 test -n "$absdir" && dir="$absdir"
2190 # Now add the directory to shlibpath_var.
2191 if eval "test -z \"\$$shlibpath_var\""; then
2192 eval "$shlibpath_var=\"\$dir\""
2193 else
2194 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2196 done
2198 # This variable tells wrapper scripts just to set shlibpath_var
2199 # rather than running their programs.
2200 libtool_execute_magic="$magic"
2202 # Check if any of the arguments is a wrapper script.
2203 args=
2204 for file
2206 case $file in
2207 -*) ;;
2209 # Do a test to see if this is really a libtool program.
2210 if func_ltwrapper_script_p "$file"; then
2211 func_source "$file"
2212 # Transform arg to wrapped name.
2213 file="$progdir/$program"
2214 elif func_ltwrapper_executable_p "$file"; then
2215 func_ltwrapper_scriptname "$file"
2216 func_source "$func_ltwrapper_scriptname_result"
2217 # Transform arg to wrapped name.
2218 file="$progdir/$program"
2221 esac
2222 # Quote arguments (to preserve shell metacharacters).
2223 func_quote_for_eval "$file"
2224 args="$args $func_quote_for_eval_result"
2225 done
2227 if test "X$opt_dry_run" = Xfalse; then
2228 if test -n "$shlibpath_var"; then
2229 # Export the shlibpath_var.
2230 eval "export $shlibpath_var"
2233 # Restore saved environment variables
2234 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2236 eval "if test \"\${save_$lt_var+set}\" = set; then
2237 $lt_var=\$save_$lt_var; export $lt_var
2238 else
2239 $lt_unset $lt_var
2241 done
2243 # Now prepare to actually exec the command.
2244 exec_cmd="\$cmd$args"
2245 else
2246 # Display what would be done.
2247 if test -n "$shlibpath_var"; then
2248 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2249 $ECHO "export $shlibpath_var"
2251 $ECHO "$cmd$args"
2252 exit $EXIT_SUCCESS
2256 test "$mode" = execute && func_mode_execute ${1+"$@"}
2259 # func_mode_finish arg...
2260 func_mode_finish ()
2262 $opt_debug
2263 libdirs="$nonopt"
2264 admincmds=
2266 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2267 for dir
2269 libdirs="$libdirs $dir"
2270 done
2272 for libdir in $libdirs; do
2273 if test -n "$finish_cmds"; then
2274 # Do each command in the finish commands.
2275 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2276 '"$cmd"'"'
2278 if test -n "$finish_eval"; then
2279 # Do the single finish_eval.
2280 eval cmds=\"$finish_eval\"
2281 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2282 $cmds"
2284 done
2287 # Exit here if they wanted silent mode.
2288 $opt_silent && exit $EXIT_SUCCESS
2290 $ECHO "X----------------------------------------------------------------------" | $Xsed
2291 $ECHO "Libraries have been installed in:"
2292 for libdir in $libdirs; do
2293 $ECHO " $libdir"
2294 done
2295 $ECHO
2296 $ECHO "If you ever happen to want to link against installed libraries"
2297 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2298 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2299 $ECHO "flag during linking and do at least one of the following:"
2300 if test -n "$shlibpath_var"; then
2301 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2302 $ECHO " during execution"
2304 if test -n "$runpath_var"; then
2305 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2306 $ECHO " during linking"
2308 if test -n "$hardcode_libdir_flag_spec"; then
2309 libdir=LIBDIR
2310 eval flag=\"$hardcode_libdir_flag_spec\"
2312 $ECHO " - use the \`$flag' linker flag"
2314 if test -n "$admincmds"; then
2315 $ECHO " - have your system administrator run these commands:$admincmds"
2317 if test -f /etc/ld.so.conf; then
2318 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2320 $ECHO
2322 $ECHO "See any operating system documentation about shared libraries for"
2323 case $host in
2324 solaris2.[6789]|solaris2.1[0-9])
2325 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2326 $ECHO "pages."
2329 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2331 esac
2332 $ECHO "X----------------------------------------------------------------------" | $Xsed
2333 exit $EXIT_SUCCESS
2336 test "$mode" = finish && func_mode_finish ${1+"$@"}
2339 # func_mode_install arg...
2340 func_mode_install ()
2342 $opt_debug
2343 # There may be an optional sh(1) argument at the beginning of
2344 # install_prog (especially on Windows NT).
2345 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2346 # Allow the use of GNU shtool's install command.
2347 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2348 # Aesthetically quote it.
2349 func_quote_for_eval "$nonopt"
2350 install_prog="$func_quote_for_eval_result "
2351 arg=$1
2352 shift
2353 else
2354 install_prog=
2355 arg=$nonopt
2358 # The real first argument should be the name of the installation program.
2359 # Aesthetically quote it.
2360 func_quote_for_eval "$arg"
2361 install_prog="$install_prog$func_quote_for_eval_result"
2363 # We need to accept at least all the BSD install flags.
2364 dest=
2365 files=
2366 opts=
2367 prev=
2368 install_type=
2369 isdir=no
2370 stripme=
2371 for arg
2373 if test -n "$dest"; then
2374 files="$files $dest"
2375 dest=$arg
2376 continue
2379 case $arg in
2380 -d) isdir=yes ;;
2382 case " $install_prog " in
2383 *[\\\ /]cp\ *) ;;
2384 *) prev=$arg ;;
2385 esac
2387 -g | -m | -o)
2388 prev=$arg
2391 stripme=" -s"
2392 continue
2397 # If the previous option needed an argument, then skip it.
2398 if test -n "$prev"; then
2399 prev=
2400 else
2401 dest=$arg
2402 continue
2405 esac
2407 # Aesthetically quote the argument.
2408 func_quote_for_eval "$arg"
2409 install_prog="$install_prog $func_quote_for_eval_result"
2410 done
2412 test -z "$install_prog" && \
2413 func_fatal_help "you must specify an install program"
2415 test -n "$prev" && \
2416 func_fatal_help "the \`$prev' option requires an argument"
2418 if test -z "$files"; then
2419 if test -z "$dest"; then
2420 func_fatal_help "no file or destination specified"
2421 else
2422 func_fatal_help "you must specify a destination"
2426 # Strip any trailing slash from the destination.
2427 func_stripname '' '/' "$dest"
2428 dest=$func_stripname_result
2430 # Check to see that the destination is a directory.
2431 test -d "$dest" && isdir=yes
2432 if test "$isdir" = yes; then
2433 destdir="$dest"
2434 destname=
2435 else
2436 func_dirname_and_basename "$dest" "" "."
2437 destdir="$func_dirname_result"
2438 destname="$func_basename_result"
2440 # Not a directory, so check to see that there is only one file specified.
2441 set dummy $files; shift
2442 test "$#" -gt 1 && \
2443 func_fatal_help "\`$dest' is not a directory"
2445 case $destdir in
2446 [\\/]* | [A-Za-z]:[\\/]*) ;;
2448 for file in $files; do
2449 case $file in
2450 *.lo) ;;
2452 func_fatal_help "\`$destdir' must be an absolute directory name"
2454 esac
2455 done
2457 esac
2459 # This variable tells wrapper scripts just to set variables rather
2460 # than running their programs.
2461 libtool_install_magic="$magic"
2463 staticlibs=
2464 future_libdirs=
2465 current_libdirs=
2466 for file in $files; do
2468 # Do each installation.
2469 case $file in
2470 *.$libext)
2471 # Do the static libraries later.
2472 staticlibs="$staticlibs $file"
2475 *.la)
2476 # Check to see that this really is a libtool archive.
2477 func_lalib_unsafe_p "$file" \
2478 || func_fatal_help "\`$file' is not a valid libtool archive"
2480 library_names=
2481 old_library=
2482 relink_command=
2483 func_source "$file"
2485 # Add the libdir to current_libdirs if it is the destination.
2486 if test "X$destdir" = "X$libdir"; then
2487 case "$current_libdirs " in
2488 *" $libdir "*) ;;
2489 *) current_libdirs="$current_libdirs $libdir" ;;
2490 esac
2491 else
2492 # Note the libdir as a future libdir.
2493 case "$future_libdirs " in
2494 *" $libdir "*) ;;
2495 *) future_libdirs="$future_libdirs $libdir" ;;
2496 esac
2499 func_dirname "$file" "/" ""
2500 dir="$func_dirname_result"
2501 dir="$dir$objdir"
2503 if test -n "$relink_command"; then
2504 # Determine the prefix the user has applied to our future dir.
2505 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2507 # Don't allow the user to place us outside of our expected
2508 # location b/c this prevents finding dependent libraries that
2509 # are installed to the same prefix.
2510 # At present, this check doesn't affect windows .dll's that
2511 # are installed into $libdir/../bin (currently, that works fine)
2512 # but it's something to keep an eye on.
2513 test "$inst_prefix_dir" = "$destdir" && \
2514 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2516 if test -n "$inst_prefix_dir"; then
2517 # Stick the inst_prefix_dir data into the link command.
2518 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2519 else
2520 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2523 func_warning "relinking \`$file'"
2524 func_show_eval "$relink_command" \
2525 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2528 # See the names of the shared library.
2529 set dummy $library_names; shift
2530 if test -n "$1"; then
2531 realname="$1"
2532 shift
2534 srcname="$realname"
2535 test -n "$relink_command" && srcname="$realname"T
2537 # Install the shared library and build the symlinks.
2538 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2539 'exit $?'
2540 tstripme="$stripme"
2541 case $host_os in
2542 cygwin* | mingw* | pw32*)
2543 case $realname in
2544 *.dll.a)
2545 tstripme=""
2547 esac
2549 esac
2550 if test -n "$tstripme" && test -n "$striplib"; then
2551 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2554 if test "$#" -gt 0; then
2555 # Delete the old symlinks, and create new ones.
2556 # Try `ln -sf' first, because the `ln' binary might depend on
2557 # the symlink we replace! Solaris /bin/ln does not understand -f,
2558 # so we also need to try rm && ln -s.
2559 for linkname
2561 test "$linkname" != "$realname" \
2562 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2563 done
2566 # Do each command in the postinstall commands.
2567 lib="$destdir/$realname"
2568 func_execute_cmds "$postinstall_cmds" 'exit $?'
2571 # Install the pseudo-library for information purposes.
2572 func_basename "$file"
2573 name="$func_basename_result"
2574 instname="$dir/$name"i
2575 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2577 # Maybe install the static library, too.
2578 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2581 *.lo)
2582 # Install (i.e. copy) a libtool object.
2584 # Figure out destination file name, if it wasn't already specified.
2585 if test -n "$destname"; then
2586 destfile="$destdir/$destname"
2587 else
2588 func_basename "$file"
2589 destfile="$func_basename_result"
2590 destfile="$destdir/$destfile"
2593 # Deduce the name of the destination old-style object file.
2594 case $destfile in
2595 *.lo)
2596 func_lo2o "$destfile"
2597 staticdest=$func_lo2o_result
2599 *.$objext)
2600 staticdest="$destfile"
2601 destfile=
2604 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2606 esac
2608 # Install the libtool object if requested.
2609 test -n "$destfile" && \
2610 func_show_eval "$install_prog $file $destfile" 'exit $?'
2612 # Install the old object if enabled.
2613 if test "$build_old_libs" = yes; then
2614 # Deduce the name of the old-style object file.
2615 func_lo2o "$file"
2616 staticobj=$func_lo2o_result
2617 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2619 exit $EXIT_SUCCESS
2623 # Figure out destination file name, if it wasn't already specified.
2624 if test -n "$destname"; then
2625 destfile="$destdir/$destname"
2626 else
2627 func_basename "$file"
2628 destfile="$func_basename_result"
2629 destfile="$destdir/$destfile"
2632 # If the file is missing, and there is a .exe on the end, strip it
2633 # because it is most likely a libtool script we actually want to
2634 # install
2635 stripped_ext=""
2636 case $file in
2637 *.exe)
2638 if test ! -f "$file"; then
2639 func_stripname '' '.exe' "$file"
2640 file=$func_stripname_result
2641 stripped_ext=".exe"
2644 esac
2646 # Do a test to see if this is really a libtool program.
2647 case $host in
2648 *cygwin*|*mingw*)
2649 if func_ltwrapper_executable_p "$file"; then
2650 func_ltwrapper_scriptname "$file"
2651 wrapper=$func_ltwrapper_scriptname_result
2652 else
2653 func_stripname '' '.exe' "$file"
2654 wrapper=$func_stripname_result
2658 wrapper=$file
2660 esac
2661 if func_ltwrapper_script_p "$wrapper"; then
2662 notinst_deplibs=
2663 relink_command=
2665 func_source "$wrapper"
2667 # Check the variables that should have been set.
2668 test -z "$generated_by_libtool_version" && \
2669 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2671 finalize=yes
2672 for lib in $notinst_deplibs; do
2673 # Check to see that each library is installed.
2674 libdir=
2675 if test -f "$lib"; then
2676 func_source "$lib"
2678 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2679 if test -n "$libdir" && test ! -f "$libfile"; then
2680 func_warning "\`$lib' has not been installed in \`$libdir'"
2681 finalize=no
2683 done
2685 relink_command=
2686 func_source "$wrapper"
2688 outputname=
2689 if test "$fast_install" = no && test -n "$relink_command"; then
2690 $opt_dry_run || {
2691 if test "$finalize" = yes; then
2692 tmpdir=`func_mktempdir`
2693 func_basename "$file$stripped_ext"
2694 file="$func_basename_result"
2695 outputname="$tmpdir/$file"
2696 # Replace the output file specification.
2697 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2699 $opt_silent || {
2700 func_quote_for_expand "$relink_command"
2701 eval "func_echo $func_quote_for_expand_result"
2703 if eval "$relink_command"; then :
2704 else
2705 func_error "error: relink \`$file' with the above command before installing it"
2706 $opt_dry_run || ${RM}r "$tmpdir"
2707 continue
2709 file="$outputname"
2710 else
2711 func_warning "cannot relink \`$file'"
2714 else
2715 # Install the binary that we compiled earlier.
2716 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2720 # remove .exe since cygwin /usr/bin/install will append another
2721 # one anyway
2722 case $install_prog,$host in
2723 */usr/bin/install*,*cygwin*)
2724 case $file:$destfile in
2725 *.exe:*.exe)
2726 # this is ok
2728 *.exe:*)
2729 destfile=$destfile.exe
2731 *:*.exe)
2732 func_stripname '' '.exe' "$destfile"
2733 destfile=$func_stripname_result
2735 esac
2737 esac
2738 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2739 $opt_dry_run || if test -n "$outputname"; then
2740 ${RM}r "$tmpdir"
2743 esac
2744 done
2746 for file in $staticlibs; do
2747 func_basename "$file"
2748 name="$func_basename_result"
2750 # Set up the ranlib parameters.
2751 oldlib="$destdir/$name"
2753 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2755 if test -n "$stripme" && test -n "$old_striplib"; then
2756 func_show_eval "$old_striplib $oldlib" 'exit $?'
2759 # Do each command in the postinstall commands.
2760 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2761 done
2763 test -n "$future_libdirs" && \
2764 func_warning "remember to run \`$progname --finish$future_libdirs'"
2766 if test -n "$current_libdirs"; then
2767 # Maybe just do a dry run.
2768 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2769 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2770 else
2771 exit $EXIT_SUCCESS
2775 test "$mode" = install && func_mode_install ${1+"$@"}
2778 # func_generate_dlsyms outputname originator pic_p
2779 # Extract symbols from dlprefiles and create ${outputname}S.o with
2780 # a dlpreopen symbol table.
2781 func_generate_dlsyms ()
2783 $opt_debug
2784 my_outputname="$1"
2785 my_originator="$2"
2786 my_pic_p="${3-no}"
2787 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2788 my_dlsyms=
2790 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2791 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2792 my_dlsyms="${my_outputname}S.c"
2793 else
2794 func_error "not configured to extract global symbols from dlpreopened files"
2798 if test -n "$my_dlsyms"; then
2799 case $my_dlsyms in
2800 "") ;;
2801 *.c)
2802 # Discover the nlist of each of the dlfiles.
2803 nlist="$output_objdir/${my_outputname}.nm"
2805 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2807 # Parse the name list into a source file.
2808 func_verbose "creating $output_objdir/$my_dlsyms"
2810 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2811 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2812 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2814 #ifdef __cplusplus
2815 extern \"C\" {
2816 #endif
2818 /* External symbol declarations for the compiler. */\
2821 if test "$dlself" = yes; then
2822 func_verbose "generating symbol list for \`$output'"
2824 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2826 # Add our own program objects to the symbol list.
2827 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2828 for progfile in $progfiles; do
2829 func_verbose "extracting global C symbols from \`$progfile'"
2830 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2831 done
2833 if test -n "$exclude_expsyms"; then
2834 $opt_dry_run || {
2835 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2836 eval '$MV "$nlist"T "$nlist"'
2840 if test -n "$export_symbols_regex"; then
2841 $opt_dry_run || {
2842 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2843 eval '$MV "$nlist"T "$nlist"'
2847 # Prepare the list of exported symbols
2848 if test -z "$export_symbols"; then
2849 export_symbols="$output_objdir/$outputname.exp"
2850 $opt_dry_run || {
2851 $RM $export_symbols
2852 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2853 case $host in
2854 *cygwin* | *mingw* )
2855 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2856 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2858 esac
2860 else
2861 $opt_dry_run || {
2862 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2863 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2864 eval '$MV "$nlist"T "$nlist"'
2865 case $host in
2866 *cygwin | *mingw* )
2867 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2868 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2870 esac
2875 for dlprefile in $dlprefiles; do
2876 func_verbose "extracting global C symbols from \`$dlprefile'"
2877 func_basename "$dlprefile"
2878 name="$func_basename_result"
2879 $opt_dry_run || {
2880 eval '$ECHO ": $name " >> "$nlist"'
2881 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2883 done
2885 $opt_dry_run || {
2886 # Make sure we have at least an empty file.
2887 test -f "$nlist" || : > "$nlist"
2889 if test -n "$exclude_expsyms"; then
2890 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2891 $MV "$nlist"T "$nlist"
2894 # Try sorting and uniquifying the output.
2895 if $GREP -v "^: " < "$nlist" |
2896 if sort -k 3 </dev/null >/dev/null 2>&1; then
2897 sort -k 3
2898 else
2899 sort +2
2900 fi |
2901 uniq > "$nlist"S; then
2903 else
2904 $GREP -v "^: " < "$nlist" > "$nlist"S
2907 if test -f "$nlist"S; then
2908 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2909 else
2910 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2913 $ECHO >> "$output_objdir/$my_dlsyms" "\
2915 /* The mapping between symbol names and symbols. */
2916 typedef struct {
2917 const char *name;
2918 void *address;
2919 } lt_dlsymlist;
2921 case $host in
2922 *cygwin* | *mingw* )
2923 $ECHO >> "$output_objdir/$my_dlsyms" "\
2924 /* DATA imports from DLLs on WIN32 con't be const, because
2925 runtime relocations are performed -- see ld's documentation
2926 on pseudo-relocs. */"
2927 lt_dlsym_const= ;;
2928 *osf5*)
2929 echo >> "$output_objdir/$my_dlsyms" "\
2930 /* This system does not cope well with relocations in const data */"
2931 lt_dlsym_const= ;;
2933 lt_dlsym_const=const ;;
2934 esac
2936 $ECHO >> "$output_objdir/$my_dlsyms" "\
2937 extern $lt_dlsym_const lt_dlsymlist
2938 lt_${my_prefix}_LTX_preloaded_symbols[];
2939 $lt_dlsym_const lt_dlsymlist
2940 lt_${my_prefix}_LTX_preloaded_symbols[] =
2942 { \"$my_originator\", (void *) 0 },"
2944 case $need_lib_prefix in
2946 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2949 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2951 esac
2952 $ECHO >> "$output_objdir/$my_dlsyms" "\
2953 {0, (void *) 0}
2956 /* This works around a problem in FreeBSD linker */
2957 #ifdef FREEBSD_WORKAROUND
2958 static const void *lt_preloaded_setup() {
2959 return lt_${my_prefix}_LTX_preloaded_symbols;
2961 #endif
2963 #ifdef __cplusplus
2965 #endif\
2967 } # !$opt_dry_run
2969 pic_flag_for_symtable=
2970 case "$compile_command " in
2971 *" -static "*) ;;
2973 case $host in
2974 # compiling the symbol table file with pic_flag works around
2975 # a FreeBSD bug that causes programs to crash when -lm is
2976 # linked before any other PIC object. But we must not use
2977 # pic_flag when linking with -static. The problem exists in
2978 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2979 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2980 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2981 *-*-hpux*)
2982 pic_flag_for_symtable=" $pic_flag" ;;
2984 if test "X$my_pic_p" != Xno; then
2985 pic_flag_for_symtable=" $pic_flag"
2988 esac
2990 esac
2991 symtab_cflags=
2992 for arg in $LTCFLAGS; do
2993 case $arg in
2994 -pie | -fpie | -fPIE) ;;
2995 *) symtab_cflags="$symtab_cflags $arg" ;;
2996 esac
2997 done
2999 # Now compile the dynamic symbol file.
3000 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3002 # Clean up the generated files.
3003 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3005 # Transform the symbol file into the correct name.
3006 symfileobj="$output_objdir/${my_outputname}S.$objext"
3007 case $host in
3008 *cygwin* | *mingw* )
3009 if test -f "$output_objdir/$my_outputname.def"; then
3010 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3011 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3012 else
3013 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3014 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3018 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3019 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3021 esac
3024 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3026 esac
3027 else
3028 # We keep going just in case the user didn't refer to
3029 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3030 # really was required.
3032 # Nullify the symbol file.
3033 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3034 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3038 # func_win32_libid arg
3039 # return the library type of file 'arg'
3041 # Need a lot of goo to handle *both* DLLs and import libs
3042 # Has to be a shell function in order to 'eat' the argument
3043 # that is supplied when $file_magic_command is called.
3044 func_win32_libid ()
3046 $opt_debug
3047 win32_libid_type="unknown"
3048 win32_fileres=`file -L $1 2>/dev/null`
3049 case $win32_fileres in
3050 *ar\ archive\ import\ library*) # definitely import
3051 win32_libid_type="x86 archive import"
3053 *ar\ archive*) # could be an import, or static
3054 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3055 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
3056 win32_nmres=`eval $NM -f posix -A $1 |
3057 $SED -n -e '
3058 1,100{
3059 / I /{
3060 s,.*,import,
3065 case $win32_nmres in
3066 import*) win32_libid_type="x86 archive import";;
3067 *) win32_libid_type="x86 archive static";;
3068 esac
3071 *DLL*)
3072 win32_libid_type="x86 DLL"
3074 *executable*) # but shell scripts are "executable" too...
3075 case $win32_fileres in
3076 *MS\ Windows\ PE\ Intel*)
3077 win32_libid_type="x86 DLL"
3079 esac
3081 esac
3082 $ECHO "$win32_libid_type"
3087 # func_extract_an_archive dir oldlib
3088 func_extract_an_archive ()
3090 $opt_debug
3091 f_ex_an_ar_dir="$1"; shift
3092 f_ex_an_ar_oldlib="$1"
3093 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
3094 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3096 else
3097 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3102 # func_extract_archives gentop oldlib ...
3103 func_extract_archives ()
3105 $opt_debug
3106 my_gentop="$1"; shift
3107 my_oldlibs=${1+"$@"}
3108 my_oldobjs=""
3109 my_xlib=""
3110 my_xabs=""
3111 my_xdir=""
3113 for my_xlib in $my_oldlibs; do
3114 # Extract the objects.
3115 case $my_xlib in
3116 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3117 *) my_xabs=`pwd`"/$my_xlib" ;;
3118 esac
3119 func_basename "$my_xlib"
3120 my_xlib="$func_basename_result"
3121 my_xlib_u=$my_xlib
3122 while :; do
3123 case " $extracted_archives " in
3124 *" $my_xlib_u "*)
3125 func_arith $extracted_serial + 1
3126 extracted_serial=$func_arith_result
3127 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3128 *) break ;;
3129 esac
3130 done
3131 extracted_archives="$extracted_archives $my_xlib_u"
3132 my_xdir="$my_gentop/$my_xlib_u"
3134 func_mkdir_p "$my_xdir"
3136 case $host in
3137 *-darwin*)
3138 func_verbose "Extracting $my_xabs"
3139 # Do not bother doing anything if just a dry run
3140 $opt_dry_run || {
3141 darwin_orig_dir=`pwd`
3142 cd $my_xdir || exit $?
3143 darwin_archive=$my_xabs
3144 darwin_curdir=`pwd`
3145 darwin_base_archive=`basename "$darwin_archive"`
3146 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3147 if test -n "$darwin_arches"; then
3148 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3149 darwin_arch=
3150 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3151 for darwin_arch in $darwin_arches ; do
3152 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3153 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3154 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3155 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3156 cd "$darwin_curdir"
3157 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3158 done # $darwin_arches
3159 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3160 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3161 darwin_file=
3162 darwin_files=
3163 for darwin_file in $darwin_filelist; do
3164 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
3165 $LIPO -create -output "$darwin_file" $darwin_files
3166 done # $darwin_filelist
3167 $RM -rf unfat-$$
3168 cd "$darwin_orig_dir"
3169 else
3170 cd $darwin_orig_dir
3171 func_extract_an_archive "$my_xdir" "$my_xabs"
3172 fi # $darwin_arches
3173 } # !$opt_dry_run
3176 func_extract_an_archive "$my_xdir" "$my_xabs"
3178 esac
3179 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3180 done
3182 func_extract_archives_result="$my_oldobjs"
3187 # func_emit_wrapper arg
3189 # emit a libtool wrapper script on stdout
3190 # don't directly open a file because we may want to
3191 # incorporate the script contents within a cygwin/mingw
3192 # wrapper executable. Must ONLY be called from within
3193 # func_mode_link because it depends on a number of variable
3194 # set therein.
3196 # arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3197 # variable will take. If 'yes', then the emitted script
3198 # will assume that the directory in which it is stored is
3199 # the '.lib' directory. This is a cygwin/mingw-specific
3200 # behavior.
3201 func_emit_wrapper ()
3203 func_emit_wrapper_arg1=no
3204 if test -n "$1" ; then
3205 func_emit_wrapper_arg1=$1
3208 $ECHO "\
3209 #! $SHELL
3211 # $output - temporary wrapper script for $objdir/$outputname
3212 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3214 # The $output program cannot be directly executed until all the libtool
3215 # libraries that it depends on are installed.
3217 # This wrapper script should never be moved out of the build directory.
3218 # If it is, it will not operate correctly.
3220 # Sed substitution that helps us do robust quoting. It backslashifies
3221 # metacharacters that are still active within double-quoted strings.
3222 Xsed='${SED} -e 1s/^X//'
3223 sed_quote_subst='$sed_quote_subst'
3225 # Be Bourne compatible
3226 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3227 emulate sh
3228 NULLCMD=:
3229 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3230 # is contrary to our usage. Disable this feature.
3231 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3232 setopt NO_GLOB_SUBST
3233 else
3234 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3236 BIN_SH=xpg4; export BIN_SH # for Tru64
3237 DUALCASE=1; export DUALCASE # for MKS sh
3239 # The HP-UX ksh and POSIX shell print the target directory to stdout
3240 # if CDPATH is set.
3241 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3243 relink_command=\"$relink_command\"
3245 # This environment variable determines our operation mode.
3246 if test \"\$libtool_install_magic\" = \"$magic\"; then
3247 # install mode needs the following variables:
3248 generated_by_libtool_version='$macro_version'
3249 notinst_deplibs='$notinst_deplibs'
3250 else
3251 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3252 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3253 ECHO=\"$qecho\"
3254 file=\"\$0\"
3255 # Make sure echo works.
3256 if test \"X\$1\" = X--no-reexec; then
3257 # Discard the --no-reexec flag, and continue.
3258 shift
3259 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
3260 # Yippee, \$ECHO works!
3262 else
3263 # Restart under the correct shell, and then maybe \$ECHO will work.
3264 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3268 $ECHO "\
3270 # Find the directory that this script lives in.
3271 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3272 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3274 # Follow symbolic links until we get to the real thisdir.
3275 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3276 while test -n \"\$file\"; do
3277 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3279 # If there was a directory component, then change thisdir.
3280 if test \"x\$destdir\" != \"x\$file\"; then
3281 case \"\$destdir\" in
3282 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3283 *) thisdir=\"\$thisdir/\$destdir\" ;;
3284 esac
3287 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3288 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3289 done
3291 # Usually 'no', except on cygwin/mingw when embedded into
3292 # the cwrapper.
3293 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
3294 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3295 # special case for '.'
3296 if test \"\$thisdir\" = \".\"; then
3297 thisdir=\`pwd\`
3299 # remove .libs from thisdir
3300 case \"\$thisdir\" in
3301 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
3302 $objdir ) thisdir=. ;;
3303 esac
3306 # Try to get the absolute directory name.
3307 absdir=\`cd \"\$thisdir\" && pwd\`
3308 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3311 if test "$fast_install" = yes; then
3312 $ECHO "\
3313 program=lt-'$outputname'$exeext
3314 progdir=\"\$thisdir/$objdir\"
3316 if test ! -f \"\$progdir/\$program\" ||
3317 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3318 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3320 file=\"\$\$-\$program\"
3322 if test ! -d \"\$progdir\"; then
3323 $MKDIR \"\$progdir\"
3324 else
3325 $RM \"\$progdir/\$file\"
3328 $ECHO "\
3330 # relink executable if necessary
3331 if test -n \"\$relink_command\"; then
3332 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3333 else
3334 $ECHO \"\$relink_command_output\" >&2
3335 $RM \"\$progdir/\$file\"
3336 exit 1
3340 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3341 { $RM \"\$progdir/\$program\";
3342 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3343 $RM \"\$progdir/\$file\"
3345 else
3346 $ECHO "\
3347 program='$outputname'
3348 progdir=\"\$thisdir/$objdir\"
3352 $ECHO "\
3354 if test -f \"\$progdir/\$program\"; then"
3356 # Export our shlibpath_var if we have one.
3357 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3358 $ECHO "\
3359 # Add our own library path to $shlibpath_var
3360 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3362 # Some systems cannot cope with colon-terminated $shlibpath_var
3363 # The second colon is a workaround for a bug in BeOS R4 sed
3364 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3366 export $shlibpath_var
3370 # fixup the dll searchpath if we need to.
3371 if test -n "$dllsearchpath"; then
3372 $ECHO "\
3373 # Add the dll search path components to the executable PATH
3374 PATH=$dllsearchpath:\$PATH
3378 $ECHO "\
3379 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3380 # Run the actual program with our arguments.
3382 case $host in
3383 # Backslashes separate directories on plain windows
3384 *-*-mingw | *-*-os2*)
3385 $ECHO "\
3386 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3391 $ECHO "\
3392 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3395 esac
3396 $ECHO "\
3397 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3398 exit 1
3400 else
3401 # The program doesn't exist.
3402 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3403 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3404 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3405 exit 1
3410 # end: func_emit_wrapper
3412 # func_emit_cwrapperexe_src
3413 # emit the source code for a wrapper executable on stdout
3414 # Must ONLY be called from within func_mode_link because
3415 # it depends on a number of variable set therein.
3416 func_emit_cwrapperexe_src ()
3418 cat <<EOF
3420 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3421 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3423 The $output program cannot be directly executed until all the libtool
3424 libraries that it depends on are installed.
3426 This wrapper executable should never be moved out of the build directory.
3427 If it is, it will not operate correctly.
3429 Currently, it simply execs the wrapper *script* "$SHELL $output",
3430 but could eventually absorb all of the scripts functionality and
3431 exec $objdir/$outputname directly.
3434 cat <<"EOF"
3435 #include <stdio.h>
3436 #include <stdlib.h>
3437 #ifdef _MSC_VER
3438 # include <direct.h>
3439 # include <process.h>
3440 # include <io.h>
3441 # define setmode _setmode
3442 #else
3443 # include <unistd.h>
3444 # include <stdint.h>
3445 # ifdef __CYGWIN__
3446 # include <io.h>
3447 # endif
3448 #endif
3449 #include <malloc.h>
3450 #include <stdarg.h>
3451 #include <assert.h>
3452 #include <string.h>
3453 #include <ctype.h>
3454 #include <errno.h>
3455 #include <fcntl.h>
3456 #include <sys/stat.h>
3458 #if defined(PATH_MAX)
3459 # define LT_PATHMAX PATH_MAX
3460 #elif defined(MAXPATHLEN)
3461 # define LT_PATHMAX MAXPATHLEN
3462 #else
3463 # define LT_PATHMAX 1024
3464 #endif
3466 #ifndef S_IXOTH
3467 # define S_IXOTH 0
3468 #endif
3469 #ifndef S_IXGRP
3470 # define S_IXGRP 0
3471 #endif
3473 #ifdef _MSC_VER
3474 # define S_IXUSR _S_IEXEC
3475 # define stat _stat
3476 # ifndef _INTPTR_T_DEFINED
3477 # define intptr_t int
3478 # endif
3479 #endif
3481 #ifndef DIR_SEPARATOR
3482 # define DIR_SEPARATOR '/'
3483 # define PATH_SEPARATOR ':'
3484 #endif
3486 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3487 defined (__OS2__)
3488 # define HAVE_DOS_BASED_FILE_SYSTEM
3489 # define FOPEN_WB "wb"
3490 # ifndef DIR_SEPARATOR_2
3491 # define DIR_SEPARATOR_2 '\\'
3492 # endif
3493 # ifndef PATH_SEPARATOR_2
3494 # define PATH_SEPARATOR_2 ';'
3495 # endif
3496 #endif
3498 #ifndef DIR_SEPARATOR_2
3499 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3500 #else /* DIR_SEPARATOR_2 */
3501 # define IS_DIR_SEPARATOR(ch) \
3502 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3503 #endif /* DIR_SEPARATOR_2 */
3505 #ifndef PATH_SEPARATOR_2
3506 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3507 #else /* PATH_SEPARATOR_2 */
3508 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3509 #endif /* PATH_SEPARATOR_2 */
3511 #ifdef __CYGWIN__
3512 # define FOPEN_WB "wb"
3513 #endif
3515 #ifndef FOPEN_WB
3516 # define FOPEN_WB "w"
3517 #endif
3518 #ifndef _O_BINARY
3519 # define _O_BINARY 0
3520 #endif
3522 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3523 #define XFREE(stale) do { \
3524 if (stale) { free ((void *) stale); stale = 0; } \
3525 } while (0)
3527 #undef LTWRAPPER_DEBUGPRINTF
3528 #if defined DEBUGWRAPPER
3529 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3530 static void
3531 ltwrapper_debugprintf (const char *fmt, ...)
3533 va_list args;
3534 va_start (args, fmt);
3535 (void) vfprintf (stderr, fmt, args);
3536 va_end (args);
3538 #else
3539 # define LTWRAPPER_DEBUGPRINTF(args)
3540 #endif
3542 const char *program_name = NULL;
3544 void *xmalloc (size_t num);
3545 char *xstrdup (const char *string);
3546 const char *base_name (const char *name);
3547 char *find_executable (const char *wrapper);
3548 char *chase_symlinks (const char *pathspec);
3549 int make_executable (const char *path);
3550 int check_executable (const char *path);
3551 char *strendzap (char *str, const char *pat);
3552 void lt_fatal (const char *message, ...);
3554 static const char *script_text =
3557 func_emit_wrapper yes |
3558 $SED -e 's/\([\\"]\)/\\\1/g' \
3559 -e 's/^/ "/' -e 's/$/\\n"/'
3560 echo ";"
3562 cat <<EOF
3563 const char * MAGIC_EXE = "$magic_exe";
3566 main (int argc, char *argv[])
3568 char **newargz;
3569 char *tmp_pathspec;
3570 char *actual_cwrapper_path;
3571 char *shwrapper_name;
3572 intptr_t rval = 127;
3573 FILE *shwrapper;
3575 const char *dumpscript_opt = "--lt-dump-script";
3576 int i;
3578 program_name = (char *) xstrdup (base_name (argv[0]));
3579 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3580 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3582 /* very simple arg parsing; don't want to rely on getopt */
3583 for (i = 1; i < argc; i++)
3585 if (strcmp (argv[i], dumpscript_opt) == 0)
3588 case "$host" in
3589 *mingw* | *cygwin* )
3590 # make stdout use "unix" line endings
3591 echo " setmode(1,_O_BINARY);"
3593 esac
3595 cat <<EOF
3596 printf ("%s", script_text);
3597 return 0;
3601 newargz = XMALLOC (char *, argc + 2);
3604 if test -n "$TARGETSHELL" ; then
3605 # no path translation at all
3606 lt_newargv0=$TARGETSHELL
3607 else
3608 case "$host" in
3609 *mingw* )
3610 # awkward: cmd appends spaces to result
3611 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3612 lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
3613 case $lt_newargv0 in
3614 *.exe | *.EXE) ;;
3615 *) lt_newargv0=$lt_newargv0.exe ;;
3616 esac
3618 * ) lt_newargv0=$SHELL ;;
3619 esac
3622 cat <<EOF
3623 newargz[0] = (char *) xstrdup ("$lt_newargv0");
3626 cat <<"EOF"
3627 tmp_pathspec = find_executable (argv[0]);
3628 if (tmp_pathspec == NULL)
3629 lt_fatal ("Couldn't find %s", argv[0]);
3630 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3631 tmp_pathspec));
3633 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3634 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3635 actual_cwrapper_path));
3636 XFREE (tmp_pathspec);
3638 shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
3639 strendzap (actual_cwrapper_path, shwrapper_name);
3641 /* shwrapper_name transforms */
3642 strendzap (shwrapper_name, ".exe");
3643 tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
3644 strlen ("_ltshwrapperTMP") + 1));
3645 strcpy (tmp_pathspec, shwrapper_name);
3646 strcat (tmp_pathspec, "_ltshwrapperTMP");
3647 XFREE (shwrapper_name);
3648 shwrapper_name = tmp_pathspec;
3649 tmp_pathspec = 0;
3650 LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
3651 shwrapper_name));
3654 cat <<EOF
3655 newargz[1] =
3656 XMALLOC (char, (strlen (actual_cwrapper_path) +
3657 strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
3658 strcpy (newargz[1], actual_cwrapper_path);
3659 strcat (newargz[1], "$objdir");
3660 strcat (newargz[1], "/");
3661 strcat (newargz[1], shwrapper_name);
3665 case $host_os in
3666 mingw*)
3667 cat <<"EOF"
3669 char* p;
3670 while ((p = strchr (newargz[1], '\\')) != NULL)
3672 *p = '/';
3677 esac
3679 cat <<"EOF"
3680 XFREE (shwrapper_name);
3681 XFREE (actual_cwrapper_path);
3683 /* always write in binary mode */
3684 if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0)
3686 lt_fatal ("Could not open %s for writing", newargz[1]);
3688 fprintf (shwrapper, "%s", script_text);
3689 fclose (shwrapper);
3691 make_executable (newargz[1]);
3693 for (i = 1; i < argc; i++)
3694 newargz[i + 1] = xstrdup (argv[i]);
3695 newargz[argc + 1] = NULL;
3697 for (i = 0; i < argc + 1; i++)
3699 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, newargz[i]));
3704 case $host_os in
3705 mingw*)
3706 cat <<EOF
3707 /* execv doesn't actually work on mingw as expected on unix */
3708 rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
3709 if (rval == -1)
3711 /* failed to start process */
3712 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
3713 return 127;
3715 return rval;
3720 cat <<EOF
3721 execv ("$lt_newargv0", newargz);
3722 return rval; /* =127, but avoids unused variable warning */
3726 esac
3728 cat <<"EOF"
3730 void *
3731 xmalloc (size_t num)
3733 void *p = (void *) malloc (num);
3734 if (!p)
3735 lt_fatal ("Memory exhausted");
3737 return p;
3740 char *
3741 xstrdup (const char *string)
3743 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3744 string) : NULL;
3747 const char *
3748 base_name (const char *name)
3750 const char *base;
3752 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3753 /* Skip over the disk name in MSDOS pathnames. */
3754 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3755 name += 2;
3756 #endif
3758 for (base = name; *name; name++)
3759 if (IS_DIR_SEPARATOR (*name))
3760 base = name + 1;
3761 return base;
3765 check_executable (const char *path)
3767 struct stat st;
3769 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
3770 path ? (*path ? path : "EMPTY!") : "NULL!"));
3771 if ((!path) || (!*path))
3772 return 0;
3774 if ((stat (path, &st) >= 0)
3775 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3776 return 1;
3777 else
3778 return 0;
3782 make_executable (const char *path)
3784 int rval = 0;
3785 struct stat st;
3787 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
3788 path ? (*path ? path : "EMPTY!") : "NULL!"));
3789 if ((!path) || (!*path))
3790 return 0;
3792 if (stat (path, &st) >= 0)
3794 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3796 return rval;
3799 /* Searches for the full path of the wrapper. Returns
3800 newly allocated full path name if found, NULL otherwise
3801 Does not chase symlinks, even on platforms that support them.
3803 char *
3804 find_executable (const char *wrapper)
3806 int has_slash = 0;
3807 const char *p;
3808 const char *p_next;
3809 /* static buffer for getcwd */
3810 char tmp[LT_PATHMAX + 1];
3811 int tmp_len;
3812 char *concat_name;
3814 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
3815 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3817 if ((wrapper == NULL) || (*wrapper == '\0'))
3818 return NULL;
3820 /* Absolute path? */
3821 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3822 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3824 concat_name = xstrdup (wrapper);
3825 if (check_executable (concat_name))
3826 return concat_name;
3827 XFREE (concat_name);
3829 else
3831 #endif
3832 if (IS_DIR_SEPARATOR (wrapper[0]))
3834 concat_name = xstrdup (wrapper);
3835 if (check_executable (concat_name))
3836 return concat_name;
3837 XFREE (concat_name);
3839 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3841 #endif
3843 for (p = wrapper; *p; p++)
3844 if (*p == '/')
3846 has_slash = 1;
3847 break;
3849 if (!has_slash)
3851 /* no slashes; search PATH */
3852 const char *path = getenv ("PATH");
3853 if (path != NULL)
3855 for (p = path; *p; p = p_next)
3857 const char *q;
3858 size_t p_len;
3859 for (q = p; *q; q++)
3860 if (IS_PATH_SEPARATOR (*q))
3861 break;
3862 p_len = q - p;
3863 p_next = (*q == '\0' ? q : q + 1);
3864 if (p_len == 0)
3866 /* empty path: current directory */
3867 if (getcwd (tmp, LT_PATHMAX) == NULL)
3868 lt_fatal ("getcwd failed");
3869 tmp_len = strlen (tmp);
3870 concat_name =
3871 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3872 memcpy (concat_name, tmp, tmp_len);
3873 concat_name[tmp_len] = '/';
3874 strcpy (concat_name + tmp_len + 1, wrapper);
3876 else
3878 concat_name =
3879 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3880 memcpy (concat_name, p, p_len);
3881 concat_name[p_len] = '/';
3882 strcpy (concat_name + p_len + 1, wrapper);
3884 if (check_executable (concat_name))
3885 return concat_name;
3886 XFREE (concat_name);
3889 /* not found in PATH; assume curdir */
3891 /* Relative path | not found in path: prepend cwd */
3892 if (getcwd (tmp, LT_PATHMAX) == NULL)
3893 lt_fatal ("getcwd failed");
3894 tmp_len = strlen (tmp);
3895 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3896 memcpy (concat_name, tmp, tmp_len);
3897 concat_name[tmp_len] = '/';
3898 strcpy (concat_name + tmp_len + 1, wrapper);
3900 if (check_executable (concat_name))
3901 return concat_name;
3902 XFREE (concat_name);
3903 return NULL;
3906 char *
3907 chase_symlinks (const char *pathspec)
3909 #ifndef S_ISLNK
3910 return xstrdup (pathspec);
3911 #else
3912 char buf[LT_PATHMAX];
3913 struct stat s;
3914 char *tmp_pathspec = xstrdup (pathspec);
3915 char *p;
3916 int has_symlinks = 0;
3917 while (strlen (tmp_pathspec) && !has_symlinks)
3919 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3920 tmp_pathspec));
3921 if (lstat (tmp_pathspec, &s) == 0)
3923 if (S_ISLNK (s.st_mode) != 0)
3925 has_symlinks = 1;
3926 break;
3929 /* search backwards for last DIR_SEPARATOR */
3930 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3931 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3932 p--;
3933 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3935 /* no more DIR_SEPARATORS left */
3936 break;
3938 *p = '\0';
3940 else
3942 char *errstr = strerror (errno);
3943 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3946 XFREE (tmp_pathspec);
3948 if (!has_symlinks)
3950 return xstrdup (pathspec);
3953 tmp_pathspec = realpath (pathspec, buf);
3954 if (tmp_pathspec == 0)
3956 lt_fatal ("Could not follow symlinks for %s", pathspec);
3958 return xstrdup (tmp_pathspec);
3959 #endif
3962 char *
3963 strendzap (char *str, const char *pat)
3965 size_t len, patlen;
3967 assert (str != NULL);
3968 assert (pat != NULL);
3970 len = strlen (str);
3971 patlen = strlen (pat);
3973 if (patlen <= len)
3975 str += len - patlen;
3976 if (strcmp (str, pat) == 0)
3977 *str = '\0';
3979 return str;
3982 static void
3983 lt_error_core (int exit_status, const char *mode,
3984 const char *message, va_list ap)
3986 fprintf (stderr, "%s: %s: ", program_name, mode);
3987 vfprintf (stderr, message, ap);
3988 fprintf (stderr, ".\n");
3990 if (exit_status >= 0)
3991 exit (exit_status);
3994 void
3995 lt_fatal (const char *message, ...)
3997 va_list ap;
3998 va_start (ap, message);
3999 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4000 va_end (ap);
4004 # end: func_emit_cwrapperexe_src
4006 # func_mode_link arg...
4007 func_mode_link ()
4009 $opt_debug
4010 case $host in
4011 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4012 # It is impossible to link a dll without this setting, and
4013 # we shouldn't force the makefile maintainer to figure out
4014 # which system we are compiling for in order to pass an extra
4015 # flag for every libtool invocation.
4016 # allow_undefined=no
4018 # FIXME: Unfortunately, there are problems with the above when trying
4019 # to make a dll which has undefined symbols, in which case not
4020 # even a static library is built. For now, we need to specify
4021 # -no-undefined on the libtool link line when we can be certain
4022 # that all symbols are satisfied, otherwise we get a static library.
4023 allow_undefined=yes
4026 allow_undefined=yes
4028 esac
4029 libtool_args=$nonopt
4030 base_compile="$nonopt $@"
4031 compile_command=$nonopt
4032 finalize_command=$nonopt
4034 compile_rpath=
4035 finalize_rpath=
4036 compile_shlibpath=
4037 finalize_shlibpath=
4038 convenience=
4039 old_convenience=
4040 deplibs=
4041 old_deplibs=
4042 compiler_flags=
4043 linker_flags=
4044 dllsearchpath=
4045 lib_search_path=`pwd`
4046 inst_prefix_dir=
4047 new_inherited_linker_flags=
4049 avoid_version=no
4050 dlfiles=
4051 dlprefiles=
4052 dlself=no
4053 export_dynamic=no
4054 export_symbols=
4055 export_symbols_regex=
4056 generated=
4057 libobjs=
4058 ltlibs=
4059 module=no
4060 no_install=no
4061 objs=
4062 non_pic_objects=
4063 precious_files_regex=
4064 prefer_static_libs=no
4065 preload=no
4066 prev=
4067 prevarg=
4068 release=
4069 rpath=
4070 xrpath=
4071 perm_rpath=
4072 temp_rpath=
4073 thread_safe=no
4074 vinfo=
4075 vinfo_number=no
4076 weak_libs=
4077 single_module="${wl}-single_module"
4078 func_infer_tag $base_compile
4080 # We need to know -static, to get the right output filenames.
4081 for arg
4083 case $arg in
4084 -shared)
4085 test "$build_libtool_libs" != yes && \
4086 func_fatal_configuration "can not build a shared library"
4087 build_old_libs=no
4088 break
4090 -all-static | -static | -static-libtool-libs)
4091 case $arg in
4092 -all-static)
4093 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4094 func_warning "complete static linking is impossible in this configuration"
4096 if test -n "$link_static_flag"; then
4097 dlopen_self=$dlopen_self_static
4099 prefer_static_libs=yes
4101 -static)
4102 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4103 dlopen_self=$dlopen_self_static
4105 prefer_static_libs=built
4107 -static-libtool-libs)
4108 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4109 dlopen_self=$dlopen_self_static
4111 prefer_static_libs=yes
4113 esac
4114 build_libtool_libs=no
4115 build_old_libs=yes
4116 break
4118 esac
4119 done
4121 # See if our shared archives depend on static archives.
4122 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4124 # Go through the arguments, transforming them on the way.
4125 while test "$#" -gt 0; do
4126 arg="$1"
4127 shift
4128 func_quote_for_eval "$arg"
4129 qarg=$func_quote_for_eval_unquoted_result
4130 func_append libtool_args " $func_quote_for_eval_result"
4132 # If the previous option needs an argument, assign it.
4133 if test -n "$prev"; then
4134 case $prev in
4135 output)
4136 func_append compile_command " @OUTPUT@"
4137 func_append finalize_command " @OUTPUT@"
4139 esac
4141 case $prev in
4142 dlfiles|dlprefiles)
4143 if test "$preload" = no; then
4144 # Add the symbol object into the linking commands.
4145 func_append compile_command " @SYMFILE@"
4146 func_append finalize_command " @SYMFILE@"
4147 preload=yes
4149 case $arg in
4150 *.la | *.lo) ;; # We handle these cases below.
4151 force)
4152 if test "$dlself" = no; then
4153 dlself=needless
4154 export_dynamic=yes
4156 prev=
4157 continue
4159 self)
4160 if test "$prev" = dlprefiles; then
4161 dlself=yes
4162 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4163 dlself=yes
4164 else
4165 dlself=needless
4166 export_dynamic=yes
4168 prev=
4169 continue
4172 if test "$prev" = dlfiles; then
4173 dlfiles="$dlfiles $arg"
4174 else
4175 dlprefiles="$dlprefiles $arg"
4177 prev=
4178 continue
4180 esac
4182 expsyms)
4183 export_symbols="$arg"
4184 test -f "$arg" \
4185 || func_fatal_error "symbol file \`$arg' does not exist"
4186 prev=
4187 continue
4189 expsyms_regex)
4190 export_symbols_regex="$arg"
4191 prev=
4192 continue
4194 framework)
4195 case $host in
4196 *-*-darwin*)
4197 case "$deplibs " in
4198 *" $qarg.ltframework "*) ;;
4199 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4201 esac
4203 esac
4204 prev=
4205 continue
4207 inst_prefix)
4208 inst_prefix_dir="$arg"
4209 prev=
4210 continue
4212 objectlist)
4213 if test -f "$arg"; then
4214 save_arg=$arg
4215 moreargs=
4216 for fil in `cat "$save_arg"`
4218 # moreargs="$moreargs $fil"
4219 arg=$fil
4220 # A libtool-controlled object.
4222 # Check to see that this really is a libtool object.
4223 if func_lalib_unsafe_p "$arg"; then
4224 pic_object=
4225 non_pic_object=
4227 # Read the .lo file
4228 func_source "$arg"
4230 if test -z "$pic_object" ||
4231 test -z "$non_pic_object" ||
4232 test "$pic_object" = none &&
4233 test "$non_pic_object" = none; then
4234 func_fatal_error "cannot find name of object for \`$arg'"
4237 # Extract subdirectory from the argument.
4238 func_dirname "$arg" "/" ""
4239 xdir="$func_dirname_result"
4241 if test "$pic_object" != none; then
4242 # Prepend the subdirectory the object is found in.
4243 pic_object="$xdir$pic_object"
4245 if test "$prev" = dlfiles; then
4246 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4247 dlfiles="$dlfiles $pic_object"
4248 prev=
4249 continue
4250 else
4251 # If libtool objects are unsupported, then we need to preload.
4252 prev=dlprefiles
4256 # CHECK ME: I think I busted this. -Ossama
4257 if test "$prev" = dlprefiles; then
4258 # Preload the old-style object.
4259 dlprefiles="$dlprefiles $pic_object"
4260 prev=
4263 # A PIC object.
4264 func_append libobjs " $pic_object"
4265 arg="$pic_object"
4268 # Non-PIC object.
4269 if test "$non_pic_object" != none; then
4270 # Prepend the subdirectory the object is found in.
4271 non_pic_object="$xdir$non_pic_object"
4273 # A standard non-PIC object
4274 func_append non_pic_objects " $non_pic_object"
4275 if test -z "$pic_object" || test "$pic_object" = none ; then
4276 arg="$non_pic_object"
4278 else
4279 # If the PIC object exists, use it instead.
4280 # $xdir was prepended to $pic_object above.
4281 non_pic_object="$pic_object"
4282 func_append non_pic_objects " $non_pic_object"
4284 else
4285 # Only an error if not doing a dry-run.
4286 if $opt_dry_run; then
4287 # Extract subdirectory from the argument.
4288 func_dirname "$arg" "/" ""
4289 xdir="$func_dirname_result"
4291 func_lo2o "$arg"
4292 pic_object=$xdir$objdir/$func_lo2o_result
4293 non_pic_object=$xdir$func_lo2o_result
4294 func_append libobjs " $pic_object"
4295 func_append non_pic_objects " $non_pic_object"
4296 else
4297 func_fatal_error "\`$arg' is not a valid libtool object"
4300 done
4301 else
4302 func_fatal_error "link input file \`$arg' does not exist"
4304 arg=$save_arg
4305 prev=
4306 continue
4308 precious_regex)
4309 precious_files_regex="$arg"
4310 prev=
4311 continue
4313 release)
4314 release="-$arg"
4315 prev=
4316 continue
4318 rpath | xrpath)
4319 # We need an absolute path.
4320 case $arg in
4321 [\\/]* | [A-Za-z]:[\\/]*) ;;
4323 func_fatal_error "only absolute run-paths are allowed"
4325 esac
4326 if test "$prev" = rpath; then
4327 case "$rpath " in
4328 *" $arg "*) ;;
4329 *) rpath="$rpath $arg" ;;
4330 esac
4331 else
4332 case "$xrpath " in
4333 *" $arg "*) ;;
4334 *) xrpath="$xrpath $arg" ;;
4335 esac
4337 prev=
4338 continue
4340 shrext)
4341 shrext_cmds="$arg"
4342 prev=
4343 continue
4345 weak)
4346 weak_libs="$weak_libs $arg"
4347 prev=
4348 continue
4350 xcclinker)
4351 linker_flags="$linker_flags $qarg"
4352 compiler_flags="$compiler_flags $qarg"
4353 prev=
4354 func_append compile_command " $qarg"
4355 func_append finalize_command " $qarg"
4356 continue
4358 xcompiler)
4359 compiler_flags="$compiler_flags $qarg"
4360 prev=
4361 func_append compile_command " $qarg"
4362 func_append finalize_command " $qarg"
4363 continue
4365 xlinker)
4366 linker_flags="$linker_flags $qarg"
4367 compiler_flags="$compiler_flags $wl$qarg"
4368 prev=
4369 func_append compile_command " $wl$qarg"
4370 func_append finalize_command " $wl$qarg"
4371 continue
4374 eval "$prev=\"\$arg\""
4375 prev=
4376 continue
4378 esac
4379 fi # test -n "$prev"
4381 prevarg="$arg"
4383 case $arg in
4384 -all-static)
4385 if test -n "$link_static_flag"; then
4386 # See comment for -static flag below, for more details.
4387 func_append compile_command " $link_static_flag"
4388 func_append finalize_command " $link_static_flag"
4390 continue
4393 -allow-undefined)
4394 # FIXME: remove this flag sometime in the future.
4395 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
4398 -avoid-version)
4399 avoid_version=yes
4400 continue
4403 -dlopen)
4404 prev=dlfiles
4405 continue
4408 -dlpreopen)
4409 prev=dlprefiles
4410 continue
4413 -export-dynamic)
4414 export_dynamic=yes
4415 continue
4418 -export-symbols | -export-symbols-regex)
4419 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
4420 func_fatal_error "more than one -exported-symbols argument is not allowed"
4422 if test "X$arg" = "X-export-symbols"; then
4423 prev=expsyms
4424 else
4425 prev=expsyms_regex
4427 continue
4430 -framework)
4431 prev=framework
4432 continue
4435 -inst-prefix-dir)
4436 prev=inst_prefix
4437 continue
4440 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
4441 # so, if we see these flags be careful not to treat them like -L
4442 -L[A-Z][A-Z]*:*)
4443 case $with_gcc/$host in
4444 no/*-*-irix* | /*-*-irix*)
4445 func_append compile_command " $arg"
4446 func_append finalize_command " $arg"
4448 esac
4449 continue
4452 -L*)
4453 func_stripname '-L' '' "$arg"
4454 dir=$func_stripname_result
4455 # We need an absolute path.
4456 case $dir in
4457 [\\/]* | [A-Za-z]:[\\/]*) ;;
4459 absdir=`cd "$dir" && pwd`
4460 test -z "$absdir" && \
4461 func_fatal_error "cannot determine absolute directory name of \`$dir'"
4462 dir="$absdir"
4464 esac
4465 case "$deplibs " in
4466 *" -L$dir "*) ;;
4468 deplibs="$deplibs -L$dir"
4469 lib_search_path="$lib_search_path $dir"
4471 esac
4472 case $host in
4473 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4474 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
4475 case :$dllsearchpath: in
4476 *":$dir:"*) ;;
4477 *) dllsearchpath="$dllsearchpath:$dir";;
4478 esac
4479 case :$dllsearchpath: in
4480 *":$testbindir:"*) ;;
4481 *) dllsearchpath="$dllsearchpath:$testbindir";;
4482 esac
4484 esac
4485 continue
4488 -l*)
4489 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
4490 case $host in
4491 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
4492 # These systems don't actually have a C or math library (as such)
4493 continue
4495 *-*-os2*)
4496 # These systems don't actually have a C library (as such)
4497 test "X$arg" = "X-lc" && continue
4499 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4500 # Do not include libc due to us having libc/libc_r.
4501 test "X$arg" = "X-lc" && continue
4503 *-*-rhapsody* | *-*-darwin1.[012])
4504 # Rhapsody C and math libraries are in the System framework
4505 deplibs="$deplibs System.ltframework"
4506 continue
4508 *-*-sco3.2v5* | *-*-sco5v6*)
4509 # Causes problems with __ctype
4510 test "X$arg" = "X-lc" && continue
4512 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
4513 # Compiler inserts libc in the correct place for threads to work
4514 test "X$arg" = "X-lc" && continue
4516 esac
4517 elif test "X$arg" = "X-lc_r"; then
4518 case $host in
4519 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4520 # Do not include libc_r directly, use -pthread flag.
4521 continue
4523 esac
4525 deplibs="$deplibs $arg"
4526 continue
4529 -module)
4530 module=yes
4531 continue
4534 # Tru64 UNIX uses -model [arg] to determine the layout of C++
4535 # classes, name mangling, and exception handling.
4536 # Darwin uses the -arch flag to determine output architecture.
4537 -model|-arch|-isysroot)
4538 compiler_flags="$compiler_flags $arg"
4539 func_append compile_command " $arg"
4540 func_append finalize_command " $arg"
4541 prev=xcompiler
4542 continue
4545 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4546 compiler_flags="$compiler_flags $arg"
4547 func_append compile_command " $arg"
4548 func_append finalize_command " $arg"
4549 case "$new_inherited_linker_flags " in
4550 *" $arg "*) ;;
4551 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
4552 esac
4553 continue
4556 -multi_module)
4557 single_module="${wl}-multi_module"
4558 continue
4561 -no-fast-install)
4562 fast_install=no
4563 continue
4566 -no-install)
4567 case $host in
4568 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
4569 # The PATH hackery in wrapper scripts is required on Windows
4570 # and Darwin in order for the loader to find any dlls it needs.
4571 func_warning "\`-no-install' is ignored for $host"
4572 func_warning "assuming \`-no-fast-install' instead"
4573 fast_install=no
4575 *) no_install=yes ;;
4576 esac
4577 continue
4580 -no-undefined)
4581 allow_undefined=no
4582 continue
4585 -objectlist)
4586 prev=objectlist
4587 continue
4590 -o) prev=output ;;
4592 -precious-files-regex)
4593 prev=precious_regex
4594 continue
4597 -release)
4598 prev=release
4599 continue
4602 -rpath)
4603 prev=rpath
4604 continue
4608 prev=xrpath
4609 continue
4612 -R*)
4613 func_stripname '-R' '' "$arg"
4614 dir=$func_stripname_result
4615 # We need an absolute path.
4616 case $dir in
4617 [\\/]* | [A-Za-z]:[\\/]*) ;;
4619 func_fatal_error "only absolute run-paths are allowed"
4621 esac
4622 case "$xrpath " in
4623 *" $dir "*) ;;
4624 *) xrpath="$xrpath $dir" ;;
4625 esac
4626 continue
4629 -shared)
4630 # The effects of -shared are defined in a previous loop.
4631 continue
4634 -shrext)
4635 prev=shrext
4636 continue
4639 -static | -static-libtool-libs)
4640 # The effects of -static are defined in a previous loop.
4641 # We used to do the same as -all-static on platforms that
4642 # didn't have a PIC flag, but the assumption that the effects
4643 # would be equivalent was wrong. It would break on at least
4644 # Digital Unix and AIX.
4645 continue
4648 -thread-safe)
4649 thread_safe=yes
4650 continue
4653 -version-info)
4654 prev=vinfo
4655 continue
4658 -version-number)
4659 prev=vinfo
4660 vinfo_number=yes
4661 continue
4664 -weak)
4665 prev=weak
4666 continue
4669 -Wc,*)
4670 func_stripname '-Wc,' '' "$arg"
4671 args=$func_stripname_result
4672 arg=
4673 save_ifs="$IFS"; IFS=','
4674 for flag in $args; do
4675 IFS="$save_ifs"
4676 func_quote_for_eval "$flag"
4677 arg="$arg $wl$func_quote_for_eval_result"
4678 compiler_flags="$compiler_flags $func_quote_for_eval_result"
4679 done
4680 IFS="$save_ifs"
4681 func_stripname ' ' '' "$arg"
4682 arg=$func_stripname_result
4685 -Wl,*)
4686 func_stripname '-Wl,' '' "$arg"
4687 args=$func_stripname_result
4688 arg=
4689 save_ifs="$IFS"; IFS=','
4690 for flag in $args; do
4691 IFS="$save_ifs"
4692 func_quote_for_eval "$flag"
4693 arg="$arg $wl$func_quote_for_eval_result"
4694 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
4695 linker_flags="$linker_flags $func_quote_for_eval_result"
4696 done
4697 IFS="$save_ifs"
4698 func_stripname ' ' '' "$arg"
4699 arg=$func_stripname_result
4702 -Xcompiler)
4703 prev=xcompiler
4704 continue
4707 -Xlinker)
4708 prev=xlinker
4709 continue
4712 -XCClinker)
4713 prev=xcclinker
4714 continue
4717 # -msg_* for osf cc
4718 -msg_*)
4719 func_quote_for_eval "$arg"
4720 arg="$func_quote_for_eval_result"
4723 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
4724 # -r[0-9][0-9]* specifies the processor on the SGI compiler
4725 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
4726 # +DA*, +DD* enable 64-bit mode on the HP compiler
4727 # -q* pass through compiler args for the IBM compiler
4728 # -m*, -t[45]*, -txscale* pass through architecture-specific
4729 # compiler args for GCC
4730 # -F/path gives path to uninstalled frameworks, gcc on darwin
4731 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
4732 # @file GCC response files
4733 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
4734 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
4735 func_quote_for_eval "$arg"
4736 arg="$func_quote_for_eval_result"
4737 func_append compile_command " $arg"
4738 func_append finalize_command " $arg"
4739 compiler_flags="$compiler_flags $arg"
4740 continue
4743 # Some other compiler flag.
4744 -* | +*)
4745 func_quote_for_eval "$arg"
4746 arg="$func_quote_for_eval_result"
4749 *.$objext)
4750 # A standard object.
4751 objs="$objs $arg"
4754 *.lo)
4755 # A libtool-controlled object.
4757 # Check to see that this really is a libtool object.
4758 if func_lalib_unsafe_p "$arg"; then
4759 pic_object=
4760 non_pic_object=
4762 # Read the .lo file
4763 func_source "$arg"
4765 if test -z "$pic_object" ||
4766 test -z "$non_pic_object" ||
4767 test "$pic_object" = none &&
4768 test "$non_pic_object" = none; then
4769 func_fatal_error "cannot find name of object for \`$arg'"
4772 # Extract subdirectory from the argument.
4773 func_dirname "$arg" "/" ""
4774 xdir="$func_dirname_result"
4776 if test "$pic_object" != none; then
4777 # Prepend the subdirectory the object is found in.
4778 pic_object="$xdir$pic_object"
4780 if test "$prev" = dlfiles; then
4781 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4782 dlfiles="$dlfiles $pic_object"
4783 prev=
4784 continue
4785 else
4786 # If libtool objects are unsupported, then we need to preload.
4787 prev=dlprefiles
4791 # CHECK ME: I think I busted this. -Ossama
4792 if test "$prev" = dlprefiles; then
4793 # Preload the old-style object.
4794 dlprefiles="$dlprefiles $pic_object"
4795 prev=
4798 # A PIC object.
4799 func_append libobjs " $pic_object"
4800 arg="$pic_object"
4803 # Non-PIC object.
4804 if test "$non_pic_object" != none; then
4805 # Prepend the subdirectory the object is found in.
4806 non_pic_object="$xdir$non_pic_object"
4808 # A standard non-PIC object
4809 func_append non_pic_objects " $non_pic_object"
4810 if test -z "$pic_object" || test "$pic_object" = none ; then
4811 arg="$non_pic_object"
4813 else
4814 # If the PIC object exists, use it instead.
4815 # $xdir was prepended to $pic_object above.
4816 non_pic_object="$pic_object"
4817 func_append non_pic_objects " $non_pic_object"
4819 else
4820 # Only an error if not doing a dry-run.
4821 if $opt_dry_run; then
4822 # Extract subdirectory from the argument.
4823 func_dirname "$arg" "/" ""
4824 xdir="$func_dirname_result"
4826 func_lo2o "$arg"
4827 pic_object=$xdir$objdir/$func_lo2o_result
4828 non_pic_object=$xdir$func_lo2o_result
4829 func_append libobjs " $pic_object"
4830 func_append non_pic_objects " $non_pic_object"
4831 else
4832 func_fatal_error "\`$arg' is not a valid libtool object"
4837 *.$libext)
4838 # An archive.
4839 deplibs="$deplibs $arg"
4840 old_deplibs="$old_deplibs $arg"
4841 continue
4844 *.la)
4845 # A libtool-controlled library.
4847 if test "$prev" = dlfiles; then
4848 # This library was specified with -dlopen.
4849 dlfiles="$dlfiles $arg"
4850 prev=
4851 elif test "$prev" = dlprefiles; then
4852 # The library was specified with -dlpreopen.
4853 dlprefiles="$dlprefiles $arg"
4854 prev=
4855 else
4856 deplibs="$deplibs $arg"
4858 continue
4861 # Some other compiler argument.
4863 # Unknown arguments in both finalize_command and compile_command need
4864 # to be aesthetically quoted because they are evaled later.
4865 func_quote_for_eval "$arg"
4866 arg="$func_quote_for_eval_result"
4868 esac # arg
4870 # Now actually substitute the argument into the commands.
4871 if test -n "$arg"; then
4872 func_append compile_command " $arg"
4873 func_append finalize_command " $arg"
4875 done # argument parsing loop
4877 test -n "$prev" && \
4878 func_fatal_help "the \`$prevarg' option requires an argument"
4880 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
4881 eval arg=\"$export_dynamic_flag_spec\"
4882 func_append compile_command " $arg"
4883 func_append finalize_command " $arg"
4886 oldlibs=
4887 # calculate the name of the file, without its directory
4888 func_basename "$output"
4889 outputname="$func_basename_result"
4890 libobjs_save="$libobjs"
4892 if test -n "$shlibpath_var"; then
4893 # get the directories listed in $shlibpath_var
4894 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
4895 else
4896 shlib_search_path=
4898 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
4899 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
4901 func_dirname "$output" "/" ""
4902 output_objdir="$func_dirname_result$objdir"
4903 # Create the object directory.
4904 func_mkdir_p "$output_objdir"
4906 # Determine the type of output
4907 case $output in
4909 func_fatal_help "you must specify an output file"
4911 *.$libext) linkmode=oldlib ;;
4912 *.lo | *.$objext) linkmode=obj ;;
4913 *.la) linkmode=lib ;;
4914 *) linkmode=prog ;; # Anything else should be a program.
4915 esac
4917 specialdeplibs=
4919 libs=
4920 # Find all interdependent deplibs by searching for libraries
4921 # that are linked more than once (e.g. -la -lb -la)
4922 for deplib in $deplibs; do
4923 if $opt_duplicate_deps ; then
4924 case "$libs " in
4925 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4926 esac
4928 libs="$libs $deplib"
4929 done
4931 if test "$linkmode" = lib; then
4932 libs="$predeps $libs $compiler_lib_search_path $postdeps"
4934 # Compute libraries that are listed more than once in $predeps
4935 # $postdeps and mark them as special (i.e., whose duplicates are
4936 # not to be eliminated).
4937 pre_post_deps=
4938 if $opt_duplicate_compiler_generated_deps; then
4939 for pre_post_dep in $predeps $postdeps; do
4940 case "$pre_post_deps " in
4941 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
4942 esac
4943 pre_post_deps="$pre_post_deps $pre_post_dep"
4944 done
4946 pre_post_deps=
4949 deplibs=
4950 newdependency_libs=
4951 newlib_search_path=
4952 need_relink=no # whether we're linking any uninstalled libtool libraries
4953 notinst_deplibs= # not-installed libtool libraries
4954 notinst_path= # paths that contain not-installed libtool libraries
4956 case $linkmode in
4957 lib)
4958 passes="conv dlpreopen link"
4959 for file in $dlfiles $dlprefiles; do
4960 case $file in
4961 *.la) ;;
4963 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
4965 esac
4966 done
4968 prog)
4969 compile_deplibs=
4970 finalize_deplibs=
4971 alldeplibs=no
4972 newdlfiles=
4973 newdlprefiles=
4974 passes="conv scan dlopen dlpreopen link"
4976 *) passes="conv"
4978 esac
4980 for pass in $passes; do
4981 # The preopen pass in lib mode reverses $deplibs; put it back here
4982 # so that -L comes before libs that need it for instance...
4983 if test "$linkmode,$pass" = "lib,link"; then
4984 ## FIXME: Find the place where the list is rebuilt in the wrong
4985 ## order, and fix it there properly
4986 tmp_deplibs=
4987 for deplib in $deplibs; do
4988 tmp_deplibs="$deplib $tmp_deplibs"
4989 done
4990 deplibs="$tmp_deplibs"
4993 if test "$linkmode,$pass" = "lib,link" ||
4994 test "$linkmode,$pass" = "prog,scan"; then
4995 libs="$deplibs"
4996 deplibs=
4998 if test "$linkmode" = prog; then
4999 case $pass in
5000 dlopen) libs="$dlfiles" ;;
5001 dlpreopen) libs="$dlprefiles" ;;
5002 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5003 esac
5005 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5006 # Collect and forward deplibs of preopened libtool libs
5007 for lib in $dlprefiles; do
5008 # Ignore non-libtool-libs
5009 dependency_libs=
5010 case $lib in
5011 *.la) func_source "$lib" ;;
5012 esac
5014 # Collect preopened libtool deplibs, except any this library
5015 # has declared as weak libs
5016 for deplib in $dependency_libs; do
5017 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
5018 case " $weak_libs " in
5019 *" $deplib_base "*) ;;
5020 *) deplibs="$deplibs $deplib" ;;
5021 esac
5022 done
5023 done
5024 libs="$dlprefiles"
5026 if test "$pass" = dlopen; then
5027 # Collect dlpreopened libraries
5028 save_deplibs="$deplibs"
5029 deplibs=
5032 for deplib in $libs; do
5033 lib=
5034 found=no
5035 case $deplib in
5036 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5037 if test "$linkmode,$pass" = "prog,link"; then
5038 compile_deplibs="$deplib $compile_deplibs"
5039 finalize_deplibs="$deplib $finalize_deplibs"
5040 else
5041 compiler_flags="$compiler_flags $deplib"
5042 if test "$linkmode" = lib ; then
5043 case "$new_inherited_linker_flags " in
5044 *" $deplib "*) ;;
5045 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5046 esac
5049 continue
5051 -l*)
5052 if test "$linkmode" != lib && test "$linkmode" != prog; then
5053 func_warning "\`-l' is ignored for archives/objects"
5054 continue
5056 func_stripname '-l' '' "$deplib"
5057 name=$func_stripname_result
5058 if test "$linkmode" = lib; then
5059 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5060 else
5061 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5063 for searchdir in $searchdirs; do
5064 for search_ext in .la $std_shrext .so .a; do
5065 # Search the libtool library
5066 lib="$searchdir/lib${name}${search_ext}"
5067 if test -f "$lib"; then
5068 if test "$search_ext" = ".la"; then
5069 found=yes
5070 else
5071 found=no
5073 break 2
5075 done
5076 done
5077 if test "$found" != yes; then
5078 # deplib doesn't seem to be a libtool library
5079 if test "$linkmode,$pass" = "prog,link"; then
5080 compile_deplibs="$deplib $compile_deplibs"
5081 finalize_deplibs="$deplib $finalize_deplibs"
5082 else
5083 deplibs="$deplib $deplibs"
5084 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5086 continue
5087 else # deplib is a libtool library
5088 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5089 # We need to do some special things here, and not later.
5090 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5091 case " $predeps $postdeps " in
5092 *" $deplib "*)
5093 if func_lalib_p "$lib"; then
5094 library_names=
5095 old_library=
5096 func_source "$lib"
5097 for l in $old_library $library_names; do
5098 ll="$l"
5099 done
5100 if test "X$ll" = "X$old_library" ; then # only static version available
5101 found=no
5102 func_dirname "$lib" "" "."
5103 ladir="$func_dirname_result"
5104 lib=$ladir/$old_library
5105 if test "$linkmode,$pass" = "prog,link"; then
5106 compile_deplibs="$deplib $compile_deplibs"
5107 finalize_deplibs="$deplib $finalize_deplibs"
5108 else
5109 deplibs="$deplib $deplibs"
5110 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5112 continue
5116 *) ;;
5117 esac
5120 ;; # -l
5121 *.ltframework)
5122 if test "$linkmode,$pass" = "prog,link"; then
5123 compile_deplibs="$deplib $compile_deplibs"
5124 finalize_deplibs="$deplib $finalize_deplibs"
5125 else
5126 deplibs="$deplib $deplibs"
5127 if test "$linkmode" = lib ; then
5128 case "$new_inherited_linker_flags " in
5129 *" $deplib "*) ;;
5130 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5131 esac
5134 continue
5136 -L*)
5137 case $linkmode in
5138 lib)
5139 deplibs="$deplib $deplibs"
5140 test "$pass" = conv && continue
5141 newdependency_libs="$deplib $newdependency_libs"
5142 func_stripname '-L' '' "$deplib"
5143 newlib_search_path="$newlib_search_path $func_stripname_result"
5145 prog)
5146 if test "$pass" = conv; then
5147 deplibs="$deplib $deplibs"
5148 continue
5150 if test "$pass" = scan; then
5151 deplibs="$deplib $deplibs"
5152 else
5153 compile_deplibs="$deplib $compile_deplibs"
5154 finalize_deplibs="$deplib $finalize_deplibs"
5156 func_stripname '-L' '' "$deplib"
5157 newlib_search_path="$newlib_search_path $func_stripname_result"
5160 func_warning "\`-L' is ignored for archives/objects"
5162 esac # linkmode
5163 continue
5164 ;; # -L
5165 -R*)
5166 if test "$pass" = link; then
5167 func_stripname '-R' '' "$deplib"
5168 dir=$func_stripname_result
5169 # Make sure the xrpath contains only unique directories.
5170 case "$xrpath " in
5171 *" $dir "*) ;;
5172 *) xrpath="$xrpath $dir" ;;
5173 esac
5175 deplibs="$deplib $deplibs"
5176 continue
5178 *.la) lib="$deplib" ;;
5179 *.$libext)
5180 if test "$pass" = conv; then
5181 deplibs="$deplib $deplibs"
5182 continue
5184 case $linkmode in
5185 lib)
5186 # Linking convenience modules into shared libraries is allowed,
5187 # but linking other static libraries is non-portable.
5188 case " $dlpreconveniencelibs " in
5189 *" $deplib "*) ;;
5191 valid_a_lib=no
5192 case $deplibs_check_method in
5193 match_pattern*)
5194 set dummy $deplibs_check_method; shift
5195 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5196 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
5197 | $EGREP "$match_pattern_regex" > /dev/null; then
5198 valid_a_lib=yes
5201 pass_all)
5202 valid_a_lib=yes
5204 esac
5205 if test "$valid_a_lib" != yes; then
5206 $ECHO
5207 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5208 $ECHO "*** I have the capability to make that library automatically link in when"
5209 $ECHO "*** you link to this library. But I can only do this if you have a"
5210 $ECHO "*** shared version of the library, which you do not appear to have"
5211 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
5212 $ECHO "*** that it is just a static archive that I should not use here."
5213 else
5214 $ECHO
5215 $ECHO "*** Warning: Linking the shared library $output against the"
5216 $ECHO "*** static library $deplib is not portable!"
5217 deplibs="$deplib $deplibs"
5220 esac
5221 continue
5223 prog)
5224 if test "$pass" != link; then
5225 deplibs="$deplib $deplibs"
5226 else
5227 compile_deplibs="$deplib $compile_deplibs"
5228 finalize_deplibs="$deplib $finalize_deplibs"
5230 continue
5232 esac # linkmode
5233 ;; # *.$libext
5234 *.lo | *.$objext)
5235 if test "$pass" = conv; then
5236 deplibs="$deplib $deplibs"
5237 elif test "$linkmode" = prog; then
5238 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5239 # If there is no dlopen support or we're linking statically,
5240 # we need to preload.
5241 newdlprefiles="$newdlprefiles $deplib"
5242 compile_deplibs="$deplib $compile_deplibs"
5243 finalize_deplibs="$deplib $finalize_deplibs"
5244 else
5245 newdlfiles="$newdlfiles $deplib"
5248 continue
5250 %DEPLIBS%)
5251 alldeplibs=yes
5252 continue
5254 esac # case $deplib
5256 if test "$found" = yes || test -f "$lib"; then :
5257 else
5258 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
5261 # Check to see that this really is a libtool archive.
5262 func_lalib_unsafe_p "$lib" \
5263 || func_fatal_error "\`$lib' is not a valid libtool archive"
5265 func_dirname "$lib" "" "."
5266 ladir="$func_dirname_result"
5268 dlname=
5269 dlopen=
5270 dlpreopen=
5271 libdir=
5272 library_names=
5273 old_library=
5274 inherited_linker_flags=
5275 # If the library was installed with an old release of libtool,
5276 # it will not redefine variables installed, or shouldnotlink
5277 installed=yes
5278 shouldnotlink=no
5279 avoidtemprpath=
5282 # Read the .la file
5283 func_source "$lib"
5285 # Convert "-framework foo" to "foo.ltframework"
5286 if test -n "$inherited_linker_flags"; then
5287 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
5288 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5289 case " $new_inherited_linker_flags " in
5290 *" $tmp_inherited_linker_flag "*) ;;
5291 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
5292 esac
5293 done
5295 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5296 if test "$linkmode,$pass" = "lib,link" ||
5297 test "$linkmode,$pass" = "prog,scan" ||
5298 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
5299 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
5300 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
5303 if test "$pass" = conv; then
5304 # Only check for convenience libraries
5305 deplibs="$lib $deplibs"
5306 if test -z "$libdir"; then
5307 if test -z "$old_library"; then
5308 func_fatal_error "cannot find name of link library for \`$lib'"
5310 # It is a libtool convenience library, so add in its objects.
5311 convenience="$convenience $ladir/$objdir/$old_library"
5312 old_convenience="$old_convenience $ladir/$objdir/$old_library"
5313 elif test "$linkmode" != prog && test "$linkmode" != lib; then
5314 func_fatal_error "\`$lib' is not a convenience library"
5316 tmp_libs=
5317 for deplib in $dependency_libs; do
5318 deplibs="$deplib $deplibs"
5319 if $opt_duplicate_deps ; then
5320 case "$tmp_libs " in
5321 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5322 esac
5324 tmp_libs="$tmp_libs $deplib"
5325 done
5326 continue
5327 fi # $pass = conv
5330 # Get the name of the library we link against.
5331 linklib=
5332 for l in $old_library $library_names; do
5333 linklib="$l"
5334 done
5335 if test -z "$linklib"; then
5336 func_fatal_error "cannot find name of link library for \`$lib'"
5339 # This library was specified with -dlopen.
5340 if test "$pass" = dlopen; then
5341 if test -z "$libdir"; then
5342 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
5344 if test -z "$dlname" ||
5345 test "$dlopen_support" != yes ||
5346 test "$build_libtool_libs" = no; then
5347 # If there is no dlname, no dlopen support or we're linking
5348 # statically, we need to preload. We also need to preload any
5349 # dependent libraries so libltdl's deplib preloader doesn't
5350 # bomb out in the load deplibs phase.
5351 dlprefiles="$dlprefiles $lib $dependency_libs"
5352 else
5353 newdlfiles="$newdlfiles $lib"
5355 continue
5356 fi # $pass = dlopen
5358 # We need an absolute path.
5359 case $ladir in
5360 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
5362 abs_ladir=`cd "$ladir" && pwd`
5363 if test -z "$abs_ladir"; then
5364 func_warning "cannot determine absolute directory name of \`$ladir'"
5365 func_warning "passing it literally to the linker, although it might fail"
5366 abs_ladir="$ladir"
5369 esac
5370 func_basename "$lib"
5371 laname="$func_basename_result"
5373 # Find the relevant object directory and library name.
5374 if test "X$installed" = Xyes; then
5375 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5376 func_warning "library \`$lib' was moved."
5377 dir="$ladir"
5378 absdir="$abs_ladir"
5379 libdir="$abs_ladir"
5380 else
5381 dir="$libdir"
5382 absdir="$libdir"
5384 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
5385 else
5386 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5387 dir="$ladir"
5388 absdir="$abs_ladir"
5389 # Remove this search path later
5390 notinst_path="$notinst_path $abs_ladir"
5391 else
5392 dir="$ladir/$objdir"
5393 absdir="$abs_ladir/$objdir"
5394 # Remove this search path later
5395 notinst_path="$notinst_path $abs_ladir"
5397 fi # $installed = yes
5398 func_stripname 'lib' '.la' "$laname"
5399 name=$func_stripname_result
5401 # This library was specified with -dlpreopen.
5402 if test "$pass" = dlpreopen; then
5403 if test -z "$libdir" && test "$linkmode" = prog; then
5404 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
5406 # Prefer using a static library (so that no silly _DYNAMIC symbols
5407 # are required to link).
5408 if test -n "$old_library"; then
5409 newdlprefiles="$newdlprefiles $dir/$old_library"
5410 # Keep a list of preopened convenience libraries to check
5411 # that they are being used correctly in the link pass.
5412 test -z "$libdir" && \
5413 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
5414 # Otherwise, use the dlname, so that lt_dlopen finds it.
5415 elif test -n "$dlname"; then
5416 newdlprefiles="$newdlprefiles $dir/$dlname"
5417 else
5418 newdlprefiles="$newdlprefiles $dir/$linklib"
5420 fi # $pass = dlpreopen
5422 if test -z "$libdir"; then
5423 # Link the convenience library
5424 if test "$linkmode" = lib; then
5425 deplibs="$dir/$old_library $deplibs"
5426 elif test "$linkmode,$pass" = "prog,link"; then
5427 compile_deplibs="$dir/$old_library $compile_deplibs"
5428 finalize_deplibs="$dir/$old_library $finalize_deplibs"
5429 else
5430 deplibs="$lib $deplibs" # used for prog,scan pass
5432 continue
5436 if test "$linkmode" = prog && test "$pass" != link; then
5437 newlib_search_path="$newlib_search_path $ladir"
5438 deplibs="$lib $deplibs"
5440 linkalldeplibs=no
5441 if test "$link_all_deplibs" != no || test -z "$library_names" ||
5442 test "$build_libtool_libs" = no; then
5443 linkalldeplibs=yes
5446 tmp_libs=
5447 for deplib in $dependency_libs; do
5448 case $deplib in
5449 -L*) func_stripname '-L' '' "$deplib"
5450 newlib_search_path="$newlib_search_path $func_stripname_result"
5452 esac
5453 # Need to link against all dependency_libs?
5454 if test "$linkalldeplibs" = yes; then
5455 deplibs="$deplib $deplibs"
5456 else
5457 # Need to hardcode shared library paths
5458 # or/and link against static libraries
5459 newdependency_libs="$deplib $newdependency_libs"
5461 if $opt_duplicate_deps ; then
5462 case "$tmp_libs " in
5463 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5464 esac
5466 tmp_libs="$tmp_libs $deplib"
5467 done # for deplib
5468 continue
5469 fi # $linkmode = prog...
5471 if test "$linkmode,$pass" = "prog,link"; then
5472 if test -n "$library_names" &&
5473 { { test "$prefer_static_libs" = no ||
5474 test "$prefer_static_libs,$installed" = "built,yes"; } ||
5475 test -z "$old_library"; }; then
5476 # We need to hardcode the library path
5477 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
5478 # Make sure the rpath contains only unique directories.
5479 case "$temp_rpath:" in
5480 *"$absdir:"*) ;;
5481 *) temp_rpath="$temp_rpath$absdir:" ;;
5482 esac
5485 # Hardcode the library path.
5486 # Skip directories that are in the system default run-time
5487 # search path.
5488 case " $sys_lib_dlsearch_path " in
5489 *" $absdir "*) ;;
5491 case "$compile_rpath " in
5492 *" $absdir "*) ;;
5493 *) compile_rpath="$compile_rpath $absdir"
5494 esac
5496 esac
5497 case " $sys_lib_dlsearch_path " in
5498 *" $libdir "*) ;;
5500 case "$finalize_rpath " in
5501 *" $libdir "*) ;;
5502 *) finalize_rpath="$finalize_rpath $libdir"
5503 esac
5505 esac
5506 fi # $linkmode,$pass = prog,link...
5508 if test "$alldeplibs" = yes &&
5509 { test "$deplibs_check_method" = pass_all ||
5510 { test "$build_libtool_libs" = yes &&
5511 test -n "$library_names"; }; }; then
5512 # We only need to search for static libraries
5513 continue
5517 link_static=no # Whether the deplib will be linked statically
5518 use_static_libs=$prefer_static_libs
5519 if test "$use_static_libs" = built && test "$installed" = yes; then
5520 use_static_libs=no
5522 if test -n "$library_names" &&
5523 { test "$use_static_libs" = no || test -z "$old_library"; }; then
5524 case $host in
5525 *cygwin* | *mingw*)
5526 # No point in relinking DLLs because paths are not encoded
5527 notinst_deplibs="$notinst_deplibs $lib"
5528 need_relink=no
5531 if test "$installed" = no; then
5532 notinst_deplibs="$notinst_deplibs $lib"
5533 need_relink=yes
5536 esac
5537 # This is a shared library
5539 # Warn about portability, can't link against -module's on some
5540 # systems (darwin). Don't bleat about dlopened modules though!
5541 dlopenmodule=""
5542 for dlpremoduletest in $dlprefiles; do
5543 if test "X$dlpremoduletest" = "X$lib"; then
5544 dlopenmodule="$dlpremoduletest"
5545 break
5547 done
5548 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
5549 $ECHO
5550 if test "$linkmode" = prog; then
5551 $ECHO "*** Warning: Linking the executable $output against the loadable module"
5552 else
5553 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
5555 $ECHO "*** $linklib is not portable!"
5557 if test "$linkmode" = lib &&
5558 test "$hardcode_into_libs" = yes; then
5559 # Hardcode the library path.
5560 # Skip directories that are in the system default run-time
5561 # search path.
5562 case " $sys_lib_dlsearch_path " in
5563 *" $absdir "*) ;;
5565 case "$compile_rpath " in
5566 *" $absdir "*) ;;
5567 *) compile_rpath="$compile_rpath $absdir"
5568 esac
5570 esac
5571 case " $sys_lib_dlsearch_path " in
5572 *" $libdir "*) ;;
5574 case "$finalize_rpath " in
5575 *" $libdir "*) ;;
5576 *) finalize_rpath="$finalize_rpath $libdir"
5577 esac
5579 esac
5582 if test -n "$old_archive_from_expsyms_cmds"; then
5583 # figure out the soname
5584 set dummy $library_names
5585 shift
5586 realname="$1"
5587 shift
5588 libname=`eval "\\$ECHO \"$libname_spec\""`
5589 # use dlname if we got it. it's perfectly good, no?
5590 if test -n "$dlname"; then
5591 soname="$dlname"
5592 elif test -n "$soname_spec"; then
5593 # bleh windows
5594 case $host in
5595 *cygwin* | mingw*)
5596 func_arith $current - $age
5597 major=$func_arith_result
5598 versuffix="-$major"
5600 esac
5601 eval soname=\"$soname_spec\"
5602 else
5603 soname="$realname"
5606 # Make a new name for the extract_expsyms_cmds to use
5607 soroot="$soname"
5608 func_basename "$soroot"
5609 soname="$func_basename_result"
5610 func_stripname 'lib' '.dll' "$soname"
5611 newlib=libimp-$func_stripname_result.a
5613 # If the library has no export list, then create one now
5614 if test -f "$output_objdir/$soname-def"; then :
5615 else
5616 func_verbose "extracting exported symbol list from \`$soname'"
5617 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
5620 # Create $newlib
5621 if test -f "$output_objdir/$newlib"; then :; else
5622 func_verbose "generating import library for \`$soname'"
5623 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
5625 # make sure the library variables are pointing to the new library
5626 dir=$output_objdir
5627 linklib=$newlib
5628 fi # test -n "$old_archive_from_expsyms_cmds"
5630 if test "$linkmode" = prog || test "$mode" != relink; then
5631 add_shlibpath=
5632 add_dir=
5633 add=
5634 lib_linked=yes
5635 case $hardcode_action in
5636 immediate | unsupported)
5637 if test "$hardcode_direct" = no; then
5638 add="$dir/$linklib"
5639 case $host in
5640 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
5641 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
5642 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
5643 *-*-unixware7*) add_dir="-L$dir" ;;
5644 *-*-darwin* )
5645 # if the lib is a (non-dlopened) module then we can not
5646 # link against it, someone is ignoring the earlier warnings
5647 if /usr/bin/file -L $add 2> /dev/null |
5648 $GREP ": [^:]* bundle" >/dev/null ; then
5649 if test "X$dlopenmodule" != "X$lib"; then
5650 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
5651 if test -z "$old_library" ; then
5652 $ECHO
5653 $ECHO "*** And there doesn't seem to be a static archive available"
5654 $ECHO "*** The link will probably fail, sorry"
5655 else
5656 add="$dir/$old_library"
5658 elif test -n "$old_library"; then
5659 add="$dir/$old_library"
5662 esac
5663 elif test "$hardcode_minus_L" = no; then
5664 case $host in
5665 *-*-sunos*) add_shlibpath="$dir" ;;
5666 esac
5667 add_dir="-L$dir"
5668 add="-l$name"
5669 elif test "$hardcode_shlibpath_var" = no; then
5670 add_shlibpath="$dir"
5671 add="-l$name"
5672 else
5673 lib_linked=no
5676 relink)
5677 if test "$hardcode_direct" = yes &&
5678 test "$hardcode_direct_absolute" = no; then
5679 add="$dir/$linklib"
5680 elif test "$hardcode_minus_L" = yes; then
5681 add_dir="-L$dir"
5682 # Try looking first in the location we're being installed to.
5683 if test -n "$inst_prefix_dir"; then
5684 case $libdir in
5685 [\\/]*)
5686 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5688 esac
5690 add="-l$name"
5691 elif test "$hardcode_shlibpath_var" = yes; then
5692 add_shlibpath="$dir"
5693 add="-l$name"
5694 else
5695 lib_linked=no
5698 *) lib_linked=no ;;
5699 esac
5701 if test "$lib_linked" != yes; then
5702 func_fatal_configuration "unsupported hardcode properties"
5705 if test -n "$add_shlibpath"; then
5706 case :$compile_shlibpath: in
5707 *":$add_shlibpath:"*) ;;
5708 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
5709 esac
5711 if test "$linkmode" = prog; then
5712 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
5713 test -n "$add" && compile_deplibs="$add $compile_deplibs"
5714 else
5715 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5716 test -n "$add" && deplibs="$add $deplibs"
5717 if test "$hardcode_direct" != yes &&
5718 test "$hardcode_minus_L" != yes &&
5719 test "$hardcode_shlibpath_var" = yes; then
5720 case :$finalize_shlibpath: in
5721 *":$libdir:"*) ;;
5722 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5723 esac
5728 if test "$linkmode" = prog || test "$mode" = relink; then
5729 add_shlibpath=
5730 add_dir=
5731 add=
5732 # Finalize command for both is simple: just hardcode it.
5733 if test "$hardcode_direct" = yes &&
5734 test "$hardcode_direct_absolute" = no; then
5735 add="$libdir/$linklib"
5736 elif test "$hardcode_minus_L" = yes; then
5737 add_dir="-L$libdir"
5738 add="-l$name"
5739 elif test "$hardcode_shlibpath_var" = yes; then
5740 case :$finalize_shlibpath: in
5741 *":$libdir:"*) ;;
5742 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5743 esac
5744 add="-l$name"
5745 elif test "$hardcode_automatic" = yes; then
5746 if test -n "$inst_prefix_dir" &&
5747 test -f "$inst_prefix_dir$libdir/$linklib" ; then
5748 add="$inst_prefix_dir$libdir/$linklib"
5749 else
5750 add="$libdir/$linklib"
5752 else
5753 # We cannot seem to hardcode it, guess we'll fake it.
5754 add_dir="-L$libdir"
5755 # Try looking first in the location we're being installed to.
5756 if test -n "$inst_prefix_dir"; then
5757 case $libdir in
5758 [\\/]*)
5759 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5761 esac
5763 add="-l$name"
5766 if test "$linkmode" = prog; then
5767 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
5768 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
5769 else
5770 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5771 test -n "$add" && deplibs="$add $deplibs"
5774 elif test "$linkmode" = prog; then
5775 # Here we assume that one of hardcode_direct or hardcode_minus_L
5776 # is not unsupported. This is valid on all known static and
5777 # shared platforms.
5778 if test "$hardcode_direct" != unsupported; then
5779 test -n "$old_library" && linklib="$old_library"
5780 compile_deplibs="$dir/$linklib $compile_deplibs"
5781 finalize_deplibs="$dir/$linklib $finalize_deplibs"
5782 else
5783 compile_deplibs="-l$name -L$dir $compile_deplibs"
5784 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
5786 elif test "$build_libtool_libs" = yes; then
5787 # Not a shared library
5788 if test "$deplibs_check_method" != pass_all; then
5789 # We're trying link a shared library against a static one
5790 # but the system doesn't support it.
5792 # Just print a warning and add the library to dependency_libs so
5793 # that the program can be linked against the static library.
5794 $ECHO
5795 $ECHO "*** Warning: This system can not link to static lib archive $lib."
5796 $ECHO "*** I have the capability to make that library automatically link in when"
5797 $ECHO "*** you link to this library. But I can only do this if you have a"
5798 $ECHO "*** shared version of the library, which you do not appear to have."
5799 if test "$module" = yes; then
5800 $ECHO "*** But as you try to build a module library, libtool will still create "
5801 $ECHO "*** a static module, that should work as long as the dlopening application"
5802 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
5803 if test -z "$global_symbol_pipe"; then
5804 $ECHO
5805 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5806 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5807 $ECHO "*** not find such a program. So, this module is probably useless."
5808 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
5810 if test "$build_old_libs" = no; then
5811 build_libtool_libs=module
5812 build_old_libs=yes
5813 else
5814 build_libtool_libs=no
5817 else
5818 deplibs="$dir/$old_library $deplibs"
5819 link_static=yes
5821 fi # link shared/static library?
5823 if test "$linkmode" = lib; then
5824 if test -n "$dependency_libs" &&
5825 { test "$hardcode_into_libs" != yes ||
5826 test "$build_old_libs" = yes ||
5827 test "$link_static" = yes; }; then
5828 # Extract -R from dependency_libs
5829 temp_deplibs=
5830 for libdir in $dependency_libs; do
5831 case $libdir in
5832 -R*) func_stripname '-R' '' "$libdir"
5833 temp_xrpath=$func_stripname_result
5834 case " $xrpath " in
5835 *" $temp_xrpath "*) ;;
5836 *) xrpath="$xrpath $temp_xrpath";;
5837 esac;;
5838 *) temp_deplibs="$temp_deplibs $libdir";;
5839 esac
5840 done
5841 dependency_libs="$temp_deplibs"
5844 newlib_search_path="$newlib_search_path $absdir"
5845 # Link against this library
5846 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
5847 # ... and its dependency_libs
5848 tmp_libs=
5849 for deplib in $dependency_libs; do
5850 newdependency_libs="$deplib $newdependency_libs"
5851 if $opt_duplicate_deps ; then
5852 case "$tmp_libs " in
5853 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5854 esac
5856 tmp_libs="$tmp_libs $deplib"
5857 done
5859 if test "$link_all_deplibs" != no; then
5860 # Add the search paths of all dependency libraries
5861 for deplib in $dependency_libs; do
5862 case $deplib in
5863 -L*) path="$deplib" ;;
5864 *.la)
5865 func_dirname "$deplib" "" "."
5866 dir="$func_dirname_result"
5867 # We need an absolute path.
5868 case $dir in
5869 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
5871 absdir=`cd "$dir" && pwd`
5872 if test -z "$absdir"; then
5873 func_warning "cannot determine absolute directory name of \`$dir'"
5874 absdir="$dir"
5877 esac
5878 if $GREP "^installed=no" $deplib > /dev/null; then
5879 case $host in
5880 *-*-darwin*)
5881 depdepl=
5882 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
5883 if test -n "$deplibrary_names" ; then
5884 for tmp in $deplibrary_names ; do
5885 depdepl=$tmp
5886 done
5887 if test -f "$absdir/$objdir/$depdepl" ; then
5888 depdepl="$absdir/$objdir/$depdepl"
5889 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5890 if test -z "$darwin_install_name"; then
5891 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5893 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
5894 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
5895 path=
5900 path="-L$absdir/$objdir"
5902 esac
5903 else
5904 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5905 test -z "$libdir" && \
5906 func_fatal_error "\`$deplib' is not a valid libtool archive"
5907 test "$absdir" != "$libdir" && \
5908 func_warning "\`$deplib' seems to be moved"
5910 path="-L$absdir"
5913 esac
5914 case " $deplibs " in
5915 *" $path "*) ;;
5916 *) deplibs="$path $deplibs" ;;
5917 esac
5918 done
5919 fi # link_all_deplibs != no
5920 fi # linkmode = lib
5921 done # for deplib in $libs
5922 if test "$pass" = link; then
5923 if test "$linkmode" = "prog"; then
5924 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
5925 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
5926 else
5927 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5930 dependency_libs="$newdependency_libs"
5931 if test "$pass" = dlpreopen; then
5932 # Link the dlpreopened libraries before other libraries
5933 for deplib in $save_deplibs; do
5934 deplibs="$deplib $deplibs"
5935 done
5937 if test "$pass" != dlopen; then
5938 if test "$pass" != conv; then
5939 # Make sure lib_search_path contains only unique directories.
5940 lib_search_path=
5941 for dir in $newlib_search_path; do
5942 case "$lib_search_path " in
5943 *" $dir "*) ;;
5944 *) lib_search_path="$lib_search_path $dir" ;;
5945 esac
5946 done
5947 newlib_search_path=
5950 if test "$linkmode,$pass" != "prog,link"; then
5951 vars="deplibs"
5952 else
5953 vars="compile_deplibs finalize_deplibs"
5955 for var in $vars dependency_libs; do
5956 # Add libraries to $var in reverse order
5957 eval tmp_libs=\"\$$var\"
5958 new_libs=
5959 for deplib in $tmp_libs; do
5960 # FIXME: Pedantically, this is the right thing to do, so
5961 # that some nasty dependency loop isn't accidentally
5962 # broken:
5963 #new_libs="$deplib $new_libs"
5964 # Pragmatically, this seems to cause very few problems in
5965 # practice:
5966 case $deplib in
5967 -L*) new_libs="$deplib $new_libs" ;;
5968 -R*) ;;
5970 # And here is the reason: when a library appears more
5971 # than once as an explicit dependence of a library, or
5972 # is implicitly linked in more than once by the
5973 # compiler, it is considered special, and multiple
5974 # occurrences thereof are not removed. Compare this
5975 # with having the same library being listed as a
5976 # dependency of multiple other libraries: in this case,
5977 # we know (pedantically, we assume) the library does not
5978 # need to be listed more than once, so we keep only the
5979 # last copy. This is not always right, but it is rare
5980 # enough that we require users that really mean to play
5981 # such unportable linking tricks to link the library
5982 # using -Wl,-lname, so that libtool does not consider it
5983 # for duplicate removal.
5984 case " $specialdeplibs " in
5985 *" $deplib "*) new_libs="$deplib $new_libs" ;;
5987 case " $new_libs " in
5988 *" $deplib "*) ;;
5989 *) new_libs="$deplib $new_libs" ;;
5990 esac
5992 esac
5994 esac
5995 done
5996 tmp_libs=
5997 for deplib in $new_libs; do
5998 case $deplib in
5999 -L*)
6000 case " $tmp_libs " in
6001 *" $deplib "*) ;;
6002 *) tmp_libs="$tmp_libs $deplib" ;;
6003 esac
6005 *) tmp_libs="$tmp_libs $deplib" ;;
6006 esac
6007 done
6008 eval $var=\"$tmp_libs\"
6009 done # for var
6011 # Last step: remove runtime libs from dependency_libs
6012 # (they stay in deplibs)
6013 tmp_libs=
6014 for i in $dependency_libs ; do
6015 case " $predeps $postdeps $compiler_lib_search_path " in
6016 *" $i "*)
6017 i=""
6019 esac
6020 if test -n "$i" ; then
6021 tmp_libs="$tmp_libs $i"
6023 done
6024 dependency_libs=$tmp_libs
6025 done # for pass
6026 if test "$linkmode" = prog; then
6027 dlfiles="$newdlfiles"
6029 if test "$linkmode" = prog || test "$linkmode" = lib; then
6030 dlprefiles="$newdlprefiles"
6033 case $linkmode in
6034 oldlib)
6035 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6036 func_warning "\`-dlopen' is ignored for archives"
6039 case " $deplibs" in
6040 *\ -l* | *\ -L*)
6041 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6042 esac
6044 test -n "$rpath" && \
6045 func_warning "\`-rpath' is ignored for archives"
6047 test -n "$xrpath" && \
6048 func_warning "\`-R' is ignored for archives"
6050 test -n "$vinfo" && \
6051 func_warning "\`-version-info/-version-number' is ignored for archives"
6053 test -n "$release" && \
6054 func_warning "\`-release' is ignored for archives"
6056 test -n "$export_symbols$export_symbols_regex" && \
6057 func_warning "\`-export-symbols' is ignored for archives"
6059 # Now set the variables for building old libraries.
6060 build_libtool_libs=no
6061 oldlibs="$output"
6062 objs="$objs$old_deplibs"
6065 lib)
6066 # Make sure we only generate libraries of the form `libNAME.la'.
6067 case $outputname in
6068 lib*)
6069 func_stripname 'lib' '.la' "$outputname"
6070 name=$func_stripname_result
6071 eval shared_ext=\"$shrext_cmds\"
6072 eval libname=\"$libname_spec\"
6075 test "$module" = no && \
6076 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6078 if test "$need_lib_prefix" != no; then
6079 # Add the "lib" prefix for modules if required
6080 func_stripname '' '.la' "$outputname"
6081 name=$func_stripname_result
6082 eval shared_ext=\"$shrext_cmds\"
6083 eval libname=\"$libname_spec\"
6084 else
6085 func_stripname '' '.la' "$outputname"
6086 libname=$func_stripname_result
6089 esac
6091 if test -n "$objs"; then
6092 if test "$deplibs_check_method" != pass_all; then
6093 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6094 else
6095 $ECHO
6096 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6097 $ECHO "*** objects $objs is not portable!"
6098 libobjs="$libobjs $objs"
6102 test "$dlself" != no && \
6103 func_warning "\`-dlopen self' is ignored for libtool libraries"
6105 set dummy $rpath
6106 shift
6107 test "$#" -gt 1 && \
6108 func_warning "ignoring multiple \`-rpath's for a libtool library"
6110 install_libdir="$1"
6112 oldlibs=
6113 if test -z "$rpath"; then
6114 if test "$build_libtool_libs" = yes; then
6115 # Building a libtool convenience library.
6116 # Some compilers have problems with a `.al' extension so
6117 # convenience libraries should have the same extension an
6118 # archive normally would.
6119 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6120 build_libtool_libs=convenience
6121 build_old_libs=yes
6124 test -n "$vinfo" && \
6125 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6127 test -n "$release" && \
6128 func_warning "\`-release' is ignored for convenience libraries"
6129 else
6131 # Parse the version information argument.
6132 save_ifs="$IFS"; IFS=':'
6133 set dummy $vinfo 0 0 0
6134 shift
6135 IFS="$save_ifs"
6137 test -n "$7" && \
6138 func_fatal_help "too many parameters to \`-version-info'"
6140 # convert absolute version numbers to libtool ages
6141 # this retains compatibility with .la files and attempts
6142 # to make the code below a bit more comprehensible
6144 case $vinfo_number in
6145 yes)
6146 number_major="$1"
6147 number_minor="$2"
6148 number_revision="$3"
6150 # There are really only two kinds -- those that
6151 # use the current revision as the major version
6152 # and those that subtract age and use age as
6153 # a minor version. But, then there is irix
6154 # which has an extra 1 added just for fun
6156 case $version_type in
6157 darwin|linux|osf|windows|none)
6158 func_arith $number_major + $number_minor
6159 current=$func_arith_result
6160 age="$number_minor"
6161 revision="$number_revision"
6163 freebsd-aout|freebsd-elf|sunos)
6164 current="$number_major"
6165 revision="$number_minor"
6166 age="0"
6168 irix|nonstopux)
6169 func_arith $number_major + $number_minor
6170 current=$func_arith_result
6171 age="$number_minor"
6172 revision="$number_minor"
6173 lt_irix_increment=no
6175 esac
6178 current="$1"
6179 revision="$2"
6180 age="$3"
6182 esac
6184 # Check that each of the things are valid numbers.
6185 case $current in
6186 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]) ;;
6188 func_error "CURRENT \`$current' must be a nonnegative integer"
6189 func_fatal_error "\`$vinfo' is not valid version information"
6191 esac
6193 case $revision in
6194 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]) ;;
6196 func_error "REVISION \`$revision' must be a nonnegative integer"
6197 func_fatal_error "\`$vinfo' is not valid version information"
6199 esac
6201 case $age in
6202 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]) ;;
6204 func_error "AGE \`$age' must be a nonnegative integer"
6205 func_fatal_error "\`$vinfo' is not valid version information"
6207 esac
6209 if test "$age" -gt "$current"; then
6210 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6211 func_fatal_error "\`$vinfo' is not valid version information"
6214 # Calculate the version variables.
6215 major=
6216 versuffix=
6217 verstring=
6218 case $version_type in
6219 none) ;;
6221 darwin)
6222 # Like Linux, but with the current version available in
6223 # verstring for coding it into the library header
6224 func_arith $current - $age
6225 major=.$func_arith_result
6226 versuffix="$major.$age.$revision"
6227 # Darwin ld doesn't like 0 for these options...
6228 func_arith $current + 1
6229 minor_current=$func_arith_result
6230 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6231 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6234 freebsd-aout)
6235 major=".$current"
6236 versuffix=".$current.$revision";
6239 freebsd-elf)
6240 major=".$current"
6241 versuffix=".$current"
6244 irix | nonstopux)
6245 if test "X$lt_irix_increment" = "Xno"; then
6246 func_arith $current - $age
6247 else
6248 func_arith $current - $age + 1
6250 major=$func_arith_result
6252 case $version_type in
6253 nonstopux) verstring_prefix=nonstopux ;;
6254 *) verstring_prefix=sgi ;;
6255 esac
6256 verstring="$verstring_prefix$major.$revision"
6258 # Add in all the interfaces that we are compatible with.
6259 loop=$revision
6260 while test "$loop" -ne 0; do
6261 func_arith $revision - $loop
6262 iface=$func_arith_result
6263 func_arith $loop - 1
6264 loop=$func_arith_result
6265 verstring="$verstring_prefix$major.$iface:$verstring"
6266 done
6268 # Before this point, $major must not contain `.'.
6269 major=.$major
6270 versuffix="$major.$revision"
6273 linux)
6274 func_arith $current - $age
6275 major=.$func_arith_result
6276 versuffix="$major.$age.$revision"
6279 osf)
6280 func_arith $current - $age
6281 major=.$func_arith_result
6282 versuffix=".$current.$age.$revision"
6283 verstring="$current.$age.$revision"
6285 # Add in all the interfaces that we are compatible with.
6286 loop=$age
6287 while test "$loop" -ne 0; do
6288 func_arith $current - $loop
6289 iface=$func_arith_result
6290 func_arith $loop - 1
6291 loop=$func_arith_result
6292 verstring="$verstring:${iface}.0"
6293 done
6295 # Make executables depend on our current version.
6296 verstring="$verstring:${current}.0"
6299 qnx)
6300 major=".$current"
6301 versuffix=".$current"
6304 sunos)
6305 major=".$current"
6306 versuffix=".$current.$revision"
6309 windows)
6310 # Use '-' rather than '.', since we only want one
6311 # extension on DOS 8.3 filesystems.
6312 func_arith $current - $age
6313 major=$func_arith_result
6314 versuffix="-$major"
6318 func_fatal_configuration "unknown library version type \`$version_type'"
6320 esac
6322 # Clear the version info if we defaulted, and they specified a release.
6323 if test -z "$vinfo" && test -n "$release"; then
6324 major=
6325 case $version_type in
6326 darwin)
6327 # we can't check for "0.0" in archive_cmds due to quoting
6328 # problems, so we reset it completely
6329 verstring=
6332 verstring="0.0"
6334 esac
6335 if test "$need_version" = no; then
6336 versuffix=
6337 else
6338 versuffix=".0.0"
6342 # Remove version info from name if versioning should be avoided
6343 if test "$avoid_version" = yes && test "$need_version" = no; then
6344 major=
6345 versuffix=
6346 verstring=""
6349 # Check to see if the archive will have undefined symbols.
6350 if test "$allow_undefined" = yes; then
6351 if test "$allow_undefined_flag" = unsupported; then
6352 func_warning "undefined symbols not allowed in $host shared libraries"
6353 build_libtool_libs=no
6354 build_old_libs=yes
6356 else
6357 # Don't allow undefined symbols.
6358 allow_undefined_flag="$no_undefined_flag"
6363 func_generate_dlsyms "$libname" "$libname" "yes"
6364 libobjs="$libobjs $symfileobj"
6365 test "X$libobjs" = "X " && libobjs=
6367 if test "$mode" != relink; then
6368 # Remove our outputs, but don't remove object files since they
6369 # may have been created when compiling PIC objects.
6370 removelist=
6371 tempremovelist=`$ECHO "$output_objdir/*"`
6372 for p in $tempremovelist; do
6373 case $p in
6374 *.$objext)
6376 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
6377 if test "X$precious_files_regex" != "X"; then
6378 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6379 then
6380 continue
6383 removelist="$removelist $p"
6385 *) ;;
6386 esac
6387 done
6388 test -n "$removelist" && \
6389 func_show_eval "${RM}r \$removelist"
6392 # Now set the variables for building old libraries.
6393 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
6394 oldlibs="$oldlibs $output_objdir/$libname.$libext"
6396 # Transform .lo files to .o files.
6397 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
6400 # Eliminate all temporary directories.
6401 #for path in $notinst_path; do
6402 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
6403 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
6404 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
6405 #done
6407 if test -n "$xrpath"; then
6408 # If the user specified any rpath flags, then add them.
6409 temp_xrpath=
6410 for libdir in $xrpath; do
6411 temp_xrpath="$temp_xrpath -R$libdir"
6412 case "$finalize_rpath " in
6413 *" $libdir "*) ;;
6414 *) finalize_rpath="$finalize_rpath $libdir" ;;
6415 esac
6416 done
6417 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
6418 dependency_libs="$temp_xrpath $dependency_libs"
6422 # Make sure dlfiles contains only unique files that won't be dlpreopened
6423 old_dlfiles="$dlfiles"
6424 dlfiles=
6425 for lib in $old_dlfiles; do
6426 case " $dlprefiles $dlfiles " in
6427 *" $lib "*) ;;
6428 *) dlfiles="$dlfiles $lib" ;;
6429 esac
6430 done
6432 # Make sure dlprefiles contains only unique files
6433 old_dlprefiles="$dlprefiles"
6434 dlprefiles=
6435 for lib in $old_dlprefiles; do
6436 case "$dlprefiles " in
6437 *" $lib "*) ;;
6438 *) dlprefiles="$dlprefiles $lib" ;;
6439 esac
6440 done
6442 if test "$build_libtool_libs" = yes; then
6443 if test -n "$rpath"; then
6444 case $host in
6445 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
6446 # these systems don't actually have a c library (as such)!
6448 *-*-rhapsody* | *-*-darwin1.[012])
6449 # Rhapsody C library is in the System framework
6450 deplibs="$deplibs System.ltframework"
6452 *-*-netbsd*)
6453 # Don't link with libc until the a.out ld.so is fixed.
6455 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6456 # Do not include libc due to us having libc/libc_r.
6458 *-*-sco3.2v5* | *-*-sco5v6*)
6459 # Causes problems with __ctype
6461 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6462 # Compiler inserts libc in the correct place for threads to work
6465 # Add libc to deplibs on all other systems if necessary.
6466 if test "$build_libtool_need_lc" = "yes"; then
6467 deplibs="$deplibs -lc"
6470 esac
6473 # Transform deplibs into only deplibs that can be linked in shared.
6474 name_save=$name
6475 libname_save=$libname
6476 release_save=$release
6477 versuffix_save=$versuffix
6478 major_save=$major
6479 # I'm not sure if I'm treating the release correctly. I think
6480 # release should show up in the -l (ie -lgmp5) so we don't want to
6481 # add it in twice. Is that correct?
6482 release=""
6483 versuffix=""
6484 major=""
6485 newdeplibs=
6486 droppeddeps=no
6487 case $deplibs_check_method in
6488 pass_all)
6489 # Don't check for shared/static. Everything works.
6490 # This might be a little naive. We might want to check
6491 # whether the library exists or not. But this is on
6492 # osf3 & osf4 and I'm not really sure... Just
6493 # implementing what was already the behavior.
6494 newdeplibs=$deplibs
6496 test_compile)
6497 # This code stresses the "libraries are programs" paradigm to its
6498 # limits. Maybe even breaks it. We compile a program, linking it
6499 # against the deplibs as a proxy for the library. Then we can check
6500 # whether they linked in statically or dynamically with ldd.
6501 $opt_dry_run || $RM conftest.c
6502 cat > conftest.c <<EOF
6503 int main() { return 0; }
6505 $opt_dry_run || $RM conftest
6506 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
6507 ldd_output=`ldd conftest`
6508 for i in $deplibs; do
6509 case $i in
6510 -l*)
6511 func_stripname -l '' "$i"
6512 name=$func_stripname_result
6513 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6514 case " $predeps $postdeps " in
6515 *" $i "*)
6516 newdeplibs="$newdeplibs $i"
6517 i=""
6519 esac
6521 if test -n "$i" ; then
6522 libname=`eval "\\$ECHO \"$libname_spec\""`
6523 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6524 set dummy $deplib_matches; shift
6525 deplib_match=$1
6526 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6527 newdeplibs="$newdeplibs $i"
6528 else
6529 droppeddeps=yes
6530 $ECHO
6531 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6532 $ECHO "*** I have the capability to make that library automatically link in when"
6533 $ECHO "*** you link to this library. But I can only do this if you have a"
6534 $ECHO "*** shared version of the library, which I believe you do not have"
6535 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
6536 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
6541 newdeplibs="$newdeplibs $i"
6543 esac
6544 done
6545 else
6546 # Error occurred in the first compile. Let's try to salvage
6547 # the situation: Compile a separate program for each library.
6548 for i in $deplibs; do
6549 case $i in
6550 -l*)
6551 func_stripname -l '' "$i"
6552 name=$func_stripname_result
6553 $opt_dry_run || $RM conftest
6554 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
6555 ldd_output=`ldd conftest`
6556 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6557 case " $predeps $postdeps " in
6558 *" $i "*)
6559 newdeplibs="$newdeplibs $i"
6560 i=""
6562 esac
6564 if test -n "$i" ; then
6565 libname=`eval "\\$ECHO \"$libname_spec\""`
6566 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6567 set dummy $deplib_matches; shift
6568 deplib_match=$1
6569 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6570 newdeplibs="$newdeplibs $i"
6571 else
6572 droppeddeps=yes
6573 $ECHO
6574 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6575 $ECHO "*** I have the capability to make that library automatically link in when"
6576 $ECHO "*** you link to this library. But I can only do this if you have a"
6577 $ECHO "*** shared version of the library, which you do not appear to have"
6578 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
6579 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
6582 else
6583 droppeddeps=yes
6584 $ECHO
6585 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
6586 $ECHO "*** make it link in! You will probably need to install it or some"
6587 $ECHO "*** library that it depends on before this library will be fully"
6588 $ECHO "*** functional. Installing it before continuing would be even better."
6592 newdeplibs="$newdeplibs $i"
6594 esac
6595 done
6598 file_magic*)
6599 set dummy $deplibs_check_method; shift
6600 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6601 for a_deplib in $deplibs; do
6602 case $a_deplib in
6603 -l*)
6604 func_stripname -l '' "$a_deplib"
6605 name=$func_stripname_result
6606 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6607 case " $predeps $postdeps " in
6608 *" $a_deplib "*)
6609 newdeplibs="$newdeplibs $a_deplib"
6610 a_deplib=""
6612 esac
6614 if test -n "$a_deplib" ; then
6615 libname=`eval "\\$ECHO \"$libname_spec\""`
6616 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6617 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6618 for potent_lib in $potential_libs; do
6619 # Follow soft links.
6620 if ls -lLd "$potent_lib" 2>/dev/null |
6621 $GREP " -> " >/dev/null; then
6622 continue
6624 # The statement above tries to avoid entering an
6625 # endless loop below, in case of cyclic links.
6626 # We might still enter an endless loop, since a link
6627 # loop can be closed while we follow links,
6628 # but so what?
6629 potlib="$potent_lib"
6630 while test -h "$potlib" 2>/dev/null; do
6631 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
6632 case $potliblink in
6633 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
6634 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
6635 esac
6636 done
6637 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
6638 $SED -e 10q |
6639 $EGREP "$file_magic_regex" > /dev/null; then
6640 newdeplibs="$newdeplibs $a_deplib"
6641 a_deplib=""
6642 break 2
6644 done
6645 done
6647 if test -n "$a_deplib" ; then
6648 droppeddeps=yes
6649 $ECHO
6650 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6651 $ECHO "*** I have the capability to make that library automatically link in when"
6652 $ECHO "*** you link to this library. But I can only do this if you have a"
6653 $ECHO "*** shared version of the library, which you do not appear to have"
6654 $ECHO "*** because I did check the linker path looking for a file starting"
6655 if test -z "$potlib" ; then
6656 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
6657 else
6658 $ECHO "*** with $libname and none of the candidates passed a file format test"
6659 $ECHO "*** using a file magic. Last file checked: $potlib"
6664 # Add a -L argument.
6665 newdeplibs="$newdeplibs $a_deplib"
6667 esac
6668 done # Gone through all deplibs.
6670 match_pattern*)
6671 set dummy $deplibs_check_method; shift
6672 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6673 for a_deplib in $deplibs; do
6674 case $a_deplib in
6675 -l*)
6676 func_stripname -l '' "$a_deplib"
6677 name=$func_stripname_result
6678 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6679 case " $predeps $postdeps " in
6680 *" $a_deplib "*)
6681 newdeplibs="$newdeplibs $a_deplib"
6682 a_deplib=""
6684 esac
6686 if test -n "$a_deplib" ; then
6687 libname=`eval "\\$ECHO \"$libname_spec\""`
6688 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6689 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6690 for potent_lib in $potential_libs; do
6691 potlib="$potent_lib" # see symlink-check above in file_magic test
6692 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
6693 $EGREP "$match_pattern_regex" > /dev/null; then
6694 newdeplibs="$newdeplibs $a_deplib"
6695 a_deplib=""
6696 break 2
6698 done
6699 done
6701 if test -n "$a_deplib" ; then
6702 droppeddeps=yes
6703 $ECHO
6704 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6705 $ECHO "*** I have the capability to make that library automatically link in when"
6706 $ECHO "*** you link to this library. But I can only do this if you have a"
6707 $ECHO "*** shared version of the library, which you do not appear to have"
6708 $ECHO "*** because I did check the linker path looking for a file starting"
6709 if test -z "$potlib" ; then
6710 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
6711 else
6712 $ECHO "*** with $libname and none of the candidates passed a file format test"
6713 $ECHO "*** using a regex pattern. Last file checked: $potlib"
6718 # Add a -L argument.
6719 newdeplibs="$newdeplibs $a_deplib"
6721 esac
6722 done # Gone through all deplibs.
6724 none | unknown | *)
6725 newdeplibs=""
6726 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
6727 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
6728 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6729 for i in $predeps $postdeps ; do
6730 # can't use Xsed below, because $i might contain '/'
6731 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
6732 done
6734 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
6735 $GREP . >/dev/null; then
6736 $ECHO
6737 if test "X$deplibs_check_method" = "Xnone"; then
6738 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
6739 else
6740 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
6742 $ECHO "*** All declared inter-library dependencies are being dropped."
6743 droppeddeps=yes
6746 esac
6747 versuffix=$versuffix_save
6748 major=$major_save
6749 release=$release_save
6750 libname=$libname_save
6751 name=$name_save
6753 case $host in
6754 *-*-rhapsody* | *-*-darwin1.[012])
6755 # On Rhapsody replace the C library with the System framework
6756 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6758 esac
6760 if test "$droppeddeps" = yes; then
6761 if test "$module" = yes; then
6762 $ECHO
6763 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
6764 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
6765 $ECHO "*** a static module, that should work as long as the dlopening"
6766 $ECHO "*** application is linked with the -dlopen flag."
6767 if test -z "$global_symbol_pipe"; then
6768 $ECHO
6769 $ECHO "*** However, this would only work if libtool was able to extract symbol"
6770 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6771 $ECHO "*** not find such a program. So, this module is probably useless."
6772 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6774 if test "$build_old_libs" = no; then
6775 oldlibs="$output_objdir/$libname.$libext"
6776 build_libtool_libs=module
6777 build_old_libs=yes
6778 else
6779 build_libtool_libs=no
6781 else
6782 $ECHO "*** The inter-library dependencies that have been dropped here will be"
6783 $ECHO "*** automatically added whenever a program is linked with this library"
6784 $ECHO "*** or is declared to -dlopen it."
6786 if test "$allow_undefined" = no; then
6787 $ECHO
6788 $ECHO "*** Since this library must not contain undefined symbols,"
6789 $ECHO "*** because either the platform does not support them or"
6790 $ECHO "*** it was explicitly requested with -no-undefined,"
6791 $ECHO "*** libtool will only create a static version of it."
6792 if test "$build_old_libs" = no; then
6793 oldlibs="$output_objdir/$libname.$libext"
6794 build_libtool_libs=module
6795 build_old_libs=yes
6796 else
6797 build_libtool_libs=no
6802 # Done checking deplibs!
6803 deplibs=$newdeplibs
6805 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6806 case $host in
6807 *-*-darwin*)
6808 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6809 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6810 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6812 esac
6814 # move library search paths that coincide with paths to not yet
6815 # installed libraries to the beginning of the library search list
6816 new_libs=
6817 for path in $notinst_path; do
6818 case " $new_libs " in
6819 *" -L$path/$objdir "*) ;;
6821 case " $deplibs " in
6822 *" -L$path/$objdir "*)
6823 new_libs="$new_libs -L$path/$objdir" ;;
6824 esac
6826 esac
6827 done
6828 for deplib in $deplibs; do
6829 case $deplib in
6830 -L*)
6831 case " $new_libs " in
6832 *" $deplib "*) ;;
6833 *) new_libs="$new_libs $deplib" ;;
6834 esac
6836 *) new_libs="$new_libs $deplib" ;;
6837 esac
6838 done
6839 deplibs="$new_libs"
6841 # All the library-specific variables (install_libdir is set above).
6842 library_names=
6843 old_library=
6844 dlname=
6846 # Test again, we may have decided not to build it any more
6847 if test "$build_libtool_libs" = yes; then
6848 if test "$hardcode_into_libs" = yes; then
6849 # Hardcode the library paths
6850 hardcode_libdirs=
6851 dep_rpath=
6852 rpath="$finalize_rpath"
6853 test "$mode" != relink && rpath="$compile_rpath$rpath"
6854 for libdir in $rpath; do
6855 if test -n "$hardcode_libdir_flag_spec"; then
6856 if test -n "$hardcode_libdir_separator"; then
6857 if test -z "$hardcode_libdirs"; then
6858 hardcode_libdirs="$libdir"
6859 else
6860 # Just accumulate the unique libdirs.
6861 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6862 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6865 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6867 esac
6869 else
6870 eval flag=\"$hardcode_libdir_flag_spec\"
6871 dep_rpath="$dep_rpath $flag"
6873 elif test -n "$runpath_var"; then
6874 case "$perm_rpath " in
6875 *" $libdir "*) ;;
6876 *) perm_rpath="$perm_rpath $libdir" ;;
6877 esac
6879 done
6880 # Substitute the hardcoded libdirs into the rpath.
6881 if test -n "$hardcode_libdir_separator" &&
6882 test -n "$hardcode_libdirs"; then
6883 libdir="$hardcode_libdirs"
6884 if test -n "$hardcode_libdir_flag_spec_ld"; then
6885 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
6886 else
6887 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
6890 if test -n "$runpath_var" && test -n "$perm_rpath"; then
6891 # We should set the runpath_var.
6892 rpath=
6893 for dir in $perm_rpath; do
6894 rpath="$rpath$dir:"
6895 done
6896 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
6898 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
6901 shlibpath="$finalize_shlibpath"
6902 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
6903 if test -n "$shlibpath"; then
6904 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
6907 # Get the real and link names of the library.
6908 eval shared_ext=\"$shrext_cmds\"
6909 eval library_names=\"$library_names_spec\"
6910 set dummy $library_names
6911 shift
6912 realname="$1"
6913 shift
6915 if test -n "$soname_spec"; then
6916 eval soname=\"$soname_spec\"
6917 else
6918 soname="$realname"
6920 if test -z "$dlname"; then
6921 dlname=$soname
6924 lib="$output_objdir/$realname"
6925 linknames=
6926 for link
6928 linknames="$linknames $link"
6929 done
6931 # Use standard objects if they are pic
6932 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6933 test "X$libobjs" = "X " && libobjs=
6935 delfiles=
6936 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6937 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
6938 export_symbols="$output_objdir/$libname.uexp"
6939 delfiles="$delfiles $export_symbols"
6942 orig_export_symbols=
6943 case $host_os in
6944 cygwin* | mingw*)
6945 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
6946 # exporting using user supplied symfile
6947 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
6948 # and it's NOT already a .def file. Must figure out
6949 # which of the given symbols are data symbols and tag
6950 # them as such. So, trigger use of export_symbols_cmds.
6951 # export_symbols gets reassigned inside the "prepare
6952 # the list of exported symbols" if statement, so the
6953 # include_expsyms logic still works.
6954 orig_export_symbols="$export_symbols"
6955 export_symbols=
6956 always_export_symbols=yes
6960 esac
6962 # Prepare the list of exported symbols
6963 if test -z "$export_symbols"; then
6964 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
6965 func_verbose "generating symbol list for \`$libname.la'"
6966 export_symbols="$output_objdir/$libname.exp"
6967 $opt_dry_run || $RM $export_symbols
6968 cmds=$export_symbols_cmds
6969 save_ifs="$IFS"; IFS='~'
6970 for cmd in $cmds; do
6971 IFS="$save_ifs"
6972 eval cmd=\"$cmd\"
6973 func_len " $cmd"
6974 len=$func_len_result
6975 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6976 func_show_eval "$cmd" 'exit $?'
6977 skipped_export=false
6978 else
6979 # The command line is too long to execute in one step.
6980 func_verbose "using reloadable object file for export list..."
6981 skipped_export=:
6982 # Break out early, otherwise skipped_export may be
6983 # set to false by a later but shorter cmd.
6984 break
6986 done
6987 IFS="$save_ifs"
6988 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
6989 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
6990 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
6995 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6996 tmp_export_symbols="$export_symbols"
6997 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
6998 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7001 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7002 # The given exports_symbols file has to be filtered, so filter it.
7003 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7004 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7005 # 's' commands which not all seds can handle. GNU sed should be fine
7006 # though. Also, the filter scales superlinearly with the number of
7007 # global variables. join(1) would be nice here, but unfortunately
7008 # isn't a blessed tool.
7009 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7010 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7011 export_symbols=$output_objdir/$libname.def
7012 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7015 tmp_deplibs=
7016 for test_deplib in $deplibs; do
7017 case " $convenience " in
7018 *" $test_deplib "*) ;;
7020 tmp_deplibs="$tmp_deplibs $test_deplib"
7022 esac
7023 done
7024 deplibs="$tmp_deplibs"
7026 if test -n "$convenience"; then
7027 if test -n "$whole_archive_flag_spec" &&
7028 test "$compiler_needs_object" = yes &&
7029 test -z "$libobjs"; then
7030 # extract the archives, so we have objects to list.
7031 # TODO: could optimize this to just extract one archive.
7032 whole_archive_flag_spec=
7034 if test -n "$whole_archive_flag_spec"; then
7035 save_libobjs=$libobjs
7036 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7037 test "X$libobjs" = "X " && libobjs=
7038 else
7039 gentop="$output_objdir/${outputname}x"
7040 generated="$generated $gentop"
7042 func_extract_archives $gentop $convenience
7043 libobjs="$libobjs $func_extract_archives_result"
7044 test "X$libobjs" = "X " && libobjs=
7048 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7049 eval flag=\"$thread_safe_flag_spec\"
7050 linker_flags="$linker_flags $flag"
7053 # Make a backup of the uninstalled library when relinking
7054 if test "$mode" = relink; then
7055 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7058 # Do each of the archive commands.
7059 if test "$module" = yes && test -n "$module_cmds" ; then
7060 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7061 eval test_cmds=\"$module_expsym_cmds\"
7062 cmds=$module_expsym_cmds
7063 else
7064 eval test_cmds=\"$module_cmds\"
7065 cmds=$module_cmds
7067 else
7068 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7069 eval test_cmds=\"$archive_expsym_cmds\"
7070 cmds=$archive_expsym_cmds
7071 else
7072 eval test_cmds=\"$archive_cmds\"
7073 cmds=$archive_cmds
7077 if test "X$skipped_export" != "X:" &&
7078 func_len " $test_cmds" &&
7079 len=$func_len_result &&
7080 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7082 else
7083 # The command line is too long to link in one step, link piecewise
7084 # or, if using GNU ld and skipped_export is not :, use a linker
7085 # script.
7087 # Save the value of $output and $libobjs because we want to
7088 # use them later. If we have whole_archive_flag_spec, we
7089 # want to use save_libobjs as it was before
7090 # whole_archive_flag_spec was expanded, because we can't
7091 # assume the linker understands whole_archive_flag_spec.
7092 # This may have to be revisited, in case too many
7093 # convenience libraries get linked in and end up exceeding
7094 # the spec.
7095 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7096 save_libobjs=$libobjs
7098 save_output=$output
7099 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
7101 # Clear the reloadable object creation command queue and
7102 # initialize k to one.
7103 test_cmds=
7104 concat_cmds=
7105 objlist=
7106 last_robj=
7109 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7110 output=${output_objdir}/${output_la}.lnkscript
7111 func_verbose "creating GNU ld script: $output"
7112 $ECHO 'INPUT (' > $output
7113 for obj in $save_libobjs
7115 $ECHO "$obj" >> $output
7116 done
7117 $ECHO ')' >> $output
7118 delfiles="$delfiles $output"
7119 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7120 output=${output_objdir}/${output_la}.lnk
7121 func_verbose "creating linker input file list: $output"
7122 : > $output
7123 set x $save_libobjs
7124 shift
7125 firstobj=
7126 if test "$compiler_needs_object" = yes; then
7127 firstobj="$1 "
7128 shift
7130 for obj
7132 $ECHO "$obj" >> $output
7133 done
7134 delfiles="$delfiles $output"
7135 output=$firstobj\"$file_list_spec$output\"
7136 else
7137 if test -n "$save_libobjs"; then
7138 func_verbose "creating reloadable object files..."
7139 output=$output_objdir/$output_la-${k}.$objext
7140 eval test_cmds=\"$reload_cmds\"
7141 func_len " $test_cmds"
7142 len0=$func_len_result
7143 len=$len0
7145 # Loop over the list of objects to be linked.
7146 for obj in $save_libobjs
7148 func_len " $obj"
7149 func_arith $len + $func_len_result
7150 len=$func_arith_result
7151 if test "X$objlist" = X ||
7152 test "$len" -lt "$max_cmd_len"; then
7153 func_append objlist " $obj"
7154 else
7155 # The command $test_cmds is almost too long, add a
7156 # command to the queue.
7157 if test "$k" -eq 1 ; then
7158 # The first file doesn't have a previous command to add.
7159 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
7160 else
7161 # All subsequent reloadable object files will link in
7162 # the last one created.
7163 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
7165 last_robj=$output_objdir/$output_la-${k}.$objext
7166 func_arith $k + 1
7167 k=$func_arith_result
7168 output=$output_objdir/$output_la-${k}.$objext
7169 objlist=$obj
7170 func_len " $last_robj"
7171 func_arith $len0 + $func_len_result
7172 len=$func_arith_result
7174 done
7175 # Handle the remaining objects by creating one last
7176 # reloadable object file. All subsequent reloadable object
7177 # files will link in the last one created.
7178 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7179 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
7180 if test -n "$last_robj"; then
7181 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7183 delfiles="$delfiles $output"
7185 else
7186 output=
7189 if ${skipped_export-false}; then
7190 func_verbose "generating symbol list for \`$libname.la'"
7191 export_symbols="$output_objdir/$libname.exp"
7192 $opt_dry_run || $RM $export_symbols
7193 libobjs=$output
7194 # Append the command to create the export file.
7195 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7196 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7197 if test -n "$last_robj"; then
7198 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7202 test -n "$save_libobjs" &&
7203 func_verbose "creating a temporary reloadable object file: $output"
7205 # Loop through the commands generated above and execute them.
7206 save_ifs="$IFS"; IFS='~'
7207 for cmd in $concat_cmds; do
7208 IFS="$save_ifs"
7209 $opt_silent || {
7210 func_quote_for_expand "$cmd"
7211 eval "func_echo $func_quote_for_expand_result"
7213 $opt_dry_run || eval "$cmd" || {
7214 lt_exit=$?
7216 # Restore the uninstalled library and exit
7217 if test "$mode" = relink; then
7218 ( cd "$output_objdir" && \
7219 $RM "${realname}T" && \
7220 $MV "${realname}U" "$realname" )
7223 exit $lt_exit
7225 done
7226 IFS="$save_ifs"
7228 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7229 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7230 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7234 if ${skipped_export-false}; then
7235 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7236 tmp_export_symbols="$export_symbols"
7237 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7238 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7241 if test -n "$orig_export_symbols"; then
7242 # The given exports_symbols file has to be filtered, so filter it.
7243 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7244 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7245 # 's' commands which not all seds can handle. GNU sed should be fine
7246 # though. Also, the filter scales superlinearly with the number of
7247 # global variables. join(1) would be nice here, but unfortunately
7248 # isn't a blessed tool.
7249 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7250 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7251 export_symbols=$output_objdir/$libname.def
7252 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7256 libobjs=$output
7257 # Restore the value of output.
7258 output=$save_output
7260 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
7261 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7262 test "X$libobjs" = "X " && libobjs=
7264 # Expand the library linking commands again to reset the
7265 # value of $libobjs for piecewise linking.
7267 # Do each of the archive commands.
7268 if test "$module" = yes && test -n "$module_cmds" ; then
7269 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7270 cmds=$module_expsym_cmds
7271 else
7272 cmds=$module_cmds
7274 else
7275 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7276 cmds=$archive_expsym_cmds
7277 else
7278 cmds=$archive_cmds
7283 if test -n "$delfiles"; then
7284 # Append the command to remove temporary files to $cmds.
7285 eval cmds=\"\$cmds~\$RM $delfiles\"
7288 # Add any objects from preloaded convenience libraries
7289 if test -n "$dlprefiles"; then
7290 gentop="$output_objdir/${outputname}x"
7291 generated="$generated $gentop"
7293 func_extract_archives $gentop $dlprefiles
7294 libobjs="$libobjs $func_extract_archives_result"
7295 test "X$libobjs" = "X " && libobjs=
7298 save_ifs="$IFS"; IFS='~'
7299 for cmd in $cmds; do
7300 IFS="$save_ifs"
7301 eval cmd=\"$cmd\"
7302 $opt_silent || {
7303 func_quote_for_expand "$cmd"
7304 eval "func_echo $func_quote_for_expand_result"
7306 $opt_dry_run || eval "$cmd" || {
7307 lt_exit=$?
7309 # Restore the uninstalled library and exit
7310 if test "$mode" = relink; then
7311 ( cd "$output_objdir" && \
7312 $RM "${realname}T" && \
7313 $MV "${realname}U" "$realname" )
7316 exit $lt_exit
7318 done
7319 IFS="$save_ifs"
7321 # Restore the uninstalled library and exit
7322 if test "$mode" = relink; then
7323 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
7325 if test -n "$convenience"; then
7326 if test -z "$whole_archive_flag_spec"; then
7327 func_show_eval '${RM}r "$gentop"'
7331 exit $EXIT_SUCCESS
7334 # Create links to the real library.
7335 for linkname in $linknames; do
7336 if test "$realname" != "$linkname"; then
7337 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
7339 done
7341 # If -module or -export-dynamic was specified, set the dlname.
7342 if test "$module" = yes || test "$export_dynamic" = yes; then
7343 # On all known operating systems, these are identical.
7344 dlname="$soname"
7349 obj)
7350 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7351 func_warning "\`-dlopen' is ignored for objects"
7354 case " $deplibs" in
7355 *\ -l* | *\ -L*)
7356 func_warning "\`-l' and \`-L' are ignored for objects" ;;
7357 esac
7359 test -n "$rpath" && \
7360 func_warning "\`-rpath' is ignored for objects"
7362 test -n "$xrpath" && \
7363 func_warning "\`-R' is ignored for objects"
7365 test -n "$vinfo" && \
7366 func_warning "\`-version-info' is ignored for objects"
7368 test -n "$release" && \
7369 func_warning "\`-release' is ignored for objects"
7371 case $output in
7372 *.lo)
7373 test -n "$objs$old_deplibs" && \
7374 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
7376 libobj=$output
7377 func_lo2o "$libobj"
7378 obj=$func_lo2o_result
7381 libobj=
7382 obj="$output"
7384 esac
7386 # Delete the old objects.
7387 $opt_dry_run || $RM $obj $libobj
7389 # Objects from convenience libraries. This assumes
7390 # single-version convenience libraries. Whenever we create
7391 # different ones for PIC/non-PIC, this we'll have to duplicate
7392 # the extraction.
7393 reload_conv_objs=
7394 gentop=
7395 # reload_cmds runs $LD directly, so let us get rid of
7396 # -Wl from whole_archive_flag_spec and hope we can get by with
7397 # turning comma into space..
7400 if test -n "$convenience"; then
7401 if test -n "$whole_archive_flag_spec"; then
7402 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
7403 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
7404 else
7405 gentop="$output_objdir/${obj}x"
7406 generated="$generated $gentop"
7408 func_extract_archives $gentop $convenience
7409 reload_conv_objs="$reload_objs $func_extract_archives_result"
7413 # Create the old-style object.
7414 reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
7416 output="$obj"
7417 func_execute_cmds "$reload_cmds" 'exit $?'
7419 # Exit if we aren't doing a library object file.
7420 if test -z "$libobj"; then
7421 if test -n "$gentop"; then
7422 func_show_eval '${RM}r "$gentop"'
7425 exit $EXIT_SUCCESS
7428 if test "$build_libtool_libs" != yes; then
7429 if test -n "$gentop"; then
7430 func_show_eval '${RM}r "$gentop"'
7433 # Create an invalid libtool object if no PIC, so that we don't
7434 # accidentally link it into a program.
7435 # $show "echo timestamp > $libobj"
7436 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
7437 exit $EXIT_SUCCESS
7440 if test -n "$pic_flag" || test "$pic_mode" != default; then
7441 # Only do commands if we really have different PIC objects.
7442 reload_objs="$libobjs $reload_conv_objs"
7443 output="$libobj"
7444 func_execute_cmds "$reload_cmds" 'exit $?'
7447 if test -n "$gentop"; then
7448 func_show_eval '${RM}r "$gentop"'
7451 exit $EXIT_SUCCESS
7454 prog)
7455 case $host in
7456 *cygwin*) func_stripname '' '.exe' "$output"
7457 output=$func_stripname_result.exe;;
7458 esac
7459 test -n "$vinfo" && \
7460 func_warning "\`-version-info' is ignored for programs"
7462 test -n "$release" && \
7463 func_warning "\`-release' is ignored for programs"
7465 test "$preload" = yes \
7466 && test "$dlopen_support" = unknown \
7467 && test "$dlopen_self" = unknown \
7468 && test "$dlopen_self_static" = unknown && \
7469 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
7471 case $host in
7472 *-*-rhapsody* | *-*-darwin1.[012])
7473 # On Rhapsody replace the C library is the System framework
7474 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7475 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7477 esac
7479 case $host in
7480 *-*-darwin*)
7481 # Don't allow lazy linking, it breaks C++ global constructors
7482 # But is supposedly fixed on 10.4 or later (yay!).
7483 if test "$tagname" = CXX ; then
7484 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
7485 10.[0123])
7486 compile_command="$compile_command ${wl}-bind_at_load"
7487 finalize_command="$finalize_command ${wl}-bind_at_load"
7489 esac
7491 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7492 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7493 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7495 esac
7498 # move library search paths that coincide with paths to not yet
7499 # installed libraries to the beginning of the library search list
7500 new_libs=
7501 for path in $notinst_path; do
7502 case " $new_libs " in
7503 *" -L$path/$objdir "*) ;;
7505 case " $compile_deplibs " in
7506 *" -L$path/$objdir "*)
7507 new_libs="$new_libs -L$path/$objdir" ;;
7508 esac
7510 esac
7511 done
7512 for deplib in $compile_deplibs; do
7513 case $deplib in
7514 -L*)
7515 case " $new_libs " in
7516 *" $deplib "*) ;;
7517 *) new_libs="$new_libs $deplib" ;;
7518 esac
7520 *) new_libs="$new_libs $deplib" ;;
7521 esac
7522 done
7523 compile_deplibs="$new_libs"
7526 compile_command="$compile_command $compile_deplibs"
7527 finalize_command="$finalize_command $finalize_deplibs"
7529 if test -n "$rpath$xrpath"; then
7530 # If the user specified any rpath flags, then add them.
7531 for libdir in $rpath $xrpath; do
7532 # This is the magic to use -rpath.
7533 case "$finalize_rpath " in
7534 *" $libdir "*) ;;
7535 *) finalize_rpath="$finalize_rpath $libdir" ;;
7536 esac
7537 done
7540 # Now hardcode the library paths
7541 rpath=
7542 hardcode_libdirs=
7543 for libdir in $compile_rpath $finalize_rpath; do
7544 if test -n "$hardcode_libdir_flag_spec"; then
7545 if test -n "$hardcode_libdir_separator"; then
7546 if test -z "$hardcode_libdirs"; then
7547 hardcode_libdirs="$libdir"
7548 else
7549 # Just accumulate the unique libdirs.
7550 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7551 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7554 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7556 esac
7558 else
7559 eval flag=\"$hardcode_libdir_flag_spec\"
7560 rpath="$rpath $flag"
7562 elif test -n "$runpath_var"; then
7563 case "$perm_rpath " in
7564 *" $libdir "*) ;;
7565 *) perm_rpath="$perm_rpath $libdir" ;;
7566 esac
7568 case $host in
7569 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
7570 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
7571 case :$dllsearchpath: in
7572 *":$libdir:"*) ;;
7573 *) dllsearchpath="$dllsearchpath:$libdir";;
7574 esac
7575 case :$dllsearchpath: in
7576 *":$testbindir:"*) ;;
7577 *) dllsearchpath="$dllsearchpath:$testbindir";;
7578 esac
7580 esac
7581 done
7582 # Substitute the hardcoded libdirs into the rpath.
7583 if test -n "$hardcode_libdir_separator" &&
7584 test -n "$hardcode_libdirs"; then
7585 libdir="$hardcode_libdirs"
7586 eval rpath=\" $hardcode_libdir_flag_spec\"
7588 compile_rpath="$rpath"
7590 rpath=
7591 hardcode_libdirs=
7592 for libdir in $finalize_rpath; do
7593 if test -n "$hardcode_libdir_flag_spec"; then
7594 if test -n "$hardcode_libdir_separator"; then
7595 if test -z "$hardcode_libdirs"; then
7596 hardcode_libdirs="$libdir"
7597 else
7598 # Just accumulate the unique libdirs.
7599 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7600 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7603 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7605 esac
7607 else
7608 eval flag=\"$hardcode_libdir_flag_spec\"
7609 rpath="$rpath $flag"
7611 elif test -n "$runpath_var"; then
7612 case "$finalize_perm_rpath " in
7613 *" $libdir "*) ;;
7614 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
7615 esac
7617 done
7618 # Substitute the hardcoded libdirs into the rpath.
7619 if test -n "$hardcode_libdir_separator" &&
7620 test -n "$hardcode_libdirs"; then
7621 libdir="$hardcode_libdirs"
7622 eval rpath=\" $hardcode_libdir_flag_spec\"
7624 finalize_rpath="$rpath"
7626 if test -n "$libobjs" && test "$build_old_libs" = yes; then
7627 # Transform all the library objects into standard objects.
7628 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7629 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7632 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
7634 # template prelinking step
7635 if test -n "$prelink_cmds"; then
7636 func_execute_cmds "$prelink_cmds" 'exit $?'
7639 wrappers_required=yes
7640 case $host in
7641 *cygwin* | *mingw* )
7642 if test "$build_libtool_libs" != yes; then
7643 wrappers_required=no
7647 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
7648 wrappers_required=no
7651 esac
7652 if test "$wrappers_required" = no; then
7653 # Replace the output file specification.
7654 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7655 link_command="$compile_command$compile_rpath"
7657 # We have no uninstalled library dependencies, so finalize right now.
7658 exit_status=0
7659 func_show_eval "$link_command" 'exit_status=$?'
7661 # Delete the generated files.
7662 if test -f "$output_objdir/${outputname}S.${objext}"; then
7663 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
7666 exit $exit_status
7669 if test -n "$compile_shlibpath$finalize_shlibpath"; then
7670 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
7672 if test -n "$finalize_shlibpath"; then
7673 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
7676 compile_var=
7677 finalize_var=
7678 if test -n "$runpath_var"; then
7679 if test -n "$perm_rpath"; then
7680 # We should set the runpath_var.
7681 rpath=
7682 for dir in $perm_rpath; do
7683 rpath="$rpath$dir:"
7684 done
7685 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
7687 if test -n "$finalize_perm_rpath"; then
7688 # We should set the runpath_var.
7689 rpath=
7690 for dir in $finalize_perm_rpath; do
7691 rpath="$rpath$dir:"
7692 done
7693 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
7697 if test "$no_install" = yes; then
7698 # We don't need to create a wrapper script.
7699 link_command="$compile_var$compile_command$compile_rpath"
7700 # Replace the output file specification.
7701 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7702 # Delete the old output file.
7703 $opt_dry_run || $RM $output
7704 # Link the executable and exit
7705 func_show_eval "$link_command" 'exit $?'
7706 exit $EXIT_SUCCESS
7709 if test "$hardcode_action" = relink; then
7710 # Fast installation is not supported
7711 link_command="$compile_var$compile_command$compile_rpath"
7712 relink_command="$finalize_var$finalize_command$finalize_rpath"
7714 func_warning "this platform does not like uninstalled shared libraries"
7715 func_warning "\`$output' will be relinked during installation"
7716 else
7717 if test "$fast_install" != no; then
7718 link_command="$finalize_var$compile_command$finalize_rpath"
7719 if test "$fast_install" = yes; then
7720 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
7721 else
7722 # fast_install is set to needless
7723 relink_command=
7725 else
7726 link_command="$compile_var$compile_command$compile_rpath"
7727 relink_command="$finalize_var$finalize_command$finalize_rpath"
7731 # Replace the output file specification.
7732 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7734 # Delete the old output files.
7735 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
7737 func_show_eval "$link_command" 'exit $?'
7739 # Now create the wrapper script.
7740 func_verbose "creating $output"
7742 # Quote the relink command for shipping.
7743 if test -n "$relink_command"; then
7744 # Preserve any variables that may affect compiler behavior
7745 for var in $variables_saved_for_relink; do
7746 if eval test -z \"\${$var+set}\"; then
7747 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7748 elif eval var_value=\$$var; test -z "$var_value"; then
7749 relink_command="$var=; export $var; $relink_command"
7750 else
7751 func_quote_for_eval "$var_value"
7752 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7754 done
7755 relink_command="(cd `pwd`; $relink_command)"
7756 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7759 # Quote $ECHO for shipping.
7760 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
7761 case $progpath in
7762 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
7763 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
7764 esac
7765 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
7766 else
7767 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
7770 # Only actually do things if not in dry run mode.
7771 $opt_dry_run || {
7772 # win32 will think the script is a binary if it has
7773 # a .exe suffix, so we strip it off here.
7774 case $output in
7775 *.exe) func_stripname '' '.exe' "$output"
7776 output=$func_stripname_result ;;
7777 esac
7778 # test for cygwin because mv fails w/o .exe extensions
7779 case $host in
7780 *cygwin*)
7781 exeext=.exe
7782 func_stripname '' '.exe' "$outputname"
7783 outputname=$func_stripname_result ;;
7784 *) exeext= ;;
7785 esac
7786 case $host in
7787 *cygwin* | *mingw* )
7788 func_dirname_and_basename "$output" "" "."
7789 output_name=$func_basename_result
7790 output_path=$func_dirname_result
7791 cwrappersource="$output_path/$objdir/lt-$output_name.c"
7792 cwrapper="$output_path/$output_name.exe"
7793 $RM $cwrappersource $cwrapper
7794 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7796 func_emit_cwrapperexe_src > $cwrappersource
7798 # we should really use a build-platform specific compiler
7799 # here, but OTOH, the wrappers (shell script and this C one)
7800 # are only useful if you want to execute the "real" binary.
7801 # Since the "real" binary is built for $host, then this
7802 # wrapper might as well be built for $host, too.
7803 $opt_dry_run || {
7804 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
7805 $STRIP $cwrapper
7808 # Now, create the wrapper script for func_source use:
7809 func_ltwrapper_scriptname $cwrapper
7810 $RM $func_ltwrapper_scriptname_result
7811 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
7812 $opt_dry_run || {
7813 # note: this script will not be executed, so do not chmod.
7814 if test "x$build" = "x$host" ; then
7815 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7816 else
7817 func_emit_wrapper no > $func_ltwrapper_scriptname_result
7822 $RM $output
7823 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
7825 func_emit_wrapper no > $output
7826 chmod +x $output
7828 esac
7830 exit $EXIT_SUCCESS
7832 esac
7834 # See if we need to build an old-fashioned archive.
7835 for oldlib in $oldlibs; do
7837 if test "$build_libtool_libs" = convenience; then
7838 oldobjs="$libobjs_save $symfileobj"
7839 addlibs="$convenience"
7840 build_libtool_libs=no
7841 else
7842 if test "$build_libtool_libs" = module; then
7843 oldobjs="$libobjs_save"
7844 build_libtool_libs=no
7845 else
7846 oldobjs="$old_deplibs $non_pic_objects"
7847 if test "$preload" = yes && test -f "$symfileobj"; then
7848 oldobjs="$oldobjs $symfileobj"
7851 addlibs="$old_convenience"
7854 if test -n "$addlibs"; then
7855 gentop="$output_objdir/${outputname}x"
7856 generated="$generated $gentop"
7858 func_extract_archives $gentop $addlibs
7859 oldobjs="$oldobjs $func_extract_archives_result"
7862 # Do each command in the archive commands.
7863 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
7864 cmds=$old_archive_from_new_cmds
7865 else
7867 # Add any objects from preloaded convenience libraries
7868 if test -n "$dlprefiles"; then
7869 gentop="$output_objdir/${outputname}x"
7870 generated="$generated $gentop"
7872 func_extract_archives $gentop $dlprefiles
7873 oldobjs="$oldobjs $func_extract_archives_result"
7876 # POSIX demands no paths to be encoded in archives. We have
7877 # to avoid creating archives with duplicate basenames if we
7878 # might have to extract them afterwards, e.g., when creating a
7879 # static archive out of a convenience library, or when linking
7880 # the entirety of a libtool archive into another (currently
7881 # not supported by libtool).
7882 if (for obj in $oldobjs
7884 func_basename "$obj"
7885 $ECHO "$func_basename_result"
7886 done | sort | sort -uc >/dev/null 2>&1); then
7888 else
7889 $ECHO "copying selected object files to avoid basename conflicts..."
7890 gentop="$output_objdir/${outputname}x"
7891 generated="$generated $gentop"
7892 func_mkdir_p "$gentop"
7893 save_oldobjs=$oldobjs
7894 oldobjs=
7895 counter=1
7896 for obj in $save_oldobjs
7898 func_basename "$obj"
7899 objbase="$func_basename_result"
7900 case " $oldobjs " in
7901 " ") oldobjs=$obj ;;
7902 *[\ /]"$objbase "*)
7903 while :; do
7904 # Make sure we don't pick an alternate name that also
7905 # overlaps.
7906 newobj=lt$counter-$objbase
7907 func_arith $counter + 1
7908 counter=$func_arith_result
7909 case " $oldobjs " in
7910 *[\ /]"$newobj "*) ;;
7911 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
7912 esac
7913 done
7914 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
7915 oldobjs="$oldobjs $gentop/$newobj"
7917 *) oldobjs="$oldobjs $obj" ;;
7918 esac
7919 done
7921 eval cmds=\"$old_archive_cmds\"
7923 func_len " $cmds"
7924 len=$func_len_result
7925 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7926 cmds=$old_archive_cmds
7927 else
7928 # the command line is too long to link in one step, link in parts
7929 func_verbose "using piecewise archive linking..."
7930 save_RANLIB=$RANLIB
7931 RANLIB=:
7932 objlist=
7933 concat_cmds=
7934 save_oldobjs=$oldobjs
7935 oldobjs=
7936 # Is there a better way of finding the last object in the list?
7937 for obj in $save_oldobjs
7939 last_oldobj=$obj
7940 done
7941 eval test_cmds=\"$old_archive_cmds\"
7942 func_len " $test_cmds"
7943 len0=$func_len_result
7944 len=$len0
7945 for obj in $save_oldobjs
7947 func_len " $obj"
7948 func_arith $len + $func_len_result
7949 len=$func_arith_result
7950 func_append objlist " $obj"
7951 if test "$len" -lt "$max_cmd_len"; then
7953 else
7954 # the above command should be used before it gets too long
7955 oldobjs=$objlist
7956 if test "$obj" = "$last_oldobj" ; then
7957 RANLIB=$save_RANLIB
7959 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7960 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
7961 objlist=
7962 len=$len0
7964 done
7965 RANLIB=$save_RANLIB
7966 oldobjs=$objlist
7967 if test "X$oldobjs" = "X" ; then
7968 eval cmds=\"\$concat_cmds\"
7969 else
7970 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
7974 func_execute_cmds "$cmds" 'exit $?'
7975 done
7977 test -n "$generated" && \
7978 func_show_eval "${RM}r$generated"
7980 # Now create the libtool archive.
7981 case $output in
7982 *.la)
7983 old_library=
7984 test "$build_old_libs" = yes && old_library="$libname.$libext"
7985 func_verbose "creating $output"
7987 # Preserve any variables that may affect compiler behavior
7988 for var in $variables_saved_for_relink; do
7989 if eval test -z \"\${$var+set}\"; then
7990 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7991 elif eval var_value=\$$var; test -z "$var_value"; then
7992 relink_command="$var=; export $var; $relink_command"
7993 else
7994 func_quote_for_eval "$var_value"
7995 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7997 done
7998 # Quote the link command for shipping.
7999 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8000 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
8001 if test "$hardcode_automatic" = yes ; then
8002 relink_command=
8005 # Only create the output if not a dry run.
8006 $opt_dry_run || {
8007 for installed in no yes; do
8008 if test "$installed" = yes; then
8009 if test -z "$install_libdir"; then
8010 break
8012 output="$output_objdir/$outputname"i
8013 # Replace all uninstalled libtool libraries with the installed ones
8014 newdependency_libs=
8015 for deplib in $dependency_libs; do
8016 case $deplib in
8017 *.la)
8018 func_basename "$deplib"
8019 name="$func_basename_result"
8020 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8021 test -z "$libdir" && \
8022 func_fatal_error "\`$deplib' is not a valid libtool archive"
8023 newdependency_libs="$newdependency_libs $libdir/$name"
8025 *) newdependency_libs="$newdependency_libs $deplib" ;;
8026 esac
8027 done
8028 dependency_libs="$newdependency_libs"
8029 newdlfiles=
8031 for lib in $dlfiles; do
8032 case $lib in
8033 *.la)
8034 func_basename "$lib"
8035 name="$func_basename_result"
8036 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8037 test -z "$libdir" && \
8038 func_fatal_error "\`$lib' is not a valid libtool archive"
8039 newdlfiles="$newdlfiles $libdir/$name"
8041 *) newdlfiles="$newdlfiles $lib" ;;
8042 esac
8043 done
8044 dlfiles="$newdlfiles"
8045 newdlprefiles=
8046 for lib in $dlprefiles; do
8047 case $lib in
8048 *.la)
8049 # Only pass preopened files to the pseudo-archive (for
8050 # eventual linking with the app. that links it) if we
8051 # didn't already link the preopened objects directly into
8052 # the library:
8053 func_basename "$lib"
8054 name="$func_basename_result"
8055 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8056 test -z "$libdir" && \
8057 func_fatal_error "\`$lib' is not a valid libtool archive"
8058 newdlprefiles="$newdlprefiles $libdir/$name"
8060 esac
8061 done
8062 dlprefiles="$newdlprefiles"
8063 else
8064 newdlfiles=
8065 for lib in $dlfiles; do
8066 case $lib in
8067 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8068 *) abs=`pwd`"/$lib" ;;
8069 esac
8070 newdlfiles="$newdlfiles $abs"
8071 done
8072 dlfiles="$newdlfiles"
8073 newdlprefiles=
8074 for lib in $dlprefiles; do
8075 case $lib in
8076 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8077 *) abs=`pwd`"/$lib" ;;
8078 esac
8079 newdlprefiles="$newdlprefiles $abs"
8080 done
8081 dlprefiles="$newdlprefiles"
8083 $RM $output
8084 # place dlname in correct position for cygwin
8085 tdlname=$dlname
8086 case $host,$output,$installed,$module,$dlname in
8087 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
8088 esac
8089 $ECHO > $output "\
8090 # $outputname - a libtool library file
8091 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8093 # Please DO NOT delete this file!
8094 # It is necessary for linking the library.
8096 # The name that we can dlopen(3).
8097 dlname='$tdlname'
8099 # Names of this library.
8100 library_names='$library_names'
8102 # The name of the static archive.
8103 old_library='$old_library'
8105 # Linker flags that can not go in dependency_libs.
8106 inherited_linker_flags='$new_inherited_linker_flags'
8108 # Libraries that this one depends upon.
8109 dependency_libs='$dependency_libs'
8111 # Names of additional weak libraries provided by this library
8112 weak_library_names='$weak_libs'
8114 # Version information for $libname.
8115 current=$current
8116 age=$age
8117 revision=$revision
8119 # Is this an already installed library?
8120 installed=$installed
8122 # Should we warn about portability when linking against -modules?
8123 shouldnotlink=$module
8125 # Files to dlopen/dlpreopen
8126 dlopen='$dlfiles'
8127 dlpreopen='$dlprefiles'
8129 # Directory that this library needs to be installed in:
8130 libdir='$install_libdir'"
8131 if test "$installed" = no && test "$need_relink" = yes; then
8132 $ECHO >> $output "\
8133 relink_command=\"$relink_command\""
8135 done
8138 # Do a symbolic link so that the libtool archive can be found in
8139 # LD_LIBRARY_PATH before the program is installed.
8140 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8142 esac
8143 exit $EXIT_SUCCESS
8146 { test "$mode" = link || test "$mode" = relink; } &&
8147 func_mode_link ${1+"$@"}
8150 # func_mode_uninstall arg...
8151 func_mode_uninstall ()
8153 $opt_debug
8154 RM="$nonopt"
8155 files=
8156 rmforce=
8157 exit_status=0
8159 # This variable tells wrapper scripts just to set variables rather
8160 # than running their programs.
8161 libtool_install_magic="$magic"
8163 for arg
8165 case $arg in
8166 -f) RM="$RM $arg"; rmforce=yes ;;
8167 -*) RM="$RM $arg" ;;
8168 *) files="$files $arg" ;;
8169 esac
8170 done
8172 test -z "$RM" && \
8173 func_fatal_help "you must specify an RM program"
8175 rmdirs=
8177 origobjdir="$objdir"
8178 for file in $files; do
8179 func_dirname "$file" "" "."
8180 dir="$func_dirname_result"
8181 if test "X$dir" = X.; then
8182 objdir="$origobjdir"
8183 else
8184 objdir="$dir/$origobjdir"
8186 func_basename "$file"
8187 name="$func_basename_result"
8188 test "$mode" = uninstall && objdir="$dir"
8190 # Remember objdir for removal later, being careful to avoid duplicates
8191 if test "$mode" = clean; then
8192 case " $rmdirs " in
8193 *" $objdir "*) ;;
8194 *) rmdirs="$rmdirs $objdir" ;;
8195 esac
8198 # Don't error if the file doesn't exist and rm -f was used.
8199 if { test -L "$file"; } >/dev/null 2>&1 ||
8200 { test -h "$file"; } >/dev/null 2>&1 ||
8201 test -f "$file"; then
8203 elif test -d "$file"; then
8204 exit_status=1
8205 continue
8206 elif test "$rmforce" = yes; then
8207 continue
8210 rmfiles="$file"
8212 case $name in
8213 *.la)
8214 # Possibly a libtool archive, so verify it.
8215 if func_lalib_p "$file"; then
8216 func_source $dir/$name
8218 # Delete the libtool libraries and symlinks.
8219 for n in $library_names; do
8220 rmfiles="$rmfiles $objdir/$n"
8221 done
8222 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
8224 case "$mode" in
8225 clean)
8226 case " $library_names " in
8227 # " " in the beginning catches empty $dlname
8228 *" $dlname "*) ;;
8229 *) rmfiles="$rmfiles $objdir/$dlname" ;;
8230 esac
8231 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
8233 uninstall)
8234 if test -n "$library_names"; then
8235 # Do each command in the postuninstall commands.
8236 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8239 if test -n "$old_library"; then
8240 # Do each command in the old_postuninstall commands.
8241 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8243 # FIXME: should reinstall the best remaining shared library.
8245 esac
8249 *.lo)
8250 # Possibly a libtool object, so verify it.
8251 if func_lalib_p "$file"; then
8253 # Read the .lo file
8254 func_source $dir/$name
8256 # Add PIC object to the list of files to remove.
8257 if test -n "$pic_object" &&
8258 test "$pic_object" != none; then
8259 rmfiles="$rmfiles $dir/$pic_object"
8262 # Add non-PIC object to the list of files to remove.
8263 if test -n "$non_pic_object" &&
8264 test "$non_pic_object" != none; then
8265 rmfiles="$rmfiles $dir/$non_pic_object"
8271 if test "$mode" = clean ; then
8272 noexename=$name
8273 case $file in
8274 *.exe)
8275 func_stripname '' '.exe' "$file"
8276 file=$func_stripname_result
8277 func_stripname '' '.exe' "$name"
8278 noexename=$func_stripname_result
8279 # $file with .exe has already been added to rmfiles,
8280 # add $file without .exe
8281 rmfiles="$rmfiles $file"
8283 esac
8284 # Do a test to see if this is a libtool program.
8285 if func_ltwrapper_p "$file"; then
8286 if func_ltwrapper_executable_p "$file"; then
8287 func_ltwrapper_scriptname "$file"
8288 relink_command=
8289 func_source $func_ltwrapper_scriptname_result
8290 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
8291 else
8292 relink_command=
8293 func_source $dir/$noexename
8296 # note $name still contains .exe if it was in $file originally
8297 # as does the version of $file that was added into $rmfiles
8298 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
8299 if test "$fast_install" = yes && test -n "$relink_command"; then
8300 rmfiles="$rmfiles $objdir/lt-$name"
8302 if test "X$noexename" != "X$name" ; then
8303 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
8308 esac
8309 func_show_eval "$RM $rmfiles" 'exit_status=1'
8310 done
8311 objdir="$origobjdir"
8313 # Try to remove the ${objdir}s in the directories where we deleted files
8314 for dir in $rmdirs; do
8315 if test -d "$dir"; then
8316 func_show_eval "rmdir $dir >/dev/null 2>&1"
8318 done
8320 exit $exit_status
8323 { test "$mode" = uninstall || test "$mode" = clean; } &&
8324 func_mode_uninstall ${1+"$@"}
8326 test -z "$mode" && {
8327 help="$generic_help"
8328 func_fatal_help "you must specify a MODE"
8331 test -z "$exec_cmd" && \
8332 func_fatal_help "invalid operation mode \`$mode'"
8334 if test -n "$exec_cmd"; then
8335 eval exec "$exec_cmd"
8336 exit $EXIT_FAILURE
8339 exit $exit_status
8342 # The TAGs below are defined such that we never get into a situation
8343 # in which we disable both kinds of libraries. Given conflicting
8344 # choices, we go for a static library, that is the most portable,
8345 # since we can't tell whether shared libraries were disabled because
8346 # the user asked for that or because the platform doesn't support
8347 # them. This is particularly important on AIX, because we don't
8348 # support having both static and shared libraries enabled at the same
8349 # time on that platform, so we default to a shared-only configuration.
8350 # If a disable-shared tag is given, we'll fallback to a static-only
8351 # configuration. But we'll never go from static-only to shared-only.
8353 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
8354 build_libtool_libs=no
8355 build_old_libs=yes
8356 # ### END LIBTOOL TAG CONFIG: disable-shared
8358 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
8359 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
8360 # ### END LIBTOOL TAG CONFIG: disable-static
8362 # Local Variables:
8363 # mode:shell-script
8364 # sh-indentation:2
8365 # End:
8366 # vi:sw=2