Update Makefile
[appimagekit/gsi.git] / libtool
blob8165242f9f3f5dd6cfb0dd7e38be1e813d7d5363
1 #! /bin/bash
3 # libtoolT - Provide generalized library-building support services.
4 # Generated automatically by (GNU fuseiso 20070708)
5 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
7 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
8 # Free Software Foundation, Inc.
10 # This file is part of GNU Libtool:
11 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
18 # This program is distributed in the hope that it will be useful, but
19 # WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 # General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 # As a special exception to the GNU General Public License, if you
28 # distribute this file as part of a program that contains a
29 # configuration script generated by Autoconf, you may include it under
30 # the same distribution terms that you use for the rest of that program.
32 # A sed program that does not truncate output.
33 SED="/bin/sed"
35 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
36 Xsed="/bin/sed -e 1s/^X//"
38 # The HP-UX ksh and POSIX shell print the target directory to stdout
39 # if CDPATH is set.
40 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
42 # The names of the tagged configurations supported by this script.
43 available_tags=" CXX"
45 # ### BEGIN LIBTOOL CONFIG
47 # Libtool was configured on host ubuntu:
49 # Shell to use when invoking shell scripts.
50 SHELL="/bin/bash"
52 # Whether or not to build shared libraries.
53 build_libtool_libs=yes
55 # Whether or not to build static libraries.
56 build_old_libs=yes
58 # Whether or not to add -lc for building shared libraries.
59 build_libtool_need_lc=no
61 # Whether or not to disallow shared libs when runtime libs are static
62 allow_libtool_libs_with_static_runtimes=no
64 # Whether or not to optimize for fast installation.
65 fast_install=yes
67 # The host system.
68 host_alias=
69 host=i686-pc-linux-gnu
70 host_os=linux-gnu
72 # The build system.
73 build_alias=
74 build=i686-pc-linux-gnu
75 build_os=linux-gnu
77 # An echo program that does not interpret backslashes.
78 echo="echo"
80 # The archiver.
81 AR="ar"
82 AR_FLAGS="cru"
84 # A C compiler.
85 LTCC="gcc"
87 # LTCC compiler flags.
88 LTCFLAGS="-g -O2"
90 # A language-specific compiler.
91 CC="gcc"
93 # Is the compiler the GNU C compiler?
94 with_gcc=yes
96 # An ERE matcher.
97 EGREP="/bin/grep -E"
99 # The linker used to build libraries.
100 LD="/usr/bin/ld"
102 # Whether we need hard or soft links.
103 LN_S="ln -s"
105 # A BSD-compatible nm program.
106 NM="/usr/bin/nm -B"
108 # A symbol stripping program
109 STRIP="strip"
111 # Used to examine libraries when file_magic_cmd begins "file"
112 MAGIC_CMD=file
114 # Used on cygwin: DLL creation program.
115 DLLTOOL="dlltool"
117 # Used on cygwin: object dumper.
118 OBJDUMP="objdump"
120 # Used on cygwin: assembler.
121 AS="as"
123 # The name of the directory that contains temporary libtool files.
124 objdir=.libs
126 # How to create reloadable object files.
127 reload_flag=" -r"
128 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
130 # How to pass a linker flag through the compiler.
131 wl="-Wl,"
133 # Object file suffix (normally "o").
134 objext="o"
136 # Old archive suffix (normally "a").
137 libext="a"
139 # Shared library suffix (normally ".so").
140 shrext_cmds='.so'
142 # Executable file suffix (normally "").
143 exeext=""
145 # Additional compiler flags for building library objects.
146 pic_flag=" -fPIC -DPIC"
147 pic_mode=default
149 # What is the maximum length of a command?
150 max_cmd_len=32768
152 # Does compiler simultaneously support -c and -o options?
153 compiler_c_o="yes"
155 # Must we lock files when doing compilation?
156 need_locks="no"
158 # Do we need the lib prefix for modules?
159 need_lib_prefix=no
161 # Do we need a version for libraries?
162 need_version=no
164 # Whether dlopen is supported.
165 dlopen_support=unknown
167 # Whether dlopen of programs is supported.
168 dlopen_self=unknown
170 # Whether dlopen of statically linked programs is supported.
171 dlopen_self_static=unknown
173 # Compiler flag to prevent dynamic linking.
174 link_static_flag="-static"
176 # Compiler flag to turn off builtin functions.
177 no_builtin_flag=" -fno-builtin"
179 # Compiler flag to allow reflexive dlopens.
180 export_dynamic_flag_spec="\${wl}--export-dynamic"
182 # Compiler flag to generate shared objects directly from archives.
183 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
185 # Compiler flag to generate thread-safe objects.
186 thread_safe_flag_spec=""
188 # Library versioning type.
189 version_type=linux
191 # Format of library name prefix.
192 libname_spec="lib\$name"
194 # List of archive names. First name is the real one, the rest are links.
195 # The last name is the one that the linker finds with -lNAME.
196 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
198 # The coded name of the library, if different from the real name.
199 soname_spec="\${libname}\${release}\${shared_ext}\$major"
201 # Commands used to build and install an old-style archive.
202 RANLIB="ranlib"
203 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib"
204 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
205 old_postuninstall_cmds=""
207 # Create an old-style archive from a shared archive.
208 old_archive_from_new_cmds=""
210 # Create a temporary old-style archive to link instead of a shared archive.
211 old_archive_from_expsyms_cmds=""
213 # Commands used to build and install a shared archive.
214 archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
215 archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
216 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
217 \$echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
218 \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
219 postinstall_cmds=""
220 postuninstall_cmds=""
222 # Commands used to build a loadable module (assumed same as above if empty)
223 module_cmds=""
224 module_expsym_cmds=""
226 # Commands to strip libraries.
227 old_striplib="strip --strip-debug"
228 striplib="strip --strip-unneeded"
230 # Dependencies to place before the objects being linked to create a
231 # shared library.
232 predep_objects=""
234 # Dependencies to place after the objects being linked to create a
235 # shared library.
236 postdep_objects=""
238 # Dependencies to place before the objects being linked to create a
239 # shared library.
240 predeps=""
242 # Dependencies to place after the objects being linked to create a
243 # shared library.
244 postdeps=""
246 # The library search path used internally by the compiler when linking
247 # a shared library.
248 compiler_lib_search_path=""
250 # Method to check whether dependent libraries are shared objects.
251 deplibs_check_method="pass_all"
253 # Command to use when deplibs_check_method == file_magic.
254 file_magic_cmd="\$MAGIC_CMD"
256 # Flag that allows shared libraries with undefined symbols to be built.
257 allow_undefined_flag=""
259 # Flag that forces no undefined symbols.
260 no_undefined_flag=""
262 # Commands used to finish a libtool library installation in a directory.
263 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
265 # Same as above, but a single script fragment to be evaled but not shown.
266 finish_eval=""
268 # Take the output of nm and produce a listing of raw symbols and C names.
269 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
271 # Transform the output of nm in a proper C declaration
272 global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
274 # Transform the output of nm in a C name address pair
275 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'"
277 # This is the shared library runtime path variable.
278 runpath_var=LD_RUN_PATH
280 # This is the shared library path variable.
281 shlibpath_var=LD_LIBRARY_PATH
283 # Is shlibpath searched before the hard-coded library search path?
284 shlibpath_overrides_runpath=no
286 # How to hardcode a shared library path into an executable.
287 hardcode_action=immediate
289 # Whether we should hardcode library paths into libraries.
290 hardcode_into_libs=yes
292 # Flag to hardcode $libdir into a binary during linking.
293 # This must work even if $libdir does not exist.
294 hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
296 # If ld is used when linking, flag to hardcode $libdir into
297 # a binary during linking. This must work even if $libdir does
298 # not exist.
299 hardcode_libdir_flag_spec_ld=""
301 # Whether we need a single -rpath flag with a separated argument.
302 hardcode_libdir_separator=""
304 # Set to yes if using DIR/libNAME during linking hardcodes DIR into the
305 # resulting binary.
306 hardcode_direct=no
308 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
309 # resulting binary.
310 hardcode_minus_L=no
312 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
313 # the resulting binary.
314 hardcode_shlibpath_var=unsupported
316 # Set to yes if building a shared library automatically hardcodes DIR into the library
317 # and all subsequent libraries and executables linked against it.
318 hardcode_automatic=no
320 # Variables whose values should be saved in libtool wrapper scripts and
321 # restored at relink time.
322 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
324 # Whether libtool must link a program against all its dependency libraries.
325 link_all_deplibs=unknown
327 # Compile-time system search path for libraries
328 sys_lib_search_path_spec="/usr/lib/gcc/i486-linux-gnu/4.4.3 /usr/lib /lib /usr/lib/i486-linux-gnu"
330 # Run-time system search path for libraries
331 sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/nvidia-current /lib/i486-linux-gnu /usr/lib/i486-linux-gnu /usr/lib/alsa-lib /usr/local/lib "
333 # Fix the shell variable $srcfile for the compiler.
334 fix_srcfile_path=""
336 # Set to yes if exported symbols are required.
337 always_export_symbols=no
339 # The commands to list exported symbols.
340 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
342 # The commands to extract the exported symbol list from a shared archive.
343 extract_expsyms_cmds=""
345 # Symbols that should not be listed in the preloaded symbols.
346 exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
348 # Symbols that must always be exported.
349 include_expsyms=""
351 # ### END LIBTOOL CONFIG
353 # ltmain.sh - Provide generalized library-building support services.
354 # NOTE: Changing this file will not affect anything until you rerun configure.
356 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
357 # 2007 Free Software Foundation, Inc.
358 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
360 # This program is free software; you can redistribute it and/or modify
361 # it under the terms of the GNU General Public License as published by
362 # the Free Software Foundation; either version 2 of the License, or
363 # (at your option) any later version.
365 # This program is distributed in the hope that it will be useful, but
366 # WITHOUT ANY WARRANTY; without even the implied warranty of
367 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
368 # General Public License for more details.
370 # You should have received a copy of the GNU General Public License
371 # along with this program; if not, write to the Free Software
372 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
374 # As a special exception to the GNU General Public License, if you
375 # distribute this file as part of a program that contains a
376 # configuration script generated by Autoconf, you may include it under
377 # the same distribution terms that you use for the rest of that program.
379 basename="s,^.*/,,g"
381 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
382 # is ksh but when the shell is invoked as "sh" and the current value of
383 # the _XPG environment variable is not equal to 1 (one), the special
384 # positional parameter $0, within a function call, is the name of the
385 # function.
386 progpath="$0"
388 # The name of this program:
389 progname=`echo "$progpath" | $SED $basename`
390 modename="$progname"
392 # Global variables:
393 EXIT_SUCCESS=0
394 EXIT_FAILURE=1
396 PROGRAM=ltmain.sh
397 PACKAGE=libtool
398 VERSION=1.5.23b
399 TIMESTAMP=" (1.1220.2.437 2007/02/17 09:08:45)"
401 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
402 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
403 emulate sh
404 NULLCMD=:
405 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
406 # is contrary to our usage. Disable this feature.
407 alias -g '${1+"$@"}'='"$@"'
408 setopt NO_GLOB_SUBST
409 else
410 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
412 BIN_SH=xpg4; export BIN_SH # for Tru64
413 DUALCASE=1; export DUALCASE # for MKS sh
415 # Check that we have a working $echo.
416 if test "X$1" = X--no-reexec; then
417 # Discard the --no-reexec flag, and continue.
418 shift
419 elif test "X$1" = X--fallback-echo; then
420 # Avoid inline document here, it may be left over
422 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
423 # Yippee, $echo works!
425 else
426 # Restart under the correct shell, and then maybe $echo will work.
427 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
430 if test "X$1" = X--fallback-echo; then
431 # used as fallback echo
432 shift
433 cat <<EOF
436 exit $EXIT_SUCCESS
439 default_mode=
440 help="Try \`$progname --help' for more information."
441 magic="%%%MAGIC variable%%%"
442 mkdir="mkdir"
443 mv="mv -f"
444 rm="rm -f"
446 # Sed substitution that helps us do robust quoting. It backslashifies
447 # metacharacters that are still active within double-quoted strings.
448 Xsed="${SED}"' -e 1s/^X//'
449 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
450 # test EBCDIC or ASCII
451 case `echo X|tr X '\101'` in
452 A) # ASCII based system
453 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
454 SP2NL='tr \040 \012'
455 NL2SP='tr \015\012 \040\040'
457 *) # EBCDIC based system
458 SP2NL='tr \100 \n'
459 NL2SP='tr \r\n \100\100'
461 esac
463 # NLS nuisances.
464 # Only set LANG and LC_ALL to C if already set.
465 # These must not be set unconditionally because not all systems understand
466 # e.g. LANG=C (notably SCO).
467 # We save the old values to restore during execute mode.
468 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
470 eval "if test \"\${$lt_var+set}\" = set; then
471 save_$lt_var=\$$lt_var
472 $lt_var=C
473 export $lt_var
475 done
477 # Make sure IFS has a sensible default
478 lt_nl='
480 IFS=" $lt_nl"
482 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
483 $echo "$modename: not configured to build any kind of library" 1>&2
484 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
485 exit $EXIT_FAILURE
488 # Global variables.
489 mode=$default_mode
490 nonopt=
491 prev=
492 prevopt=
493 run=
494 show="$echo"
495 show_help=
496 execute_dlfiles=
497 duplicate_deps=no
498 preserve_args=
499 lo2o="s/\\.lo\$/.${objext}/"
500 o2lo="s/\\.${objext}\$/.lo/"
501 extracted_archives=
502 extracted_serial=0
504 #####################################
505 # Shell function definitions:
506 # This seems to be the best place for them
508 # func_mktempdir [string]
509 # Make a temporary directory that won't clash with other running
510 # libtool processes, and avoids race conditions if possible. If
511 # given, STRING is the basename for that directory.
512 func_mktempdir ()
514 my_template="${TMPDIR-/tmp}/${1-$progname}"
516 if test "$run" = ":"; then
517 # Return a directory name, but don't create it in dry-run mode
518 my_tmpdir="${my_template}-$$"
519 else
521 # If mktemp works, use that first and foremost
522 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
524 if test ! -d "$my_tmpdir"; then
525 # Failing that, at least try and use $RANDOM to avoid a race
526 my_tmpdir="${my_template}-${RANDOM-0}$$"
528 save_mktempdir_umask=`umask`
529 umask 0077
530 $mkdir "$my_tmpdir"
531 umask $save_mktempdir_umask
534 # If we're not in dry-run mode, bomb out on failure
535 test -d "$my_tmpdir" || {
536 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
537 exit $EXIT_FAILURE
541 $echo "X$my_tmpdir" | $Xsed
545 # func_win32_libid arg
546 # return the library type of file 'arg'
548 # Need a lot of goo to handle *both* DLLs and import libs
549 # Has to be a shell function in order to 'eat' the argument
550 # that is supplied when $file_magic_command is called.
551 func_win32_libid ()
553 win32_libid_type="unknown"
554 win32_fileres=`file -L $1 2>/dev/null`
555 case $win32_fileres in
556 *ar\ archive\ import\ library*) # definitely import
557 win32_libid_type="x86 archive import"
559 *ar\ archive*) # could be an import, or static
560 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
561 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
562 win32_nmres=`eval $NM -f posix -A $1 | \
563 $SED -n -e '1,100{
564 / I /{
565 s,.*,import,
570 case $win32_nmres in
571 import*) win32_libid_type="x86 archive import";;
572 *) win32_libid_type="x86 archive static";;
573 esac
576 *DLL*)
577 win32_libid_type="x86 DLL"
579 *executable*) # but shell scripts are "executable" too...
580 case $win32_fileres in
581 *MS\ Windows\ PE\ Intel*)
582 win32_libid_type="x86 DLL"
584 esac
586 esac
587 $echo $win32_libid_type
591 # func_infer_tag arg
592 # Infer tagged configuration to use if any are available and
593 # if one wasn't chosen via the "--tag" command line option.
594 # Only attempt this if the compiler in the base compile
595 # command doesn't match the default compiler.
596 # arg is usually of the form 'gcc ...'
597 func_infer_tag ()
599 if test -n "$available_tags" && test -z "$tagname"; then
600 CC_quoted=
601 for arg in $CC; do
602 case $arg in
603 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
604 arg="\"$arg\""
606 esac
607 CC_quoted="$CC_quoted $arg"
608 done
609 case $@ in
610 # Blanks in the command may have been stripped by the calling shell,
611 # but not from the CC environment variable when configure was run.
612 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
613 # Blanks at the start of $base_compile will cause this to fail
614 # if we don't check for them as well.
616 for z in $available_tags; do
617 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
618 # Evaluate the configuration.
619 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
620 CC_quoted=
621 for arg in $CC; do
622 # Double-quote args containing other shell metacharacters.
623 case $arg in
624 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
625 arg="\"$arg\""
627 esac
628 CC_quoted="$CC_quoted $arg"
629 done
630 # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
631 trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
632 # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
633 extendcc=${host}-${CC}
634 # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc
635 # (Gentoo-specific hack because we always export $CHOST)
636 mungedcc=${CHOST-${host}}-${trimedcc}
637 case "$@ " in
638 "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
639 "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
640 tagname=CC
641 break ;;
642 "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
643 "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
644 "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
645 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
646 # The compiler in the base compile command matches
647 # the one in the tagged configuration.
648 # Assume this is the tagged configuration we want.
649 tagname=$z
650 break
652 esac
654 done
655 # If $tagname still isn't set, then no tagged configuration
656 # was found and let the user know that the "--tag" command
657 # line option must be used.
658 if test -z "$tagname"; then
659 $echo "$modename: unable to infer tagged configuration"
660 $echo "$modename: specify a tag with \`--tag'" 1>&2
661 exit $EXIT_FAILURE
662 # else
663 # $echo "$modename: using $tagname tagged configuration"
666 esac
671 # func_extract_an_archive dir oldlib
672 func_extract_an_archive ()
674 f_ex_an_ar_dir="$1"; shift
675 f_ex_an_ar_oldlib="$1"
677 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
678 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
679 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
681 else
682 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
683 exit $EXIT_FAILURE
687 # func_extract_archives gentop oldlib ...
688 func_extract_archives ()
690 my_gentop="$1"; shift
691 my_oldlibs=${1+"$@"}
692 my_oldobjs=""
693 my_xlib=""
694 my_xabs=""
695 my_xdir=""
696 my_status=""
698 $show "${rm}r $my_gentop"
699 $run ${rm}r "$my_gentop"
700 $show "$mkdir $my_gentop"
701 $run $mkdir "$my_gentop"
702 my_status=$?
703 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
704 exit $my_status
707 for my_xlib in $my_oldlibs; do
708 # Extract the objects.
709 case $my_xlib in
710 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
711 *) my_xabs=`pwd`"/$my_xlib" ;;
712 esac
713 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
714 my_xlib_u=$my_xlib
715 while :; do
716 case " $extracted_archives " in
717 *" $my_xlib_u "*)
718 extracted_serial=`expr $extracted_serial + 1`
719 my_xlib_u=lt$extracted_serial-$my_xlib ;;
720 *) break ;;
721 esac
722 done
723 extracted_archives="$extracted_archives $my_xlib_u"
724 my_xdir="$my_gentop/$my_xlib_u"
726 $show "${rm}r $my_xdir"
727 $run ${rm}r "$my_xdir"
728 $show "$mkdir $my_xdir"
729 $run $mkdir "$my_xdir"
730 exit_status=$?
731 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
732 exit $exit_status
734 case $host in
735 *-darwin*)
736 $show "Extracting $my_xabs"
737 # Do not bother doing anything if just a dry run
738 if test -z "$run"; then
739 darwin_orig_dir=`pwd`
740 cd $my_xdir || exit $?
741 darwin_archive=$my_xabs
742 darwin_curdir=`pwd`
743 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
744 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
745 if test -n "$darwin_arches"; then
746 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
747 darwin_arch=
748 $show "$darwin_base_archive has multiple architectures $darwin_arches"
749 for darwin_arch in $darwin_arches ; do
750 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
751 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
752 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
753 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
754 cd "$darwin_curdir"
755 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
756 done # $darwin_arches
757 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
758 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
759 darwin_file=
760 darwin_files=
761 for darwin_file in $darwin_filelist; do
762 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
763 lipo -create -output "$darwin_file" $darwin_files
764 done # $darwin_filelist
765 ${rm}r unfat-$$
766 cd "$darwin_orig_dir"
767 else
768 cd "$darwin_orig_dir"
769 func_extract_an_archive "$my_xdir" "$my_xabs"
770 fi # $darwin_arches
771 fi # $run
774 func_extract_an_archive "$my_xdir" "$my_xabs"
776 esac
777 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
778 done
779 func_extract_archives_result="$my_oldobjs"
781 # End of Shell function definitions
782 #####################################
784 # Darwin sucks
785 eval std_shrext=\"$shrext_cmds\"
787 disable_libs=no
789 # Parse our command line options once, thoroughly.
790 while test "$#" -gt 0
792 arg="$1"
793 shift
795 case $arg in
796 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
797 *) optarg= ;;
798 esac
800 # If the previous option needs an argument, assign it.
801 if test -n "$prev"; then
802 case $prev in
803 execute_dlfiles)
804 execute_dlfiles="$execute_dlfiles $arg"
806 tag)
807 tagname="$arg"
808 preserve_args="${preserve_args}=$arg"
810 # Check whether tagname contains only valid characters
811 case $tagname in
812 *[!-_A-Za-z0-9,/]*)
813 $echo "$progname: invalid tag name: $tagname" 1>&2
814 exit $EXIT_FAILURE
816 esac
818 case $tagname in
820 # Don't test for the "default" C tag, as we know, it's there, but
821 # not specially marked.
824 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
825 taglist="$taglist $tagname"
826 # Evaluate the configuration.
827 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
828 else
829 $echo "$progname: ignoring unknown tag $tagname" 1>&2
832 esac
835 eval "$prev=\$arg"
837 esac
839 prev=
840 prevopt=
841 continue
844 # Have we seen a non-optional argument yet?
845 case $arg in
846 --help)
847 show_help=yes
850 --version)
851 echo "\
852 $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
854 Copyright (C) 2007 Free Software Foundation, Inc.
855 This is free software; see the source for copying conditions. There is NO
856 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
857 exit $?
860 --config)
861 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
862 # Now print the configurations for the tags.
863 for tagname in $taglist; do
864 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
865 done
866 exit $?
869 --debug)
870 $echo "$progname: enabling shell trace mode"
871 set -x
872 preserve_args="$preserve_args $arg"
875 --dry-run | -n)
876 run=:
879 --features)
880 $echo "host: $host"
881 if test "$build_libtool_libs" = yes; then
882 $echo "enable shared libraries"
883 else
884 $echo "disable shared libraries"
886 if test "$build_old_libs" = yes; then
887 $echo "enable static libraries"
888 else
889 $echo "disable static libraries"
891 exit $?
894 --finish) mode="finish" ;;
896 --mode) prevopt="--mode" prev=mode ;;
897 --mode=*) mode="$optarg" ;;
899 --preserve-dup-deps) duplicate_deps="yes" ;;
901 --quiet | --silent)
902 show=:
903 preserve_args="$preserve_args $arg"
906 --tag)
907 prevopt="--tag"
908 prev=tag
909 preserve_args="$preserve_args --tag"
911 --tag=*)
912 set tag "$optarg" ${1+"$@"}
913 shift
914 prev=tag
915 preserve_args="$preserve_args --tag"
918 -dlopen)
919 prevopt="-dlopen"
920 prev=execute_dlfiles
924 $echo "$modename: unrecognized option \`$arg'" 1>&2
925 $echo "$help" 1>&2
926 exit $EXIT_FAILURE
930 nonopt="$arg"
931 break
933 esac
934 done
936 if test -n "$prevopt"; then
937 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
938 $echo "$help" 1>&2
939 exit $EXIT_FAILURE
942 case $disable_libs in
943 no)
945 shared)
946 build_libtool_libs=no
947 build_old_libs=yes
949 static)
950 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
952 esac
954 # If this variable is set in any of the actions, the command in it
955 # will be execed at the end. This prevents here-documents from being
956 # left over by shells.
957 exec_cmd=
959 if test -z "$show_help"; then
961 # Infer the operation mode.
962 if test -z "$mode"; then
963 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
964 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
965 case $nonopt in
966 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
967 mode=link
968 for arg
970 case $arg in
972 mode=compile
973 break
975 esac
976 done
978 *db | *dbx | *strace | *truss)
979 mode=execute
981 *install*|cp|mv)
982 mode=install
984 *rm)
985 mode=uninstall
988 # If we have no mode, but dlfiles were specified, then do execute mode.
989 test -n "$execute_dlfiles" && mode=execute
991 # Just use the default operation mode.
992 if test -z "$mode"; then
993 if test -n "$nonopt"; then
994 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
995 else
996 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
1000 esac
1003 # Only execute mode is allowed to have -dlopen flags.
1004 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1005 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
1006 $echo "$help" 1>&2
1007 exit $EXIT_FAILURE
1010 # Change the help message to a mode-specific one.
1011 generic_help="$help"
1012 help="Try \`$modename --help --mode=$mode' for more information."
1014 # These modes are in order of execution frequency so that they run quickly.
1015 case $mode in
1016 # libtool compile mode
1017 compile)
1018 modename="$modename: compile"
1019 # Get the compilation command and the source file.
1020 base_compile=
1021 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1022 suppress_opt=yes
1023 suppress_output=
1024 arg_mode=normal
1025 libobj=
1026 later=
1028 for arg
1030 case $arg_mode in
1031 arg )
1032 # do not "continue". Instead, add this to base_compile
1033 lastarg="$arg"
1034 arg_mode=normal
1037 target )
1038 libobj="$arg"
1039 arg_mode=normal
1040 continue
1043 normal )
1044 # Accept any command-line options.
1045 case $arg in
1047 if test -n "$libobj" ; then
1048 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
1049 exit $EXIT_FAILURE
1051 arg_mode=target
1052 continue
1055 -static | -prefer-pic | -prefer-non-pic)
1056 later="$later $arg"
1057 continue
1060 -no-suppress)
1061 suppress_opt=no
1062 continue
1065 -Xcompiler)
1066 arg_mode=arg # the next one goes into the "base_compile" arg list
1067 continue # The current "srcfile" will either be retained or
1068 ;; # replaced later. I would guess that would be a bug.
1070 -Wc,*)
1071 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
1072 lastarg=
1073 save_ifs="$IFS"; IFS=','
1074 for arg in $args; do
1075 IFS="$save_ifs"
1077 # Double-quote args containing other shell metacharacters.
1078 # Many Bourne shells cannot handle close brackets correctly
1079 # in scan sets, so we specify it separately.
1080 case $arg in
1081 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1082 arg="\"$arg\""
1084 esac
1085 lastarg="$lastarg $arg"
1086 done
1087 IFS="$save_ifs"
1088 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
1090 # Add the arguments to base_compile.
1091 base_compile="$base_compile $lastarg"
1092 continue
1096 # Accept the current argument as the source file.
1097 # The previous "srcfile" becomes the current argument.
1099 lastarg="$srcfile"
1100 srcfile="$arg"
1102 esac # case $arg
1104 esac # case $arg_mode
1106 # Aesthetically quote the previous argument.
1107 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
1109 case $lastarg in
1110 # Double-quote args containing other shell metacharacters.
1111 # Many Bourne shells cannot handle close brackets correctly
1112 # in scan sets, and some SunOS ksh mistreat backslash-escaping
1113 # in scan sets (worked around with variable expansion),
1114 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
1115 # at all, so we specify them separately.
1116 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1117 lastarg="\"$lastarg\""
1119 esac
1121 base_compile="$base_compile $lastarg"
1122 done # for arg
1124 case $arg_mode in
1125 arg)
1126 $echo "$modename: you must specify an argument for -Xcompile"
1127 exit $EXIT_FAILURE
1129 target)
1130 $echo "$modename: you must specify a target with \`-o'" 1>&2
1131 exit $EXIT_FAILURE
1134 # Get the name of the library object.
1135 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
1137 esac
1139 # Recognize several different file suffixes.
1140 # If the user specifies -o file.o, it is replaced with file.lo
1141 xform='[cCFSifmso]'
1142 case $libobj in
1143 *.ada) xform=ada ;;
1144 *.adb) xform=adb ;;
1145 *.ads) xform=ads ;;
1146 *.asm) xform=asm ;;
1147 *.c++) xform=c++ ;;
1148 *.cc) xform=cc ;;
1149 *.ii) xform=ii ;;
1150 *.class) xform=class ;;
1151 *.cpp) xform=cpp ;;
1152 *.cxx) xform=cxx ;;
1153 *.[fF][09]?) xform=[fF][09]. ;;
1154 *.for) xform=for ;;
1155 *.java) xform=java ;;
1156 *.obj) xform=obj ;;
1157 esac
1159 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
1161 case $libobj in
1162 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
1164 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
1165 exit $EXIT_FAILURE
1167 esac
1169 func_infer_tag $base_compile
1171 for arg in $later; do
1172 case $arg in
1173 -static)
1174 build_old_libs=yes
1175 continue
1178 -prefer-pic)
1179 pic_mode=yes
1180 continue
1183 -prefer-non-pic)
1184 pic_mode=no
1185 continue
1187 esac
1188 done
1190 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
1191 case $qlibobj in
1192 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1193 qlibobj="\"$qlibobj\"" ;;
1194 esac
1195 test "X$libobj" != "X$qlibobj" \
1196 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
1197 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
1198 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
1199 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
1200 if test "X$xdir" = "X$obj"; then
1201 xdir=
1202 else
1203 xdir=$xdir/
1205 lobj=${xdir}$objdir/$objname
1207 if test -z "$base_compile"; then
1208 $echo "$modename: you must specify a compilation command" 1>&2
1209 $echo "$help" 1>&2
1210 exit $EXIT_FAILURE
1213 # Delete any leftover library objects.
1214 if test "$build_old_libs" = yes; then
1215 removelist="$obj $lobj $libobj ${libobj}T"
1216 else
1217 removelist="$lobj $libobj ${libobj}T"
1220 $run $rm $removelist
1221 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
1223 # On Cygwin there's no "real" PIC flag so we must build both object types
1224 case $host_os in
1225 cygwin* | mingw* | pw32* | os2*)
1226 pic_mode=default
1228 esac
1229 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1230 # non-PIC code in shared libraries is not supported
1231 pic_mode=default
1234 # Calculate the filename of the output object if compiler does
1235 # not support -o with -c
1236 if test "$compiler_c_o" = no; then
1237 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1238 lockfile="$output_obj.lock"
1239 removelist="$removelist $output_obj $lockfile"
1240 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
1241 else
1242 output_obj=
1243 need_locks=no
1244 lockfile=
1247 # Lock this critical section if it is needed
1248 # We use this script file to make the link, it avoids creating a new file
1249 if test "$need_locks" = yes; then
1250 until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
1251 $show "Waiting for $lockfile to be removed"
1252 sleep 2
1253 done
1254 elif test "$need_locks" = warn; then
1255 if test -f "$lockfile"; then
1256 $echo "\
1257 *** ERROR, $lockfile exists and contains:
1258 `cat $lockfile 2>/dev/null`
1260 This indicates that another process is trying to use the same
1261 temporary object file, and libtool could not work around it because
1262 your compiler does not support \`-c' and \`-o' together. If you
1263 repeat this compilation, it may succeed, by chance, but you had better
1264 avoid parallel builds (make -j) in this platform, or get a better
1265 compiler."
1267 $run $rm $removelist
1268 exit $EXIT_FAILURE
1270 $echo "$srcfile" > "$lockfile"
1273 if test -n "$fix_srcfile_path"; then
1274 eval srcfile=\"$fix_srcfile_path\"
1276 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
1277 case $qsrcfile in
1278 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1279 qsrcfile="\"$qsrcfile\"" ;;
1280 esac
1282 $run $rm "$libobj" "${libobj}T"
1284 # Create a libtool object file (analogous to a ".la" file),
1285 # but don't create it if we're doing a dry run.
1286 test -z "$run" && cat > ${libobj}T <<EOF
1287 # $libobj - a libtool object file
1288 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
1290 # Please DO NOT delete this file!
1291 # It is necessary for linking the library.
1293 # Name of the PIC object.
1296 # Only build a PIC object if we are building libtool libraries.
1297 if test "$build_libtool_libs" = yes; then
1298 # Without this assignment, base_compile gets emptied.
1299 fbsd_hideous_sh_bug=$base_compile
1301 if test "$pic_mode" != no; then
1302 command="$base_compile $qsrcfile $pic_flag"
1303 else
1304 # Don't build PIC code
1305 command="$base_compile $qsrcfile"
1308 if test ! -d "${xdir}$objdir"; then
1309 $show "$mkdir ${xdir}$objdir"
1310 $run $mkdir ${xdir}$objdir
1311 exit_status=$?
1312 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
1313 exit $exit_status
1317 if test -z "$output_obj"; then
1318 # Place PIC objects in $objdir
1319 command="$command -o $lobj"
1322 $run $rm "$lobj" "$output_obj"
1324 $show "$command"
1325 if $run eval "$command"; then :
1326 else
1327 test -n "$output_obj" && $run $rm $removelist
1328 exit $EXIT_FAILURE
1331 if test "$need_locks" = warn &&
1332 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1333 $echo "\
1334 *** ERROR, $lockfile contains:
1335 `cat $lockfile 2>/dev/null`
1337 but it should contain:
1338 $srcfile
1340 This indicates that another process is trying to use the same
1341 temporary object file, and libtool could not work around it because
1342 your compiler does not support \`-c' and \`-o' together. If you
1343 repeat this compilation, it may succeed, by chance, but you had better
1344 avoid parallel builds (make -j) in this platform, or get a better
1345 compiler."
1347 $run $rm $removelist
1348 exit $EXIT_FAILURE
1351 # Just move the object if needed, then go on to compile the next one
1352 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1353 $show "$mv $output_obj $lobj"
1354 if $run $mv $output_obj $lobj; then :
1355 else
1356 error=$?
1357 $run $rm $removelist
1358 exit $error
1362 # Append the name of the PIC object to the libtool object file.
1363 test -z "$run" && cat >> ${libobj}T <<EOF
1364 pic_object='$objdir/$objname'
1368 # Allow error messages only from the first compilation.
1369 if test "$suppress_opt" = yes; then
1370 suppress_output=' >/dev/null 2>&1'
1372 else
1373 # No PIC object so indicate it doesn't exist in the libtool
1374 # object file.
1375 test -z "$run" && cat >> ${libobj}T <<EOF
1376 pic_object=none
1381 # Only build a position-dependent object if we build old libraries.
1382 if test "$build_old_libs" = yes; then
1383 if test "$pic_mode" != yes; then
1384 # Don't build PIC code
1385 command="$base_compile $qsrcfile"
1386 else
1387 command="$base_compile $qsrcfile $pic_flag"
1389 if test "$compiler_c_o" = yes; then
1390 command="$command -o $obj"
1393 # Suppress compiler output if we already did a PIC compilation.
1394 command="$command$suppress_output"
1395 $run $rm "$obj" "$output_obj"
1396 $show "$command"
1397 if $run eval "$command"; then :
1398 else
1399 $run $rm $removelist
1400 exit $EXIT_FAILURE
1403 if test "$need_locks" = warn &&
1404 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1405 $echo "\
1406 *** ERROR, $lockfile contains:
1407 `cat $lockfile 2>/dev/null`
1409 but it should contain:
1410 $srcfile
1412 This indicates that another process is trying to use the same
1413 temporary object file, and libtool could not work around it because
1414 your compiler does not support \`-c' and \`-o' together. If you
1415 repeat this compilation, it may succeed, by chance, but you had better
1416 avoid parallel builds (make -j) in this platform, or get a better
1417 compiler."
1419 $run $rm $removelist
1420 exit $EXIT_FAILURE
1423 # Just move the object if needed
1424 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1425 $show "$mv $output_obj $obj"
1426 if $run $mv $output_obj $obj; then :
1427 else
1428 error=$?
1429 $run $rm $removelist
1430 exit $error
1434 # Append the name of the non-PIC object the libtool object file.
1435 # Only append if the libtool object file exists.
1436 test -z "$run" && cat >> ${libobj}T <<EOF
1437 # Name of the non-PIC object.
1438 non_pic_object='$objname'
1441 else
1442 # Append the name of the non-PIC object the libtool object file.
1443 # Only append if the libtool object file exists.
1444 test -z "$run" && cat >> ${libobj}T <<EOF
1445 # Name of the non-PIC object.
1446 non_pic_object=none
1451 $run $mv "${libobj}T" "${libobj}"
1453 # Unlock the critical section if it was locked
1454 if test "$need_locks" != no; then
1455 $run $rm "$lockfile"
1458 exit $EXIT_SUCCESS
1461 # libtool link mode
1462 link | relink)
1463 modename="$modename: link"
1464 case $host in
1465 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1466 # It is impossible to link a dll without this setting, and
1467 # we shouldn't force the makefile maintainer to figure out
1468 # which system we are compiling for in order to pass an extra
1469 # flag for every libtool invocation.
1470 # allow_undefined=no
1472 # FIXME: Unfortunately, there are problems with the above when trying
1473 # to make a dll which has undefined symbols, in which case not
1474 # even a static library is built. For now, we need to specify
1475 # -no-undefined on the libtool link line when we can be certain
1476 # that all symbols are satisfied, otherwise we get a static library.
1477 allow_undefined=yes
1480 allow_undefined=yes
1482 esac
1483 libtool_args="$nonopt"
1484 base_compile="$nonopt $@"
1485 compile_command="$nonopt"
1486 finalize_command="$nonopt"
1488 compile_rpath=
1489 finalize_rpath=
1490 compile_shlibpath=
1491 finalize_shlibpath=
1492 convenience=
1493 old_convenience=
1494 deplibs=
1495 old_deplibs=
1496 compiler_flags=
1497 linker_flags=
1498 dllsearchpath=
1499 lib_search_path=`pwd`
1500 inst_prefix_dir=
1502 avoid_version=no
1503 dlfiles=
1504 dlprefiles=
1505 dlself=no
1506 export_dynamic=no
1507 export_symbols=
1508 export_symbols_regex=
1509 generated=
1510 libobjs=
1511 ltlibs=
1512 module=no
1513 no_install=no
1514 objs=
1515 non_pic_objects=
1516 notinst_path= # paths that contain not-installed libtool libraries
1517 precious_files_regex=
1518 prefer_static_libs=no
1519 preload=no
1520 prev=
1521 prevarg=
1522 release=
1523 rpath=
1524 xrpath=
1525 perm_rpath=
1526 temp_rpath=
1527 thread_safe=no
1528 vinfo=
1529 vinfo_number=no
1531 func_infer_tag $base_compile
1533 # We need to know -static, to get the right output filenames.
1534 for arg
1536 case $arg in
1537 -all-static | -static | -static-libtool-libs)
1538 case $arg in
1539 -all-static)
1540 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1541 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1543 if test -n "$link_static_flag"; then
1544 dlopen_self=$dlopen_self_static
1546 prefer_static_libs=yes
1548 -static)
1549 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1550 dlopen_self=$dlopen_self_static
1552 prefer_static_libs=built
1554 -static-libtool-libs)
1555 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1556 dlopen_self=$dlopen_self_static
1558 prefer_static_libs=yes
1560 esac
1561 build_libtool_libs=no
1562 build_old_libs=yes
1563 break
1565 esac
1566 done
1568 # See if our shared archives depend on static archives.
1569 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1571 # Go through the arguments, transforming them on the way.
1572 while test "$#" -gt 0; do
1573 arg="$1"
1574 shift
1575 case $arg in
1576 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1577 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1579 *) qarg=$arg ;;
1580 esac
1581 libtool_args="$libtool_args $qarg"
1583 # If the previous option needs an argument, assign it.
1584 if test -n "$prev"; then
1585 case $prev in
1586 output)
1587 compile_command="$compile_command @OUTPUT@"
1588 finalize_command="$finalize_command @OUTPUT@"
1590 esac
1592 case $prev in
1593 dlfiles|dlprefiles)
1594 if test "$preload" = no; then
1595 # Add the symbol object into the linking commands.
1596 compile_command="$compile_command @SYMFILE@"
1597 finalize_command="$finalize_command @SYMFILE@"
1598 preload=yes
1600 case $arg in
1601 *.la | *.lo) ;; # We handle these cases below.
1602 force)
1603 if test "$dlself" = no; then
1604 dlself=needless
1605 export_dynamic=yes
1607 prev=
1608 continue
1610 self)
1611 if test "$prev" = dlprefiles; then
1612 dlself=yes
1613 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1614 dlself=yes
1615 else
1616 dlself=needless
1617 export_dynamic=yes
1619 prev=
1620 continue
1623 if test "$prev" = dlfiles; then
1624 dlfiles="$dlfiles $arg"
1625 else
1626 dlprefiles="$dlprefiles $arg"
1628 prev=
1629 continue
1631 esac
1633 expsyms)
1634 export_symbols="$arg"
1635 if test ! -f "$arg"; then
1636 $echo "$modename: symbol file \`$arg' does not exist"
1637 exit $EXIT_FAILURE
1639 prev=
1640 continue
1642 expsyms_regex)
1643 export_symbols_regex="$arg"
1644 prev=
1645 continue
1647 inst_prefix)
1648 inst_prefix_dir="$arg"
1649 prev=
1650 continue
1652 precious_regex)
1653 precious_files_regex="$arg"
1654 prev=
1655 continue
1657 release)
1658 release="-$arg"
1659 prev=
1660 continue
1662 objectlist)
1663 if test -f "$arg"; then
1664 save_arg=$arg
1665 moreargs=
1666 for fil in `cat $save_arg`
1668 # moreargs="$moreargs $fil"
1669 arg=$fil
1670 # A libtool-controlled object.
1672 # Check to see that this really is a libtool object.
1673 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1674 pic_object=
1675 non_pic_object=
1677 # Read the .lo file
1678 # If there is no directory component, then add one.
1679 case $arg in
1680 */* | *\\*) . $arg ;;
1681 *) . ./$arg ;;
1682 esac
1684 if test -z "$pic_object" || \
1685 test -z "$non_pic_object" ||
1686 test "$pic_object" = none && \
1687 test "$non_pic_object" = none; then
1688 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1689 exit $EXIT_FAILURE
1692 # Extract subdirectory from the argument.
1693 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1694 if test "X$xdir" = "X$arg"; then
1695 xdir=
1696 else
1697 xdir="$xdir/"
1700 if test "$pic_object" != none; then
1701 # Prepend the subdirectory the object is found in.
1702 pic_object="$xdir$pic_object"
1704 if test "$prev" = dlfiles; then
1705 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1706 dlfiles="$dlfiles $pic_object"
1707 prev=
1708 continue
1709 else
1710 # If libtool objects are unsupported, then we need to preload.
1711 prev=dlprefiles
1715 # CHECK ME: I think I busted this. -Ossama
1716 if test "$prev" = dlprefiles; then
1717 # Preload the old-style object.
1718 dlprefiles="$dlprefiles $pic_object"
1719 prev=
1722 # A PIC object.
1723 libobjs="$libobjs $pic_object"
1724 arg="$pic_object"
1727 # Non-PIC object.
1728 if test "$non_pic_object" != none; then
1729 # Prepend the subdirectory the object is found in.
1730 non_pic_object="$xdir$non_pic_object"
1732 # A standard non-PIC object
1733 non_pic_objects="$non_pic_objects $non_pic_object"
1734 if test -z "$pic_object" || test "$pic_object" = none ; then
1735 arg="$non_pic_object"
1737 else
1738 # If the PIC object exists, use it instead.
1739 # $xdir was prepended to $pic_object above.
1740 non_pic_object="$pic_object"
1741 non_pic_objects="$non_pic_objects $non_pic_object"
1743 else
1744 # Only an error if not doing a dry-run.
1745 if test -z "$run"; then
1746 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1747 exit $EXIT_FAILURE
1748 else
1749 # Dry-run case.
1751 # Extract subdirectory from the argument.
1752 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1753 if test "X$xdir" = "X$arg"; then
1754 xdir=
1755 else
1756 xdir="$xdir/"
1759 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1760 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1761 libobjs="$libobjs $pic_object"
1762 non_pic_objects="$non_pic_objects $non_pic_object"
1765 done
1766 else
1767 $echo "$modename: link input file \`$save_arg' does not exist"
1768 exit $EXIT_FAILURE
1770 arg=$save_arg
1771 prev=
1772 continue
1774 rpath | xrpath)
1775 # We need an absolute path.
1776 case $arg in
1777 [\\/]* | [A-Za-z]:[\\/]*) ;;
1779 $echo "$modename: only absolute run-paths are allowed" 1>&2
1780 exit $EXIT_FAILURE
1782 esac
1783 if test "$prev" = rpath; then
1784 case "$rpath " in
1785 *" $arg "*) ;;
1786 *) rpath="$rpath $arg" ;;
1787 esac
1788 else
1789 case "$xrpath " in
1790 *" $arg "*) ;;
1791 *) xrpath="$xrpath $arg" ;;
1792 esac
1794 prev=
1795 continue
1797 xcompiler)
1798 compiler_flags="$compiler_flags $qarg"
1799 prev=
1800 compile_command="$compile_command $qarg"
1801 finalize_command="$finalize_command $qarg"
1802 continue
1804 xlinker)
1805 linker_flags="$linker_flags $qarg"
1806 compiler_flags="$compiler_flags $wl$qarg"
1807 prev=
1808 compile_command="$compile_command $wl$qarg"
1809 finalize_command="$finalize_command $wl$qarg"
1810 continue
1812 xcclinker)
1813 linker_flags="$linker_flags $qarg"
1814 compiler_flags="$compiler_flags $qarg"
1815 prev=
1816 compile_command="$compile_command $qarg"
1817 finalize_command="$finalize_command $qarg"
1818 continue
1820 shrext)
1821 shrext_cmds="$arg"
1822 prev=
1823 continue
1825 darwin_framework|darwin_framework_skip)
1826 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1827 compile_command="$compile_command $arg"
1828 finalize_command="$finalize_command $arg"
1829 prev=
1830 continue
1833 eval "$prev=\"\$arg\""
1834 prev=
1835 continue
1837 esac
1838 fi # test -n "$prev"
1840 prevarg="$arg"
1842 case $arg in
1843 -all-static)
1844 if test -n "$link_static_flag"; then
1845 compile_command="$compile_command $link_static_flag"
1846 finalize_command="$finalize_command $link_static_flag"
1848 continue
1851 -allow-undefined)
1852 # FIXME: remove this flag sometime in the future.
1853 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1854 continue
1857 -avoid-version)
1858 avoid_version=yes
1859 continue
1862 -dlopen)
1863 prev=dlfiles
1864 continue
1867 -dlpreopen)
1868 prev=dlprefiles
1869 continue
1872 -export-dynamic)
1873 export_dynamic=yes
1874 continue
1877 -export-symbols | -export-symbols-regex)
1878 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1879 $echo "$modename: more than one -exported-symbols argument is not allowed"
1880 exit $EXIT_FAILURE
1882 if test "X$arg" = "X-export-symbols"; then
1883 prev=expsyms
1884 else
1885 prev=expsyms_regex
1887 continue
1890 -framework|-arch|-isysroot)
1891 case " $CC " in
1892 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1893 prev=darwin_framework_skip ;;
1894 *) compiler_flags="$compiler_flags $arg"
1895 prev=darwin_framework ;;
1896 esac
1897 compile_command="$compile_command $arg"
1898 finalize_command="$finalize_command $arg"
1899 continue
1902 -inst-prefix-dir)
1903 prev=inst_prefix
1904 continue
1907 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1908 # so, if we see these flags be careful not to treat them like -L
1909 -L[A-Z][A-Z]*:*)
1910 case $with_gcc/$host in
1911 no/*-*-irix* | /*-*-irix*)
1912 compile_command="$compile_command $arg"
1913 finalize_command="$finalize_command $arg"
1915 esac
1916 continue
1919 -L*)
1920 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1921 # We need an absolute path.
1922 case $dir in
1923 [\\/]* | [A-Za-z]:[\\/]*) ;;
1925 absdir=`cd "$dir" && pwd`
1926 if test -z "$absdir"; then
1927 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1928 absdir="$dir"
1929 notinst_path="$notinst_path $dir"
1931 dir="$absdir"
1933 esac
1934 case "$deplibs " in
1935 *" -L$dir "*) ;;
1937 deplibs="$deplibs -L$dir"
1938 lib_search_path="$lib_search_path $dir"
1940 esac
1941 case $host in
1942 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1943 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1944 case :$dllsearchpath: in
1945 *":$dir:"*) ;;
1946 *) dllsearchpath="$dllsearchpath:$dir";;
1947 esac
1948 case :$dllsearchpath: in
1949 *":$testbindir:"*) ;;
1950 *) dllsearchpath="$dllsearchpath:$testbindir";;
1951 esac
1953 esac
1954 continue
1957 -l*)
1958 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1959 case $host in
1960 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1961 # These systems don't actually have a C or math library (as such)
1962 continue
1964 *-*-os2*)
1965 # These systems don't actually have a C library (as such)
1966 test "X$arg" = "X-lc" && continue
1968 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1969 # Do not include libc due to us having libc/libc_r.
1970 test "X$arg" = "X-lc" && continue
1972 *-*-rhapsody* | *-*-darwin1.[012])
1973 # Rhapsody C and math libraries are in the System framework
1974 deplibs="$deplibs -framework System"
1975 continue
1977 *-*-sco3.2v5* | *-*-sco5v6*)
1978 # Causes problems with __ctype
1979 test "X$arg" = "X-lc" && continue
1981 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1982 # Compiler inserts libc in the correct place for threads to work
1983 test "X$arg" = "X-lc" && continue
1985 esac
1986 elif test "X$arg" = "X-lc_r"; then
1987 case $host in
1988 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1989 # Do not include libc_r directly, use -pthread flag.
1990 continue
1992 esac
1994 deplibs="$deplibs $arg"
1995 continue
1998 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1999 # classes, name mangling, and exception handling.
2000 -model)
2001 compile_command="$compile_command $arg"
2002 compiler_flags="$compiler_flags $arg"
2003 finalize_command="$finalize_command $arg"
2004 prev=xcompiler
2005 continue
2008 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2009 compiler_flags="$compiler_flags $arg"
2010 compile_command="$compile_command $arg"
2011 finalize_command="$finalize_command $arg"
2012 continue
2015 -module)
2016 module=yes
2017 continue
2020 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
2021 # -r[0-9][0-9]* specifies the processor on the SGI compiler
2022 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
2023 # +DA*, +DD* enable 64-bit mode on the HP compiler
2024 # -q* pass through compiler args for the IBM compiler
2025 # -m* pass through architecture-specific compiler args for GCC
2026 # -m*, -t[45]*, -txscale* pass through architecture-specific
2027 # compiler args for GCC
2028 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
2029 # -F/path gives path to uninstalled frameworks, gcc on darwin
2030 # @file GCC response files
2031 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
2032 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
2034 # Unknown arguments in both finalize_command and compile_command need
2035 # to be aesthetically quoted because they are evaled later.
2036 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2037 case $arg in
2038 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2039 arg="\"$arg\""
2041 esac
2042 compile_command="$compile_command $arg"
2043 finalize_command="$finalize_command $arg"
2044 compiler_flags="$compiler_flags $arg"
2045 continue
2048 -shrext)
2049 prev=shrext
2050 continue
2053 -no-fast-install)
2054 fast_install=no
2055 continue
2058 -no-install)
2059 case $host in
2060 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
2061 # The PATH hackery in wrapper scripts is required on Windows
2062 # in order for the loader to find any dlls it needs.
2063 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
2064 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
2065 fast_install=no
2067 *) no_install=yes ;;
2068 esac
2069 continue
2072 -no-undefined)
2073 allow_undefined=no
2074 continue
2077 -objectlist)
2078 prev=objectlist
2079 continue
2082 -o) prev=output ;;
2084 -precious-files-regex)
2085 prev=precious_regex
2086 continue
2089 -release)
2090 prev=release
2091 continue
2094 -rpath)
2095 prev=rpath
2096 continue
2100 prev=xrpath
2101 continue
2104 -R*)
2105 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
2106 # We need an absolute path.
2107 case $dir in
2108 [\\/]* | [A-Za-z]:[\\/]*) ;;
2110 $echo "$modename: only absolute run-paths are allowed" 1>&2
2111 exit $EXIT_FAILURE
2113 esac
2114 case "$xrpath " in
2115 *" $dir "*) ;;
2116 *) xrpath="$xrpath $dir" ;;
2117 esac
2118 continue
2121 -static | -static-libtool-libs)
2122 # The effects of -static are defined in a previous loop.
2123 # We used to do the same as -all-static on platforms that
2124 # didn't have a PIC flag, but the assumption that the effects
2125 # would be equivalent was wrong. It would break on at least
2126 # Digital Unix and AIX.
2127 continue
2130 -thread-safe)
2131 thread_safe=yes
2132 continue
2135 -version-info)
2136 prev=vinfo
2137 continue
2139 -version-number)
2140 prev=vinfo
2141 vinfo_number=yes
2142 continue
2145 -Wc,*)
2146 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
2147 arg=
2148 save_ifs="$IFS"; IFS=','
2149 for flag in $args; do
2150 IFS="$save_ifs"
2151 case $flag in
2152 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2153 flag="\"$flag\""
2155 esac
2156 arg="$arg $wl$flag"
2157 compiler_flags="$compiler_flags $flag"
2158 done
2159 IFS="$save_ifs"
2160 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
2163 -Wl,*)
2164 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
2165 arg=
2166 save_ifs="$IFS"; IFS=','
2167 for flag in $args; do
2168 IFS="$save_ifs"
2169 case $flag in
2170 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2171 flag="\"$flag\""
2173 esac
2174 arg="$arg $wl$flag"
2175 compiler_flags="$compiler_flags $wl$flag"
2176 linker_flags="$linker_flags $flag"
2177 done
2178 IFS="$save_ifs"
2179 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
2182 -Xcompiler)
2183 prev=xcompiler
2184 continue
2187 -Xlinker)
2188 prev=xlinker
2189 continue
2192 -XCClinker)
2193 prev=xcclinker
2194 continue
2197 # Some other compiler flag.
2198 -* | +*)
2199 # Unknown arguments in both finalize_command and compile_command need
2200 # to be aesthetically quoted because they are evaled later.
2201 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2202 case $arg in
2203 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2204 arg="\"$arg\""
2206 esac
2209 *.$objext)
2210 # A standard object.
2211 objs="$objs $arg"
2214 *.lo)
2215 # A libtool-controlled object.
2217 # Check to see that this really is a libtool object.
2218 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2219 pic_object=
2220 non_pic_object=
2222 # Read the .lo file
2223 # If there is no directory component, then add one.
2224 case $arg in
2225 */* | *\\*) . $arg ;;
2226 *) . ./$arg ;;
2227 esac
2229 if test -z "$pic_object" || \
2230 test -z "$non_pic_object" ||
2231 test "$pic_object" = none && \
2232 test "$non_pic_object" = none; then
2233 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
2234 exit $EXIT_FAILURE
2237 # Extract subdirectory from the argument.
2238 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
2239 if test "X$xdir" = "X$arg"; then
2240 xdir=
2241 else
2242 xdir="$xdir/"
2245 if test "$pic_object" != none; then
2246 # Prepend the subdirectory the object is found in.
2247 pic_object="$xdir$pic_object"
2249 if test "$prev" = dlfiles; then
2250 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
2251 dlfiles="$dlfiles $pic_object"
2252 prev=
2253 continue
2254 else
2255 # If libtool objects are unsupported, then we need to preload.
2256 prev=dlprefiles
2260 # CHECK ME: I think I busted this. -Ossama
2261 if test "$prev" = dlprefiles; then
2262 # Preload the old-style object.
2263 dlprefiles="$dlprefiles $pic_object"
2264 prev=
2267 # A PIC object.
2268 libobjs="$libobjs $pic_object"
2269 arg="$pic_object"
2272 # Non-PIC object.
2273 if test "$non_pic_object" != none; then
2274 # Prepend the subdirectory the object is found in.
2275 non_pic_object="$xdir$non_pic_object"
2277 # A standard non-PIC object
2278 non_pic_objects="$non_pic_objects $non_pic_object"
2279 if test -z "$pic_object" || test "$pic_object" = none ; then
2280 arg="$non_pic_object"
2282 else
2283 # If the PIC object exists, use it instead.
2284 # $xdir was prepended to $pic_object above.
2285 non_pic_object="$pic_object"
2286 non_pic_objects="$non_pic_objects $non_pic_object"
2288 else
2289 # Only an error if not doing a dry-run.
2290 if test -z "$run"; then
2291 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
2292 exit $EXIT_FAILURE
2293 else
2294 # Dry-run case.
2296 # Extract subdirectory from the argument.
2297 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
2298 if test "X$xdir" = "X$arg"; then
2299 xdir=
2300 else
2301 xdir="$xdir/"
2304 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
2305 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
2306 libobjs="$libobjs $pic_object"
2307 non_pic_objects="$non_pic_objects $non_pic_object"
2312 *.$libext)
2313 # An archive.
2314 deplibs="$deplibs $arg"
2315 old_deplibs="$old_deplibs $arg"
2316 continue
2319 *.la)
2320 # A libtool-controlled library.
2322 if test "$prev" = dlfiles; then
2323 # This library was specified with -dlopen.
2324 dlfiles="$dlfiles $arg"
2325 prev=
2326 elif test "$prev" = dlprefiles; then
2327 # The library was specified with -dlpreopen.
2328 dlprefiles="$dlprefiles $arg"
2329 prev=
2330 else
2331 deplibs="$deplibs $arg"
2333 continue
2336 # Some other compiler argument.
2338 # Unknown arguments in both finalize_command and compile_command need
2339 # to be aesthetically quoted because they are evaled later.
2340 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2341 case $arg in
2342 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2343 arg="\"$arg\""
2345 esac
2347 esac # arg
2349 # Now actually substitute the argument into the commands.
2350 if test -n "$arg"; then
2351 compile_command="$compile_command $arg"
2352 finalize_command="$finalize_command $arg"
2354 done # argument parsing loop
2356 if test -n "$prev"; then
2357 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2358 $echo "$help" 1>&2
2359 exit $EXIT_FAILURE
2362 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2363 eval arg=\"$export_dynamic_flag_spec\"
2364 compile_command="$compile_command $arg"
2365 finalize_command="$finalize_command $arg"
2368 oldlibs=
2369 # calculate the name of the file, without its directory
2370 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2371 libobjs_save="$libobjs"
2373 if test -n "$shlibpath_var"; then
2374 # get the directories listed in $shlibpath_var
2375 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2376 else
2377 shlib_search_path=
2379 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2380 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2382 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2383 if test "X$output_objdir" = "X$output"; then
2384 output_objdir="$objdir"
2385 else
2386 output_objdir="$output_objdir/$objdir"
2388 # Create the object directory.
2389 if test ! -d "$output_objdir"; then
2390 $show "$mkdir $output_objdir"
2391 $run $mkdir $output_objdir
2392 exit_status=$?
2393 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2394 exit $exit_status
2398 # Determine the type of output
2399 case $output in
2401 $echo "$modename: you must specify an output file" 1>&2
2402 $echo "$help" 1>&2
2403 exit $EXIT_FAILURE
2405 *.$libext) linkmode=oldlib ;;
2406 *.lo | *.$objext) linkmode=obj ;;
2407 *.la) linkmode=lib ;;
2408 *) linkmode=prog ;; # Anything else should be a program.
2409 esac
2411 case $host in
2412 *cygwin* | *mingw* | *pw32*)
2413 # don't eliminate duplications in $postdeps and $predeps
2414 duplicate_compiler_generated_deps=yes
2417 duplicate_compiler_generated_deps=$duplicate_deps
2419 esac
2420 specialdeplibs=
2422 libs=
2423 # Find all interdependent deplibs by searching for libraries
2424 # that are linked more than once (e.g. -la -lb -la)
2425 for deplib in $deplibs; do
2426 if test "X$duplicate_deps" = "Xyes" ; then
2427 case "$libs " in
2428 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2429 esac
2431 libs="$libs $deplib"
2432 done
2434 if test "$linkmode" = lib; then
2435 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2437 # Compute libraries that are listed more than once in $predeps
2438 # $postdeps and mark them as special (i.e., whose duplicates are
2439 # not to be eliminated).
2440 pre_post_deps=
2441 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2442 for pre_post_dep in $predeps $postdeps; do
2443 case "$pre_post_deps " in
2444 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2445 esac
2446 pre_post_deps="$pre_post_deps $pre_post_dep"
2447 done
2449 pre_post_deps=
2452 deplibs=
2453 newdependency_libs=
2454 newlib_search_path=
2455 need_relink=no # whether we're linking any uninstalled libtool libraries
2456 notinst_deplibs= # not-installed libtool libraries
2457 case $linkmode in
2458 lib)
2459 passes="conv link"
2460 for file in $dlfiles $dlprefiles; do
2461 case $file in
2462 *.la) ;;
2464 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2465 exit $EXIT_FAILURE
2467 esac
2468 done
2470 prog)
2471 compile_deplibs=
2472 finalize_deplibs=
2473 alldeplibs=no
2474 newdlfiles=
2475 newdlprefiles=
2476 passes="conv scan dlopen dlpreopen link"
2478 *) passes="conv"
2480 esac
2481 for pass in $passes; do
2482 if test "$linkmode,$pass" = "lib,link" ||
2483 test "$linkmode,$pass" = "prog,scan"; then
2484 libs="$deplibs"
2485 deplibs=
2487 if test "$linkmode" = prog; then
2488 case $pass in
2489 dlopen) libs="$dlfiles" ;;
2490 dlpreopen) libs="$dlprefiles" ;;
2491 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2492 esac
2494 if test "$pass" = dlopen; then
2495 # Collect dlpreopened libraries
2496 save_deplibs="$deplibs"
2497 deplibs=
2499 for deplib in $libs; do
2500 lib=
2501 found=no
2502 case $deplib in
2503 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2504 if test "$linkmode,$pass" = "prog,link"; then
2505 compile_deplibs="$deplib $compile_deplibs"
2506 finalize_deplibs="$deplib $finalize_deplibs"
2507 else
2508 compiler_flags="$compiler_flags $deplib"
2510 continue
2512 -l*)
2513 if test "$linkmode" != lib && test "$linkmode" != prog; then
2514 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2515 continue
2517 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2518 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2519 for search_ext in .la $std_shrext .so .a; do
2520 # Search the libtool library
2521 lib="$searchdir/lib${name}${search_ext}"
2522 if test -f "$lib"; then
2523 if test "$search_ext" = ".la"; then
2524 found=yes
2525 else
2526 found=no
2528 break 2
2530 done
2531 done
2532 if test "$found" != yes; then
2533 # deplib doesn't seem to be a libtool library
2534 if test "$linkmode,$pass" = "prog,link"; then
2535 compile_deplibs="$deplib $compile_deplibs"
2536 finalize_deplibs="$deplib $finalize_deplibs"
2537 else
2538 deplibs="$deplib $deplibs"
2539 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2541 continue
2542 else # deplib is a libtool library
2543 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2544 # We need to do some special things here, and not later.
2545 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2546 case " $predeps $postdeps " in
2547 *" $deplib "*)
2548 if (${SED} -e '2q' $lib |
2549 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2550 library_names=
2551 old_library=
2552 case $lib in
2553 */* | *\\*) . $lib ;;
2554 *) . ./$lib ;;
2555 esac
2556 for l in $old_library $library_names; do
2557 ll="$l"
2558 done
2559 if test "X$ll" = "X$old_library" ; then # only static version available
2560 found=no
2561 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2562 test "X$ladir" = "X$lib" && ladir="."
2563 lib=$ladir/$old_library
2564 if test "$linkmode,$pass" = "prog,link"; then
2565 compile_deplibs="$deplib $compile_deplibs"
2566 finalize_deplibs="$deplib $finalize_deplibs"
2567 else
2568 deplibs="$deplib $deplibs"
2569 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2571 continue
2575 *) ;;
2576 esac
2579 ;; # -l
2580 -L*)
2581 case $linkmode in
2582 lib)
2583 deplibs="$deplib $deplibs"
2584 test "$pass" = conv && continue
2585 newdependency_libs="$deplib $newdependency_libs"
2586 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2588 prog)
2589 if test "$pass" = conv; then
2590 deplibs="$deplib $deplibs"
2591 continue
2593 if test "$pass" = scan; then
2594 deplibs="$deplib $deplibs"
2595 else
2596 compile_deplibs="$deplib $compile_deplibs"
2597 finalize_deplibs="$deplib $finalize_deplibs"
2599 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2602 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2604 esac # linkmode
2605 continue
2606 ;; # -L
2607 -R*)
2608 if test "$pass" = link; then
2609 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2610 # Make sure the xrpath contains only unique directories.
2611 case "$xrpath " in
2612 *" $dir "*) ;;
2613 *) xrpath="$xrpath $dir" ;;
2614 esac
2616 deplibs="$deplib $deplibs"
2617 continue
2619 *.la) lib="$deplib" ;;
2620 *.$libext)
2621 if test "$pass" = conv; then
2622 deplibs="$deplib $deplibs"
2623 continue
2625 case $linkmode in
2626 lib)
2627 valid_a_lib=no
2628 case $deplibs_check_method in
2629 match_pattern*)
2630 set dummy $deplibs_check_method
2631 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2632 if eval $echo \"$deplib\" 2>/dev/null \
2633 | $SED 10q \
2634 | $EGREP "$match_pattern_regex" > /dev/null; then
2635 valid_a_lib=yes
2638 pass_all)
2639 valid_a_lib=yes
2641 esac
2642 if test "$valid_a_lib" != yes; then
2643 $echo
2644 $echo "*** Warning: Trying to link with static lib archive $deplib."
2645 $echo "*** I have the capability to make that library automatically link in when"
2646 $echo "*** you link to this library. But I can only do this if you have a"
2647 $echo "*** shared version of the library, which you do not appear to have"
2648 $echo "*** because the file extensions .$libext of this argument makes me believe"
2649 $echo "*** that it is just a static archive that I should not used here."
2650 else
2651 $echo
2652 $echo "*** Warning: Linking the shared library $output against the"
2653 $echo "*** static library $deplib is not portable!"
2654 deplibs="$deplib $deplibs"
2656 continue
2658 prog)
2659 if test "$pass" != link; then
2660 deplibs="$deplib $deplibs"
2661 else
2662 compile_deplibs="$deplib $compile_deplibs"
2663 finalize_deplibs="$deplib $finalize_deplibs"
2665 continue
2667 esac # linkmode
2668 ;; # *.$libext
2669 *.lo | *.$objext)
2670 if test "$pass" = conv; then
2671 deplibs="$deplib $deplibs"
2672 elif test "$linkmode" = prog; then
2673 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2674 # If there is no dlopen support or we're linking statically,
2675 # we need to preload.
2676 newdlprefiles="$newdlprefiles $deplib"
2677 compile_deplibs="$deplib $compile_deplibs"
2678 finalize_deplibs="$deplib $finalize_deplibs"
2679 else
2680 newdlfiles="$newdlfiles $deplib"
2683 continue
2685 %DEPLIBS%)
2686 alldeplibs=yes
2687 continue
2689 esac # case $deplib
2690 if test "$found" = yes || test -f "$lib"; then :
2691 else
2692 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2693 exit $EXIT_FAILURE
2696 # Check to see that this really is a libtool archive.
2697 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2698 else
2699 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2700 exit $EXIT_FAILURE
2703 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2704 test "X$ladir" = "X$lib" && ladir="."
2706 dlname=
2707 dlopen=
2708 dlpreopen=
2709 libdir=
2710 library_names=
2711 old_library=
2712 # If the library was installed with an old release of libtool,
2713 # it will not redefine variables installed, or shouldnotlink
2714 installed=yes
2715 shouldnotlink=no
2716 avoidtemprpath=
2719 # Read the .la file
2720 case $lib in
2721 */* | *\\*) . $lib ;;
2722 *) . ./$lib ;;
2723 esac
2725 if test "$linkmode,$pass" = "lib,link" ||
2726 test "$linkmode,$pass" = "prog,scan" ||
2727 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2728 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2729 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2732 if test "$pass" = conv; then
2733 # Only check for convenience libraries
2734 deplibs="$lib $deplibs"
2735 if test -z "$libdir"; then
2736 if test -z "$old_library"; then
2737 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2738 exit $EXIT_FAILURE
2740 # It is a libtool convenience library, so add in its objects.
2741 convenience="$convenience $ladir/$objdir/$old_library"
2742 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2743 tmp_libs=
2744 for deplib in $dependency_libs; do
2745 deplibs="$deplib $deplibs"
2746 if test "X$duplicate_deps" = "Xyes" ; then
2747 case "$tmp_libs " in
2748 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2749 esac
2751 tmp_libs="$tmp_libs $deplib"
2752 done
2753 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2754 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2755 exit $EXIT_FAILURE
2757 continue
2758 fi # $pass = conv
2761 # Get the name of the library we link against.
2762 linklib=
2763 for l in $old_library $library_names; do
2764 linklib="$l"
2765 done
2766 if test -z "$linklib"; then
2767 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2768 exit $EXIT_FAILURE
2771 # This library was specified with -dlopen.
2772 if test "$pass" = dlopen; then
2773 if test -z "$libdir"; then
2774 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2775 exit $EXIT_FAILURE
2777 if test -z "$dlname" ||
2778 test "$dlopen_support" != yes ||
2779 test "$build_libtool_libs" = no; then
2780 # If there is no dlname, no dlopen support or we're linking
2781 # statically, we need to preload. We also need to preload any
2782 # dependent libraries so libltdl's deplib preloader doesn't
2783 # bomb out in the load deplibs phase.
2784 dlprefiles="$dlprefiles $lib $dependency_libs"
2785 else
2786 newdlfiles="$newdlfiles $lib"
2788 continue
2789 fi # $pass = dlopen
2791 # We need an absolute path.
2792 case $ladir in
2793 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2795 abs_ladir=`cd "$ladir" && pwd`
2796 if test -z "$abs_ladir"; then
2797 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2798 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2799 abs_ladir="$ladir"
2802 esac
2803 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2805 # Find the relevant object directory and library name.
2806 if test "X$installed" = Xyes; then
2807 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2808 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2809 dir="$ladir"
2810 absdir="$abs_ladir"
2811 libdir="$abs_ladir"
2812 else
2813 dir="$libdir"
2814 absdir="$libdir"
2816 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2817 else
2818 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2819 dir="$ladir"
2820 absdir="$abs_ladir"
2821 # Remove this search path later
2822 notinst_path="$notinst_path $abs_ladir"
2823 else
2824 dir="$ladir/$objdir"
2825 absdir="$abs_ladir/$objdir"
2826 # Remove this search path later
2827 notinst_path="$notinst_path $abs_ladir"
2829 fi # $installed = yes
2830 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2832 # This library was specified with -dlpreopen.
2833 if test "$pass" = dlpreopen; then
2834 if test -z "$libdir"; then
2835 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2836 exit $EXIT_FAILURE
2838 # Prefer using a static library (so that no silly _DYNAMIC symbols
2839 # are required to link).
2840 if test -n "$old_library"; then
2841 newdlprefiles="$newdlprefiles $dir/$old_library"
2842 # Otherwise, use the dlname, so that lt_dlopen finds it.
2843 elif test -n "$dlname"; then
2844 newdlprefiles="$newdlprefiles $dir/$dlname"
2845 else
2846 newdlprefiles="$newdlprefiles $dir/$linklib"
2848 fi # $pass = dlpreopen
2850 if test -z "$libdir"; then
2851 # Link the convenience library
2852 if test "$linkmode" = lib; then
2853 deplibs="$dir/$old_library $deplibs"
2854 elif test "$linkmode,$pass" = "prog,link"; then
2855 compile_deplibs="$dir/$old_library $compile_deplibs"
2856 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2857 else
2858 deplibs="$lib $deplibs" # used for prog,scan pass
2860 continue
2864 if test "$linkmode" = prog && test "$pass" != link; then
2865 newlib_search_path="$newlib_search_path $ladir"
2866 deplibs="$lib $deplibs"
2868 linkalldeplibs=no
2869 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2870 test "$build_libtool_libs" = no; then
2871 linkalldeplibs=yes
2874 tmp_libs=
2875 for deplib in $dependency_libs; do
2876 case $deplib in
2877 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2878 esac
2879 # Need to link against all dependency_libs?
2880 if test "$linkalldeplibs" = yes; then
2881 deplibs="$deplib $deplibs"
2882 else
2883 # Need to hardcode shared library paths
2884 # or/and link against static libraries
2885 newdependency_libs="$deplib $newdependency_libs"
2887 if test "X$duplicate_deps" = "Xyes" ; then
2888 case "$tmp_libs " in
2889 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2890 esac
2892 tmp_libs="$tmp_libs $deplib"
2893 done # for deplib
2894 continue
2895 fi # $linkmode = prog...
2897 if test "$linkmode,$pass" = "prog,link"; then
2898 if test -n "$library_names" &&
2899 { { test "$prefer_static_libs" = no ||
2900 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2901 test -z "$old_library"; }; then
2902 # We need to hardcode the library path
2903 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2904 # Make sure the rpath contains only unique directories.
2905 case "$temp_rpath " in
2906 *" $dir "*) ;;
2907 *" $absdir "*) ;;
2908 *) temp_rpath="$temp_rpath $absdir" ;;
2909 esac
2912 # Hardcode the library path.
2913 # Skip directories that are in the system default run-time
2914 # search path.
2915 case " $sys_lib_dlsearch_path " in
2916 *" $absdir "*) ;;
2918 case "$compile_rpath " in
2919 *" $absdir "*) ;;
2920 *) compile_rpath="$compile_rpath $absdir"
2921 esac
2923 esac
2924 case " $sys_lib_dlsearch_path " in
2925 *" $libdir "*) ;;
2927 case "$finalize_rpath " in
2928 *" $libdir "*) ;;
2929 *) finalize_rpath="$finalize_rpath $libdir"
2930 esac
2932 esac
2933 fi # $linkmode,$pass = prog,link...
2935 if test "$alldeplibs" = yes &&
2936 { test "$deplibs_check_method" = pass_all ||
2937 { test "$build_libtool_libs" = yes &&
2938 test -n "$library_names"; }; }; then
2939 # We only need to search for static libraries
2940 continue
2944 link_static=no # Whether the deplib will be linked statically
2945 use_static_libs=$prefer_static_libs
2946 if test "$use_static_libs" = built && test "$installed" = yes ; then
2947 use_static_libs=no
2949 if test -n "$library_names" &&
2950 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2951 if test "$installed" = no; then
2952 notinst_deplibs="$notinst_deplibs $lib"
2953 need_relink=yes
2955 # This is a shared library
2957 # Warn about portability, can't link against -module's on
2958 # some systems (darwin)
2959 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2960 $echo
2961 if test "$linkmode" = prog; then
2962 $echo "*** Warning: Linking the executable $output against the loadable module"
2963 else
2964 $echo "*** Warning: Linking the shared library $output against the loadable module"
2966 $echo "*** $linklib is not portable!"
2968 if test "$linkmode" = lib &&
2969 test "$hardcode_into_libs" = yes; then
2970 # Hardcode the library path.
2971 # Skip directories that are in the system default run-time
2972 # search path.
2973 case " $sys_lib_dlsearch_path " in
2974 *" $absdir "*) ;;
2976 case "$compile_rpath " in
2977 *" $absdir "*) ;;
2978 *) compile_rpath="$compile_rpath $absdir"
2979 esac
2981 esac
2982 case " $sys_lib_dlsearch_path " in
2983 *" $libdir "*) ;;
2985 case "$finalize_rpath " in
2986 *" $libdir "*) ;;
2987 *) finalize_rpath="$finalize_rpath $libdir"
2988 esac
2990 esac
2993 if test -n "$old_archive_from_expsyms_cmds"; then
2994 # figure out the soname
2995 set dummy $library_names
2996 realname="$2"
2997 shift; shift
2998 libname=`eval \\$echo \"$libname_spec\"`
2999 # use dlname if we got it. it's perfectly good, no?
3000 if test -n "$dlname"; then
3001 soname="$dlname"
3002 elif test -n "$soname_spec"; then
3003 # bleh windows
3004 case $host in
3005 *cygwin* | mingw*)
3006 major=`expr $current - $age`
3007 versuffix="-$major"
3009 esac
3010 eval soname=\"$soname_spec\"
3011 else
3012 soname="$realname"
3015 # Make a new name for the extract_expsyms_cmds to use
3016 soroot="$soname"
3017 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
3018 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
3020 # If the library has no export list, then create one now
3021 if test -f "$output_objdir/$soname-def"; then :
3022 else
3023 $show "extracting exported symbol list from \`$soname'"
3024 save_ifs="$IFS"; IFS='~'
3025 cmds=$extract_expsyms_cmds
3026 for cmd in $cmds; do
3027 IFS="$save_ifs"
3028 eval cmd=\"$cmd\"
3029 $show "$cmd"
3030 $run eval "$cmd" || exit $?
3031 done
3032 IFS="$save_ifs"
3035 # Create $newlib
3036 if test -f "$output_objdir/$newlib"; then :; else
3037 $show "generating import library for \`$soname'"
3038 save_ifs="$IFS"; IFS='~'
3039 cmds=$old_archive_from_expsyms_cmds
3040 for cmd in $cmds; do
3041 IFS="$save_ifs"
3042 eval cmd=\"$cmd\"
3043 $show "$cmd"
3044 $run eval "$cmd" || exit $?
3045 done
3046 IFS="$save_ifs"
3048 # make sure the library variables are pointing to the new library
3049 dir=$output_objdir
3050 linklib=$newlib
3051 fi # test -n "$old_archive_from_expsyms_cmds"
3053 if test "$linkmode" = prog || test "$mode" != relink; then
3054 add_shlibpath=
3055 add_dir=
3056 add=
3057 lib_linked=yes
3058 case $hardcode_action in
3059 immediate | unsupported)
3060 if test "$hardcode_direct" = no; then
3061 add="$dir/$linklib"
3062 case $host in
3063 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
3064 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
3065 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
3066 *-*-unixware7*) add_dir="-L$dir" ;;
3067 *-*-darwin* )
3068 # if the lib is a module then we can not link against
3069 # it, someone is ignoring the new warnings I added
3070 if /usr/bin/file -L $add 2> /dev/null |
3071 $EGREP ": [^:]* bundle" >/dev/null ; then
3072 $echo "** Warning, lib $linklib is a module, not a shared library"
3073 if test -z "$old_library" ; then
3074 $echo
3075 $echo "** And there doesn't seem to be a static archive available"
3076 $echo "** The link will probably fail, sorry"
3077 else
3078 add="$dir/$old_library"
3081 esac
3082 elif test "$hardcode_minus_L" = no; then
3083 case $host in
3084 *-*-sunos*) add_shlibpath="$dir" ;;
3085 esac
3086 add_dir="-L$dir"
3087 add="-l$name"
3088 elif test "$hardcode_shlibpath_var" = no; then
3089 add_shlibpath="$dir"
3090 add="-l$name"
3091 else
3092 lib_linked=no
3095 relink)
3096 if test "$hardcode_direct" = yes; then
3097 add="$dir/$linklib"
3098 elif test "$hardcode_minus_L" = yes; then
3099 add_dir="-L$dir"
3100 # Try looking first in the location we're being installed to.
3101 if test -n "$inst_prefix_dir"; then
3102 case $libdir in
3103 [\\/]*)
3104 add_dir="$add_dir -L$inst_prefix_dir$libdir"
3106 esac
3108 add="-l$name"
3109 elif test "$hardcode_shlibpath_var" = yes; then
3110 add_shlibpath="$dir"
3111 add="-l$name"
3112 else
3113 lib_linked=no
3116 *) lib_linked=no ;;
3117 esac
3119 if test "$lib_linked" != yes; then
3120 $echo "$modename: configuration error: unsupported hardcode properties"
3121 exit $EXIT_FAILURE
3124 if test -n "$add_shlibpath"; then
3125 case :$compile_shlibpath: in
3126 *":$add_shlibpath:"*) ;;
3127 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
3128 esac
3130 if test "$linkmode" = prog; then
3131 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
3132 test -n "$add" && compile_deplibs="$add $compile_deplibs"
3133 else
3134 test -n "$add_dir" && deplibs="$add_dir $deplibs"
3135 test -n "$add" && deplibs="$add $deplibs"
3136 if test "$hardcode_direct" != yes && \
3137 test "$hardcode_minus_L" != yes && \
3138 test "$hardcode_shlibpath_var" = yes; then
3139 case :$finalize_shlibpath: in
3140 *":$libdir:"*) ;;
3141 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
3142 esac
3147 if test "$linkmode" = prog || test "$mode" = relink; then
3148 add_shlibpath=
3149 add_dir=
3150 add=
3151 # Finalize command for both is simple: just hardcode it.
3152 if test "$hardcode_direct" = yes; then
3153 add="$libdir/$linklib"
3154 elif test "$hardcode_minus_L" = yes; then
3155 add_dir="-L$libdir"
3156 add="-l$name"
3157 elif test "$hardcode_shlibpath_var" = yes; then
3158 case :$finalize_shlibpath: in
3159 *":$libdir:"*) ;;
3160 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
3161 esac
3162 add="-l$name"
3163 elif test "$hardcode_automatic" = yes; then
3164 if test -n "$inst_prefix_dir" &&
3165 test -f "$inst_prefix_dir$libdir/$linklib" ; then
3166 add="$inst_prefix_dir$libdir/$linklib"
3167 else
3168 add="$libdir/$linklib"
3170 else
3171 # We cannot seem to hardcode it, guess we'll fake it.
3172 add_dir="-L$libdir"
3173 # Try looking first in the location we're being installed to.
3174 if test -n "$inst_prefix_dir"; then
3175 case $libdir in
3176 [\\/]*)
3177 add_dir="$add_dir -L$inst_prefix_dir$libdir"
3179 esac
3181 add="-l$name"
3184 if test "$linkmode" = prog; then
3185 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
3186 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
3187 else
3188 test -n "$add_dir" && deplibs="$add_dir $deplibs"
3189 test -n "$add" && deplibs="$add $deplibs"
3192 elif test "$linkmode" = prog; then
3193 # Here we assume that one of hardcode_direct or hardcode_minus_L
3194 # is not unsupported. This is valid on all known static and
3195 # shared platforms.
3196 if test "$hardcode_direct" != unsupported; then
3197 test -n "$old_library" && linklib="$old_library"
3198 compile_deplibs="$dir/$linklib $compile_deplibs"
3199 finalize_deplibs="$dir/$linklib $finalize_deplibs"
3200 else
3201 compile_deplibs="-l$name -L$dir $compile_deplibs"
3202 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
3204 elif test "$build_libtool_libs" = yes; then
3205 # Not a shared library
3206 if test "$deplibs_check_method" != pass_all; then
3207 # We're trying link a shared library against a static one
3208 # but the system doesn't support it.
3210 # Just print a warning and add the library to dependency_libs so
3211 # that the program can be linked against the static library.
3212 $echo
3213 $echo "*** Warning: This system can not link to static lib archive $lib."
3214 $echo "*** I have the capability to make that library automatically link in when"
3215 $echo "*** you link to this library. But I can only do this if you have a"
3216 $echo "*** shared version of the library, which you do not appear to have."
3217 if test "$module" = yes; then
3218 $echo "*** But as you try to build a module library, libtool will still create "
3219 $echo "*** a static module, that should work as long as the dlopening application"
3220 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
3221 if test -z "$global_symbol_pipe"; then
3222 $echo
3223 $echo "*** However, this would only work if libtool was able to extract symbol"
3224 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3225 $echo "*** not find such a program. So, this module is probably useless."
3226 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3228 if test "$build_old_libs" = no; then
3229 build_libtool_libs=module
3230 build_old_libs=yes
3231 else
3232 build_libtool_libs=no
3235 else
3236 deplibs="$dir/$old_library $deplibs"
3237 link_static=yes
3239 fi # link shared/static library?
3241 if test "$linkmode" = lib; then
3242 if test -n "$dependency_libs" &&
3243 { test "$hardcode_into_libs" != yes ||
3244 test "$build_old_libs" = yes ||
3245 test "$link_static" = yes; }; then
3246 # Extract -R from dependency_libs
3247 temp_deplibs=
3248 for libdir in $dependency_libs; do
3249 case $libdir in
3250 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
3251 case " $xrpath " in
3252 *" $temp_xrpath "*) ;;
3253 *) xrpath="$xrpath $temp_xrpath";;
3254 esac;;
3255 *) temp_deplibs="$temp_deplibs $libdir";;
3256 esac
3257 done
3258 dependency_libs="$temp_deplibs"
3261 newlib_search_path="$newlib_search_path $absdir"
3262 # Link against this library
3263 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
3264 # ... and its dependency_libs
3265 tmp_libs=
3266 for deplib in $dependency_libs; do
3267 newdependency_libs="$deplib $newdependency_libs"
3268 if test "X$duplicate_deps" = "Xyes" ; then
3269 case "$tmp_libs " in
3270 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3271 esac
3273 tmp_libs="$tmp_libs $deplib"
3274 done
3276 if test "$link_all_deplibs" != no; then
3277 # Add the search paths of all dependency libraries
3278 for deplib in $dependency_libs; do
3279 case $deplib in
3280 -L*) path="$deplib" ;;
3281 *.la)
3282 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
3283 test "X$dir" = "X$deplib" && dir="."
3284 # We need an absolute path.
3285 case $dir in
3286 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
3288 absdir=`cd "$dir" && pwd`
3289 if test -z "$absdir"; then
3290 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
3291 absdir="$dir"
3294 esac
3295 if grep "^installed=no" $deplib > /dev/null; then
3296 path="$absdir/$objdir"
3297 else
3298 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3299 if test -z "$libdir"; then
3300 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3301 exit $EXIT_FAILURE
3303 if test "$absdir" != "$libdir"; then
3304 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
3306 path="$absdir"
3308 depdepl=
3309 case $host in
3310 *-*-darwin*)
3311 # we do not want to link against static libs,
3312 # but need to link against shared
3313 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
3314 if test -n "$deplibrary_names" ; then
3315 for tmp in $deplibrary_names ; do
3316 depdepl=$tmp
3317 done
3318 if test -f "$path/$depdepl" ; then
3319 depdepl="$path/$depdepl"
3321 # do not add paths which are already there
3322 case " $newlib_search_path " in
3323 *" $path "*) ;;
3324 *) newlib_search_path="$newlib_search_path $path";;
3325 esac
3327 path=""
3330 path="-L$path"
3332 esac
3334 -l*)
3335 case $host in
3336 *-*-darwin*)
3337 # Again, we only want to link against shared libraries
3338 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
3339 for tmp in $newlib_search_path ; do
3340 if test -f "$tmp/lib$tmp_libs.dylib" ; then
3341 eval depdepl="$tmp/lib$tmp_libs.dylib"
3342 break
3344 done
3345 path=""
3347 *) continue ;;
3348 esac
3350 *) continue ;;
3351 esac
3352 case " $deplibs " in
3353 *" $path "*) ;;
3354 *) deplibs="$path $deplibs" ;;
3355 esac
3356 case " $deplibs " in
3357 *" $depdepl "*) ;;
3358 *) deplibs="$depdepl $deplibs" ;;
3359 esac
3360 done
3361 fi # link_all_deplibs != no
3362 fi # linkmode = lib
3363 done # for deplib in $libs
3364 dependency_libs="$newdependency_libs"
3365 if test "$pass" = dlpreopen; then
3366 # Link the dlpreopened libraries before other libraries
3367 for deplib in $save_deplibs; do
3368 deplibs="$deplib $deplibs"
3369 done
3371 if test "$pass" != dlopen; then
3372 if test "$pass" != conv; then
3373 # Make sure lib_search_path contains only unique directories.
3374 lib_search_path=
3375 for dir in $newlib_search_path; do
3376 case "$lib_search_path " in
3377 *" $dir "*) ;;
3378 *) lib_search_path="$lib_search_path $dir" ;;
3379 esac
3380 done
3381 newlib_search_path=
3384 if test "$linkmode,$pass" != "prog,link"; then
3385 vars="deplibs"
3386 else
3387 vars="compile_deplibs finalize_deplibs"
3389 for var in $vars dependency_libs; do
3390 # Add libraries to $var in reverse order
3391 eval tmp_libs=\"\$$var\"
3392 new_libs=
3393 for deplib in $tmp_libs; do
3394 # FIXME: Pedantically, this is the right thing to do, so
3395 # that some nasty dependency loop isn't accidentally
3396 # broken:
3397 #new_libs="$deplib $new_libs"
3398 # Pragmatically, this seems to cause very few problems in
3399 # practice:
3400 case $deplib in
3401 -L*) new_libs="$deplib $new_libs" ;;
3402 -R*) ;;
3404 # And here is the reason: when a library appears more
3405 # than once as an explicit dependence of a library, or
3406 # is implicitly linked in more than once by the
3407 # compiler, it is considered special, and multiple
3408 # occurrences thereof are not removed. Compare this
3409 # with having the same library being listed as a
3410 # dependency of multiple other libraries: in this case,
3411 # we know (pedantically, we assume) the library does not
3412 # need to be listed more than once, so we keep only the
3413 # last copy. This is not always right, but it is rare
3414 # enough that we require users that really mean to play
3415 # such unportable linking tricks to link the library
3416 # using -Wl,-lname, so that libtool does not consider it
3417 # for duplicate removal.
3418 case " $specialdeplibs " in
3419 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3421 case " $new_libs " in
3422 *" $deplib "*) ;;
3423 *) new_libs="$deplib $new_libs" ;;
3424 esac
3426 esac
3428 esac
3429 done
3430 tmp_libs=
3431 for deplib in $new_libs; do
3432 case $deplib in
3433 -L*)
3434 case " $tmp_libs " in
3435 *" $deplib "*) ;;
3436 *) tmp_libs="$tmp_libs $deplib" ;;
3437 esac
3439 *) tmp_libs="$tmp_libs $deplib" ;;
3440 esac
3441 done
3442 eval $var=\"$tmp_libs\"
3443 done # for var
3445 # Last step: remove runtime libs from dependency_libs
3446 # (they stay in deplibs)
3447 tmp_libs=
3448 for i in $dependency_libs ; do
3449 case " $predeps $postdeps $compiler_lib_search_path " in
3450 *" $i "*)
3451 i=""
3453 esac
3454 if test -n "$i" ; then
3455 tmp_libs="$tmp_libs $i"
3457 done
3458 dependency_libs=$tmp_libs
3459 done # for pass
3460 if test "$linkmode" = prog; then
3461 dlfiles="$newdlfiles"
3462 dlprefiles="$newdlprefiles"
3465 case $linkmode in
3466 oldlib)
3467 if test -n "$deplibs"; then
3468 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3471 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3472 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3475 if test -n "$rpath"; then
3476 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3479 if test -n "$xrpath"; then
3480 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3483 if test -n "$vinfo"; then
3484 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3487 if test -n "$release"; then
3488 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3491 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3492 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3495 # Now set the variables for building old libraries.
3496 build_libtool_libs=no
3497 oldlibs="$output"
3498 objs="$objs$old_deplibs"
3501 lib)
3502 # Make sure we only generate libraries of the form `libNAME.la'.
3503 case $outputname in
3504 lib*)
3505 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3506 eval shared_ext=\"$shrext_cmds\"
3507 eval libname=\"$libname_spec\"
3510 if test "$module" = no; then
3511 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3512 $echo "$help" 1>&2
3513 exit $EXIT_FAILURE
3515 if test "$need_lib_prefix" != no; then
3516 # Add the "lib" prefix for modules if required
3517 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3518 eval shared_ext=\"$shrext_cmds\"
3519 eval libname=\"$libname_spec\"
3520 else
3521 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3524 esac
3526 if test -n "$objs"; then
3527 if test "$deplibs_check_method" != pass_all; then
3528 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3529 exit $EXIT_FAILURE
3530 else
3531 $echo
3532 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3533 $echo "*** objects $objs is not portable!"
3534 libobjs="$libobjs $objs"
3538 if test "$dlself" != no; then
3539 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3542 set dummy $rpath
3543 if test "$#" -gt 2; then
3544 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3546 install_libdir="$2"
3548 oldlibs=
3549 if test -z "$rpath"; then
3550 if test "$build_libtool_libs" = yes; then
3551 # Building a libtool convenience library.
3552 # Some compilers have problems with a `.al' extension so
3553 # convenience libraries should have the same extension an
3554 # archive normally would.
3555 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3556 build_libtool_libs=convenience
3557 build_old_libs=yes
3560 if test -n "$vinfo"; then
3561 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3564 if test -n "$release"; then
3565 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3567 else
3569 # Parse the version information argument.
3570 save_ifs="$IFS"; IFS=':'
3571 set dummy $vinfo 0 0 0
3572 IFS="$save_ifs"
3574 if test -n "$8"; then
3575 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3576 $echo "$help" 1>&2
3577 exit $EXIT_FAILURE
3580 # convert absolute version numbers to libtool ages
3581 # this retains compatibility with .la files and attempts
3582 # to make the code below a bit more comprehensible
3584 case $vinfo_number in
3585 yes)
3586 number_major="$2"
3587 number_minor="$3"
3588 number_revision="$4"
3590 # There are really only two kinds -- those that
3591 # use the current revision as the major version
3592 # and those that subtract age and use age as
3593 # a minor version. But, then there is irix
3594 # which has an extra 1 added just for fun
3596 case $version_type in
3597 darwin|linux|osf|windows|none)
3598 current=`expr $number_major + $number_minor`
3599 age="$number_minor"
3600 revision="$number_revision"
3602 freebsd-aout|freebsd-elf|sunos)
3603 current="$number_major"
3604 revision="$number_minor"
3605 age="0"
3607 irix|nonstopux)
3608 current=`expr $number_major + $number_minor - 1`
3609 age="$number_minor"
3610 revision="$number_minor"
3612 esac
3615 current="$2"
3616 revision="$3"
3617 age="$4"
3619 esac
3621 # Check that each of the things are valid numbers.
3622 case $current in
3623 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]) ;;
3625 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3626 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3627 exit $EXIT_FAILURE
3629 esac
3631 case $revision in
3632 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]) ;;
3634 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3635 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3636 exit $EXIT_FAILURE
3638 esac
3640 case $age in
3641 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]) ;;
3643 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3644 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3645 exit $EXIT_FAILURE
3647 esac
3649 if test "$age" -gt "$current"; then
3650 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3651 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3652 exit $EXIT_FAILURE
3655 # Calculate the version variables.
3656 major=
3657 versuffix=
3658 verstring=
3659 case $version_type in
3660 none) ;;
3662 darwin)
3663 # Like Linux, but with the current version available in
3664 # verstring for coding it into the library header
3665 major=.`expr $current - $age`
3666 versuffix="$major.$age.$revision"
3667 # Darwin ld doesn't like 0 for these options...
3668 minor_current=`expr $current + 1`
3669 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3672 freebsd-aout)
3673 major=".$current"
3674 versuffix=".$current.$revision";
3677 freebsd-elf)
3678 major=".$current"
3679 versuffix=".$current";
3682 irix | nonstopux)
3683 major=`expr $current - $age + 1`
3685 case $version_type in
3686 nonstopux) verstring_prefix=nonstopux ;;
3687 *) verstring_prefix=sgi ;;
3688 esac
3689 verstring="$verstring_prefix$major.$revision"
3691 # Add in all the interfaces that we are compatible with.
3692 loop=$revision
3693 while test "$loop" -ne 0; do
3694 iface=`expr $revision - $loop`
3695 loop=`expr $loop - 1`
3696 verstring="$verstring_prefix$major.$iface:$verstring"
3697 done
3699 # Before this point, $major must not contain `.'.
3700 major=.$major
3701 versuffix="$major.$revision"
3704 linux)
3705 major=.`expr $current - $age`
3706 versuffix="$major.$age.$revision"
3709 osf)
3710 major=.`expr $current - $age`
3711 versuffix=".$current.$age.$revision"
3712 verstring="$current.$age.$revision"
3714 # Add in all the interfaces that we are compatible with.
3715 loop=$age
3716 while test "$loop" -ne 0; do
3717 iface=`expr $current - $loop`
3718 loop=`expr $loop - 1`
3719 verstring="$verstring:${iface}.0"
3720 done
3722 # Make executables depend on our current version.
3723 verstring="$verstring:${current}.0"
3726 sunos)
3727 major=".$current"
3728 versuffix=".$current.$revision"
3731 windows)
3732 # Use '-' rather than '.', since we only want one
3733 # extension on DOS 8.3 filesystems.
3734 major=`expr $current - $age`
3735 versuffix="-$major"
3739 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3740 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3741 exit $EXIT_FAILURE
3743 esac
3745 # Clear the version info if we defaulted, and they specified a release.
3746 if test -z "$vinfo" && test -n "$release"; then
3747 major=
3748 case $version_type in
3749 darwin)
3750 # we can't check for "0.0" in archive_cmds due to quoting
3751 # problems, so we reset it completely
3752 verstring=
3755 verstring="0.0"
3757 esac
3758 if test "$need_version" = no; then
3759 versuffix=
3760 else
3761 versuffix=".0.0"
3765 # Remove version info from name if versioning should be avoided
3766 if test "$avoid_version" = yes && test "$need_version" = no; then
3767 major=
3768 versuffix=
3769 verstring=""
3772 # Check to see if the archive will have undefined symbols.
3773 if test "$allow_undefined" = yes; then
3774 if test "$allow_undefined_flag" = unsupported; then
3775 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3776 build_libtool_libs=no
3777 build_old_libs=yes
3779 else
3780 # Don't allow undefined symbols.
3781 allow_undefined_flag="$no_undefined_flag"
3785 if test "$mode" != relink; then
3786 # Remove our outputs, but don't remove object files since they
3787 # may have been created when compiling PIC objects.
3788 removelist=
3789 tempremovelist=`$echo "$output_objdir/*"`
3790 for p in $tempremovelist; do
3791 case $p in
3792 *.$objext)
3794 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3795 if test "X$precious_files_regex" != "X"; then
3796 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3797 then
3798 continue
3801 removelist="$removelist $p"
3803 *) ;;
3804 esac
3805 done
3806 if test -n "$removelist"; then
3807 $show "${rm}r $removelist"
3808 $run ${rm}r $removelist
3812 # Now set the variables for building old libraries.
3813 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3814 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3816 # Transform .lo files to .o files.
3817 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3820 # Eliminate all temporary directories.
3821 #for path in $notinst_path; do
3822 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3823 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3824 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3825 #done
3827 if test -n "$xrpath"; then
3828 # If the user specified any rpath flags, then add them.
3829 temp_xrpath=
3830 for libdir in $xrpath; do
3831 temp_xrpath="$temp_xrpath -R$libdir"
3832 case "$finalize_rpath " in
3833 *" $libdir "*) ;;
3834 *) finalize_rpath="$finalize_rpath $libdir" ;;
3835 esac
3836 done
3837 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3838 dependency_libs="$temp_xrpath $dependency_libs"
3842 # Make sure dlfiles contains only unique files that won't be dlpreopened
3843 old_dlfiles="$dlfiles"
3844 dlfiles=
3845 for lib in $old_dlfiles; do
3846 case " $dlprefiles $dlfiles " in
3847 *" $lib "*) ;;
3848 *) dlfiles="$dlfiles $lib" ;;
3849 esac
3850 done
3852 # Make sure dlprefiles contains only unique files
3853 old_dlprefiles="$dlprefiles"
3854 dlprefiles=
3855 for lib in $old_dlprefiles; do
3856 case "$dlprefiles " in
3857 *" $lib "*) ;;
3858 *) dlprefiles="$dlprefiles $lib" ;;
3859 esac
3860 done
3862 if test "$build_libtool_libs" = yes; then
3863 if test -n "$rpath"; then
3864 case $host in
3865 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3866 # these systems don't actually have a c library (as such)!
3868 *-*-rhapsody* | *-*-darwin1.[012])
3869 # Rhapsody C library is in the System framework
3870 deplibs="$deplibs -framework System"
3872 *-*-netbsd*)
3873 # Don't link with libc until the a.out ld.so is fixed.
3875 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3876 # Do not include libc due to us having libc/libc_r.
3878 *-*-sco3.2v5* | *-*-sco5v6*)
3879 # Causes problems with __ctype
3881 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3882 # Compiler inserts libc in the correct place for threads to work
3885 # Add libc to deplibs on all other systems if necessary.
3886 if test "$build_libtool_need_lc" = "yes"; then
3887 deplibs="$deplibs -lc"
3890 esac
3893 # Transform deplibs into only deplibs that can be linked in shared.
3894 name_save=$name
3895 libname_save=$libname
3896 release_save=$release
3897 versuffix_save=$versuffix
3898 major_save=$major
3899 # I'm not sure if I'm treating the release correctly. I think
3900 # release should show up in the -l (ie -lgmp5) so we don't want to
3901 # add it in twice. Is that correct?
3902 release=""
3903 versuffix=""
3904 major=""
3905 newdeplibs=
3906 droppeddeps=no
3907 case $deplibs_check_method in
3908 pass_all)
3909 # Don't check for shared/static. Everything works.
3910 # This might be a little naive. We might want to check
3911 # whether the library exists or not. But this is on
3912 # osf3 & osf4 and I'm not really sure... Just
3913 # implementing what was already the behavior.
3914 newdeplibs=$deplibs
3916 test_compile)
3917 # This code stresses the "libraries are programs" paradigm to its
3918 # limits. Maybe even breaks it. We compile a program, linking it
3919 # against the deplibs as a proxy for the library. Then we can check
3920 # whether they linked in statically or dynamically with ldd.
3921 $rm conftest.c
3922 cat > conftest.c <<EOF
3923 int main() { return 0; }
3925 $rm conftest
3926 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3927 ldd_output=`ldd conftest`
3928 for i in $deplibs; do
3929 name=`expr $i : '-l\(.*\)'`
3930 # If $name is empty we are operating on a -L argument.
3931 if test "$name" != "" && test "$name" != "0"; then
3932 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3933 case " $predeps $postdeps " in
3934 *" $i "*)
3935 newdeplibs="$newdeplibs $i"
3936 i=""
3938 esac
3940 if test -n "$i" ; then
3941 libname=`eval \\$echo \"$libname_spec\"`
3942 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3943 set dummy $deplib_matches
3944 deplib_match=$2
3945 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3946 newdeplibs="$newdeplibs $i"
3947 else
3948 droppeddeps=yes
3949 $echo
3950 $echo "*** Warning: dynamic linker does not accept needed library $i."
3951 $echo "*** I have the capability to make that library automatically link in when"
3952 $echo "*** you link to this library. But I can only do this if you have a"
3953 $echo "*** shared version of the library, which I believe you do not have"
3954 $echo "*** because a test_compile did reveal that the linker did not use it for"
3955 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3958 else
3959 newdeplibs="$newdeplibs $i"
3961 done
3962 else
3963 # Error occurred in the first compile. Let's try to salvage
3964 # the situation: Compile a separate program for each library.
3965 for i in $deplibs; do
3966 name=`expr $i : '-l\(.*\)'`
3967 # If $name is empty we are operating on a -L argument.
3968 if test "$name" != "" && test "$name" != "0"; then
3969 $rm conftest
3970 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3971 ldd_output=`ldd conftest`
3972 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3973 case " $predeps $postdeps " in
3974 *" $i "*)
3975 newdeplibs="$newdeplibs $i"
3976 i=""
3978 esac
3980 if test -n "$i" ; then
3981 libname=`eval \\$echo \"$libname_spec\"`
3982 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3983 set dummy $deplib_matches
3984 deplib_match=$2
3985 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3986 newdeplibs="$newdeplibs $i"
3987 else
3988 droppeddeps=yes
3989 $echo
3990 $echo "*** Warning: dynamic linker does not accept needed library $i."
3991 $echo "*** I have the capability to make that library automatically link in when"
3992 $echo "*** you link to this library. But I can only do this if you have a"
3993 $echo "*** shared version of the library, which you do not appear to have"
3994 $echo "*** because a test_compile did reveal that the linker did not use this one"
3995 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3998 else
3999 droppeddeps=yes
4000 $echo
4001 $echo "*** Warning! Library $i is needed by this library but I was not able to"
4002 $echo "*** make it link in! You will probably need to install it or some"
4003 $echo "*** library that it depends on before this library will be fully"
4004 $echo "*** functional. Installing it before continuing would be even better."
4006 else
4007 newdeplibs="$newdeplibs $i"
4009 done
4012 file_magic*)
4013 set dummy $deplibs_check_method
4014 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
4015 for a_deplib in $deplibs; do
4016 name=`expr $a_deplib : '-l\(.*\)'`
4017 # If $name is empty we are operating on a -L argument.
4018 if test "$name" != "" && test "$name" != "0"; then
4019 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
4020 case " $predeps $postdeps " in
4021 *" $a_deplib "*)
4022 newdeplibs="$newdeplibs $a_deplib"
4023 a_deplib=""
4025 esac
4027 if test -n "$a_deplib" ; then
4028 libname=`eval \\$echo \"$libname_spec\"`
4029 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
4030 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
4031 for potent_lib in $potential_libs; do
4032 # Follow soft links.
4033 if ls -lLd "$potent_lib" 2>/dev/null \
4034 | grep " -> " >/dev/null; then
4035 continue
4037 # The statement above tries to avoid entering an
4038 # endless loop below, in case of cyclic links.
4039 # We might still enter an endless loop, since a link
4040 # loop can be closed while we follow links,
4041 # but so what?
4042 potlib="$potent_lib"
4043 while test -h "$potlib" 2>/dev/null; do
4044 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
4045 case $potliblink in
4046 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
4047 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
4048 esac
4049 done
4050 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
4051 | ${SED} 10q \
4052 | $EGREP "$file_magic_regex" > /dev/null; then
4053 newdeplibs="$newdeplibs $a_deplib"
4054 a_deplib=""
4055 break 2
4057 done
4058 done
4060 if test -n "$a_deplib" ; then
4061 droppeddeps=yes
4062 $echo
4063 $echo "*** Warning: linker path does not have real file for library $a_deplib."
4064 $echo "*** I have the capability to make that library automatically link in when"
4065 $echo "*** you link to this library. But I can only do this if you have a"
4066 $echo "*** shared version of the library, which you do not appear to have"
4067 $echo "*** because I did check the linker path looking for a file starting"
4068 if test -z "$potlib" ; then
4069 $echo "*** with $libname but no candidates were found. (...for file magic test)"
4070 else
4071 $echo "*** with $libname and none of the candidates passed a file format test"
4072 $echo "*** using a file magic. Last file checked: $potlib"
4075 else
4076 # Add a -L argument.
4077 newdeplibs="$newdeplibs $a_deplib"
4079 done # Gone through all deplibs.
4081 match_pattern*)
4082 set dummy $deplibs_check_method
4083 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
4084 for a_deplib in $deplibs; do
4085 name=`expr $a_deplib : '-l\(.*\)'`
4086 # If $name is empty we are operating on a -L argument.
4087 if test -n "$name" && test "$name" != "0"; then
4088 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
4089 case " $predeps $postdeps " in
4090 *" $a_deplib "*)
4091 newdeplibs="$newdeplibs $a_deplib"
4092 a_deplib=""
4094 esac
4096 if test -n "$a_deplib" ; then
4097 libname=`eval \\$echo \"$libname_spec\"`
4098 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
4099 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
4100 for potent_lib in $potential_libs; do
4101 potlib="$potent_lib" # see symlink-check above in file_magic test
4102 if eval $echo \"$potent_lib\" 2>/dev/null \
4103 | ${SED} 10q \
4104 | $EGREP "$match_pattern_regex" > /dev/null; then
4105 newdeplibs="$newdeplibs $a_deplib"
4106 a_deplib=""
4107 break 2
4109 done
4110 done
4112 if test -n "$a_deplib" ; then
4113 droppeddeps=yes
4114 $echo
4115 $echo "*** Warning: linker path does not have real file for library $a_deplib."
4116 $echo "*** I have the capability to make that library automatically link in when"
4117 $echo "*** you link to this library. But I can only do this if you have a"
4118 $echo "*** shared version of the library, which you do not appear to have"
4119 $echo "*** because I did check the linker path looking for a file starting"
4120 if test -z "$potlib" ; then
4121 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
4122 else
4123 $echo "*** with $libname and none of the candidates passed a file format test"
4124 $echo "*** using a regex pattern. Last file checked: $potlib"
4127 else
4128 # Add a -L argument.
4129 newdeplibs="$newdeplibs $a_deplib"
4131 done # Gone through all deplibs.
4133 none | unknown | *)
4134 newdeplibs=""
4135 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
4136 -e 's/ -[LR][^ ]*//g'`
4137 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
4138 for i in $predeps $postdeps ; do
4139 # can't use Xsed below, because $i might contain '/'
4140 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
4141 done
4143 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
4144 | grep . >/dev/null; then
4145 $echo
4146 if test "X$deplibs_check_method" = "Xnone"; then
4147 $echo "*** Warning: inter-library dependencies are not supported in this platform."
4148 else
4149 $echo "*** Warning: inter-library dependencies are not known to be supported."
4151 $echo "*** All declared inter-library dependencies are being dropped."
4152 droppeddeps=yes
4155 esac
4156 versuffix=$versuffix_save
4157 major=$major_save
4158 release=$release_save
4159 libname=$libname_save
4160 name=$name_save
4162 case $host in
4163 *-*-rhapsody* | *-*-darwin1.[012])
4164 # On Rhapsody replace the C library is the System framework
4165 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
4167 esac
4169 if test "$droppeddeps" = yes; then
4170 if test "$module" = yes; then
4171 $echo
4172 $echo "*** Warning: libtool could not satisfy all declared inter-library"
4173 $echo "*** dependencies of module $libname. Therefore, libtool will create"
4174 $echo "*** a static module, that should work as long as the dlopening"
4175 $echo "*** application is linked with the -dlopen flag."
4176 if test -z "$global_symbol_pipe"; then
4177 $echo
4178 $echo "*** However, this would only work if libtool was able to extract symbol"
4179 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
4180 $echo "*** not find such a program. So, this module is probably useless."
4181 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
4183 if test "$build_old_libs" = no; then
4184 oldlibs="$output_objdir/$libname.$libext"
4185 build_libtool_libs=module
4186 build_old_libs=yes
4187 else
4188 build_libtool_libs=no
4190 else
4191 $echo "*** The inter-library dependencies that have been dropped here will be"
4192 $echo "*** automatically added whenever a program is linked with this library"
4193 $echo "*** or is declared to -dlopen it."
4195 if test "$allow_undefined" = no; then
4196 $echo
4197 $echo "*** Since this library must not contain undefined symbols,"
4198 $echo "*** because either the platform does not support them or"
4199 $echo "*** it was explicitly requested with -no-undefined,"
4200 $echo "*** libtool will only create a static version of it."
4201 if test "$build_old_libs" = no; then
4202 oldlibs="$output_objdir/$libname.$libext"
4203 build_libtool_libs=module
4204 build_old_libs=yes
4205 else
4206 build_libtool_libs=no
4211 # Done checking deplibs!
4212 deplibs=$newdeplibs
4216 # move library search paths that coincide with paths to not yet
4217 # installed libraries to the beginning of the library search list
4218 new_libs=
4219 for path in $notinst_path; do
4220 case " $new_libs " in
4221 *" -L$path/$objdir "*) ;;
4223 case " $deplibs " in
4224 *" -L$path/$objdir "*)
4225 new_libs="$new_libs -L$path/$objdir" ;;
4226 esac
4228 esac
4229 done
4230 for deplib in $deplibs; do
4231 case $deplib in
4232 -L*)
4233 case " $new_libs " in
4234 *" $deplib "*) ;;
4235 *) new_libs="$new_libs $deplib" ;;
4236 esac
4238 *) new_libs="$new_libs $deplib" ;;
4239 esac
4240 done
4241 deplibs="$new_libs"
4244 # All the library-specific variables (install_libdir is set above).
4245 library_names=
4246 old_library=
4247 dlname=
4249 # Test again, we may have decided not to build it any more
4250 if test "$build_libtool_libs" = yes; then
4251 if test "$hardcode_into_libs" = yes; then
4252 # Hardcode the library paths
4253 hardcode_libdirs=
4254 dep_rpath=
4255 rpath="$finalize_rpath"
4256 test "$mode" != relink && rpath="$compile_rpath$rpath"
4257 for libdir in $rpath; do
4258 if test -n "$hardcode_libdir_flag_spec"; then
4259 if test -n "$hardcode_libdir_separator"; then
4260 if test -z "$hardcode_libdirs"; then
4261 hardcode_libdirs="$libdir"
4262 else
4263 # Just accumulate the unique libdirs.
4264 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4265 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4268 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4270 esac
4272 else
4273 eval flag=\"$hardcode_libdir_flag_spec\"
4274 dep_rpath="$dep_rpath $flag"
4276 elif test -n "$runpath_var"; then
4277 case "$perm_rpath " in
4278 *" $libdir "*) ;;
4279 *) perm_rpath="$perm_rpath $libdir" ;;
4280 esac
4282 done
4283 # Substitute the hardcoded libdirs into the rpath.
4284 if test -n "$hardcode_libdir_separator" &&
4285 test -n "$hardcode_libdirs"; then
4286 libdir="$hardcode_libdirs"
4287 if test -n "$hardcode_libdir_flag_spec_ld"; then
4288 case $archive_cmds in
4289 *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
4290 *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
4291 esac
4292 else
4293 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
4296 if test -n "$runpath_var" && test -n "$perm_rpath"; then
4297 # We should set the runpath_var.
4298 rpath=
4299 for dir in $perm_rpath; do
4300 rpath="$rpath$dir:"
4301 done
4302 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
4304 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
4307 shlibpath="$finalize_shlibpath"
4308 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
4309 if test -n "$shlibpath"; then
4310 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
4313 # Get the real and link names of the library.
4314 eval shared_ext=\"$shrext_cmds\"
4315 eval library_names=\"$library_names_spec\"
4316 set dummy $library_names
4317 realname="$2"
4318 shift; shift
4320 if test -n "$soname_spec"; then
4321 eval soname=\"$soname_spec\"
4322 else
4323 soname="$realname"
4325 if test -z "$dlname"; then
4326 dlname=$soname
4329 lib="$output_objdir/$realname"
4330 linknames=
4331 for link
4333 linknames="$linknames $link"
4334 done
4336 # Use standard objects if they are pic
4337 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4339 # Prepare the list of exported symbols
4340 if test -z "$export_symbols"; then
4341 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4342 $show "generating symbol list for \`$libname.la'"
4343 export_symbols="$output_objdir/$libname.exp"
4344 $run $rm $export_symbols
4345 cmds=$export_symbols_cmds
4346 save_ifs="$IFS"; IFS='~'
4347 for cmd in $cmds; do
4348 IFS="$save_ifs"
4349 eval cmd=\"$cmd\"
4350 if len=`expr "X$cmd" : ".*"` &&
4351 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4352 $show "$cmd"
4353 $run eval "$cmd" || exit $?
4354 skipped_export=false
4355 else
4356 # The command line is too long to execute in one step.
4357 $show "using reloadable object file for export list..."
4358 skipped_export=:
4359 # Break out early, otherwise skipped_export may be
4360 # set to false by a later but shorter cmd.
4361 break
4363 done
4364 IFS="$save_ifs"
4365 if test -n "$export_symbols_regex"; then
4366 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4367 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4368 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4369 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4374 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4375 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4378 tmp_deplibs=
4379 for test_deplib in $deplibs; do
4380 case " $convenience " in
4381 *" $test_deplib "*) ;;
4383 tmp_deplibs="$tmp_deplibs $test_deplib"
4385 esac
4386 done
4387 deplibs="$tmp_deplibs"
4389 if test -n "$convenience"; then
4390 if test -n "$whole_archive_flag_spec"; then
4391 save_libobjs=$libobjs
4392 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4393 else
4394 gentop="$output_objdir/${outputname}x"
4395 generated="$generated $gentop"
4397 func_extract_archives $gentop $convenience
4398 libobjs="$libobjs $func_extract_archives_result"
4402 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4403 eval flag=\"$thread_safe_flag_spec\"
4404 linker_flags="$linker_flags $flag"
4407 # Make a backup of the uninstalled library when relinking
4408 if test "$mode" = relink; then
4409 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4412 # Do each of the archive commands.
4413 if test "$module" = yes && test -n "$module_cmds" ; then
4414 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4415 eval test_cmds=\"$module_expsym_cmds\"
4416 cmds=$module_expsym_cmds
4417 else
4418 eval test_cmds=\"$module_cmds\"
4419 cmds=$module_cmds
4421 else
4422 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4423 eval test_cmds=\"$archive_expsym_cmds\"
4424 cmds=$archive_expsym_cmds
4425 else
4426 eval test_cmds=\"$archive_cmds\"
4427 cmds=$archive_cmds
4431 if test "X$skipped_export" != "X:" &&
4432 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4433 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4435 else
4436 # The command line is too long to link in one step, link piecewise.
4437 $echo "creating reloadable object files..."
4439 # Save the value of $output and $libobjs because we want to
4440 # use them later. If we have whole_archive_flag_spec, we
4441 # want to use save_libobjs as it was before
4442 # whole_archive_flag_spec was expanded, because we can't
4443 # assume the linker understands whole_archive_flag_spec.
4444 # This may have to be revisited, in case too many
4445 # convenience libraries get linked in and end up exceeding
4446 # the spec.
4447 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4448 save_libobjs=$libobjs
4450 save_output=$output
4451 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4453 # Clear the reloadable object creation command queue and
4454 # initialize k to one.
4455 test_cmds=
4456 concat_cmds=
4457 objlist=
4458 delfiles=
4459 last_robj=
4461 output=$output_objdir/$output_la-${k}.$objext
4462 # Loop over the list of objects to be linked.
4463 for obj in $save_libobjs
4465 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4466 if test "X$objlist" = X ||
4467 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4468 test "$len" -le "$max_cmd_len"; }; then
4469 objlist="$objlist $obj"
4470 else
4471 # The command $test_cmds is almost too long, add a
4472 # command to the queue.
4473 if test "$k" -eq 1 ; then
4474 # The first file doesn't have a previous command to add.
4475 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4476 else
4477 # All subsequent reloadable object files will link in
4478 # the last one created.
4479 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4481 last_robj=$output_objdir/$output_la-${k}.$objext
4482 k=`expr $k + 1`
4483 output=$output_objdir/$output_la-${k}.$objext
4484 objlist=$obj
4485 len=1
4487 done
4488 # Handle the remaining objects by creating one last
4489 # reloadable object file. All subsequent reloadable object
4490 # files will link in the last one created.
4491 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4492 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4494 if ${skipped_export-false}; then
4495 $show "generating symbol list for \`$libname.la'"
4496 export_symbols="$output_objdir/$libname.exp"
4497 $run $rm $export_symbols
4498 libobjs=$output
4499 # Append the command to create the export file.
4500 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4503 # Set up a command to remove the reloadable object files
4504 # after they are used.
4506 while test "$i" -lt "$k"
4508 i=`expr $i + 1`
4509 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4510 done
4512 $echo "creating a temporary reloadable object file: $output"
4514 # Loop through the commands generated above and execute them.
4515 save_ifs="$IFS"; IFS='~'
4516 for cmd in $concat_cmds; do
4517 IFS="$save_ifs"
4518 $show "$cmd"
4519 $run eval "$cmd" || exit $?
4520 done
4521 IFS="$save_ifs"
4523 libobjs=$output
4524 # Restore the value of output.
4525 output=$save_output
4527 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4528 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4530 # Expand the library linking commands again to reset the
4531 # value of $libobjs for piecewise linking.
4533 # Do each of the archive commands.
4534 if test "$module" = yes && test -n "$module_cmds" ; then
4535 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4536 cmds=$module_expsym_cmds
4537 else
4538 cmds=$module_cmds
4540 else
4541 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4542 cmds=$archive_expsym_cmds
4543 else
4544 cmds=$archive_cmds
4548 # Append the command to remove the reloadable object files
4549 # to the just-reset $cmds.
4550 eval cmds=\"\$cmds~\$rm $delfiles\"
4552 save_ifs="$IFS"; IFS='~'
4553 for cmd in $cmds; do
4554 IFS="$save_ifs"
4555 eval cmd=\"$cmd\"
4556 $show "$cmd"
4557 $run eval "$cmd" || {
4558 lt_exit=$?
4560 # Restore the uninstalled library and exit
4561 if test "$mode" = relink; then
4562 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4565 exit $lt_exit
4567 done
4568 IFS="$save_ifs"
4570 # Restore the uninstalled library and exit
4571 if test "$mode" = relink; then
4572 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4574 if test -n "$convenience"; then
4575 if test -z "$whole_archive_flag_spec"; then
4576 $show "${rm}r $gentop"
4577 $run ${rm}r "$gentop"
4581 exit $EXIT_SUCCESS
4584 # Create links to the real library.
4585 for linkname in $linknames; do
4586 if test "$realname" != "$linkname"; then
4587 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4588 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4590 done
4592 # If -module or -export-dynamic was specified, set the dlname.
4593 if test "$module" = yes || test "$export_dynamic" = yes; then
4594 # On all known operating systems, these are identical.
4595 dlname="$soname"
4600 obj)
4601 if test -n "$deplibs"; then
4602 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4605 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4606 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4609 if test -n "$rpath"; then
4610 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4613 if test -n "$xrpath"; then
4614 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4617 if test -n "$vinfo"; then
4618 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4621 if test -n "$release"; then
4622 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4625 case $output in
4626 *.lo)
4627 if test -n "$objs$old_deplibs"; then
4628 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4629 exit $EXIT_FAILURE
4631 libobj="$output"
4632 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4635 libobj=
4636 obj="$output"
4638 esac
4640 # Delete the old objects.
4641 $run $rm $obj $libobj
4643 # Objects from convenience libraries. This assumes
4644 # single-version convenience libraries. Whenever we create
4645 # different ones for PIC/non-PIC, this we'll have to duplicate
4646 # the extraction.
4647 reload_conv_objs=
4648 gentop=
4649 # reload_cmds runs $LD directly, so let us get rid of
4650 # -Wl from whole_archive_flag_spec and hope we can get by with
4651 # turning comma into space..
4654 if test -n "$convenience"; then
4655 if test -n "$whole_archive_flag_spec"; then
4656 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4657 reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4658 else
4659 gentop="$output_objdir/${obj}x"
4660 generated="$generated $gentop"
4662 func_extract_archives $gentop $convenience
4663 reload_conv_objs="$reload_objs $func_extract_archives_result"
4667 # Create the old-style object.
4668 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
4670 output="$obj"
4671 cmds=$reload_cmds
4672 save_ifs="$IFS"; IFS='~'
4673 for cmd in $cmds; do
4674 IFS="$save_ifs"
4675 eval cmd=\"$cmd\"
4676 $show "$cmd"
4677 $run eval "$cmd" || exit $?
4678 done
4679 IFS="$save_ifs"
4681 # Exit if we aren't doing a library object file.
4682 if test -z "$libobj"; then
4683 if test -n "$gentop"; then
4684 $show "${rm}r $gentop"
4685 $run ${rm}r $gentop
4688 exit $EXIT_SUCCESS
4691 if test "$build_libtool_libs" != yes; then
4692 if test -n "$gentop"; then
4693 $show "${rm}r $gentop"
4694 $run ${rm}r $gentop
4697 # Create an invalid libtool object if no PIC, so that we don't
4698 # accidentally link it into a program.
4699 # $show "echo timestamp > $libobj"
4700 # $run eval "echo timestamp > $libobj" || exit $?
4701 exit $EXIT_SUCCESS
4704 if test -n "$pic_flag" || test "$pic_mode" != default; then
4705 # Only do commands if we really have different PIC objects.
4706 reload_objs="$libobjs $reload_conv_objs"
4707 output="$libobj"
4708 cmds=$reload_cmds
4709 save_ifs="$IFS"; IFS='~'
4710 for cmd in $cmds; do
4711 IFS="$save_ifs"
4712 eval cmd=\"$cmd\"
4713 $show "$cmd"
4714 $run eval "$cmd" || exit $?
4715 done
4716 IFS="$save_ifs"
4719 if test -n "$gentop"; then
4720 $show "${rm}r $gentop"
4721 $run ${rm}r $gentop
4724 exit $EXIT_SUCCESS
4727 prog)
4728 case $host in
4729 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4730 esac
4731 if test -n "$vinfo"; then
4732 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4735 if test -n "$release"; then
4736 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4739 if test "$preload" = yes; then
4740 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4741 test "$dlopen_self_static" = unknown; then
4742 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4746 case $host in
4747 *-*-rhapsody* | *-*-darwin1.[012])
4748 # On Rhapsody replace the C library is the System framework
4749 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4750 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4752 esac
4754 case $host in
4755 *darwin*)
4756 # Don't allow lazy linking, it breaks C++ global constructors
4757 if test "$tagname" = CXX ; then
4758 compile_command="$compile_command ${wl}-bind_at_load"
4759 finalize_command="$finalize_command ${wl}-bind_at_load"
4762 esac
4765 # move library search paths that coincide with paths to not yet
4766 # installed libraries to the beginning of the library search list
4767 new_libs=
4768 for path in $notinst_path; do
4769 case " $new_libs " in
4770 *" -L$path/$objdir "*) ;;
4772 case " $compile_deplibs " in
4773 *" -L$path/$objdir "*)
4774 new_libs="$new_libs -L$path/$objdir" ;;
4775 esac
4777 esac
4778 done
4779 for deplib in $compile_deplibs; do
4780 case $deplib in
4781 -L*)
4782 case " $new_libs " in
4783 *" $deplib "*) ;;
4784 *) new_libs="$new_libs $deplib" ;;
4785 esac
4787 *) new_libs="$new_libs $deplib" ;;
4788 esac
4789 done
4790 compile_deplibs="$new_libs"
4793 compile_command="$compile_command $compile_deplibs"
4794 finalize_command="$finalize_command $finalize_deplibs"
4796 if test -n "$rpath$xrpath"; then
4797 # If the user specified any rpath flags, then add them.
4798 for libdir in $rpath $xrpath; do
4799 # This is the magic to use -rpath.
4800 case "$finalize_rpath " in
4801 *" $libdir "*) ;;
4802 *) finalize_rpath="$finalize_rpath $libdir" ;;
4803 esac
4804 done
4807 # Now hardcode the library paths
4808 rpath=
4809 hardcode_libdirs=
4810 for libdir in $compile_rpath $finalize_rpath; do
4811 if test -n "$hardcode_libdir_flag_spec"; then
4812 if test -n "$hardcode_libdir_separator"; then
4813 if test -z "$hardcode_libdirs"; then
4814 hardcode_libdirs="$libdir"
4815 else
4816 # Just accumulate the unique libdirs.
4817 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4818 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4821 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4823 esac
4825 else
4826 eval flag=\"$hardcode_libdir_flag_spec\"
4827 rpath="$rpath $flag"
4829 elif test -n "$runpath_var"; then
4830 case "$perm_rpath " in
4831 *" $libdir "*) ;;
4832 *) perm_rpath="$perm_rpath $libdir" ;;
4833 esac
4835 case $host in
4836 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4837 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4838 case :$dllsearchpath: in
4839 *":$libdir:"*) ;;
4840 *) dllsearchpath="$dllsearchpath:$libdir";;
4841 esac
4842 case :$dllsearchpath: in
4843 *":$testbindir:"*) ;;
4844 *) dllsearchpath="$dllsearchpath:$testbindir";;
4845 esac
4847 esac
4848 done
4849 # Substitute the hardcoded libdirs into the rpath.
4850 if test -n "$hardcode_libdir_separator" &&
4851 test -n "$hardcode_libdirs"; then
4852 libdir="$hardcode_libdirs"
4853 eval rpath=\" $hardcode_libdir_flag_spec\"
4855 compile_rpath="$rpath"
4857 rpath=
4858 hardcode_libdirs=
4859 for libdir in $finalize_rpath; do
4860 if test -n "$hardcode_libdir_flag_spec"; then
4861 if test -n "$hardcode_libdir_separator"; then
4862 if test -z "$hardcode_libdirs"; then
4863 hardcode_libdirs="$libdir"
4864 else
4865 # Just accumulate the unique libdirs.
4866 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4867 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4870 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4872 esac
4874 else
4875 eval flag=\"$hardcode_libdir_flag_spec\"
4876 rpath="$rpath $flag"
4878 elif test -n "$runpath_var"; then
4879 case "$finalize_perm_rpath " in
4880 *" $libdir "*) ;;
4881 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4882 esac
4884 done
4885 # Substitute the hardcoded libdirs into the rpath.
4886 if test -n "$hardcode_libdir_separator" &&
4887 test -n "$hardcode_libdirs"; then
4888 libdir="$hardcode_libdirs"
4889 eval rpath=\" $hardcode_libdir_flag_spec\"
4891 finalize_rpath="$rpath"
4893 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4894 # Transform all the library objects into standard objects.
4895 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4896 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4899 dlsyms=
4900 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4901 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4902 dlsyms="${outputname}S.c"
4903 else
4904 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4908 if test -n "$dlsyms"; then
4909 case $dlsyms in
4910 "") ;;
4911 *.c)
4912 # Discover the nlist of each of the dlfiles.
4913 nlist="$output_objdir/${outputname}.nm"
4915 $show "$rm $nlist ${nlist}S ${nlist}T"
4916 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4918 # Parse the name list into a source file.
4919 $show "creating $output_objdir/$dlsyms"
4921 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4922 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4923 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4925 #ifdef __cplusplus
4926 extern \"C\" {
4927 #endif
4929 /* Prevent the only kind of declaration conflicts we can make. */
4930 #define lt_preloaded_symbols some_other_symbol
4932 /* External symbol declarations for the compiler. */\
4935 if test "$dlself" = yes; then
4936 $show "generating symbol list for \`$output'"
4938 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4940 # Add our own program objects to the symbol list.
4941 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4942 for arg in $progfiles; do
4943 $show "extracting global C symbols from \`$arg'"
4944 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4945 done
4947 if test -n "$exclude_expsyms"; then
4948 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4949 $run eval '$mv "$nlist"T "$nlist"'
4952 if test -n "$export_symbols_regex"; then
4953 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4954 $run eval '$mv "$nlist"T "$nlist"'
4957 # Prepare the list of exported symbols
4958 if test -z "$export_symbols"; then
4959 export_symbols="$output_objdir/$outputname.exp"
4960 $run $rm $export_symbols
4961 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4962 case $host in
4963 *cygwin* | *mingw* )
4964 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4965 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4967 esac
4968 else
4969 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4970 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4971 $run eval 'mv "$nlist"T "$nlist"'
4972 case $host in
4973 *cygwin* | *mingw* )
4974 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4975 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4977 esac
4981 for arg in $dlprefiles; do
4982 $show "extracting global C symbols from \`$arg'"
4983 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4984 $run eval '$echo ": $name " >> "$nlist"'
4985 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4986 done
4988 if test -z "$run"; then
4989 # Make sure we have at least an empty file.
4990 test -f "$nlist" || : > "$nlist"
4992 if test -n "$exclude_expsyms"; then
4993 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4994 $mv "$nlist"T "$nlist"
4997 # Try sorting and uniquifying the output.
4998 if grep -v "^: " < "$nlist" |
4999 if sort -k 3 </dev/null >/dev/null 2>&1; then
5000 sort -k 3
5001 else
5002 sort +2
5003 fi |
5004 uniq > "$nlist"S; then
5006 else
5007 grep -v "^: " < "$nlist" > "$nlist"S
5010 if test -f "$nlist"S; then
5011 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
5012 else
5013 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
5016 $echo >> "$output_objdir/$dlsyms" "\
5018 #undef lt_preloaded_symbols
5020 #if defined (__STDC__) && __STDC__
5021 # define lt_ptr void *
5022 #else
5023 # define lt_ptr char *
5024 # define const
5025 #endif
5027 /* The mapping between symbol names and symbols. */
5030 case $host in
5031 *cygwin* | *mingw* )
5032 $echo >> "$output_objdir/$dlsyms" "\
5033 /* DATA imports from DLLs on WIN32 can't be const, because
5034 runtime relocations are performed -- see ld's documentation
5035 on pseudo-relocs */
5036 struct {
5040 $echo >> "$output_objdir/$dlsyms" "\
5041 const struct {
5044 esac
5047 $echo >> "$output_objdir/$dlsyms" "\
5048 const char *name;
5049 lt_ptr address;
5051 lt_preloaded_symbols[] =
5055 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
5057 $echo >> "$output_objdir/$dlsyms" "\
5058 {0, (lt_ptr) 0}
5061 /* This works around a problem in FreeBSD linker */
5062 #ifdef FREEBSD_WORKAROUND
5063 static const void *lt_preloaded_setup() {
5064 return lt_preloaded_symbols;
5066 #endif
5068 #ifdef __cplusplus
5070 #endif\
5074 pic_flag_for_symtable=
5075 case $host in
5076 # compiling the symbol table file with pic_flag works around
5077 # a FreeBSD bug that causes programs to crash when -lm is
5078 # linked before any other PIC object. But we must not use
5079 # pic_flag when linking with -static. The problem exists in
5080 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
5081 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
5082 case "$compile_command " in
5083 *" -static "*) ;;
5084 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
5085 esac;;
5086 *-*-hpux*)
5087 case "$compile_command " in
5088 *" -static "*) ;;
5089 *) pic_flag_for_symtable=" $pic_flag";;
5090 esac
5091 esac
5093 # Now compile the dynamic symbol file.
5094 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
5095 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
5097 # Clean up the generated files.
5098 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
5099 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
5101 # Transform the symbol file into the correct name.
5102 case $host in
5103 *cygwin* | *mingw* )
5104 if test -f "$output_objdir/${outputname}.def" ; then
5105 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
5106 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
5107 else
5108 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
5109 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
5113 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
5114 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
5116 esac
5119 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
5120 exit $EXIT_FAILURE
5122 esac
5123 else
5124 # We keep going just in case the user didn't refer to
5125 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
5126 # really was required.
5128 # Nullify the symbol file.
5129 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
5130 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
5133 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
5134 # Replace the output file specification.
5135 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
5136 link_command="$compile_command$compile_rpath"
5138 # We have no uninstalled library dependencies, so finalize right now.
5139 $show "$link_command"
5140 $run eval "$link_command"
5141 exit_status=$?
5143 # Delete the generated files.
5144 if test -n "$dlsyms"; then
5145 $show "$rm $output_objdir/${outputname}S.${objext}"
5146 $run $rm "$output_objdir/${outputname}S.${objext}"
5149 exit $exit_status
5152 if test -n "$shlibpath_var"; then
5153 # We should set the shlibpath_var
5154 rpath=
5155 for dir in $temp_rpath; do
5156 case $dir in
5157 [\\/]* | [A-Za-z]:[\\/]*)
5158 # Absolute path.
5159 rpath="$rpath$dir:"
5162 # Relative path: add a thisdir entry.
5163 rpath="$rpath\$thisdir/$dir:"
5165 esac
5166 done
5167 temp_rpath="$rpath"
5170 if test -n "$compile_shlibpath$finalize_shlibpath"; then
5171 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
5173 if test -n "$finalize_shlibpath"; then
5174 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
5177 compile_var=
5178 finalize_var=
5179 if test -n "$runpath_var"; then
5180 if test -n "$perm_rpath"; then
5181 # We should set the runpath_var.
5182 rpath=
5183 for dir in $perm_rpath; do
5184 rpath="$rpath$dir:"
5185 done
5186 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
5188 if test -n "$finalize_perm_rpath"; then
5189 # We should set the runpath_var.
5190 rpath=
5191 for dir in $finalize_perm_rpath; do
5192 rpath="$rpath$dir:"
5193 done
5194 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
5198 if test "$no_install" = yes; then
5199 # We don't need to create a wrapper script.
5200 link_command="$compile_var$compile_command$compile_rpath"
5201 # Replace the output file specification.
5202 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
5203 # Delete the old output file.
5204 $run $rm $output
5205 # Link the executable and exit
5206 $show "$link_command"
5207 $run eval "$link_command" || exit $?
5208 exit $EXIT_SUCCESS
5211 if test "$hardcode_action" = relink; then
5212 # Fast installation is not supported
5213 link_command="$compile_var$compile_command$compile_rpath"
5214 relink_command="$finalize_var$finalize_command$finalize_rpath"
5216 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
5217 $echo "$modename: \`$output' will be relinked during installation" 1>&2
5218 else
5219 if test "$fast_install" != no; then
5220 link_command="$finalize_var$compile_command$finalize_rpath"
5221 if test "$fast_install" = yes; then
5222 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
5223 else
5224 # fast_install is set to needless
5225 relink_command=
5227 else
5228 link_command="$compile_var$compile_command$compile_rpath"
5229 relink_command="$finalize_var$finalize_command$finalize_rpath"
5233 # Replace the output file specification.
5234 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
5236 # Delete the old output files.
5237 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
5239 $show "$link_command"
5240 $run eval "$link_command" || exit $?
5242 # Now create the wrapper script.
5243 $show "creating $output"
5245 # Quote the relink command for shipping.
5246 if test -n "$relink_command"; then
5247 # Preserve any variables that may affect compiler behavior
5248 for var in $variables_saved_for_relink; do
5249 if eval test -z \"\${$var+set}\"; then
5250 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5251 elif eval var_value=\$$var; test -z "$var_value"; then
5252 relink_command="$var=; export $var; $relink_command"
5253 else
5254 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5255 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5257 done
5258 relink_command="(cd `pwd`; $relink_command)"
5259 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5262 # Quote $echo for shipping.
5263 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
5264 case $progpath in
5265 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
5266 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
5267 esac
5268 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
5269 else
5270 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
5273 # Only actually do things if our run command is non-null.
5274 if test -z "$run"; then
5275 # win32 will think the script is a binary if it has
5276 # a .exe suffix, so we strip it off here.
5277 case $output in
5278 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
5279 esac
5280 # test for cygwin because mv fails w/o .exe extensions
5281 case $host in
5282 *cygwin*)
5283 exeext=.exe
5284 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
5285 *) exeext= ;;
5286 esac
5287 case $host in
5288 *cygwin* | *mingw* )
5289 output_name=`basename $output`
5290 output_path=`dirname $output`
5291 cwrappersource="$output_path/$objdir/lt-$output_name.c"
5292 cwrapper="$output_path/$output_name.exe"
5293 $rm $cwrappersource $cwrapper
5294 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
5296 cat > $cwrappersource <<EOF
5298 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5299 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5301 The $output program cannot be directly executed until all the libtool
5302 libraries that it depends on are installed.
5304 This wrapper executable should never be moved out of the build directory.
5305 If it is, it will not operate correctly.
5307 Currently, it simply execs the wrapper *script* "/bin/sh $output",
5308 but could eventually absorb all of the scripts functionality and
5309 exec $objdir/$outputname directly.
5312 cat >> $cwrappersource<<"EOF"
5313 #include <stdio.h>
5314 #include <stdlib.h>
5315 #include <unistd.h>
5316 #include <malloc.h>
5317 #include <stdarg.h>
5318 #include <assert.h>
5319 #include <string.h>
5320 #include <ctype.h>
5321 #include <sys/stat.h>
5323 #if defined(PATH_MAX)
5324 # define LT_PATHMAX PATH_MAX
5325 #elif defined(MAXPATHLEN)
5326 # define LT_PATHMAX MAXPATHLEN
5327 #else
5328 # define LT_PATHMAX 1024
5329 #endif
5331 #ifndef DIR_SEPARATOR
5332 # define DIR_SEPARATOR '/'
5333 # define PATH_SEPARATOR ':'
5334 #endif
5336 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5337 defined (__OS2__)
5338 # define HAVE_DOS_BASED_FILE_SYSTEM
5339 # ifndef DIR_SEPARATOR_2
5340 # define DIR_SEPARATOR_2 '\\'
5341 # endif
5342 # ifndef PATH_SEPARATOR_2
5343 # define PATH_SEPARATOR_2 ';'
5344 # endif
5345 #endif
5347 #ifndef DIR_SEPARATOR_2
5348 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5349 #else /* DIR_SEPARATOR_2 */
5350 # define IS_DIR_SEPARATOR(ch) \
5351 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5352 #endif /* DIR_SEPARATOR_2 */
5354 #ifndef PATH_SEPARATOR_2
5355 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5356 #else /* PATH_SEPARATOR_2 */
5357 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5358 #endif /* PATH_SEPARATOR_2 */
5360 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5361 #define XFREE(stale) do { \
5362 if (stale) { free ((void *) stale); stale = 0; } \
5363 } while (0)
5365 /* -DDEBUG is fairly common in CFLAGS. */
5366 #undef DEBUG
5367 #if defined DEBUGWRAPPER
5368 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5369 #else
5370 # define DEBUG(format, ...)
5371 #endif
5373 const char *program_name = NULL;
5375 void * xmalloc (size_t num);
5376 char * xstrdup (const char *string);
5377 const char * base_name (const char *name);
5378 char * find_executable(const char *wrapper);
5379 int check_executable(const char *path);
5380 char * strendzap(char *str, const char *pat);
5381 void lt_fatal (const char *message, ...);
5384 main (int argc, char *argv[])
5386 char **newargz;
5387 int i;
5389 program_name = (char *) xstrdup (base_name (argv[0]));
5390 DEBUG("(main) argv[0] : %s\n",argv[0]);
5391 DEBUG("(main) program_name : %s\n",program_name);
5392 newargz = XMALLOC(char *, argc+2);
5395 cat >> $cwrappersource <<EOF
5396 newargz[0] = (char *) xstrdup("$SHELL");
5399 cat >> $cwrappersource <<"EOF"
5400 newargz[1] = find_executable(argv[0]);
5401 if (newargz[1] == NULL)
5402 lt_fatal("Couldn't find %s", argv[0]);
5403 DEBUG("(main) found exe at : %s\n",newargz[1]);
5404 /* we know the script has the same name, without the .exe */
5405 /* so make sure newargz[1] doesn't end in .exe */
5406 strendzap(newargz[1],".exe");
5407 for (i = 1; i < argc; i++)
5408 newargz[i+1] = xstrdup(argv[i]);
5409 newargz[argc+1] = NULL;
5411 for (i=0; i<argc+1; i++)
5413 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5419 case $host_os in
5420 mingw*)
5421 cat >> $cwrappersource <<EOF
5422 execv("$SHELL",(char const **)newargz);
5426 cat >> $cwrappersource <<EOF
5427 execv("$SHELL",newargz);
5430 esac
5432 cat >> $cwrappersource <<"EOF"
5433 return 127;
5436 void *
5437 xmalloc (size_t num)
5439 void * p = (void *) malloc (num);
5440 if (!p)
5441 lt_fatal ("Memory exhausted");
5443 return p;
5446 char *
5447 xstrdup (const char *string)
5449 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5453 const char *
5454 base_name (const char *name)
5456 const char *base;
5458 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5459 /* Skip over the disk name in MSDOS pathnames. */
5460 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5461 name += 2;
5462 #endif
5464 for (base = name; *name; name++)
5465 if (IS_DIR_SEPARATOR (*name))
5466 base = name + 1;
5467 return base;
5471 check_executable(const char * path)
5473 struct stat st;
5475 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5476 if ((!path) || (!*path))
5477 return 0;
5479 if ((stat (path, &st) >= 0) &&
5481 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5482 #if defined (S_IXOTH)
5483 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5484 #endif
5485 #if defined (S_IXGRP)
5486 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5487 #endif
5488 ((st.st_mode & S_IXUSR) == S_IXUSR))
5490 return 1;
5491 else
5492 return 0;
5495 /* Searches for the full path of the wrapper. Returns
5496 newly allocated full path name if found, NULL otherwise */
5497 char *
5498 find_executable (const char* wrapper)
5500 int has_slash = 0;
5501 const char* p;
5502 const char* p_next;
5503 /* static buffer for getcwd */
5504 char tmp[LT_PATHMAX + 1];
5505 int tmp_len;
5506 char* concat_name;
5508 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5510 if ((wrapper == NULL) || (*wrapper == '\0'))
5511 return NULL;
5513 /* Absolute path? */
5514 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5515 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5517 concat_name = xstrdup (wrapper);
5518 if (check_executable(concat_name))
5519 return concat_name;
5520 XFREE(concat_name);
5522 else
5524 #endif
5525 if (IS_DIR_SEPARATOR (wrapper[0]))
5527 concat_name = xstrdup (wrapper);
5528 if (check_executable(concat_name))
5529 return concat_name;
5530 XFREE(concat_name);
5532 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5534 #endif
5536 for (p = wrapper; *p; p++)
5537 if (*p == '/')
5539 has_slash = 1;
5540 break;
5542 if (!has_slash)
5544 /* no slashes; search PATH */
5545 const char* path = getenv ("PATH");
5546 if (path != NULL)
5548 for (p = path; *p; p = p_next)
5550 const char* q;
5551 size_t p_len;
5552 for (q = p; *q; q++)
5553 if (IS_PATH_SEPARATOR(*q))
5554 break;
5555 p_len = q - p;
5556 p_next = (*q == '\0' ? q : q + 1);
5557 if (p_len == 0)
5559 /* empty path: current directory */
5560 if (getcwd (tmp, LT_PATHMAX) == NULL)
5561 lt_fatal ("getcwd failed");
5562 tmp_len = strlen(tmp);
5563 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5564 memcpy (concat_name, tmp, tmp_len);
5565 concat_name[tmp_len] = '/';
5566 strcpy (concat_name + tmp_len + 1, wrapper);
5568 else
5570 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5571 memcpy (concat_name, p, p_len);
5572 concat_name[p_len] = '/';
5573 strcpy (concat_name + p_len + 1, wrapper);
5575 if (check_executable(concat_name))
5576 return concat_name;
5577 XFREE(concat_name);
5580 /* not found in PATH; assume curdir */
5582 /* Relative path | not found in path: prepend cwd */
5583 if (getcwd (tmp, LT_PATHMAX) == NULL)
5584 lt_fatal ("getcwd failed");
5585 tmp_len = strlen(tmp);
5586 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5587 memcpy (concat_name, tmp, tmp_len);
5588 concat_name[tmp_len] = '/';
5589 strcpy (concat_name + tmp_len + 1, wrapper);
5591 if (check_executable(concat_name))
5592 return concat_name;
5593 XFREE(concat_name);
5594 return NULL;
5597 char *
5598 strendzap(char *str, const char *pat)
5600 size_t len, patlen;
5602 assert(str != NULL);
5603 assert(pat != NULL);
5605 len = strlen(str);
5606 patlen = strlen(pat);
5608 if (patlen <= len)
5610 str += len - patlen;
5611 if (strcmp(str, pat) == 0)
5612 *str = '\0';
5614 return str;
5617 static void
5618 lt_error_core (int exit_status, const char * mode,
5619 const char * message, va_list ap)
5621 fprintf (stderr, "%s: %s: ", program_name, mode);
5622 vfprintf (stderr, message, ap);
5623 fprintf (stderr, ".\n");
5625 if (exit_status >= 0)
5626 exit (exit_status);
5629 void
5630 lt_fatal (const char *message, ...)
5632 va_list ap;
5633 va_start (ap, message);
5634 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5635 va_end (ap);
5638 # we should really use a build-platform specific compiler
5639 # here, but OTOH, the wrappers (shell script and this C one)
5640 # are only useful if you want to execute the "real" binary.
5641 # Since the "real" binary is built for $host, then this
5642 # wrapper might as well be built for $host, too.
5643 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5645 esac
5646 $rm $output
5647 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5649 $echo > $output "\
5650 #! $SHELL
5652 # $output - temporary wrapper script for $objdir/$outputname
5653 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5655 # The $output program cannot be directly executed until all the libtool
5656 # libraries that it depends on are installed.
5658 # This wrapper script should never be moved out of the build directory.
5659 # If it is, it will not operate correctly.
5661 # Sed substitution that helps us do robust quoting. It backslashifies
5662 # metacharacters that are still active within double-quoted strings.
5663 Xsed='${SED} -e 1s/^X//'
5664 sed_quote_subst='$sed_quote_subst'
5666 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5667 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5668 emulate sh
5669 NULLCMD=:
5670 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5671 # is contrary to our usage. Disable this feature.
5672 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5673 setopt NO_GLOB_SUBST
5674 else
5675 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5677 BIN_SH=xpg4; export BIN_SH # for Tru64
5678 DUALCASE=1; export DUALCASE # for MKS sh
5680 # The HP-UX ksh and POSIX shell print the target directory to stdout
5681 # if CDPATH is set.
5682 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5684 relink_command=\"$relink_command\"
5686 # This environment variable determines our operation mode.
5687 if test \"\$libtool_install_magic\" = \"$magic\"; then
5688 # install mode needs the following variable:
5689 notinst_deplibs='$notinst_deplibs'
5690 else
5691 # When we are sourced in execute mode, \$file and \$echo are already set.
5692 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5693 echo=\"$qecho\"
5694 file=\"\$0\"
5695 # Make sure echo works.
5696 if test \"X\$1\" = X--no-reexec; then
5697 # Discard the --no-reexec flag, and continue.
5698 shift
5699 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5700 # Yippee, \$echo works!
5702 else
5703 # Restart under the correct shell, and then maybe \$echo will work.
5704 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5708 $echo >> $output "\
5710 # Find the directory that this script lives in.
5711 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5712 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5714 # Follow symbolic links until we get to the real thisdir.
5715 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5716 while test -n \"\$file\"; do
5717 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5719 # If there was a directory component, then change thisdir.
5720 if test \"x\$destdir\" != \"x\$file\"; then
5721 case \"\$destdir\" in
5722 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5723 *) thisdir=\"\$thisdir/\$destdir\" ;;
5724 esac
5727 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5728 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5729 done
5731 # Try to get the absolute directory name.
5732 absdir=\`cd \"\$thisdir\" && pwd\`
5733 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5736 if test "$fast_install" = yes; then
5737 $echo >> $output "\
5738 program=lt-'$outputname'$exeext
5739 progdir=\"\$thisdir/$objdir\"
5741 if test ! -f \"\$progdir/\$program\" || \\
5742 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5743 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5745 file=\"\$\$-\$program\"
5747 if test ! -d \"\$progdir\"; then
5748 $mkdir \"\$progdir\"
5749 else
5750 $rm \"\$progdir/\$file\"
5753 $echo >> $output "\
5755 # relink executable if necessary
5756 if test -n \"\$relink_command\"; then
5757 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5758 else
5759 $echo \"\$relink_command_output\" >&2
5760 $rm \"\$progdir/\$file\"
5761 exit $EXIT_FAILURE
5765 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5766 { $rm \"\$progdir/\$program\";
5767 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5768 $rm \"\$progdir/\$file\"
5770 else
5771 $echo >> $output "\
5772 program='$outputname'
5773 progdir=\"\$thisdir/$objdir\"
5777 $echo >> $output "\
5779 if test -f \"\$progdir/\$program\"; then"
5781 # Export our shlibpath_var if we have one.
5782 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5783 $echo >> $output "\
5784 # Add our own library path to $shlibpath_var
5785 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5787 # Some systems cannot cope with colon-terminated $shlibpath_var
5788 # The second colon is a workaround for a bug in BeOS R4 sed
5789 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5791 export $shlibpath_var
5795 # fixup the dll searchpath if we need to.
5796 if test -n "$dllsearchpath"; then
5797 $echo >> $output "\
5798 # Add the dll search path components to the executable PATH
5799 PATH=$dllsearchpath:\$PATH
5803 $echo >> $output "\
5804 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5805 # Run the actual program with our arguments.
5807 # Make sure env LD_LIBRARY_PATH does not mess us up
5808 if test -n \"\${LD_LIBRARY_PATH+set}\"; then
5809 export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH
5812 case $host in
5813 # Backslashes separate directories on plain windows
5814 *-*-mingw | *-*-os2*)
5815 $echo >> $output "\
5816 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5821 $echo >> $output "\
5822 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5825 esac
5826 $echo >> $output "\
5827 \$echo \"\$0: cannot exec \$program \$*\"
5828 exit $EXIT_FAILURE
5830 else
5831 # The program doesn't exist.
5832 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5833 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5834 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5835 exit $EXIT_FAILURE
5839 chmod +x $output
5841 exit $EXIT_SUCCESS
5843 esac
5845 # See if we need to build an old-fashioned archive.
5846 for oldlib in $oldlibs; do
5848 if test "$build_libtool_libs" = convenience; then
5849 oldobjs="$libobjs_save"
5850 addlibs="$convenience"
5851 build_libtool_libs=no
5852 else
5853 if test "$build_libtool_libs" = module; then
5854 oldobjs="$libobjs_save"
5855 build_libtool_libs=no
5856 else
5857 oldobjs="$old_deplibs $non_pic_objects"
5859 addlibs="$old_convenience"
5862 if test -n "$addlibs"; then
5863 gentop="$output_objdir/${outputname}x"
5864 generated="$generated $gentop"
5866 func_extract_archives $gentop $addlibs
5867 oldobjs="$oldobjs $func_extract_archives_result"
5870 # Do each command in the archive commands.
5871 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5872 cmds=$old_archive_from_new_cmds
5873 else
5874 # POSIX demands no paths to be encoded in archives. We have
5875 # to avoid creating archives with duplicate basenames if we
5876 # might have to extract them afterwards, e.g., when creating a
5877 # static archive out of a convenience library, or when linking
5878 # the entirety of a libtool archive into another (currently
5879 # not supported by libtool).
5880 if (for obj in $oldobjs
5882 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5883 done | sort | sort -uc >/dev/null 2>&1); then
5885 else
5886 $echo "copying selected object files to avoid basename conflicts..."
5888 if test -z "$gentop"; then
5889 gentop="$output_objdir/${outputname}x"
5890 generated="$generated $gentop"
5892 $show "${rm}r $gentop"
5893 $run ${rm}r "$gentop"
5894 $show "$mkdir $gentop"
5895 $run $mkdir "$gentop"
5896 exit_status=$?
5897 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5898 exit $exit_status
5902 save_oldobjs=$oldobjs
5903 oldobjs=
5904 counter=1
5905 for obj in $save_oldobjs
5907 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5908 case " $oldobjs " in
5909 " ") oldobjs=$obj ;;
5910 *[\ /]"$objbase "*)
5911 while :; do
5912 # Make sure we don't pick an alternate name that also
5913 # overlaps.
5914 newobj=lt$counter-$objbase
5915 counter=`expr $counter + 1`
5916 case " $oldobjs " in
5917 *[\ /]"$newobj "*) ;;
5918 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5919 esac
5920 done
5921 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5922 $run ln "$obj" "$gentop/$newobj" ||
5923 $run cp "$obj" "$gentop/$newobj"
5924 oldobjs="$oldobjs $gentop/$newobj"
5926 *) oldobjs="$oldobjs $obj" ;;
5927 esac
5928 done
5931 eval cmds=\"$old_archive_cmds\"
5933 if len=`expr "X$cmds" : ".*"` &&
5934 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5935 cmds=$old_archive_cmds
5936 else
5937 # the command line is too long to link in one step, link in parts
5938 $echo "using piecewise archive linking..."
5939 save_RANLIB=$RANLIB
5940 RANLIB=:
5941 objlist=
5942 concat_cmds=
5943 save_oldobjs=$oldobjs
5945 # Is there a better way of finding the last object in the list?
5946 for obj in $save_oldobjs
5948 last_oldobj=$obj
5949 done
5950 for obj in $save_oldobjs
5952 oldobjs="$objlist $obj"
5953 objlist="$objlist $obj"
5954 eval test_cmds=\"$old_archive_cmds\"
5955 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5956 test "$len" -le "$max_cmd_len"; then
5958 else
5959 # the above command should be used before it gets too long
5960 oldobjs=$objlist
5961 if test "$obj" = "$last_oldobj" ; then
5962 RANLIB=$save_RANLIB
5964 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5965 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5966 objlist=
5968 done
5969 RANLIB=$save_RANLIB
5970 oldobjs=$objlist
5971 if test "X$oldobjs" = "X" ; then
5972 eval cmds=\"\$concat_cmds\"
5973 else
5974 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5978 save_ifs="$IFS"; IFS='~'
5979 for cmd in $cmds; do
5980 eval cmd=\"$cmd\"
5981 IFS="$save_ifs"
5982 $show "$cmd"
5983 $run eval "$cmd" || exit $?
5984 done
5985 IFS="$save_ifs"
5986 done
5988 if test -n "$generated"; then
5989 $show "${rm}r$generated"
5990 $run ${rm}r$generated
5993 # Now create the libtool archive.
5994 case $output in
5995 *.la)
5996 old_library=
5997 test "$build_old_libs" = yes && old_library="$libname.$libext"
5998 $show "creating $output"
6000 # Preserve any variables that may affect compiler behavior
6001 for var in $variables_saved_for_relink; do
6002 if eval test -z \"\${$var+set}\"; then
6003 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
6004 elif eval var_value=\$$var; test -z "$var_value"; then
6005 relink_command="$var=; export $var; $relink_command"
6006 else
6007 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
6008 relink_command="$var=\"$var_value\"; export $var; $relink_command"
6010 done
6011 # Quote the link command for shipping.
6012 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
6013 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
6014 if test "$hardcode_automatic" = yes ; then
6015 relink_command=
6019 # Only create the output if not a dry run.
6020 if test -z "$run"; then
6021 for installed in no yes; do
6022 if test "$installed" = yes; then
6023 if test -z "$install_libdir"; then
6024 break
6026 output="$output_objdir/$outputname"i
6027 # Replace all uninstalled libtool libraries with the installed ones
6028 newdependency_libs=
6029 for deplib in $dependency_libs; do
6030 case $deplib in
6031 *.la)
6032 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
6033 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6034 if test -z "$libdir"; then
6035 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
6036 exit $EXIT_FAILURE
6038 if test "X$EGREP" = X ; then
6039 EGREP=egrep
6041 # We do not want portage's install root ($D) present. Check only for
6042 # this if the .la is being installed.
6043 if test "$installed" = yes && test "$D"; then
6044 eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
6045 else
6046 mynewdependency_lib="$libdir/$name"
6048 # Do not add duplicates
6049 if test "$mynewdependency_lib"; then
6050 my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
6051 if test -z "$my_little_ninja_foo_1"; then
6052 newdependency_libs="$newdependency_libs $mynewdependency_lib"
6057 if test "$installed" = yes; then
6058 # Rather use S=WORKDIR if our version of portage supports it.
6059 # This is because some ebuild (gcc) do not use $S as buildroot.
6060 if test "$PWORKDIR"; then
6061 S="$PWORKDIR"
6063 # We do not want portage's build root ($S) present.
6064 my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
6065 # We do not want portage's install root ($D) present.
6066 my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
6067 if test -n "$my_little_ninja_foo_2" && test "$S"; then
6068 mynewdependency_lib=""
6069 elif test -n "$my_little_ninja_foo_3" && test "$D"; then
6070 eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
6071 else
6072 mynewdependency_lib="$deplib"
6074 else
6075 mynewdependency_lib="$deplib"
6077 # Do not add duplicates
6078 if test "$mynewdependency_lib"; then
6079 my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
6080 if test -z "$my_little_ninja_foo_4"; then
6081 newdependency_libs="$newdependency_libs $mynewdependency_lib"
6085 esac
6086 done
6087 dependency_libs="$newdependency_libs"
6088 newdlfiles=
6089 for lib in $dlfiles; do
6090 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
6091 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
6092 if test -z "$libdir"; then
6093 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6094 exit $EXIT_FAILURE
6096 newdlfiles="$newdlfiles $libdir/$name"
6097 done
6098 dlfiles="$newdlfiles"
6099 newdlprefiles=
6100 for lib in $dlprefiles; do
6101 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
6102 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
6103 if test -z "$libdir"; then
6104 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6105 exit $EXIT_FAILURE
6107 newdlprefiles="$newdlprefiles $libdir/$name"
6108 done
6109 dlprefiles="$newdlprefiles"
6110 else
6111 newdlfiles=
6112 for lib in $dlfiles; do
6113 case $lib in
6114 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
6115 *) abs=`pwd`"/$lib" ;;
6116 esac
6117 newdlfiles="$newdlfiles $abs"
6118 done
6119 dlfiles="$newdlfiles"
6120 newdlprefiles=
6121 for lib in $dlprefiles; do
6122 case $lib in
6123 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
6124 *) abs=`pwd`"/$lib" ;;
6125 esac
6126 newdlprefiles="$newdlprefiles $abs"
6127 done
6128 dlprefiles="$newdlprefiles"
6130 $rm $output
6131 # place dlname in correct position for cygwin
6132 tdlname=$dlname
6133 case $host,$output,$installed,$module,$dlname in
6134 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
6135 esac
6136 # Do not add duplicates
6137 if test "$installed" = yes && test "$D"; then
6138 install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
6140 $echo > $output "\
6141 # $outputname - a libtool library file
6142 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
6144 # Please DO NOT delete this file!
6145 # It is necessary for linking the library.
6147 # The name that we can dlopen(3).
6148 dlname='$tdlname'
6150 # Names of this library.
6151 library_names='$library_names'
6153 # The name of the static archive.
6154 old_library='$old_library'
6156 # Libraries that this one depends upon.
6157 dependency_libs='$dependency_libs'
6159 # Version information for $libname.
6160 current=$current
6161 age=$age
6162 revision=$revision
6164 # Is this an already installed library?
6165 installed=$installed
6167 # Should we warn about portability when linking against -modules?
6168 shouldnotlink=$module
6170 # Files to dlopen/dlpreopen
6171 dlopen='$dlfiles'
6172 dlpreopen='$dlprefiles'
6174 # Directory that this library needs to be installed in:
6175 libdir='$install_libdir'"
6176 if test "$installed" = no && test "$need_relink" = yes; then
6177 $echo >> $output "\
6178 relink_command=\"$relink_command\""
6180 done
6183 # Do a symbolic link so that the libtool archive can be found in
6184 # LD_LIBRARY_PATH before the program is installed.
6185 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
6186 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
6188 esac
6189 exit $EXIT_SUCCESS
6192 # libtool install mode
6193 install)
6194 modename="$modename: install"
6196 # There may be an optional sh(1) argument at the beginning of
6197 # install_prog (especially on Windows NT).
6198 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
6199 # Allow the use of GNU shtool's install command.
6200 $echo "X$nonopt" | grep shtool > /dev/null; then
6201 # Aesthetically quote it.
6202 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
6203 case $arg in
6204 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
6205 arg="\"$arg\""
6207 esac
6208 install_prog="$arg "
6209 arg="$1"
6210 shift
6211 else
6212 install_prog=
6213 arg=$nonopt
6216 # The real first argument should be the name of the installation program.
6217 # Aesthetically quote it.
6218 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
6219 case $arg in
6220 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
6221 arg="\"$arg\""
6223 esac
6224 install_prog="$install_prog$arg"
6226 # We need to accept at least all the BSD install flags.
6227 dest=
6228 files=
6229 opts=
6230 prev=
6231 install_type=
6232 isdir=no
6233 stripme=
6234 for arg
6236 if test -n "$dest"; then
6237 files="$files $dest"
6238 dest=$arg
6239 continue
6242 case $arg in
6243 -d) isdir=yes ;;
6244 -f)
6245 case " $install_prog " in
6246 *[\\\ /]cp\ *) ;;
6247 *) prev=$arg ;;
6248 esac
6250 -g | -m | -o) prev=$arg ;;
6252 stripme=" -s"
6253 continue
6258 # If the previous option needed an argument, then skip it.
6259 if test -n "$prev"; then
6260 prev=
6261 else
6262 dest=$arg
6263 continue
6266 esac
6268 # Aesthetically quote the argument.
6269 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
6270 case $arg in
6271 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
6272 arg="\"$arg\""
6274 esac
6275 install_prog="$install_prog $arg"
6276 done
6278 if test -z "$install_prog"; then
6279 $echo "$modename: you must specify an install program" 1>&2
6280 $echo "$help" 1>&2
6281 exit $EXIT_FAILURE
6284 if test -n "$prev"; then
6285 $echo "$modename: the \`$prev' option requires an argument" 1>&2
6286 $echo "$help" 1>&2
6287 exit $EXIT_FAILURE
6290 if test -z "$files"; then
6291 if test -z "$dest"; then
6292 $echo "$modename: no file or destination specified" 1>&2
6293 else
6294 $echo "$modename: you must specify a destination" 1>&2
6296 $echo "$help" 1>&2
6297 exit $EXIT_FAILURE
6300 # Strip any trailing slash from the destination.
6301 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
6303 # Check to see that the destination is a directory.
6304 test -d "$dest" && isdir=yes
6305 if test "$isdir" = yes; then
6306 destdir="$dest"
6307 destname=
6308 else
6309 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
6310 test "X$destdir" = "X$dest" && destdir=.
6311 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
6313 # Not a directory, so check to see that there is only one file specified.
6314 set dummy $files
6315 if test "$#" -gt 2; then
6316 $echo "$modename: \`$dest' is not a directory" 1>&2
6317 $echo "$help" 1>&2
6318 exit $EXIT_FAILURE
6321 case $destdir in
6322 [\\/]* | [A-Za-z]:[\\/]*) ;;
6324 for file in $files; do
6325 case $file in
6326 *.lo) ;;
6328 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
6329 $echo "$help" 1>&2
6330 exit $EXIT_FAILURE
6332 esac
6333 done
6335 esac
6337 # This variable tells wrapper scripts just to set variables rather
6338 # than running their programs.
6339 libtool_install_magic="$magic"
6341 staticlibs=
6342 future_libdirs=
6343 current_libdirs=
6344 for file in $files; do
6346 # Do each installation.
6347 case $file in
6348 *.$libext)
6349 # Do the static libraries later.
6350 staticlibs="$staticlibs $file"
6353 *.la)
6354 # Check to see that this really is a libtool archive.
6355 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6356 else
6357 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
6358 $echo "$help" 1>&2
6359 exit $EXIT_FAILURE
6362 library_names=
6363 old_library=
6364 relink_command=
6365 # If there is no directory component, then add one.
6366 case $file in
6367 */* | *\\*) . $file ;;
6368 *) . ./$file ;;
6369 esac
6371 # Add the libdir to current_libdirs if it is the destination.
6372 if test "X$destdir" = "X$libdir"; then
6373 case "$current_libdirs " in
6374 *" $libdir "*) ;;
6375 *) current_libdirs="$current_libdirs $libdir" ;;
6376 esac
6377 else
6378 # Note the libdir as a future libdir.
6379 case "$future_libdirs " in
6380 *" $libdir "*) ;;
6381 *) future_libdirs="$future_libdirs $libdir" ;;
6382 esac
6385 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
6386 test "X$dir" = "X$file/" && dir=
6387 dir="$dir$objdir"
6389 if test -n "$relink_command"; then
6390 # Determine the prefix the user has applied to our future dir.
6391 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6393 # Don't allow the user to place us outside of our expected
6394 # location b/c this prevents finding dependent libraries that
6395 # are installed to the same prefix.
6396 # At present, this check doesn't affect windows .dll's that
6397 # are installed into $libdir/../bin (currently, that works fine)
6398 # but it's something to keep an eye on.
6399 if test "$inst_prefix_dir" = "$destdir"; then
6400 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6401 exit $EXIT_FAILURE
6404 if test -n "$inst_prefix_dir"; then
6405 # Stick the inst_prefix_dir data into the link command.
6406 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6407 else
6408 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6411 $echo "$modename: warning: relinking \`$file'" 1>&2
6412 $show "$relink_command"
6413 if $run eval "$relink_command"; then :
6414 else
6415 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6416 exit $EXIT_FAILURE
6420 # See the names of the shared library.
6421 set dummy $library_names
6422 if test -n "$2"; then
6423 realname="$2"
6424 shift
6425 shift
6427 srcname="$realname"
6428 test -n "$relink_command" && srcname="$realname"T
6430 # Install the shared library and build the symlinks.
6431 $show "$install_prog $dir/$srcname $destdir/$realname"
6432 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6433 if test -n "$stripme" && test -n "$striplib"; then
6434 $show "$striplib $destdir/$realname"
6435 $run eval "$striplib $destdir/$realname" || exit $?
6438 if test "$#" -gt 0; then
6439 # Delete the old symlinks, and create new ones.
6440 # Try `ln -sf' first, because the `ln' binary might depend on
6441 # the symlink we replace! Solaris /bin/ln does not understand -f,
6442 # so we also need to try rm && ln -s.
6443 for linkname
6445 if test "$linkname" != "$realname"; then
6446 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6447 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6449 done
6452 # Do each command in the postinstall commands.
6453 lib="$destdir/$realname"
6454 cmds=$postinstall_cmds
6455 save_ifs="$IFS"; IFS='~'
6456 for cmd in $cmds; do
6457 IFS="$save_ifs"
6458 eval cmd=\"$cmd\"
6459 $show "$cmd"
6460 $run eval "$cmd" || {
6461 lt_exit=$?
6463 # Restore the uninstalled library and exit
6464 if test "$mode" = relink; then
6465 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6468 exit $lt_exit
6470 done
6471 IFS="$save_ifs"
6474 # Install the pseudo-library for information purposes.
6475 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6476 instname="$dir/$name"i
6477 $show "$install_prog $instname $destdir/$name"
6478 $run eval "$install_prog $instname $destdir/$name" || exit $?
6480 # Maybe install the static library, too.
6481 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6484 *.lo)
6485 # Install (i.e. copy) a libtool object.
6487 # Figure out destination file name, if it wasn't already specified.
6488 if test -n "$destname"; then
6489 destfile="$destdir/$destname"
6490 else
6491 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6492 destfile="$destdir/$destfile"
6495 # Deduce the name of the destination old-style object file.
6496 case $destfile in
6497 *.lo)
6498 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6500 *.$objext)
6501 staticdest="$destfile"
6502 destfile=
6505 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6506 $echo "$help" 1>&2
6507 exit $EXIT_FAILURE
6509 esac
6511 # Install the libtool object if requested.
6512 if test -n "$destfile"; then
6513 $show "$install_prog $file $destfile"
6514 $run eval "$install_prog $file $destfile" || exit $?
6517 # Install the old object if enabled.
6518 if test "$build_old_libs" = yes; then
6519 # Deduce the name of the old-style object file.
6520 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6522 $show "$install_prog $staticobj $staticdest"
6523 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6525 exit $EXIT_SUCCESS
6529 # Figure out destination file name, if it wasn't already specified.
6530 if test -n "$destname"; then
6531 destfile="$destdir/$destname"
6532 else
6533 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6534 destfile="$destdir/$destfile"
6537 # If the file is missing, and there is a .exe on the end, strip it
6538 # because it is most likely a libtool script we actually want to
6539 # install
6540 stripped_ext=""
6541 case $file in
6542 *.exe)
6543 if test ! -f "$file"; then
6544 file=`$echo $file|${SED} 's,.exe$,,'`
6545 stripped_ext=".exe"
6548 esac
6550 # Do a test to see if this is really a libtool program.
6551 case $host in
6552 *cygwin*|*mingw*)
6553 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6556 wrapper=$file
6558 esac
6559 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6560 notinst_deplibs=
6561 relink_command=
6563 # Note that it is not necessary on cygwin/mingw to append a dot to
6564 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6565 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6566 # `FILE.' does not work on cygwin managed mounts.
6568 # If there is no directory component, then add one.
6569 case $wrapper in
6570 */* | *\\*) . ${wrapper} ;;
6571 *) . ./${wrapper} ;;
6572 esac
6574 # Check the variables that should have been set.
6575 if test -z "$notinst_deplibs"; then
6576 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6577 exit $EXIT_FAILURE
6580 finalize=yes
6581 for lib in $notinst_deplibs; do
6582 # Check to see that each library is installed.
6583 libdir=
6584 if test -f "$lib"; then
6585 # If there is no directory component, then add one.
6586 case $lib in
6587 */* | *\\*) . $lib ;;
6588 *) . ./$lib ;;
6589 esac
6591 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6592 if test -n "$libdir" && test ! -f "$libfile"; then
6593 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6594 finalize=no
6596 done
6598 relink_command=
6599 # Note that it is not necessary on cygwin/mingw to append a dot to
6600 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6601 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6602 # `FILE.' does not work on cygwin managed mounts.
6604 # If there is no directory component, then add one.
6605 case $wrapper in
6606 */* | *\\*) . ${wrapper} ;;
6607 *) . ./${wrapper} ;;
6608 esac
6610 outputname=
6611 if test "$fast_install" = no && test -n "$relink_command"; then
6612 if test "$finalize" = yes && test -z "$run"; then
6613 tmpdir=`func_mktempdir`
6614 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6615 outputname="$tmpdir/$file"
6616 # Replace the output file specification.
6617 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6619 $show "$relink_command"
6620 if $run eval "$relink_command"; then :
6621 else
6622 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6623 ${rm}r "$tmpdir"
6624 continue
6626 file="$outputname"
6627 else
6628 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6630 else
6631 # Install the binary that we compiled earlier.
6632 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6636 # remove .exe since cygwin /usr/bin/install will append another
6637 # one anyway
6638 case $install_prog,$host in
6639 */usr/bin/install*,*cygwin*)
6640 case $file:$destfile in
6641 *.exe:*.exe)
6642 # this is ok
6644 *.exe:*)
6645 destfile=$destfile.exe
6647 *:*.exe)
6648 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6650 esac
6652 esac
6653 $show "$install_prog$stripme $file $destfile"
6654 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6655 test -n "$outputname" && ${rm}r "$tmpdir"
6657 esac
6658 done
6660 for file in $staticlibs; do
6661 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6663 # Set up the ranlib parameters.
6664 oldlib="$destdir/$name"
6666 $show "$install_prog $file $oldlib"
6667 $run eval "$install_prog \$file \$oldlib" || exit $?
6669 if test -n "$stripme" && test -n "$old_striplib"; then
6670 $show "$old_striplib $oldlib"
6671 $run eval "$old_striplib $oldlib" || exit $?
6674 # Do each command in the postinstall commands.
6675 cmds=$old_postinstall_cmds
6676 save_ifs="$IFS"; IFS='~'
6677 for cmd in $cmds; do
6678 IFS="$save_ifs"
6679 eval cmd=\"$cmd\"
6680 $show "$cmd"
6681 $run eval "$cmd" || exit $?
6682 done
6683 IFS="$save_ifs"
6684 done
6686 if test -n "$future_libdirs"; then
6687 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6690 if test -n "$current_libdirs"; then
6691 # Maybe just do a dry run.
6692 test -n "$run" && current_libdirs=" -n$current_libdirs"
6693 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6694 else
6695 exit $EXIT_SUCCESS
6699 # libtool finish mode
6700 finish)
6701 modename="$modename: finish"
6702 libdirs="$nonopt"
6703 admincmds=
6705 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6706 for dir
6708 libdirs="$libdirs $dir"
6709 done
6711 for libdir in $libdirs; do
6712 if test -n "$finish_cmds"; then
6713 # Do each command in the finish commands.
6714 cmds=$finish_cmds
6715 save_ifs="$IFS"; IFS='~'
6716 for cmd in $cmds; do
6717 IFS="$save_ifs"
6718 eval cmd=\"$cmd\"
6719 $show "$cmd"
6720 $run eval "$cmd" || admincmds="$admincmds
6721 $cmd"
6722 done
6723 IFS="$save_ifs"
6725 if test -n "$finish_eval"; then
6726 # Do the single finish_eval.
6727 eval cmds=\"$finish_eval\"
6728 $run eval "$cmds" || admincmds="$admincmds
6729 $cmds"
6731 done
6734 # Exit here if they wanted silent mode.
6735 test "$show" = : && exit $EXIT_SUCCESS
6737 $echo "X----------------------------------------------------------------------" | $Xsed
6738 $echo "Libraries have been installed in:"
6739 for libdir in $libdirs; do
6740 $echo " $libdir"
6741 done
6742 $echo
6743 $echo "If you ever happen to want to link against installed libraries"
6744 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6745 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6746 $echo "flag during linking and do at least one of the following:"
6747 if test -n "$shlibpath_var"; then
6748 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6749 $echo " during execution"
6751 if test -n "$runpath_var"; then
6752 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6753 $echo " during linking"
6755 if test -n "$hardcode_libdir_flag_spec"; then
6756 libdir=LIBDIR
6757 eval flag=\"$hardcode_libdir_flag_spec\"
6759 $echo " - use the \`$flag' linker flag"
6761 if test -n "$admincmds"; then
6762 $echo " - have your system administrator run these commands:$admincmds"
6764 if test -f /etc/ld.so.conf; then
6765 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6767 $echo
6768 $echo "See any operating system documentation about shared libraries for"
6769 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6770 $echo "X----------------------------------------------------------------------" | $Xsed
6771 exit $EXIT_SUCCESS
6774 # libtool execute mode
6775 execute)
6776 modename="$modename: execute"
6778 # The first argument is the command name.
6779 cmd="$nonopt"
6780 if test -z "$cmd"; then
6781 $echo "$modename: you must specify a COMMAND" 1>&2
6782 $echo "$help"
6783 exit $EXIT_FAILURE
6786 # Handle -dlopen flags immediately.
6787 for file in $execute_dlfiles; do
6788 if test ! -f "$file"; then
6789 $echo "$modename: \`$file' is not a file" 1>&2
6790 $echo "$help" 1>&2
6791 exit $EXIT_FAILURE
6794 dir=
6795 case $file in
6796 *.la)
6797 # Check to see that this really is a libtool archive.
6798 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6799 else
6800 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6801 $echo "$help" 1>&2
6802 exit $EXIT_FAILURE
6805 # Read the libtool library.
6806 dlname=
6807 library_names=
6809 # If there is no directory component, then add one.
6810 case $file in
6811 */* | *\\*) . $file ;;
6812 *) . ./$file ;;
6813 esac
6815 # Skip this library if it cannot be dlopened.
6816 if test -z "$dlname"; then
6817 # Warn if it was a shared library.
6818 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6819 continue
6822 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6823 test "X$dir" = "X$file" && dir=.
6825 if test -f "$dir/$objdir/$dlname"; then
6826 dir="$dir/$objdir"
6827 else
6828 if test ! -f "$dir/$dlname"; then
6829 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6830 exit $EXIT_FAILURE
6835 *.lo)
6836 # Just add the directory containing the .lo file.
6837 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6838 test "X$dir" = "X$file" && dir=.
6842 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6843 continue
6845 esac
6847 # Get the absolute pathname.
6848 absdir=`cd "$dir" && pwd`
6849 test -n "$absdir" && dir="$absdir"
6851 # Now add the directory to shlibpath_var.
6852 if eval "test -z \"\$$shlibpath_var\""; then
6853 eval "$shlibpath_var=\"\$dir\""
6854 else
6855 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6857 done
6859 # This variable tells wrapper scripts just to set shlibpath_var
6860 # rather than running their programs.
6861 libtool_execute_magic="$magic"
6863 # Check if any of the arguments is a wrapper script.
6864 args=
6865 for file
6867 case $file in
6868 -*) ;;
6870 # Do a test to see if this is really a libtool program.
6871 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6872 # If there is no directory component, then add one.
6873 case $file in
6874 */* | *\\*) . $file ;;
6875 *) . ./$file ;;
6876 esac
6878 # Transform arg to wrapped name.
6879 file="$progdir/$program"
6882 esac
6883 # Quote arguments (to preserve shell metacharacters).
6884 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6885 args="$args \"$file\""
6886 done
6888 if test -z "$run"; then
6889 if test -n "$shlibpath_var"; then
6890 # Export the shlibpath_var.
6891 eval "export $shlibpath_var"
6894 # Restore saved environment variables
6895 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6897 eval "if test \"\${save_$lt_var+set}\" = set; then
6898 $lt_var=\$save_$lt_var; export $lt_var
6899 else
6900 $lt_unset $lt_var
6902 done
6904 # Now prepare to actually exec the command.
6905 exec_cmd="\$cmd$args"
6906 else
6907 # Display what would be done.
6908 if test -n "$shlibpath_var"; then
6909 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6910 $echo "export $shlibpath_var"
6912 $echo "$cmd$args"
6913 exit $EXIT_SUCCESS
6917 # libtool clean and uninstall mode
6918 clean | uninstall)
6919 modename="$modename: $mode"
6920 rm="$nonopt"
6921 files=
6922 rmforce=
6923 exit_status=0
6925 # This variable tells wrapper scripts just to set variables rather
6926 # than running their programs.
6927 libtool_install_magic="$magic"
6929 for arg
6931 case $arg in
6932 -f) rm="$rm $arg"; rmforce=yes ;;
6933 -*) rm="$rm $arg" ;;
6934 *) files="$files $arg" ;;
6935 esac
6936 done
6938 if test -z "$rm"; then
6939 $echo "$modename: you must specify an RM program" 1>&2
6940 $echo "$help" 1>&2
6941 exit $EXIT_FAILURE
6944 rmdirs=
6946 origobjdir="$objdir"
6947 for file in $files; do
6948 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6949 if test "X$dir" = "X$file"; then
6950 dir=.
6951 objdir="$origobjdir"
6952 else
6953 objdir="$dir/$origobjdir"
6955 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6956 test "$mode" = uninstall && objdir="$dir"
6958 # Remember objdir for removal later, being careful to avoid duplicates
6959 if test "$mode" = clean; then
6960 case " $rmdirs " in
6961 *" $objdir "*) ;;
6962 *) rmdirs="$rmdirs $objdir" ;;
6963 esac
6966 # Don't error if the file doesn't exist and rm -f was used.
6967 if (test -L "$file") >/dev/null 2>&1 \
6968 || (test -h "$file") >/dev/null 2>&1 \
6969 || test -f "$file"; then
6971 elif test -d "$file"; then
6972 exit_status=1
6973 continue
6974 elif test "$rmforce" = yes; then
6975 continue
6978 rmfiles="$file"
6980 case $name in
6981 *.la)
6982 # Possibly a libtool archive, so verify it.
6983 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6984 . $dir/$name
6986 # Delete the libtool libraries and symlinks.
6987 for n in $library_names; do
6988 rmfiles="$rmfiles $objdir/$n"
6989 done
6990 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6992 case "$mode" in
6993 clean)
6994 case " $library_names " in
6995 # " " in the beginning catches empty $dlname
6996 *" $dlname "*) ;;
6997 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6998 esac
6999 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
7001 uninstall)
7002 if test -n "$library_names"; then
7003 # Do each command in the postuninstall commands.
7004 cmds=$postuninstall_cmds
7005 save_ifs="$IFS"; IFS='~'
7006 for cmd in $cmds; do
7007 IFS="$save_ifs"
7008 eval cmd=\"$cmd\"
7009 $show "$cmd"
7010 $run eval "$cmd"
7011 if test "$?" -ne 0 && test "$rmforce" != yes; then
7012 exit_status=1
7014 done
7015 IFS="$save_ifs"
7018 if test -n "$old_library"; then
7019 # Do each command in the old_postuninstall commands.
7020 cmds=$old_postuninstall_cmds
7021 save_ifs="$IFS"; IFS='~'
7022 for cmd in $cmds; do
7023 IFS="$save_ifs"
7024 eval cmd=\"$cmd\"
7025 $show "$cmd"
7026 $run eval "$cmd"
7027 if test "$?" -ne 0 && test "$rmforce" != yes; then
7028 exit_status=1
7030 done
7031 IFS="$save_ifs"
7033 # FIXME: should reinstall the best remaining shared library.
7035 esac
7039 *.lo)
7040 # Possibly a libtool object, so verify it.
7041 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
7043 # Read the .lo file
7044 . $dir/$name
7046 # Add PIC object to the list of files to remove.
7047 if test -n "$pic_object" \
7048 && test "$pic_object" != none; then
7049 rmfiles="$rmfiles $dir/$pic_object"
7052 # Add non-PIC object to the list of files to remove.
7053 if test -n "$non_pic_object" \
7054 && test "$non_pic_object" != none; then
7055 rmfiles="$rmfiles $dir/$non_pic_object"
7061 if test "$mode" = clean ; then
7062 noexename=$name
7063 case $file in
7064 *.exe)
7065 file=`$echo $file|${SED} 's,.exe$,,'`
7066 noexename=`$echo $name|${SED} 's,.exe$,,'`
7067 # $file with .exe has already been added to rmfiles,
7068 # add $file without .exe
7069 rmfiles="$rmfiles $file"
7071 esac
7072 # Do a test to see if this is a libtool program.
7073 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
7074 relink_command=
7075 . $dir/$noexename
7077 # note $name still contains .exe if it was in $file originally
7078 # as does the version of $file that was added into $rmfiles
7079 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
7080 if test "$fast_install" = yes && test -n "$relink_command"; then
7081 rmfiles="$rmfiles $objdir/lt-$name"
7083 if test "X$noexename" != "X$name" ; then
7084 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
7089 esac
7090 $show "$rm $rmfiles"
7091 $run $rm $rmfiles || exit_status=1
7092 done
7093 objdir="$origobjdir"
7095 # Try to remove the ${objdir}s in the directories where we deleted files
7096 for dir in $rmdirs; do
7097 if test -d "$dir"; then
7098 $show "rmdir $dir"
7099 $run rmdir $dir >/dev/null 2>&1
7101 done
7103 exit $exit_status
7107 $echo "$modename: you must specify a MODE" 1>&2
7108 $echo "$generic_help" 1>&2
7109 exit $EXIT_FAILURE
7111 esac
7113 if test -z "$exec_cmd"; then
7114 $echo "$modename: invalid operation mode \`$mode'" 1>&2
7115 $echo "$generic_help" 1>&2
7116 exit $EXIT_FAILURE
7118 fi # test -z "$show_help"
7120 if test -n "$exec_cmd"; then
7121 eval exec $exec_cmd
7122 exit $EXIT_FAILURE
7125 # We need to display help for each of the modes.
7126 case $mode in
7127 "") $echo \
7128 "Usage: $modename [OPTION]... [MODE-ARG]...
7130 Provide generalized library-building support services.
7132 --config show all configuration variables
7133 --debug enable verbose shell tracing
7134 -n, --dry-run display commands without modifying any files
7135 --features display basic configuration information and exit
7136 --finish same as \`--mode=finish'
7137 --help display this help message and exit
7138 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
7139 --quiet same as \`--silent'
7140 --silent don't print informational messages
7141 --tag=TAG use configuration variables from tag TAG
7142 --version print version information
7144 MODE must be one of the following:
7146 clean remove files from the build directory
7147 compile compile a source file into a libtool object
7148 execute automatically set library path, then run a program
7149 finish complete the installation of libtool libraries
7150 install install libraries or executables
7151 link create a library or an executable
7152 uninstall remove libraries from an installed directory
7154 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
7155 a more detailed description of MODE.
7157 Report bugs to <bug-libtool@gnu.org>."
7158 exit $EXIT_SUCCESS
7161 clean)
7162 $echo \
7163 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
7165 Remove files from the build directory.
7167 RM is the name of the program to use to delete files associated with each FILE
7168 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
7169 to RM.
7171 If FILE is a libtool library, object or program, all the files associated
7172 with it are deleted. Otherwise, only FILE itself is deleted using RM."
7175 compile)
7176 $echo \
7177 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
7179 Compile a source file into a libtool library object.
7181 This mode accepts the following additional options:
7183 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
7184 -prefer-pic try to building PIC objects only
7185 -prefer-non-pic try to building non-PIC objects only
7186 -static always build a \`.o' file suitable for static linking
7188 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
7189 from the given SOURCEFILE.
7191 The output file name is determined by removing the directory component from
7192 SOURCEFILE, then substituting the C source code suffix \`.c' with the
7193 library object suffix, \`.lo'."
7196 execute)
7197 $echo \
7198 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
7200 Automatically set library path, then run a program.
7202 This mode accepts the following additional options:
7204 -dlopen FILE add the directory containing FILE to the library path
7206 This mode sets the library path environment variable according to \`-dlopen'
7207 flags.
7209 If any of the ARGS are libtool executable wrappers, then they are translated
7210 into their corresponding uninstalled binary, and any of their required library
7211 directories are added to the library path.
7213 Then, COMMAND is executed, with ARGS as arguments."
7216 finish)
7217 $echo \
7218 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
7220 Complete the installation of libtool libraries.
7222 Each LIBDIR is a directory that contains libtool libraries.
7224 The commands that this mode executes may require superuser privileges. Use
7225 the \`--dry-run' option if you just want to see what would be executed."
7228 install)
7229 $echo \
7230 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
7232 Install executables or libraries.
7234 INSTALL-COMMAND is the installation command. The first component should be
7235 either the \`install' or \`cp' program.
7237 The rest of the components are interpreted as arguments to that command (only
7238 BSD-compatible install options are recognized)."
7241 link)
7242 $echo \
7243 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
7245 Link object files or libraries together to form another library, or to
7246 create an executable program.
7248 LINK-COMMAND is a command using the C compiler that you would use to create
7249 a program from several object files.
7251 The following components of LINK-COMMAND are treated specially:
7253 -all-static do not do any dynamic linking at all
7254 -avoid-version do not add a version suffix if possible
7255 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
7256 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
7257 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
7258 -export-symbols SYMFILE
7259 try to export only the symbols listed in SYMFILE
7260 -export-symbols-regex REGEX
7261 try to export only the symbols matching REGEX
7262 -LLIBDIR search LIBDIR for required installed libraries
7263 -lNAME OUTPUT-FILE requires the installed library libNAME
7264 -module build a library that can dlopened
7265 -no-fast-install disable the fast-install mode
7266 -no-install link a not-installable executable
7267 -no-undefined declare that a library does not refer to external symbols
7268 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
7269 -objectlist FILE Use a list of object files found in FILE to specify objects
7270 -precious-files-regex REGEX
7271 don't remove output files matching REGEX
7272 -release RELEASE specify package release information
7273 -rpath LIBDIR the created library will eventually be installed in LIBDIR
7274 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
7275 -static do not do any dynamic linking of uninstalled libtool libraries
7276 -static-libtool-libs
7277 do not do any dynamic linking of libtool libraries
7278 -version-info CURRENT[:REVISION[:AGE]]
7279 specify library version info [each variable defaults to 0]
7281 All other options (arguments beginning with \`-') are ignored.
7283 Every other argument is treated as a filename. Files ending in \`.la' are
7284 treated as uninstalled libtool libraries, other files are standard or library
7285 object files.
7287 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
7288 only library objects (\`.lo' files) may be specified, and \`-rpath' is
7289 required, except when creating a convenience library.
7291 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
7292 using \`ar' and \`ranlib', or on Windows using \`lib'.
7294 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
7295 is created, otherwise an executable program is created."
7298 uninstall)
7299 $echo \
7300 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
7302 Remove libraries from an installation directory.
7304 RM is the name of the program to use to delete files associated with each FILE
7305 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
7306 to RM.
7308 If FILE is a libtool library, all the files associated with it are deleted.
7309 Otherwise, only FILE itself is deleted using RM."
7313 $echo "$modename: invalid operation mode \`$mode'" 1>&2
7314 $echo "$help" 1>&2
7315 exit $EXIT_FAILURE
7317 esac
7319 $echo
7320 $echo "Try \`$modename --help' for more information about other modes."
7322 exit $?
7324 # The TAGs below are defined such that we never get into a situation
7325 # in which we disable both kinds of libraries. Given conflicting
7326 # choices, we go for a static library, that is the most portable,
7327 # since we can't tell whether shared libraries were disabled because
7328 # the user asked for that or because the platform doesn't support
7329 # them. This is particularly important on AIX, because we don't
7330 # support having both static and shared libraries enabled at the same
7331 # time on that platform, so we default to a shared-only configuration.
7332 # If a disable-shared tag is given, we'll fallback to a static-only
7333 # configuration. But we'll never go from static-only to shared-only.
7335 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
7336 disable_libs=shared
7337 # ### END LIBTOOL TAG CONFIG: disable-shared
7339 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
7340 disable_libs=static
7341 # ### END LIBTOOL TAG CONFIG: disable-static
7343 # Local Variables:
7344 # mode:shell-script
7345 # sh-indentation:2
7346 # End:
7347 # ### BEGIN LIBTOOL TAG CONFIG: CXX
7349 # Libtool was configured on host ubuntu:
7351 # Shell to use when invoking shell scripts.
7352 SHELL="/bin/bash"
7354 # Whether or not to build shared libraries.
7355 build_libtool_libs=yes
7357 # Whether or not to build static libraries.
7358 build_old_libs=yes
7360 # Whether or not to add -lc for building shared libraries.
7361 build_libtool_need_lc=no
7363 # Whether or not to disallow shared libs when runtime libs are static
7364 allow_libtool_libs_with_static_runtimes=no
7366 # Whether or not to optimize for fast installation.
7367 fast_install=yes
7369 # The host system.
7370 host_alias=
7371 host=i686-pc-linux-gnu
7372 host_os=linux-gnu
7374 # The build system.
7375 build_alias=
7376 build=i686-pc-linux-gnu
7377 build_os=linux-gnu
7379 # An echo program that does not interpret backslashes.
7380 echo="echo"
7382 # The archiver.
7383 AR="ar"
7384 AR_FLAGS="cru"
7386 # A C compiler.
7387 LTCC="gcc"
7389 # LTCC compiler flags.
7390 LTCFLAGS="-g -O2"
7392 # A language-specific compiler.
7393 CC="g++"
7395 # Is the compiler the GNU C compiler?
7396 with_gcc=yes
7398 # An ERE matcher.
7399 EGREP="/bin/grep -E"
7401 # The linker used to build libraries.
7402 LD="/usr/bin/ld"
7404 # Whether we need hard or soft links.
7405 LN_S="ln -s"
7407 # A BSD-compatible nm program.
7408 NM="/usr/bin/nm -B"
7410 # A symbol stripping program
7411 STRIP="strip"
7413 # Used to examine libraries when file_magic_cmd begins "file"
7414 MAGIC_CMD=file
7416 # Used on cygwin: DLL creation program.
7417 DLLTOOL="dlltool"
7419 # Used on cygwin: object dumper.
7420 OBJDUMP="objdump"
7422 # Used on cygwin: assembler.
7423 AS="as"
7425 # The name of the directory that contains temporary libtool files.
7426 objdir=.libs
7428 # How to create reloadable object files.
7429 reload_flag=" -r"
7430 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
7432 # How to pass a linker flag through the compiler.
7433 wl="-Wl,"
7435 # Object file suffix (normally "o").
7436 objext="o"
7438 # Old archive suffix (normally "a").
7439 libext="a"
7441 # Shared library suffix (normally ".so").
7442 shrext_cmds='.so'
7444 # Executable file suffix (normally "").
7445 exeext=""
7447 # Additional compiler flags for building library objects.
7448 pic_flag=" -fPIC -DPIC"
7449 pic_mode=default
7451 # What is the maximum length of a command?
7452 max_cmd_len=32768
7454 # Does compiler simultaneously support -c and -o options?
7455 compiler_c_o="yes"
7457 # Must we lock files when doing compilation?
7458 need_locks="no"
7460 # Do we need the lib prefix for modules?
7461 need_lib_prefix=no
7463 # Do we need a version for libraries?
7464 need_version=no
7466 # Whether dlopen is supported.
7467 dlopen_support=unknown
7469 # Whether dlopen of programs is supported.
7470 dlopen_self=unknown
7472 # Whether dlopen of statically linked programs is supported.
7473 dlopen_self_static=unknown
7475 # Compiler flag to prevent dynamic linking.
7476 link_static_flag="-static"
7478 # Compiler flag to turn off builtin functions.
7479 no_builtin_flag=" -fno-builtin"
7481 # Compiler flag to allow reflexive dlopens.
7482 export_dynamic_flag_spec="\${wl}--export-dynamic"
7484 # Compiler flag to generate shared objects directly from archives.
7485 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
7487 # Compiler flag to generate thread-safe objects.
7488 thread_safe_flag_spec=""
7490 # Library versioning type.
7491 version_type=linux
7493 # Format of library name prefix.
7494 libname_spec="lib\$name"
7496 # List of archive names. First name is the real one, the rest are links.
7497 # The last name is the one that the linker finds with -lNAME.
7498 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
7500 # The coded name of the library, if different from the real name.
7501 soname_spec="\${libname}\${release}\${shared_ext}\$major"
7503 # Commands used to build and install an old-style archive.
7504 RANLIB="ranlib"
7505 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib"
7506 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
7507 old_postuninstall_cmds=""
7509 # Create an old-style archive from a shared archive.
7510 old_archive_from_new_cmds=""
7512 # Create a temporary old-style archive to link instead of a shared archive.
7513 old_archive_from_expsyms_cmds=""
7515 # Commands used to build and install a shared archive.
7516 archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
7517 archive_expsym_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib"
7518 postinstall_cmds=""
7519 postuninstall_cmds=""
7521 # Commands used to build a loadable module (assumed same as above if empty)
7522 module_cmds=""
7523 module_expsym_cmds=""
7525 # Commands to strip libraries.
7526 old_striplib="strip --strip-debug"
7527 striplib="strip --strip-unneeded"
7529 # Dependencies to place before the objects being linked to create a
7530 # shared library.
7531 predep_objects="/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.4.3/crtbeginS.o"
7533 # Dependencies to place after the objects being linked to create a
7534 # shared library.
7535 postdep_objects="/usr/lib/gcc/i486-linux-gnu/4.4.3/crtendS.o /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crtn.o"
7537 # Dependencies to place before the objects being linked to create a
7538 # shared library.
7539 predeps=""
7541 # Dependencies to place after the objects being linked to create a
7542 # shared library.
7543 postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
7545 # The library search path used internally by the compiler when linking
7546 # a shared library.
7547 compiler_lib_search_path="-L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../.. -L/usr/lib/i486-linux-gnu"
7549 # Method to check whether dependent libraries are shared objects.
7550 deplibs_check_method="pass_all"
7552 # Command to use when deplibs_check_method == file_magic.
7553 file_magic_cmd="\$MAGIC_CMD"
7555 # Flag that allows shared libraries with undefined symbols to be built.
7556 allow_undefined_flag=""
7558 # Flag that forces no undefined symbols.
7559 no_undefined_flag=""
7561 # Commands used to finish a libtool library installation in a directory.
7562 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
7564 # Same as above, but a single script fragment to be evaled but not shown.
7565 finish_eval=""
7567 # Take the output of nm and produce a listing of raw symbols and C names.
7568 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
7570 # Transform the output of nm in a proper C declaration
7571 global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
7573 # Transform the output of nm in a C name address pair
7574 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'"
7576 # This is the shared library runtime path variable.
7577 runpath_var=LD_RUN_PATH
7579 # This is the shared library path variable.
7580 shlibpath_var=LD_LIBRARY_PATH
7582 # Is shlibpath searched before the hard-coded library search path?
7583 shlibpath_overrides_runpath=no
7585 # How to hardcode a shared library path into an executable.
7586 hardcode_action=immediate
7588 # Whether we should hardcode library paths into libraries.
7589 hardcode_into_libs=yes
7591 # Flag to hardcode $libdir into a binary during linking.
7592 # This must work even if $libdir does not exist.
7593 hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
7595 # If ld is used when linking, flag to hardcode $libdir into
7596 # a binary during linking. This must work even if $libdir does
7597 # not exist.
7598 hardcode_libdir_flag_spec_ld=""
7600 # Whether we need a single -rpath flag with a separated argument.
7601 hardcode_libdir_separator=""
7603 # Set to yes if using DIR/libNAME during linking hardcodes DIR into the
7604 # resulting binary.
7605 hardcode_direct=no
7607 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
7608 # resulting binary.
7609 hardcode_minus_L=no
7611 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
7612 # the resulting binary.
7613 hardcode_shlibpath_var=unsupported
7615 # Set to yes if building a shared library automatically hardcodes DIR into the library
7616 # and all subsequent libraries and executables linked against it.
7617 hardcode_automatic=no
7619 # Variables whose values should be saved in libtool wrapper scripts and
7620 # restored at relink time.
7621 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
7623 # Whether libtool must link a program against all its dependency libraries.
7624 link_all_deplibs=unknown
7626 # Compile-time system search path for libraries
7627 sys_lib_search_path_spec="/usr/lib/gcc/i486-linux-gnu/4.4.3 /usr/lib /lib /usr/lib/i486-linux-gnu"
7629 # Run-time system search path for libraries
7630 sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/nvidia-current /lib/i486-linux-gnu /usr/lib/i486-linux-gnu /usr/lib/alsa-lib /usr/local/lib "
7632 # Fix the shell variable $srcfile for the compiler.
7633 fix_srcfile_path=""
7635 # Set to yes if exported symbols are required.
7636 always_export_symbols=no
7638 # The commands to list exported symbols.
7639 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
7641 # The commands to extract the exported symbol list from a shared archive.
7642 extract_expsyms_cmds=""
7644 # Symbols that should not be listed in the preloaded symbols.
7645 exclude_expsyms=""
7647 # Symbols that must always be exported.
7648 include_expsyms=""
7650 # ### END LIBTOOL TAG CONFIG: CXX