Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / libexif / libtool
blobfb94720b52011fac3c296a2df8637f541c803a84
1 #! /bin/sh
3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (libexif) 0.6.19
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 # Which release of libtool.m4 was used?
42 macro_version=2.2.6
43 macro_revision=1.3012
45 # Whether or not to build shared libraries.
46 build_libtool_libs=yes
48 # Whether or not to build static libraries.
49 build_old_libs=yes
51 # What type of objects to build.
52 pic_mode=default
54 # Whether or not to optimize for fast installation.
55 fast_install=yes
57 # The host system.
58 host_alias=mipsel-linux
59 host=mipsel-unknown-linux-gnu
60 host_os=linux-gnu
62 # The build system.
63 build_alias=x86_64-linux-gnu
64 build=x86_64-pc-linux-gnu
65 build_os=linux-gnu
67 # A sed program that does not truncate output.
68 SED="/bin/sed"
70 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
71 Xsed="$SED -e 1s/^X//"
73 # A grep program that handles long lines.
74 GREP="/bin/grep"
76 # An ERE matcher.
77 EGREP="/bin/grep -E"
79 # A literal string matcher.
80 FGREP="/bin/grep -F"
82 # A BSD- or MS-compatible name lister.
83 NM="mipsel-uclibc-nm"
85 # Whether we need soft or hard links.
86 LN_S="ln -s"
88 # What is the maximum length of a command?
89 max_cmd_len=3458764513820540925
91 # Object file suffix (normally "o").
92 objext=o
94 # Executable file suffix (normally "").
95 exeext=
97 # whether the shell understands "unset".
98 lt_unset=unset
100 # turn spaces into newlines.
101 SP2NL="tr \\040 \\012"
103 # turn newlines into spaces.
104 NL2SP="tr \\015\\012 \\040\\040"
106 # How to create reloadable object files.
107 reload_flag=" -r"
108 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
110 # An object symbol dumper.
111 OBJDUMP="mipsel-linux-objdump"
113 # Method to check whether dependent libraries are shared objects.
114 deplibs_check_method="pass_all"
116 # Command to use when deplibs_check_method == "file_magic".
117 file_magic_cmd="\$MAGIC_CMD"
119 # The archiver.
120 AR="mipsel-uclibc-ar"
121 AR_FLAGS="cru"
123 # A symbol stripping program.
124 STRIP="mipsel-uclibc-strip -R .note -R .comment"
126 # Commands used to install an old-style archive.
127 RANLIB="mipsel-uclibc-ranlib"
128 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
129 old_postuninstall_cmds=""
131 # A C compiler.
132 LTCC="mipsel-uclibc-gcc"
134 # LTCC compiler flags.
135 LTCFLAGS="-Os -Wall -DLINUX26 -DCONFIG_BCMWL5 -pipe -DBCMWPA2 -funit-at-a-time -Wno-pointer-sign -mtune=mips32 -mips32 -fPIC -ffunction-sections -fdata-sections"
137 # Take the output of nm and produce a listing of raw symbols and C names.
138 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
140 # Transform the output of nm in a proper C declaration.
141 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
143 # Transform the output of nm in a C name address pair.
144 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
146 # Transform the output of nm in a C name address pair when lib prefix is needed.
147 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'"
149 # The name of the directory that contains temporary libtool files.
150 objdir=.libs
152 # Shell to use when invoking shell scripts.
153 SHELL="/bin/sh"
155 # An echo program that does not interpret backslashes.
156 ECHO="echo"
158 # Used to examine libraries when file_magic_cmd begins with "file".
159 MAGIC_CMD=file
161 # Must we lock files when doing compilation?
162 need_locks="no"
164 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
165 DSYMUTIL=""
167 # Tool to change global to local symbols on Mac OS X.
168 NMEDIT=""
170 # Tool to manipulate fat objects and archives on Mac OS X.
171 LIPO=""
173 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
174 OTOOL=""
176 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
177 OTOOL64=""
179 # Old archive suffix (normally "a").
180 libext=a
182 # Shared library suffix (normally ".so").
183 shrext_cmds=".so"
185 # The commands to extract the exported symbol list from a shared archive.
186 extract_expsyms_cmds=""
188 # Variables whose values should be saved in libtool wrapper scripts and
189 # restored at link time.
190 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
192 # Do we need the "lib" prefix for modules?
193 need_lib_prefix=no
195 # Do we need a version for libraries?
196 need_version=no
198 # Library versioning type.
199 version_type=linux
201 # Shared library runtime path variable.
202 runpath_var=LD_RUN_PATH
204 # Shared library path variable.
205 shlibpath_var=LD_LIBRARY_PATH
207 # Is shlibpath searched before the hard-coded library search path?
208 shlibpath_overrides_runpath=no
210 # Format of library name prefix.
211 libname_spec="lib\$name"
213 # List of archive names. First name is the real one, the rest are links.
214 # The last name is the one that the linker finds with -lNAME
215 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
217 # The coded name of the library, if different from the real name.
218 soname_spec="\${libname}\${release}\${shared_ext}\$major"
220 # Command to use after installation of a shared archive.
221 postinstall_cmds=""
223 # Command to use after uninstallation of a shared archive.
224 postuninstall_cmds=""
226 # Commands used to finish a libtool library installation in a directory.
227 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
229 # As "finish_cmds", except a single script fragment to be evaled but
230 # not shown.
231 finish_eval=""
233 # Whether we should hardcode library paths into libraries.
234 hardcode_into_libs=yes
236 # Compile-time system search path for libraries.
237 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"
239 # Run-time system search path for libraries.
240 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 "
242 # Whether dlopen is supported.
243 dlopen_support=unknown
245 # Whether dlopen of programs is supported.
246 dlopen_self=unknown
248 # Whether dlopen of statically linked programs is supported.
249 dlopen_self_static=unknown
251 # Commands to strip libraries.
252 old_striplib="mipsel-uclibc-strip -R .note -R .comment --strip-debug"
253 striplib="mipsel-uclibc-strip -R .note -R .comment --strip-unneeded"
256 # The linker used to build libraries.
257 LD="mipsel-uclibc-ld"
259 # Commands used to build an old-style archive.
260 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
262 # A language specific compiler.
263 CC="mipsel-uclibc-gcc"
265 # Is the compiler the GNU compiler?
266 with_gcc=yes
268 # Compiler flag to turn off builtin functions.
269 no_builtin_flag=" -fno-builtin"
271 # How to pass a linker flag through the compiler.
272 wl="-Wl,"
274 # Additional compiler flags for building library objects.
275 pic_flag=" -fPIC -DPIC"
277 # Compiler flag to prevent dynamic linking.
278 link_static_flag="-static"
280 # Does compiler simultaneously support -c and -o options?
281 compiler_c_o="yes"
283 # Whether or not to add -lc for building shared libraries.
284 build_libtool_need_lc=no
286 # Whether or not to disallow shared libs when runtime libs are static.
287 allow_libtool_libs_with_static_runtimes=no
289 # Compiler flag to allow reflexive dlopens.
290 export_dynamic_flag_spec="\${wl}--export-dynamic"
292 # Compiler flag to generate shared objects directly from archives.
293 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
295 # Whether the compiler copes with passing no objects directly.
296 compiler_needs_object="no"
298 # Create an old-style archive from a shared archive.
299 old_archive_from_new_cmds=""
301 # Create a temporary old-style archive to link instead of a shared archive.
302 old_archive_from_expsyms_cmds=""
304 # Commands used to build a shared archive.
305 archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
306 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
307 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
308 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
309 \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
311 # Commands used to build a loadable module if different from building
312 # a shared archive.
313 module_cmds=""
314 module_expsym_cmds=""
316 # Whether we are building with GNU ld or not.
317 with_gnu_ld="yes"
319 # Flag that allows shared libraries with undefined symbols to be built.
320 allow_undefined_flag=""
322 # Flag that enforces no undefined symbols.
323 no_undefined_flag=""
325 # Flag to hardcode $libdir into a binary during linking.
326 # This must work even if $libdir does not exist
327 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
329 # If ld is used when linking, flag to hardcode $libdir into a binary
330 # during linking. This must work even if $libdir does not exist.
331 hardcode_libdir_flag_spec_ld=""
333 # Whether we need a single "-rpath" flag with a separated argument.
334 hardcode_libdir_separator=""
336 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
337 # DIR into the resulting binary.
338 hardcode_direct=no
340 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
341 # DIR into the resulting binary and the resulting library dependency is
342 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
343 # library is relocated.
344 hardcode_direct_absolute=no
346 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
347 # into the resulting binary.
348 hardcode_minus_L=no
350 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
351 # into the resulting binary.
352 hardcode_shlibpath_var=unsupported
354 # Set to "yes" if building a shared library automatically hardcodes DIR
355 # into the library and all subsequent libraries and executables linked
356 # against it.
357 hardcode_automatic=no
359 # Set to yes if linker adds runtime paths of dependent libraries
360 # to runtime path list.
361 inherit_rpath=no
363 # Whether libtool must link a program against all its dependency libraries.
364 link_all_deplibs=unknown
366 # Fix the shell variable $srcfile for the compiler.
367 fix_srcfile_path=""
369 # Set to "yes" if exported symbols are required.
370 always_export_symbols=no
372 # The commands to list exported symbols.
373 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
375 # Symbols that should not be listed in the preloaded symbols.
376 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
378 # Symbols that must always be exported.
379 include_expsyms=""
381 # Commands necessary for linking programs (against libraries) with templates.
382 prelink_cmds=""
384 # Specify filename containing input files.
385 file_list_spec=""
387 # How to hardcode a shared library path into an executable.
388 hardcode_action=immediate
390 # ### END LIBTOOL CONFIG
392 # Generated from ltmain.m4sh.
394 # ltmain.sh (GNU libtool) 2.2.6
395 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
397 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
398 # This is free software; see the source for copying conditions. There is NO
399 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
401 # GNU Libtool is free software; you can redistribute it and/or modify
402 # it under the terms of the GNU General Public License as published by
403 # the Free Software Foundation; either version 2 of the License, or
404 # (at your option) any later version.
406 # As a special exception to the GNU General Public License,
407 # if you distribute this file as part of a program or library that
408 # is built using GNU Libtool, you may include this file under the
409 # same distribution terms that you use for the rest of that program.
411 # GNU Libtool is distributed in the hope that it will be useful, but
412 # WITHOUT ANY WARRANTY; without even the implied warranty of
413 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
414 # General Public License for more details.
416 # You should have received a copy of the GNU General Public License
417 # along with GNU Libtool; see the file COPYING. If not, a copy
418 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
419 # or obtained by writing to the Free Software Foundation, Inc.,
420 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
422 # Usage: $progname [OPTION]... [MODE-ARG]...
424 # Provide generalized library-building support services.
426 # --config show all configuration variables
427 # --debug enable verbose shell tracing
428 # -n, --dry-run display commands without modifying any files
429 # --features display basic configuration information and exit
430 # --mode=MODE use operation mode MODE
431 # --preserve-dup-deps don't remove duplicate dependency libraries
432 # --quiet, --silent don't print informational messages
433 # --tag=TAG use configuration variables from tag TAG
434 # -v, --verbose print informational messages (default)
435 # --version print version information
436 # -h, --help print short or long help message
438 # MODE must be one of the following:
440 # clean remove files from the build directory
441 # compile compile a source file into a libtool object
442 # execute automatically set library path, then run a program
443 # finish complete the installation of libtool libraries
444 # install install libraries or executables
445 # link create a library or an executable
446 # uninstall remove libraries from an installed directory
448 # MODE-ARGS vary depending on the MODE.
449 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
451 # When reporting a bug, please describe a test case to reproduce it and
452 # include the following information:
454 # host-triplet: $host
455 # shell: $SHELL
456 # compiler: $LTCC
457 # compiler flags: $LTCFLAGS
458 # linker: $LD (gnu? $with_gnu_ld)
459 # $progname: (GNU libtool) 2.2.6
460 # automake: $automake_version
461 # autoconf: $autoconf_version
463 # Report bugs to <bug-libtool@gnu.org>.
465 PROGRAM=ltmain.sh
466 PACKAGE=libtool
467 VERSION=2.2.6
468 TIMESTAMP=""
469 package_revision=1.3012
471 # define SED for historic ltconfig's generated by Libtool 1.3
472 test -z "$SED" && SED=sed
474 # Be Bourne compatible
475 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
476 emulate sh
477 NULLCMD=:
478 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
479 # is contrary to our usage. Disable this feature.
480 alias -g '${1+"$@"}'='"$@"'
481 setopt NO_GLOB_SUBST
482 else
483 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
485 BIN_SH=xpg4; export BIN_SH # for Tru64
486 DUALCASE=1; export DUALCASE # for MKS sh
488 # NLS nuisances: We save the old values to restore during execute mode.
489 # Only set LANG and LC_ALL to C if already set.
490 # These must not be set unconditionally because not all systems understand
491 # e.g. LANG=C (notably SCO).
492 lt_user_locale=
493 lt_safe_locale=
494 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
496 eval "if test \"\${$lt_var+set}\" = set; then
497 save_$lt_var=\$$lt_var
498 $lt_var=C
499 export $lt_var
500 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
501 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
503 done
505 $lt_unset CDPATH
511 : ${CP="cp -f"}
512 : ${ECHO="echo"}
513 : ${EGREP="/bin/grep -E"}
514 : ${FGREP="/bin/grep -F"}
515 : ${GREP="/bin/grep"}
516 : ${LN_S="ln -s"}
517 : ${MAKE="make"}
518 : ${MKDIR="mkdir"}
519 : ${MV="mv -f"}
520 : ${RM="rm -f"}
521 : ${SED="/bin/sed"}
522 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
523 : ${Xsed="$SED -e 1s/^X//"}
525 # Global variables:
526 EXIT_SUCCESS=0
527 EXIT_FAILURE=1
528 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
529 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
531 exit_status=$EXIT_SUCCESS
533 # Make sure IFS has a sensible default
534 lt_nl='
536 IFS=" $lt_nl"
538 dirname="s,/[^/]*$,,"
539 basename="s,^.*/,,"
541 # func_dirname_and_basename file append nondir_replacement
542 # perform func_basename and func_dirname in a single function
543 # call:
544 # dirname: Compute the dirname of FILE. If nonempty,
545 # add APPEND to the result, otherwise set result
546 # to NONDIR_REPLACEMENT.
547 # value returned in "$func_dirname_result"
548 # basename: Compute filename of FILE.
549 # value retuned in "$func_basename_result"
550 # Implementation must be kept synchronized with func_dirname
551 # and func_basename. For efficiency, we do not delegate to
552 # those functions but instead duplicate the functionality here.
553 func_dirname_and_basename ()
555 # Extract subdirectory from the argument.
556 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
557 if test "X$func_dirname_result" = "X${1}"; then
558 func_dirname_result="${3}"
559 else
560 func_dirname_result="$func_dirname_result${2}"
562 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
565 # Generated shell functions inserted here.
567 # func_dirname file append nondir_replacement
568 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
569 # otherwise set result to NONDIR_REPLACEMENT.
570 func_dirname ()
572 case ${1} in
573 */*) func_dirname_result="${1%/*}${2}" ;;
574 * ) func_dirname_result="${3}" ;;
575 esac
578 # func_basename file
579 func_basename ()
581 func_basename_result="${1##*/}"
584 # func_dirname_and_basename file append nondir_replacement
585 # perform func_basename and func_dirname in a single function
586 # call:
587 # dirname: Compute the dirname of FILE. If nonempty,
588 # add APPEND to the result, otherwise set result
589 # to NONDIR_REPLACEMENT.
590 # value returned in "$func_dirname_result"
591 # basename: Compute filename of FILE.
592 # value retuned in "$func_basename_result"
593 # Implementation must be kept synchronized with func_dirname
594 # and func_basename. For efficiency, we do not delegate to
595 # those functions but instead duplicate the functionality here.
596 func_dirname_and_basename ()
598 case ${1} in
599 */*) func_dirname_result="${1%/*}${2}" ;;
600 * ) func_dirname_result="${3}" ;;
601 esac
602 func_basename_result="${1##*/}"
605 # func_stripname prefix suffix name
606 # strip PREFIX and SUFFIX off of NAME.
607 # PREFIX and SUFFIX must not contain globbing or regex special
608 # characters, hashes, percent signs, but SUFFIX may contain a leading
609 # dot (in which case that matches only a dot).
610 func_stripname ()
612 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
613 # positional parameters, so assign one to ordinary parameter first.
614 func_stripname_result=${3}
615 func_stripname_result=${func_stripname_result#"${1}"}
616 func_stripname_result=${func_stripname_result%"${2}"}
619 # func_opt_split
620 func_opt_split ()
622 func_opt_split_opt=${1%%=*}
623 func_opt_split_arg=${1#*=}
626 # func_lo2o object
627 func_lo2o ()
629 case ${1} in
630 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
631 *) func_lo2o_result=${1} ;;
632 esac
635 # func_xform libobj-or-source
636 func_xform ()
638 func_xform_result=${1%.*}.lo
641 # func_arith arithmetic-term...
642 func_arith ()
644 func_arith_result=$(( $* ))
647 # func_len string
648 # STRING may not start with a hyphen.
649 func_len ()
651 func_len_result=${#1}
655 # func_append var value
656 # Append VALUE to the end of shell variable VAR.
657 func_append ()
659 eval "$1+=\$2"
661 # Generated shell functions inserted here.
663 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
664 # is ksh but when the shell is invoked as "sh" and the current value of
665 # the _XPG environment variable is not equal to 1 (one), the special
666 # positional parameter $0, within a function call, is the name of the
667 # function.
668 progpath="$0"
670 # The name of this program:
671 # In the unlikely event $progname began with a '-', it would play havoc with
672 # func_echo (imagine progname=-n), so we prepend ./ in that case:
673 func_dirname_and_basename "$progpath"
674 progname=$func_basename_result
675 case $progname in
676 -*) progname=./$progname ;;
677 esac
679 # Make sure we have an absolute path for reexecution:
680 case $progpath in
681 [\\/]*|[A-Za-z]:\\*) ;;
682 *[\\/]*)
683 progdir=$func_dirname_result
684 progdir=`cd "$progdir" && pwd`
685 progpath="$progdir/$progname"
688 save_IFS="$IFS"
689 IFS=:
690 for progdir in $PATH; do
691 IFS="$save_IFS"
692 test -x "$progdir/$progname" && break
693 done
694 IFS="$save_IFS"
695 test -n "$progdir" || progdir=`pwd`
696 progpath="$progdir/$progname"
698 esac
700 # Sed substitution that helps us do robust quoting. It backslashifies
701 # metacharacters that are still active within double-quoted strings.
702 Xsed="${SED}"' -e 1s/^X//'
703 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
705 # Same as above, but do not quote variable references.
706 double_quote_subst='s/\(["`\\]\)/\\\1/g'
708 # Re-`\' parameter expansions in output of double_quote_subst that were
709 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
710 # in input to double_quote_subst, that '$' was protected from expansion.
711 # Since each input `\' is now two `\'s, look for any number of runs of
712 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
713 bs='\\'
714 bs2='\\\\'
715 bs4='\\\\\\\\'
716 dollar='\$'
717 sed_double_backslash="\
718 s/$bs4/&\\
720 s/^$bs2$dollar/$bs&/
721 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
722 s/\n//g"
724 # Standard options:
725 opt_dry_run=false
726 opt_help=false
727 opt_quiet=false
728 opt_verbose=false
729 opt_warning=:
731 # func_echo arg...
732 # Echo program name prefixed message, along with the current mode
733 # name if it has been set yet.
734 func_echo ()
736 $ECHO "$progname${mode+: }$mode: $*"
739 # func_verbose arg...
740 # Echo program name prefixed message in verbose mode only.
741 func_verbose ()
743 $opt_verbose && func_echo ${1+"$@"}
745 # A bug in bash halts the script if the last line of a function
746 # fails when set -e is in force, so we need another command to
747 # work around that:
751 # func_error arg...
752 # Echo program name prefixed message to standard error.
753 func_error ()
755 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
758 # func_warning arg...
759 # Echo program name prefixed warning message to standard error.
760 func_warning ()
762 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
764 # bash bug again:
768 # func_fatal_error arg...
769 # Echo program name prefixed message to standard error, and exit.
770 func_fatal_error ()
772 func_error ${1+"$@"}
773 exit $EXIT_FAILURE
776 # func_fatal_help arg...
777 # Echo program name prefixed message to standard error, followed by
778 # a help hint, and exit.
779 func_fatal_help ()
781 func_error ${1+"$@"}
782 func_fatal_error "$help"
784 help="Try \`$progname --help' for more information." ## default
787 # func_grep expression filename
788 # Check whether EXPRESSION matches any line of FILENAME, without output.
789 func_grep ()
791 $GREP "$1" "$2" >/dev/null 2>&1
795 # func_mkdir_p directory-path
796 # Make sure the entire path to DIRECTORY-PATH is available.
797 func_mkdir_p ()
799 my_directory_path="$1"
800 my_dir_list=
802 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
804 # Protect directory names starting with `-'
805 case $my_directory_path in
806 -*) my_directory_path="./$my_directory_path" ;;
807 esac
809 # While some portion of DIR does not yet exist...
810 while test ! -d "$my_directory_path"; do
811 # ...make a list in topmost first order. Use a colon delimited
812 # list incase some portion of path contains whitespace.
813 my_dir_list="$my_directory_path:$my_dir_list"
815 # If the last portion added has no slash in it, the list is done
816 case $my_directory_path in */*) ;; *) break ;; esac
818 # ...otherwise throw away the child directory and loop
819 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
820 done
821 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
823 save_mkdir_p_IFS="$IFS"; IFS=':'
824 for my_dir in $my_dir_list; do
825 IFS="$save_mkdir_p_IFS"
826 # mkdir can fail with a `File exist' error if two processes
827 # try to create one of the directories concurrently. Don't
828 # stop in that case!
829 $MKDIR "$my_dir" 2>/dev/null || :
830 done
831 IFS="$save_mkdir_p_IFS"
833 # Bail out if we (or some other process) failed to create a directory.
834 test -d "$my_directory_path" || \
835 func_fatal_error "Failed to create \`$1'"
840 # func_mktempdir [string]
841 # Make a temporary directory that won't clash with other running
842 # libtool processes, and avoids race conditions if possible. If
843 # given, STRING is the basename for that directory.
844 func_mktempdir ()
846 my_template="${TMPDIR-/tmp}/${1-$progname}"
848 if test "$opt_dry_run" = ":"; then
849 # Return a directory name, but don't create it in dry-run mode
850 my_tmpdir="${my_template}-$$"
851 else
853 # If mktemp works, use that first and foremost
854 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
856 if test ! -d "$my_tmpdir"; then
857 # Failing that, at least try and use $RANDOM to avoid a race
858 my_tmpdir="${my_template}-${RANDOM-0}$$"
860 save_mktempdir_umask=`umask`
861 umask 0077
862 $MKDIR "$my_tmpdir"
863 umask $save_mktempdir_umask
866 # If we're not in dry-run mode, bomb out on failure
867 test -d "$my_tmpdir" || \
868 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
871 $ECHO "X$my_tmpdir" | $Xsed
875 # func_quote_for_eval arg
876 # Aesthetically quote ARG to be evaled later.
877 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
878 # is double-quoted, suitable for a subsequent eval, whereas
879 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
880 # which are still active within double quotes backslashified.
881 func_quote_for_eval ()
883 case $1 in
884 *[\\\`\"\$]*)
885 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
887 func_quote_for_eval_unquoted_result="$1" ;;
888 esac
890 case $func_quote_for_eval_unquoted_result in
891 # Double-quote args containing shell metacharacters to delay
892 # word splitting, command substitution and and variable
893 # expansion for a subsequent eval.
894 # Many Bourne shells cannot handle close brackets correctly
895 # in scan sets, so we specify it separately.
896 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
897 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
900 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
901 esac
905 # func_quote_for_expand arg
906 # Aesthetically quote ARG to be evaled later; same as above,
907 # but do not quote variable references.
908 func_quote_for_expand ()
910 case $1 in
911 *[\\\`\"]*)
912 my_arg=`$ECHO "X$1" | $Xsed \
913 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
915 my_arg="$1" ;;
916 esac
918 case $my_arg in
919 # Double-quote args containing shell metacharacters to delay
920 # word splitting and command substitution for a subsequent eval.
921 # Many Bourne shells cannot handle close brackets correctly
922 # in scan sets, so we specify it separately.
923 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
924 my_arg="\"$my_arg\""
926 esac
928 func_quote_for_expand_result="$my_arg"
932 # func_show_eval cmd [fail_exp]
933 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
934 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
935 # is given, then evaluate it.
936 func_show_eval ()
938 my_cmd="$1"
939 my_fail_exp="${2-:}"
941 ${opt_silent-false} || {
942 func_quote_for_expand "$my_cmd"
943 eval "func_echo $func_quote_for_expand_result"
946 if ${opt_dry_run-false}; then :; else
947 eval "$my_cmd"
948 my_status=$?
949 if test "$my_status" -eq 0; then :; else
950 eval "(exit $my_status); $my_fail_exp"
956 # func_show_eval_locale cmd [fail_exp]
957 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
958 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
959 # is given, then evaluate it. Use the saved locale for evaluation.
960 func_show_eval_locale ()
962 my_cmd="$1"
963 my_fail_exp="${2-:}"
965 ${opt_silent-false} || {
966 func_quote_for_expand "$my_cmd"
967 eval "func_echo $func_quote_for_expand_result"
970 if ${opt_dry_run-false}; then :; else
971 eval "$lt_user_locale
972 $my_cmd"
973 my_status=$?
974 eval "$lt_safe_locale"
975 if test "$my_status" -eq 0; then :; else
976 eval "(exit $my_status); $my_fail_exp"
985 # func_version
986 # Echo version message to standard output and exit.
987 func_version ()
989 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
990 s/^# //
991 s/^# *$//
992 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
994 }' < "$progpath"
995 exit $?
998 # func_usage
999 # Echo short help message to standard output and exit.
1000 func_usage ()
1002 $SED -n '/^# Usage:/,/# -h/ {
1003 s/^# //
1004 s/^# *$//
1005 s/\$progname/'$progname'/
1007 }' < "$progpath"
1008 $ECHO
1009 $ECHO "run \`$progname --help | more' for full usage"
1010 exit $?
1013 # func_help
1014 # Echo long help message to standard output and exit.
1015 func_help ()
1017 $SED -n '/^# Usage:/,/# Report bugs to/ {
1018 s/^# //
1019 s/^# *$//
1020 s*\$progname*'$progname'*
1021 s*\$host*'"$host"'*
1022 s*\$SHELL*'"$SHELL"'*
1023 s*\$LTCC*'"$LTCC"'*
1024 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1025 s*\$LD*'"$LD"'*
1026 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1027 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1028 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1030 }' < "$progpath"
1031 exit $?
1034 # func_missing_arg argname
1035 # Echo program name prefixed message to standard error and set global
1036 # exit_cmd.
1037 func_missing_arg ()
1039 func_error "missing argument for $1"
1040 exit_cmd=exit
1043 exit_cmd=:
1049 # Check that we have a working $ECHO.
1050 if test "X$1" = X--no-reexec; then
1051 # Discard the --no-reexec flag, and continue.
1052 shift
1053 elif test "X$1" = X--fallback-echo; then
1054 # Avoid inline document here, it may be left over
1056 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
1057 # Yippee, $ECHO works!
1059 else
1060 # Restart under the correct shell, and then maybe $ECHO will work.
1061 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
1064 if test "X$1" = X--fallback-echo; then
1065 # used as fallback echo
1066 shift
1067 cat <<EOF
1070 exit $EXIT_SUCCESS
1073 magic="%%%MAGIC variable%%%"
1074 magic_exe="%%%MAGIC EXE variable%%%"
1076 # Global variables.
1077 # $mode is unset
1078 nonopt=
1079 execute_dlfiles=
1080 preserve_args=
1081 lo2o="s/\\.lo\$/.${objext}/"
1082 o2lo="s/\\.${objext}\$/.lo/"
1083 extracted_archives=
1084 extracted_serial=0
1086 opt_dry_run=false
1087 opt_duplicate_deps=false
1088 opt_silent=false
1089 opt_debug=:
1091 # If this variable is set in any of the actions, the command in it
1092 # will be execed at the end. This prevents here-documents from being
1093 # left over by shells.
1094 exec_cmd=
1096 # func_fatal_configuration arg...
1097 # Echo program name prefixed message to standard error, followed by
1098 # a configuration failure hint, and exit.
1099 func_fatal_configuration ()
1101 func_error ${1+"$@"}
1102 func_error "See the $PACKAGE documentation for more information."
1103 func_fatal_error "Fatal configuration error."
1107 # func_config
1108 # Display the configuration for all the tags in this script.
1109 func_config ()
1111 re_begincf='^# ### BEGIN LIBTOOL'
1112 re_endcf='^# ### END LIBTOOL'
1114 # Default configuration.
1115 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1117 # Now print the configurations for the tags.
1118 for tagname in $taglist; do
1119 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1120 done
1122 exit $?
1125 # func_features
1126 # Display the features supported by this script.
1127 func_features ()
1129 $ECHO "host: $host"
1130 if test "$build_libtool_libs" = yes; then
1131 $ECHO "enable shared libraries"
1132 else
1133 $ECHO "disable shared libraries"
1135 if test "$build_old_libs" = yes; then
1136 $ECHO "enable static libraries"
1137 else
1138 $ECHO "disable static libraries"
1141 exit $?
1144 # func_enable_tag tagname
1145 # Verify that TAGNAME is valid, and either flag an error and exit, or
1146 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1147 # variable here.
1148 func_enable_tag ()
1150 # Global variable:
1151 tagname="$1"
1153 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1154 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1155 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1157 # Validate tagname.
1158 case $tagname in
1159 *[!-_A-Za-z0-9,/]*)
1160 func_fatal_error "invalid tag name: $tagname"
1162 esac
1164 # Don't test for the "default" C tag, as we know it's
1165 # there but not specially marked.
1166 case $tagname in
1167 CC) ;;
1169 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1170 taglist="$taglist $tagname"
1172 # Evaluate the configuration. Be careful to quote the path
1173 # and the sed script, to avoid splitting on whitespace, but
1174 # also don't use non-portable quotes within backquotes within
1175 # quotes we have to do it in 2 steps:
1176 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1177 eval "$extractedcf"
1178 else
1179 func_error "ignoring unknown tag $tagname"
1182 esac
1185 # Parse options once, thoroughly. This comes as soon as possible in
1186 # the script to make things like `libtool --version' happen quickly.
1189 # Shorthand for --mode=foo, only valid as the first argument
1190 case $1 in
1191 clean|clea|cle|cl)
1192 shift; set dummy --mode clean ${1+"$@"}; shift
1194 compile|compil|compi|comp|com|co|c)
1195 shift; set dummy --mode compile ${1+"$@"}; shift
1197 execute|execut|execu|exec|exe|ex|e)
1198 shift; set dummy --mode execute ${1+"$@"}; shift
1200 finish|finis|fini|fin|fi|f)
1201 shift; set dummy --mode finish ${1+"$@"}; shift
1203 install|instal|insta|inst|ins|in|i)
1204 shift; set dummy --mode install ${1+"$@"}; shift
1206 link|lin|li|l)
1207 shift; set dummy --mode link ${1+"$@"}; shift
1209 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1210 shift; set dummy --mode uninstall ${1+"$@"}; shift
1212 esac
1214 # Parse non-mode specific arguments:
1215 while test "$#" -gt 0; do
1216 opt="$1"
1217 shift
1219 case $opt in
1220 --config) func_config ;;
1222 --debug) preserve_args="$preserve_args $opt"
1223 func_echo "enabling shell trace mode"
1224 opt_debug='set -x'
1225 $opt_debug
1228 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
1229 execute_dlfiles="$execute_dlfiles $1"
1230 shift
1233 --dry-run | -n) opt_dry_run=: ;;
1234 --features) func_features ;;
1235 --finish) mode="finish" ;;
1237 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
1238 case $1 in
1239 # Valid mode arguments:
1240 clean) ;;
1241 compile) ;;
1242 execute) ;;
1243 finish) ;;
1244 install) ;;
1245 link) ;;
1246 relink) ;;
1247 uninstall) ;;
1249 # Catch anything else as an error
1250 *) func_error "invalid argument for $opt"
1251 exit_cmd=exit
1252 break
1254 esac
1256 mode="$1"
1257 shift
1260 --preserve-dup-deps)
1261 opt_duplicate_deps=: ;;
1263 --quiet|--silent) preserve_args="$preserve_args $opt"
1264 opt_silent=:
1267 --verbose| -v) preserve_args="$preserve_args $opt"
1268 opt_silent=false
1271 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
1272 preserve_args="$preserve_args $opt $1"
1273 func_enable_tag "$1" # tagname is set here
1274 shift
1277 # Separate optargs to long options:
1278 -dlopen=*|--mode=*|--tag=*)
1279 func_opt_split "$opt"
1280 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
1281 shift
1284 -\?|-h) func_usage ;;
1285 --help) opt_help=: ;;
1286 --version) func_version ;;
1288 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1290 *) nonopt="$opt"
1291 break
1293 esac
1294 done
1297 case $host in
1298 *cygwin* | *mingw* | *pw32* | *cegcc*)
1299 # don't eliminate duplications in $postdeps and $predeps
1300 opt_duplicate_compiler_generated_deps=:
1303 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
1305 esac
1307 # Having warned about all mis-specified options, bail out if
1308 # anything was wrong.
1309 $exit_cmd $EXIT_FAILURE
1312 # func_check_version_match
1313 # Ensure that we are using m4 macros, and libtool script from the same
1314 # release of libtool.
1315 func_check_version_match ()
1317 if test "$package_revision" != "$macro_revision"; then
1318 if test "$VERSION" != "$macro_version"; then
1319 if test -z "$macro_version"; then
1320 cat >&2 <<_LT_EOF
1321 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1322 $progname: definition of this LT_INIT comes from an older release.
1323 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1324 $progname: and run autoconf again.
1325 _LT_EOF
1326 else
1327 cat >&2 <<_LT_EOF
1328 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1329 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1330 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1331 $progname: and run autoconf again.
1332 _LT_EOF
1334 else
1335 cat >&2 <<_LT_EOF
1336 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1337 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1338 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1339 $progname: of $PACKAGE $VERSION and run autoconf again.
1340 _LT_EOF
1343 exit $EXIT_MISMATCH
1348 ## ----------- ##
1349 ## Main. ##
1350 ## ----------- ##
1352 $opt_help || {
1353 # Sanity checks first:
1354 func_check_version_match
1356 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1357 func_fatal_configuration "not configured to build any kind of library"
1360 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1363 # Darwin sucks
1364 eval std_shrext=\"$shrext_cmds\"
1367 # Only execute mode is allowed to have -dlopen flags.
1368 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1369 func_error "unrecognized option \`-dlopen'"
1370 $ECHO "$help" 1>&2
1371 exit $EXIT_FAILURE
1374 # Change the help message to a mode-specific one.
1375 generic_help="$help"
1376 help="Try \`$progname --help --mode=$mode' for more information."
1380 # func_lalib_p file
1381 # True iff FILE is a libtool `.la' library or `.lo' object file.
1382 # This function is only a basic sanity check; it will hardly flush out
1383 # determined imposters.
1384 func_lalib_p ()
1386 test -f "$1" &&
1387 $SED -e 4q "$1" 2>/dev/null \
1388 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1391 # func_lalib_unsafe_p file
1392 # True iff FILE is a libtool `.la' library or `.lo' object file.
1393 # This function implements the same check as func_lalib_p without
1394 # resorting to external programs. To this end, it redirects stdin and
1395 # closes it afterwards, without saving the original file descriptor.
1396 # As a safety measure, use it only where a negative result would be
1397 # fatal anyway. Works if `file' does not exist.
1398 func_lalib_unsafe_p ()
1400 lalib_p=no
1401 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1402 for lalib_p_l in 1 2 3 4
1404 read lalib_p_line
1405 case "$lalib_p_line" in
1406 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1407 esac
1408 done
1409 exec 0<&5 5<&-
1411 test "$lalib_p" = yes
1414 # func_ltwrapper_script_p file
1415 # True iff FILE is a libtool wrapper script
1416 # This function is only a basic sanity check; it will hardly flush out
1417 # determined imposters.
1418 func_ltwrapper_script_p ()
1420 func_lalib_p "$1"
1423 # func_ltwrapper_executable_p file
1424 # True iff FILE is a libtool wrapper executable
1425 # This function is only a basic sanity check; it will hardly flush out
1426 # determined imposters.
1427 func_ltwrapper_executable_p ()
1429 func_ltwrapper_exec_suffix=
1430 case $1 in
1431 *.exe) ;;
1432 *) func_ltwrapper_exec_suffix=.exe ;;
1433 esac
1434 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1437 # func_ltwrapper_scriptname file
1438 # Assumes file is an ltwrapper_executable
1439 # uses $file to determine the appropriate filename for a
1440 # temporary ltwrapper_script.
1441 func_ltwrapper_scriptname ()
1443 func_ltwrapper_scriptname_result=""
1444 if func_ltwrapper_executable_p "$1"; then
1445 func_dirname_and_basename "$1" "" "."
1446 func_stripname '' '.exe' "$func_basename_result"
1447 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1451 # func_ltwrapper_p file
1452 # True iff FILE is a libtool wrapper script or wrapper executable
1453 # This function is only a basic sanity check; it will hardly flush out
1454 # determined imposters.
1455 func_ltwrapper_p ()
1457 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1461 # func_execute_cmds commands fail_cmd
1462 # Execute tilde-delimited COMMANDS.
1463 # If FAIL_CMD is given, eval that upon failure.
1464 # FAIL_CMD may read-access the current command in variable CMD!
1465 func_execute_cmds ()
1467 $opt_debug
1468 save_ifs=$IFS; IFS='~'
1469 for cmd in $1; do
1470 IFS=$save_ifs
1471 eval cmd=\"$cmd\"
1472 func_show_eval "$cmd" "${2-:}"
1473 done
1474 IFS=$save_ifs
1478 # func_source file
1479 # Source FILE, adding directory component if necessary.
1480 # Note that it is not necessary on cygwin/mingw to append a dot to
1481 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1482 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1483 # `FILE.' does not work on cygwin managed mounts.
1484 func_source ()
1486 $opt_debug
1487 case $1 in
1488 */* | *\\*) . "$1" ;;
1489 *) . "./$1" ;;
1490 esac
1494 # func_infer_tag arg
1495 # Infer tagged configuration to use if any are available and
1496 # if one wasn't chosen via the "--tag" command line option.
1497 # Only attempt this if the compiler in the base compile
1498 # command doesn't match the default compiler.
1499 # arg is usually of the form 'gcc ...'
1500 func_infer_tag ()
1502 $opt_debug
1503 if test -n "$available_tags" && test -z "$tagname"; then
1504 CC_quoted=
1505 for arg in $CC; do
1506 func_quote_for_eval "$arg"
1507 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1508 done
1509 case $@ in
1510 # Blanks in the command may have been stripped by the calling shell,
1511 # but not from the CC environment variable when configure was run.
1512 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1513 # Blanks at the start of $base_compile will cause this to fail
1514 # if we don't check for them as well.
1516 for z in $available_tags; do
1517 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1518 # Evaluate the configuration.
1519 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1520 CC_quoted=
1521 for arg in $CC; do
1522 # Double-quote args containing other shell metacharacters.
1523 func_quote_for_eval "$arg"
1524 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1525 done
1526 case "$@ " in
1527 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1528 # The compiler in the base compile command matches
1529 # the one in the tagged configuration.
1530 # Assume this is the tagged configuration we want.
1531 tagname=$z
1532 break
1534 esac
1536 done
1537 # If $tagname still isn't set, then no tagged configuration
1538 # was found and let the user know that the "--tag" command
1539 # line option must be used.
1540 if test -z "$tagname"; then
1541 func_echo "unable to infer tagged configuration"
1542 func_fatal_error "specify a tag with \`--tag'"
1543 # else
1544 # func_verbose "using $tagname tagged configuration"
1547 esac
1553 # func_write_libtool_object output_name pic_name nonpic_name
1554 # Create a libtool object file (analogous to a ".la" file),
1555 # but don't create it if we're doing a dry run.
1556 func_write_libtool_object ()
1558 write_libobj=${1}
1559 if test "$build_libtool_libs" = yes; then
1560 write_lobj=\'${2}\'
1561 else
1562 write_lobj=none
1565 if test "$build_old_libs" = yes; then
1566 write_oldobj=\'${3}\'
1567 else
1568 write_oldobj=none
1571 $opt_dry_run || {
1572 cat >${write_libobj}T <<EOF
1573 # $write_libobj - a libtool object file
1574 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1576 # Please DO NOT delete this file!
1577 # It is necessary for linking the library.
1579 # Name of the PIC object.
1580 pic_object=$write_lobj
1582 # Name of the non-PIC object
1583 non_pic_object=$write_oldobj
1586 $MV "${write_libobj}T" "${write_libobj}"
1590 # func_mode_compile arg...
1591 func_mode_compile ()
1593 $opt_debug
1594 # Get the compilation command and the source file.
1595 base_compile=
1596 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1597 suppress_opt=yes
1598 suppress_output=
1599 arg_mode=normal
1600 libobj=
1601 later=
1602 pie_flag=
1604 for arg
1606 case $arg_mode in
1607 arg )
1608 # do not "continue". Instead, add this to base_compile
1609 lastarg="$arg"
1610 arg_mode=normal
1613 target )
1614 libobj="$arg"
1615 arg_mode=normal
1616 continue
1619 normal )
1620 # Accept any command-line options.
1621 case $arg in
1623 test -n "$libobj" && \
1624 func_fatal_error "you cannot specify \`-o' more than once"
1625 arg_mode=target
1626 continue
1629 -pie | -fpie | -fPIE)
1630 pie_flag="$pie_flag $arg"
1631 continue
1634 -shared | -static | -prefer-pic | -prefer-non-pic)
1635 later="$later $arg"
1636 continue
1639 -no-suppress)
1640 suppress_opt=no
1641 continue
1644 -Xcompiler)
1645 arg_mode=arg # the next one goes into the "base_compile" arg list
1646 continue # The current "srcfile" will either be retained or
1647 ;; # replaced later. I would guess that would be a bug.
1649 -Wc,*)
1650 func_stripname '-Wc,' '' "$arg"
1651 args=$func_stripname_result
1652 lastarg=
1653 save_ifs="$IFS"; IFS=','
1654 for arg in $args; do
1655 IFS="$save_ifs"
1656 func_quote_for_eval "$arg"
1657 lastarg="$lastarg $func_quote_for_eval_result"
1658 done
1659 IFS="$save_ifs"
1660 func_stripname ' ' '' "$lastarg"
1661 lastarg=$func_stripname_result
1663 # Add the arguments to base_compile.
1664 base_compile="$base_compile $lastarg"
1665 continue
1669 # Accept the current argument as the source file.
1670 # The previous "srcfile" becomes the current argument.
1672 lastarg="$srcfile"
1673 srcfile="$arg"
1675 esac # case $arg
1677 esac # case $arg_mode
1679 # Aesthetically quote the previous argument.
1680 func_quote_for_eval "$lastarg"
1681 base_compile="$base_compile $func_quote_for_eval_result"
1682 done # for arg
1684 case $arg_mode in
1685 arg)
1686 func_fatal_error "you must specify an argument for -Xcompile"
1688 target)
1689 func_fatal_error "you must specify a target with \`-o'"
1692 # Get the name of the library object.
1693 test -z "$libobj" && {
1694 func_basename "$srcfile"
1695 libobj="$func_basename_result"
1698 esac
1700 # Recognize several different file suffixes.
1701 # If the user specifies -o file.o, it is replaced with file.lo
1702 case $libobj in
1703 *.[cCFSifmso] | \
1704 *.ada | *.adb | *.ads | *.asm | \
1705 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1706 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1707 func_xform "$libobj"
1708 libobj=$func_xform_result
1710 esac
1712 case $libobj in
1713 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1715 func_fatal_error "cannot determine name of library object from \`$libobj'"
1717 esac
1719 func_infer_tag $base_compile
1721 for arg in $later; do
1722 case $arg in
1723 -shared)
1724 test "$build_libtool_libs" != yes && \
1725 func_fatal_configuration "can not build a shared library"
1726 build_old_libs=no
1727 continue
1730 -static)
1731 build_libtool_libs=no
1732 build_old_libs=yes
1733 continue
1736 -prefer-pic)
1737 pic_mode=yes
1738 continue
1741 -prefer-non-pic)
1742 pic_mode=no
1743 continue
1745 esac
1746 done
1748 func_quote_for_eval "$libobj"
1749 test "X$libobj" != "X$func_quote_for_eval_result" \
1750 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1751 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1752 func_dirname_and_basename "$obj" "/" ""
1753 objname="$func_basename_result"
1754 xdir="$func_dirname_result"
1755 lobj=${xdir}$objdir/$objname
1757 test -z "$base_compile" && \
1758 func_fatal_help "you must specify a compilation command"
1760 # Delete any leftover library objects.
1761 if test "$build_old_libs" = yes; then
1762 removelist="$obj $lobj $libobj ${libobj}T"
1763 else
1764 removelist="$lobj $libobj ${libobj}T"
1767 # On Cygwin there's no "real" PIC flag so we must build both object types
1768 case $host_os in
1769 cygwin* | mingw* | pw32* | os2* | cegcc*)
1770 pic_mode=default
1772 esac
1773 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1774 # non-PIC code in shared libraries is not supported
1775 pic_mode=default
1778 # Calculate the filename of the output object if compiler does
1779 # not support -o with -c
1780 if test "$compiler_c_o" = no; then
1781 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1782 lockfile="$output_obj.lock"
1783 else
1784 output_obj=
1785 need_locks=no
1786 lockfile=
1789 # Lock this critical section if it is needed
1790 # We use this script file to make the link, it avoids creating a new file
1791 if test "$need_locks" = yes; then
1792 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1793 func_echo "Waiting for $lockfile to be removed"
1794 sleep 2
1795 done
1796 elif test "$need_locks" = warn; then
1797 if test -f "$lockfile"; then
1798 $ECHO "\
1799 *** ERROR, $lockfile exists and contains:
1800 `cat $lockfile 2>/dev/null`
1802 This indicates that another process is trying to use the same
1803 temporary object file, and libtool could not work around it because
1804 your compiler does not support \`-c' and \`-o' together. If you
1805 repeat this compilation, it may succeed, by chance, but you had better
1806 avoid parallel builds (make -j) in this platform, or get a better
1807 compiler."
1809 $opt_dry_run || $RM $removelist
1810 exit $EXIT_FAILURE
1812 removelist="$removelist $output_obj"
1813 $ECHO "$srcfile" > "$lockfile"
1816 $opt_dry_run || $RM $removelist
1817 removelist="$removelist $lockfile"
1818 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1820 if test -n "$fix_srcfile_path"; then
1821 eval srcfile=\"$fix_srcfile_path\"
1823 func_quote_for_eval "$srcfile"
1824 qsrcfile=$func_quote_for_eval_result
1826 # Only build a PIC object if we are building libtool libraries.
1827 if test "$build_libtool_libs" = yes; then
1828 # Without this assignment, base_compile gets emptied.
1829 fbsd_hideous_sh_bug=$base_compile
1831 if test "$pic_mode" != no; then
1832 command="$base_compile $qsrcfile $pic_flag"
1833 else
1834 # Don't build PIC code
1835 command="$base_compile $qsrcfile"
1838 func_mkdir_p "$xdir$objdir"
1840 if test -z "$output_obj"; then
1841 # Place PIC objects in $objdir
1842 command="$command -o $lobj"
1845 func_show_eval_locale "$command" \
1846 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1848 if test "$need_locks" = warn &&
1849 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1850 $ECHO "\
1851 *** ERROR, $lockfile contains:
1852 `cat $lockfile 2>/dev/null`
1854 but it should contain:
1855 $srcfile
1857 This indicates that another process is trying to use the same
1858 temporary object file, and libtool could not work around it because
1859 your compiler does not support \`-c' and \`-o' together. If you
1860 repeat this compilation, it may succeed, by chance, but you had better
1861 avoid parallel builds (make -j) in this platform, or get a better
1862 compiler."
1864 $opt_dry_run || $RM $removelist
1865 exit $EXIT_FAILURE
1868 # Just move the object if needed, then go on to compile the next one
1869 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1870 func_show_eval '$MV "$output_obj" "$lobj"' \
1871 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1874 # Allow error messages only from the first compilation.
1875 if test "$suppress_opt" = yes; then
1876 suppress_output=' >/dev/null 2>&1'
1880 # Only build a position-dependent object if we build old libraries.
1881 if test "$build_old_libs" = yes; then
1882 if test "$pic_mode" != yes; then
1883 # Don't build PIC code
1884 command="$base_compile $qsrcfile$pie_flag"
1885 else
1886 command="$base_compile $qsrcfile $pic_flag"
1888 if test "$compiler_c_o" = yes; then
1889 command="$command -o $obj"
1892 # Suppress compiler output if we already did a PIC compilation.
1893 command="$command$suppress_output"
1894 func_show_eval_locale "$command" \
1895 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1897 if test "$need_locks" = warn &&
1898 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1899 $ECHO "\
1900 *** ERROR, $lockfile contains:
1901 `cat $lockfile 2>/dev/null`
1903 but it should contain:
1904 $srcfile
1906 This indicates that another process is trying to use the same
1907 temporary object file, and libtool could not work around it because
1908 your compiler does not support \`-c' and \`-o' together. If you
1909 repeat this compilation, it may succeed, by chance, but you had better
1910 avoid parallel builds (make -j) in this platform, or get a better
1911 compiler."
1913 $opt_dry_run || $RM $removelist
1914 exit $EXIT_FAILURE
1917 # Just move the object if needed
1918 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1919 func_show_eval '$MV "$output_obj" "$obj"' \
1920 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1924 $opt_dry_run || {
1925 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1927 # Unlock the critical section if it was locked
1928 if test "$need_locks" != no; then
1929 removelist=$lockfile
1930 $RM "$lockfile"
1934 exit $EXIT_SUCCESS
1937 $opt_help || {
1938 test "$mode" = compile && func_mode_compile ${1+"$@"}
1941 func_mode_help ()
1943 # We need to display help for each of the modes.
1944 case $mode in
1946 # Generic help is extracted from the usage comments
1947 # at the start of this file.
1948 func_help
1951 clean)
1952 $ECHO \
1953 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1955 Remove files from the build directory.
1957 RM is the name of the program to use to delete files associated with each FILE
1958 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1959 to RM.
1961 If FILE is a libtool library, object or program, all the files associated
1962 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1965 compile)
1966 $ECHO \
1967 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1969 Compile a source file into a libtool library object.
1971 This mode accepts the following additional options:
1973 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1974 -no-suppress do not suppress compiler output for multiple passes
1975 -prefer-pic try to building PIC objects only
1976 -prefer-non-pic try to building non-PIC objects only
1977 -shared do not build a \`.o' file suitable for static linking
1978 -static only build a \`.o' file suitable for static linking
1980 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1981 from the given SOURCEFILE.
1983 The output file name is determined by removing the directory component from
1984 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1985 library object suffix, \`.lo'."
1988 execute)
1989 $ECHO \
1990 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1992 Automatically set library path, then run a program.
1994 This mode accepts the following additional options:
1996 -dlopen FILE add the directory containing FILE to the library path
1998 This mode sets the library path environment variable according to \`-dlopen'
1999 flags.
2001 If any of the ARGS are libtool executable wrappers, then they are translated
2002 into their corresponding uninstalled binary, and any of their required library
2003 directories are added to the library path.
2005 Then, COMMAND is executed, with ARGS as arguments."
2008 finish)
2009 $ECHO \
2010 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2012 Complete the installation of libtool libraries.
2014 Each LIBDIR is a directory that contains libtool libraries.
2016 The commands that this mode executes may require superuser privileges. Use
2017 the \`--dry-run' option if you just want to see what would be executed."
2020 install)
2021 $ECHO \
2022 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2024 Install executables or libraries.
2026 INSTALL-COMMAND is the installation command. The first component should be
2027 either the \`install' or \`cp' program.
2029 The following components of INSTALL-COMMAND are treated specially:
2031 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2033 The rest of the components are interpreted as arguments to that command (only
2034 BSD-compatible install options are recognized)."
2037 link)
2038 $ECHO \
2039 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2041 Link object files or libraries together to form another library, or to
2042 create an executable program.
2044 LINK-COMMAND is a command using the C compiler that you would use to create
2045 a program from several object files.
2047 The following components of LINK-COMMAND are treated specially:
2049 -all-static do not do any dynamic linking at all
2050 -avoid-version do not add a version suffix if possible
2051 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2052 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2053 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2054 -export-symbols SYMFILE
2055 try to export only the symbols listed in SYMFILE
2056 -export-symbols-regex REGEX
2057 try to export only the symbols matching REGEX
2058 -LLIBDIR search LIBDIR for required installed libraries
2059 -lNAME OUTPUT-FILE requires the installed library libNAME
2060 -module build a library that can dlopened
2061 -no-fast-install disable the fast-install mode
2062 -no-install link a not-installable executable
2063 -no-undefined declare that a library does not refer to external symbols
2064 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2065 -objectlist FILE Use a list of object files found in FILE to specify objects
2066 -precious-files-regex REGEX
2067 don't remove output files matching REGEX
2068 -release RELEASE specify package release information
2069 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2070 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2071 -shared only do dynamic linking of libtool libraries
2072 -shrext SUFFIX override the standard shared library file extension
2073 -static do not do any dynamic linking of uninstalled libtool libraries
2074 -static-libtool-libs
2075 do not do any dynamic linking of libtool libraries
2076 -version-info CURRENT[:REVISION[:AGE]]
2077 specify library version info [each variable defaults to 0]
2078 -weak LIBNAME declare that the target provides the LIBNAME interface
2080 All other options (arguments beginning with \`-') are ignored.
2082 Every other argument is treated as a filename. Files ending in \`.la' are
2083 treated as uninstalled libtool libraries, other files are standard or library
2084 object files.
2086 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2087 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2088 required, except when creating a convenience library.
2090 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2091 using \`ar' and \`ranlib', or on Windows using \`lib'.
2093 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2094 is created, otherwise an executable program is created."
2097 uninstall)
2098 $ECHO \
2099 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2101 Remove libraries from an installation directory.
2103 RM is the name of the program to use to delete files associated with each FILE
2104 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2105 to RM.
2107 If FILE is a libtool library, all the files associated with it are deleted.
2108 Otherwise, only FILE itself is deleted using RM."
2112 func_fatal_help "invalid operation mode \`$mode'"
2114 esac
2116 $ECHO
2117 $ECHO "Try \`$progname --help' for more information about other modes."
2119 exit $?
2122 # Now that we've collected a possible --mode arg, show help if necessary
2123 $opt_help && func_mode_help
2126 # func_mode_execute arg...
2127 func_mode_execute ()
2129 $opt_debug
2130 # The first argument is the command name.
2131 cmd="$nonopt"
2132 test -z "$cmd" && \
2133 func_fatal_help "you must specify a COMMAND"
2135 # Handle -dlopen flags immediately.
2136 for file in $execute_dlfiles; do
2137 test -f "$file" \
2138 || func_fatal_help "\`$file' is not a file"
2140 dir=
2141 case $file in
2142 *.la)
2143 # Check to see that this really is a libtool archive.
2144 func_lalib_unsafe_p "$file" \
2145 || func_fatal_help "\`$lib' is not a valid libtool archive"
2147 # Read the libtool library.
2148 dlname=
2149 library_names=
2150 func_source "$file"
2152 # Skip this library if it cannot be dlopened.
2153 if test -z "$dlname"; then
2154 # Warn if it was a shared library.
2155 test -n "$library_names" && \
2156 func_warning "\`$file' was not linked with \`-export-dynamic'"
2157 continue
2160 func_dirname "$file" "" "."
2161 dir="$func_dirname_result"
2163 if test -f "$dir/$objdir/$dlname"; then
2164 dir="$dir/$objdir"
2165 else
2166 if test ! -f "$dir/$dlname"; then
2167 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2172 *.lo)
2173 # Just add the directory containing the .lo file.
2174 func_dirname "$file" "" "."
2175 dir="$func_dirname_result"
2179 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2180 continue
2182 esac
2184 # Get the absolute pathname.
2185 absdir=`cd "$dir" && pwd`
2186 test -n "$absdir" && dir="$absdir"
2188 # Now add the directory to shlibpath_var.
2189 if eval "test -z \"\$$shlibpath_var\""; then
2190 eval "$shlibpath_var=\"\$dir\""
2191 else
2192 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2194 done
2196 # This variable tells wrapper scripts just to set shlibpath_var
2197 # rather than running their programs.
2198 libtool_execute_magic="$magic"
2200 # Check if any of the arguments is a wrapper script.
2201 args=
2202 for file
2204 case $file in
2205 -*) ;;
2207 # Do a test to see if this is really a libtool program.
2208 if func_ltwrapper_script_p "$file"; then
2209 func_source "$file"
2210 # Transform arg to wrapped name.
2211 file="$progdir/$program"
2212 elif func_ltwrapper_executable_p "$file"; then
2213 func_ltwrapper_scriptname "$file"
2214 func_source "$func_ltwrapper_scriptname_result"
2215 # Transform arg to wrapped name.
2216 file="$progdir/$program"
2219 esac
2220 # Quote arguments (to preserve shell metacharacters).
2221 func_quote_for_eval "$file"
2222 args="$args $func_quote_for_eval_result"
2223 done
2225 if test "X$opt_dry_run" = Xfalse; then
2226 if test -n "$shlibpath_var"; then
2227 # Export the shlibpath_var.
2228 eval "export $shlibpath_var"
2231 # Restore saved environment variables
2232 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2234 eval "if test \"\${save_$lt_var+set}\" = set; then
2235 $lt_var=\$save_$lt_var; export $lt_var
2236 else
2237 $lt_unset $lt_var
2239 done
2241 # Now prepare to actually exec the command.
2242 exec_cmd="\$cmd$args"
2243 else
2244 # Display what would be done.
2245 if test -n "$shlibpath_var"; then
2246 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2247 $ECHO "export $shlibpath_var"
2249 $ECHO "$cmd$args"
2250 exit $EXIT_SUCCESS
2254 test "$mode" = execute && func_mode_execute ${1+"$@"}
2257 # func_mode_finish arg...
2258 func_mode_finish ()
2260 $opt_debug
2261 libdirs="$nonopt"
2262 admincmds=
2264 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2265 for dir
2267 libdirs="$libdirs $dir"
2268 done
2270 for libdir in $libdirs; do
2271 if test -n "$finish_cmds"; then
2272 # Do each command in the finish commands.
2273 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2274 '"$cmd"'"'
2276 if test -n "$finish_eval"; then
2277 # Do the single finish_eval.
2278 eval cmds=\"$finish_eval\"
2279 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2280 $cmds"
2282 done
2285 # Exit here if they wanted silent mode.
2286 $opt_silent && exit $EXIT_SUCCESS
2288 $ECHO "X----------------------------------------------------------------------" | $Xsed
2289 $ECHO "Libraries have been installed in:"
2290 for libdir in $libdirs; do
2291 $ECHO " $libdir"
2292 done
2293 $ECHO
2294 $ECHO "If you ever happen to want to link against installed libraries"
2295 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2296 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2297 $ECHO "flag during linking and do at least one of the following:"
2298 if test -n "$shlibpath_var"; then
2299 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2300 $ECHO " during execution"
2302 if test -n "$runpath_var"; then
2303 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2304 $ECHO " during linking"
2306 if test -n "$hardcode_libdir_flag_spec"; then
2307 libdir=LIBDIR
2308 eval flag=\"$hardcode_libdir_flag_spec\"
2310 $ECHO " - use the \`$flag' linker flag"
2312 if test -n "$admincmds"; then
2313 $ECHO " - have your system administrator run these commands:$admincmds"
2315 if test -f /etc/ld.so.conf; then
2316 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2318 $ECHO
2320 $ECHO "See any operating system documentation about shared libraries for"
2321 case $host in
2322 solaris2.[6789]|solaris2.1[0-9])
2323 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2324 $ECHO "pages."
2327 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2329 esac
2330 $ECHO "X----------------------------------------------------------------------" | $Xsed
2331 exit $EXIT_SUCCESS
2334 test "$mode" = finish && func_mode_finish ${1+"$@"}
2337 # func_mode_install arg...
2338 func_mode_install ()
2340 $opt_debug
2341 # There may be an optional sh(1) argument at the beginning of
2342 # install_prog (especially on Windows NT).
2343 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2344 # Allow the use of GNU shtool's install command.
2345 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2346 # Aesthetically quote it.
2347 func_quote_for_eval "$nonopt"
2348 install_prog="$func_quote_for_eval_result "
2349 arg=$1
2350 shift
2351 else
2352 install_prog=
2353 arg=$nonopt
2356 # The real first argument should be the name of the installation program.
2357 # Aesthetically quote it.
2358 func_quote_for_eval "$arg"
2359 install_prog="$install_prog$func_quote_for_eval_result"
2361 # We need to accept at least all the BSD install flags.
2362 dest=
2363 files=
2364 opts=
2365 prev=
2366 install_type=
2367 isdir=no
2368 stripme=
2369 for arg
2371 if test -n "$dest"; then
2372 files="$files $dest"
2373 dest=$arg
2374 continue
2377 case $arg in
2378 -d) isdir=yes ;;
2380 case " $install_prog " in
2381 *[\\\ /]cp\ *) ;;
2382 *) prev=$arg ;;
2383 esac
2385 -g | -m | -o)
2386 prev=$arg
2389 stripme=" -s"
2390 continue
2395 # If the previous option needed an argument, then skip it.
2396 if test -n "$prev"; then
2397 prev=
2398 else
2399 dest=$arg
2400 continue
2403 esac
2405 # Aesthetically quote the argument.
2406 func_quote_for_eval "$arg"
2407 install_prog="$install_prog $func_quote_for_eval_result"
2408 done
2410 test -z "$install_prog" && \
2411 func_fatal_help "you must specify an install program"
2413 test -n "$prev" && \
2414 func_fatal_help "the \`$prev' option requires an argument"
2416 if test -z "$files"; then
2417 if test -z "$dest"; then
2418 func_fatal_help "no file or destination specified"
2419 else
2420 func_fatal_help "you must specify a destination"
2424 # Strip any trailing slash from the destination.
2425 func_stripname '' '/' "$dest"
2426 dest=$func_stripname_result
2428 # Check to see that the destination is a directory.
2429 test -d "$dest" && isdir=yes
2430 if test "$isdir" = yes; then
2431 destdir="$dest"
2432 destname=
2433 else
2434 func_dirname_and_basename "$dest" "" "."
2435 destdir="$func_dirname_result"
2436 destname="$func_basename_result"
2438 # Not a directory, so check to see that there is only one file specified.
2439 set dummy $files; shift
2440 test "$#" -gt 1 && \
2441 func_fatal_help "\`$dest' is not a directory"
2443 case $destdir in
2444 [\\/]* | [A-Za-z]:[\\/]*) ;;
2446 for file in $files; do
2447 case $file in
2448 *.lo) ;;
2450 func_fatal_help "\`$destdir' must be an absolute directory name"
2452 esac
2453 done
2455 esac
2457 # This variable tells wrapper scripts just to set variables rather
2458 # than running their programs.
2459 libtool_install_magic="$magic"
2461 staticlibs=
2462 future_libdirs=
2463 current_libdirs=
2464 for file in $files; do
2466 # Do each installation.
2467 case $file in
2468 *.$libext)
2469 # Do the static libraries later.
2470 staticlibs="$staticlibs $file"
2473 *.la)
2474 # Check to see that this really is a libtool archive.
2475 func_lalib_unsafe_p "$file" \
2476 || func_fatal_help "\`$file' is not a valid libtool archive"
2478 library_names=
2479 old_library=
2480 relink_command=
2481 func_source "$file"
2483 # Add the libdir to current_libdirs if it is the destination.
2484 if test "X$destdir" = "X$libdir"; then
2485 case "$current_libdirs " in
2486 *" $libdir "*) ;;
2487 *) current_libdirs="$current_libdirs $libdir" ;;
2488 esac
2489 else
2490 # Note the libdir as a future libdir.
2491 case "$future_libdirs " in
2492 *" $libdir "*) ;;
2493 *) future_libdirs="$future_libdirs $libdir" ;;
2494 esac
2497 func_dirname "$file" "/" ""
2498 dir="$func_dirname_result"
2499 dir="$dir$objdir"
2501 if test -n "$relink_command"; then
2502 # Determine the prefix the user has applied to our future dir.
2503 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2505 # Don't allow the user to place us outside of our expected
2506 # location b/c this prevents finding dependent libraries that
2507 # are installed to the same prefix.
2508 # At present, this check doesn't affect windows .dll's that
2509 # are installed into $libdir/../bin (currently, that works fine)
2510 # but it's something to keep an eye on.
2511 test "$inst_prefix_dir" = "$destdir" && \
2512 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2514 if test -n "$inst_prefix_dir"; then
2515 # Stick the inst_prefix_dir data into the link command.
2516 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2517 else
2518 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2521 func_warning "relinking \`$file'"
2522 func_show_eval "$relink_command" \
2523 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2526 # See the names of the shared library.
2527 set dummy $library_names; shift
2528 if test -n "$1"; then
2529 realname="$1"
2530 shift
2532 srcname="$realname"
2533 test -n "$relink_command" && srcname="$realname"T
2535 # Install the shared library and build the symlinks.
2536 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2537 'exit $?'
2538 tstripme="$stripme"
2539 case $host_os in
2540 cygwin* | mingw* | pw32* | cegcc*)
2541 case $realname in
2542 *.dll.a)
2543 tstripme=""
2545 esac
2547 esac
2548 if test -n "$tstripme" && test -n "$striplib"; then
2549 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2552 if test "$#" -gt 0; then
2553 # Delete the old symlinks, and create new ones.
2554 # Try `ln -sf' first, because the `ln' binary might depend on
2555 # the symlink we replace! Solaris /bin/ln does not understand -f,
2556 # so we also need to try rm && ln -s.
2557 for linkname
2559 test "$linkname" != "$realname" \
2560 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2561 done
2564 # Do each command in the postinstall commands.
2565 lib="$destdir/$realname"
2566 func_execute_cmds "$postinstall_cmds" 'exit $?'
2569 # Install the pseudo-library for information purposes.
2570 func_basename "$file"
2571 name="$func_basename_result"
2572 instname="$dir/$name"i
2573 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2575 # Maybe install the static library, too.
2576 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2579 *.lo)
2580 # Install (i.e. copy) a libtool object.
2582 # Figure out destination file name, if it wasn't already specified.
2583 if test -n "$destname"; then
2584 destfile="$destdir/$destname"
2585 else
2586 func_basename "$file"
2587 destfile="$func_basename_result"
2588 destfile="$destdir/$destfile"
2591 # Deduce the name of the destination old-style object file.
2592 case $destfile in
2593 *.lo)
2594 func_lo2o "$destfile"
2595 staticdest=$func_lo2o_result
2597 *.$objext)
2598 staticdest="$destfile"
2599 destfile=
2602 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2604 esac
2606 # Install the libtool object if requested.
2607 test -n "$destfile" && \
2608 func_show_eval "$install_prog $file $destfile" 'exit $?'
2610 # Install the old object if enabled.
2611 if test "$build_old_libs" = yes; then
2612 # Deduce the name of the old-style object file.
2613 func_lo2o "$file"
2614 staticobj=$func_lo2o_result
2615 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2617 exit $EXIT_SUCCESS
2621 # Figure out destination file name, if it wasn't already specified.
2622 if test -n "$destname"; then
2623 destfile="$destdir/$destname"
2624 else
2625 func_basename "$file"
2626 destfile="$func_basename_result"
2627 destfile="$destdir/$destfile"
2630 # If the file is missing, and there is a .exe on the end, strip it
2631 # because it is most likely a libtool script we actually want to
2632 # install
2633 stripped_ext=""
2634 case $file in
2635 *.exe)
2636 if test ! -f "$file"; then
2637 func_stripname '' '.exe' "$file"
2638 file=$func_stripname_result
2639 stripped_ext=".exe"
2642 esac
2644 # Do a test to see if this is really a libtool program.
2645 case $host in
2646 *cygwin* | *mingw*)
2647 if func_ltwrapper_executable_p "$file"; then
2648 func_ltwrapper_scriptname "$file"
2649 wrapper=$func_ltwrapper_scriptname_result
2650 else
2651 func_stripname '' '.exe' "$file"
2652 wrapper=$func_stripname_result
2656 wrapper=$file
2658 esac
2659 if func_ltwrapper_script_p "$wrapper"; then
2660 notinst_deplibs=
2661 relink_command=
2663 func_source "$wrapper"
2665 # Check the variables that should have been set.
2666 test -z "$generated_by_libtool_version" && \
2667 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2669 finalize=yes
2670 for lib in $notinst_deplibs; do
2671 # Check to see that each library is installed.
2672 libdir=
2673 if test -f "$lib"; then
2674 func_source "$lib"
2676 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2677 if test -n "$libdir" && test ! -f "$libfile"; then
2678 func_warning "\`$lib' has not been installed in \`$libdir'"
2679 finalize=no
2681 done
2683 relink_command=
2684 func_source "$wrapper"
2686 outputname=
2687 if test "$fast_install" = no && test -n "$relink_command"; then
2688 $opt_dry_run || {
2689 if test "$finalize" = yes; then
2690 tmpdir=`func_mktempdir`
2691 func_basename "$file$stripped_ext"
2692 file="$func_basename_result"
2693 outputname="$tmpdir/$file"
2694 # Replace the output file specification.
2695 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2697 $opt_silent || {
2698 func_quote_for_expand "$relink_command"
2699 eval "func_echo $func_quote_for_expand_result"
2701 if eval "$relink_command"; then :
2702 else
2703 func_error "error: relink \`$file' with the above command before installing it"
2704 $opt_dry_run || ${RM}r "$tmpdir"
2705 continue
2707 file="$outputname"
2708 else
2709 func_warning "cannot relink \`$file'"
2712 else
2713 # Install the binary that we compiled earlier.
2714 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2718 # remove .exe since cygwin /usr/bin/install will append another
2719 # one anyway
2720 case $install_prog,$host in
2721 */usr/bin/install*,*cygwin*)
2722 case $file:$destfile in
2723 *.exe:*.exe)
2724 # this is ok
2726 *.exe:*)
2727 destfile=$destfile.exe
2729 *:*.exe)
2730 func_stripname '' '.exe' "$destfile"
2731 destfile=$func_stripname_result
2733 esac
2735 esac
2736 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2737 $opt_dry_run || if test -n "$outputname"; then
2738 ${RM}r "$tmpdir"
2741 esac
2742 done
2744 for file in $staticlibs; do
2745 func_basename "$file"
2746 name="$func_basename_result"
2748 # Set up the ranlib parameters.
2749 oldlib="$destdir/$name"
2751 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2753 if test -n "$stripme" && test -n "$old_striplib"; then
2754 func_show_eval "$old_striplib $oldlib" 'exit $?'
2757 # Do each command in the postinstall commands.
2758 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2759 done
2761 test -n "$future_libdirs" && \
2762 func_warning "remember to run \`$progname --finish$future_libdirs'"
2764 if test -n "$current_libdirs"; then
2765 # Maybe just do a dry run.
2766 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2767 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2768 else
2769 exit $EXIT_SUCCESS
2773 test "$mode" = install && func_mode_install ${1+"$@"}
2776 # func_generate_dlsyms outputname originator pic_p
2777 # Extract symbols from dlprefiles and create ${outputname}S.o with
2778 # a dlpreopen symbol table.
2779 func_generate_dlsyms ()
2781 $opt_debug
2782 my_outputname="$1"
2783 my_originator="$2"
2784 my_pic_p="${3-no}"
2785 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2786 my_dlsyms=
2788 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2789 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2790 my_dlsyms="${my_outputname}S.c"
2791 else
2792 func_error "not configured to extract global symbols from dlpreopened files"
2796 if test -n "$my_dlsyms"; then
2797 case $my_dlsyms in
2798 "") ;;
2799 *.c)
2800 # Discover the nlist of each of the dlfiles.
2801 nlist="$output_objdir/${my_outputname}.nm"
2803 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2805 # Parse the name list into a source file.
2806 func_verbose "creating $output_objdir/$my_dlsyms"
2808 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2809 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2810 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2812 #ifdef __cplusplus
2813 extern \"C\" {
2814 #endif
2816 /* External symbol declarations for the compiler. */\
2819 if test "$dlself" = yes; then
2820 func_verbose "generating symbol list for \`$output'"
2822 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2824 # Add our own program objects to the symbol list.
2825 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2826 for progfile in $progfiles; do
2827 func_verbose "extracting global C symbols from \`$progfile'"
2828 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2829 done
2831 if test -n "$exclude_expsyms"; then
2832 $opt_dry_run || {
2833 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2834 eval '$MV "$nlist"T "$nlist"'
2838 if test -n "$export_symbols_regex"; then
2839 $opt_dry_run || {
2840 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2841 eval '$MV "$nlist"T "$nlist"'
2845 # Prepare the list of exported symbols
2846 if test -z "$export_symbols"; then
2847 export_symbols="$output_objdir/$outputname.exp"
2848 $opt_dry_run || {
2849 $RM $export_symbols
2850 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2851 case $host in
2852 *cygwin* | *mingw* | *cegcc* )
2853 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2854 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2856 esac
2858 else
2859 $opt_dry_run || {
2860 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2861 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2862 eval '$MV "$nlist"T "$nlist"'
2863 case $host in
2864 *cygwin | *mingw* | *cegcc* )
2865 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2866 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2868 esac
2873 for dlprefile in $dlprefiles; do
2874 func_verbose "extracting global C symbols from \`$dlprefile'"
2875 func_basename "$dlprefile"
2876 name="$func_basename_result"
2877 $opt_dry_run || {
2878 eval '$ECHO ": $name " >> "$nlist"'
2879 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2881 done
2883 $opt_dry_run || {
2884 # Make sure we have at least an empty file.
2885 test -f "$nlist" || : > "$nlist"
2887 if test -n "$exclude_expsyms"; then
2888 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2889 $MV "$nlist"T "$nlist"
2892 # Try sorting and uniquifying the output.
2893 if $GREP -v "^: " < "$nlist" |
2894 if sort -k 3 </dev/null >/dev/null 2>&1; then
2895 sort -k 3
2896 else
2897 sort +2
2898 fi |
2899 uniq > "$nlist"S; then
2901 else
2902 $GREP -v "^: " < "$nlist" > "$nlist"S
2905 if test -f "$nlist"S; then
2906 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2907 else
2908 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2911 $ECHO >> "$output_objdir/$my_dlsyms" "\
2913 /* The mapping between symbol names and symbols. */
2914 typedef struct {
2915 const char *name;
2916 void *address;
2917 } lt_dlsymlist;
2919 case $host in
2920 *cygwin* | *mingw* | *cegcc* )
2921 $ECHO >> "$output_objdir/$my_dlsyms" "\
2922 /* DATA imports from DLLs on WIN32 con't be const, because
2923 runtime relocations are performed -- see ld's documentation
2924 on pseudo-relocs. */"
2925 lt_dlsym_const= ;;
2926 *osf5*)
2927 echo >> "$output_objdir/$my_dlsyms" "\
2928 /* This system does not cope well with relocations in const data */"
2929 lt_dlsym_const= ;;
2931 lt_dlsym_const=const ;;
2932 esac
2934 $ECHO >> "$output_objdir/$my_dlsyms" "\
2935 extern $lt_dlsym_const lt_dlsymlist
2936 lt_${my_prefix}_LTX_preloaded_symbols[];
2937 $lt_dlsym_const lt_dlsymlist
2938 lt_${my_prefix}_LTX_preloaded_symbols[] =
2940 { \"$my_originator\", (void *) 0 },"
2942 case $need_lib_prefix in
2944 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2947 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2949 esac
2950 $ECHO >> "$output_objdir/$my_dlsyms" "\
2951 {0, (void *) 0}
2954 /* This works around a problem in FreeBSD linker */
2955 #ifdef FREEBSD_WORKAROUND
2956 static const void *lt_preloaded_setup() {
2957 return lt_${my_prefix}_LTX_preloaded_symbols;
2959 #endif
2961 #ifdef __cplusplus
2963 #endif\
2965 } # !$opt_dry_run
2967 pic_flag_for_symtable=
2968 case "$compile_command " in
2969 *" -static "*) ;;
2971 case $host in
2972 # compiling the symbol table file with pic_flag works around
2973 # a FreeBSD bug that causes programs to crash when -lm is
2974 # linked before any other PIC object. But we must not use
2975 # pic_flag when linking with -static. The problem exists in
2976 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2977 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2978 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2979 *-*-hpux*)
2980 pic_flag_for_symtable=" $pic_flag" ;;
2982 if test "X$my_pic_p" != Xno; then
2983 pic_flag_for_symtable=" $pic_flag"
2986 esac
2988 esac
2989 symtab_cflags=
2990 for arg in $LTCFLAGS; do
2991 case $arg in
2992 -pie | -fpie | -fPIE) ;;
2993 *) symtab_cflags="$symtab_cflags $arg" ;;
2994 esac
2995 done
2997 # Now compile the dynamic symbol file.
2998 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3000 # Clean up the generated files.
3001 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3003 # Transform the symbol file into the correct name.
3004 symfileobj="$output_objdir/${my_outputname}S.$objext"
3005 case $host in
3006 *cygwin* | *mingw* | *cegcc* )
3007 if test -f "$output_objdir/$my_outputname.def"; then
3008 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3009 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3010 else
3011 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3012 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3016 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3017 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
3019 esac
3022 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3024 esac
3025 else
3026 # We keep going just in case the user didn't refer to
3027 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3028 # really was required.
3030 # Nullify the symbol file.
3031 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3032 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3036 # func_win32_libid arg
3037 # return the library type of file 'arg'
3039 # Need a lot of goo to handle *both* DLLs and import libs
3040 # Has to be a shell function in order to 'eat' the argument
3041 # that is supplied when $file_magic_command is called.
3042 func_win32_libid ()
3044 $opt_debug
3045 win32_libid_type="unknown"
3046 win32_fileres=`file -L $1 2>/dev/null`
3047 case $win32_fileres in
3048 *ar\ archive\ import\ library*) # definitely import
3049 win32_libid_type="x86 archive import"
3051 *ar\ archive*) # could be an import, or static
3052 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3053 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
3054 win32_nmres=`eval $NM -f posix -A $1 |
3055 $SED -n -e '
3056 1,100{
3057 / I /{
3058 s,.*,import,
3063 case $win32_nmres in
3064 import*) win32_libid_type="x86 archive import";;
3065 *) win32_libid_type="x86 archive static";;
3066 esac
3069 *DLL*)
3070 win32_libid_type="x86 DLL"
3072 *executable*) # but shell scripts are "executable" too...
3073 case $win32_fileres in
3074 *MS\ Windows\ PE\ Intel*)
3075 win32_libid_type="x86 DLL"
3077 esac
3079 esac
3080 $ECHO "$win32_libid_type"
3085 # func_extract_an_archive dir oldlib
3086 func_extract_an_archive ()
3088 $opt_debug
3089 f_ex_an_ar_dir="$1"; shift
3090 f_ex_an_ar_oldlib="$1"
3091 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
3092 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3094 else
3095 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3100 # func_extract_archives gentop oldlib ...
3101 func_extract_archives ()
3103 $opt_debug
3104 my_gentop="$1"; shift
3105 my_oldlibs=${1+"$@"}
3106 my_oldobjs=""
3107 my_xlib=""
3108 my_xabs=""
3109 my_xdir=""
3111 for my_xlib in $my_oldlibs; do
3112 # Extract the objects.
3113 case $my_xlib in
3114 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3115 *) my_xabs=`pwd`"/$my_xlib" ;;
3116 esac
3117 func_basename "$my_xlib"
3118 my_xlib="$func_basename_result"
3119 my_xlib_u=$my_xlib
3120 while :; do
3121 case " $extracted_archives " in
3122 *" $my_xlib_u "*)
3123 func_arith $extracted_serial + 1
3124 extracted_serial=$func_arith_result
3125 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3126 *) break ;;
3127 esac
3128 done
3129 extracted_archives="$extracted_archives $my_xlib_u"
3130 my_xdir="$my_gentop/$my_xlib_u"
3132 func_mkdir_p "$my_xdir"
3134 case $host in
3135 *-darwin*)
3136 func_verbose "Extracting $my_xabs"
3137 # Do not bother doing anything if just a dry run
3138 $opt_dry_run || {
3139 darwin_orig_dir=`pwd`
3140 cd $my_xdir || exit $?
3141 darwin_archive=$my_xabs
3142 darwin_curdir=`pwd`
3143 darwin_base_archive=`basename "$darwin_archive"`
3144 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3145 if test -n "$darwin_arches"; then
3146 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3147 darwin_arch=
3148 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3149 for darwin_arch in $darwin_arches ; do
3150 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3151 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3152 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3153 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3154 cd "$darwin_curdir"
3155 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3156 done # $darwin_arches
3157 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3158 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3159 darwin_file=
3160 darwin_files=
3161 for darwin_file in $darwin_filelist; do
3162 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
3163 $LIPO -create -output "$darwin_file" $darwin_files
3164 done # $darwin_filelist
3165 $RM -rf unfat-$$
3166 cd "$darwin_orig_dir"
3167 else
3168 cd $darwin_orig_dir
3169 func_extract_an_archive "$my_xdir" "$my_xabs"
3170 fi # $darwin_arches
3171 } # !$opt_dry_run
3174 func_extract_an_archive "$my_xdir" "$my_xabs"
3176 esac
3177 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3178 done
3180 func_extract_archives_result="$my_oldobjs"
3185 # func_emit_wrapper_part1 [arg=no]
3187 # Emit the first part of a libtool wrapper script on stdout.
3188 # For more information, see the description associated with
3189 # func_emit_wrapper(), below.
3190 func_emit_wrapper_part1 ()
3192 func_emit_wrapper_part1_arg1=no
3193 if test -n "$1" ; then
3194 func_emit_wrapper_part1_arg1=$1
3197 $ECHO "\
3198 #! $SHELL
3200 # $output - temporary wrapper script for $objdir/$outputname
3201 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3203 # The $output program cannot be directly executed until all the libtool
3204 # libraries that it depends on are installed.
3206 # This wrapper script should never be moved out of the build directory.
3207 # If it is, it will not operate correctly.
3209 # Sed substitution that helps us do robust quoting. It backslashifies
3210 # metacharacters that are still active within double-quoted strings.
3211 Xsed='${SED} -e 1s/^X//'
3212 sed_quote_subst='$sed_quote_subst'
3214 # Be Bourne compatible
3215 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3216 emulate sh
3217 NULLCMD=:
3218 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3219 # is contrary to our usage. Disable this feature.
3220 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3221 setopt NO_GLOB_SUBST
3222 else
3223 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3225 BIN_SH=xpg4; export BIN_SH # for Tru64
3226 DUALCASE=1; export DUALCASE # for MKS sh
3228 # The HP-UX ksh and POSIX shell print the target directory to stdout
3229 # if CDPATH is set.
3230 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3232 relink_command=\"$relink_command\"
3234 # This environment variable determines our operation mode.
3235 if test \"\$libtool_install_magic\" = \"$magic\"; then
3236 # install mode needs the following variables:
3237 generated_by_libtool_version='$macro_version'
3238 notinst_deplibs='$notinst_deplibs'
3239 else
3240 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3241 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3242 ECHO=\"$qecho\"
3243 file=\"\$0\"
3244 # Make sure echo works.
3245 if test \"X\$1\" = X--no-reexec; then
3246 # Discard the --no-reexec flag, and continue.
3247 shift
3248 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
3249 # Yippee, \$ECHO works!
3251 else
3252 # Restart under the correct shell, and then maybe \$ECHO will work.
3253 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3257 $ECHO "\
3259 # Find the directory that this script lives in.
3260 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3261 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3263 # Follow symbolic links until we get to the real thisdir.
3264 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3265 while test -n \"\$file\"; do
3266 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3268 # If there was a directory component, then change thisdir.
3269 if test \"x\$destdir\" != \"x\$file\"; then
3270 case \"\$destdir\" in
3271 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3272 *) thisdir=\"\$thisdir/\$destdir\" ;;
3273 esac
3276 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3277 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3278 done
3281 # end: func_emit_wrapper_part1
3283 # func_emit_wrapper_part2 [arg=no]
3285 # Emit the second part of a libtool wrapper script on stdout.
3286 # For more information, see the description associated with
3287 # func_emit_wrapper(), below.
3288 func_emit_wrapper_part2 ()
3290 func_emit_wrapper_part2_arg1=no
3291 if test -n "$1" ; then
3292 func_emit_wrapper_part2_arg1=$1
3295 $ECHO "\
3297 # Usually 'no', except on cygwin/mingw when embedded into
3298 # the cwrapper.
3299 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
3300 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3301 # special case for '.'
3302 if test \"\$thisdir\" = \".\"; then
3303 thisdir=\`pwd\`
3305 # remove .libs from thisdir
3306 case \"\$thisdir\" in
3307 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
3308 $objdir ) thisdir=. ;;
3309 esac
3312 # Try to get the absolute directory name.
3313 absdir=\`cd \"\$thisdir\" && pwd\`
3314 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3317 if test "$fast_install" = yes; then
3318 $ECHO "\
3319 program=lt-'$outputname'$exeext
3320 progdir=\"\$thisdir/$objdir\"
3322 if test ! -f \"\$progdir/\$program\" ||
3323 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3324 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3326 file=\"\$\$-\$program\"
3328 if test ! -d \"\$progdir\"; then
3329 $MKDIR \"\$progdir\"
3330 else
3331 $RM \"\$progdir/\$file\"
3334 $ECHO "\
3336 # relink executable if necessary
3337 if test -n \"\$relink_command\"; then
3338 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3339 else
3340 $ECHO \"\$relink_command_output\" >&2
3341 $RM \"\$progdir/\$file\"
3342 exit 1
3346 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3347 { $RM \"\$progdir/\$program\";
3348 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3349 $RM \"\$progdir/\$file\"
3351 else
3352 $ECHO "\
3353 program='$outputname'
3354 progdir=\"\$thisdir/$objdir\"
3358 $ECHO "\
3360 if test -f \"\$progdir/\$program\"; then"
3362 # Export our shlibpath_var if we have one.
3363 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3364 $ECHO "\
3365 # Add our own library path to $shlibpath_var
3366 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3368 # Some systems cannot cope with colon-terminated $shlibpath_var
3369 # The second colon is a workaround for a bug in BeOS R4 sed
3370 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3372 export $shlibpath_var
3376 # fixup the dll searchpath if we need to.
3377 if test -n "$dllsearchpath"; then
3378 $ECHO "\
3379 # Add the dll search path components to the executable PATH
3380 PATH=$dllsearchpath:\$PATH
3384 $ECHO "\
3385 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3386 # Run the actual program with our arguments.
3388 case $host in
3389 # Backslashes separate directories on plain windows
3390 *-*-mingw | *-*-os2* | *-cegcc*)
3391 $ECHO "\
3392 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3397 $ECHO "\
3398 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3401 esac
3402 $ECHO "\
3403 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3404 exit 1
3406 else
3407 # The program doesn't exist.
3408 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3409 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3410 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3411 exit 1
3416 # end: func_emit_wrapper_part2
3419 # func_emit_wrapper [arg=no]
3421 # Emit a libtool wrapper script on stdout.
3422 # Don't directly open a file because we may want to
3423 # incorporate the script contents within a cygwin/mingw
3424 # wrapper executable. Must ONLY be called from within
3425 # func_mode_link because it depends on a number of variables
3426 # set therein.
3428 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3429 # variable will take. If 'yes', then the emitted script
3430 # will assume that the directory in which it is stored is
3431 # the $objdir directory. This is a cygwin/mingw-specific
3432 # behavior.
3433 func_emit_wrapper ()
3435 func_emit_wrapper_arg1=no
3436 if test -n "$1" ; then
3437 func_emit_wrapper_arg1=$1
3440 # split this up so that func_emit_cwrapperexe_src
3441 # can call each part independently.
3442 func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
3443 func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
3447 # func_to_host_path arg
3449 # Convert paths to host format when used with build tools.
3450 # Intended for use with "native" mingw (where libtool itself
3451 # is running under the msys shell), or in the following cross-
3452 # build environments:
3453 # $build $host
3454 # mingw (msys) mingw [e.g. native]
3455 # cygwin mingw
3456 # *nix + wine mingw
3457 # where wine is equipped with the `winepath' executable.
3458 # In the native mingw case, the (msys) shell automatically
3459 # converts paths for any non-msys applications it launches,
3460 # but that facility isn't available from inside the cwrapper.
3461 # Similar accommodations are necessary for $host mingw and
3462 # $build cygwin. Calling this function does no harm for other
3463 # $host/$build combinations not listed above.
3465 # ARG is the path (on $build) that should be converted to
3466 # the proper representation for $host. The result is stored
3467 # in $func_to_host_path_result.
3468 func_to_host_path ()
3470 func_to_host_path_result="$1"
3471 if test -n "$1" ; then
3472 case $host in
3473 *mingw* )
3474 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3475 case $build in
3476 *mingw* ) # actually, msys
3477 # awkward: cmd appends spaces to result
3478 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3479 func_to_host_path_tmp1=`( cmd //c echo "$1" |\
3480 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3481 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3482 $SED -e "$lt_sed_naive_backslashify"`
3484 *cygwin* )
3485 func_to_host_path_tmp1=`cygpath -w "$1"`
3486 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3487 $SED -e "$lt_sed_naive_backslashify"`
3490 # Unfortunately, winepath does not exit with a non-zero
3491 # error code, so we are forced to check the contents of
3492 # stdout. On the other hand, if the command is not
3493 # found, the shell will set an exit code of 127 and print
3494 # *an error message* to stdout. So we must check for both
3495 # error code of zero AND non-empty stdout, which explains
3496 # the odd construction:
3497 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3498 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3499 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3500 $SED -e "$lt_sed_naive_backslashify"`
3501 else
3502 # Allow warning below.
3503 func_to_host_path_result=""
3506 esac
3507 if test -z "$func_to_host_path_result" ; then
3508 func_error "Could not determine host path corresponding to"
3509 func_error " '$1'"
3510 func_error "Continuing, but uninstalled executables may not work."
3511 # Fallback:
3512 func_to_host_path_result="$1"
3515 esac
3518 # end: func_to_host_path
3520 # func_to_host_pathlist arg
3522 # Convert pathlists to host format when used with build tools.
3523 # See func_to_host_path(), above. This function supports the
3524 # following $build/$host combinations (but does no harm for
3525 # combinations not listed here):
3526 # $build $host
3527 # mingw (msys) mingw [e.g. native]
3528 # cygwin mingw
3529 # *nix + wine mingw
3531 # Path separators are also converted from $build format to
3532 # $host format. If ARG begins or ends with a path separator
3533 # character, it is preserved (but converted to $host format)
3534 # on output.
3536 # ARG is a pathlist (on $build) that should be converted to
3537 # the proper representation on $host. The result is stored
3538 # in $func_to_host_pathlist_result.
3539 func_to_host_pathlist ()
3541 func_to_host_pathlist_result="$1"
3542 if test -n "$1" ; then
3543 case $host in
3544 *mingw* )
3545 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3546 # Remove leading and trailing path separator characters from
3547 # ARG. msys behavior is inconsistent here, cygpath turns them
3548 # into '.;' and ';.', and winepath ignores them completely.
3549 func_to_host_pathlist_tmp2="$1"
3550 # Once set for this call, this variable should not be
3551 # reassigned. It is used in tha fallback case.
3552 func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
3553 $SED -e 's|^:*||' -e 's|:*$||'`
3554 case $build in
3555 *mingw* ) # Actually, msys.
3556 # Awkward: cmd appends spaces to result.
3557 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3558 func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
3559 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3560 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3561 $SED -e "$lt_sed_naive_backslashify"`
3563 *cygwin* )
3564 func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
3565 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3566 $SED -e "$lt_sed_naive_backslashify"`
3569 # unfortunately, winepath doesn't convert pathlists
3570 func_to_host_pathlist_result=""
3571 func_to_host_pathlist_oldIFS=$IFS
3572 IFS=:
3573 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3574 IFS=$func_to_host_pathlist_oldIFS
3575 if test -n "$func_to_host_pathlist_f" ; then
3576 func_to_host_path "$func_to_host_pathlist_f"
3577 if test -n "$func_to_host_path_result" ; then
3578 if test -z "$func_to_host_pathlist_result" ; then
3579 func_to_host_pathlist_result="$func_to_host_path_result"
3580 else
3581 func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
3585 IFS=:
3586 done
3587 IFS=$func_to_host_pathlist_oldIFS
3589 esac
3590 if test -z "$func_to_host_pathlist_result" ; then
3591 func_error "Could not determine the host path(s) corresponding to"
3592 func_error " '$1'"
3593 func_error "Continuing, but uninstalled executables may not work."
3594 # Fallback. This may break if $1 contains DOS-style drive
3595 # specifications. The fix is not to complicate the expression
3596 # below, but for the user to provide a working wine installation
3597 # with winepath so that path translation in the cross-to-mingw
3598 # case works properly.
3599 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3600 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3601 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3603 # Now, add the leading and trailing path separators back
3604 case "$1" in
3605 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3607 esac
3608 case "$1" in
3609 *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
3611 esac
3613 esac
3616 # end: func_to_host_pathlist
3618 # func_emit_cwrapperexe_src
3619 # emit the source code for a wrapper executable on stdout
3620 # Must ONLY be called from within func_mode_link because
3621 # it depends on a number of variable set therein.
3622 func_emit_cwrapperexe_src ()
3624 cat <<EOF
3626 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3627 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3629 The $output program cannot be directly executed until all the libtool
3630 libraries that it depends on are installed.
3632 This wrapper executable should never be moved out of the build directory.
3633 If it is, it will not operate correctly.
3635 Currently, it simply execs the wrapper *script* "$SHELL $output",
3636 but could eventually absorb all of the scripts functionality and
3637 exec $objdir/$outputname directly.
3640 cat <<"EOF"
3641 #include <stdio.h>
3642 #include <stdlib.h>
3643 #ifdef _MSC_VER
3644 # include <direct.h>
3645 # include <process.h>
3646 # include <io.h>
3647 # define setmode _setmode
3648 #else
3649 # include <unistd.h>
3650 # include <stdint.h>
3651 # ifdef __CYGWIN__
3652 # include <io.h>
3653 # define HAVE_SETENV
3654 # ifdef __STRICT_ANSI__
3655 char *realpath (const char *, char *);
3656 int putenv (char *);
3657 int setenv (const char *, const char *, int);
3658 # endif
3659 # endif
3660 #endif
3661 #include <malloc.h>
3662 #include <stdarg.h>
3663 #include <assert.h>
3664 #include <string.h>
3665 #include <ctype.h>
3666 #include <errno.h>
3667 #include <fcntl.h>
3668 #include <sys/stat.h>
3670 #if defined(PATH_MAX)
3671 # define LT_PATHMAX PATH_MAX
3672 #elif defined(MAXPATHLEN)
3673 # define LT_PATHMAX MAXPATHLEN
3674 #else
3675 # define LT_PATHMAX 1024
3676 #endif
3678 #ifndef S_IXOTH
3679 # define S_IXOTH 0
3680 #endif
3681 #ifndef S_IXGRP
3682 # define S_IXGRP 0
3683 #endif
3685 #ifdef _MSC_VER
3686 # define S_IXUSR _S_IEXEC
3687 # define stat _stat
3688 # ifndef _INTPTR_T_DEFINED
3689 # define intptr_t int
3690 # endif
3691 #endif
3693 #ifndef DIR_SEPARATOR
3694 # define DIR_SEPARATOR '/'
3695 # define PATH_SEPARATOR ':'
3696 #endif
3698 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3699 defined (__OS2__)
3700 # define HAVE_DOS_BASED_FILE_SYSTEM
3701 # define FOPEN_WB "wb"
3702 # ifndef DIR_SEPARATOR_2
3703 # define DIR_SEPARATOR_2 '\\'
3704 # endif
3705 # ifndef PATH_SEPARATOR_2
3706 # define PATH_SEPARATOR_2 ';'
3707 # endif
3708 #endif
3710 #ifndef DIR_SEPARATOR_2
3711 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3712 #else /* DIR_SEPARATOR_2 */
3713 # define IS_DIR_SEPARATOR(ch) \
3714 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3715 #endif /* DIR_SEPARATOR_2 */
3717 #ifndef PATH_SEPARATOR_2
3718 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3719 #else /* PATH_SEPARATOR_2 */
3720 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3721 #endif /* PATH_SEPARATOR_2 */
3723 #ifdef __CYGWIN__
3724 # define FOPEN_WB "wb"
3725 #endif
3727 #ifndef FOPEN_WB
3728 # define FOPEN_WB "w"
3729 #endif
3730 #ifndef _O_BINARY
3731 # define _O_BINARY 0
3732 #endif
3734 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3735 #define XFREE(stale) do { \
3736 if (stale) { free ((void *) stale); stale = 0; } \
3737 } while (0)
3739 #undef LTWRAPPER_DEBUGPRINTF
3740 #if defined DEBUGWRAPPER
3741 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3742 static void
3743 ltwrapper_debugprintf (const char *fmt, ...)
3745 va_list args;
3746 va_start (args, fmt);
3747 (void) vfprintf (stderr, fmt, args);
3748 va_end (args);
3750 #else
3751 # define LTWRAPPER_DEBUGPRINTF(args)
3752 #endif
3754 const char *program_name = NULL;
3756 void *xmalloc (size_t num);
3757 char *xstrdup (const char *string);
3758 const char *base_name (const char *name);
3759 char *find_executable (const char *wrapper);
3760 char *chase_symlinks (const char *pathspec);
3761 int make_executable (const char *path);
3762 int check_executable (const char *path);
3763 char *strendzap (char *str, const char *pat);
3764 void lt_fatal (const char *message, ...);
3765 void lt_setenv (const char *name, const char *value);
3766 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3767 void lt_opt_process_env_set (const char *arg);
3768 void lt_opt_process_env_prepend (const char *arg);
3769 void lt_opt_process_env_append (const char *arg);
3770 int lt_split_name_value (const char *arg, char** name, char** value);
3771 void lt_update_exe_path (const char *name, const char *value);
3772 void lt_update_lib_path (const char *name, const char *value);
3774 static const char *script_text_part1 =
3777 func_emit_wrapper_part1 yes |
3778 $SED -e 's/\([\\"]\)/\\\1/g' \
3779 -e 's/^/ "/' -e 's/$/\\n"/'
3780 echo ";"
3781 cat <<EOF
3783 static const char *script_text_part2 =
3785 func_emit_wrapper_part2 yes |
3786 $SED -e 's/\([\\"]\)/\\\1/g' \
3787 -e 's/^/ "/' -e 's/$/\\n"/'
3788 echo ";"
3790 cat <<EOF
3791 const char * MAGIC_EXE = "$magic_exe";
3792 const char * LIB_PATH_VARNAME = "$shlibpath_var";
3795 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3796 func_to_host_pathlist "$temp_rpath"
3797 cat <<EOF
3798 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
3800 else
3801 cat <<"EOF"
3802 const char * LIB_PATH_VALUE = "";
3806 if test -n "$dllsearchpath"; then
3807 func_to_host_pathlist "$dllsearchpath:"
3808 cat <<EOF
3809 const char * EXE_PATH_VARNAME = "PATH";
3810 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
3812 else
3813 cat <<"EOF"
3814 const char * EXE_PATH_VARNAME = "";
3815 const char * EXE_PATH_VALUE = "";
3819 if test "$fast_install" = yes; then
3820 cat <<EOF
3821 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3823 else
3824 cat <<EOF
3825 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3830 cat <<"EOF"
3832 #define LTWRAPPER_OPTION_PREFIX "--lt-"
3833 #define LTWRAPPER_OPTION_PREFIX_LENGTH 5
3835 static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
3836 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3838 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
3840 static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
3841 static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
3842 /* argument is putenv-style "foo=bar", value of foo is set to bar */
3844 static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
3845 static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
3846 /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
3848 static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
3849 static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
3850 /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
3853 main (int argc, char *argv[])
3855 char **newargz;
3856 int newargc;
3857 char *tmp_pathspec;
3858 char *actual_cwrapper_path;
3859 char *actual_cwrapper_name;
3860 char *target_name;
3861 char *lt_argv_zero;
3862 intptr_t rval = 127;
3864 int i;
3866 program_name = (char *) xstrdup (base_name (argv[0]));
3867 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3868 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3870 /* very simple arg parsing; don't want to rely on getopt */
3871 for (i = 1; i < argc; i++)
3873 if (strcmp (argv[i], dumpscript_opt) == 0)
3876 case "$host" in
3877 *mingw* | *cygwin* )
3878 # make stdout use "unix" line endings
3879 echo " setmode(1,_O_BINARY);"
3881 esac
3883 cat <<"EOF"
3884 printf ("%s", script_text_part1);
3885 printf ("%s", script_text_part2);
3886 return 0;
3890 newargz = XMALLOC (char *, argc + 1);
3891 tmp_pathspec = find_executable (argv[0]);
3892 if (tmp_pathspec == NULL)
3893 lt_fatal ("Couldn't find %s", argv[0]);
3894 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3895 tmp_pathspec));
3897 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3898 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3899 actual_cwrapper_path));
3900 XFREE (tmp_pathspec);
3902 actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
3903 strendzap (actual_cwrapper_path, actual_cwrapper_name);
3905 /* wrapper name transforms */
3906 strendzap (actual_cwrapper_name, ".exe");
3907 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3908 XFREE (actual_cwrapper_name);
3909 actual_cwrapper_name = tmp_pathspec;
3910 tmp_pathspec = 0;
3912 /* target_name transforms -- use actual target program name; might have lt- prefix */
3913 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3914 strendzap (target_name, ".exe");
3915 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3916 XFREE (target_name);
3917 target_name = tmp_pathspec;
3918 tmp_pathspec = 0;
3920 LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
3921 target_name));
3924 cat <<EOF
3925 newargz[0] =
3926 XMALLOC (char, (strlen (actual_cwrapper_path) +
3927 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3928 strcpy (newargz[0], actual_cwrapper_path);
3929 strcat (newargz[0], "$objdir");
3930 strcat (newargz[0], "/");
3933 cat <<"EOF"
3934 /* stop here, and copy so we don't have to do this twice */
3935 tmp_pathspec = xstrdup (newargz[0]);
3937 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3938 strcat (newargz[0], actual_cwrapper_name);
3940 /* DO want the lt- prefix here if it exists, so use target_name */
3941 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3942 XFREE (tmp_pathspec);
3943 tmp_pathspec = NULL;
3946 case $host_os in
3947 mingw*)
3948 cat <<"EOF"
3950 char* p;
3951 while ((p = strchr (newargz[0], '\\')) != NULL)
3953 *p = '/';
3955 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
3957 *p = '/';
3962 esac
3964 cat <<"EOF"
3965 XFREE (target_name);
3966 XFREE (actual_cwrapper_path);
3967 XFREE (actual_cwrapper_name);
3969 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3970 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
3971 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3972 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3974 newargc=0;
3975 for (i = 1; i < argc; i++)
3977 if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
3979 if (argv[i][env_set_opt_len] == '=')
3981 const char *p = argv[i] + env_set_opt_len + 1;
3982 lt_opt_process_env_set (p);
3984 else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
3986 lt_opt_process_env_set (argv[++i]); /* don't copy */
3988 else
3989 lt_fatal ("%s missing required argument", env_set_opt);
3990 continue;
3992 if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
3994 if (argv[i][env_prepend_opt_len] == '=')
3996 const char *p = argv[i] + env_prepend_opt_len + 1;
3997 lt_opt_process_env_prepend (p);
3999 else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
4001 lt_opt_process_env_prepend (argv[++i]); /* don't copy */
4003 else
4004 lt_fatal ("%s missing required argument", env_prepend_opt);
4005 continue;
4007 if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
4009 if (argv[i][env_append_opt_len] == '=')
4011 const char *p = argv[i] + env_append_opt_len + 1;
4012 lt_opt_process_env_append (p);
4014 else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
4016 lt_opt_process_env_append (argv[++i]); /* don't copy */
4018 else
4019 lt_fatal ("%s missing required argument", env_append_opt);
4020 continue;
4022 if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
4024 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4025 namespace, but it is not one of the ones we know about and
4026 have already dealt with, above (inluding dump-script), then
4027 report an error. Otherwise, targets might begin to believe
4028 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4029 namespace. The first time any user complains about this, we'll
4030 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4031 or a configure.ac-settable value.
4033 lt_fatal ("Unrecognized option in %s namespace: '%s'",
4034 ltwrapper_option_prefix, argv[i]);
4036 /* otherwise ... */
4037 newargz[++newargc] = xstrdup (argv[i]);
4039 newargz[++newargc] = NULL;
4041 LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
4042 for (i = 0; i < newargc; i++)
4044 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
4049 case $host_os in
4050 mingw*)
4051 cat <<"EOF"
4052 /* execv doesn't actually work on mingw as expected on unix */
4053 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4054 if (rval == -1)
4056 /* failed to start process */
4057 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
4058 return 127;
4060 return rval;
4064 cat <<"EOF"
4065 execv (lt_argv_zero, newargz);
4066 return rval; /* =127, but avoids unused variable warning */
4069 esac
4071 cat <<"EOF"
4074 void *
4075 xmalloc (size_t num)
4077 void *p = (void *) malloc (num);
4078 if (!p)
4079 lt_fatal ("Memory exhausted");
4081 return p;
4084 char *
4085 xstrdup (const char *string)
4087 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4088 string) : NULL;
4091 const char *
4092 base_name (const char *name)
4094 const char *base;
4096 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4097 /* Skip over the disk name in MSDOS pathnames. */
4098 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4099 name += 2;
4100 #endif
4102 for (base = name; *name; name++)
4103 if (IS_DIR_SEPARATOR (*name))
4104 base = name + 1;
4105 return base;
4109 check_executable (const char *path)
4111 struct stat st;
4113 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
4114 path ? (*path ? path : "EMPTY!") : "NULL!"));
4115 if ((!path) || (!*path))
4116 return 0;
4118 if ((stat (path, &st) >= 0)
4119 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4120 return 1;
4121 else
4122 return 0;
4126 make_executable (const char *path)
4128 int rval = 0;
4129 struct stat st;
4131 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
4132 path ? (*path ? path : "EMPTY!") : "NULL!"));
4133 if ((!path) || (!*path))
4134 return 0;
4136 if (stat (path, &st) >= 0)
4138 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4140 return rval;
4143 /* Searches for the full path of the wrapper. Returns
4144 newly allocated full path name if found, NULL otherwise
4145 Does not chase symlinks, even on platforms that support them.
4147 char *
4148 find_executable (const char *wrapper)
4150 int has_slash = 0;
4151 const char *p;
4152 const char *p_next;
4153 /* static buffer for getcwd */
4154 char tmp[LT_PATHMAX + 1];
4155 int tmp_len;
4156 char *concat_name;
4158 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
4159 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
4161 if ((wrapper == NULL) || (*wrapper == '\0'))
4162 return NULL;
4164 /* Absolute path? */
4165 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4166 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4168 concat_name = xstrdup (wrapper);
4169 if (check_executable (concat_name))
4170 return concat_name;
4171 XFREE (concat_name);
4173 else
4175 #endif
4176 if (IS_DIR_SEPARATOR (wrapper[0]))
4178 concat_name = xstrdup (wrapper);
4179 if (check_executable (concat_name))
4180 return concat_name;
4181 XFREE (concat_name);
4183 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4185 #endif
4187 for (p = wrapper; *p; p++)
4188 if (*p == '/')
4190 has_slash = 1;
4191 break;
4193 if (!has_slash)
4195 /* no slashes; search PATH */
4196 const char *path = getenv ("PATH");
4197 if (path != NULL)
4199 for (p = path; *p; p = p_next)
4201 const char *q;
4202 size_t p_len;
4203 for (q = p; *q; q++)
4204 if (IS_PATH_SEPARATOR (*q))
4205 break;
4206 p_len = q - p;
4207 p_next = (*q == '\0' ? q : q + 1);
4208 if (p_len == 0)
4210 /* empty path: current directory */
4211 if (getcwd (tmp, LT_PATHMAX) == NULL)
4212 lt_fatal ("getcwd failed");
4213 tmp_len = strlen (tmp);
4214 concat_name =
4215 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4216 memcpy (concat_name, tmp, tmp_len);
4217 concat_name[tmp_len] = '/';
4218 strcpy (concat_name + tmp_len + 1, wrapper);
4220 else
4222 concat_name =
4223 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4224 memcpy (concat_name, p, p_len);
4225 concat_name[p_len] = '/';
4226 strcpy (concat_name + p_len + 1, wrapper);
4228 if (check_executable (concat_name))
4229 return concat_name;
4230 XFREE (concat_name);
4233 /* not found in PATH; assume curdir */
4235 /* Relative path | not found in path: prepend cwd */
4236 if (getcwd (tmp, LT_PATHMAX) == NULL)
4237 lt_fatal ("getcwd failed");
4238 tmp_len = strlen (tmp);
4239 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4240 memcpy (concat_name, tmp, tmp_len);
4241 concat_name[tmp_len] = '/';
4242 strcpy (concat_name + tmp_len + 1, wrapper);
4244 if (check_executable (concat_name))
4245 return concat_name;
4246 XFREE (concat_name);
4247 return NULL;
4250 char *
4251 chase_symlinks (const char *pathspec)
4253 #ifndef S_ISLNK
4254 return xstrdup (pathspec);
4255 #else
4256 char buf[LT_PATHMAX];
4257 struct stat s;
4258 char *tmp_pathspec = xstrdup (pathspec);
4259 char *p;
4260 int has_symlinks = 0;
4261 while (strlen (tmp_pathspec) && !has_symlinks)
4263 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
4264 tmp_pathspec));
4265 if (lstat (tmp_pathspec, &s) == 0)
4267 if (S_ISLNK (s.st_mode) != 0)
4269 has_symlinks = 1;
4270 break;
4273 /* search backwards for last DIR_SEPARATOR */
4274 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4275 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4276 p--;
4277 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4279 /* no more DIR_SEPARATORS left */
4280 break;
4282 *p = '\0';
4284 else
4286 char *errstr = strerror (errno);
4287 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
4290 XFREE (tmp_pathspec);
4292 if (!has_symlinks)
4294 return xstrdup (pathspec);
4297 tmp_pathspec = realpath (pathspec, buf);
4298 if (tmp_pathspec == 0)
4300 lt_fatal ("Could not follow symlinks for %s", pathspec);
4302 return xstrdup (tmp_pathspec);
4303 #endif
4306 char *
4307 strendzap (char *str, const char *pat)
4309 size_t len, patlen;
4311 assert (str != NULL);
4312 assert (pat != NULL);
4314 len = strlen (str);
4315 patlen = strlen (pat);
4317 if (patlen <= len)
4319 str += len - patlen;
4320 if (strcmp (str, pat) == 0)
4321 *str = '\0';
4323 return str;
4326 static void
4327 lt_error_core (int exit_status, const char *mode,
4328 const char *message, va_list ap)
4330 fprintf (stderr, "%s: %s: ", program_name, mode);
4331 vfprintf (stderr, message, ap);
4332 fprintf (stderr, ".\n");
4334 if (exit_status >= 0)
4335 exit (exit_status);
4338 void
4339 lt_fatal (const char *message, ...)
4341 va_list ap;
4342 va_start (ap, message);
4343 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4344 va_end (ap);
4347 void
4348 lt_setenv (const char *name, const char *value)
4350 LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
4351 (name ? name : "<NULL>"),
4352 (value ? value : "<NULL>")));
4354 #ifdef HAVE_SETENV
4355 /* always make a copy, for consistency with !HAVE_SETENV */
4356 char *str = xstrdup (value);
4357 setenv (name, str, 1);
4358 #else
4359 int len = strlen (name) + 1 + strlen (value) + 1;
4360 char *str = XMALLOC (char, len);
4361 sprintf (str, "%s=%s", name, value);
4362 if (putenv (str) != EXIT_SUCCESS)
4364 XFREE (str);
4366 #endif
4370 char *
4371 lt_extend_str (const char *orig_value, const char *add, int to_end)
4373 char *new_value;
4374 if (orig_value && *orig_value)
4376 int orig_value_len = strlen (orig_value);
4377 int add_len = strlen (add);
4378 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4379 if (to_end)
4381 strcpy (new_value, orig_value);
4382 strcpy (new_value + orig_value_len, add);
4384 else
4386 strcpy (new_value, add);
4387 strcpy (new_value + add_len, orig_value);
4390 else
4392 new_value = xstrdup (add);
4394 return new_value;
4398 lt_split_name_value (const char *arg, char** name, char** value)
4400 const char *p;
4401 int len;
4402 if (!arg || !*arg)
4403 return 1;
4405 p = strchr (arg, (int)'=');
4407 if (!p)
4408 return 1;
4410 *value = xstrdup (++p);
4412 len = strlen (arg) - strlen (*value);
4413 *name = XMALLOC (char, len);
4414 strncpy (*name, arg, len-1);
4415 (*name)[len - 1] = '\0';
4417 return 0;
4420 void
4421 lt_opt_process_env_set (const char *arg)
4423 char *name = NULL;
4424 char *value = NULL;
4426 if (lt_split_name_value (arg, &name, &value) != 0)
4428 XFREE (name);
4429 XFREE (value);
4430 lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
4433 lt_setenv (name, value);
4434 XFREE (name);
4435 XFREE (value);
4438 void
4439 lt_opt_process_env_prepend (const char *arg)
4441 char *name = NULL;
4442 char *value = NULL;
4443 char *new_value = NULL;
4445 if (lt_split_name_value (arg, &name, &value) != 0)
4447 XFREE (name);
4448 XFREE (value);
4449 lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
4452 new_value = lt_extend_str (getenv (name), value, 0);
4453 lt_setenv (name, new_value);
4454 XFREE (new_value);
4455 XFREE (name);
4456 XFREE (value);
4459 void
4460 lt_opt_process_env_append (const char *arg)
4462 char *name = NULL;
4463 char *value = NULL;
4464 char *new_value = NULL;
4466 if (lt_split_name_value (arg, &name, &value) != 0)
4468 XFREE (name);
4469 XFREE (value);
4470 lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
4473 new_value = lt_extend_str (getenv (name), value, 1);
4474 lt_setenv (name, new_value);
4475 XFREE (new_value);
4476 XFREE (name);
4477 XFREE (value);
4480 void
4481 lt_update_exe_path (const char *name, const char *value)
4483 LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4484 (name ? name : "<NULL>"),
4485 (value ? value : "<NULL>")));
4487 if (name && *name && value && *value)
4489 char *new_value = lt_extend_str (getenv (name), value, 0);
4490 /* some systems can't cope with a ':'-terminated path #' */
4491 int len = strlen (new_value);
4492 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4494 new_value[len-1] = '\0';
4496 lt_setenv (name, new_value);
4497 XFREE (new_value);
4501 void
4502 lt_update_lib_path (const char *name, const char *value)
4504 LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4505 (name ? name : "<NULL>"),
4506 (value ? value : "<NULL>")));
4508 if (name && *name && value && *value)
4510 char *new_value = lt_extend_str (getenv (name), value, 0);
4511 lt_setenv (name, new_value);
4512 XFREE (new_value);
4519 # end: func_emit_cwrapperexe_src
4521 # func_mode_link arg...
4522 func_mode_link ()
4524 $opt_debug
4525 case $host in
4526 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4527 # It is impossible to link a dll without this setting, and
4528 # we shouldn't force the makefile maintainer to figure out
4529 # which system we are compiling for in order to pass an extra
4530 # flag for every libtool invocation.
4531 # allow_undefined=no
4533 # FIXME: Unfortunately, there are problems with the above when trying
4534 # to make a dll which has undefined symbols, in which case not
4535 # even a static library is built. For now, we need to specify
4536 # -no-undefined on the libtool link line when we can be certain
4537 # that all symbols are satisfied, otherwise we get a static library.
4538 allow_undefined=yes
4541 allow_undefined=yes
4543 esac
4544 libtool_args=$nonopt
4545 base_compile="$nonopt $@"
4546 compile_command=$nonopt
4547 finalize_command=$nonopt
4549 compile_rpath=
4550 finalize_rpath=
4551 compile_shlibpath=
4552 finalize_shlibpath=
4553 convenience=
4554 old_convenience=
4555 deplibs=
4556 old_deplibs=
4557 compiler_flags=
4558 linker_flags=
4559 dllsearchpath=
4560 lib_search_path=`pwd`
4561 inst_prefix_dir=
4562 new_inherited_linker_flags=
4564 avoid_version=no
4565 dlfiles=
4566 dlprefiles=
4567 dlself=no
4568 export_dynamic=no
4569 export_symbols=
4570 export_symbols_regex=
4571 generated=
4572 libobjs=
4573 ltlibs=
4574 module=no
4575 no_install=no
4576 objs=
4577 non_pic_objects=
4578 precious_files_regex=
4579 prefer_static_libs=no
4580 preload=no
4581 prev=
4582 prevarg=
4583 release=
4584 rpath=
4585 xrpath=
4586 perm_rpath=
4587 temp_rpath=
4588 thread_safe=no
4589 vinfo=
4590 vinfo_number=no
4591 weak_libs=
4592 single_module="${wl}-single_module"
4593 func_infer_tag $base_compile
4595 # We need to know -static, to get the right output filenames.
4596 for arg
4598 case $arg in
4599 -shared)
4600 test "$build_libtool_libs" != yes && \
4601 func_fatal_configuration "can not build a shared library"
4602 build_old_libs=no
4603 break
4605 -all-static | -static | -static-libtool-libs)
4606 case $arg in
4607 -all-static)
4608 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4609 func_warning "complete static linking is impossible in this configuration"
4611 if test -n "$link_static_flag"; then
4612 dlopen_self=$dlopen_self_static
4614 prefer_static_libs=yes
4616 -static)
4617 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4618 dlopen_self=$dlopen_self_static
4620 prefer_static_libs=built
4622 -static-libtool-libs)
4623 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4624 dlopen_self=$dlopen_self_static
4626 prefer_static_libs=yes
4628 esac
4629 build_libtool_libs=no
4630 build_old_libs=yes
4631 break
4633 esac
4634 done
4636 # See if our shared archives depend on static archives.
4637 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4639 # Go through the arguments, transforming them on the way.
4640 while test "$#" -gt 0; do
4641 arg="$1"
4642 shift
4643 func_quote_for_eval "$arg"
4644 qarg=$func_quote_for_eval_unquoted_result
4645 func_append libtool_args " $func_quote_for_eval_result"
4647 # If the previous option needs an argument, assign it.
4648 if test -n "$prev"; then
4649 case $prev in
4650 output)
4651 func_append compile_command " @OUTPUT@"
4652 func_append finalize_command " @OUTPUT@"
4654 esac
4656 case $prev in
4657 dlfiles|dlprefiles)
4658 if test "$preload" = no; then
4659 # Add the symbol object into the linking commands.
4660 func_append compile_command " @SYMFILE@"
4661 func_append finalize_command " @SYMFILE@"
4662 preload=yes
4664 case $arg in
4665 *.la | *.lo) ;; # We handle these cases below.
4666 force)
4667 if test "$dlself" = no; then
4668 dlself=needless
4669 export_dynamic=yes
4671 prev=
4672 continue
4674 self)
4675 if test "$prev" = dlprefiles; then
4676 dlself=yes
4677 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4678 dlself=yes
4679 else
4680 dlself=needless
4681 export_dynamic=yes
4683 prev=
4684 continue
4687 if test "$prev" = dlfiles; then
4688 dlfiles="$dlfiles $arg"
4689 else
4690 dlprefiles="$dlprefiles $arg"
4692 prev=
4693 continue
4695 esac
4697 expsyms)
4698 export_symbols="$arg"
4699 test -f "$arg" \
4700 || func_fatal_error "symbol file \`$arg' does not exist"
4701 prev=
4702 continue
4704 expsyms_regex)
4705 export_symbols_regex="$arg"
4706 prev=
4707 continue
4709 framework)
4710 case $host in
4711 *-*-darwin*)
4712 case "$deplibs " in
4713 *" $qarg.ltframework "*) ;;
4714 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4716 esac
4718 esac
4719 prev=
4720 continue
4722 inst_prefix)
4723 inst_prefix_dir="$arg"
4724 prev=
4725 continue
4727 objectlist)
4728 if test -f "$arg"; then
4729 save_arg=$arg
4730 moreargs=
4731 for fil in `cat "$save_arg"`
4733 # moreargs="$moreargs $fil"
4734 arg=$fil
4735 # A libtool-controlled object.
4737 # Check to see that this really is a libtool object.
4738 if func_lalib_unsafe_p "$arg"; then
4739 pic_object=
4740 non_pic_object=
4742 # Read the .lo file
4743 func_source "$arg"
4745 if test -z "$pic_object" ||
4746 test -z "$non_pic_object" ||
4747 test "$pic_object" = none &&
4748 test "$non_pic_object" = none; then
4749 func_fatal_error "cannot find name of object for \`$arg'"
4752 # Extract subdirectory from the argument.
4753 func_dirname "$arg" "/" ""
4754 xdir="$func_dirname_result"
4756 if test "$pic_object" != none; then
4757 # Prepend the subdirectory the object is found in.
4758 pic_object="$xdir$pic_object"
4760 if test "$prev" = dlfiles; then
4761 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4762 dlfiles="$dlfiles $pic_object"
4763 prev=
4764 continue
4765 else
4766 # If libtool objects are unsupported, then we need to preload.
4767 prev=dlprefiles
4771 # CHECK ME: I think I busted this. -Ossama
4772 if test "$prev" = dlprefiles; then
4773 # Preload the old-style object.
4774 dlprefiles="$dlprefiles $pic_object"
4775 prev=
4778 # A PIC object.
4779 func_append libobjs " $pic_object"
4780 arg="$pic_object"
4783 # Non-PIC object.
4784 if test "$non_pic_object" != none; then
4785 # Prepend the subdirectory the object is found in.
4786 non_pic_object="$xdir$non_pic_object"
4788 # A standard non-PIC object
4789 func_append non_pic_objects " $non_pic_object"
4790 if test -z "$pic_object" || test "$pic_object" = none ; then
4791 arg="$non_pic_object"
4793 else
4794 # If the PIC object exists, use it instead.
4795 # $xdir was prepended to $pic_object above.
4796 non_pic_object="$pic_object"
4797 func_append non_pic_objects " $non_pic_object"
4799 else
4800 # Only an error if not doing a dry-run.
4801 if $opt_dry_run; then
4802 # Extract subdirectory from the argument.
4803 func_dirname "$arg" "/" ""
4804 xdir="$func_dirname_result"
4806 func_lo2o "$arg"
4807 pic_object=$xdir$objdir/$func_lo2o_result
4808 non_pic_object=$xdir$func_lo2o_result
4809 func_append libobjs " $pic_object"
4810 func_append non_pic_objects " $non_pic_object"
4811 else
4812 func_fatal_error "\`$arg' is not a valid libtool object"
4815 done
4816 else
4817 func_fatal_error "link input file \`$arg' does not exist"
4819 arg=$save_arg
4820 prev=
4821 continue
4823 precious_regex)
4824 precious_files_regex="$arg"
4825 prev=
4826 continue
4828 release)
4829 release="-$arg"
4830 prev=
4831 continue
4833 rpath | xrpath)
4834 # We need an absolute path.
4835 case $arg in
4836 [\\/]* | [A-Za-z]:[\\/]*) ;;
4838 func_fatal_error "only absolute run-paths are allowed"
4840 esac
4841 if test "$prev" = rpath; then
4842 case "$rpath " in
4843 *" $arg "*) ;;
4844 *) rpath="$rpath $arg" ;;
4845 esac
4846 else
4847 case "$xrpath " in
4848 *" $arg "*) ;;
4849 *) xrpath="$xrpath $arg" ;;
4850 esac
4852 prev=
4853 continue
4855 shrext)
4856 shrext_cmds="$arg"
4857 prev=
4858 continue
4860 weak)
4861 weak_libs="$weak_libs $arg"
4862 prev=
4863 continue
4865 xcclinker)
4866 linker_flags="$linker_flags $qarg"
4867 compiler_flags="$compiler_flags $qarg"
4868 prev=
4869 func_append compile_command " $qarg"
4870 func_append finalize_command " $qarg"
4871 continue
4873 xcompiler)
4874 compiler_flags="$compiler_flags $qarg"
4875 prev=
4876 func_append compile_command " $qarg"
4877 func_append finalize_command " $qarg"
4878 continue
4880 xlinker)
4881 linker_flags="$linker_flags $qarg"
4882 compiler_flags="$compiler_flags $wl$qarg"
4883 prev=
4884 func_append compile_command " $wl$qarg"
4885 func_append finalize_command " $wl$qarg"
4886 continue
4889 eval "$prev=\"\$arg\""
4890 prev=
4891 continue
4893 esac
4894 fi # test -n "$prev"
4896 prevarg="$arg"
4898 case $arg in
4899 -all-static)
4900 if test -n "$link_static_flag"; then
4901 # See comment for -static flag below, for more details.
4902 func_append compile_command " $link_static_flag"
4903 func_append finalize_command " $link_static_flag"
4905 continue
4908 -allow-undefined)
4909 # FIXME: remove this flag sometime in the future.
4910 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
4913 -avoid-version)
4914 avoid_version=yes
4915 continue
4918 -dlopen)
4919 prev=dlfiles
4920 continue
4923 -dlpreopen)
4924 prev=dlprefiles
4925 continue
4928 -export-dynamic)
4929 export_dynamic=yes
4930 continue
4933 -export-symbols | -export-symbols-regex)
4934 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
4935 func_fatal_error "more than one -exported-symbols argument is not allowed"
4937 if test "X$arg" = "X-export-symbols"; then
4938 prev=expsyms
4939 else
4940 prev=expsyms_regex
4942 continue
4945 -framework)
4946 prev=framework
4947 continue
4950 -inst-prefix-dir)
4951 prev=inst_prefix
4952 continue
4955 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
4956 # so, if we see these flags be careful not to treat them like -L
4957 -L[A-Z][A-Z]*:*)
4958 case $with_gcc/$host in
4959 no/*-*-irix* | /*-*-irix*)
4960 func_append compile_command " $arg"
4961 func_append finalize_command " $arg"
4963 esac
4964 continue
4967 -L*)
4968 func_stripname '-L' '' "$arg"
4969 dir=$func_stripname_result
4970 if test -z "$dir"; then
4971 if test "$#" -gt 0; then
4972 func_fatal_error "require no space between \`-L' and \`$1'"
4973 else
4974 func_fatal_error "need path for \`-L' option"
4977 # We need an absolute path.
4978 case $dir in
4979 [\\/]* | [A-Za-z]:[\\/]*) ;;
4981 absdir=`cd "$dir" && pwd`
4982 test -z "$absdir" && \
4983 func_fatal_error "cannot determine absolute directory name of \`$dir'"
4984 dir="$absdir"
4986 esac
4987 case "$deplibs " in
4988 *" -L$dir "*) ;;
4990 deplibs="$deplibs -L$dir"
4991 lib_search_path="$lib_search_path $dir"
4993 esac
4994 case $host in
4995 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4996 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
4997 case :$dllsearchpath: in
4998 *":$dir:"*) ;;
4999 ::) dllsearchpath=$dir;;
5000 *) dllsearchpath="$dllsearchpath:$dir";;
5001 esac
5002 case :$dllsearchpath: in
5003 *":$testbindir:"*) ;;
5004 ::) dllsearchpath=$testbindir;;
5005 *) dllsearchpath="$dllsearchpath:$testbindir";;
5006 esac
5008 esac
5009 continue
5012 -l*)
5013 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5014 case $host in
5015 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
5016 # These systems don't actually have a C or math library (as such)
5017 continue
5019 *-*-os2*)
5020 # These systems don't actually have a C library (as such)
5021 test "X$arg" = "X-lc" && continue
5023 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5024 # Do not include libc due to us having libc/libc_r.
5025 test "X$arg" = "X-lc" && continue
5027 *-*-rhapsody* | *-*-darwin1.[012])
5028 # Rhapsody C and math libraries are in the System framework
5029 deplibs="$deplibs System.ltframework"
5030 continue
5032 *-*-sco3.2v5* | *-*-sco5v6*)
5033 # Causes problems with __ctype
5034 test "X$arg" = "X-lc" && continue
5036 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5037 # Compiler inserts libc in the correct place for threads to work
5038 test "X$arg" = "X-lc" && continue
5040 esac
5041 elif test "X$arg" = "X-lc_r"; then
5042 case $host in
5043 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5044 # Do not include libc_r directly, use -pthread flag.
5045 continue
5047 esac
5049 deplibs="$deplibs $arg"
5050 continue
5053 -module)
5054 module=yes
5055 continue
5058 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5059 # classes, name mangling, and exception handling.
5060 # Darwin uses the -arch flag to determine output architecture.
5061 -model|-arch|-isysroot)
5062 compiler_flags="$compiler_flags $arg"
5063 func_append compile_command " $arg"
5064 func_append finalize_command " $arg"
5065 prev=xcompiler
5066 continue
5069 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5070 compiler_flags="$compiler_flags $arg"
5071 func_append compile_command " $arg"
5072 func_append finalize_command " $arg"
5073 case "$new_inherited_linker_flags " in
5074 *" $arg "*) ;;
5075 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
5076 esac
5077 continue
5080 -multi_module)
5081 single_module="${wl}-multi_module"
5082 continue
5085 -no-fast-install)
5086 fast_install=no
5087 continue
5090 -no-install)
5091 case $host in
5092 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5093 # The PATH hackery in wrapper scripts is required on Windows
5094 # and Darwin in order for the loader to find any dlls it needs.
5095 func_warning "\`-no-install' is ignored for $host"
5096 func_warning "assuming \`-no-fast-install' instead"
5097 fast_install=no
5099 *) no_install=yes ;;
5100 esac
5101 continue
5104 -no-undefined)
5105 allow_undefined=no
5106 continue
5109 -objectlist)
5110 prev=objectlist
5111 continue
5114 -o) prev=output ;;
5116 -precious-files-regex)
5117 prev=precious_regex
5118 continue
5121 -release)
5122 prev=release
5123 continue
5126 -rpath)
5127 prev=rpath
5128 continue
5132 prev=xrpath
5133 continue
5136 -R*)
5137 func_stripname '-R' '' "$arg"
5138 dir=$func_stripname_result
5139 # We need an absolute path.
5140 case $dir in
5141 [\\/]* | [A-Za-z]:[\\/]*) ;;
5143 func_fatal_error "only absolute run-paths are allowed"
5145 esac
5146 case "$xrpath " in
5147 *" $dir "*) ;;
5148 *) xrpath="$xrpath $dir" ;;
5149 esac
5150 continue
5153 -shared)
5154 # The effects of -shared are defined in a previous loop.
5155 continue
5158 -shrext)
5159 prev=shrext
5160 continue
5163 -static | -static-libtool-libs)
5164 # The effects of -static are defined in a previous loop.
5165 # We used to do the same as -all-static on platforms that
5166 # didn't have a PIC flag, but the assumption that the effects
5167 # would be equivalent was wrong. It would break on at least
5168 # Digital Unix and AIX.
5169 continue
5172 -thread-safe)
5173 thread_safe=yes
5174 continue
5177 -version-info)
5178 prev=vinfo
5179 continue
5182 -version-number)
5183 prev=vinfo
5184 vinfo_number=yes
5185 continue
5188 -weak)
5189 prev=weak
5190 continue
5193 -Wc,*)
5194 func_stripname '-Wc,' '' "$arg"
5195 args=$func_stripname_result
5196 arg=
5197 save_ifs="$IFS"; IFS=','
5198 for flag in $args; do
5199 IFS="$save_ifs"
5200 func_quote_for_eval "$flag"
5201 arg="$arg $wl$func_quote_for_eval_result"
5202 compiler_flags="$compiler_flags $func_quote_for_eval_result"
5203 done
5204 IFS="$save_ifs"
5205 func_stripname ' ' '' "$arg"
5206 arg=$func_stripname_result
5209 -Wl,*)
5210 func_stripname '-Wl,' '' "$arg"
5211 args=$func_stripname_result
5212 arg=
5213 save_ifs="$IFS"; IFS=','
5214 for flag in $args; do
5215 IFS="$save_ifs"
5216 func_quote_for_eval "$flag"
5217 arg="$arg $wl$func_quote_for_eval_result"
5218 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
5219 linker_flags="$linker_flags $func_quote_for_eval_result"
5220 done
5221 IFS="$save_ifs"
5222 func_stripname ' ' '' "$arg"
5223 arg=$func_stripname_result
5226 -Xcompiler)
5227 prev=xcompiler
5228 continue
5231 -Xlinker)
5232 prev=xlinker
5233 continue
5236 -XCClinker)
5237 prev=xcclinker
5238 continue
5241 # -msg_* for osf cc
5242 -msg_*)
5243 func_quote_for_eval "$arg"
5244 arg="$func_quote_for_eval_result"
5247 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
5248 # -r[0-9][0-9]* specifies the processor on the SGI compiler
5249 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
5250 # +DA*, +DD* enable 64-bit mode on the HP compiler
5251 # -q* pass through compiler args for the IBM compiler
5252 # -m*, -t[45]*, -txscale* pass through architecture-specific
5253 # compiler args for GCC
5254 # -F/path gives path to uninstalled frameworks, gcc on darwin
5255 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
5256 # @file GCC response files
5257 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5258 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
5259 func_quote_for_eval "$arg"
5260 arg="$func_quote_for_eval_result"
5261 func_append compile_command " $arg"
5262 func_append finalize_command " $arg"
5263 compiler_flags="$compiler_flags $arg"
5264 continue
5267 # Some other compiler flag.
5268 -* | +*)
5269 func_quote_for_eval "$arg"
5270 arg="$func_quote_for_eval_result"
5273 *.$objext)
5274 # A standard object.
5275 objs="$objs $arg"
5278 *.lo)
5279 # A libtool-controlled object.
5281 # Check to see that this really is a libtool object.
5282 if func_lalib_unsafe_p "$arg"; then
5283 pic_object=
5284 non_pic_object=
5286 # Read the .lo file
5287 func_source "$arg"
5289 if test -z "$pic_object" ||
5290 test -z "$non_pic_object" ||
5291 test "$pic_object" = none &&
5292 test "$non_pic_object" = none; then
5293 func_fatal_error "cannot find name of object for \`$arg'"
5296 # Extract subdirectory from the argument.
5297 func_dirname "$arg" "/" ""
5298 xdir="$func_dirname_result"
5300 if test "$pic_object" != none; then
5301 # Prepend the subdirectory the object is found in.
5302 pic_object="$xdir$pic_object"
5304 if test "$prev" = dlfiles; then
5305 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5306 dlfiles="$dlfiles $pic_object"
5307 prev=
5308 continue
5309 else
5310 # If libtool objects are unsupported, then we need to preload.
5311 prev=dlprefiles
5315 # CHECK ME: I think I busted this. -Ossama
5316 if test "$prev" = dlprefiles; then
5317 # Preload the old-style object.
5318 dlprefiles="$dlprefiles $pic_object"
5319 prev=
5322 # A PIC object.
5323 func_append libobjs " $pic_object"
5324 arg="$pic_object"
5327 # Non-PIC object.
5328 if test "$non_pic_object" != none; then
5329 # Prepend the subdirectory the object is found in.
5330 non_pic_object="$xdir$non_pic_object"
5332 # A standard non-PIC object
5333 func_append non_pic_objects " $non_pic_object"
5334 if test -z "$pic_object" || test "$pic_object" = none ; then
5335 arg="$non_pic_object"
5337 else
5338 # If the PIC object exists, use it instead.
5339 # $xdir was prepended to $pic_object above.
5340 non_pic_object="$pic_object"
5341 func_append non_pic_objects " $non_pic_object"
5343 else
5344 # Only an error if not doing a dry-run.
5345 if $opt_dry_run; then
5346 # Extract subdirectory from the argument.
5347 func_dirname "$arg" "/" ""
5348 xdir="$func_dirname_result"
5350 func_lo2o "$arg"
5351 pic_object=$xdir$objdir/$func_lo2o_result
5352 non_pic_object=$xdir$func_lo2o_result
5353 func_append libobjs " $pic_object"
5354 func_append non_pic_objects " $non_pic_object"
5355 else
5356 func_fatal_error "\`$arg' is not a valid libtool object"
5361 *.$libext)
5362 # An archive.
5363 deplibs="$deplibs $arg"
5364 old_deplibs="$old_deplibs $arg"
5365 continue
5368 *.la)
5369 # A libtool-controlled library.
5371 if test "$prev" = dlfiles; then
5372 # This library was specified with -dlopen.
5373 dlfiles="$dlfiles $arg"
5374 prev=
5375 elif test "$prev" = dlprefiles; then
5376 # The library was specified with -dlpreopen.
5377 dlprefiles="$dlprefiles $arg"
5378 prev=
5379 else
5380 deplibs="$deplibs $arg"
5382 continue
5385 # Some other compiler argument.
5387 # Unknown arguments in both finalize_command and compile_command need
5388 # to be aesthetically quoted because they are evaled later.
5389 func_quote_for_eval "$arg"
5390 arg="$func_quote_for_eval_result"
5392 esac # arg
5394 # Now actually substitute the argument into the commands.
5395 if test -n "$arg"; then
5396 func_append compile_command " $arg"
5397 func_append finalize_command " $arg"
5399 done # argument parsing loop
5401 if test "$module" = yes ; then
5402 # [Mandriva] dropping ld option "--no-undefined" which is wrong for plugins
5403 linker_flags=`$ECHO "X $linker_flags" | $Xsed -e 's/ --no-undefined//'`
5404 compiler_flags=`$ECHO "X $compiler_flags" | $Xsed -e 's/ -Wl,--no-undefined//'`
5407 test -n "$prev" && \
5408 func_fatal_help "the \`$prevarg' option requires an argument"
5410 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5411 eval arg=\"$export_dynamic_flag_spec\"
5412 func_append compile_command " $arg"
5413 func_append finalize_command " $arg"
5416 oldlibs=
5417 # calculate the name of the file, without its directory
5418 func_basename "$output"
5419 outputname="$func_basename_result"
5420 libobjs_save="$libobjs"
5422 if test -n "$shlibpath_var"; then
5423 # get the directories listed in $shlibpath_var
5424 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
5425 else
5426 shlib_search_path=
5428 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5429 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5431 func_dirname "$output" "/" ""
5432 output_objdir="$func_dirname_result$objdir"
5433 # Create the object directory.
5434 func_mkdir_p "$output_objdir"
5436 # Determine the type of output
5437 case $output in
5439 func_fatal_help "you must specify an output file"
5441 *.$libext) linkmode=oldlib ;;
5442 *.lo | *.$objext) linkmode=obj ;;
5443 *.la) linkmode=lib ;;
5444 *) linkmode=prog ;; # Anything else should be a program.
5445 esac
5447 specialdeplibs=
5449 libs=
5450 # Find all interdependent deplibs by searching for libraries
5451 # that are linked more than once (e.g. -la -lb -la)
5452 for deplib in $deplibs; do
5453 if $opt_duplicate_deps ; then
5454 case "$libs " in
5455 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5456 esac
5458 libs="$libs $deplib"
5459 done
5461 if test "$linkmode" = lib; then
5462 libs="$predeps $libs $compiler_lib_search_path $postdeps"
5464 # Compute libraries that are listed more than once in $predeps
5465 # $postdeps and mark them as special (i.e., whose duplicates are
5466 # not to be eliminated).
5467 pre_post_deps=
5468 if $opt_duplicate_compiler_generated_deps; then
5469 for pre_post_dep in $predeps $postdeps; do
5470 case "$pre_post_deps " in
5471 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
5472 esac
5473 pre_post_deps="$pre_post_deps $pre_post_dep"
5474 done
5476 pre_post_deps=
5479 deplibs=
5480 newdependency_libs=
5481 newlib_search_path=
5482 need_relink=no # whether we're linking any uninstalled libtool libraries
5483 notinst_deplibs= # not-installed libtool libraries
5484 notinst_path= # paths that contain not-installed libtool libraries
5486 case $linkmode in
5487 lib)
5488 passes="conv dlpreopen link"
5489 for file in $dlfiles $dlprefiles; do
5490 case $file in
5491 *.la) ;;
5493 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5495 esac
5496 done
5498 prog)
5499 compile_deplibs=
5500 finalize_deplibs=
5501 alldeplibs=no
5502 newdlfiles=
5503 newdlprefiles=
5504 passes="conv scan dlopen dlpreopen link"
5506 *) passes="conv"
5508 esac
5510 for pass in $passes; do
5511 # The preopen pass in lib mode reverses $deplibs; put it back here
5512 # so that -L comes before libs that need it for instance...
5513 if test "$linkmode,$pass" = "lib,link"; then
5514 ## FIXME: Find the place where the list is rebuilt in the wrong
5515 ## order, and fix it there properly
5516 tmp_deplibs=
5517 for deplib in $deplibs; do
5518 tmp_deplibs="$deplib $tmp_deplibs"
5519 done
5520 deplibs="$tmp_deplibs"
5523 if test "$linkmode,$pass" = "lib,link" ||
5524 test "$linkmode,$pass" = "prog,scan"; then
5525 libs="$deplibs"
5526 deplibs=
5528 if test "$linkmode" = prog; then
5529 case $pass in
5530 dlopen) libs="$dlfiles" ;;
5531 dlpreopen) libs="$dlprefiles" ;;
5532 link)
5533 libs="$deplibs %DEPLIBS%"
5534 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
5536 esac
5538 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5539 # Collect and forward deplibs of preopened libtool libs
5540 for lib in $dlprefiles; do
5541 # Ignore non-libtool-libs
5542 dependency_libs=
5543 case $lib in
5544 *.la) func_source "$lib" ;;
5545 esac
5547 # Collect preopened libtool deplibs, except any this library
5548 # has declared as weak libs
5549 for deplib in $dependency_libs; do
5550 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
5551 case " $weak_libs " in
5552 *" $deplib_base "*) ;;
5553 *) deplibs="$deplibs $deplib" ;;
5554 esac
5555 done
5556 done
5557 libs="$dlprefiles"
5559 if test "$pass" = dlopen; then
5560 # Collect dlpreopened libraries
5561 save_deplibs="$deplibs"
5562 deplibs=
5565 for deplib in $libs; do
5566 lib=
5567 found=no
5568 case $deplib in
5569 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5570 if test "$linkmode,$pass" = "prog,link"; then
5571 compile_deplibs="$deplib $compile_deplibs"
5572 finalize_deplibs="$deplib $finalize_deplibs"
5573 else
5574 compiler_flags="$compiler_flags $deplib"
5575 if test "$linkmode" = lib ; then
5576 case "$new_inherited_linker_flags " in
5577 *" $deplib "*) ;;
5578 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5579 esac
5582 continue
5584 -l*)
5585 if test "$linkmode" != lib && test "$linkmode" != prog; then
5586 func_warning "\`-l' is ignored for archives/objects"
5587 continue
5589 func_stripname '-l' '' "$deplib"
5590 name=$func_stripname_result
5591 if test "$linkmode" = lib; then
5592 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5593 else
5594 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5596 for searchdir in $searchdirs; do
5597 for search_ext in .la $std_shrext .so .a; do
5598 # Search the libtool library
5599 lib="$searchdir/lib${name}${search_ext}"
5600 if test -f "$lib"; then
5601 if test "$search_ext" = ".la"; then
5602 found=yes
5603 else
5604 found=no
5606 break 2
5608 done
5609 done
5610 if test "$found" != yes; then
5611 # deplib doesn't seem to be a libtool library
5612 if test "$linkmode,$pass" = "prog,link"; then
5613 compile_deplibs="$deplib $compile_deplibs"
5614 finalize_deplibs="$deplib $finalize_deplibs"
5615 else
5616 deplibs="$deplib $deplibs"
5617 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5619 continue
5620 else # deplib is a libtool library
5621 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5622 # We need to do some special things here, and not later.
5623 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5624 case " $predeps $postdeps " in
5625 *" $deplib "*)
5626 if func_lalib_p "$lib"; then
5627 library_names=
5628 old_library=
5629 func_source "$lib"
5630 for l in $old_library $library_names; do
5631 ll="$l"
5632 done
5633 if test "X$ll" = "X$old_library" ; then # only static version available
5634 found=no
5635 func_dirname "$lib" "" "."
5636 ladir="$func_dirname_result"
5637 lib=$ladir/$old_library
5638 if test "$linkmode,$pass" = "prog,link"; then
5639 compile_deplibs="$deplib $compile_deplibs"
5640 finalize_deplibs="$deplib $finalize_deplibs"
5641 else
5642 deplibs="$deplib $deplibs"
5643 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5645 continue
5649 *) ;;
5650 esac
5653 ;; # -l
5654 *.ltframework)
5655 if test "$linkmode,$pass" = "prog,link"; then
5656 compile_deplibs="$deplib $compile_deplibs"
5657 finalize_deplibs="$deplib $finalize_deplibs"
5658 else
5659 deplibs="$deplib $deplibs"
5660 if test "$linkmode" = lib ; then
5661 case "$new_inherited_linker_flags " in
5662 *" $deplib "*) ;;
5663 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5664 esac
5667 continue
5669 -L*)
5670 case $linkmode in
5671 lib)
5672 deplibs="$deplib $deplibs"
5673 test "$pass" = conv && continue
5674 newdependency_libs="$deplib $newdependency_libs"
5675 func_stripname '-L' '' "$deplib"
5676 newlib_search_path="$newlib_search_path $func_stripname_result"
5678 prog)
5679 if test "$pass" = conv; then
5680 deplibs="$deplib $deplibs"
5681 continue
5683 if test "$pass" = scan; then
5684 deplibs="$deplib $deplibs"
5685 else
5686 compile_deplibs="$deplib $compile_deplibs"
5687 finalize_deplibs="$deplib $finalize_deplibs"
5689 func_stripname '-L' '' "$deplib"
5690 newlib_search_path="$newlib_search_path $func_stripname_result"
5693 func_warning "\`-L' is ignored for archives/objects"
5695 esac # linkmode
5696 continue
5697 ;; # -L
5698 -R*)
5699 if test "$pass" = link; then
5700 func_stripname '-R' '' "$deplib"
5701 dir=$func_stripname_result
5702 # Make sure the xrpath contains only unique directories.
5703 case "$xrpath " in
5704 *" $dir "*) ;;
5705 *) xrpath="$xrpath $dir" ;;
5706 esac
5708 deplibs="$deplib $deplibs"
5709 continue
5711 *.la) lib="$deplib" ;;
5712 *.$libext)
5713 if test "$pass" = conv; then
5714 deplibs="$deplib $deplibs"
5715 continue
5717 case $linkmode in
5718 lib)
5719 # Linking convenience modules into shared libraries is allowed,
5720 # but linking other static libraries is non-portable.
5721 case " $dlpreconveniencelibs " in
5722 *" $deplib "*) ;;
5724 valid_a_lib=no
5725 case $deplibs_check_method in
5726 match_pattern*)
5727 set dummy $deplibs_check_method; shift
5728 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5729 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
5730 | $EGREP "$match_pattern_regex" > /dev/null; then
5731 valid_a_lib=yes
5734 pass_all)
5735 valid_a_lib=yes
5737 esac
5738 if test "$valid_a_lib" != yes; then
5739 $ECHO
5740 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5741 $ECHO "*** I have the capability to make that library automatically link in when"
5742 $ECHO "*** you link to this library. But I can only do this if you have a"
5743 $ECHO "*** shared version of the library, which you do not appear to have"
5744 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
5745 $ECHO "*** that it is just a static archive that I should not use here."
5746 else
5747 $ECHO
5748 $ECHO "*** Warning: Linking the shared library $output against the"
5749 $ECHO "*** static library $deplib is not portable!"
5750 deplibs="$deplib $deplibs"
5753 esac
5754 continue
5756 prog)
5757 if test "$pass" != link; then
5758 deplibs="$deplib $deplibs"
5759 else
5760 compile_deplibs="$deplib $compile_deplibs"
5761 finalize_deplibs="$deplib $finalize_deplibs"
5763 continue
5765 esac # linkmode
5766 ;; # *.$libext
5767 *.lo | *.$objext)
5768 if test "$pass" = conv; then
5769 deplibs="$deplib $deplibs"
5770 elif test "$linkmode" = prog; then
5771 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5772 # If there is no dlopen support or we're linking statically,
5773 # we need to preload.
5774 newdlprefiles="$newdlprefiles $deplib"
5775 compile_deplibs="$deplib $compile_deplibs"
5776 finalize_deplibs="$deplib $finalize_deplibs"
5777 else
5778 newdlfiles="$newdlfiles $deplib"
5781 continue
5783 %DEPLIBS%)
5784 alldeplibs=yes
5785 continue
5787 esac # case $deplib
5789 if test "$found" = yes || test -f "$lib"; then :
5790 else
5791 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
5794 # Check to see that this really is a libtool archive.
5795 func_lalib_unsafe_p "$lib" \
5796 || func_fatal_error "\`$lib' is not a valid libtool archive"
5798 func_dirname "$lib" "" "."
5799 ladir="$func_dirname_result"
5801 dlname=
5802 dlopen=
5803 dlpreopen=
5804 libdir=
5805 library_names=
5806 old_library=
5807 inherited_linker_flags=
5808 # If the library was installed with an old release of libtool,
5809 # it will not redefine variables installed, or shouldnotlink
5810 installed=yes
5811 shouldnotlink=no
5812 avoidtemprpath=
5815 # Read the .la file
5816 func_source "$lib"
5818 # Convert "-framework foo" to "foo.ltframework"
5819 if test -n "$inherited_linker_flags"; then
5820 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
5821 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5822 case " $new_inherited_linker_flags " in
5823 *" $tmp_inherited_linker_flag "*) ;;
5824 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
5825 esac
5826 done
5828 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5829 if test "$linkmode,$pass" = "lib,link" ||
5830 test "$linkmode,$pass" = "prog,scan" ||
5831 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
5832 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
5833 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
5836 if test "$pass" = conv; then
5837 # Only check for convenience libraries
5838 deplibs="$lib $deplibs"
5839 if test -z "$libdir"; then
5840 if test -z "$old_library"; then
5841 func_fatal_error "cannot find name of link library for \`$lib'"
5843 # It is a libtool convenience library, so add in its objects.
5844 convenience="$convenience $ladir/$objdir/$old_library"
5845 old_convenience="$old_convenience $ladir/$objdir/$old_library"
5846 elif test "$linkmode" != prog && test "$linkmode" != lib; then
5847 func_fatal_error "\`$lib' is not a convenience library"
5849 tmp_libs=
5850 for deplib in $dependency_libs; do
5851 deplibs="$deplib $deplibs"
5852 if $opt_duplicate_deps ; then
5853 case "$tmp_libs " in
5854 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5855 esac
5857 tmp_libs="$tmp_libs $deplib"
5858 done
5859 continue
5860 fi # $pass = conv
5863 # Get the name of the library we link against.
5864 linklib=
5865 for l in $old_library $library_names; do
5866 linklib="$l"
5867 done
5868 if test -z "$linklib"; then
5869 func_fatal_error "cannot find name of link library for \`$lib'"
5872 # This library was specified with -dlopen.
5873 if test "$pass" = dlopen; then
5874 if test -z "$libdir"; then
5875 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
5877 if test -z "$dlname" ||
5878 test "$dlopen_support" != yes ||
5879 test "$build_libtool_libs" = no; then
5880 # If there is no dlname, no dlopen support or we're linking
5881 # statically, we need to preload. We also need to preload any
5882 # dependent libraries so libltdl's deplib preloader doesn't
5883 # bomb out in the load deplibs phase.
5884 dlprefiles="$dlprefiles $lib $dependency_libs"
5885 else
5886 newdlfiles="$newdlfiles $lib"
5888 continue
5889 fi # $pass = dlopen
5891 # We need an absolute path.
5892 case $ladir in
5893 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
5895 abs_ladir=`cd "$ladir" && pwd`
5896 if test -z "$abs_ladir"; then
5897 func_warning "cannot determine absolute directory name of \`$ladir'"
5898 func_warning "passing it literally to the linker, although it might fail"
5899 abs_ladir="$ladir"
5902 esac
5903 func_basename "$lib"
5904 laname="$func_basename_result"
5906 # Find the relevant object directory and library name.
5907 if test "X$installed" = Xyes; then
5908 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5909 func_warning "library \`$lib' was moved."
5910 dir="$ladir"
5911 absdir="$abs_ladir"
5912 libdir="$abs_ladir"
5913 else
5914 dir="$libdir"
5915 absdir="$libdir"
5917 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
5918 else
5919 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5920 dir="$ladir"
5921 absdir="$abs_ladir"
5922 # Remove this search path later
5923 notinst_path="$notinst_path $abs_ladir"
5924 else
5925 dir="$ladir/$objdir"
5926 absdir="$abs_ladir/$objdir"
5927 # Remove this search path later
5928 notinst_path="$notinst_path $abs_ladir"
5930 fi # $installed = yes
5931 func_stripname 'lib' '.la' "$laname"
5932 name=$func_stripname_result
5934 # This library was specified with -dlpreopen.
5935 if test "$pass" = dlpreopen; then
5936 if test -z "$libdir" && test "$linkmode" = prog; then
5937 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
5939 # Prefer using a static library (so that no silly _DYNAMIC symbols
5940 # are required to link).
5941 if test -n "$old_library"; then
5942 newdlprefiles="$newdlprefiles $dir/$old_library"
5943 # Keep a list of preopened convenience libraries to check
5944 # that they are being used correctly in the link pass.
5945 test -z "$libdir" && \
5946 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
5947 # Otherwise, use the dlname, so that lt_dlopen finds it.
5948 elif test -n "$dlname"; then
5949 newdlprefiles="$newdlprefiles $dir/$dlname"
5950 else
5951 newdlprefiles="$newdlprefiles $dir/$linklib"
5953 fi # $pass = dlpreopen
5955 if test -z "$libdir"; then
5956 # Link the convenience library
5957 if test "$linkmode" = lib; then
5958 deplibs="$dir/$old_library $deplibs"
5959 elif test "$linkmode,$pass" = "prog,link"; then
5960 compile_deplibs="$dir/$old_library $compile_deplibs"
5961 finalize_deplibs="$dir/$old_library $finalize_deplibs"
5962 else
5963 deplibs="$lib $deplibs" # used for prog,scan pass
5965 continue
5969 if test "$linkmode" = prog && test "$pass" != link; then
5970 newlib_search_path="$newlib_search_path $ladir"
5971 deplibs="$lib $deplibs"
5973 linkalldeplibs=no
5974 if test "$link_all_deplibs" != no || test -z "$library_names" ||
5975 test "$build_libtool_libs" = no; then
5976 linkalldeplibs=yes
5979 tmp_libs=
5980 for deplib in $dependency_libs; do
5981 case $deplib in
5982 -L*) func_stripname '-L' '' "$deplib"
5983 newlib_search_path="$newlib_search_path $func_stripname_result"
5985 esac
5986 # Need to link against all dependency_libs?
5987 if test "$linkalldeplibs" = yes; then
5988 deplibs="$deplib $deplibs"
5989 else
5990 # Need to hardcode shared library paths
5991 # or/and link against static libraries
5992 newdependency_libs="$deplib $newdependency_libs"
5994 if $opt_duplicate_deps ; then
5995 case "$tmp_libs " in
5996 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5997 esac
5999 tmp_libs="$tmp_libs $deplib"
6000 done # for deplib
6001 continue
6002 fi # $linkmode = prog...
6004 if test "$linkmode,$pass" = "prog,link"; then
6005 if test -n "$library_names" &&
6006 { { test "$prefer_static_libs" = no ||
6007 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6008 test -z "$old_library"; }; then
6009 # We need to hardcode the library path
6010 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6011 # Make sure the rpath contains only unique directories.
6012 case "$temp_rpath:" in
6013 *"$absdir:"*) ;;
6014 *) temp_rpath="$temp_rpath$absdir:" ;;
6015 esac
6018 # Hardcode the library path.
6019 # Skip directories that are in the system default run-time
6020 # search path.
6021 case " $sys_lib_dlsearch_path " in
6022 *" $absdir "*) ;;
6024 case "$compile_rpath " in
6025 *" $absdir "*) ;;
6026 *) compile_rpath="$compile_rpath $absdir"
6027 esac
6029 esac
6030 case " $sys_lib_dlsearch_path " in
6031 *" $libdir "*) ;;
6033 case "$finalize_rpath " in
6034 *" $libdir "*) ;;
6035 *) finalize_rpath="$finalize_rpath $libdir"
6036 esac
6038 esac
6039 fi # $linkmode,$pass = prog,link...
6041 if test "$alldeplibs" = yes &&
6042 { test "$deplibs_check_method" = pass_all ||
6043 { test "$build_libtool_libs" = yes &&
6044 test -n "$library_names"; }; }; then
6045 # We only need to search for static libraries
6046 continue
6050 link_static=no # Whether the deplib will be linked statically
6051 use_static_libs=$prefer_static_libs
6052 if test "$use_static_libs" = built && test "$installed" = yes; then
6053 use_static_libs=no
6055 if test -n "$library_names" &&
6056 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6057 case $host in
6058 *cygwin* | *mingw* | *cegcc*)
6059 # No point in relinking DLLs because paths are not encoded
6060 notinst_deplibs="$notinst_deplibs $lib"
6061 need_relink=no
6064 if test "$installed" = no; then
6065 notinst_deplibs="$notinst_deplibs $lib"
6066 need_relink=yes
6069 esac
6070 # This is a shared library
6072 # Warn about portability, can't link against -module's on some
6073 # systems (darwin). Don't bleat about dlopened modules though!
6074 dlopenmodule=""
6075 for dlpremoduletest in $dlprefiles; do
6076 if test "X$dlpremoduletest" = "X$lib"; then
6077 dlopenmodule="$dlpremoduletest"
6078 break
6080 done
6081 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6082 $ECHO
6083 if test "$linkmode" = prog; then
6084 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6085 else
6086 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6088 $ECHO "*** $linklib is not portable!"
6090 if test "$linkmode" = lib &&
6091 test "$hardcode_into_libs" = yes; then
6092 # Hardcode the library path.
6093 # Skip directories that are in the system default run-time
6094 # search path.
6095 case " $sys_lib_dlsearch_path " in
6096 *" $absdir "*) ;;
6098 case "$compile_rpath " in
6099 *" $absdir "*) ;;
6100 *) compile_rpath="$compile_rpath $absdir"
6101 esac
6103 esac
6104 case " $sys_lib_dlsearch_path " in
6105 *" $libdir "*) ;;
6107 case "$finalize_rpath " in
6108 *" $libdir "*) ;;
6109 *) finalize_rpath="$finalize_rpath $libdir"
6110 esac
6112 esac
6115 if test -n "$old_archive_from_expsyms_cmds"; then
6116 # figure out the soname
6117 set dummy $library_names
6118 shift
6119 realname="$1"
6120 shift
6121 libname=`eval "\\$ECHO \"$libname_spec\""`
6122 # use dlname if we got it. it's perfectly good, no?
6123 if test -n "$dlname"; then
6124 soname="$dlname"
6125 elif test -n "$soname_spec"; then
6126 # bleh windows
6127 case $host in
6128 *cygwin* | mingw* | *cegcc*)
6129 func_arith $current - $age
6130 major=$func_arith_result
6131 versuffix="-$major"
6133 esac
6134 eval soname=\"$soname_spec\"
6135 else
6136 soname="$realname"
6139 # Make a new name for the extract_expsyms_cmds to use
6140 soroot="$soname"
6141 func_basename "$soroot"
6142 soname="$func_basename_result"
6143 func_stripname 'lib' '.dll' "$soname"
6144 newlib=libimp-$func_stripname_result.a
6146 # If the library has no export list, then create one now
6147 if test -f "$output_objdir/$soname-def"; then :
6148 else
6149 func_verbose "extracting exported symbol list from \`$soname'"
6150 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6153 # Create $newlib
6154 if test -f "$output_objdir/$newlib"; then :; else
6155 func_verbose "generating import library for \`$soname'"
6156 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6158 # make sure the library variables are pointing to the new library
6159 dir=$output_objdir
6160 linklib=$newlib
6161 fi # test -n "$old_archive_from_expsyms_cmds"
6163 if test "$linkmode" = prog || test "$mode" != relink; then
6164 add_shlibpath=
6165 add_dir=
6166 add=
6167 lib_linked=yes
6168 case $hardcode_action in
6169 immediate | unsupported)
6170 if test "$hardcode_direct" = no; then
6171 add="$dir/$linklib"
6172 case $host in
6173 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6174 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6175 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6176 *-*-unixware7*) add_dir="-L$dir" ;;
6177 *-*-darwin* )
6178 # if the lib is a (non-dlopened) module then we can not
6179 # link against it, someone is ignoring the earlier warnings
6180 if /usr/bin/file -L $add 2> /dev/null |
6181 $GREP ": [^:]* bundle" >/dev/null ; then
6182 if test "X$dlopenmodule" != "X$lib"; then
6183 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6184 if test -z "$old_library" ; then
6185 $ECHO
6186 $ECHO "*** And there doesn't seem to be a static archive available"
6187 $ECHO "*** The link will probably fail, sorry"
6188 else
6189 add="$dir/$old_library"
6191 elif test -n "$old_library"; then
6192 add="$dir/$old_library"
6195 esac
6196 elif test "$hardcode_minus_L" = no; then
6197 case $host in
6198 *-*-sunos*) add_shlibpath="$dir" ;;
6199 esac
6200 add_dir="-L$dir"
6201 add="-l$name"
6202 elif test "$hardcode_shlibpath_var" = no; then
6203 add_shlibpath="$dir"
6204 add="-l$name"
6205 else
6206 lib_linked=no
6209 relink)
6210 if test "$hardcode_direct" = yes &&
6211 test "$hardcode_direct_absolute" = no; then
6212 add="$dir/$linklib"
6213 elif test "$hardcode_minus_L" = yes; then
6214 add_dir="-L$dir"
6215 # Try looking first in the location we're being installed to.
6216 if test -n "$inst_prefix_dir"; then
6217 case $libdir in
6218 [\\/]*)
6219 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6221 esac
6223 add="-l$name"
6224 elif test "$hardcode_shlibpath_var" = yes; then
6225 add_shlibpath="$dir"
6226 add="-l$name"
6227 else
6228 lib_linked=no
6231 *) lib_linked=no ;;
6232 esac
6234 if test "$lib_linked" != yes; then
6235 func_fatal_configuration "unsupported hardcode properties"
6238 if test -n "$add_shlibpath"; then
6239 case :$compile_shlibpath: in
6240 *":$add_shlibpath:"*) ;;
6241 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
6242 esac
6244 if test "$linkmode" = prog; then
6245 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6246 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6247 else
6248 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6249 test -n "$add" && deplibs="$add $deplibs"
6250 if test "$hardcode_direct" != yes &&
6251 test "$hardcode_minus_L" != yes &&
6252 test "$hardcode_shlibpath_var" = yes; then
6253 case :$finalize_shlibpath: in
6254 *":$libdir:"*) ;;
6255 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6256 esac
6261 if test "$linkmode" = prog || test "$mode" = relink; then
6262 add_shlibpath=
6263 add_dir=
6264 add=
6265 # Finalize command for both is simple: just hardcode it.
6266 if test "$hardcode_direct" = yes &&
6267 test "$hardcode_direct_absolute" = no; then
6268 add="$libdir/$linklib"
6269 elif test "$hardcode_minus_L" = yes; then
6270 add_dir="-L$libdir"
6271 add="-l$name"
6272 elif test "$hardcode_shlibpath_var" = yes; then
6273 case :$finalize_shlibpath: in
6274 *":$libdir:"*) ;;
6275 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6276 esac
6277 add="-l$name"
6278 elif test "$hardcode_automatic" = yes; then
6279 if test -n "$inst_prefix_dir" &&
6280 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6281 add="$inst_prefix_dir$libdir/$linklib"
6282 else
6283 add="$libdir/$linklib"
6285 else
6286 # We cannot seem to hardcode it, guess we'll fake it.
6287 add_dir="-L$libdir"
6288 # Try looking first in the location we're being installed to.
6289 if test -n "$inst_prefix_dir"; then
6290 case $libdir in
6291 [\\/]*)
6292 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6294 esac
6296 add="-l$name"
6299 if test "$linkmode" = prog; then
6300 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6301 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6302 else
6303 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6304 test -n "$add" && deplibs="$add $deplibs"
6307 elif test "$linkmode" = prog; then
6308 # Here we assume that one of hardcode_direct or hardcode_minus_L
6309 # is not unsupported. This is valid on all known static and
6310 # shared platforms.
6311 if test "$hardcode_direct" != unsupported; then
6312 test -n "$old_library" && linklib="$old_library"
6313 compile_deplibs="$dir/$linklib $compile_deplibs"
6314 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6315 else
6316 compile_deplibs="-l$name -L$dir $compile_deplibs"
6317 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6319 elif test "$build_libtool_libs" = yes; then
6320 # Not a shared library
6321 if test "$deplibs_check_method" != pass_all; then
6322 # We're trying link a shared library against a static one
6323 # but the system doesn't support it.
6325 # Just print a warning and add the library to dependency_libs so
6326 # that the program can be linked against the static library.
6327 $ECHO
6328 $ECHO "*** Warning: This system can not link to static lib archive $lib."
6329 $ECHO "*** I have the capability to make that library automatically link in when"
6330 $ECHO "*** you link to this library. But I can only do this if you have a"
6331 $ECHO "*** shared version of the library, which you do not appear to have."
6332 if test "$module" = yes; then
6333 $ECHO "*** But as you try to build a module library, libtool will still create "
6334 $ECHO "*** a static module, that should work as long as the dlopening application"
6335 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
6336 if test -z "$global_symbol_pipe"; then
6337 $ECHO
6338 $ECHO "*** However, this would only work if libtool was able to extract symbol"
6339 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6340 $ECHO "*** not find such a program. So, this module is probably useless."
6341 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6343 if test "$build_old_libs" = no; then
6344 build_libtool_libs=module
6345 build_old_libs=yes
6346 else
6347 build_libtool_libs=no
6350 else
6351 deplibs="$dir/$old_library $deplibs"
6352 link_static=yes
6354 fi # link shared/static library?
6356 if test "$linkmode" = lib; then
6357 if test -n "$dependency_libs" &&
6358 { test "$hardcode_into_libs" != yes ||
6359 test "$build_old_libs" = yes ||
6360 test "$link_static" = yes; }; then
6361 # Extract -R from dependency_libs
6362 temp_deplibs=
6363 for libdir in $dependency_libs; do
6364 case $libdir in
6365 -R*) func_stripname '-R' '' "$libdir"
6366 temp_xrpath=$func_stripname_result
6367 case " $xrpath " in
6368 *" $temp_xrpath "*) ;;
6369 *) xrpath="$xrpath $temp_xrpath";;
6370 esac;;
6371 *) temp_deplibs="$temp_deplibs $libdir";;
6372 esac
6373 done
6374 dependency_libs="$temp_deplibs"
6377 newlib_search_path="$newlib_search_path $absdir"
6378 # Link against this library
6379 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6380 # ... and its dependency_libs
6381 tmp_libs=
6382 for deplib in $dependency_libs; do
6383 newdependency_libs="$deplib $newdependency_libs"
6384 if $opt_duplicate_deps ; then
6385 case "$tmp_libs " in
6386 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6387 esac
6389 tmp_libs="$tmp_libs $deplib"
6390 done
6392 if test "$link_all_deplibs" != no; then
6393 # Add the search paths of all dependency libraries
6394 for deplib in $dependency_libs; do
6395 case $deplib in
6396 -L*) path="$deplib" ;;
6397 *.la)
6398 func_dirname "$deplib" "" "."
6399 dir="$func_dirname_result"
6400 # We need an absolute path.
6401 case $dir in
6402 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
6404 absdir=`cd "$dir" && pwd`
6405 if test -z "$absdir"; then
6406 func_warning "cannot determine absolute directory name of \`$dir'"
6407 absdir="$dir"
6410 esac
6411 if $GREP "^installed=no" $deplib > /dev/null; then
6412 case $host in
6413 *-*-darwin*)
6414 depdepl=
6415 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
6416 if test -n "$deplibrary_names" ; then
6417 for tmp in $deplibrary_names ; do
6418 depdepl=$tmp
6419 done
6420 if test -f "$absdir/$objdir/$depdepl" ; then
6421 depdepl="$absdir/$objdir/$depdepl"
6422 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6423 if test -z "$darwin_install_name"; then
6424 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6426 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
6427 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
6428 path=
6433 path="-L$absdir/$objdir"
6435 esac
6436 else
6437 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6438 test -z "$libdir" && \
6439 func_fatal_error "\`$deplib' is not a valid libtool archive"
6440 test "$absdir" != "$libdir" && \
6441 func_warning "\`$deplib' seems to be moved"
6443 path="-L$absdir"
6446 esac
6447 case " $deplibs " in
6448 *" $path "*) ;;
6449 *) deplibs="$path $deplibs" ;;
6450 esac
6451 done
6452 fi # link_all_deplibs != no
6453 fi # linkmode = lib
6454 done # for deplib in $libs
6455 if test "$pass" = link; then
6456 if test "$linkmode" = "prog"; then
6457 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
6458 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
6459 else
6460 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6463 dependency_libs="$newdependency_libs"
6464 if test "$pass" = dlpreopen; then
6465 # Link the dlpreopened libraries before other libraries
6466 for deplib in $save_deplibs; do
6467 deplibs="$deplib $deplibs"
6468 done
6470 if test "$pass" != dlopen; then
6471 if test "$pass" != conv; then
6472 # Make sure lib_search_path contains only unique directories.
6473 lib_search_path=
6474 for dir in $newlib_search_path; do
6475 case "$lib_search_path " in
6476 *" $dir "*) ;;
6477 *) lib_search_path="$lib_search_path $dir" ;;
6478 esac
6479 done
6480 newlib_search_path=
6483 if test "$linkmode,$pass" != "prog,link"; then
6484 vars="deplibs"
6485 else
6486 vars="compile_deplibs finalize_deplibs"
6488 for var in $vars dependency_libs; do
6489 # Add libraries to $var in reverse order
6490 eval tmp_libs=\"\$$var\"
6491 new_libs=
6492 for deplib in $tmp_libs; do
6493 # FIXME: Pedantically, this is the right thing to do, so
6494 # that some nasty dependency loop isn't accidentally
6495 # broken:
6496 #new_libs="$deplib $new_libs"
6497 # Pragmatically, this seems to cause very few problems in
6498 # practice:
6499 case $deplib in
6500 -L*) new_libs="$deplib $new_libs" ;;
6501 -R*) ;;
6503 # And here is the reason: when a library appears more
6504 # than once as an explicit dependence of a library, or
6505 # is implicitly linked in more than once by the
6506 # compiler, it is considered special, and multiple
6507 # occurrences thereof are not removed. Compare this
6508 # with having the same library being listed as a
6509 # dependency of multiple other libraries: in this case,
6510 # we know (pedantically, we assume) the library does not
6511 # need to be listed more than once, so we keep only the
6512 # last copy. This is not always right, but it is rare
6513 # enough that we require users that really mean to play
6514 # such unportable linking tricks to link the library
6515 # using -Wl,-lname, so that libtool does not consider it
6516 # for duplicate removal.
6517 case " $specialdeplibs " in
6518 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6520 case " $new_libs " in
6521 *" $deplib "*) ;;
6522 *) new_libs="$deplib $new_libs" ;;
6523 esac
6525 esac
6527 esac
6528 done
6529 tmp_libs=
6530 for deplib in $new_libs; do
6531 case $deplib in
6532 -L*)
6533 case " $tmp_libs " in
6534 *" $deplib "*) ;;
6535 *) tmp_libs="$tmp_libs $deplib" ;;
6536 esac
6538 *) tmp_libs="$tmp_libs $deplib" ;;
6539 esac
6540 done
6541 eval $var=\"$tmp_libs\"
6542 done # for var
6544 # Last step: remove runtime libs from dependency_libs
6545 # (they stay in deplibs)
6546 tmp_libs=
6547 for i in $dependency_libs ; do
6548 case " $predeps $postdeps $compiler_lib_search_path " in
6549 *" $i "*)
6550 i=""
6552 esac
6553 if test -n "$i" ; then
6554 tmp_libs="$tmp_libs $i"
6556 done
6557 dependency_libs=$tmp_libs
6558 done # for pass
6559 if test "$linkmode" = prog; then
6560 dlfiles="$newdlfiles"
6562 if test "$linkmode" = prog || test "$linkmode" = lib; then
6563 dlprefiles="$newdlprefiles"
6566 case $linkmode in
6567 oldlib)
6568 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6569 func_warning "\`-dlopen' is ignored for archives"
6572 case " $deplibs" in
6573 *\ -l* | *\ -L*)
6574 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6575 esac
6577 test -n "$rpath" && \
6578 func_warning "\`-rpath' is ignored for archives"
6580 test -n "$xrpath" && \
6581 func_warning "\`-R' is ignored for archives"
6583 test -n "$vinfo" && \
6584 func_warning "\`-version-info/-version-number' is ignored for archives"
6586 test -n "$release" && \
6587 func_warning "\`-release' is ignored for archives"
6589 test -n "$export_symbols$export_symbols_regex" && \
6590 func_warning "\`-export-symbols' is ignored for archives"
6592 # Now set the variables for building old libraries.
6593 build_libtool_libs=no
6594 oldlibs="$output"
6595 objs="$objs$old_deplibs"
6598 lib)
6599 # Make sure we only generate libraries of the form `libNAME.la'.
6600 case $outputname in
6601 lib*)
6602 func_stripname 'lib' '.la' "$outputname"
6603 name=$func_stripname_result
6604 eval shared_ext=\"$shrext_cmds\"
6605 eval libname=\"$libname_spec\"
6608 test "$module" = no && \
6609 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6611 if test "$need_lib_prefix" != no; then
6612 # Add the "lib" prefix for modules if required
6613 func_stripname '' '.la' "$outputname"
6614 name=$func_stripname_result
6615 eval shared_ext=\"$shrext_cmds\"
6616 eval libname=\"$libname_spec\"
6617 else
6618 func_stripname '' '.la' "$outputname"
6619 libname=$func_stripname_result
6622 esac
6624 if test -n "$objs"; then
6625 if test "$deplibs_check_method" != pass_all; then
6626 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6627 else
6628 $ECHO
6629 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6630 $ECHO "*** objects $objs is not portable!"
6631 libobjs="$libobjs $objs"
6635 test "$dlself" != no && \
6636 func_warning "\`-dlopen self' is ignored for libtool libraries"
6638 set dummy $rpath
6639 shift
6640 test "$#" -gt 1 && \
6641 func_warning "ignoring multiple \`-rpath's for a libtool library"
6643 install_libdir="$1"
6645 oldlibs=
6646 if test -z "$rpath"; then
6647 if test "$build_libtool_libs" = yes; then
6648 # Building a libtool convenience library.
6649 # Some compilers have problems with a `.al' extension so
6650 # convenience libraries should have the same extension an
6651 # archive normally would.
6652 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6653 build_libtool_libs=convenience
6654 build_old_libs=yes
6657 test -n "$vinfo" && \
6658 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6660 test -n "$release" && \
6661 func_warning "\`-release' is ignored for convenience libraries"
6662 else
6664 # Parse the version information argument.
6665 save_ifs="$IFS"; IFS=':'
6666 set dummy $vinfo 0 0 0
6667 shift
6668 IFS="$save_ifs"
6670 test -n "$7" && \
6671 func_fatal_help "too many parameters to \`-version-info'"
6673 # convert absolute version numbers to libtool ages
6674 # this retains compatibility with .la files and attempts
6675 # to make the code below a bit more comprehensible
6677 case $vinfo_number in
6678 yes)
6679 number_major="$1"
6680 number_minor="$2"
6681 number_revision="$3"
6683 # There are really only two kinds -- those that
6684 # use the current revision as the major version
6685 # and those that subtract age and use age as
6686 # a minor version. But, then there is irix
6687 # which has an extra 1 added just for fun
6689 case $version_type in
6690 darwin|linux|osf|windows|none)
6691 func_arith $number_major + $number_minor
6692 current=$func_arith_result
6693 age="$number_minor"
6694 revision="$number_revision"
6696 freebsd-aout|freebsd-elf|sunos)
6697 current="$number_major"
6698 revision="$number_minor"
6699 age="0"
6701 irix|nonstopux)
6702 func_arith $number_major + $number_minor
6703 current=$func_arith_result
6704 age="$number_minor"
6705 revision="$number_minor"
6706 lt_irix_increment=no
6708 esac
6711 current="$1"
6712 revision="$2"
6713 age="$3"
6715 esac
6717 # Check that each of the things are valid numbers.
6718 case $current in
6719 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]) ;;
6721 func_error "CURRENT \`$current' must be a nonnegative integer"
6722 func_fatal_error "\`$vinfo' is not valid version information"
6724 esac
6726 case $revision in
6727 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]) ;;
6729 func_error "REVISION \`$revision' must be a nonnegative integer"
6730 func_fatal_error "\`$vinfo' is not valid version information"
6732 esac
6734 case $age in
6735 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]) ;;
6737 func_error "AGE \`$age' must be a nonnegative integer"
6738 func_fatal_error "\`$vinfo' is not valid version information"
6740 esac
6742 if test "$age" -gt "$current"; then
6743 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6744 func_fatal_error "\`$vinfo' is not valid version information"
6747 # Calculate the version variables.
6748 major=
6749 versuffix=
6750 verstring=
6751 case $version_type in
6752 none) ;;
6754 darwin)
6755 # Like Linux, but with the current version available in
6756 # verstring for coding it into the library header
6757 func_arith $current - $age
6758 major=.$func_arith_result
6759 versuffix="$major.$age.$revision"
6760 # Darwin ld doesn't like 0 for these options...
6761 func_arith $current + 1
6762 minor_current=$func_arith_result
6763 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6764 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6767 freebsd-aout)
6768 major=".$current"
6769 versuffix=".$current.$revision";
6772 freebsd-elf)
6773 major=".$current"
6774 versuffix=".$current"
6777 irix | nonstopux)
6778 if test "X$lt_irix_increment" = "Xno"; then
6779 func_arith $current - $age
6780 else
6781 func_arith $current - $age + 1
6783 major=$func_arith_result
6785 case $version_type in
6786 nonstopux) verstring_prefix=nonstopux ;;
6787 *) verstring_prefix=sgi ;;
6788 esac
6789 verstring="$verstring_prefix$major.$revision"
6791 # Add in all the interfaces that we are compatible with.
6792 loop=$revision
6793 while test "$loop" -ne 0; do
6794 func_arith $revision - $loop
6795 iface=$func_arith_result
6796 func_arith $loop - 1
6797 loop=$func_arith_result
6798 verstring="$verstring_prefix$major.$iface:$verstring"
6799 done
6801 # Before this point, $major must not contain `.'.
6802 major=.$major
6803 versuffix="$major.$revision"
6806 linux)
6807 func_arith $current - $age
6808 major=.$func_arith_result
6809 versuffix="$major.$age.$revision"
6812 osf)
6813 func_arith $current - $age
6814 major=.$func_arith_result
6815 versuffix=".$current.$age.$revision"
6816 verstring="$current.$age.$revision"
6818 # Add in all the interfaces that we are compatible with.
6819 loop=$age
6820 while test "$loop" -ne 0; do
6821 func_arith $current - $loop
6822 iface=$func_arith_result
6823 func_arith $loop - 1
6824 loop=$func_arith_result
6825 verstring="$verstring:${iface}.0"
6826 done
6828 # Make executables depend on our current version.
6829 verstring="$verstring:${current}.0"
6832 qnx)
6833 major=".$current"
6834 versuffix=".$current"
6837 sunos)
6838 major=".$current"
6839 versuffix=".$current.$revision"
6842 windows)
6843 # Use '-' rather than '.', since we only want one
6844 # extension on DOS 8.3 filesystems.
6845 func_arith $current - $age
6846 major=$func_arith_result
6847 versuffix="-$major"
6851 func_fatal_configuration "unknown library version type \`$version_type'"
6853 esac
6855 # Clear the version info if we defaulted, and they specified a release.
6856 if test -z "$vinfo" && test -n "$release"; then
6857 major=
6858 case $version_type in
6859 darwin)
6860 # we can't check for "0.0" in archive_cmds due to quoting
6861 # problems, so we reset it completely
6862 verstring=
6865 verstring="0.0"
6867 esac
6868 if test "$need_version" = no; then
6869 versuffix=
6870 else
6871 versuffix=".0.0"
6875 # Remove version info from name if versioning should be avoided
6876 if test "$avoid_version" = yes && test "$need_version" = no; then
6877 major=
6878 versuffix=
6879 verstring=""
6882 # Check to see if the archive will have undefined symbols.
6883 if test "$allow_undefined" = yes; then
6884 if test "$allow_undefined_flag" = unsupported; then
6885 func_warning "undefined symbols not allowed in $host shared libraries"
6886 build_libtool_libs=no
6887 build_old_libs=yes
6889 else
6890 # Don't allow undefined symbols.
6891 allow_undefined_flag="$no_undefined_flag"
6896 func_generate_dlsyms "$libname" "$libname" "yes"
6897 libobjs="$libobjs $symfileobj"
6898 test "X$libobjs" = "X " && libobjs=
6900 if test "$mode" != relink; then
6901 # Remove our outputs, but don't remove object files since they
6902 # may have been created when compiling PIC objects.
6903 removelist=
6904 tempremovelist=`$ECHO "$output_objdir/*"`
6905 for p in $tempremovelist; do
6906 case $p in
6907 *.$objext | *.gcno)
6909 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
6910 if test "X$precious_files_regex" != "X"; then
6911 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6912 then
6913 continue
6916 removelist="$removelist $p"
6918 *) ;;
6919 esac
6920 done
6921 test -n "$removelist" && \
6922 func_show_eval "${RM}r \$removelist"
6925 # Now set the variables for building old libraries.
6926 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
6927 oldlibs="$oldlibs $output_objdir/$libname.$libext"
6929 # Transform .lo files to .o files.
6930 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
6933 # Eliminate all temporary directories.
6934 #for path in $notinst_path; do
6935 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
6936 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
6937 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
6938 #done
6940 if test -n "$xrpath"; then
6941 # If the user specified any rpath flags, then add them.
6942 temp_xrpath=
6943 for libdir in $xrpath; do
6944 temp_xrpath="$temp_xrpath -R$libdir"
6945 case "$finalize_rpath " in
6946 *" $libdir "*) ;;
6947 *) finalize_rpath="$finalize_rpath $libdir" ;;
6948 esac
6949 done
6950 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
6951 dependency_libs="$temp_xrpath $dependency_libs"
6955 # Make sure dlfiles contains only unique files that won't be dlpreopened
6956 old_dlfiles="$dlfiles"
6957 dlfiles=
6958 for lib in $old_dlfiles; do
6959 case " $dlprefiles $dlfiles " in
6960 *" $lib "*) ;;
6961 *) dlfiles="$dlfiles $lib" ;;
6962 esac
6963 done
6965 # Make sure dlprefiles contains only unique files
6966 old_dlprefiles="$dlprefiles"
6967 dlprefiles=
6968 for lib in $old_dlprefiles; do
6969 case "$dlprefiles " in
6970 *" $lib "*) ;;
6971 *) dlprefiles="$dlprefiles $lib" ;;
6972 esac
6973 done
6975 if test "$build_libtool_libs" = yes; then
6976 if test -n "$rpath"; then
6977 case $host in
6978 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
6979 # these systems don't actually have a c library (as such)!
6981 *-*-rhapsody* | *-*-darwin1.[012])
6982 # Rhapsody C library is in the System framework
6983 deplibs="$deplibs System.ltframework"
6985 *-*-netbsd*)
6986 # Don't link with libc until the a.out ld.so is fixed.
6988 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6989 # Do not include libc due to us having libc/libc_r.
6991 *-*-sco3.2v5* | *-*-sco5v6*)
6992 # Causes problems with __ctype
6994 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6995 # Compiler inserts libc in the correct place for threads to work
6998 # Add libc to deplibs on all other systems if necessary.
6999 if test "$build_libtool_need_lc" = "yes"; then
7000 deplibs="$deplibs -lc"
7003 esac
7006 # Transform deplibs into only deplibs that can be linked in shared.
7007 name_save=$name
7008 libname_save=$libname
7009 release_save=$release
7010 versuffix_save=$versuffix
7011 major_save=$major
7012 # I'm not sure if I'm treating the release correctly. I think
7013 # release should show up in the -l (ie -lgmp5) so we don't want to
7014 # add it in twice. Is that correct?
7015 release=""
7016 versuffix=""
7017 major=""
7018 newdeplibs=
7019 droppeddeps=no
7020 case $deplibs_check_method in
7021 pass_all)
7022 # Don't check for shared/static. Everything works.
7023 # This might be a little naive. We might want to check
7024 # whether the library exists or not. But this is on
7025 # osf3 & osf4 and I'm not really sure... Just
7026 # implementing what was already the behavior.
7027 newdeplibs=$deplibs
7029 test_compile)
7030 # This code stresses the "libraries are programs" paradigm to its
7031 # limits. Maybe even breaks it. We compile a program, linking it
7032 # against the deplibs as a proxy for the library. Then we can check
7033 # whether they linked in statically or dynamically with ldd.
7034 $opt_dry_run || $RM conftest.c
7035 cat > conftest.c <<EOF
7036 int main() { return 0; }
7038 $opt_dry_run || $RM conftest
7039 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7040 ldd_output=`ldd conftest`
7041 for i in $deplibs; do
7042 case $i in
7043 -l*)
7044 func_stripname -l '' "$i"
7045 name=$func_stripname_result
7046 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7047 case " $predeps $postdeps " in
7048 *" $i "*)
7049 newdeplibs="$newdeplibs $i"
7050 i=""
7052 esac
7054 if test -n "$i" ; then
7055 libname=`eval "\\$ECHO \"$libname_spec\""`
7056 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7057 set dummy $deplib_matches; shift
7058 deplib_match=$1
7059 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7060 newdeplibs="$newdeplibs $i"
7061 else
7062 droppeddeps=yes
7063 $ECHO
7064 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7065 $ECHO "*** I have the capability to make that library automatically link in when"
7066 $ECHO "*** you link to this library. But I can only do this if you have a"
7067 $ECHO "*** shared version of the library, which I believe you do not have"
7068 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
7069 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
7074 newdeplibs="$newdeplibs $i"
7076 esac
7077 done
7078 else
7079 # Error occurred in the first compile. Let's try to salvage
7080 # the situation: Compile a separate program for each library.
7081 for i in $deplibs; do
7082 case $i in
7083 -l*)
7084 func_stripname -l '' "$i"
7085 name=$func_stripname_result
7086 $opt_dry_run || $RM conftest
7087 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7088 ldd_output=`ldd conftest`
7089 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7090 case " $predeps $postdeps " in
7091 *" $i "*)
7092 newdeplibs="$newdeplibs $i"
7093 i=""
7095 esac
7097 if test -n "$i" ; then
7098 libname=`eval "\\$ECHO \"$libname_spec\""`
7099 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7100 set dummy $deplib_matches; shift
7101 deplib_match=$1
7102 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7103 newdeplibs="$newdeplibs $i"
7104 else
7105 droppeddeps=yes
7106 $ECHO
7107 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7108 $ECHO "*** I have the capability to make that library automatically link in when"
7109 $ECHO "*** you link to this library. But I can only do this if you have a"
7110 $ECHO "*** shared version of the library, which you do not appear to have"
7111 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
7112 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
7115 else
7116 droppeddeps=yes
7117 $ECHO
7118 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7119 $ECHO "*** make it link in! You will probably need to install it or some"
7120 $ECHO "*** library that it depends on before this library will be fully"
7121 $ECHO "*** functional. Installing it before continuing would be even better."
7125 newdeplibs="$newdeplibs $i"
7127 esac
7128 done
7131 file_magic*)
7132 set dummy $deplibs_check_method; shift
7133 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7134 for a_deplib in $deplibs; do
7135 case $a_deplib in
7136 -l*)
7137 func_stripname -l '' "$a_deplib"
7138 name=$func_stripname_result
7139 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7140 case " $predeps $postdeps " in
7141 *" $a_deplib "*)
7142 newdeplibs="$newdeplibs $a_deplib"
7143 a_deplib=""
7145 esac
7147 if test -n "$a_deplib" ; then
7148 libname=`eval "\\$ECHO \"$libname_spec\""`
7149 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7150 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7151 for potent_lib in $potential_libs; do
7152 # Follow soft links.
7153 if ls -lLd "$potent_lib" 2>/dev/null |
7154 $GREP " -> " >/dev/null; then
7155 continue
7157 # The statement above tries to avoid entering an
7158 # endless loop below, in case of cyclic links.
7159 # We might still enter an endless loop, since a link
7160 # loop can be closed while we follow links,
7161 # but so what?
7162 potlib="$potent_lib"
7163 while test -h "$potlib" 2>/dev/null; do
7164 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7165 case $potliblink in
7166 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7167 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
7168 esac
7169 done
7170 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7171 $SED -e 10q |
7172 $EGREP "$file_magic_regex" > /dev/null; then
7173 newdeplibs="$newdeplibs $a_deplib"
7174 a_deplib=""
7175 break 2
7177 done
7178 done
7180 if test -n "$a_deplib" ; then
7181 droppeddeps=yes
7182 $ECHO
7183 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7184 $ECHO "*** I have the capability to make that library automatically link in when"
7185 $ECHO "*** you link to this library. But I can only do this if you have a"
7186 $ECHO "*** shared version of the library, which you do not appear to have"
7187 $ECHO "*** because I did check the linker path looking for a file starting"
7188 if test -z "$potlib" ; then
7189 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7190 else
7191 $ECHO "*** with $libname and none of the candidates passed a file format test"
7192 $ECHO "*** using a file magic. Last file checked: $potlib"
7197 # Add a -L argument.
7198 newdeplibs="$newdeplibs $a_deplib"
7200 esac
7201 done # Gone through all deplibs.
7203 match_pattern*)
7204 set dummy $deplibs_check_method; shift
7205 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7206 for a_deplib in $deplibs; do
7207 case $a_deplib in
7208 -l*)
7209 func_stripname -l '' "$a_deplib"
7210 name=$func_stripname_result
7211 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7212 case " $predeps $postdeps " in
7213 *" $a_deplib "*)
7214 newdeplibs="$newdeplibs $a_deplib"
7215 a_deplib=""
7217 esac
7219 if test -n "$a_deplib" ; then
7220 libname=`eval "\\$ECHO \"$libname_spec\""`
7221 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7222 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7223 for potent_lib in $potential_libs; do
7224 potlib="$potent_lib" # see symlink-check above in file_magic test
7225 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
7226 $EGREP "$match_pattern_regex" > /dev/null; then
7227 newdeplibs="$newdeplibs $a_deplib"
7228 a_deplib=""
7229 break 2
7231 done
7232 done
7234 if test -n "$a_deplib" ; then
7235 droppeddeps=yes
7236 $ECHO
7237 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7238 $ECHO "*** I have the capability to make that library automatically link in when"
7239 $ECHO "*** you link to this library. But I can only do this if you have a"
7240 $ECHO "*** shared version of the library, which you do not appear to have"
7241 $ECHO "*** because I did check the linker path looking for a file starting"
7242 if test -z "$potlib" ; then
7243 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7244 else
7245 $ECHO "*** with $libname and none of the candidates passed a file format test"
7246 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7251 # Add a -L argument.
7252 newdeplibs="$newdeplibs $a_deplib"
7254 esac
7255 done # Gone through all deplibs.
7257 none | unknown | *)
7258 newdeplibs=""
7259 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
7260 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
7261 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7262 for i in $predeps $postdeps ; do
7263 # can't use Xsed below, because $i might contain '/'
7264 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
7265 done
7267 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
7268 $GREP . >/dev/null; then
7269 $ECHO
7270 if test "X$deplibs_check_method" = "Xnone"; then
7271 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
7272 else
7273 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
7275 $ECHO "*** All declared inter-library dependencies are being dropped."
7276 droppeddeps=yes
7279 esac
7280 versuffix=$versuffix_save
7281 major=$major_save
7282 release=$release_save
7283 libname=$libname_save
7284 name=$name_save
7286 case $host in
7287 *-*-rhapsody* | *-*-darwin1.[012])
7288 # On Rhapsody replace the C library with the System framework
7289 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7291 esac
7293 if test "$droppeddeps" = yes; then
7294 if test "$module" = yes; then
7295 $ECHO
7296 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
7297 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7298 $ECHO "*** a static module, that should work as long as the dlopening"
7299 $ECHO "*** application is linked with the -dlopen flag."
7300 if test -z "$global_symbol_pipe"; then
7301 $ECHO
7302 $ECHO "*** However, this would only work if libtool was able to extract symbol"
7303 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
7304 $ECHO "*** not find such a program. So, this module is probably useless."
7305 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
7307 if test "$build_old_libs" = no; then
7308 oldlibs="$output_objdir/$libname.$libext"
7309 build_libtool_libs=module
7310 build_old_libs=yes
7311 else
7312 build_libtool_libs=no
7314 else
7315 $ECHO "*** The inter-library dependencies that have been dropped here will be"
7316 $ECHO "*** automatically added whenever a program is linked with this library"
7317 $ECHO "*** or is declared to -dlopen it."
7319 if test "$allow_undefined" = no; then
7320 $ECHO
7321 $ECHO "*** Since this library must not contain undefined symbols,"
7322 $ECHO "*** because either the platform does not support them or"
7323 $ECHO "*** it was explicitly requested with -no-undefined,"
7324 $ECHO "*** libtool will only create a static version of it."
7325 if test "$build_old_libs" = no; then
7326 oldlibs="$output_objdir/$libname.$libext"
7327 build_libtool_libs=module
7328 build_old_libs=yes
7329 else
7330 build_libtool_libs=no
7335 # Done checking deplibs!
7336 deplibs=$newdeplibs
7338 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7339 case $host in
7340 *-*-darwin*)
7341 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7342 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7343 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7345 esac
7347 # move library search paths that coincide with paths to not yet
7348 # installed libraries to the beginning of the library search list
7349 new_libs=
7350 for path in $notinst_path; do
7351 case " $new_libs " in
7352 *" -L$path/$objdir "*) ;;
7354 case " $deplibs " in
7355 *" -L$path/$objdir "*)
7356 new_libs="$new_libs -L$path/$objdir" ;;
7357 esac
7359 esac
7360 done
7361 for deplib in $deplibs; do
7362 case $deplib in
7363 -L*)
7364 case " $new_libs " in
7365 *" $deplib "*) ;;
7366 *) new_libs="$new_libs $deplib" ;;
7367 esac
7369 *) new_libs="$new_libs $deplib" ;;
7370 esac
7371 done
7372 deplibs="$new_libs"
7374 # All the library-specific variables (install_libdir is set above).
7375 library_names=
7376 old_library=
7377 dlname=
7379 # Test again, we may have decided not to build it any more
7380 if test "$build_libtool_libs" = yes; then
7381 if test "$hardcode_into_libs" = yes; then
7382 # Hardcode the library paths
7383 hardcode_libdirs=
7384 dep_rpath=
7385 rpath="$finalize_rpath"
7386 test "$mode" != relink && rpath="$compile_rpath$rpath"
7387 for libdir in $rpath; do
7388 if test -n "$hardcode_libdir_flag_spec"; then
7389 if test -n "$hardcode_libdir_separator"; then
7390 if test -z "$hardcode_libdirs"; then
7391 hardcode_libdirs="$libdir"
7392 else
7393 # Just accumulate the unique libdirs.
7394 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7395 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7398 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7400 esac
7402 else
7403 eval flag=\"$hardcode_libdir_flag_spec\"
7404 dep_rpath="$dep_rpath $flag"
7406 elif test -n "$runpath_var"; then
7407 case "$perm_rpath " in
7408 *" $libdir "*) ;;
7409 *) perm_rpath="$perm_rpath $libdir" ;;
7410 esac
7412 done
7413 # Substitute the hardcoded libdirs into the rpath.
7414 if test -n "$hardcode_libdir_separator" &&
7415 test -n "$hardcode_libdirs"; then
7416 libdir="$hardcode_libdirs"
7417 if test -n "$hardcode_libdir_flag_spec_ld"; then
7418 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
7419 else
7420 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
7423 if test -n "$runpath_var" && test -n "$perm_rpath"; then
7424 # We should set the runpath_var.
7425 rpath=
7426 for dir in $perm_rpath; do
7427 rpath="$rpath$dir:"
7428 done
7429 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
7431 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
7434 shlibpath="$finalize_shlibpath"
7435 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
7436 if test -n "$shlibpath"; then
7437 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
7440 # Get the real and link names of the library.
7441 eval shared_ext=\"$shrext_cmds\"
7442 eval library_names=\"$library_names_spec\"
7443 set dummy $library_names
7444 shift
7445 realname="$1"
7446 shift
7448 if test -n "$soname_spec"; then
7449 eval soname=\"$soname_spec\"
7450 else
7451 soname="$realname"
7453 if test -z "$dlname"; then
7454 dlname=$soname
7457 lib="$output_objdir/$realname"
7458 linknames=
7459 for link
7461 linknames="$linknames $link"
7462 done
7464 # Use standard objects if they are pic
7465 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7466 test "X$libobjs" = "X " && libobjs=
7468 delfiles=
7469 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7470 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
7471 export_symbols="$output_objdir/$libname.uexp"
7472 delfiles="$delfiles $export_symbols"
7475 orig_export_symbols=
7476 case $host_os in
7477 cygwin* | mingw* | cegcc*)
7478 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
7479 # exporting using user supplied symfile
7480 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
7481 # and it's NOT already a .def file. Must figure out
7482 # which of the given symbols are data symbols and tag
7483 # them as such. So, trigger use of export_symbols_cmds.
7484 # export_symbols gets reassigned inside the "prepare
7485 # the list of exported symbols" if statement, so the
7486 # include_expsyms logic still works.
7487 orig_export_symbols="$export_symbols"
7488 export_symbols=
7489 always_export_symbols=yes
7493 esac
7495 # Prepare the list of exported symbols
7496 if test -z "$export_symbols"; then
7497 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7498 func_verbose "generating symbol list for \`$libname.la'"
7499 export_symbols="$output_objdir/$libname.exp"
7500 $opt_dry_run || $RM $export_symbols
7501 cmds=$export_symbols_cmds
7502 save_ifs="$IFS"; IFS='~'
7503 for cmd in $cmds; do
7504 IFS="$save_ifs"
7505 eval cmd=\"$cmd\"
7506 func_len " $cmd"
7507 len=$func_len_result
7508 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7509 func_show_eval "$cmd" 'exit $?'
7510 skipped_export=false
7511 else
7512 # The command line is too long to execute in one step.
7513 func_verbose "using reloadable object file for export list..."
7514 skipped_export=:
7515 # Break out early, otherwise skipped_export may be
7516 # set to false by a later but shorter cmd.
7517 break
7519 done
7520 IFS="$save_ifs"
7521 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7522 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7523 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7528 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7529 tmp_export_symbols="$export_symbols"
7530 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7531 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7534 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7535 # The given exports_symbols file has to be filtered, so filter it.
7536 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7537 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7538 # 's' commands which not all seds can handle. GNU sed should be fine
7539 # though. Also, the filter scales superlinearly with the number of
7540 # global variables. join(1) would be nice here, but unfortunately
7541 # isn't a blessed tool.
7542 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7543 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7544 export_symbols=$output_objdir/$libname.def
7545 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7548 tmp_deplibs=
7549 inst_prefix_arg=
7550 for test_deplib in $deplibs; do
7551 case " $convenience " in
7552 *" $test_deplib "*) ;;
7554 if test -n "$inst_prefix_dir" && (echo "$test_deplib" | grep -- "$inst_prefix_dir" >/dev/null); then
7555 inst_prefix_arg="$inst_prefix_arg $test_deplib"
7556 else
7557 tmp_deplibs="$tmp_deplibs $test_deplib"
7560 esac
7561 done
7562 deplibs="$tmp_deplibs"
7563 if test -n "$inst_prefix_arg"; then
7564 deplibs="$inst_prefix_arg $deplibs"
7567 if test -n "$convenience"; then
7568 if test -n "$whole_archive_flag_spec" &&
7569 test "$compiler_needs_object" = yes &&
7570 test -z "$libobjs"; then
7571 # extract the archives, so we have objects to list.
7572 # TODO: could optimize this to just extract one archive.
7573 whole_archive_flag_spec=
7575 if test -n "$whole_archive_flag_spec"; then
7576 save_libobjs=$libobjs
7577 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7578 test "X$libobjs" = "X " && libobjs=
7579 else
7580 gentop="$output_objdir/${outputname}x"
7581 generated="$generated $gentop"
7583 func_extract_archives $gentop $convenience
7584 libobjs="$libobjs $func_extract_archives_result"
7585 test "X$libobjs" = "X " && libobjs=
7589 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7590 eval flag=\"$thread_safe_flag_spec\"
7591 linker_flags="$linker_flags $flag"
7594 # Make a backup of the uninstalled library when relinking
7595 if test "$mode" = relink; then
7596 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7599 # Do each of the archive commands.
7600 if test "$module" = yes && test -n "$module_cmds" ; then
7601 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7602 eval test_cmds=\"$module_expsym_cmds\"
7603 cmds=$module_expsym_cmds
7604 else
7605 eval test_cmds=\"$module_cmds\"
7606 cmds=$module_cmds
7608 else
7609 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7610 eval test_cmds=\"$archive_expsym_cmds\"
7611 cmds=$archive_expsym_cmds
7612 else
7613 eval test_cmds=\"$archive_cmds\"
7614 cmds=$archive_cmds
7618 if test "X$skipped_export" != "X:" &&
7619 func_len " $test_cmds" &&
7620 len=$func_len_result &&
7621 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7623 else
7624 # The command line is too long to link in one step, link piecewise
7625 # or, if using GNU ld and skipped_export is not :, use a linker
7626 # script.
7628 # Save the value of $output and $libobjs because we want to
7629 # use them later. If we have whole_archive_flag_spec, we
7630 # want to use save_libobjs as it was before
7631 # whole_archive_flag_spec was expanded, because we can't
7632 # assume the linker understands whole_archive_flag_spec.
7633 # This may have to be revisited, in case too many
7634 # convenience libraries get linked in and end up exceeding
7635 # the spec.
7636 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7637 save_libobjs=$libobjs
7639 save_output=$output
7640 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
7642 # Clear the reloadable object creation command queue and
7643 # initialize k to one.
7644 test_cmds=
7645 concat_cmds=
7646 objlist=
7647 last_robj=
7650 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7651 output=${output_objdir}/${output_la}.lnkscript
7652 func_verbose "creating GNU ld script: $output"
7653 $ECHO 'INPUT (' > $output
7654 for obj in $save_libobjs
7656 $ECHO "$obj" >> $output
7657 done
7658 $ECHO ')' >> $output
7659 delfiles="$delfiles $output"
7660 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7661 output=${output_objdir}/${output_la}.lnk
7662 func_verbose "creating linker input file list: $output"
7663 : > $output
7664 set x $save_libobjs
7665 shift
7666 firstobj=
7667 if test "$compiler_needs_object" = yes; then
7668 firstobj="$1 "
7669 shift
7671 for obj
7673 $ECHO "$obj" >> $output
7674 done
7675 delfiles="$delfiles $output"
7676 output=$firstobj\"$file_list_spec$output\"
7677 else
7678 if test -n "$save_libobjs"; then
7679 func_verbose "creating reloadable object files..."
7680 output=$output_objdir/$output_la-${k}.$objext
7681 eval test_cmds=\"$reload_cmds\"
7682 func_len " $test_cmds"
7683 len0=$func_len_result
7684 len=$len0
7686 # Loop over the list of objects to be linked.
7687 for obj in $save_libobjs
7689 func_len " $obj"
7690 func_arith $len + $func_len_result
7691 len=$func_arith_result
7692 if test "X$objlist" = X ||
7693 test "$len" -lt "$max_cmd_len"; then
7694 func_append objlist " $obj"
7695 else
7696 # The command $test_cmds is almost too long, add a
7697 # command to the queue.
7698 if test "$k" -eq 1 ; then
7699 # The first file doesn't have a previous command to add.
7700 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
7701 else
7702 # All subsequent reloadable object files will link in
7703 # the last one created.
7704 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
7706 last_robj=$output_objdir/$output_la-${k}.$objext
7707 func_arith $k + 1
7708 k=$func_arith_result
7709 output=$output_objdir/$output_la-${k}.$objext
7710 objlist=$obj
7711 func_len " $last_robj"
7712 func_arith $len0 + $func_len_result
7713 len=$func_arith_result
7715 done
7716 # Handle the remaining objects by creating one last
7717 # reloadable object file. All subsequent reloadable object
7718 # files will link in the last one created.
7719 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7720 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
7721 if test -n "$last_robj"; then
7722 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7724 delfiles="$delfiles $output"
7726 else
7727 output=
7730 if ${skipped_export-false}; then
7731 func_verbose "generating symbol list for \`$libname.la'"
7732 export_symbols="$output_objdir/$libname.exp"
7733 $opt_dry_run || $RM $export_symbols
7734 libobjs=$output
7735 # Append the command to create the export file.
7736 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7737 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7738 if test -n "$last_robj"; then
7739 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7743 test -n "$save_libobjs" &&
7744 func_verbose "creating a temporary reloadable object file: $output"
7746 # Loop through the commands generated above and execute them.
7747 save_ifs="$IFS"; IFS='~'
7748 for cmd in $concat_cmds; do
7749 IFS="$save_ifs"
7750 $opt_silent || {
7751 func_quote_for_expand "$cmd"
7752 eval "func_echo $func_quote_for_expand_result"
7754 $opt_dry_run || eval "$cmd" || {
7755 lt_exit=$?
7757 # Restore the uninstalled library and exit
7758 if test "$mode" = relink; then
7759 ( cd "$output_objdir" && \
7760 $RM "${realname}T" && \
7761 $MV "${realname}U" "$realname" )
7764 exit $lt_exit
7766 done
7767 IFS="$save_ifs"
7769 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7770 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7771 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7775 if ${skipped_export-false}; then
7776 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7777 tmp_export_symbols="$export_symbols"
7778 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7779 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7782 if test -n "$orig_export_symbols"; then
7783 # The given exports_symbols file has to be filtered, so filter it.
7784 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7785 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7786 # 's' commands which not all seds can handle. GNU sed should be fine
7787 # though. Also, the filter scales superlinearly with the number of
7788 # global variables. join(1) would be nice here, but unfortunately
7789 # isn't a blessed tool.
7790 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7791 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7792 export_symbols=$output_objdir/$libname.def
7793 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7797 libobjs=$output
7798 # Restore the value of output.
7799 output=$save_output
7801 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
7802 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7803 test "X$libobjs" = "X " && libobjs=
7805 # Expand the library linking commands again to reset the
7806 # value of $libobjs for piecewise linking.
7808 # Do each of the archive commands.
7809 if test "$module" = yes && test -n "$module_cmds" ; then
7810 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7811 cmds=$module_expsym_cmds
7812 else
7813 cmds=$module_cmds
7815 else
7816 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7817 cmds=$archive_expsym_cmds
7818 else
7819 cmds=$archive_cmds
7824 if test -n "$delfiles"; then
7825 # Append the command to remove temporary files to $cmds.
7826 eval cmds=\"\$cmds~\$RM $delfiles\"
7829 # Add any objects from preloaded convenience libraries
7830 if test -n "$dlprefiles"; then
7831 gentop="$output_objdir/${outputname}x"
7832 generated="$generated $gentop"
7834 func_extract_archives $gentop $dlprefiles
7835 libobjs="$libobjs $func_extract_archives_result"
7836 test "X$libobjs" = "X " && libobjs=
7839 save_ifs="$IFS"; IFS='~'
7840 for cmd in $cmds; do
7841 IFS="$save_ifs"
7842 eval cmd=\"$cmd\"
7843 $opt_silent || {
7844 func_quote_for_expand "$cmd"
7845 eval "func_echo $func_quote_for_expand_result"
7847 $opt_dry_run || eval "$cmd" || {
7848 lt_exit=$?
7850 # Restore the uninstalled library and exit
7851 if test "$mode" = relink; then
7852 ( cd "$output_objdir" && \
7853 $RM "${realname}T" && \
7854 $MV "${realname}U" "$realname" )
7857 exit $lt_exit
7859 done
7860 IFS="$save_ifs"
7862 # Restore the uninstalled library and exit
7863 if test "$mode" = relink; then
7864 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
7866 if test -n "$convenience"; then
7867 if test -z "$whole_archive_flag_spec"; then
7868 func_show_eval '${RM}r "$gentop"'
7872 exit $EXIT_SUCCESS
7875 # Create links to the real library.
7876 for linkname in $linknames; do
7877 if test "$realname" != "$linkname"; then
7878 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
7880 done
7882 # If -module or -export-dynamic was specified, set the dlname.
7883 if test "$module" = yes || test "$export_dynamic" = yes; then
7884 # On all known operating systems, these are identical.
7885 dlname="$soname"
7890 obj)
7891 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7892 func_warning "\`-dlopen' is ignored for objects"
7895 case " $deplibs" in
7896 *\ -l* | *\ -L*)
7897 func_warning "\`-l' and \`-L' are ignored for objects" ;;
7898 esac
7900 test -n "$rpath" && \
7901 func_warning "\`-rpath' is ignored for objects"
7903 test -n "$xrpath" && \
7904 func_warning "\`-R' is ignored for objects"
7906 test -n "$vinfo" && \
7907 func_warning "\`-version-info' is ignored for objects"
7909 test -n "$release" && \
7910 func_warning "\`-release' is ignored for objects"
7912 case $output in
7913 *.lo)
7914 test -n "$objs$old_deplibs" && \
7915 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
7917 libobj=$output
7918 func_lo2o "$libobj"
7919 obj=$func_lo2o_result
7922 libobj=
7923 obj="$output"
7925 esac
7927 # Delete the old objects.
7928 $opt_dry_run || $RM $obj $libobj
7930 # Objects from convenience libraries. This assumes
7931 # single-version convenience libraries. Whenever we create
7932 # different ones for PIC/non-PIC, this we'll have to duplicate
7933 # the extraction.
7934 reload_conv_objs=
7935 gentop=
7936 # reload_cmds runs $LD directly, so let us get rid of
7937 # -Wl from whole_archive_flag_spec and hope we can get by with
7938 # turning comma into space..
7941 if test -n "$convenience"; then
7942 if test -n "$whole_archive_flag_spec"; then
7943 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
7944 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
7945 else
7946 gentop="$output_objdir/${obj}x"
7947 generated="$generated $gentop"
7949 func_extract_archives $gentop $convenience
7950 reload_conv_objs="$reload_objs $func_extract_archives_result"
7954 # Create the old-style object.
7955 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
7957 output="$obj"
7958 func_execute_cmds "$reload_cmds" 'exit $?'
7960 # Exit if we aren't doing a library object file.
7961 if test -z "$libobj"; then
7962 if test -n "$gentop"; then
7963 func_show_eval '${RM}r "$gentop"'
7966 exit $EXIT_SUCCESS
7969 if test "$build_libtool_libs" != yes; then
7970 if test -n "$gentop"; then
7971 func_show_eval '${RM}r "$gentop"'
7974 # Create an invalid libtool object if no PIC, so that we don't
7975 # accidentally link it into a program.
7976 # $show "echo timestamp > $libobj"
7977 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
7978 exit $EXIT_SUCCESS
7981 if test -n "$pic_flag" || test "$pic_mode" != default; then
7982 # Only do commands if we really have different PIC objects.
7983 reload_objs="$libobjs $reload_conv_objs"
7984 output="$libobj"
7985 func_execute_cmds "$reload_cmds" 'exit $?'
7988 if test -n "$gentop"; then
7989 func_show_eval '${RM}r "$gentop"'
7992 exit $EXIT_SUCCESS
7995 prog)
7996 case $host in
7997 *cygwin*) func_stripname '' '.exe' "$output"
7998 output=$func_stripname_result.exe;;
7999 esac
8000 test -n "$vinfo" && \
8001 func_warning "\`-version-info' is ignored for programs"
8003 test -n "$release" && \
8004 func_warning "\`-release' is ignored for programs"
8006 test "$preload" = yes \
8007 && test "$dlopen_support" = unknown \
8008 && test "$dlopen_self" = unknown \
8009 && test "$dlopen_self_static" = unknown && \
8010 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8012 case $host in
8013 *-*-rhapsody* | *-*-darwin1.[012])
8014 # On Rhapsody replace the C library is the System framework
8015 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
8016 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
8018 esac
8020 case $host in
8021 *-*-darwin*)
8022 # Don't allow lazy linking, it breaks C++ global constructors
8023 # But is supposedly fixed on 10.4 or later (yay!).
8024 if test "$tagname" = CXX ; then
8025 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8026 10.[0123])
8027 compile_command="$compile_command ${wl}-bind_at_load"
8028 finalize_command="$finalize_command ${wl}-bind_at_load"
8030 esac
8032 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8033 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
8034 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
8036 esac
8039 # move library search paths that coincide with paths to not yet
8040 # installed libraries to the beginning of the library search list
8041 new_libs=
8042 for path in $notinst_path; do
8043 case " $new_libs " in
8044 *" -L$path/$objdir "*) ;;
8046 case " $compile_deplibs " in
8047 *" -L$path/$objdir "*)
8048 new_libs="$new_libs -L$path/$objdir" ;;
8049 esac
8051 esac
8052 done
8053 for deplib in $compile_deplibs; do
8054 case $deplib in
8055 -L*)
8056 case " $new_libs " in
8057 *" $deplib "*) ;;
8058 *) new_libs="$new_libs $deplib" ;;
8059 esac
8061 *) new_libs="$new_libs $deplib" ;;
8062 esac
8063 done
8064 compile_deplibs="$new_libs"
8067 compile_command="$compile_command $compile_deplibs"
8068 finalize_command="$finalize_command $finalize_deplibs"
8070 if test -n "$rpath$xrpath"; then
8071 # If the user specified any rpath flags, then add them.
8072 for libdir in $rpath $xrpath; do
8073 # This is the magic to use -rpath.
8074 case "$finalize_rpath " in
8075 *" $libdir "*) ;;
8076 *) finalize_rpath="$finalize_rpath $libdir" ;;
8077 esac
8078 done
8081 # Now hardcode the library paths
8082 rpath=
8083 hardcode_libdirs=
8084 for libdir in $compile_rpath $finalize_rpath; do
8085 if test -n "$hardcode_libdir_flag_spec"; then
8086 if test -n "$hardcode_libdir_separator"; then
8087 if test -z "$hardcode_libdirs"; then
8088 hardcode_libdirs="$libdir"
8089 else
8090 # Just accumulate the unique libdirs.
8091 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8092 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8095 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8097 esac
8099 else
8100 eval flag=\"$hardcode_libdir_flag_spec\"
8101 rpath="$rpath $flag"
8103 elif test -n "$runpath_var"; then
8104 case "$perm_rpath " in
8105 *" $libdir "*) ;;
8106 *) perm_rpath="$perm_rpath $libdir" ;;
8107 esac
8109 case $host in
8110 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8111 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8112 case :$dllsearchpath: in
8113 *":$libdir:"*) ;;
8114 ::) dllsearchpath=$libdir;;
8115 *) dllsearchpath="$dllsearchpath:$libdir";;
8116 esac
8117 case :$dllsearchpath: in
8118 *":$testbindir:"*) ;;
8119 ::) dllsearchpath=$testbindir;;
8120 *) dllsearchpath="$dllsearchpath:$testbindir";;
8121 esac
8123 esac
8124 done
8125 # Substitute the hardcoded libdirs into the rpath.
8126 if test -n "$hardcode_libdir_separator" &&
8127 test -n "$hardcode_libdirs"; then
8128 libdir="$hardcode_libdirs"
8129 eval rpath=\" $hardcode_libdir_flag_spec\"
8131 compile_rpath="$rpath"
8133 rpath=
8134 hardcode_libdirs=
8135 for libdir in $finalize_rpath; do
8136 if test -n "$hardcode_libdir_flag_spec"; then
8137 if test -n "$hardcode_libdir_separator"; then
8138 if test -z "$hardcode_libdirs"; then
8139 hardcode_libdirs="$libdir"
8140 else
8141 # Just accumulate the unique libdirs.
8142 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8143 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8146 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8148 esac
8150 else
8151 eval flag=\"$hardcode_libdir_flag_spec\"
8152 rpath="$rpath $flag"
8154 elif test -n "$runpath_var"; then
8155 case "$finalize_perm_rpath " in
8156 *" $libdir "*) ;;
8157 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
8158 esac
8160 done
8161 # Substitute the hardcoded libdirs into the rpath.
8162 if test -n "$hardcode_libdir_separator" &&
8163 test -n "$hardcode_libdirs"; then
8164 libdir="$hardcode_libdirs"
8165 eval rpath=\" $hardcode_libdir_flag_spec\"
8167 finalize_rpath="$rpath"
8169 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8170 # Transform all the library objects into standard objects.
8171 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
8172 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
8175 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8177 # template prelinking step
8178 if test -n "$prelink_cmds"; then
8179 func_execute_cmds "$prelink_cmds" 'exit $?'
8182 wrappers_required=yes
8183 case $host in
8184 *cygwin* | *mingw* )
8185 if test "$build_libtool_libs" != yes; then
8186 wrappers_required=no
8189 *cegcc)
8190 # Disable wrappers for cegcc, we are cross compiling anyway.
8191 wrappers_required=no
8194 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8195 wrappers_required=no
8198 esac
8199 if test "$wrappers_required" = no; then
8200 # Replace the output file specification.
8201 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
8202 link_command="$compile_command$compile_rpath"
8204 # We have no uninstalled library dependencies, so finalize right now.
8205 exit_status=0
8206 func_show_eval "$link_command" 'exit_status=$?'
8208 # Delete the generated files.
8209 if test -f "$output_objdir/${outputname}S.${objext}"; then
8210 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8213 exit $exit_status
8216 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8217 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8219 if test -n "$finalize_shlibpath"; then
8220 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8223 compile_var=
8224 finalize_var=
8225 if test -n "$runpath_var"; then
8226 if test -n "$perm_rpath"; then
8227 # We should set the runpath_var.
8228 rpath=
8229 for dir in $perm_rpath; do
8230 rpath="$rpath$dir:"
8231 done
8232 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8234 if test -n "$finalize_perm_rpath"; then
8235 # We should set the runpath_var.
8236 rpath=
8237 for dir in $finalize_perm_rpath; do
8238 rpath="$rpath$dir:"
8239 done
8240 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8244 if test "$no_install" = yes; then
8245 # We don't need to create a wrapper script.
8246 link_command="$compile_var$compile_command$compile_rpath"
8247 # Replace the output file specification.
8248 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
8249 # Delete the old output file.
8250 $opt_dry_run || $RM $output
8251 # Link the executable and exit
8252 func_show_eval "$link_command" 'exit $?'
8253 exit $EXIT_SUCCESS
8256 if test "$hardcode_action" = relink; then
8257 # Fast installation is not supported
8258 link_command="$compile_var$compile_command$compile_rpath"
8259 relink_command="$finalize_var$finalize_command$finalize_rpath"
8261 func_warning "this platform does not like uninstalled shared libraries"
8262 func_warning "\`$output' will be relinked during installation"
8263 else
8264 if test "$fast_install" != no; then
8265 link_command="$finalize_var$compile_command$finalize_rpath"
8266 if test "$fast_install" = yes; then
8267 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
8268 else
8269 # fast_install is set to needless
8270 relink_command=
8272 else
8273 link_command="$compile_var$compile_command$compile_rpath"
8274 relink_command="$finalize_var$finalize_command$finalize_rpath"
8278 # Replace the output file specification.
8279 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8281 # Delete the old output files.
8282 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8284 func_show_eval "$link_command" 'exit $?'
8286 # Now create the wrapper script.
8287 func_verbose "creating $output"
8289 # Quote the relink command for shipping.
8290 if test -n "$relink_command"; then
8291 # Preserve any variables that may affect compiler behavior
8292 for var in $variables_saved_for_relink; do
8293 if eval test -z \"\${$var+set}\"; then
8294 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8295 elif eval var_value=\$$var; test -z "$var_value"; then
8296 relink_command="$var=; export $var; $relink_command"
8297 else
8298 func_quote_for_eval "$var_value"
8299 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8301 done
8302 relink_command="(cd `pwd`; $relink_command)"
8303 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
8306 # Quote $ECHO for shipping.
8307 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
8308 case $progpath in
8309 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
8310 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
8311 esac
8312 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
8313 else
8314 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
8317 # Only actually do things if not in dry run mode.
8318 $opt_dry_run || {
8319 # win32 will think the script is a binary if it has
8320 # a .exe suffix, so we strip it off here.
8321 case $output in
8322 *.exe) func_stripname '' '.exe' "$output"
8323 output=$func_stripname_result ;;
8324 esac
8325 # test for cygwin because mv fails w/o .exe extensions
8326 case $host in
8327 *cygwin*)
8328 exeext=.exe
8329 func_stripname '' '.exe' "$outputname"
8330 outputname=$func_stripname_result ;;
8331 *) exeext= ;;
8332 esac
8333 case $host in
8334 *cygwin* | *mingw* )
8335 func_dirname_and_basename "$output" "" "."
8336 output_name=$func_basename_result
8337 output_path=$func_dirname_result
8338 cwrappersource="$output_path/$objdir/lt-$output_name.c"
8339 cwrapper="$output_path/$output_name.exe"
8340 $RM $cwrappersource $cwrapper
8341 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8343 func_emit_cwrapperexe_src > $cwrappersource
8345 # The wrapper executable is built using the $host compiler,
8346 # because it contains $host paths and files. If cross-
8347 # compiling, it, like the target executable, must be
8348 # executed on the $host or under an emulation environment.
8349 $opt_dry_run || {
8350 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8351 $STRIP $cwrapper
8354 # Now, create the wrapper script for func_source use:
8355 func_ltwrapper_scriptname $cwrapper
8356 $RM $func_ltwrapper_scriptname_result
8357 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8358 $opt_dry_run || {
8359 # note: this script will not be executed, so do not chmod.
8360 if test "x$build" = "x$host" ; then
8361 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8362 else
8363 func_emit_wrapper no > $func_ltwrapper_scriptname_result
8368 $RM $output
8369 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8371 func_emit_wrapper no > $output
8372 chmod +x $output
8374 esac
8376 exit $EXIT_SUCCESS
8378 esac
8380 # See if we need to build an old-fashioned archive.
8381 for oldlib in $oldlibs; do
8383 if test "$build_libtool_libs" = convenience; then
8384 oldobjs="$libobjs_save $symfileobj"
8385 addlibs="$convenience"
8386 build_libtool_libs=no
8387 else
8388 if test "$build_libtool_libs" = module; then
8389 oldobjs="$libobjs_save"
8390 build_libtool_libs=no
8391 else
8392 oldobjs="$old_deplibs $non_pic_objects"
8393 if test "$preload" = yes && test -f "$symfileobj"; then
8394 oldobjs="$oldobjs $symfileobj"
8397 addlibs="$old_convenience"
8400 if test -n "$addlibs"; then
8401 gentop="$output_objdir/${outputname}x"
8402 generated="$generated $gentop"
8404 func_extract_archives $gentop $addlibs
8405 oldobjs="$oldobjs $func_extract_archives_result"
8408 # Do each command in the archive commands.
8409 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
8410 cmds=$old_archive_from_new_cmds
8411 else
8413 # Add any objects from preloaded convenience libraries
8414 if test -n "$dlprefiles"; then
8415 gentop="$output_objdir/${outputname}x"
8416 generated="$generated $gentop"
8418 func_extract_archives $gentop $dlprefiles
8419 oldobjs="$oldobjs $func_extract_archives_result"
8422 # POSIX demands no paths to be encoded in archives. We have
8423 # to avoid creating archives with duplicate basenames if we
8424 # might have to extract them afterwards, e.g., when creating a
8425 # static archive out of a convenience library, or when linking
8426 # the entirety of a libtool archive into another (currently
8427 # not supported by libtool).
8428 if (for obj in $oldobjs
8430 func_basename "$obj"
8431 $ECHO "$func_basename_result"
8432 done | sort | sort -uc >/dev/null 2>&1); then
8434 else
8435 $ECHO "copying selected object files to avoid basename conflicts..."
8436 gentop="$output_objdir/${outputname}x"
8437 generated="$generated $gentop"
8438 func_mkdir_p "$gentop"
8439 save_oldobjs=$oldobjs
8440 oldobjs=
8441 counter=1
8442 for obj in $save_oldobjs
8444 func_basename "$obj"
8445 objbase="$func_basename_result"
8446 case " $oldobjs " in
8447 " ") oldobjs=$obj ;;
8448 *[\ /]"$objbase "*)
8449 while :; do
8450 # Make sure we don't pick an alternate name that also
8451 # overlaps.
8452 newobj=lt$counter-$objbase
8453 func_arith $counter + 1
8454 counter=$func_arith_result
8455 case " $oldobjs " in
8456 *[\ /]"$newobj "*) ;;
8457 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
8458 esac
8459 done
8460 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8461 oldobjs="$oldobjs $gentop/$newobj"
8463 *) oldobjs="$oldobjs $obj" ;;
8464 esac
8465 done
8467 eval cmds=\"$old_archive_cmds\"
8469 func_len " $cmds"
8470 len=$func_len_result
8471 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8472 cmds=$old_archive_cmds
8473 else
8474 # the command line is too long to link in one step, link in parts
8475 func_verbose "using piecewise archive linking..."
8476 save_RANLIB=$RANLIB
8477 RANLIB=:
8478 objlist=
8479 concat_cmds=
8480 save_oldobjs=$oldobjs
8481 oldobjs=
8482 # Is there a better way of finding the last object in the list?
8483 for obj in $save_oldobjs
8485 last_oldobj=$obj
8486 done
8487 eval test_cmds=\"$old_archive_cmds\"
8488 func_len " $test_cmds"
8489 len0=$func_len_result
8490 len=$len0
8491 for obj in $save_oldobjs
8493 func_len " $obj"
8494 func_arith $len + $func_len_result
8495 len=$func_arith_result
8496 func_append objlist " $obj"
8497 if test "$len" -lt "$max_cmd_len"; then
8499 else
8500 # the above command should be used before it gets too long
8501 oldobjs=$objlist
8502 if test "$obj" = "$last_oldobj" ; then
8503 RANLIB=$save_RANLIB
8505 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8506 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8507 objlist=
8508 len=$len0
8510 done
8511 RANLIB=$save_RANLIB
8512 oldobjs=$objlist
8513 if test "X$oldobjs" = "X" ; then
8514 eval cmds=\"\$concat_cmds\"
8515 else
8516 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8520 func_execute_cmds "$cmds" 'exit $?'
8521 done
8523 test -n "$generated" && \
8524 func_show_eval "${RM}r$generated"
8526 # Now create the libtool archive.
8527 case $output in
8528 *.la)
8529 old_library=
8530 test "$build_old_libs" = yes && old_library="$libname.$libext"
8531 func_verbose "creating $output"
8533 # Preserve any variables that may affect compiler behavior
8534 for var in $variables_saved_for_relink; do
8535 if eval test -z \"\${$var+set}\"; then
8536 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8537 elif eval var_value=\$$var; test -z "$var_value"; then
8538 relink_command="$var=; export $var; $relink_command"
8539 else
8540 func_quote_for_eval "$var_value"
8541 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8543 done
8544 # Quote the link command for shipping.
8545 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8546 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
8547 if test "$hardcode_automatic" = yes ; then
8548 relink_command=
8551 # Only create the output if not a dry run.
8552 $opt_dry_run || {
8553 for installed in no yes; do
8554 if test "$installed" = yes; then
8555 if test -z "$install_libdir"; then
8556 break
8558 output="$output_objdir/$outputname"i
8559 # Replace all uninstalled libtool libraries with the installed ones
8560 newdependency_libs=
8561 for deplib in $dependency_libs; do
8562 case $deplib in
8563 *.la)
8564 func_basename "$deplib"
8565 name="$func_basename_result"
8566 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8567 test -z "$libdir" && \
8568 func_fatal_error "\`$deplib' is not a valid libtool archive"
8569 newdependency_libs="$newdependency_libs $libdir/$name"
8571 *) newdependency_libs="$newdependency_libs $deplib" ;;
8572 esac
8573 done
8574 dependency_libs="$newdependency_libs"
8575 newdlfiles=
8577 for lib in $dlfiles; do
8578 case $lib in
8579 *.la)
8580 func_basename "$lib"
8581 name="$func_basename_result"
8582 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8583 test -z "$libdir" && \
8584 func_fatal_error "\`$lib' is not a valid libtool archive"
8585 newdlfiles="$newdlfiles $libdir/$name"
8587 *) newdlfiles="$newdlfiles $lib" ;;
8588 esac
8589 done
8590 dlfiles="$newdlfiles"
8591 newdlprefiles=
8592 for lib in $dlprefiles; do
8593 case $lib in
8594 *.la)
8595 # Only pass preopened files to the pseudo-archive (for
8596 # eventual linking with the app. that links it) if we
8597 # didn't already link the preopened objects directly into
8598 # the library:
8599 func_basename "$lib"
8600 name="$func_basename_result"
8601 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8602 test -z "$libdir" && \
8603 func_fatal_error "\`$lib' is not a valid libtool archive"
8604 newdlprefiles="$newdlprefiles $libdir/$name"
8606 esac
8607 done
8608 dlprefiles="$newdlprefiles"
8609 else
8610 newdlfiles=
8611 for lib in $dlfiles; do
8612 case $lib in
8613 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8614 *) abs=`pwd`"/$lib" ;;
8615 esac
8616 newdlfiles="$newdlfiles $abs"
8617 done
8618 dlfiles="$newdlfiles"
8619 newdlprefiles=
8620 for lib in $dlprefiles; do
8621 case $lib in
8622 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8623 *) abs=`pwd`"/$lib" ;;
8624 esac
8625 newdlprefiles="$newdlprefiles $abs"
8626 done
8627 dlprefiles="$newdlprefiles"
8629 $RM $output
8630 # place dlname in correct position for cygwin
8631 tdlname=$dlname
8632 case $host,$output,$installed,$module,$dlname in
8633 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
8634 esac
8635 $ECHO > $output "\
8636 # $outputname - a libtool library file
8637 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8639 # Please DO NOT delete this file!
8640 # It is necessary for linking the library.
8642 # The name that we can dlopen(3).
8643 dlname='$tdlname'
8645 # Names of this library.
8646 library_names='$library_names'
8648 # The name of the static archive.
8649 old_library='$old_library'
8651 # Linker flags that can not go in dependency_libs.
8652 inherited_linker_flags='$new_inherited_linker_flags'
8654 # Libraries that this one depends upon.
8655 dependency_libs='$dependency_libs'
8657 # Names of additional weak libraries provided by this library
8658 weak_library_names='$weak_libs'
8660 # Version information for $libname.
8661 current=$current
8662 age=$age
8663 revision=$revision
8665 # Is this an already installed library?
8666 installed=$installed
8668 # Should we warn about portability when linking against -modules?
8669 shouldnotlink=$module
8671 # Files to dlopen/dlpreopen
8672 dlopen='$dlfiles'
8673 dlpreopen='$dlprefiles'
8675 # Directory that this library needs to be installed in:
8676 libdir='$install_libdir'"
8677 if test "$installed" = no && test "$need_relink" = yes; then
8678 $ECHO >> $output "\
8679 relink_command=\"$relink_command\""
8681 done
8684 # Do a symbolic link so that the libtool archive can be found in
8685 # LD_LIBRARY_PATH before the program is installed.
8686 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8688 esac
8689 exit $EXIT_SUCCESS
8692 { test "$mode" = link || test "$mode" = relink; } &&
8693 func_mode_link ${1+"$@"}
8696 # func_mode_uninstall arg...
8697 func_mode_uninstall ()
8699 $opt_debug
8700 RM="$nonopt"
8701 files=
8702 rmforce=
8703 exit_status=0
8705 # This variable tells wrapper scripts just to set variables rather
8706 # than running their programs.
8707 libtool_install_magic="$magic"
8709 for arg
8711 case $arg in
8712 -f) RM="$RM $arg"; rmforce=yes ;;
8713 -*) RM="$RM $arg" ;;
8714 *) files="$files $arg" ;;
8715 esac
8716 done
8718 test -z "$RM" && \
8719 func_fatal_help "you must specify an RM program"
8721 rmdirs=
8723 origobjdir="$objdir"
8724 for file in $files; do
8725 func_dirname "$file" "" "."
8726 dir="$func_dirname_result"
8727 if test "X$dir" = X.; then
8728 objdir="$origobjdir"
8729 else
8730 objdir="$dir/$origobjdir"
8732 func_basename "$file"
8733 name="$func_basename_result"
8734 test "$mode" = uninstall && objdir="$dir"
8736 # Remember objdir for removal later, being careful to avoid duplicates
8737 if test "$mode" = clean; then
8738 case " $rmdirs " in
8739 *" $objdir "*) ;;
8740 *) rmdirs="$rmdirs $objdir" ;;
8741 esac
8744 # Don't error if the file doesn't exist and rm -f was used.
8745 if { test -L "$file"; } >/dev/null 2>&1 ||
8746 { test -h "$file"; } >/dev/null 2>&1 ||
8747 test -f "$file"; then
8749 elif test -d "$file"; then
8750 exit_status=1
8751 continue
8752 elif test "$rmforce" = yes; then
8753 continue
8756 rmfiles="$file"
8758 case $name in
8759 *.la)
8760 # Possibly a libtool archive, so verify it.
8761 if func_lalib_p "$file"; then
8762 func_source $dir/$name
8764 # Delete the libtool libraries and symlinks.
8765 for n in $library_names; do
8766 rmfiles="$rmfiles $objdir/$n"
8767 done
8768 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
8770 case "$mode" in
8771 clean)
8772 case " $library_names " in
8773 # " " in the beginning catches empty $dlname
8774 *" $dlname "*) ;;
8775 *) rmfiles="$rmfiles $objdir/$dlname" ;;
8776 esac
8777 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
8779 uninstall)
8780 if test -n "$library_names"; then
8781 # Do each command in the postuninstall commands.
8782 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8785 if test -n "$old_library"; then
8786 # Do each command in the old_postuninstall commands.
8787 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8789 # FIXME: should reinstall the best remaining shared library.
8791 esac
8795 *.lo)
8796 # Possibly a libtool object, so verify it.
8797 if func_lalib_p "$file"; then
8799 # Read the .lo file
8800 func_source $dir/$name
8802 # Add PIC object to the list of files to remove.
8803 if test -n "$pic_object" &&
8804 test "$pic_object" != none; then
8805 rmfiles="$rmfiles $dir/$pic_object"
8808 # Add non-PIC object to the list of files to remove.
8809 if test -n "$non_pic_object" &&
8810 test "$non_pic_object" != none; then
8811 rmfiles="$rmfiles $dir/$non_pic_object"
8817 if test "$mode" = clean ; then
8818 noexename=$name
8819 case $file in
8820 *.exe)
8821 func_stripname '' '.exe' "$file"
8822 file=$func_stripname_result
8823 func_stripname '' '.exe' "$name"
8824 noexename=$func_stripname_result
8825 # $file with .exe has already been added to rmfiles,
8826 # add $file without .exe
8827 rmfiles="$rmfiles $file"
8829 esac
8830 # Do a test to see if this is a libtool program.
8831 if func_ltwrapper_p "$file"; then
8832 if func_ltwrapper_executable_p "$file"; then
8833 func_ltwrapper_scriptname "$file"
8834 relink_command=
8835 func_source $func_ltwrapper_scriptname_result
8836 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
8837 else
8838 relink_command=
8839 func_source $dir/$noexename
8842 # note $name still contains .exe if it was in $file originally
8843 # as does the version of $file that was added into $rmfiles
8844 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
8845 if test "$fast_install" = yes && test -n "$relink_command"; then
8846 rmfiles="$rmfiles $objdir/lt-$name"
8848 if test "X$noexename" != "X$name" ; then
8849 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
8854 esac
8855 func_show_eval "$RM $rmfiles" 'exit_status=1'
8856 done
8857 objdir="$origobjdir"
8859 # Try to remove the ${objdir}s in the directories where we deleted files
8860 for dir in $rmdirs; do
8861 if test -d "$dir"; then
8862 func_show_eval "rmdir $dir >/dev/null 2>&1"
8864 done
8866 exit $exit_status
8869 { test "$mode" = uninstall || test "$mode" = clean; } &&
8870 func_mode_uninstall ${1+"$@"}
8872 test -z "$mode" && {
8873 help="$generic_help"
8874 func_fatal_help "you must specify a MODE"
8877 test -z "$exec_cmd" && \
8878 func_fatal_help "invalid operation mode \`$mode'"
8880 if test -n "$exec_cmd"; then
8881 eval exec "$exec_cmd"
8882 exit $EXIT_FAILURE
8885 exit $exit_status
8888 # The TAGs below are defined such that we never get into a situation
8889 # in which we disable both kinds of libraries. Given conflicting
8890 # choices, we go for a static library, that is the most portable,
8891 # since we can't tell whether shared libraries were disabled because
8892 # the user asked for that or because the platform doesn't support
8893 # them. This is particularly important on AIX, because we don't
8894 # support having both static and shared libraries enabled at the same
8895 # time on that platform, so we default to a shared-only configuration.
8896 # If a disable-shared tag is given, we'll fallback to a static-only
8897 # configuration. But we'll never go from static-only to shared-only.
8899 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
8900 build_libtool_libs=no
8901 build_old_libs=yes
8902 # ### END LIBTOOL TAG CONFIG: disable-shared
8904 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
8905 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
8906 # ### END LIBTOOL TAG CONFIG: disable-static
8908 # Local Variables:
8909 # mode:shell-script
8910 # sh-indentation:2
8911 # End:
8912 # vi:sw=2