summaryrefslogtreecommitdiff
path: root/libtool (plain)
blob: c7a861ad6b719b6392cc505a4706bf14fe7092de
1#! /bin/sh
2
3# libtoolT - Provide generalized library-building support services.
4# Generated automatically by (GNU zvbi 0.2.33)
5# NOTE: Changes made to this file will be lost: look at ltmain.sh.
6#
7# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
8# Free Software Foundation, Inc.
9#
10# This file is part of GNU Libtool:
11# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
12#
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.
17#
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.
22#
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.
26#
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.
31
32# A sed program that does not truncate output.
33SED="/bin/sed"
34
35# Sed that helps us avoid accidentally triggering echo(1) options like -n.
36Xsed="/bin/sed -e 1s/^X//"
37
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
41
42# The names of the tagged configurations supported by this script.
43available_tags=" CXX"
44
45# ### BEGIN LIBTOOL CONFIG
46
47# Libtool was configured on host linux-gk:
48
49# Shell to use when invoking shell scripts.
50SHELL="/bin/sh"
51
52# Whether or not to build shared libraries.
53build_libtool_libs=yes
54
55# Whether or not to build static libraries.
56build_old_libs=yes
57
58# Whether or not to add -lc for building shared libraries.
59build_libtool_need_lc=no
60
61# Whether or not to disallow shared libs when runtime libs are static
62allow_libtool_libs_with_static_runtimes=no
63
64# Whether or not to optimize for fast installation.
65fast_install=yes
66
67# The host system.
68host_alias=
69host=x86_64-unknown-linux-gnu
70host_os=linux-gnu
71
72# The build system.
73build_alias=
74build=x86_64-unknown-linux-gnu
75build_os=linux-gnu
76
77# An echo program that does not interpret backslashes.
78echo="echo"
79
80# The archiver.
81AR="ar"
82AR_FLAGS="cru"
83
84# A C compiler.
85LTCC="gcc"
86
87# A language-specific compiler.
88CC="gcc"
89
90# Is the compiler the GNU C compiler?
91with_gcc=yes
92
93# An ERE matcher.
94EGREP="/usr/bin/grep -E"
95
96# The linker used to build libraries.
97LD="/usr/bin/ld -m elf_x86_64"
98
99# Whether we need hard or soft links.
100LN_S="ln -s"
101
102# A BSD-compatible nm program.
103NM="/usr/bin/nm -B"
104
105# A symbol stripping program
106STRIP="strip"
107
108# Used to examine libraries when file_magic_cmd begins "file"
109MAGIC_CMD=file
110
111# Used on cygwin: DLL creation program.
112DLLTOOL="dlltool"
113
114# Used on cygwin: object dumper.
115OBJDUMP="objdump"
116
117# Used on cygwin: assembler.
118AS="as"
119
120# The name of the directory that contains temporary libtool files.
121objdir=.libs
122
123# How to create reloadable object files.
124reload_flag=" -r"
125reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
126
127# How to pass a linker flag through the compiler.
128wl="-Wl,"
129
130# Object file suffix (normally "o").
131objext="o"
132
133# Old archive suffix (normally "a").
134libext="a"
135
136# Shared library suffix (normally ".so").
137shrext_cmds='.so'
138
139# Executable file suffix (normally "").
140exeext=""
141
142# Additional compiler flags for building library objects.
143pic_flag=" -fPIC -DPIC"
144pic_mode=default
145
146# What is the maximum length of a command?
147max_cmd_len=32768
148
149# Does compiler simultaneously support -c and -o options?
150compiler_c_o="yes"
151
152# Must we lock files when doing compilation?
153need_locks="no"
154
155# Do we need the lib prefix for modules?
156need_lib_prefix=no
157
158# Do we need a version for libraries?
159need_version=no
160
161# Whether dlopen is supported.
162dlopen_support=unknown
163
164# Whether dlopen of programs is supported.
165dlopen_self=unknown
166
167# Whether dlopen of statically linked programs is supported.
168dlopen_self_static=unknown
169
170# Compiler flag to prevent dynamic linking.
171link_static_flag="-static"
172
173# Compiler flag to turn off builtin functions.
174no_builtin_flag=" -fno-builtin"
175
176# Compiler flag to allow reflexive dlopens.
177export_dynamic_flag_spec="\${wl}--export-dynamic"
178
179# Compiler flag to generate shared objects directly from archives.
180whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
181
182# Compiler flag to generate thread-safe objects.
183thread_safe_flag_spec=""
184
185# Library versioning type.
186version_type=linux
187
188# Format of library name prefix.
189libname_spec="lib\$name"
190
191# List of archive names. First name is the real one, the rest are links.
192# The last name is the one that the linker finds with -lNAME.
193library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
194
195# The coded name of the library, if different from the real name.
196soname_spec="\${libname}\${release}\${shared_ext}\$major"
197
198# Commands used to build and install an old-style archive.
199RANLIB="ranlib"
200old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib"
201old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib"
202old_postuninstall_cmds=""
203
204# Create an old-style archive from a shared archive.
205old_archive_from_new_cmds=""
206
207# Create a temporary old-style archive to link instead of a shared archive.
208old_archive_from_expsyms_cmds=""
209
210# Commands used to build and install a shared archive.
211archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
212archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
213 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
214 \$echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
215 \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
216postinstall_cmds=""
217postuninstall_cmds=""
218
219# Commands used to build a loadable module (assumed same as above if empty)
220module_cmds=""
221module_expsym_cmds=""
222
223# Commands to strip libraries.
224old_striplib="strip --strip-debug"
225striplib="strip --strip-unneeded"
226
227# Dependencies to place before the objects being linked to create a
228# shared library.
229predep_objects=""
230
231# Dependencies to place after the objects being linked to create a
232# shared library.
233postdep_objects=""
234
235# Dependencies to place before the objects being linked to create a
236# shared library.
237predeps=""
238
239# Dependencies to place after the objects being linked to create a
240# shared library.
241postdeps=""
242
243# The library search path used internally by the compiler when linking
244# a shared library.
245compiler_lib_search_path=""
246
247# Method to check whether dependent libraries are shared objects.
248deplibs_check_method="pass_all"
249
250# Command to use when deplibs_check_method == file_magic.
251file_magic_cmd="\$MAGIC_CMD"
252
253# Flag that allows shared libraries with undefined symbols to be built.
254allow_undefined_flag=""
255
256# Flag that forces no undefined symbols.
257no_undefined_flag=""
258
259# Commands used to finish a libtool library installation in a directory.
260finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
261
262# Same as above, but a single script fragment to be evaled but not shown.
263finish_eval=""
264
265# Take the output of nm and produce a listing of raw symbols and C names.
266global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
267
268# Transform the output of nm in a proper C declaration
269global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
270
271# Transform the output of nm in a C name address pair
272global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'"
273
274# This is the shared library runtime path variable.
275runpath_var=LD_RUN_PATH
276
277# This is the shared library path variable.
278shlibpath_var=LD_LIBRARY_PATH
279
280# Is shlibpath searched before the hard-coded library search path?
281shlibpath_overrides_runpath=no
282
283# How to hardcode a shared library path into an executable.
284hardcode_action=immediate
285
286# Whether we should hardcode library paths into libraries.
287hardcode_into_libs=yes
288
289# Flag to hardcode $libdir into a binary during linking.
290# This must work even if $libdir does not exist.
291hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
292
293# If ld is used when linking, flag to hardcode $libdir into
294# a binary during linking. This must work even if $libdir does
295# not exist.
296hardcode_libdir_flag_spec_ld=""
297
298# Whether we need a single -rpath flag with a separated argument.
299hardcode_libdir_separator=""
300
301# Set to yes if using DIR/libNAME during linking hardcodes DIR into the
302# resulting binary.
303hardcode_direct=no
304
305# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
306# resulting binary.
307hardcode_minus_L=no
308
309# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
310# the resulting binary.
311hardcode_shlibpath_var=unsupported
312
313# Set to yes if building a shared library automatically hardcodes DIR into the library
314# and all subsequent libraries and executables linked against it.
315hardcode_automatic=no
316
317# Variables whose values should be saved in libtool wrapper scripts and
318# restored at relink time.
319variables_saved_for_relink="PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
320
321# Whether libtool must link a program against all its dependency libraries.
322link_all_deplibs=unknown
323
324# Compile-time system search path for libraries
325sys_lib_search_path_spec=" /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/ /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/lib/x86_64-unknown-linux-gnu/4.7.0/ /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/lib/../lib/ /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../x86_64-unknown-linux-gnu/4.7.0/ /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../lib/ /lib/x86_64-unknown-linux-gnu/4.7.0/ /lib/../lib/ /usr/lib/x86_64-unknown-linux-gnu/4.7.0/ /usr/lib/../lib/ /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/lib/ /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../ /lib/ /usr/lib/"
326
327# Run-time system search path for libraries
328sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/libfakeroot /usr/lib32 /usr/lib/perl5/core_perl/CORE "
329
330# Fix the shell variable $srcfile for the compiler.
331fix_srcfile_path=""
332
333# Set to yes if exported symbols are required.
334always_export_symbols=no
335
336# The commands to list exported symbols.
337export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
338
339# The commands to extract the exported symbol list from a shared archive.
340extract_expsyms_cmds=""
341
342# Symbols that should not be listed in the preloaded symbols.
343exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
344
345# Symbols that must always be exported.
346include_expsyms=""
347
348# ### END LIBTOOL CONFIG
349
350# ltmain.sh - Provide generalized library-building support services.
351# NOTE: Changing this file will not affect anything until you rerun configure.
352#
353# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
354# Free Software Foundation, Inc.
355# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
356#
357# This program is free software; you can redistribute it and/or modify
358# it under the terms of the GNU General Public License as published by
359# the Free Software Foundation; either version 2 of the License, or
360# (at your option) any later version.
361#
362# This program is distributed in the hope that it will be useful, but
363# WITHOUT ANY WARRANTY; without even the implied warranty of
364# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
365# General Public License for more details.
366#
367# You should have received a copy of the GNU General Public License
368# along with this program; if not, write to the Free Software
369# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
370#
371# As a special exception to the GNU General Public License, if you
372# distribute this file as part of a program that contains a
373# configuration script generated by Autoconf, you may include it under
374# the same distribution terms that you use for the rest of that program.
375
376basename="s,^.*/,,g"
377
378# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
379# is ksh but when the shell is invoked as "sh" and the current value of
380# the _XPG environment variable is not equal to 1 (one), the special
381# positional parameter $0, within a function call, is the name of the
382# function.
383progpath="$0"
384
385# The name of this program:
386progname=`echo "$progpath" | $SED $basename`
387modename="$progname"
388
389# Global variables:
390EXIT_SUCCESS=0
391EXIT_FAILURE=1
392
393PROGRAM=ltmain.sh
394PACKAGE=libtool
395VERSION=1.5.20
396TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)"
397
398# See if we are running on zsh, and set the options which allow our
399# commands through without removal of \ escapes.
400if test -n "${ZSH_VERSION+set}" ; then
401 setopt NO_GLOB_SUBST
402fi
403
404# Check that we have a working $echo.
405if test "X$1" = X--no-reexec; then
406 # Discard the --no-reexec flag, and continue.
407 shift
408elif test "X$1" = X--fallback-echo; then
409 # Avoid inline document here, it may be left over
410 :
411elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
412 # Yippee, $echo works!
413 :
414else
415 # Restart under the correct shell, and then maybe $echo will work.
416 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
417fi
418
419if test "X$1" = X--fallback-echo; then
420 # used as fallback echo
421 shift
422 cat <<EOF
423$*
424EOF
425 exit $EXIT_SUCCESS
426fi
427
428default_mode=
429help="Try \`$progname --help' for more information."
430magic="%%%MAGIC variable%%%"
431mkdir="mkdir"
432mv="mv -f"
433rm="rm -f"
434
435# Sed substitution that helps us do robust quoting. It backslashifies
436# metacharacters that are still active within double-quoted strings.
437Xsed="${SED}"' -e 1s/^X//'
438sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
439# test EBCDIC or ASCII
440case `echo X|tr X '\101'` in
441 A) # ASCII based system
442 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
443 SP2NL='tr \040 \012'
444 NL2SP='tr \015\012 \040\040'
445 ;;
446 *) # EBCDIC based system
447 SP2NL='tr \100 \n'
448 NL2SP='tr \r\n \100\100'
449 ;;
450esac
451
452# NLS nuisances.
453# Only set LANG and LC_ALL to C if already set.
454# These must not be set unconditionally because not all systems understand
455# e.g. LANG=C (notably SCO).
456# We save the old values to restore during execute mode.
457if test "${LC_ALL+set}" = set; then
458 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
459fi
460if test "${LANG+set}" = set; then
461 save_LANG="$LANG"; LANG=C; export LANG
462fi
463
464# Make sure IFS has a sensible default
465lt_nl='
466'
467IFS=" $lt_nl"
468
469if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
470 $echo "$modename: not configured to build any kind of library" 1>&2
471 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
472 exit $EXIT_FAILURE
473fi
474
475# Global variables.
476mode=$default_mode
477nonopt=
478prev=
479prevopt=
480run=
481show="$echo"
482show_help=
483execute_dlfiles=
484lo2o="s/\\.lo\$/.${objext}/"
485o2lo="s/\\.${objext}\$/.lo/"
486
487#####################################
488# Shell function definitions:
489# This seems to be the best place for them
490
491# func_win32_libid arg
492# return the library type of file 'arg'
493#
494# Need a lot of goo to handle *both* DLLs and import libs
495# Has to be a shell function in order to 'eat' the argument
496# that is supplied when $file_magic_command is called.
497func_win32_libid ()
498{
499 win32_libid_type="unknown"
500 win32_fileres=`file -L $1 2>/dev/null`
501 case $win32_fileres in
502 *ar\ archive\ import\ library*) # definitely import
503 win32_libid_type="x86 archive import"
504 ;;
505 *ar\ archive*) # could be an import, or static
506 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
507 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
508 win32_nmres=`eval $NM -f posix -A $1 | \
509 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
510 if test "X$win32_nmres" = "Ximport" ; then
511 win32_libid_type="x86 archive import"
512 else
513 win32_libid_type="x86 archive static"
514 fi
515 fi
516 ;;
517 *DLL*)
518 win32_libid_type="x86 DLL"
519 ;;
520 *executable*) # but shell scripts are "executable" too...
521 case $win32_fileres in
522 *MS\ Windows\ PE\ Intel*)
523 win32_libid_type="x86 DLL"
524 ;;
525 esac
526 ;;
527 esac
528 $echo $win32_libid_type
529}
530
531
532# func_infer_tag arg
533# Infer tagged configuration to use if any are available and
534# if one wasn't chosen via the "--tag" command line option.
535# Only attempt this if the compiler in the base compile
536# command doesn't match the default compiler.
537# arg is usually of the form 'gcc ...'
538func_infer_tag ()
539{
540 if test -n "$available_tags" && test -z "$tagname"; then
541 CC_quoted=
542 for arg in $CC; do
543 case $arg in
544 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
545 arg="\"$arg\""
546 ;;
547 esac
548 CC_quoted="$CC_quoted $arg"
549 done
550 case $@ in
551 # Blanks in the command may have been stripped by the calling shell,
552 # but not from the CC environment variable when configure was run.
553 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
554 # Blanks at the start of $base_compile will cause this to fail
555 # if we don't check for them as well.
556 *)
557 for z in $available_tags; do
558 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
559 # Evaluate the configuration.
560 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
561 CC_quoted=
562 for arg in $CC; do
563 # Double-quote args containing other shell metacharacters.
564 case $arg in
565 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
566 arg="\"$arg\""
567 ;;
568 esac
569 CC_quoted="$CC_quoted $arg"
570 done
571 case "$@ " in
572 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
573 # The compiler in the base compile command matches
574 # the one in the tagged configuration.
575 # Assume this is the tagged configuration we want.
576 tagname=$z
577 break
578 ;;
579 esac
580 fi
581 done
582 # If $tagname still isn't set, then no tagged configuration
583 # was found and let the user know that the "--tag" command
584 # line option must be used.
585 if test -z "$tagname"; then
586 $echo "$modename: unable to infer tagged configuration"
587 $echo "$modename: specify a tag with \`--tag'" 1>&2
588 exit $EXIT_FAILURE
589# else
590# $echo "$modename: using $tagname tagged configuration"
591 fi
592 ;;
593 esac
594 fi
595}
596
597
598# func_extract_an_archive dir oldlib
599func_extract_an_archive ()
600{
601 f_ex_an_ar_dir="$1"; shift
602 f_ex_an_ar_oldlib="$1"
603
604 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
605 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
606 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
607 :
608 else
609 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
610 exit $EXIT_FAILURE
611 fi
612}
613
614# func_extract_archives gentop oldlib ...
615func_extract_archives ()
616{
617 my_gentop="$1"; shift
618 my_oldlibs=${1+"$@"}
619 my_oldobjs=""
620 my_xlib=""
621 my_xabs=""
622 my_xdir=""
623 my_status=""
624
625 $show "${rm}r $my_gentop"
626 $run ${rm}r "$my_gentop"
627 $show "$mkdir $my_gentop"
628 $run $mkdir "$my_gentop"
629 my_status=$?
630 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
631 exit $my_status
632 fi
633
634 for my_xlib in $my_oldlibs; do
635 # Extract the objects.
636 case $my_xlib in
637 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
638 *) my_xabs=`pwd`"/$my_xlib" ;;
639 esac
640 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
641 my_xdir="$my_gentop/$my_xlib"
642
643 $show "${rm}r $my_xdir"
644 $run ${rm}r "$my_xdir"
645 $show "$mkdir $my_xdir"
646 $run $mkdir "$my_xdir"
647 status=$?
648 if test "$status" -ne 0 && test ! -d "$my_xdir"; then
649 exit $status
650 fi
651 case $host in
652 *-darwin*)
653 $show "Extracting $my_xabs"
654 # Do not bother doing anything if just a dry run
655 if test -z "$run"; then
656 darwin_orig_dir=`pwd`
657 cd $my_xdir || exit $?
658 darwin_archive=$my_xabs
659 darwin_curdir=`pwd`
660 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
661 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
662 if test -n "$darwin_arches"; then
663 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
664 darwin_arch=
665 $show "$darwin_base_archive has multiple architectures $darwin_arches"
666 for darwin_arch in $darwin_arches ; do
667 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
668 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
669 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
670 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
671 cd "$darwin_curdir"
672 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
673 done # $darwin_arches
674 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
675 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
676 darwin_file=
677 darwin_files=
678 for darwin_file in $darwin_filelist; do
679 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
680 lipo -create -output "$darwin_file" $darwin_files
681 done # $darwin_filelist
682 ${rm}r unfat-$$
683 cd "$darwin_orig_dir"
684 else
685 cd "$darwin_orig_dir"
686 func_extract_an_archive "$my_xdir" "$my_xabs"
687 fi # $darwin_arches
688 fi # $run
689 ;;
690 *)
691 func_extract_an_archive "$my_xdir" "$my_xabs"
692 ;;
693 esac
694 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
695 done
696 func_extract_archives_result="$my_oldobjs"
697}
698# End of Shell function definitions
699#####################################
700
701# Darwin sucks
702eval std_shrext=\"$shrext_cmds\"
703
704# Parse our command line options once, thoroughly.
705while test "$#" -gt 0
706do
707 arg="$1"
708 shift
709
710 case $arg in
711 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
712 *) optarg= ;;
713 esac
714
715 # If the previous option needs an argument, assign it.
716 if test -n "$prev"; then
717 case $prev in
718 execute_dlfiles)
719 execute_dlfiles="$execute_dlfiles $arg"
720 ;;
721 tag)
722 tagname="$arg"
723 preserve_args="${preserve_args}=$arg"
724
725 # Check whether tagname contains only valid characters
726 case $tagname in
727 *[!-_A-Za-z0-9,/]*)
728 $echo "$progname: invalid tag name: $tagname" 1>&2
729 exit $EXIT_FAILURE
730 ;;
731 esac
732
733 case $tagname in
734 CC)
735 # Don't test for the "default" C tag, as we know, it's there, but
736 # not specially marked.
737 ;;
738 *)
739 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
740 taglist="$taglist $tagname"
741 # Evaluate the configuration.
742 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
743 else
744 $echo "$progname: ignoring unknown tag $tagname" 1>&2
745 fi
746 ;;
747 esac
748 ;;
749 *)
750 eval "$prev=\$arg"
751 ;;
752 esac
753
754 prev=
755 prevopt=
756 continue
757 fi
758
759 # Have we seen a non-optional argument yet?
760 case $arg in
761 --help)
762 show_help=yes
763 ;;
764
765 --version)
766 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
767 $echo
768 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
769 $echo "This is free software; see the source for copying conditions. There is NO"
770 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
771 exit $?
772 ;;
773
774 --config)
775 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
776 # Now print the configurations for the tags.
777 for tagname in $taglist; do
778 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
779 done
780 exit $?
781 ;;
782
783 --debug)
784 $echo "$progname: enabling shell trace mode"
785 set -x
786 preserve_args="$preserve_args $arg"
787 ;;
788
789 --dry-run | -n)
790 run=:
791 ;;
792
793 --features)
794 $echo "host: $host"
795 if test "$build_libtool_libs" = yes; then
796 $echo "enable shared libraries"
797 else
798 $echo "disable shared libraries"
799 fi
800 if test "$build_old_libs" = yes; then
801 $echo "enable static libraries"
802 else
803 $echo "disable static libraries"
804 fi
805 exit $?
806 ;;
807
808 --finish) mode="finish" ;;
809
810 --mode) prevopt="--mode" prev=mode ;;
811 --mode=*) mode="$optarg" ;;
812
813 --preserve-dup-deps) duplicate_deps="yes" ;;
814
815 --quiet | --silent)
816 show=:
817 preserve_args="$preserve_args $arg"
818 ;;
819
820 --tag) prevopt="--tag" prev=tag ;;
821 --tag=*)
822 set tag "$optarg" ${1+"$@"}
823 shift
824 prev=tag
825 preserve_args="$preserve_args --tag"
826 ;;
827
828 -dlopen)
829 prevopt="-dlopen"
830 prev=execute_dlfiles
831 ;;
832
833 -*)
834 $echo "$modename: unrecognized option \`$arg'" 1>&2
835 $echo "$help" 1>&2
836 exit $EXIT_FAILURE
837 ;;
838
839 *)
840 nonopt="$arg"
841 break
842 ;;
843 esac
844done
845
846if test -n "$prevopt"; then
847 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
848 $echo "$help" 1>&2
849 exit $EXIT_FAILURE
850fi
851
852# If this variable is set in any of the actions, the command in it
853# will be execed at the end. This prevents here-documents from being
854# left over by shells.
855exec_cmd=
856
857if test -z "$show_help"; then
858
859 # Infer the operation mode.
860 if test -z "$mode"; then
861 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
862 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
863 case $nonopt in
864 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
865 mode=link
866 for arg
867 do
868 case $arg in
869 -c)
870 mode=compile
871 break
872 ;;
873 esac
874 done
875 ;;
876 *db | *dbx | *strace | *truss)
877 mode=execute
878 ;;
879 *install*|cp|mv)
880 mode=install
881 ;;
882 *rm)
883 mode=uninstall
884 ;;
885 *)
886 # If we have no mode, but dlfiles were specified, then do execute mode.
887 test -n "$execute_dlfiles" && mode=execute
888
889 # Just use the default operation mode.
890 if test -z "$mode"; then
891 if test -n "$nonopt"; then
892 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
893 else
894 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
895 fi
896 fi
897 ;;
898 esac
899 fi
900
901 # Only execute mode is allowed to have -dlopen flags.
902 if test -n "$execute_dlfiles" && test "$mode" != execute; then
903 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
904 $echo "$help" 1>&2
905 exit $EXIT_FAILURE
906 fi
907
908 # Change the help message to a mode-specific one.
909 generic_help="$help"
910 help="Try \`$modename --help --mode=$mode' for more information."
911
912 # These modes are in order of execution frequency so that they run quickly.
913 case $mode in
914 # libtool compile mode
915 compile)
916 modename="$modename: compile"
917 # Get the compilation command and the source file.
918 base_compile=
919 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
920 suppress_opt=yes
921 suppress_output=
922 arg_mode=normal
923 libobj=
924 later=
925
926 for arg
927 do
928 case $arg_mode in
929 arg )
930 # do not "continue". Instead, add this to base_compile
931 lastarg="$arg"
932 arg_mode=normal
933 ;;
934
935 target )
936 libobj="$arg"
937 arg_mode=normal
938 continue
939 ;;
940
941 normal )
942 # Accept any command-line options.
943 case $arg in
944 -o)
945 if test -n "$libobj" ; then
946 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
947 exit $EXIT_FAILURE
948 fi
949 arg_mode=target
950 continue
951 ;;
952
953 -static | -prefer-pic | -prefer-non-pic)
954 later="$later $arg"
955 continue
956 ;;
957
958 -no-suppress)
959 suppress_opt=no
960 continue
961 ;;
962
963 -Xcompiler)
964 arg_mode=arg # the next one goes into the "base_compile" arg list
965 continue # The current "srcfile" will either be retained or
966 ;; # replaced later. I would guess that would be a bug.
967
968 -Wc,*)
969 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
970 lastarg=
971 save_ifs="$IFS"; IFS=','
972 for arg in $args; do
973 IFS="$save_ifs"
974
975 # Double-quote args containing other shell metacharacters.
976 # Many Bourne shells cannot handle close brackets correctly
977 # in scan sets, so we specify it separately.
978 case $arg in
979 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
980 arg="\"$arg\""
981 ;;
982 esac
983 lastarg="$lastarg $arg"
984 done
985 IFS="$save_ifs"
986 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
987
988 # Add the arguments to base_compile.
989 base_compile="$base_compile $lastarg"
990 continue
991 ;;
992
993 * )
994 # Accept the current argument as the source file.
995 # The previous "srcfile" becomes the current argument.
996 #
997 lastarg="$srcfile"
998 srcfile="$arg"
999 ;;
1000 esac # case $arg
1001 ;;
1002 esac # case $arg_mode
1003
1004 # Aesthetically quote the previous argument.
1005 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
1006
1007 case $lastarg in
1008 # Double-quote args containing other shell metacharacters.
1009 # Many Bourne shells cannot handle close brackets correctly
1010 # in scan sets, and some SunOS ksh mistreat backslash-escaping
1011 # in scan sets (worked around with variable expansion),
1012 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
1013 # at all, so we specify them separately.
1014 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1015 lastarg="\"$lastarg\""
1016 ;;
1017 esac
1018
1019 base_compile="$base_compile $lastarg"
1020 done # for arg
1021
1022 case $arg_mode in
1023 arg)
1024 $echo "$modename: you must specify an argument for -Xcompile"
1025 exit $EXIT_FAILURE
1026 ;;
1027 target)
1028 $echo "$modename: you must specify a target with \`-o'" 1>&2
1029 exit $EXIT_FAILURE
1030 ;;
1031 *)
1032 # Get the name of the library object.
1033 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
1034 ;;
1035 esac
1036
1037 # Recognize several different file suffixes.
1038 # If the user specifies -o file.o, it is replaced with file.lo
1039 xform='[cCFSifmso]'
1040 case $libobj in
1041 *.ada) xform=ada ;;
1042 *.adb) xform=adb ;;
1043 *.ads) xform=ads ;;
1044 *.asm) xform=asm ;;
1045 *.c++) xform=c++ ;;
1046 *.cc) xform=cc ;;
1047 *.ii) xform=ii ;;
1048 *.class) xform=class ;;
1049 *.cpp) xform=cpp ;;
1050 *.cxx) xform=cxx ;;
1051 *.f90) xform=f90 ;;
1052 *.for) xform=for ;;
1053 *.java) xform=java ;;
1054 esac
1055
1056 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
1057
1058 case $libobj in
1059 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
1060 *)
1061 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
1062 exit $EXIT_FAILURE
1063 ;;
1064 esac
1065
1066 func_infer_tag $base_compile
1067
1068 for arg in $later; do
1069 case $arg in
1070 -static)
1071 build_old_libs=yes
1072 continue
1073 ;;
1074
1075 -prefer-pic)
1076 pic_mode=yes
1077 continue
1078 ;;
1079
1080 -prefer-non-pic)
1081 pic_mode=no
1082 continue
1083 ;;
1084 esac
1085 done
1086
1087 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
1088 case $qlibobj in
1089 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1090 qlibobj="\"$qlibobj\"" ;;
1091 esac
1092 test "X$libobj" != "X$qlibobj" \
1093 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
1094 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
1095 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
1096 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
1097 if test "X$xdir" = "X$obj"; then
1098 xdir=
1099 else
1100 xdir=$xdir/
1101 fi
1102 lobj=${xdir}$objdir/$objname
1103
1104 if test -z "$base_compile"; then
1105 $echo "$modename: you must specify a compilation command" 1>&2
1106 $echo "$help" 1>&2
1107 exit $EXIT_FAILURE
1108 fi
1109
1110 # Delete any leftover library objects.
1111 if test "$build_old_libs" = yes; then
1112 removelist="$obj $lobj $libobj ${libobj}T"
1113 else
1114 removelist="$lobj $libobj ${libobj}T"
1115 fi
1116
1117 $run $rm $removelist
1118 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
1119
1120 # On Cygwin there's no "real" PIC flag so we must build both object types
1121 case $host_os in
1122 cygwin* | mingw* | pw32* | os2*)
1123 pic_mode=default
1124 ;;
1125 esac
1126 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1127 # non-PIC code in shared libraries is not supported
1128 pic_mode=default
1129 fi
1130
1131 # Calculate the filename of the output object if compiler does
1132 # not support -o with -c
1133 if test "$compiler_c_o" = no; then
1134 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1135 lockfile="$output_obj.lock"
1136 removelist="$removelist $output_obj $lockfile"
1137 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
1138 else
1139 output_obj=
1140 need_locks=no
1141 lockfile=
1142 fi
1143
1144 # Lock this critical section if it is needed
1145 # We use this script file to make the link, it avoids creating a new file
1146 if test "$need_locks" = yes; then
1147 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
1148 $show "Waiting for $lockfile to be removed"
1149 sleep 2
1150 done
1151 elif test "$need_locks" = warn; then
1152 if test -f "$lockfile"; then
1153 $echo "\
1154*** ERROR, $lockfile exists and contains:
1155`cat $lockfile 2>/dev/null`
1156
1157This indicates that another process is trying to use the same
1158temporary object file, and libtool could not work around it because
1159your compiler does not support \`-c' and \`-o' together. If you
1160repeat this compilation, it may succeed, by chance, but you had better
1161avoid parallel builds (make -j) in this platform, or get a better
1162compiler."
1163
1164 $run $rm $removelist
1165 exit $EXIT_FAILURE
1166 fi
1167 $echo "$srcfile" > "$lockfile"
1168 fi
1169
1170 if test -n "$fix_srcfile_path"; then
1171 eval srcfile=\"$fix_srcfile_path\"
1172 fi
1173 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
1174 case $qsrcfile in
1175 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1176 qsrcfile="\"$qsrcfile\"" ;;
1177 esac
1178
1179 $run $rm "$libobj" "${libobj}T"
1180
1181 # Create a libtool object file (analogous to a ".la" file),
1182 # but don't create it if we're doing a dry run.
1183 test -z "$run" && cat > ${libobj}T <<EOF
1184# $libobj - a libtool object file
1185# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
1186#
1187# Please DO NOT delete this file!
1188# It is necessary for linking the library.
1189
1190# Name of the PIC object.
1191EOF
1192
1193 # Only build a PIC object if we are building libtool libraries.
1194 if test "$build_libtool_libs" = yes; then
1195 # Without this assignment, base_compile gets emptied.
1196 fbsd_hideous_sh_bug=$base_compile
1197
1198 if test "$pic_mode" != no; then
1199 command="$base_compile $qsrcfile $pic_flag"
1200 else
1201 # Don't build PIC code
1202 command="$base_compile $qsrcfile"
1203 fi
1204
1205 if test ! -d "${xdir}$objdir"; then
1206 $show "$mkdir ${xdir}$objdir"
1207 $run $mkdir ${xdir}$objdir
1208 status=$?
1209 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
1210 exit $status
1211 fi
1212 fi
1213
1214 if test -z "$output_obj"; then
1215 # Place PIC objects in $objdir
1216 command="$command -o $lobj"
1217 fi
1218
1219 $run $rm "$lobj" "$output_obj"
1220
1221 $show "$command"
1222 if $run eval "$command"; then :
1223 else
1224 test -n "$output_obj" && $run $rm $removelist
1225 exit $EXIT_FAILURE
1226 fi
1227
1228 if test "$need_locks" = warn &&
1229 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1230 $echo "\
1231*** ERROR, $lockfile contains:
1232`cat $lockfile 2>/dev/null`
1233
1234but it should contain:
1235$srcfile
1236
1237This indicates that another process is trying to use the same
1238temporary object file, and libtool could not work around it because
1239your compiler does not support \`-c' and \`-o' together. If you
1240repeat this compilation, it may succeed, by chance, but you had better
1241avoid parallel builds (make -j) in this platform, or get a better
1242compiler."
1243
1244 $run $rm $removelist
1245 exit $EXIT_FAILURE
1246 fi
1247
1248 # Just move the object if needed, then go on to compile the next one
1249 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1250 $show "$mv $output_obj $lobj"
1251 if $run $mv $output_obj $lobj; then :
1252 else
1253 error=$?
1254 $run $rm $removelist
1255 exit $error
1256 fi
1257 fi
1258
1259 # Append the name of the PIC object to the libtool object file.
1260 test -z "$run" && cat >> ${libobj}T <<EOF
1261pic_object='$objdir/$objname'
1262
1263EOF
1264
1265 # Allow error messages only from the first compilation.
1266 if test "$suppress_opt" = yes; then
1267 suppress_output=' >/dev/null 2>&1'
1268 fi
1269 else
1270 # No PIC object so indicate it doesn't exist in the libtool
1271 # object file.
1272 test -z "$run" && cat >> ${libobj}T <<EOF
1273pic_object=none
1274
1275EOF
1276 fi
1277
1278 # Only build a position-dependent object if we build old libraries.
1279 if test "$build_old_libs" = yes; then
1280 if test "$pic_mode" != yes; then
1281 # Don't build PIC code
1282 command="$base_compile $qsrcfile"
1283 else
1284 command="$base_compile $qsrcfile $pic_flag"
1285 fi
1286 if test "$compiler_c_o" = yes; then
1287 command="$command -o $obj"
1288 fi
1289
1290 # Suppress compiler output if we already did a PIC compilation.
1291 command="$command$suppress_output"
1292 $run $rm "$obj" "$output_obj"
1293 $show "$command"
1294 if $run eval "$command"; then :
1295 else
1296 $run $rm $removelist
1297 exit $EXIT_FAILURE
1298 fi
1299
1300 if test "$need_locks" = warn &&
1301 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1302 $echo "\
1303*** ERROR, $lockfile contains:
1304`cat $lockfile 2>/dev/null`
1305
1306but it should contain:
1307$srcfile
1308
1309This indicates that another process is trying to use the same
1310temporary object file, and libtool could not work around it because
1311your compiler does not support \`-c' and \`-o' together. If you
1312repeat this compilation, it may succeed, by chance, but you had better
1313avoid parallel builds (make -j) in this platform, or get a better
1314compiler."
1315
1316 $run $rm $removelist
1317 exit $EXIT_FAILURE
1318 fi
1319
1320 # Just move the object if needed
1321 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1322 $show "$mv $output_obj $obj"
1323 if $run $mv $output_obj $obj; then :
1324 else
1325 error=$?
1326 $run $rm $removelist
1327 exit $error
1328 fi
1329 fi
1330
1331 # Append the name of the non-PIC object the libtool object file.
1332 # Only append if the libtool object file exists.
1333 test -z "$run" && cat >> ${libobj}T <<EOF
1334# Name of the non-PIC object.
1335non_pic_object='$objname'
1336
1337EOF
1338 else
1339 # Append the name of the non-PIC object the libtool object file.
1340 # Only append if the libtool object file exists.
1341 test -z "$run" && cat >> ${libobj}T <<EOF
1342# Name of the non-PIC object.
1343non_pic_object=none
1344
1345EOF
1346 fi
1347
1348 $run $mv "${libobj}T" "${libobj}"
1349
1350 # Unlock the critical section if it was locked
1351 if test "$need_locks" != no; then
1352 $run $rm "$lockfile"
1353 fi
1354
1355 exit $EXIT_SUCCESS
1356 ;;
1357
1358 # libtool link mode
1359 link | relink)
1360 modename="$modename: link"
1361 case $host in
1362 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1363 # It is impossible to link a dll without this setting, and
1364 # we shouldn't force the makefile maintainer to figure out
1365 # which system we are compiling for in order to pass an extra
1366 # flag for every libtool invocation.
1367 # allow_undefined=no
1368
1369 # FIXME: Unfortunately, there are problems with the above when trying
1370 # to make a dll which has undefined symbols, in which case not
1371 # even a static library is built. For now, we need to specify
1372 # -no-undefined on the libtool link line when we can be certain
1373 # that all symbols are satisfied, otherwise we get a static library.
1374 allow_undefined=yes
1375 ;;
1376 *)
1377 allow_undefined=yes
1378 ;;
1379 esac
1380 libtool_args="$nonopt"
1381 base_compile="$nonopt $@"
1382 compile_command="$nonopt"
1383 finalize_command="$nonopt"
1384
1385 compile_rpath=
1386 finalize_rpath=
1387 compile_shlibpath=
1388 finalize_shlibpath=
1389 convenience=
1390 old_convenience=
1391 deplibs=
1392 old_deplibs=
1393 compiler_flags=
1394 linker_flags=
1395 dllsearchpath=
1396 lib_search_path=`pwd`
1397 inst_prefix_dir=
1398
1399 avoid_version=no
1400 dlfiles=
1401 dlprefiles=
1402 dlself=no
1403 export_dynamic=no
1404 export_symbols=
1405 export_symbols_regex=
1406 generated=
1407 libobjs=
1408 ltlibs=
1409 module=no
1410 no_install=no
1411 objs=
1412 non_pic_objects=
1413 precious_files_regex=
1414 prefer_static_libs=no
1415 preload=no
1416 prev=
1417 prevarg=
1418 release=
1419 rpath=
1420 xrpath=
1421 perm_rpath=
1422 temp_rpath=
1423 thread_safe=no
1424 vinfo=
1425 vinfo_number=no
1426
1427 func_infer_tag $base_compile
1428
1429 # We need to know -static, to get the right output filenames.
1430 for arg
1431 do
1432 case $arg in
1433 -all-static | -static)
1434 if test "X$arg" = "X-all-static"; then
1435 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1436 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1437 fi
1438 if test -n "$link_static_flag"; then
1439 dlopen_self=$dlopen_self_static
1440 fi
1441 else
1442 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1443 dlopen_self=$dlopen_self_static
1444 fi
1445 fi
1446 build_libtool_libs=no
1447 build_old_libs=yes
1448 prefer_static_libs=yes
1449 break
1450 ;;
1451 esac
1452 done
1453
1454 # See if our shared archives depend on static archives.
1455 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1456
1457 # Go through the arguments, transforming them on the way.
1458 while test "$#" -gt 0; do
1459 arg="$1"
1460 shift
1461 case $arg in
1462 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1463 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1464 ;;
1465 *) qarg=$arg ;;
1466 esac
1467 libtool_args="$libtool_args $qarg"
1468
1469 # If the previous option needs an argument, assign it.
1470 if test -n "$prev"; then
1471 case $prev in
1472 output)
1473 compile_command="$compile_command @OUTPUT@"
1474 finalize_command="$finalize_command @OUTPUT@"
1475 ;;
1476 esac
1477
1478 case $prev in
1479 dlfiles|dlprefiles)
1480 if test "$preload" = no; then
1481 # Add the symbol object into the linking commands.
1482 compile_command="$compile_command @SYMFILE@"
1483 finalize_command="$finalize_command @SYMFILE@"
1484 preload=yes
1485 fi
1486 case $arg in
1487 *.la | *.lo) ;; # We handle these cases below.
1488 force)
1489 if test "$dlself" = no; then
1490 dlself=needless
1491 export_dynamic=yes
1492 fi
1493 prev=
1494 continue
1495 ;;
1496 self)
1497 if test "$prev" = dlprefiles; then
1498 dlself=yes
1499 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1500 dlself=yes
1501 else
1502 dlself=needless
1503 export_dynamic=yes
1504 fi
1505 prev=
1506 continue
1507 ;;
1508 *)
1509 if test "$prev" = dlfiles; then
1510 dlfiles="$dlfiles $arg"
1511 else
1512 dlprefiles="$dlprefiles $arg"
1513 fi
1514 prev=
1515 continue
1516 ;;
1517 esac
1518 ;;
1519 expsyms)
1520 export_symbols="$arg"
1521 if test ! -f "$arg"; then
1522 $echo "$modename: symbol file \`$arg' does not exist"
1523 exit $EXIT_FAILURE
1524 fi
1525 prev=
1526 continue
1527 ;;
1528 expsyms_regex)
1529 export_symbols_regex="$arg"
1530 prev=
1531 continue
1532 ;;
1533 inst_prefix)
1534 inst_prefix_dir="$arg"
1535 prev=
1536 continue
1537 ;;
1538 precious_regex)
1539 precious_files_regex="$arg"
1540 prev=
1541 continue
1542 ;;
1543 release)
1544 release="-$arg"
1545 prev=
1546 continue
1547 ;;
1548 objectlist)
1549 if test -f "$arg"; then
1550 save_arg=$arg
1551 moreargs=
1552 for fil in `cat $save_arg`
1553 do
1554# moreargs="$moreargs $fil"
1555 arg=$fil
1556 # A libtool-controlled object.
1557
1558 # Check to see that this really is a libtool object.
1559 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1560 pic_object=
1561 non_pic_object=
1562
1563 # Read the .lo file
1564 # If there is no directory component, then add one.
1565 case $arg in
1566 */* | *\\*) . $arg ;;
1567 *) . ./$arg ;;
1568 esac
1569
1570 if test -z "$pic_object" || \
1571 test -z "$non_pic_object" ||
1572 test "$pic_object" = none && \
1573 test "$non_pic_object" = none; then
1574 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1575 exit $EXIT_FAILURE
1576 fi
1577
1578 # Extract subdirectory from the argument.
1579 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1580 if test "X$xdir" = "X$arg"; then
1581 xdir=
1582 else
1583 xdir="$xdir/"
1584 fi
1585
1586 if test "$pic_object" != none; then
1587 # Prepend the subdirectory the object is found in.
1588 pic_object="$xdir$pic_object"
1589
1590 if test "$prev" = dlfiles; then
1591 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1592 dlfiles="$dlfiles $pic_object"
1593 prev=
1594 continue
1595 else
1596 # If libtool objects are unsupported, then we need to preload.
1597 prev=dlprefiles
1598 fi
1599 fi
1600
1601 # CHECK ME: I think I busted this. -Ossama
1602 if test "$prev" = dlprefiles; then
1603 # Preload the old-style object.
1604 dlprefiles="$dlprefiles $pic_object"
1605 prev=
1606 fi
1607
1608 # A PIC object.
1609 libobjs="$libobjs $pic_object"
1610 arg="$pic_object"
1611 fi
1612
1613 # Non-PIC object.
1614 if test "$non_pic_object" != none; then
1615 # Prepend the subdirectory the object is found in.
1616 non_pic_object="$xdir$non_pic_object"
1617
1618 # A standard non-PIC object
1619 non_pic_objects="$non_pic_objects $non_pic_object"
1620 if test -z "$pic_object" || test "$pic_object" = none ; then
1621 arg="$non_pic_object"
1622 fi
1623 fi
1624 else
1625 # Only an error if not doing a dry-run.
1626 if test -z "$run"; then
1627 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1628 exit $EXIT_FAILURE
1629 else
1630 # Dry-run case.
1631
1632 # Extract subdirectory from the argument.
1633 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1634 if test "X$xdir" = "X$arg"; then
1635 xdir=
1636 else
1637 xdir="$xdir/"
1638 fi
1639
1640 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1641 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1642 libobjs="$libobjs $pic_object"
1643 non_pic_objects="$non_pic_objects $non_pic_object"
1644 fi
1645 fi
1646 done
1647 else
1648 $echo "$modename: link input file \`$save_arg' does not exist"
1649 exit $EXIT_FAILURE
1650 fi
1651 arg=$save_arg
1652 prev=
1653 continue
1654 ;;
1655 rpath | xrpath)
1656 # We need an absolute path.
1657 case $arg in
1658 [\\/]* | [A-Za-z]:[\\/]*) ;;
1659 *)
1660 $echo "$modename: only absolute run-paths are allowed" 1>&2
1661 exit $EXIT_FAILURE
1662 ;;
1663 esac
1664 if test "$prev" = rpath; then
1665 case "$rpath " in
1666 *" $arg "*) ;;
1667 *) rpath="$rpath $arg" ;;
1668 esac
1669 else
1670 case "$xrpath " in
1671 *" $arg "*) ;;
1672 *) xrpath="$xrpath $arg" ;;
1673 esac
1674 fi
1675 prev=
1676 continue
1677 ;;
1678 xcompiler)
1679 compiler_flags="$compiler_flags $qarg"
1680 prev=
1681 compile_command="$compile_command $qarg"
1682 finalize_command="$finalize_command $qarg"
1683 continue
1684 ;;
1685 xlinker)
1686 linker_flags="$linker_flags $qarg"
1687 compiler_flags="$compiler_flags $wl$qarg"
1688 prev=
1689 compile_command="$compile_command $wl$qarg"
1690 finalize_command="$finalize_command $wl$qarg"
1691 continue
1692 ;;
1693 xcclinker)
1694 linker_flags="$linker_flags $qarg"
1695 compiler_flags="$compiler_flags $qarg"
1696 prev=
1697 compile_command="$compile_command $qarg"
1698 finalize_command="$finalize_command $qarg"
1699 continue
1700 ;;
1701 shrext)
1702 shrext_cmds="$arg"
1703 prev=
1704 continue
1705 ;;
1706 darwin_framework)
1707 compiler_flags="$compiler_flags $arg"
1708 compile_command="$compile_command $arg"
1709 finalize_command="$finalize_command $arg"
1710 prev=
1711 continue
1712 ;;
1713 *)
1714 eval "$prev=\"\$arg\""
1715 prev=
1716 continue
1717 ;;
1718 esac
1719 fi # test -n "$prev"
1720
1721 prevarg="$arg"
1722
1723 case $arg in
1724 -all-static)
1725 if test -n "$link_static_flag"; then
1726 compile_command="$compile_command $link_static_flag"
1727 finalize_command="$finalize_command $link_static_flag"
1728 fi
1729 continue
1730 ;;
1731
1732 -allow-undefined)
1733 # FIXME: remove this flag sometime in the future.
1734 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1735 continue
1736 ;;
1737
1738 -avoid-version)
1739 avoid_version=yes
1740 continue
1741 ;;
1742
1743 -dlopen)
1744 prev=dlfiles
1745 continue
1746 ;;
1747
1748 -dlpreopen)
1749 prev=dlprefiles
1750 continue
1751 ;;
1752
1753 -export-dynamic)
1754 export_dynamic=yes
1755 continue
1756 ;;
1757
1758 -export-symbols | -export-symbols-regex)
1759 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1760 $echo "$modename: more than one -exported-symbols argument is not allowed"
1761 exit $EXIT_FAILURE
1762 fi
1763 if test "X$arg" = "X-export-symbols"; then
1764 prev=expsyms
1765 else
1766 prev=expsyms_regex
1767 fi
1768 continue
1769 ;;
1770
1771 -framework|-arch)
1772 prev=darwin_framework
1773 compiler_flags="$compiler_flags $arg"
1774 compile_command="$compile_command $arg"
1775 finalize_command="$finalize_command $arg"
1776 continue
1777 ;;
1778
1779 -inst-prefix-dir)
1780 prev=inst_prefix
1781 continue
1782 ;;
1783
1784 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1785 # so, if we see these flags be careful not to treat them like -L
1786 -L[A-Z][A-Z]*:*)
1787 case $with_gcc/$host in
1788 no/*-*-irix* | /*-*-irix*)
1789 compile_command="$compile_command $arg"
1790 finalize_command="$finalize_command $arg"
1791 ;;
1792 esac
1793 continue
1794 ;;
1795
1796 -L*)
1797 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1798 # We need an absolute path.
1799 case $dir in
1800 [\\/]* | [A-Za-z]:[\\/]*) ;;
1801 *)
1802 absdir=`cd "$dir" && pwd`
1803 if test -z "$absdir"; then
1804 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1805 exit $EXIT_FAILURE
1806 fi
1807 dir="$absdir"
1808 ;;
1809 esac
1810 case "$deplibs " in
1811 *" -L$dir "*) ;;
1812 *)
1813 deplibs="$deplibs -L$dir"
1814 lib_search_path="$lib_search_path $dir"
1815 ;;
1816 esac
1817 case $host in
1818 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1819 case :$dllsearchpath: in
1820 *":$dir:"*) ;;
1821 *) dllsearchpath="$dllsearchpath:$dir";;
1822 esac
1823 ;;
1824 esac
1825 continue
1826 ;;
1827
1828 -l*)
1829 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1830 case $host in
1831 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1832 # These systems don't actually have a C or math library (as such)
1833 continue
1834 ;;
1835 *-*-mingw* | *-*-os2*)
1836 # These systems don't actually have a C library (as such)
1837 test "X$arg" = "X-lc" && continue
1838 ;;
1839 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1840 # Do not include libc due to us having libc/libc_r.
1841 test "X$arg" = "X-lc" && continue
1842 ;;
1843 *-*-rhapsody* | *-*-darwin1.[012])
1844 # Rhapsody C and math libraries are in the System framework
1845 deplibs="$deplibs -framework System"
1846 continue
1847 esac
1848 elif test "X$arg" = "X-lc_r"; then
1849 case $host in
1850 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1851 # Do not include libc_r directly, use -pthread flag.
1852 continue
1853 ;;
1854 esac
1855 fi
1856 deplibs="$deplibs $arg"
1857 continue
1858 ;;
1859
1860 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1861 # classes, name mangling, and exception handling.
1862 -model)
1863 compile_command="$compile_command $arg"
1864 compiler_flags="$compiler_flags $arg"
1865 finalize_command="$finalize_command $arg"
1866 prev=xcompiler
1867 continue
1868 ;;
1869
1870 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1871 compiler_flags="$compiler_flags $arg"
1872 compile_command="$compile_command $arg"
1873 finalize_command="$finalize_command $arg"
1874 continue
1875 ;;
1876
1877 -module)
1878 module=yes
1879 continue
1880 ;;
1881
1882 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1883 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1884 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1885 # +DA*, +DD* enable 64-bit mode on the HP compiler
1886 # -q* pass through compiler args for the IBM compiler
1887 # -m* pass through architecture-specific compiler args for GCC
1888 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
1889
1890 # Unknown arguments in both finalize_command and compile_command need
1891 # to be aesthetically quoted because they are evaled later.
1892 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1893 case $arg in
1894 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1895 arg="\"$arg\""
1896 ;;
1897 esac
1898 compile_command="$compile_command $arg"
1899 finalize_command="$finalize_command $arg"
1900 if test "$with_gcc" = "yes" ; then
1901 compiler_flags="$compiler_flags $arg"
1902 fi
1903 continue
1904 ;;
1905
1906 -shrext)
1907 prev=shrext
1908 continue
1909 ;;
1910
1911 -no-fast-install)
1912 fast_install=no
1913 continue
1914 ;;
1915
1916 -no-install)
1917 case $host in
1918 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1919 # The PATH hackery in wrapper scripts is required on Windows
1920 # in order for the loader to find any dlls it needs.
1921 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1922 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1923 fast_install=no
1924 ;;
1925 *) no_install=yes ;;
1926 esac
1927 continue
1928 ;;
1929
1930 -no-undefined)
1931 allow_undefined=no
1932 continue
1933 ;;
1934
1935 -objectlist)
1936 prev=objectlist
1937 continue
1938 ;;
1939
1940 -o) prev=output ;;
1941
1942 -precious-files-regex)
1943 prev=precious_regex
1944 continue
1945 ;;
1946
1947 -release)
1948 prev=release
1949 continue
1950 ;;
1951
1952 -rpath)
1953 prev=rpath
1954 continue
1955 ;;
1956
1957 -R)
1958 prev=xrpath
1959 continue
1960 ;;
1961
1962 -R*)
1963 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1964 # We need an absolute path.
1965 case $dir in
1966 [\\/]* | [A-Za-z]:[\\/]*) ;;
1967 *)
1968 $echo "$modename: only absolute run-paths are allowed" 1>&2
1969 exit $EXIT_FAILURE
1970 ;;
1971 esac
1972 case "$xrpath " in
1973 *" $dir "*) ;;
1974 *) xrpath="$xrpath $dir" ;;
1975 esac
1976 continue
1977 ;;
1978
1979 -static)
1980 # The effects of -static are defined in a previous loop.
1981 # We used to do the same as -all-static on platforms that
1982 # didn't have a PIC flag, but the assumption that the effects
1983 # would be equivalent was wrong. It would break on at least
1984 # Digital Unix and AIX.
1985 continue
1986 ;;
1987
1988 -thread-safe)
1989 thread_safe=yes
1990 continue
1991 ;;
1992
1993 -version-info)
1994 prev=vinfo
1995 continue
1996 ;;
1997 -version-number)
1998 prev=vinfo
1999 vinfo_number=yes
2000 continue
2001 ;;
2002
2003 -Wc,*)
2004 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
2005 arg=
2006 save_ifs="$IFS"; IFS=','
2007 for flag in $args; do
2008 IFS="$save_ifs"
2009 case $flag in
2010 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2011 flag="\"$flag\""
2012 ;;
2013 esac
2014 arg="$arg $wl$flag"
2015 compiler_flags="$compiler_flags $flag"
2016 done
2017 IFS="$save_ifs"
2018 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
2019 ;;
2020
2021 -Wl,*)
2022 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
2023 arg=
2024 save_ifs="$IFS"; IFS=','
2025 for flag in $args; do
2026 IFS="$save_ifs"
2027 case $flag in
2028 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2029 flag="\"$flag\""
2030 ;;
2031 esac
2032 arg="$arg $wl$flag"
2033 compiler_flags="$compiler_flags $wl$flag"
2034 linker_flags="$linker_flags $flag"
2035 done
2036 IFS="$save_ifs"
2037 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
2038 ;;
2039
2040 -Xcompiler)
2041 prev=xcompiler
2042 continue
2043 ;;
2044
2045 -Xlinker)
2046 prev=xlinker
2047 continue
2048 ;;
2049
2050 -XCClinker)
2051 prev=xcclinker
2052 continue
2053 ;;
2054
2055 # Some other compiler flag.
2056 -* | +*)
2057 # Unknown arguments in both finalize_command and compile_command need
2058 # to be aesthetically quoted because they are evaled later.
2059 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2060 case $arg in
2061 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2062 arg="\"$arg\""
2063 ;;
2064 esac
2065 ;;
2066
2067 *.$objext)
2068 # A standard object.
2069 objs="$objs $arg"
2070 ;;
2071
2072 *.lo)
2073 # A libtool-controlled object.
2074
2075 # Check to see that this really is a libtool object.
2076 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2077 pic_object=
2078 non_pic_object=
2079
2080 # Read the .lo file
2081 # If there is no directory component, then add one.
2082 case $arg in
2083 */* | *\\*) . $arg ;;
2084 *) . ./$arg ;;
2085 esac
2086
2087 if test -z "$pic_object" || \
2088 test -z "$non_pic_object" ||
2089 test "$pic_object" = none && \
2090 test "$non_pic_object" = none; then
2091 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
2092 exit $EXIT_FAILURE
2093 fi
2094
2095 # Extract subdirectory from the argument.
2096 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
2097 if test "X$xdir" = "X$arg"; then
2098 xdir=
2099 else
2100 xdir="$xdir/"
2101 fi
2102
2103 if test "$pic_object" != none; then
2104 # Prepend the subdirectory the object is found in.
2105 pic_object="$xdir$pic_object"
2106
2107 if test "$prev" = dlfiles; then
2108 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
2109 dlfiles="$dlfiles $pic_object"
2110 prev=
2111 continue
2112 else
2113 # If libtool objects are unsupported, then we need to preload.
2114 prev=dlprefiles
2115 fi
2116 fi
2117
2118 # CHECK ME: I think I busted this. -Ossama
2119 if test "$prev" = dlprefiles; then
2120 # Preload the old-style object.
2121 dlprefiles="$dlprefiles $pic_object"
2122 prev=
2123 fi
2124
2125 # A PIC object.
2126 libobjs="$libobjs $pic_object"
2127 arg="$pic_object"
2128 fi
2129
2130 # Non-PIC object.
2131 if test "$non_pic_object" != none; then
2132 # Prepend the subdirectory the object is found in.
2133 non_pic_object="$xdir$non_pic_object"
2134
2135 # A standard non-PIC object
2136 non_pic_objects="$non_pic_objects $non_pic_object"
2137 if test -z "$pic_object" || test "$pic_object" = none ; then
2138 arg="$non_pic_object"
2139 fi
2140 fi
2141 else
2142 # Only an error if not doing a dry-run.
2143 if test -z "$run"; then
2144 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
2145 exit $EXIT_FAILURE
2146 else
2147 # Dry-run case.
2148
2149 # Extract subdirectory from the argument.
2150 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
2151 if test "X$xdir" = "X$arg"; then
2152 xdir=
2153 else
2154 xdir="$xdir/"
2155 fi
2156
2157 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
2158 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
2159 libobjs="$libobjs $pic_object"
2160 non_pic_objects="$non_pic_objects $non_pic_object"
2161 fi
2162 fi
2163 ;;
2164
2165 *.$libext)
2166 # An archive.
2167 deplibs="$deplibs $arg"
2168 old_deplibs="$old_deplibs $arg"
2169 continue
2170 ;;
2171
2172 *.la)
2173 # A libtool-controlled library.
2174
2175 if test "$prev" = dlfiles; then
2176 # This library was specified with -dlopen.
2177 dlfiles="$dlfiles $arg"
2178 prev=
2179 elif test "$prev" = dlprefiles; then
2180 # The library was specified with -dlpreopen.
2181 dlprefiles="$dlprefiles $arg"
2182 prev=
2183 else
2184 deplibs="$deplibs $arg"
2185 fi
2186 continue
2187 ;;
2188
2189 # Some other compiler argument.
2190 *)
2191 # Unknown arguments in both finalize_command and compile_command need
2192 # to be aesthetically quoted because they are evaled later.
2193 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2194 case $arg in
2195 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2196 arg="\"$arg\""
2197 ;;
2198 esac
2199 ;;
2200 esac # arg
2201
2202 # Now actually substitute the argument into the commands.
2203 if test -n "$arg"; then
2204 compile_command="$compile_command $arg"
2205 finalize_command="$finalize_command $arg"
2206 fi
2207 done # argument parsing loop
2208
2209 if test -n "$prev"; then
2210 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2211 $echo "$help" 1>&2
2212 exit $EXIT_FAILURE
2213 fi
2214
2215 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2216 eval arg=\"$export_dynamic_flag_spec\"
2217 compile_command="$compile_command $arg"
2218 finalize_command="$finalize_command $arg"
2219 fi
2220
2221 oldlibs=
2222 # calculate the name of the file, without its directory
2223 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2224 libobjs_save="$libobjs"
2225
2226 if test -n "$shlibpath_var"; then
2227 # get the directories listed in $shlibpath_var
2228 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2229 else
2230 shlib_search_path=
2231 fi
2232 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2233 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2234
2235 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2236 if test "X$output_objdir" = "X$output"; then
2237 output_objdir="$objdir"
2238 else
2239 output_objdir="$output_objdir/$objdir"
2240 fi
2241 # Create the object directory.
2242 if test ! -d "$output_objdir"; then
2243 $show "$mkdir $output_objdir"
2244 $run $mkdir $output_objdir
2245 status=$?
2246 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
2247 exit $status
2248 fi
2249 fi
2250
2251 # Determine the type of output
2252 case $output in
2253 "")
2254 $echo "$modename: you must specify an output file" 1>&2
2255 $echo "$help" 1>&2
2256 exit $EXIT_FAILURE
2257 ;;
2258 *.$libext) linkmode=oldlib ;;
2259 *.lo | *.$objext) linkmode=obj ;;
2260 *.la) linkmode=lib ;;
2261 *) linkmode=prog ;; # Anything else should be a program.
2262 esac
2263
2264 case $host in
2265 *cygwin* | *mingw* | *pw32*)
2266 # don't eliminate duplications in $postdeps and $predeps
2267 duplicate_compiler_generated_deps=yes
2268 ;;
2269 *)
2270 duplicate_compiler_generated_deps=$duplicate_deps
2271 ;;
2272 esac
2273 specialdeplibs=
2274
2275 libs=
2276 # Find all interdependent deplibs by searching for libraries
2277 # that are linked more than once (e.g. -la -lb -la)
2278 for deplib in $deplibs; do
2279 if test "X$duplicate_deps" = "Xyes" ; then
2280 case "$libs " in
2281 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2282 esac
2283 fi
2284 libs="$libs $deplib"
2285 done
2286
2287 if test "$linkmode" = lib; then
2288 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2289
2290 # Compute libraries that are listed more than once in $predeps
2291 # $postdeps and mark them as special (i.e., whose duplicates are
2292 # not to be eliminated).
2293 pre_post_deps=
2294 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2295 for pre_post_dep in $predeps $postdeps; do
2296 case "$pre_post_deps " in
2297 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2298 esac
2299 pre_post_deps="$pre_post_deps $pre_post_dep"
2300 done
2301 fi
2302 pre_post_deps=
2303 fi
2304
2305 deplibs=
2306 newdependency_libs=
2307 newlib_search_path=
2308 need_relink=no # whether we're linking any uninstalled libtool libraries
2309 notinst_deplibs= # not-installed libtool libraries
2310 notinst_path= # paths that contain not-installed libtool libraries
2311 case $linkmode in
2312 lib)
2313 passes="conv link"
2314 for file in $dlfiles $dlprefiles; do
2315 case $file in
2316 *.la) ;;
2317 *)
2318 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2319 exit $EXIT_FAILURE
2320 ;;
2321 esac
2322 done
2323 ;;
2324 prog)
2325 compile_deplibs=
2326 finalize_deplibs=
2327 alldeplibs=no
2328 newdlfiles=
2329 newdlprefiles=
2330 passes="conv scan dlopen dlpreopen link"
2331 ;;
2332 *) passes="conv"
2333 ;;
2334 esac
2335 for pass in $passes; do
2336 if test "$linkmode,$pass" = "lib,link" ||
2337 test "$linkmode,$pass" = "prog,scan"; then
2338 libs="$deplibs"
2339 deplibs=
2340 fi
2341 if test "$linkmode" = prog; then
2342 case $pass in
2343 dlopen) libs="$dlfiles" ;;
2344 dlpreopen) libs="$dlprefiles" ;;
2345 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2346 esac
2347 fi
2348 if test "$pass" = dlopen; then
2349 # Collect dlpreopened libraries
2350 save_deplibs="$deplibs"
2351 deplibs=
2352 fi
2353 for deplib in $libs; do
2354 lib=
2355 found=no
2356 case $deplib in
2357 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2358 if test "$linkmode,$pass" = "prog,link"; then
2359 compile_deplibs="$deplib $compile_deplibs"
2360 finalize_deplibs="$deplib $finalize_deplibs"
2361 else
2362 compiler_flags="$compiler_flags $deplib"
2363 fi
2364 continue
2365 ;;
2366 -l*)
2367 if test "$linkmode" != lib && test "$linkmode" != prog; then
2368 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2369 continue
2370 fi
2371 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2372 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2373 for search_ext in .la $std_shrext .so .a; do
2374 # Search the libtool library
2375 lib="$searchdir/lib${name}${search_ext}"
2376 if test -f "$lib"; then
2377 if test "$search_ext" = ".la"; then
2378 found=yes
2379 else
2380 found=no
2381 fi
2382 break 2
2383 fi
2384 done
2385 done
2386 if test "$found" != yes; then
2387 # deplib doesn't seem to be a libtool library
2388 if test "$linkmode,$pass" = "prog,link"; then
2389 compile_deplibs="$deplib $compile_deplibs"
2390 finalize_deplibs="$deplib $finalize_deplibs"
2391 else
2392 deplibs="$deplib $deplibs"
2393 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2394 fi
2395 continue
2396 else # deplib is a libtool library
2397 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2398 # We need to do some special things here, and not later.
2399 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2400 case " $predeps $postdeps " in
2401 *" $deplib "*)
2402 if (${SED} -e '2q' $lib |
2403 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2404 library_names=
2405 old_library=
2406 case $lib in
2407 */* | *\\*) . $lib ;;
2408 *) . ./$lib ;;
2409 esac
2410 for l in $old_library $library_names; do
2411 ll="$l"
2412 done
2413 if test "X$ll" = "X$old_library" ; then # only static version available
2414 found=no
2415 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2416 test "X$ladir" = "X$lib" && ladir="."
2417 lib=$ladir/$old_library
2418 if test "$linkmode,$pass" = "prog,link"; then
2419 compile_deplibs="$deplib $compile_deplibs"
2420 finalize_deplibs="$deplib $finalize_deplibs"
2421 else
2422 deplibs="$deplib $deplibs"
2423 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2424 fi
2425 continue
2426 fi
2427 fi
2428 ;;
2429 *) ;;
2430 esac
2431 fi
2432 fi
2433 ;; # -l
2434 -L*)
2435 case $linkmode in
2436 lib)
2437 deplibs="$deplib $deplibs"
2438 test "$pass" = conv && continue
2439 newdependency_libs="$deplib $newdependency_libs"
2440 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2441 ;;
2442 prog)
2443 if test "$pass" = conv; then
2444 deplibs="$deplib $deplibs"
2445 continue
2446 fi
2447 if test "$pass" = scan; then
2448 deplibs="$deplib $deplibs"
2449 else
2450 compile_deplibs="$deplib $compile_deplibs"
2451 finalize_deplibs="$deplib $finalize_deplibs"
2452 fi
2453 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2454 ;;
2455 *)
2456 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2457 ;;
2458 esac # linkmode
2459 continue
2460 ;; # -L
2461 -R*)
2462 if test "$pass" = link; then
2463 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2464 # Make sure the xrpath contains only unique directories.
2465 case "$xrpath " in
2466 *" $dir "*) ;;
2467 *) xrpath="$xrpath $dir" ;;
2468 esac
2469 fi
2470 deplibs="$deplib $deplibs"
2471 continue
2472 ;;
2473 *.la) lib="$deplib" ;;
2474 *.$libext)
2475 if test "$pass" = conv; then
2476 deplibs="$deplib $deplibs"
2477 continue
2478 fi
2479 case $linkmode in
2480 lib)
2481 valid_a_lib=no
2482 case $deplibs_check_method in
2483 match_pattern*)
2484 set dummy $deplibs_check_method
2485 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2486 if eval $echo \"$deplib\" 2>/dev/null \
2487 | $SED 10q \
2488 | $EGREP "$match_pattern_regex" > /dev/null; then
2489 valid_a_lib=yes
2490 fi
2491 ;;
2492 pass_all)
2493 valid_a_lib=yes
2494 ;;
2495 esac
2496 if test "$valid_a_lib" != yes; then
2497 $echo
2498 $echo "*** Warning: Trying to link with static lib archive $deplib."
2499 $echo "*** I have the capability to make that library automatically link in when"
2500 $echo "*** you link to this library. But I can only do this if you have a"
2501 $echo "*** shared version of the library, which you do not appear to have"
2502 $echo "*** because the file extensions .$libext of this argument makes me believe"
2503 $echo "*** that it is just a static archive that I should not used here."
2504 else
2505 $echo
2506 $echo "*** Warning: Linking the shared library $output against the"
2507 $echo "*** static library $deplib is not portable!"
2508 deplibs="$deplib $deplibs"
2509 fi
2510 continue
2511 ;;
2512 prog)
2513 if test "$pass" != link; then
2514 deplibs="$deplib $deplibs"
2515 else
2516 compile_deplibs="$deplib $compile_deplibs"
2517 finalize_deplibs="$deplib $finalize_deplibs"
2518 fi
2519 continue
2520 ;;
2521 esac # linkmode
2522 ;; # *.$libext
2523 *.lo | *.$objext)
2524 if test "$pass" = conv; then
2525 deplibs="$deplib $deplibs"
2526 elif test "$linkmode" = prog; then
2527 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2528 # If there is no dlopen support or we're linking statically,
2529 # we need to preload.
2530 newdlprefiles="$newdlprefiles $deplib"
2531 compile_deplibs="$deplib $compile_deplibs"
2532 finalize_deplibs="$deplib $finalize_deplibs"
2533 else
2534 newdlfiles="$newdlfiles $deplib"
2535 fi
2536 fi
2537 continue
2538 ;;
2539 %DEPLIBS%)
2540 alldeplibs=yes
2541 continue
2542 ;;
2543 esac # case $deplib
2544 if test "$found" = yes || test -f "$lib"; then :
2545 else
2546 $echo "$modename: cannot find the library \`$lib'" 1>&2
2547 exit $EXIT_FAILURE
2548 fi
2549
2550 # Check to see that this really is a libtool archive.
2551 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2552 else
2553 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2554 exit $EXIT_FAILURE
2555 fi
2556
2557 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2558 test "X$ladir" = "X$lib" && ladir="."
2559
2560 dlname=
2561 dlopen=
2562 dlpreopen=
2563 libdir=
2564 library_names=
2565 old_library=
2566 # If the library was installed with an old release of libtool,
2567 # it will not redefine variables installed, or shouldnotlink
2568 installed=yes
2569 shouldnotlink=no
2570 avoidtemprpath=
2571
2572
2573 # Read the .la file
2574 case $lib in
2575 */* | *\\*) . $lib ;;
2576 *) . ./$lib ;;
2577 esac
2578
2579 if test "$linkmode,$pass" = "lib,link" ||
2580 test "$linkmode,$pass" = "prog,scan" ||
2581 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2582 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2583 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2584 fi
2585
2586 if test "$pass" = conv; then
2587 # Only check for convenience libraries
2588 deplibs="$lib $deplibs"
2589 if test -z "$libdir"; then
2590 if test -z "$old_library"; then
2591 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2592 exit $EXIT_FAILURE
2593 fi
2594 # It is a libtool convenience library, so add in its objects.
2595 convenience="$convenience $ladir/$objdir/$old_library"
2596 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2597 tmp_libs=
2598 for deplib in $dependency_libs; do
2599 deplibs="$deplib $deplibs"
2600 if test "X$duplicate_deps" = "Xyes" ; then
2601 case "$tmp_libs " in
2602 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2603 esac
2604 fi
2605 tmp_libs="$tmp_libs $deplib"
2606 done
2607 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2608 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2609 exit $EXIT_FAILURE
2610 fi
2611 continue
2612 fi # $pass = conv
2613
2614
2615 # Get the name of the library we link against.
2616 linklib=
2617 for l in $old_library $library_names; do
2618 linklib="$l"
2619 done
2620 if test -z "$linklib"; then
2621 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2622 exit $EXIT_FAILURE
2623 fi
2624
2625 # This library was specified with -dlopen.
2626 if test "$pass" = dlopen; then
2627 if test -z "$libdir"; then
2628 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2629 exit $EXIT_FAILURE
2630 fi
2631 if test -z "$dlname" ||
2632 test "$dlopen_support" != yes ||
2633 test "$build_libtool_libs" = no; then
2634 # If there is no dlname, no dlopen support or we're linking
2635 # statically, we need to preload. We also need to preload any
2636 # dependent libraries so libltdl's deplib preloader doesn't
2637 # bomb out in the load deplibs phase.
2638 dlprefiles="$dlprefiles $lib $dependency_libs"
2639 else
2640 newdlfiles="$newdlfiles $lib"
2641 fi
2642 continue
2643 fi # $pass = dlopen
2644
2645 # We need an absolute path.
2646 case $ladir in
2647 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2648 *)
2649 abs_ladir=`cd "$ladir" && pwd`
2650 if test -z "$abs_ladir"; then
2651 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2652 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2653 abs_ladir="$ladir"
2654 fi
2655 ;;
2656 esac
2657 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2658
2659 # Find the relevant object directory and library name.
2660 if test "X$installed" = Xyes; then
2661 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2662 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2663 dir="$ladir"
2664 absdir="$abs_ladir"
2665 libdir="$abs_ladir"
2666 else
2667 dir="$libdir"
2668 absdir="$libdir"
2669 fi
2670 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2671 else
2672 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2673 dir="$ladir"
2674 absdir="$abs_ladir"
2675 # Remove this search path later
2676 notinst_path="$notinst_path $abs_ladir"
2677 else
2678 dir="$ladir/$objdir"
2679 absdir="$abs_ladir/$objdir"
2680 # Remove this search path later
2681 notinst_path="$notinst_path $abs_ladir"
2682 fi
2683 fi # $installed = yes
2684 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2685
2686 # This library was specified with -dlpreopen.
2687 if test "$pass" = dlpreopen; then
2688 if test -z "$libdir"; then
2689 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2690 exit $EXIT_FAILURE
2691 fi
2692 # Prefer using a static library (so that no silly _DYNAMIC symbols
2693 # are required to link).
2694 if test -n "$old_library"; then
2695 newdlprefiles="$newdlprefiles $dir/$old_library"
2696 # Otherwise, use the dlname, so that lt_dlopen finds it.
2697 elif test -n "$dlname"; then
2698 newdlprefiles="$newdlprefiles $dir/$dlname"
2699 else
2700 newdlprefiles="$newdlprefiles $dir/$linklib"
2701 fi
2702 fi # $pass = dlpreopen
2703
2704 if test -z "$libdir"; then
2705 # Link the convenience library
2706 if test "$linkmode" = lib; then
2707 deplibs="$dir/$old_library $deplibs"
2708 elif test "$linkmode,$pass" = "prog,link"; then
2709 compile_deplibs="$dir/$old_library $compile_deplibs"
2710 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2711 else
2712 deplibs="$lib $deplibs" # used for prog,scan pass
2713 fi
2714 continue
2715 fi
2716
2717
2718 if test "$linkmode" = prog && test "$pass" != link; then
2719 newlib_search_path="$newlib_search_path $ladir"
2720 deplibs="$lib $deplibs"
2721
2722 linkalldeplibs=no
2723 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2724 test "$build_libtool_libs" = no; then
2725 linkalldeplibs=yes
2726 fi
2727
2728 tmp_libs=
2729 for deplib in $dependency_libs; do
2730 case $deplib in
2731 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2732 esac
2733 # Need to link against all dependency_libs?
2734 if test "$linkalldeplibs" = yes; then
2735 deplibs="$deplib $deplibs"
2736 else
2737 # Need to hardcode shared library paths
2738 # or/and link against static libraries
2739 newdependency_libs="$deplib $newdependency_libs"
2740 fi
2741 if test "X$duplicate_deps" = "Xyes" ; then
2742 case "$tmp_libs " in
2743 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2744 esac
2745 fi
2746 tmp_libs="$tmp_libs $deplib"
2747 done # for deplib
2748 continue
2749 fi # $linkmode = prog...
2750
2751 if test "$linkmode,$pass" = "prog,link"; then
2752 if test -n "$library_names" &&
2753 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2754 # We need to hardcode the library path
2755 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2756 # Make sure the rpath contains only unique directories.
2757 case "$temp_rpath " in
2758 *" $dir "*) ;;
2759 *" $absdir "*) ;;
2760 *) temp_rpath="$temp_rpath $absdir" ;;
2761 esac
2762 fi
2763
2764 # Hardcode the library path.
2765 # Skip directories that are in the system default run-time
2766 # search path.
2767 case " $sys_lib_dlsearch_path " in
2768 *" $absdir "*) ;;
2769 *)
2770 case "$compile_rpath " in
2771 *" $absdir "*) ;;
2772 *) compile_rpath="$compile_rpath $absdir"
2773 esac
2774 ;;
2775 esac
2776 case " $sys_lib_dlsearch_path " in
2777 *" $libdir "*) ;;
2778 *)
2779 case "$finalize_rpath " in
2780 *" $libdir "*) ;;
2781 *) finalize_rpath="$finalize_rpath $libdir"
2782 esac
2783 ;;
2784 esac
2785 fi # $linkmode,$pass = prog,link...
2786
2787 if test "$alldeplibs" = yes &&
2788 { test "$deplibs_check_method" = pass_all ||
2789 { test "$build_libtool_libs" = yes &&
2790 test -n "$library_names"; }; }; then
2791 # We only need to search for static libraries
2792 continue
2793 fi
2794 fi
2795
2796 link_static=no # Whether the deplib will be linked statically
2797 if test -n "$library_names" &&
2798 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2799 if test "$installed" = no; then
2800 notinst_deplibs="$notinst_deplibs $lib"
2801 need_relink=yes
2802 fi
2803 # This is a shared library
2804
2805 # Warn about portability, can't link against -module's on
2806 # some systems (darwin)
2807 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2808 $echo
2809 if test "$linkmode" = prog; then
2810 $echo "*** Warning: Linking the executable $output against the loadable module"
2811 else
2812 $echo "*** Warning: Linking the shared library $output against the loadable module"
2813 fi
2814 $echo "*** $linklib is not portable!"
2815 fi
2816 if test "$linkmode" = lib &&
2817 test "$hardcode_into_libs" = yes; then
2818 # Hardcode the library path.
2819 # Skip directories that are in the system default run-time
2820 # search path.
2821 case " $sys_lib_dlsearch_path " in
2822 *" $absdir "*) ;;
2823 *)
2824 case "$compile_rpath " in
2825 *" $absdir "*) ;;
2826 *) compile_rpath="$compile_rpath $absdir"
2827 esac
2828 ;;
2829 esac
2830 case " $sys_lib_dlsearch_path " in
2831 *" $libdir "*) ;;
2832 *)
2833 case "$finalize_rpath " in
2834 *" $libdir "*) ;;
2835 *) finalize_rpath="$finalize_rpath $libdir"
2836 esac
2837 ;;
2838 esac
2839 fi
2840
2841 if test -n "$old_archive_from_expsyms_cmds"; then
2842 # figure out the soname
2843 set dummy $library_names
2844 realname="$2"
2845 shift; shift
2846 libname=`eval \\$echo \"$libname_spec\"`
2847 # use dlname if we got it. it's perfectly good, no?
2848 if test -n "$dlname"; then
2849 soname="$dlname"
2850 elif test -n "$soname_spec"; then
2851 # bleh windows
2852 case $host in
2853 *cygwin* | mingw*)
2854 major=`expr $current - $age`
2855 versuffix="-$major"
2856 ;;
2857 esac
2858 eval soname=\"$soname_spec\"
2859 else
2860 soname="$realname"
2861 fi
2862
2863 # Make a new name for the extract_expsyms_cmds to use
2864 soroot="$soname"
2865 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2866 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2867
2868 # If the library has no export list, then create one now
2869 if test -f "$output_objdir/$soname-def"; then :
2870 else
2871 $show "extracting exported symbol list from \`$soname'"
2872 save_ifs="$IFS"; IFS='~'
2873 cmds=$extract_expsyms_cmds
2874 for cmd in $cmds; do
2875 IFS="$save_ifs"
2876 eval cmd=\"$cmd\"
2877 $show "$cmd"
2878 $run eval "$cmd" || exit $?
2879 done
2880 IFS="$save_ifs"
2881 fi
2882
2883 # Create $newlib
2884 if test -f "$output_objdir/$newlib"; then :; else
2885 $show "generating import library for \`$soname'"
2886 save_ifs="$IFS"; IFS='~'
2887 cmds=$old_archive_from_expsyms_cmds
2888 for cmd in $cmds; do
2889 IFS="$save_ifs"
2890 eval cmd=\"$cmd\"
2891 $show "$cmd"
2892 $run eval "$cmd" || exit $?
2893 done
2894 IFS="$save_ifs"
2895 fi
2896 # make sure the library variables are pointing to the new library
2897 dir=$output_objdir
2898 linklib=$newlib
2899 fi # test -n "$old_archive_from_expsyms_cmds"
2900
2901 if test "$linkmode" = prog || test "$mode" != relink; then
2902 add_shlibpath=
2903 add_dir=
2904 add=
2905 lib_linked=yes
2906 case $hardcode_action in
2907 immediate | unsupported)
2908 if test "$hardcode_direct" = no; then
2909 add="$dir/$linklib"
2910 case $host in
2911 *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2912 *-*-darwin* )
2913 # if the lib is a module then we can not link against
2914 # it, someone is ignoring the new warnings I added
2915 if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
2916 $echo "** Warning, lib $linklib is a module, not a shared library"
2917 if test -z "$old_library" ; then
2918 $echo
2919 $echo "** And there doesn't seem to be a static archive available"
2920 $echo "** The link will probably fail, sorry"
2921 else
2922 add="$dir/$old_library"
2923 fi
2924 fi
2925 esac
2926 elif test "$hardcode_minus_L" = no; then
2927 case $host in
2928 *-*-sunos*) add_shlibpath="$dir" ;;
2929 esac
2930 add_dir="-L$dir"
2931 add="-l$name"
2932 elif test "$hardcode_shlibpath_var" = no; then
2933 add_shlibpath="$dir"
2934 add="-l$name"
2935 else
2936 lib_linked=no
2937 fi
2938 ;;
2939 relink)
2940 if test "$hardcode_direct" = yes; then
2941 add="$dir/$linklib"
2942 elif test "$hardcode_minus_L" = yes; then
2943 add_dir="-L$dir"
2944 # Try looking first in the location we're being installed to.
2945 if test -n "$inst_prefix_dir"; then
2946 case $libdir in
2947 [\\/]*)
2948 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2949 ;;
2950 esac
2951 fi
2952 add="-l$name"
2953 elif test "$hardcode_shlibpath_var" = yes; then
2954 add_shlibpath="$dir"
2955 add="-l$name"
2956 else
2957 lib_linked=no
2958 fi
2959 ;;
2960 *) lib_linked=no ;;
2961 esac
2962
2963 if test "$lib_linked" != yes; then
2964 $echo "$modename: configuration error: unsupported hardcode properties"
2965 exit $EXIT_FAILURE
2966 fi
2967
2968 if test -n "$add_shlibpath"; then
2969 case :$compile_shlibpath: in
2970 *":$add_shlibpath:"*) ;;
2971 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2972 esac
2973 fi
2974 if test "$linkmode" = prog; then
2975 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2976 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2977 else
2978 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2979 test -n "$add" && deplibs="$add $deplibs"
2980 if test "$hardcode_direct" != yes && \
2981 test "$hardcode_minus_L" != yes && \
2982 test "$hardcode_shlibpath_var" = yes; then
2983 case :$finalize_shlibpath: in
2984 *":$libdir:"*) ;;
2985 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2986 esac
2987 fi
2988 fi
2989 fi
2990
2991 if test "$linkmode" = prog || test "$mode" = relink; then
2992 add_shlibpath=
2993 add_dir=
2994 add=
2995 # Finalize command for both is simple: just hardcode it.
2996 if test "$hardcode_direct" = yes; then
2997 add="$libdir/$linklib"
2998 elif test "$hardcode_minus_L" = yes; then
2999 add_dir="-L$libdir"
3000 add="-l$name"
3001 elif test "$hardcode_shlibpath_var" = yes; then
3002 case :$finalize_shlibpath: in
3003 *":$libdir:"*) ;;
3004 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
3005 esac
3006 add="-l$name"
3007 elif test "$hardcode_automatic" = yes; then
3008 if test -n "$inst_prefix_dir" &&
3009 test -f "$inst_prefix_dir$libdir/$linklib" ; then
3010 add="$inst_prefix_dir$libdir/$linklib"
3011 else
3012 add="$libdir/$linklib"
3013 fi
3014 else
3015 # We cannot seem to hardcode it, guess we'll fake it.
3016 add_dir="-L$libdir"
3017 # Try looking first in the location we're being installed to.
3018 if test -n "$inst_prefix_dir"; then
3019 case $libdir in
3020 [\\/]*)
3021 add_dir="$add_dir -L$inst_prefix_dir$libdir"
3022 ;;
3023 esac
3024 fi
3025 add="-l$name"
3026 fi
3027
3028 if test "$linkmode" = prog; then
3029 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
3030 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
3031 else
3032 test -n "$add_dir" && deplibs="$add_dir $deplibs"
3033 test -n "$add" && deplibs="$add $deplibs"
3034 fi
3035 fi
3036 elif test "$linkmode" = prog; then
3037 # Here we assume that one of hardcode_direct or hardcode_minus_L
3038 # is not unsupported. This is valid on all known static and
3039 # shared platforms.
3040 if test "$hardcode_direct" != unsupported; then
3041 test -n "$old_library" && linklib="$old_library"
3042 compile_deplibs="$dir/$linklib $compile_deplibs"
3043 finalize_deplibs="$dir/$linklib $finalize_deplibs"
3044 else
3045 compile_deplibs="-l$name -L$dir $compile_deplibs"
3046 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
3047 fi
3048 elif test "$build_libtool_libs" = yes; then
3049 # Not a shared library
3050 if test "$deplibs_check_method" != pass_all; then
3051 # We're trying link a shared library against a static one
3052 # but the system doesn't support it.
3053
3054 # Just print a warning and add the library to dependency_libs so
3055 # that the program can be linked against the static library.
3056 $echo
3057 $echo "*** Warning: This system can not link to static lib archive $lib."
3058 $echo "*** I have the capability to make that library automatically link in when"
3059 $echo "*** you link to this library. But I can only do this if you have a"
3060 $echo "*** shared version of the library, which you do not appear to have."
3061 if test "$module" = yes; then
3062 $echo "*** But as you try to build a module library, libtool will still create "
3063 $echo "*** a static module, that should work as long as the dlopening application"
3064 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
3065 if test -z "$global_symbol_pipe"; then
3066 $echo
3067 $echo "*** However, this would only work if libtool was able to extract symbol"
3068 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3069 $echo "*** not find such a program. So, this module is probably useless."
3070 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3071 fi
3072 if test "$build_old_libs" = no; then
3073 build_libtool_libs=module
3074 build_old_libs=yes
3075 else
3076 build_libtool_libs=no
3077 fi
3078 fi
3079 else
3080 deplibs="$dir/$old_library $deplibs"
3081 link_static=yes
3082 fi
3083 fi # link shared/static library?
3084
3085 if test "$linkmode" = lib; then
3086 if test -n "$dependency_libs" &&
3087 { test "$hardcode_into_libs" != yes ||
3088 test "$build_old_libs" = yes ||
3089 test "$link_static" = yes; }; then
3090 # Extract -R from dependency_libs
3091 temp_deplibs=
3092 for libdir in $dependency_libs; do
3093 case $libdir in
3094 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
3095 case " $xrpath " in
3096 *" $temp_xrpath "*) ;;
3097 *) xrpath="$xrpath $temp_xrpath";;
3098 esac;;
3099 *) temp_deplibs="$temp_deplibs $libdir";;
3100 esac
3101 done
3102 dependency_libs="$temp_deplibs"
3103 fi
3104
3105 newlib_search_path="$newlib_search_path $absdir"
3106 # Link against this library
3107 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
3108 # ... and its dependency_libs
3109 tmp_libs=
3110 for deplib in $dependency_libs; do
3111 newdependency_libs="$deplib $newdependency_libs"
3112 if test "X$duplicate_deps" = "Xyes" ; then
3113 case "$tmp_libs " in
3114 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3115 esac
3116 fi
3117 tmp_libs="$tmp_libs $deplib"
3118 done
3119
3120 if test "$link_all_deplibs" != no; then
3121 # Add the search paths of all dependency libraries
3122 for deplib in $dependency_libs; do
3123 case $deplib in
3124 -L*) path="$deplib" ;;
3125 *.la)
3126 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
3127 test "X$dir" = "X$deplib" && dir="."
3128 # We need an absolute path.
3129 case $dir in
3130 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
3131 *)
3132 absdir=`cd "$dir" && pwd`
3133 if test -z "$absdir"; then
3134 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
3135 absdir="$dir"
3136 fi
3137 ;;
3138 esac
3139 if grep "^installed=no" $deplib > /dev/null; then
3140 path="$absdir/$objdir"
3141 else
3142 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3143 if test -z "$libdir"; then
3144 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3145 exit $EXIT_FAILURE
3146 fi
3147 if test "$absdir" != "$libdir"; then
3148 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
3149 fi
3150 path="$absdir"
3151 fi
3152 depdepl=
3153 case $host in
3154 *-*-darwin*)
3155 # we do not want to link against static libs,
3156 # but need to link against shared
3157 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
3158 if test -n "$deplibrary_names" ; then
3159 for tmp in $deplibrary_names ; do
3160 depdepl=$tmp
3161 done
3162 if test -f "$path/$depdepl" ; then
3163 depdepl="$path/$depdepl"
3164 fi
3165 # do not add paths which are already there
3166 case " $newlib_search_path " in
3167 *" $path "*) ;;
3168 *) newlib_search_path="$newlib_search_path $path";;
3169 esac
3170 fi
3171 path=""
3172 ;;
3173 *)
3174 path="-L$path"
3175 ;;
3176 esac
3177 ;;
3178 -l*)
3179 case $host in
3180 *-*-darwin*)
3181 # Again, we only want to link against shared libraries
3182 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
3183 for tmp in $newlib_search_path ; do
3184 if test -f "$tmp/lib$tmp_libs.dylib" ; then
3185 eval depdepl="$tmp/lib$tmp_libs.dylib"
3186 break
3187 fi
3188 done
3189 path=""
3190 ;;
3191 *) continue ;;
3192 esac
3193 ;;
3194 *) continue ;;
3195 esac
3196 case " $deplibs " in
3197 *" $path "*) ;;
3198 *) deplibs="$path $deplibs" ;;
3199 esac
3200 case " $deplibs " in
3201 *" $depdepl "*) ;;
3202 *) deplibs="$depdepl $deplibs" ;;
3203 esac
3204 done
3205 fi # link_all_deplibs != no
3206 fi # linkmode = lib
3207 done # for deplib in $libs
3208 dependency_libs="$newdependency_libs"
3209 if test "$pass" = dlpreopen; then
3210 # Link the dlpreopened libraries before other libraries
3211 for deplib in $save_deplibs; do
3212 deplibs="$deplib $deplibs"
3213 done
3214 fi
3215 if test "$pass" != dlopen; then
3216 if test "$pass" != conv; then
3217 # Make sure lib_search_path contains only unique directories.
3218 lib_search_path=
3219 for dir in $newlib_search_path; do
3220 case "$lib_search_path " in
3221 *" $dir "*) ;;
3222 *) lib_search_path="$lib_search_path $dir" ;;
3223 esac
3224 done
3225 newlib_search_path=
3226 fi
3227
3228 if test "$linkmode,$pass" != "prog,link"; then
3229 vars="deplibs"
3230 else
3231 vars="compile_deplibs finalize_deplibs"
3232 fi
3233 for var in $vars dependency_libs; do
3234 # Add libraries to $var in reverse order
3235 eval tmp_libs=\"\$$var\"
3236 new_libs=
3237 for deplib in $tmp_libs; do
3238 # FIXME: Pedantically, this is the right thing to do, so
3239 # that some nasty dependency loop isn't accidentally
3240 # broken:
3241 #new_libs="$deplib $new_libs"
3242 # Pragmatically, this seems to cause very few problems in
3243 # practice:
3244 case $deplib in
3245 -L*) new_libs="$deplib $new_libs" ;;
3246 -R*) ;;
3247 *)
3248 # And here is the reason: when a library appears more
3249 # than once as an explicit dependence of a library, or
3250 # is implicitly linked in more than once by the
3251 # compiler, it is considered special, and multiple
3252 # occurrences thereof are not removed. Compare this
3253 # with having the same library being listed as a
3254 # dependency of multiple other libraries: in this case,
3255 # we know (pedantically, we assume) the library does not
3256 # need to be listed more than once, so we keep only the
3257 # last copy. This is not always right, but it is rare
3258 # enough that we require users that really mean to play
3259 # such unportable linking tricks to link the library
3260 # using -Wl,-lname, so that libtool does not consider it
3261 # for duplicate removal.
3262 case " $specialdeplibs " in
3263 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3264 *)
3265 case " $new_libs " in
3266 *" $deplib "*) ;;
3267 *) new_libs="$deplib $new_libs" ;;
3268 esac
3269 ;;
3270 esac
3271 ;;
3272 esac
3273 done
3274 tmp_libs=
3275 for deplib in $new_libs; do
3276 case $deplib in
3277 -L*)
3278 case " $tmp_libs " in
3279 *" $deplib "*) ;;
3280 *) tmp_libs="$tmp_libs $deplib" ;;
3281 esac
3282 ;;
3283 *) tmp_libs="$tmp_libs $deplib" ;;
3284 esac
3285 done
3286 eval $var=\"$tmp_libs\"
3287 done # for var
3288 fi
3289 # Last step: remove runtime libs from dependency_libs
3290 # (they stay in deplibs)
3291 tmp_libs=
3292 for i in $dependency_libs ; do
3293 case " $predeps $postdeps $compiler_lib_search_path " in
3294 *" $i "*)
3295 i=""
3296 ;;
3297 esac
3298 if test -n "$i" ; then
3299 tmp_libs="$tmp_libs $i"
3300 fi
3301 done
3302 dependency_libs=$tmp_libs
3303 done # for pass
3304 if test "$linkmode" = prog; then
3305 dlfiles="$newdlfiles"
3306 dlprefiles="$newdlprefiles"
3307 fi
3308
3309 case $linkmode in
3310 oldlib)
3311 if test -n "$deplibs"; then
3312 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3313 fi
3314
3315 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3316 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3317 fi
3318
3319 if test -n "$rpath"; then
3320 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3321 fi
3322
3323 if test -n "$xrpath"; then
3324 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3325 fi
3326
3327 if test -n "$vinfo"; then
3328 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3329 fi
3330
3331 if test -n "$release"; then
3332 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3333 fi
3334
3335 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3336 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3337 fi
3338
3339 # Now set the variables for building old libraries.
3340 build_libtool_libs=no
3341 oldlibs="$output"
3342 objs="$objs$old_deplibs"
3343 ;;
3344
3345 lib)
3346 # Make sure we only generate libraries of the form `libNAME.la'.
3347 case $outputname in
3348 lib*)
3349 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3350 eval shared_ext=\"$shrext_cmds\"
3351 eval libname=\"$libname_spec\"
3352 ;;
3353 *)
3354 if test "$module" = no; then
3355 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3356 $echo "$help" 1>&2
3357 exit $EXIT_FAILURE
3358 fi
3359 if test "$need_lib_prefix" != no; then
3360 # Add the "lib" prefix for modules if required
3361 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3362 eval shared_ext=\"$shrext_cmds\"
3363 eval libname=\"$libname_spec\"
3364 else
3365 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3366 fi
3367 ;;
3368 esac
3369
3370 if test -n "$objs"; then
3371 if test "$deplibs_check_method" != pass_all; then
3372 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3373 exit $EXIT_FAILURE
3374 else
3375 $echo
3376 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3377 $echo "*** objects $objs is not portable!"
3378 libobjs="$libobjs $objs"
3379 fi
3380 fi
3381
3382 if test "$dlself" != no; then
3383 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3384 fi
3385
3386 set dummy $rpath
3387 if test "$#" -gt 2; then
3388 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3389 fi
3390 install_libdir="$2"
3391
3392 oldlibs=
3393 if test -z "$rpath"; then
3394 if test "$build_libtool_libs" = yes; then
3395 # Building a libtool convenience library.
3396 # Some compilers have problems with a `.al' extension so
3397 # convenience libraries should have the same extension an
3398 # archive normally would.
3399 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3400 build_libtool_libs=convenience
3401 build_old_libs=yes
3402 fi
3403
3404 if test -n "$vinfo"; then
3405 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3406 fi
3407
3408 if test -n "$release"; then
3409 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3410 fi
3411 else
3412
3413 # Parse the version information argument.
3414 save_ifs="$IFS"; IFS=':'
3415 set dummy $vinfo 0 0 0
3416 IFS="$save_ifs"
3417
3418 if test -n "$8"; then
3419 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3420 $echo "$help" 1>&2
3421 exit $EXIT_FAILURE
3422 fi
3423
3424 # convert absolute version numbers to libtool ages
3425 # this retains compatibility with .la files and attempts
3426 # to make the code below a bit more comprehensible
3427
3428 case $vinfo_number in
3429 yes)
3430 number_major="$2"
3431 number_minor="$3"
3432 number_revision="$4"
3433 #
3434 # There are really only two kinds -- those that
3435 # use the current revision as the major version
3436 # and those that subtract age and use age as
3437 # a minor version. But, then there is irix
3438 # which has an extra 1 added just for fun
3439 #
3440 case $version_type in
3441 darwin|linux|osf|windows)
3442 current=`expr $number_major + $number_minor`
3443 age="$number_minor"
3444 revision="$number_revision"
3445 ;;
3446 freebsd-aout|freebsd-elf|sunos)
3447 current="$number_major"
3448 revision="$number_minor"
3449 age="0"
3450 ;;
3451 irix|nonstopux)
3452 current=`expr $number_major + $number_minor - 1`
3453 age="$number_minor"
3454 revision="$number_minor"
3455 ;;
3456 esac
3457 ;;
3458 no)
3459 current="$2"
3460 revision="$3"
3461 age="$4"
3462 ;;
3463 esac
3464
3465 # Check that each of the things are valid numbers.
3466 case $current in
3467 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]) ;;
3468 *)
3469 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3470 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3471 exit $EXIT_FAILURE
3472 ;;
3473 esac
3474
3475 case $revision in
3476 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]) ;;
3477 *)
3478 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3479 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3480 exit $EXIT_FAILURE
3481 ;;
3482 esac
3483
3484 case $age in
3485 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]) ;;
3486 *)
3487 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3488 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3489 exit $EXIT_FAILURE
3490 ;;
3491 esac
3492
3493 if test "$age" -gt "$current"; then
3494 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3495 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3496 exit $EXIT_FAILURE
3497 fi
3498
3499 # Calculate the version variables.
3500 major=
3501 versuffix=
3502 verstring=
3503 case $version_type in
3504 none) ;;
3505
3506 darwin)
3507 # Like Linux, but with the current version available in
3508 # verstring for coding it into the library header
3509 major=.`expr $current - $age`
3510 versuffix="$major.$age.$revision"
3511 # Darwin ld doesn't like 0 for these options...
3512 minor_current=`expr $current + 1`
3513 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3514 ;;
3515
3516 freebsd-aout)
3517 major=".$current"
3518 versuffix=".$current.$revision";
3519 ;;
3520
3521 freebsd-elf)
3522 major=".$current"
3523 versuffix=".$current";
3524 ;;
3525
3526 irix | nonstopux)
3527 major=`expr $current - $age + 1`
3528
3529 case $version_type in
3530 nonstopux) verstring_prefix=nonstopux ;;
3531 *) verstring_prefix=sgi ;;
3532 esac
3533 verstring="$verstring_prefix$major.$revision"
3534
3535 # Add in all the interfaces that we are compatible with.
3536 loop=$revision
3537 while test "$loop" -ne 0; do
3538 iface=`expr $revision - $loop`
3539 loop=`expr $loop - 1`
3540 verstring="$verstring_prefix$major.$iface:$verstring"
3541 done
3542
3543 # Before this point, $major must not contain `.'.
3544 major=.$major
3545 versuffix="$major.$revision"
3546 ;;
3547
3548 linux)
3549 major=.`expr $current - $age`
3550 versuffix="$major.$age.$revision"
3551 ;;
3552
3553 osf)
3554 major=.`expr $current - $age`
3555 versuffix=".$current.$age.$revision"
3556 verstring="$current.$age.$revision"
3557
3558 # Add in all the interfaces that we are compatible with.
3559 loop=$age
3560 while test "$loop" -ne 0; do
3561 iface=`expr $current - $loop`
3562 loop=`expr $loop - 1`
3563 verstring="$verstring:${iface}.0"
3564 done
3565
3566 # Make executables depend on our current version.
3567 verstring="$verstring:${current}.0"
3568 ;;
3569
3570 sunos)
3571 major=".$current"
3572 versuffix=".$current.$revision"
3573 ;;
3574
3575 windows)
3576 # Use '-' rather than '.', since we only want one
3577 # extension on DOS 8.3 filesystems.
3578 major=`expr $current - $age`
3579 versuffix="-$major"
3580 ;;
3581
3582 *)
3583 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3584 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3585 exit $EXIT_FAILURE
3586 ;;
3587 esac
3588
3589 # Clear the version info if we defaulted, and they specified a release.
3590 if test -z "$vinfo" && test -n "$release"; then
3591 major=
3592 case $version_type in
3593 darwin)
3594 # we can't check for "0.0" in archive_cmds due to quoting
3595 # problems, so we reset it completely
3596 verstring=
3597 ;;
3598 *)
3599 verstring="0.0"
3600 ;;
3601 esac
3602 if test "$need_version" = no; then
3603 versuffix=
3604 else
3605 versuffix=".0.0"
3606 fi
3607 fi
3608
3609 # Remove version info from name if versioning should be avoided
3610 if test "$avoid_version" = yes && test "$need_version" = no; then
3611 major=
3612 versuffix=
3613 verstring=""
3614 fi
3615
3616 # Check to see if the archive will have undefined symbols.
3617 if test "$allow_undefined" = yes; then
3618 if test "$allow_undefined_flag" = unsupported; then
3619 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3620 build_libtool_libs=no
3621 build_old_libs=yes
3622 fi
3623 else
3624 # Don't allow undefined symbols.
3625 allow_undefined_flag="$no_undefined_flag"
3626 fi
3627 fi
3628
3629 if test "$mode" != relink; then
3630 # Remove our outputs, but don't remove object files since they
3631 # may have been created when compiling PIC objects.
3632 removelist=
3633 tempremovelist=`$echo "$output_objdir/*"`
3634 for p in $tempremovelist; do
3635 case $p in
3636 *.$objext)
3637 ;;
3638 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3639 if test "X$precious_files_regex" != "X"; then
3640 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3641 then
3642 continue
3643 fi
3644 fi
3645 removelist="$removelist $p"
3646 ;;
3647 *) ;;
3648 esac
3649 done
3650 if test -n "$removelist"; then
3651 $show "${rm}r $removelist"
3652 $run ${rm}r $removelist
3653 fi
3654 fi
3655
3656 # Now set the variables for building old libraries.
3657 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3658 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3659
3660 # Transform .lo files to .o files.
3661 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3662 fi
3663
3664 # Eliminate all temporary directories.
3665 for path in $notinst_path; do
3666 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3667 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3668 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3669 done
3670
3671 if test -n "$xrpath"; then
3672 # If the user specified any rpath flags, then add them.
3673 temp_xrpath=
3674 for libdir in $xrpath; do
3675 temp_xrpath="$temp_xrpath -R$libdir"
3676 case "$finalize_rpath " in
3677 *" $libdir "*) ;;
3678 *) finalize_rpath="$finalize_rpath $libdir" ;;
3679 esac
3680 done
3681 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3682 dependency_libs="$temp_xrpath $dependency_libs"
3683 fi
3684 fi
3685
3686 # Make sure dlfiles contains only unique files that won't be dlpreopened
3687 old_dlfiles="$dlfiles"
3688 dlfiles=
3689 for lib in $old_dlfiles; do
3690 case " $dlprefiles $dlfiles " in
3691 *" $lib "*) ;;
3692 *) dlfiles="$dlfiles $lib" ;;
3693 esac
3694 done
3695
3696 # Make sure dlprefiles contains only unique files
3697 old_dlprefiles="$dlprefiles"
3698 dlprefiles=
3699 for lib in $old_dlprefiles; do
3700 case "$dlprefiles " in
3701 *" $lib "*) ;;
3702 *) dlprefiles="$dlprefiles $lib" ;;
3703 esac
3704 done
3705
3706 if test "$build_libtool_libs" = yes; then
3707 if test -n "$rpath"; then
3708 case $host in
3709 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3710 # these systems don't actually have a c library (as such)!
3711 ;;
3712 *-*-rhapsody* | *-*-darwin1.[012])
3713 # Rhapsody C library is in the System framework
3714 deplibs="$deplibs -framework System"
3715 ;;
3716 *-*-netbsd*)
3717 # Don't link with libc until the a.out ld.so is fixed.
3718 ;;
3719 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3720 # Do not include libc due to us having libc/libc_r.
3721 test "X$arg" = "X-lc" && continue
3722 ;;
3723 *)
3724 # Add libc to deplibs on all other systems if necessary.
3725 if test "$build_libtool_need_lc" = "yes"; then
3726 deplibs="$deplibs -lc"
3727 fi
3728 ;;
3729 esac
3730 fi
3731
3732 # Transform deplibs into only deplibs that can be linked in shared.
3733 name_save=$name
3734 libname_save=$libname
3735 release_save=$release
3736 versuffix_save=$versuffix
3737 major_save=$major
3738 # I'm not sure if I'm treating the release correctly. I think
3739 # release should show up in the -l (ie -lgmp5) so we don't want to
3740 # add it in twice. Is that correct?
3741 release=""
3742 versuffix=""
3743 major=""
3744 newdeplibs=
3745 droppeddeps=no
3746 case $deplibs_check_method in
3747 pass_all)
3748 # Don't check for shared/static. Everything works.
3749 # This might be a little naive. We might want to check
3750 # whether the library exists or not. But this is on
3751 # osf3 & osf4 and I'm not really sure... Just
3752 # implementing what was already the behavior.
3753 newdeplibs=$deplibs
3754 ;;
3755 test_compile)
3756 # This code stresses the "libraries are programs" paradigm to its
3757 # limits. Maybe even breaks it. We compile a program, linking it
3758 # against the deplibs as a proxy for the library. Then we can check
3759 # whether they linked in statically or dynamically with ldd.
3760 $rm conftest.c
3761 cat > conftest.c <<EOF
3762 int main() { return 0; }
3763EOF
3764 $rm conftest
3765 $LTCC -o conftest conftest.c $deplibs
3766 if test "$?" -eq 0 ; then
3767 ldd_output=`ldd conftest`
3768 for i in $deplibs; do
3769 name=`expr $i : '-l\(.*\)'`
3770 # If $name is empty we are operating on a -L argument.
3771 if test "$name" != "" && test "$name" -ne "0"; then
3772 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3773 case " $predeps $postdeps " in
3774 *" $i "*)
3775 newdeplibs="$newdeplibs $i"
3776 i=""
3777 ;;
3778 esac
3779 fi
3780 if test -n "$i" ; then
3781 libname=`eval \\$echo \"$libname_spec\"`
3782 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3783 set dummy $deplib_matches
3784 deplib_match=$2
3785 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3786 newdeplibs="$newdeplibs $i"
3787 else
3788 droppeddeps=yes
3789 $echo
3790 $echo "*** Warning: dynamic linker does not accept needed library $i."
3791 $echo "*** I have the capability to make that library automatically link in when"
3792 $echo "*** you link to this library. But I can only do this if you have a"
3793 $echo "*** shared version of the library, which I believe you do not have"
3794 $echo "*** because a test_compile did reveal that the linker did not use it for"
3795 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3796 fi
3797 fi
3798 else
3799 newdeplibs="$newdeplibs $i"
3800 fi
3801 done
3802 else
3803 # Error occurred in the first compile. Let's try to salvage
3804 # the situation: Compile a separate program for each library.
3805 for i in $deplibs; do
3806 name=`expr $i : '-l\(.*\)'`
3807 # If $name is empty we are operating on a -L argument.
3808 if test "$name" != "" && test "$name" != "0"; then
3809 $rm conftest
3810 $LTCC -o conftest conftest.c $i
3811 # Did it work?
3812 if test "$?" -eq 0 ; then
3813 ldd_output=`ldd conftest`
3814 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3815 case " $predeps $postdeps " in
3816 *" $i "*)
3817 newdeplibs="$newdeplibs $i"
3818 i=""
3819 ;;
3820 esac
3821 fi
3822 if test -n "$i" ; then
3823 libname=`eval \\$echo \"$libname_spec\"`
3824 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3825 set dummy $deplib_matches
3826 deplib_match=$2
3827 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3828 newdeplibs="$newdeplibs $i"
3829 else
3830 droppeddeps=yes
3831 $echo
3832 $echo "*** Warning: dynamic linker does not accept needed library $i."
3833 $echo "*** I have the capability to make that library automatically link in when"
3834 $echo "*** you link to this library. But I can only do this if you have a"
3835 $echo "*** shared version of the library, which you do not appear to have"
3836 $echo "*** because a test_compile did reveal that the linker did not use this one"
3837 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3838 fi
3839 fi
3840 else
3841 droppeddeps=yes
3842 $echo
3843 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3844 $echo "*** make it link in! You will probably need to install it or some"
3845 $echo "*** library that it depends on before this library will be fully"
3846 $echo "*** functional. Installing it before continuing would be even better."
3847 fi
3848 else
3849 newdeplibs="$newdeplibs $i"
3850 fi
3851 done
3852 fi
3853 ;;
3854 file_magic*)
3855 set dummy $deplibs_check_method
3856 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3857 for a_deplib in $deplibs; do
3858 name=`expr $a_deplib : '-l\(.*\)'`
3859 # If $name is empty we are operating on a -L argument.
3860 if test "$name" != "" && test "$name" != "0"; then
3861 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3862 case " $predeps $postdeps " in
3863 *" $a_deplib "*)
3864 newdeplibs="$newdeplibs $a_deplib"
3865 a_deplib=""
3866 ;;
3867 esac
3868 fi
3869 if test -n "$a_deplib" ; then
3870 libname=`eval \\$echo \"$libname_spec\"`
3871 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3872 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3873 for potent_lib in $potential_libs; do
3874 # Follow soft links.
3875 if ls -lLd "$potent_lib" 2>/dev/null \
3876 | grep " -> " >/dev/null; then
3877 continue
3878 fi
3879 # The statement above tries to avoid entering an
3880 # endless loop below, in case of cyclic links.
3881 # We might still enter an endless loop, since a link
3882 # loop can be closed while we follow links,
3883 # but so what?
3884 potlib="$potent_lib"
3885 while test -h "$potlib" 2>/dev/null; do
3886 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3887 case $potliblink in
3888 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3889 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3890 esac
3891 done
3892 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3893 | ${SED} 10q \
3894 | $EGREP "$file_magic_regex" > /dev/null; then
3895 newdeplibs="$newdeplibs $a_deplib"
3896 a_deplib=""
3897 break 2
3898 fi
3899 done
3900 done
3901 fi
3902 if test -n "$a_deplib" ; then
3903 droppeddeps=yes
3904 $echo
3905 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3906 $echo "*** I have the capability to make that library automatically link in when"
3907 $echo "*** you link to this library. But I can only do this if you have a"
3908 $echo "*** shared version of the library, which you do not appear to have"
3909 $echo "*** because I did check the linker path looking for a file starting"
3910 if test -z "$potlib" ; then
3911 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3912 else
3913 $echo "*** with $libname and none of the candidates passed a file format test"
3914 $echo "*** using a file magic. Last file checked: $potlib"
3915 fi
3916 fi
3917 else
3918 # Add a -L argument.
3919 newdeplibs="$newdeplibs $a_deplib"
3920 fi
3921 done # Gone through all deplibs.
3922 ;;
3923 match_pattern*)
3924 set dummy $deplibs_check_method
3925 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3926 for a_deplib in $deplibs; do
3927 name=`expr $a_deplib : '-l\(.*\)'`
3928 # If $name is empty we are operating on a -L argument.
3929 if test -n "$name" && test "$name" != "0"; then
3930 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3931 case " $predeps $postdeps " in
3932 *" $a_deplib "*)
3933 newdeplibs="$newdeplibs $a_deplib"
3934 a_deplib=""
3935 ;;
3936 esac
3937 fi
3938 if test -n "$a_deplib" ; then
3939 libname=`eval \\$echo \"$libname_spec\"`
3940 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3941 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3942 for potent_lib in $potential_libs; do
3943 potlib="$potent_lib" # see symlink-check above in file_magic test
3944 if eval $echo \"$potent_lib\" 2>/dev/null \
3945 | ${SED} 10q \
3946 | $EGREP "$match_pattern_regex" > /dev/null; then
3947 newdeplibs="$newdeplibs $a_deplib"
3948 a_deplib=""
3949 break 2
3950 fi
3951 done
3952 done
3953 fi
3954 if test -n "$a_deplib" ; then
3955 droppeddeps=yes
3956 $echo
3957 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3958 $echo "*** I have the capability to make that library automatically link in when"
3959 $echo "*** you link to this library. But I can only do this if you have a"
3960 $echo "*** shared version of the library, which you do not appear to have"
3961 $echo "*** because I did check the linker path looking for a file starting"
3962 if test -z "$potlib" ; then
3963 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3964 else
3965 $echo "*** with $libname and none of the candidates passed a file format test"
3966 $echo "*** using a regex pattern. Last file checked: $potlib"
3967 fi
3968 fi
3969 else
3970 # Add a -L argument.
3971 newdeplibs="$newdeplibs $a_deplib"
3972 fi
3973 done # Gone through all deplibs.
3974 ;;
3975 none | unknown | *)
3976 newdeplibs=""
3977 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3978 -e 's/ -[LR][^ ]*//g'`
3979 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3980 for i in $predeps $postdeps ; do
3981 # can't use Xsed below, because $i might contain '/'
3982 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3983 done
3984 fi
3985 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3986 | grep . >/dev/null; then
3987 $echo
3988 if test "X$deplibs_check_method" = "Xnone"; then
3989 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3990 else
3991 $echo "*** Warning: inter-library dependencies are not known to be supported."
3992 fi
3993 $echo "*** All declared inter-library dependencies are being dropped."
3994 droppeddeps=yes
3995 fi
3996 ;;
3997 esac
3998 versuffix=$versuffix_save
3999 major=$major_save
4000 release=$release_save
4001 libname=$libname_save
4002 name=$name_save
4003
4004 case $host in
4005 *-*-rhapsody* | *-*-darwin1.[012])
4006 # On Rhapsody replace the C library is the System framework
4007 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
4008 ;;
4009 esac
4010
4011 if test "$droppeddeps" = yes; then
4012 if test "$module" = yes; then
4013 $echo
4014 $echo "*** Warning: libtool could not satisfy all declared inter-library"
4015 $echo "*** dependencies of module $libname. Therefore, libtool will create"
4016 $echo "*** a static module, that should work as long as the dlopening"
4017 $echo "*** application is linked with the -dlopen flag."
4018 if test -z "$global_symbol_pipe"; then
4019 $echo
4020 $echo "*** However, this would only work if libtool was able to extract symbol"
4021 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
4022 $echo "*** not find such a program. So, this module is probably useless."
4023 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
4024 fi
4025 if test "$build_old_libs" = no; then
4026 oldlibs="$output_objdir/$libname.$libext"
4027 build_libtool_libs=module
4028 build_old_libs=yes
4029 else
4030 build_libtool_libs=no
4031 fi
4032 else
4033 $echo "*** The inter-library dependencies that have been dropped here will be"
4034 $echo "*** automatically added whenever a program is linked with this library"
4035 $echo "*** or is declared to -dlopen it."
4036
4037 if test "$allow_undefined" = no; then
4038 $echo
4039 $echo "*** Since this library must not contain undefined symbols,"
4040 $echo "*** because either the platform does not support them or"
4041 $echo "*** it was explicitly requested with -no-undefined,"
4042 $echo "*** libtool will only create a static version of it."
4043 if test "$build_old_libs" = no; then
4044 oldlibs="$output_objdir/$libname.$libext"
4045 build_libtool_libs=module
4046 build_old_libs=yes
4047 else
4048 build_libtool_libs=no
4049 fi
4050 fi
4051 fi
4052 fi
4053 # Done checking deplibs!
4054 deplibs=$newdeplibs
4055 fi
4056
4057 # All the library-specific variables (install_libdir is set above).
4058 library_names=
4059 old_library=
4060 dlname=
4061
4062 # Test again, we may have decided not to build it any more
4063 if test "$build_libtool_libs" = yes; then
4064 if test "$hardcode_into_libs" = yes; then
4065 # Hardcode the library paths
4066 hardcode_libdirs=
4067 dep_rpath=
4068 rpath="$finalize_rpath"
4069 test "$mode" != relink && rpath="$compile_rpath$rpath"
4070 for libdir in $rpath; do
4071 if test -n "$hardcode_libdir_flag_spec"; then
4072 if test -n "$hardcode_libdir_separator"; then
4073 if test -z "$hardcode_libdirs"; then
4074 hardcode_libdirs="$libdir"
4075 else
4076 # Just accumulate the unique libdirs.
4077 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4078 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4079 ;;
4080 *)
4081 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4082 ;;
4083 esac
4084 fi
4085 else
4086 eval flag=\"$hardcode_libdir_flag_spec\"
4087 dep_rpath="$dep_rpath $flag"
4088 fi
4089 elif test -n "$runpath_var"; then
4090 case "$perm_rpath " in
4091 *" $libdir "*) ;;
4092 *) perm_rpath="$perm_rpath $libdir" ;;
4093 esac
4094 fi
4095 done
4096 # Substitute the hardcoded libdirs into the rpath.
4097 if test -n "$hardcode_libdir_separator" &&
4098 test -n "$hardcode_libdirs"; then
4099 libdir="$hardcode_libdirs"
4100 if test -n "$hardcode_libdir_flag_spec_ld"; then
4101 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
4102 else
4103 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
4104 fi
4105 fi
4106 if test -n "$runpath_var" && test -n "$perm_rpath"; then
4107 # We should set the runpath_var.
4108 rpath=
4109 for dir in $perm_rpath; do
4110 rpath="$rpath$dir:"
4111 done
4112 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
4113 fi
4114 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
4115 fi
4116
4117 shlibpath="$finalize_shlibpath"
4118 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
4119 if test -n "$shlibpath"; then
4120 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
4121 fi
4122
4123 # Get the real and link names of the library.
4124 eval shared_ext=\"$shrext_cmds\"
4125 eval library_names=\"$library_names_spec\"
4126 set dummy $library_names
4127 realname="$2"
4128 shift; shift
4129
4130 if test -n "$soname_spec"; then
4131 eval soname=\"$soname_spec\"
4132 else
4133 soname="$realname"
4134 fi
4135 if test -z "$dlname"; then
4136 dlname=$soname
4137 fi
4138
4139 lib="$output_objdir/$realname"
4140 for link
4141 do
4142 linknames="$linknames $link"
4143 done
4144
4145 # Use standard objects if they are pic
4146 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4147
4148 # Prepare the list of exported symbols
4149 if test -z "$export_symbols"; then
4150 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4151 $show "generating symbol list for \`$libname.la'"
4152 export_symbols="$output_objdir/$libname.exp"
4153 $run $rm $export_symbols
4154 cmds=$export_symbols_cmds
4155 save_ifs="$IFS"; IFS='~'
4156 for cmd in $cmds; do
4157 IFS="$save_ifs"
4158 eval cmd=\"$cmd\"
4159 if len=`expr "X$cmd" : ".*"` &&
4160 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4161 $show "$cmd"
4162 $run eval "$cmd" || exit $?
4163 skipped_export=false
4164 else
4165 # The command line is too long to execute in one step.
4166 $show "using reloadable object file for export list..."
4167 skipped_export=:
4168 # Break out early, otherwise skipped_export may be
4169 # set to false by a later but shorter cmd.
4170 break
4171 fi
4172 done
4173 IFS="$save_ifs"
4174 if test -n "$export_symbols_regex"; then
4175 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4176 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4177 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4178 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4179 fi
4180 fi
4181 fi
4182
4183 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4184 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4185 fi
4186
4187 tmp_deplibs=
4188 for test_deplib in $deplibs; do
4189 case " $convenience " in
4190 *" $test_deplib "*) ;;
4191 *)
4192 tmp_deplibs="$tmp_deplibs $test_deplib"
4193 ;;
4194 esac
4195 done
4196 deplibs="$tmp_deplibs"
4197
4198 if test -n "$convenience"; then
4199 if test -n "$whole_archive_flag_spec"; then
4200 save_libobjs=$libobjs
4201 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4202 else
4203 gentop="$output_objdir/${outputname}x"
4204 generated="$generated $gentop"
4205
4206 func_extract_archives $gentop $convenience
4207 libobjs="$libobjs $func_extract_archives_result"
4208 fi
4209 fi
4210
4211 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4212 eval flag=\"$thread_safe_flag_spec\"
4213 linker_flags="$linker_flags $flag"
4214 fi
4215
4216 # Make a backup of the uninstalled library when relinking
4217 if test "$mode" = relink; then
4218 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4219 fi
4220
4221 # Do each of the archive commands.
4222 if test "$module" = yes && test -n "$module_cmds" ; then
4223 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4224 eval test_cmds=\"$module_expsym_cmds\"
4225 cmds=$module_expsym_cmds
4226 else
4227 eval test_cmds=\"$module_cmds\"
4228 cmds=$module_cmds
4229 fi
4230 else
4231 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4232 eval test_cmds=\"$archive_expsym_cmds\"
4233 cmds=$archive_expsym_cmds
4234 else
4235 eval test_cmds=\"$archive_cmds\"
4236 cmds=$archive_cmds
4237 fi
4238 fi
4239
4240 if test "X$skipped_export" != "X:" &&
4241 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4242 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4243 :
4244 else
4245 # The command line is too long to link in one step, link piecewise.
4246 $echo "creating reloadable object files..."
4247
4248 # Save the value of $output and $libobjs because we want to
4249 # use them later. If we have whole_archive_flag_spec, we
4250 # want to use save_libobjs as it was before
4251 # whole_archive_flag_spec was expanded, because we can't
4252 # assume the linker understands whole_archive_flag_spec.
4253 # This may have to be revisited, in case too many
4254 # convenience libraries get linked in and end up exceeding
4255 # the spec.
4256 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4257 save_libobjs=$libobjs
4258 fi
4259 save_output=$output
4260 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4261
4262 # Clear the reloadable object creation command queue and
4263 # initialize k to one.
4264 test_cmds=
4265 concat_cmds=
4266 objlist=
4267 delfiles=
4268 last_robj=
4269 k=1
4270 output=$output_objdir/$output_la-${k}.$objext
4271 # Loop over the list of objects to be linked.
4272 for obj in $save_libobjs
4273 do
4274 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4275 if test "X$objlist" = X ||
4276 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4277 test "$len" -le "$max_cmd_len"; }; then
4278 objlist="$objlist $obj"
4279 else
4280 # The command $test_cmds is almost too long, add a
4281 # command to the queue.
4282 if test "$k" -eq 1 ; then
4283 # The first file doesn't have a previous command to add.
4284 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4285 else
4286 # All subsequent reloadable object files will link in
4287 # the last one created.
4288 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4289 fi
4290 last_robj=$output_objdir/$output_la-${k}.$objext
4291 k=`expr $k + 1`
4292 output=$output_objdir/$output_la-${k}.$objext
4293 objlist=$obj
4294 len=1
4295 fi
4296 done
4297 # Handle the remaining objects by creating one last
4298 # reloadable object file. All subsequent reloadable object
4299 # files will link in the last one created.
4300 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4301 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4302
4303 if ${skipped_export-false}; then
4304 $show "generating symbol list for \`$libname.la'"
4305 export_symbols="$output_objdir/$libname.exp"
4306 $run $rm $export_symbols
4307 libobjs=$output
4308 # Append the command to create the export file.
4309 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4310 fi
4311
4312 # Set up a command to remove the reloadable object files
4313 # after they are used.
4314 i=0
4315 while test "$i" -lt "$k"
4316 do
4317 i=`expr $i + 1`
4318 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4319 done
4320
4321 $echo "creating a temporary reloadable object file: $output"
4322
4323 # Loop through the commands generated above and execute them.
4324 save_ifs="$IFS"; IFS='~'
4325 for cmd in $concat_cmds; do
4326 IFS="$save_ifs"
4327 $show "$cmd"
4328 $run eval "$cmd" || exit $?
4329 done
4330 IFS="$save_ifs"
4331
4332 libobjs=$output
4333 # Restore the value of output.
4334 output=$save_output
4335
4336 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4337 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4338 fi
4339 # Expand the library linking commands again to reset the
4340 # value of $libobjs for piecewise linking.
4341
4342 # Do each of the archive commands.
4343 if test "$module" = yes && test -n "$module_cmds" ; then
4344 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4345 cmds=$module_expsym_cmds
4346 else
4347 cmds=$module_cmds
4348 fi
4349 else
4350 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4351 cmds=$archive_expsym_cmds
4352 else
4353 cmds=$archive_cmds
4354 fi
4355 fi
4356
4357 # Append the command to remove the reloadable object files
4358 # to the just-reset $cmds.
4359 eval cmds=\"\$cmds~\$rm $delfiles\"
4360 fi
4361 save_ifs="$IFS"; IFS='~'
4362 for cmd in $cmds; do
4363 IFS="$save_ifs"
4364 eval cmd=\"$cmd\"
4365 $show "$cmd"
4366 $run eval "$cmd" || {
4367 lt_exit=$?
4368
4369 # Restore the uninstalled library and exit
4370 if test "$mode" = relink; then
4371 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4372 fi
4373
4374 exit $lt_exit
4375 }
4376 done
4377 IFS="$save_ifs"
4378
4379 # Restore the uninstalled library and exit
4380 if test "$mode" = relink; then
4381 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4382
4383 if test -n "$convenience"; then
4384 if test -z "$whole_archive_flag_spec"; then
4385 $show "${rm}r $gentop"
4386 $run ${rm}r "$gentop"
4387 fi
4388 fi
4389
4390 exit $EXIT_SUCCESS
4391 fi
4392
4393 # Create links to the real library.
4394 for linkname in $linknames; do
4395 if test "$realname" != "$linkname"; then
4396 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4397 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4398 fi
4399 done
4400
4401 # If -module or -export-dynamic was specified, set the dlname.
4402 if test "$module" = yes || test "$export_dynamic" = yes; then
4403 # On all known operating systems, these are identical.
4404 dlname="$soname"
4405 fi
4406 fi
4407 ;;
4408
4409 obj)
4410 if test -n "$deplibs"; then
4411 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4412 fi
4413
4414 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4415 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4416 fi
4417
4418 if test -n "$rpath"; then
4419 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4420 fi
4421
4422 if test -n "$xrpath"; then
4423 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4424 fi
4425
4426 if test -n "$vinfo"; then
4427 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4428 fi
4429
4430 if test -n "$release"; then
4431 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4432 fi
4433
4434 case $output in
4435 *.lo)
4436 if test -n "$objs$old_deplibs"; then
4437 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4438 exit $EXIT_FAILURE
4439 fi
4440 libobj="$output"
4441 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4442 ;;
4443 *)
4444 libobj=
4445 obj="$output"
4446 ;;
4447 esac
4448
4449 # Delete the old objects.
4450 $run $rm $obj $libobj
4451
4452 # Objects from convenience libraries. This assumes
4453 # single-version convenience libraries. Whenever we create
4454 # different ones for PIC/non-PIC, this we'll have to duplicate
4455 # the extraction.
4456 reload_conv_objs=
4457 gentop=
4458 # reload_cmds runs $LD directly, so let us get rid of
4459 # -Wl from whole_archive_flag_spec
4460 wl=
4461
4462 if test -n "$convenience"; then
4463 if test -n "$whole_archive_flag_spec"; then
4464 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4465 else
4466 gentop="$output_objdir/${obj}x"
4467 generated="$generated $gentop"
4468
4469 func_extract_archives $gentop $convenience
4470 reload_conv_objs="$reload_objs $func_extract_archives_result"
4471 fi
4472 fi
4473
4474 # Create the old-style object.
4475 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
4476
4477 output="$obj"
4478 cmds=$reload_cmds
4479 save_ifs="$IFS"; IFS='~'
4480 for cmd in $cmds; do
4481 IFS="$save_ifs"
4482 eval cmd=\"$cmd\"
4483 $show "$cmd"
4484 $run eval "$cmd" || exit $?
4485 done
4486 IFS="$save_ifs"
4487
4488 # Exit if we aren't doing a library object file.
4489 if test -z "$libobj"; then
4490 if test -n "$gentop"; then
4491 $show "${rm}r $gentop"
4492 $run ${rm}r $gentop
4493 fi
4494
4495 exit $EXIT_SUCCESS
4496 fi
4497
4498 if test "$build_libtool_libs" != yes; then
4499 if test -n "$gentop"; then
4500 $show "${rm}r $gentop"
4501 $run ${rm}r $gentop
4502 fi
4503
4504 # Create an invalid libtool object if no PIC, so that we don't
4505 # accidentally link it into a program.
4506 # $show "echo timestamp > $libobj"
4507 # $run eval "echo timestamp > $libobj" || exit $?
4508 exit $EXIT_SUCCESS
4509 fi
4510
4511 if test -n "$pic_flag" || test "$pic_mode" != default; then
4512 # Only do commands if we really have different PIC objects.
4513 reload_objs="$libobjs $reload_conv_objs"
4514 output="$libobj"
4515 cmds=$reload_cmds
4516 save_ifs="$IFS"; IFS='~'
4517 for cmd in $cmds; do
4518 IFS="$save_ifs"
4519 eval cmd=\"$cmd\"
4520 $show "$cmd"
4521 $run eval "$cmd" || exit $?
4522 done
4523 IFS="$save_ifs"
4524 fi
4525
4526 if test -n "$gentop"; then
4527 $show "${rm}r $gentop"
4528 $run ${rm}r $gentop
4529 fi
4530
4531 exit $EXIT_SUCCESS
4532 ;;
4533
4534 prog)
4535 case $host in
4536 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4537 esac
4538 if test -n "$vinfo"; then
4539 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4540 fi
4541
4542 if test -n "$release"; then
4543 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4544 fi
4545
4546 if test "$preload" = yes; then
4547 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4548 test "$dlopen_self_static" = unknown; then
4549 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4550 fi
4551 fi
4552
4553 case $host in
4554 *-*-rhapsody* | *-*-darwin1.[012])
4555 # On Rhapsody replace the C library is the System framework
4556 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4557 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4558 ;;
4559 esac
4560
4561 case $host in
4562 *darwin*)
4563 # Don't allow lazy linking, it breaks C++ global constructors
4564 if test "$tagname" = CXX ; then
4565 compile_command="$compile_command ${wl}-bind_at_load"
4566 finalize_command="$finalize_command ${wl}-bind_at_load"
4567 fi
4568 ;;
4569 esac
4570
4571 compile_command="$compile_command $compile_deplibs"
4572 finalize_command="$finalize_command $finalize_deplibs"
4573
4574 if test -n "$rpath$xrpath"; then
4575 # If the user specified any rpath flags, then add them.
4576 for libdir in $rpath $xrpath; do
4577 # This is the magic to use -rpath.
4578 case "$finalize_rpath " in
4579 *" $libdir "*) ;;
4580 *) finalize_rpath="$finalize_rpath $libdir" ;;
4581 esac
4582 done
4583 fi
4584
4585 # Now hardcode the library paths
4586 rpath=
4587 hardcode_libdirs=
4588 for libdir in $compile_rpath $finalize_rpath; do
4589 if test -n "$hardcode_libdir_flag_spec"; then
4590 if test -n "$hardcode_libdir_separator"; then
4591 if test -z "$hardcode_libdirs"; then
4592 hardcode_libdirs="$libdir"
4593 else
4594 # Just accumulate the unique libdirs.
4595 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4596 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4597 ;;
4598 *)
4599 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4600 ;;
4601 esac
4602 fi
4603 else
4604 eval flag=\"$hardcode_libdir_flag_spec\"
4605 rpath="$rpath $flag"
4606 fi
4607 elif test -n "$runpath_var"; then
4608 case "$perm_rpath " in
4609 *" $libdir "*) ;;
4610 *) perm_rpath="$perm_rpath $libdir" ;;
4611 esac
4612 fi
4613 case $host in
4614 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4615 case :$dllsearchpath: in
4616 *":$libdir:"*) ;;
4617 *) dllsearchpath="$dllsearchpath:$libdir";;
4618 esac
4619 ;;
4620 esac
4621 done
4622 # Substitute the hardcoded libdirs into the rpath.
4623 if test -n "$hardcode_libdir_separator" &&
4624 test -n "$hardcode_libdirs"; then
4625 libdir="$hardcode_libdirs"
4626 eval rpath=\" $hardcode_libdir_flag_spec\"
4627 fi
4628 compile_rpath="$rpath"
4629
4630 rpath=
4631 hardcode_libdirs=
4632 for libdir in $finalize_rpath; do
4633 if test -n "$hardcode_libdir_flag_spec"; then
4634 if test -n "$hardcode_libdir_separator"; then
4635 if test -z "$hardcode_libdirs"; then
4636 hardcode_libdirs="$libdir"
4637 else
4638 # Just accumulate the unique libdirs.
4639 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4640 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4641 ;;
4642 *)
4643 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4644 ;;
4645 esac
4646 fi
4647 else
4648 eval flag=\"$hardcode_libdir_flag_spec\"
4649 rpath="$rpath $flag"
4650 fi
4651 elif test -n "$runpath_var"; then
4652 case "$finalize_perm_rpath " in
4653 *" $libdir "*) ;;
4654 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4655 esac
4656 fi
4657 done
4658 # Substitute the hardcoded libdirs into the rpath.
4659 if test -n "$hardcode_libdir_separator" &&
4660 test -n "$hardcode_libdirs"; then
4661 libdir="$hardcode_libdirs"
4662 eval rpath=\" $hardcode_libdir_flag_spec\"
4663 fi
4664 finalize_rpath="$rpath"
4665
4666 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4667 # Transform all the library objects into standard objects.
4668 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4669 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4670 fi
4671
4672 dlsyms=
4673 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4674 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4675 dlsyms="${outputname}S.c"
4676 else
4677 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4678 fi
4679 fi
4680
4681 if test -n "$dlsyms"; then
4682 case $dlsyms in
4683 "") ;;
4684 *.c)
4685 # Discover the nlist of each of the dlfiles.
4686 nlist="$output_objdir/${outputname}.nm"
4687
4688 $show "$rm $nlist ${nlist}S ${nlist}T"
4689 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4690
4691 # Parse the name list into a source file.
4692 $show "creating $output_objdir/$dlsyms"
4693
4694 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4695/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4696/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4697
4698#ifdef __cplusplus
4699extern \"C\" {
4700#endif
4701
4702/* Prevent the only kind of declaration conflicts we can make. */
4703#define lt_preloaded_symbols some_other_symbol
4704
4705/* External symbol declarations for the compiler. */\
4706"
4707
4708 if test "$dlself" = yes; then
4709 $show "generating symbol list for \`$output'"
4710
4711 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4712
4713 # Add our own program objects to the symbol list.
4714 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4715 for arg in $progfiles; do
4716 $show "extracting global C symbols from \`$arg'"
4717 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4718 done
4719
4720 if test -n "$exclude_expsyms"; then
4721 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4722 $run eval '$mv "$nlist"T "$nlist"'
4723 fi
4724
4725 if test -n "$export_symbols_regex"; then
4726 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4727 $run eval '$mv "$nlist"T "$nlist"'
4728 fi
4729
4730 # Prepare the list of exported symbols
4731 if test -z "$export_symbols"; then
4732 export_symbols="$output_objdir/$outputname.exp"
4733 $run $rm $export_symbols
4734 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4735 else
4736 $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4737 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4738 $run eval 'mv "$nlist"T "$nlist"'
4739 fi
4740 fi
4741
4742 for arg in $dlprefiles; do
4743 $show "extracting global C symbols from \`$arg'"
4744 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4745 $run eval '$echo ": $name " >> "$nlist"'
4746 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4747 done
4748
4749 if test -z "$run"; then
4750 # Make sure we have at least an empty file.
4751 test -f "$nlist" || : > "$nlist"
4752
4753 if test -n "$exclude_expsyms"; then
4754 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4755 $mv "$nlist"T "$nlist"
4756 fi
4757
4758 # Try sorting and uniquifying the output.
4759 if grep -v "^: " < "$nlist" |
4760 if sort -k 3 </dev/null >/dev/null 2>&1; then
4761 sort -k 3
4762 else
4763 sort +2
4764 fi |
4765 uniq > "$nlist"S; then
4766 :
4767 else
4768 grep -v "^: " < "$nlist" > "$nlist"S
4769 fi
4770
4771 if test -f "$nlist"S; then
4772 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4773 else
4774 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4775 fi
4776
4777 $echo >> "$output_objdir/$dlsyms" "\
4778
4779#undef lt_preloaded_symbols
4780
4781#if defined (__STDC__) && __STDC__
4782# define lt_ptr void *
4783#else
4784# define lt_ptr char *
4785# define const
4786#endif
4787
4788/* The mapping between symbol names and symbols. */
4789"
4790
4791 case $host in
4792 *cygwin* | *mingw* )
4793 $echo >> "$output_objdir/$dlsyms" "\
4794/* DATA imports from DLLs on WIN32 can't be const, because
4795 runtime relocations are performed -- see ld's documentation
4796 on pseudo-relocs */
4797struct {
4798"
4799 ;;
4800 * )
4801 $echo >> "$output_objdir/$dlsyms" "\
4802const struct {
4803"
4804 ;;
4805 esac
4806
4807
4808 $echo >> "$output_objdir/$dlsyms" "\
4809 const char *name;
4810 lt_ptr address;
4811}
4812lt_preloaded_symbols[] =
4813{\
4814"
4815
4816 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4817
4818 $echo >> "$output_objdir/$dlsyms" "\
4819 {0, (lt_ptr) 0}
4820};
4821
4822/* This works around a problem in FreeBSD linker */
4823#ifdef FREEBSD_WORKAROUND
4824static const void *lt_preloaded_setup() {
4825 return lt_preloaded_symbols;
4826}
4827#endif
4828
4829#ifdef __cplusplus
4830}
4831#endif\
4832"
4833 fi
4834
4835 pic_flag_for_symtable=
4836 case $host in
4837 # compiling the symbol table file with pic_flag works around
4838 # a FreeBSD bug that causes programs to crash when -lm is
4839 # linked before any other PIC object. But we must not use
4840 # pic_flag when linking with -static. The problem exists in
4841 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4842 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4843 case "$compile_command " in
4844 *" -static "*) ;;
4845 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4846 esac;;
4847 *-*-hpux*)
4848 case "$compile_command " in
4849 *" -static "*) ;;
4850 *) pic_flag_for_symtable=" $pic_flag";;
4851 esac
4852 esac
4853
4854 # Now compile the dynamic symbol file.
4855 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4856 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4857
4858 # Clean up the generated files.
4859 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4860 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4861
4862 # Transform the symbol file into the correct name.
4863 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4864 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4865 ;;
4866 *)
4867 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4868 exit $EXIT_FAILURE
4869 ;;
4870 esac
4871 else
4872 # We keep going just in case the user didn't refer to
4873 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4874 # really was required.
4875
4876 # Nullify the symbol file.
4877 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4878 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4879 fi
4880
4881 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4882 # Replace the output file specification.
4883 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4884 link_command="$compile_command$compile_rpath"
4885
4886 # We have no uninstalled library dependencies, so finalize right now.
4887 $show "$link_command"
4888 $run eval "$link_command"
4889 status=$?
4890
4891 # Delete the generated files.
4892 if test -n "$dlsyms"; then
4893 $show "$rm $output_objdir/${outputname}S.${objext}"
4894 $run $rm "$output_objdir/${outputname}S.${objext}"
4895 fi
4896
4897 exit $status
4898 fi
4899
4900 if test -n "$shlibpath_var"; then
4901 # We should set the shlibpath_var
4902 rpath=
4903 for dir in $temp_rpath; do
4904 case $dir in
4905 [\\/]* | [A-Za-z]:[\\/]*)
4906 # Absolute path.
4907 rpath="$rpath$dir:"
4908 ;;
4909 *)
4910 # Relative path: add a thisdir entry.
4911 rpath="$rpath\$thisdir/$dir:"
4912 ;;
4913 esac
4914 done
4915 temp_rpath="$rpath"
4916 fi
4917
4918 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4919 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4920 fi
4921 if test -n "$finalize_shlibpath"; then
4922 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4923 fi
4924
4925 compile_var=
4926 finalize_var=
4927 if test -n "$runpath_var"; then
4928 if test -n "$perm_rpath"; then
4929 # We should set the runpath_var.
4930 rpath=
4931 for dir in $perm_rpath; do
4932 rpath="$rpath$dir:"
4933 done
4934 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4935 fi
4936 if test -n "$finalize_perm_rpath"; then
4937 # We should set the runpath_var.
4938 rpath=
4939 for dir in $finalize_perm_rpath; do
4940 rpath="$rpath$dir:"
4941 done
4942 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4943 fi
4944 fi
4945
4946 if test "$no_install" = yes; then
4947 # We don't need to create a wrapper script.
4948 link_command="$compile_var$compile_command$compile_rpath"
4949 # Replace the output file specification.
4950 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4951 # Delete the old output file.
4952 $run $rm $output
4953 # Link the executable and exit
4954 $show "$link_command"
4955 $run eval "$link_command" || exit $?
4956 exit $EXIT_SUCCESS
4957 fi
4958
4959 if test "$hardcode_action" = relink; then
4960 # Fast installation is not supported
4961 link_command="$compile_var$compile_command$compile_rpath"
4962 relink_command="$finalize_var$finalize_command$finalize_rpath"
4963
4964 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4965 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4966 else
4967 if test "$fast_install" != no; then
4968 link_command="$finalize_var$compile_command$finalize_rpath"
4969 if test "$fast_install" = yes; then
4970 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4971 else
4972 # fast_install is set to needless
4973 relink_command=
4974 fi
4975 else
4976 link_command="$compile_var$compile_command$compile_rpath"
4977 relink_command="$finalize_var$finalize_command$finalize_rpath"
4978 fi
4979 fi
4980
4981 # Replace the output file specification.
4982 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4983
4984 # Delete the old output files.
4985 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4986
4987 $show "$link_command"
4988 $run eval "$link_command" || exit $?
4989
4990 # Now create the wrapper script.
4991 $show "creating $output"
4992
4993 # Quote the relink command for shipping.
4994 if test -n "$relink_command"; then
4995 # Preserve any variables that may affect compiler behavior
4996 for var in $variables_saved_for_relink; do
4997 if eval test -z \"\${$var+set}\"; then
4998 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4999 elif eval var_value=\$$var; test -z "$var_value"; then
5000 relink_command="$var=; export $var; $relink_command"
5001 else
5002 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5003 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5004 fi
5005 done
5006 relink_command="(cd `pwd`; $relink_command)"
5007 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5008 fi
5009
5010 # Quote $echo for shipping.
5011 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
5012 case $progpath in
5013 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
5014 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
5015 esac
5016 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
5017 else
5018 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
5019 fi
5020
5021 # Only actually do things if our run command is non-null.
5022 if test -z "$run"; then
5023 # win32 will think the script is a binary if it has
5024 # a .exe suffix, so we strip it off here.
5025 case $output in
5026 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
5027 esac
5028 # test for cygwin because mv fails w/o .exe extensions
5029 case $host in
5030 *cygwin*)
5031 exeext=.exe
5032 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
5033 *) exeext= ;;
5034 esac
5035 case $host in
5036 *cygwin* | *mingw* )
5037 cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
5038 cwrapper=`$echo ${output}.exe`
5039 $rm $cwrappersource $cwrapper
5040 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
5041
5042 cat > $cwrappersource <<EOF
5043
5044/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5045 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5046
5047 The $output program cannot be directly executed until all the libtool
5048 libraries that it depends on are installed.
5049
5050 This wrapper executable should never be moved out of the build directory.
5051 If it is, it will not operate correctly.
5052
5053 Currently, it simply execs the wrapper *script* "/bin/sh $output",
5054 but could eventually absorb all of the scripts functionality and
5055 exec $objdir/$outputname directly.
5056*/
5057EOF
5058 cat >> $cwrappersource<<"EOF"
5059#include <stdio.h>
5060#include <stdlib.h>
5061#include <unistd.h>
5062#include <malloc.h>
5063#include <stdarg.h>
5064#include <assert.h>
5065
5066#if defined(PATH_MAX)
5067# define LT_PATHMAX PATH_MAX
5068#elif defined(MAXPATHLEN)
5069# define LT_PATHMAX MAXPATHLEN
5070#else
5071# define LT_PATHMAX 1024
5072#endif
5073
5074#ifndef DIR_SEPARATOR
5075#define DIR_SEPARATOR '/'
5076#endif
5077
5078#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5079 defined (__OS2__)
5080#define HAVE_DOS_BASED_FILE_SYSTEM
5081#ifndef DIR_SEPARATOR_2
5082#define DIR_SEPARATOR_2 '\\'
5083#endif
5084#endif
5085
5086#ifndef DIR_SEPARATOR_2
5087# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5088#else /* DIR_SEPARATOR_2 */
5089# define IS_DIR_SEPARATOR(ch) \
5090 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5091#endif /* DIR_SEPARATOR_2 */
5092
5093#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5094#define XFREE(stale) do { \
5095 if (stale) { free ((void *) stale); stale = 0; } \
5096} while (0)
5097
5098const char *program_name = NULL;
5099
5100void * xmalloc (size_t num);
5101char * xstrdup (const char *string);
5102char * basename (const char *name);
5103char * fnqualify(const char *path);
5104char * strendzap(char *str, const char *pat);
5105void lt_fatal (const char *message, ...);
5106
5107int
5108main (int argc, char *argv[])
5109{
5110 char **newargz;
5111 int i;
5112
5113 program_name = (char *) xstrdup ((char *) basename (argv[0]));
5114 newargz = XMALLOC(char *, argc+2);
5115EOF
5116
5117 cat >> $cwrappersource <<EOF
5118 newargz[0] = "$SHELL";
5119EOF
5120
5121 cat >> $cwrappersource <<"EOF"
5122 newargz[1] = fnqualify(argv[0]);
5123 /* we know the script has the same name, without the .exe */
5124 /* so make sure newargz[1] doesn't end in .exe */
5125 strendzap(newargz[1],".exe");
5126 for (i = 1; i < argc; i++)
5127 newargz[i+1] = xstrdup(argv[i]);
5128 newargz[argc+1] = NULL;
5129EOF
5130
5131 cat >> $cwrappersource <<EOF
5132 execv("$SHELL",newargz);
5133EOF
5134
5135 cat >> $cwrappersource <<"EOF"
5136 return 127;
5137}
5138
5139void *
5140xmalloc (size_t num)
5141{
5142 void * p = (void *) malloc (num);
5143 if (!p)
5144 lt_fatal ("Memory exhausted");
5145
5146 return p;
5147}
5148
5149char *
5150xstrdup (const char *string)
5151{
5152 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5153;
5154}
5155
5156char *
5157basename (const char *name)
5158{
5159 const char *base;
5160
5161#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5162 /* Skip over the disk name in MSDOS pathnames. */
5163 if (isalpha (name[0]) && name[1] == ':')
5164 name += 2;
5165#endif
5166
5167 for (base = name; *name; name++)
5168 if (IS_DIR_SEPARATOR (*name))
5169 base = name + 1;
5170 return (char *) base;
5171}
5172
5173char *
5174fnqualify(const char *path)
5175{
5176 size_t size;
5177 char *p;
5178 char tmp[LT_PATHMAX + 1];
5179
5180 assert(path != NULL);
5181
5182 /* Is it qualified already? */
5183#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5184 if (isalpha (path[0]) && path[1] == ':')
5185 return xstrdup (path);
5186#endif
5187 if (IS_DIR_SEPARATOR (path[0]))
5188 return xstrdup (path);
5189
5190 /* prepend the current directory */
5191 /* doesn't handle '~' */
5192 if (getcwd (tmp, LT_PATHMAX) == NULL)
5193 lt_fatal ("getcwd failed");
5194 size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
5195 p = XMALLOC(char, size);
5196 sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
5197 return p;
5198}
5199
5200char *
5201strendzap(char *str, const char *pat)
5202{
5203 size_t len, patlen;
5204
5205 assert(str != NULL);
5206 assert(pat != NULL);
5207
5208 len = strlen(str);
5209 patlen = strlen(pat);
5210
5211 if (patlen <= len)
5212 {
5213 str += len - patlen;
5214 if (strcmp(str, pat) == 0)
5215 *str = '\0';
5216 }
5217 return str;
5218}
5219
5220static void
5221lt_error_core (int exit_status, const char * mode,
5222 const char * message, va_list ap)
5223{
5224 fprintf (stderr, "%s: %s: ", program_name, mode);
5225 vfprintf (stderr, message, ap);
5226 fprintf (stderr, ".\n");
5227
5228 if (exit_status >= 0)
5229 exit (exit_status);
5230}
5231
5232void
5233lt_fatal (const char *message, ...)
5234{
5235 va_list ap;
5236 va_start (ap, message);
5237 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5238 va_end (ap);
5239}
5240EOF
5241 # we should really use a build-platform specific compiler
5242 # here, but OTOH, the wrappers (shell script and this C one)
5243 # are only useful if you want to execute the "real" binary.
5244 # Since the "real" binary is built for $host, then this
5245 # wrapper might as well be built for $host, too.
5246 $run $LTCC -s -o $cwrapper $cwrappersource
5247 ;;
5248 esac
5249 $rm $output
5250 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5251
5252 $echo > $output "\
5253#! $SHELL
5254
5255# $output - temporary wrapper script for $objdir/$outputname
5256# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5257#
5258# The $output program cannot be directly executed until all the libtool
5259# libraries that it depends on are installed.
5260#
5261# This wrapper script should never be moved out of the build directory.
5262# If it is, it will not operate correctly.
5263
5264# Sed substitution that helps us do robust quoting. It backslashifies
5265# metacharacters that are still active within double-quoted strings.
5266Xsed='${SED} -e 1s/^X//'
5267sed_quote_subst='$sed_quote_subst'
5268
5269# The HP-UX ksh and POSIX shell print the target directory to stdout
5270# if CDPATH is set.
5271(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5272
5273relink_command=\"$relink_command\"
5274
5275# This environment variable determines our operation mode.
5276if test \"\$libtool_install_magic\" = \"$magic\"; then
5277 # install mode needs the following variable:
5278 notinst_deplibs='$notinst_deplibs'
5279else
5280 # When we are sourced in execute mode, \$file and \$echo are already set.
5281 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5282 echo=\"$qecho\"
5283 file=\"\$0\"
5284 # Make sure echo works.
5285 if test \"X\$1\" = X--no-reexec; then
5286 # Discard the --no-reexec flag, and continue.
5287 shift
5288 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5289 # Yippee, \$echo works!
5290 :
5291 else
5292 # Restart under the correct shell, and then maybe \$echo will work.
5293 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5294 fi
5295 fi\
5296"
5297 $echo >> $output "\
5298
5299 # Find the directory that this script lives in.
5300 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5301 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5302
5303 # Follow symbolic links until we get to the real thisdir.
5304 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5305 while test -n \"\$file\"; do
5306 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5307
5308 # If there was a directory component, then change thisdir.
5309 if test \"x\$destdir\" != \"x\$file\"; then
5310 case \"\$destdir\" in
5311 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5312 *) thisdir=\"\$thisdir/\$destdir\" ;;
5313 esac
5314 fi
5315
5316 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5317 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5318 done
5319
5320 # Try to get the absolute directory name.
5321 absdir=\`cd \"\$thisdir\" && pwd\`
5322 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5323"
5324
5325 if test "$fast_install" = yes; then
5326 $echo >> $output "\
5327 program=lt-'$outputname'$exeext
5328 progdir=\"\$thisdir/$objdir\"
5329
5330 if test ! -f \"\$progdir/\$program\" || \\
5331 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5332 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5333
5334 file=\"\$\$-\$program\"
5335
5336 if test ! -d \"\$progdir\"; then
5337 $mkdir \"\$progdir\"
5338 else
5339 $rm \"\$progdir/\$file\"
5340 fi"
5341
5342 $echo >> $output "\
5343
5344 # relink executable if necessary
5345 if test -n \"\$relink_command\"; then
5346 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5347 else
5348 $echo \"\$relink_command_output\" >&2
5349 $rm \"\$progdir/\$file\"
5350 exit $EXIT_FAILURE
5351 fi
5352 fi
5353
5354 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5355 { $rm \"\$progdir/\$program\";
5356 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5357 $rm \"\$progdir/\$file\"
5358 fi"
5359 else
5360 $echo >> $output "\
5361 program='$outputname'
5362 progdir=\"\$thisdir/$objdir\"
5363"
5364 fi
5365
5366 $echo >> $output "\
5367
5368 if test -f \"\$progdir/\$program\"; then"
5369
5370 # Export our shlibpath_var if we have one.
5371 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5372 $echo >> $output "\
5373 # Add our own library path to $shlibpath_var
5374 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5375
5376 # Some systems cannot cope with colon-terminated $shlibpath_var
5377 # The second colon is a workaround for a bug in BeOS R4 sed
5378 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5379
5380 export $shlibpath_var
5381"
5382 fi
5383
5384 # fixup the dll searchpath if we need to.
5385 if test -n "$dllsearchpath"; then
5386 $echo >> $output "\
5387 # Add the dll search path components to the executable PATH
5388 PATH=$dllsearchpath:\$PATH
5389"
5390 fi
5391
5392 $echo >> $output "\
5393 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5394 # Run the actual program with our arguments.
5395"
5396 case $host in
5397 # Backslashes separate directories on plain windows
5398 *-*-mingw | *-*-os2*)
5399 $echo >> $output "\
5400 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5401"
5402 ;;
5403
5404 *)
5405 $echo >> $output "\
5406 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5407"
5408 ;;
5409 esac
5410 $echo >> $output "\
5411 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5412 exit $EXIT_FAILURE
5413 fi
5414 else
5415 # The program doesn't exist.
5416 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5417 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5418 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5419 exit $EXIT_FAILURE
5420 fi
5421fi\
5422"
5423 chmod +x $output
5424 fi
5425 exit $EXIT_SUCCESS
5426 ;;
5427 esac
5428
5429 # See if we need to build an old-fashioned archive.
5430 for oldlib in $oldlibs; do
5431
5432 if test "$build_libtool_libs" = convenience; then
5433 oldobjs="$libobjs_save"
5434 addlibs="$convenience"
5435 build_libtool_libs=no
5436 else
5437 if test "$build_libtool_libs" = module; then
5438 oldobjs="$libobjs_save"
5439 build_libtool_libs=no
5440 else
5441 oldobjs="$old_deplibs $non_pic_objects"
5442 fi
5443 addlibs="$old_convenience"
5444 fi
5445
5446 if test -n "$addlibs"; then
5447 gentop="$output_objdir/${outputname}x"
5448 generated="$generated $gentop"
5449
5450 func_extract_archives $gentop $addlibs
5451 oldobjs="$oldobjs $func_extract_archives_result"
5452 fi
5453
5454 # Do each command in the archive commands.
5455 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5456 cmds=$old_archive_from_new_cmds
5457 else
5458 # POSIX demands no paths to be encoded in archives. We have
5459 # to avoid creating archives with duplicate basenames if we
5460 # might have to extract them afterwards, e.g., when creating a
5461 # static archive out of a convenience library, or when linking
5462 # the entirety of a libtool archive into another (currently
5463 # not supported by libtool).
5464 if (for obj in $oldobjs
5465 do
5466 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5467 done | sort | sort -uc >/dev/null 2>&1); then
5468 :
5469 else
5470 $echo "copying selected object files to avoid basename conflicts..."
5471
5472 if test -z "$gentop"; then
5473 gentop="$output_objdir/${outputname}x"
5474 generated="$generated $gentop"
5475
5476 $show "${rm}r $gentop"
5477 $run ${rm}r "$gentop"
5478 $show "$mkdir $gentop"
5479 $run $mkdir "$gentop"
5480 status=$?
5481 if test "$status" -ne 0 && test ! -d "$gentop"; then
5482 exit $status
5483 fi
5484 fi
5485
5486 save_oldobjs=$oldobjs
5487 oldobjs=
5488 counter=1
5489 for obj in $save_oldobjs
5490 do
5491 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5492 case " $oldobjs " in
5493 " ") oldobjs=$obj ;;
5494 *[\ /]"$objbase "*)
5495 while :; do
5496 # Make sure we don't pick an alternate name that also
5497 # overlaps.
5498 newobj=lt$counter-$objbase
5499 counter=`expr $counter + 1`
5500 case " $oldobjs " in
5501 *[\ /]"$newobj "*) ;;
5502 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5503 esac
5504 done
5505 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5506 $run ln "$obj" "$gentop/$newobj" ||
5507 $run cp "$obj" "$gentop/$newobj"
5508 oldobjs="$oldobjs $gentop/$newobj"
5509 ;;
5510 *) oldobjs="$oldobjs $obj" ;;
5511 esac
5512 done
5513 fi
5514
5515 eval cmds=\"$old_archive_cmds\"
5516
5517 if len=`expr "X$cmds" : ".*"` &&
5518 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5519 cmds=$old_archive_cmds
5520 else
5521 # the command line is too long to link in one step, link in parts
5522 $echo "using piecewise archive linking..."
5523 save_RANLIB=$RANLIB
5524 RANLIB=:
5525 objlist=
5526 concat_cmds=
5527 save_oldobjs=$oldobjs
5528
5529 # Is there a better way of finding the last object in the list?
5530 for obj in $save_oldobjs
5531 do
5532 last_oldobj=$obj
5533 done
5534 for obj in $save_oldobjs
5535 do
5536 oldobjs="$objlist $obj"
5537 objlist="$objlist $obj"
5538 eval test_cmds=\"$old_archive_cmds\"
5539 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5540 test "$len" -le "$max_cmd_len"; then
5541 :
5542 else
5543 # the above command should be used before it gets too long
5544 oldobjs=$objlist
5545 if test "$obj" = "$last_oldobj" ; then
5546 RANLIB=$save_RANLIB
5547 fi
5548 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5549 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5550 objlist=
5551 fi
5552 done
5553 RANLIB=$save_RANLIB
5554 oldobjs=$objlist
5555 if test "X$oldobjs" = "X" ; then
5556 eval cmds=\"\$concat_cmds\"
5557 else
5558 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5559 fi
5560 fi
5561 fi
5562 save_ifs="$IFS"; IFS='~'
5563 for cmd in $cmds; do
5564 eval cmd=\"$cmd\"
5565 IFS="$save_ifs"
5566 $show "$cmd"
5567 $run eval "$cmd" || exit $?
5568 done
5569 IFS="$save_ifs"
5570 done
5571
5572 if test -n "$generated"; then
5573 $show "${rm}r$generated"
5574 $run ${rm}r$generated
5575 fi
5576
5577 # Now create the libtool archive.
5578 case $output in
5579 *.la)
5580 old_library=
5581 test "$build_old_libs" = yes && old_library="$libname.$libext"
5582 $show "creating $output"
5583
5584 # Preserve any variables that may affect compiler behavior
5585 for var in $variables_saved_for_relink; do
5586 if eval test -z \"\${$var+set}\"; then
5587 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5588 elif eval var_value=\$$var; test -z "$var_value"; then
5589 relink_command="$var=; export $var; $relink_command"
5590 else
5591 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5592 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5593 fi
5594 done
5595 # Quote the link command for shipping.
5596 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5597 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5598 if test "$hardcode_automatic" = yes ; then
5599 relink_command=
5600 fi
5601
5602
5603 # Only create the output if not a dry run.
5604 if test -z "$run"; then
5605 for installed in no yes; do
5606 if test "$installed" = yes; then
5607 if test -z "$install_libdir"; then
5608 break
5609 fi
5610 output="$output_objdir/$outputname"i
5611 # Replace all uninstalled libtool libraries with the installed ones
5612 newdependency_libs=
5613 for deplib in $dependency_libs; do
5614 case $deplib in
5615 *.la)
5616 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5617 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5618 if test -z "$libdir"; then
5619 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5620 exit $EXIT_FAILURE
5621 fi
5622 newdependency_libs="$newdependency_libs $libdir/$name"
5623 ;;
5624 *) newdependency_libs="$newdependency_libs $deplib" ;;
5625 esac
5626 done
5627 dependency_libs="$newdependency_libs"
5628 newdlfiles=
5629 for lib in $dlfiles; do
5630 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5631 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5632 if test -z "$libdir"; then
5633 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5634 exit $EXIT_FAILURE
5635 fi
5636 newdlfiles="$newdlfiles $libdir/$name"
5637 done
5638 dlfiles="$newdlfiles"
5639 newdlprefiles=
5640 for lib in $dlprefiles; do
5641 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5642 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5643 if test -z "$libdir"; then
5644 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5645 exit $EXIT_FAILURE
5646 fi
5647 newdlprefiles="$newdlprefiles $libdir/$name"
5648 done
5649 dlprefiles="$newdlprefiles"
5650 else
5651 newdlfiles=
5652 for lib in $dlfiles; do
5653 case $lib in
5654 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5655 *) abs=`pwd`"/$lib" ;;
5656 esac
5657 newdlfiles="$newdlfiles $abs"
5658 done
5659 dlfiles="$newdlfiles"
5660 newdlprefiles=
5661 for lib in $dlprefiles; do
5662 case $lib in
5663 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5664 *) abs=`pwd`"/$lib" ;;
5665 esac
5666 newdlprefiles="$newdlprefiles $abs"
5667 done
5668 dlprefiles="$newdlprefiles"
5669 fi
5670 $rm $output
5671 # place dlname in correct position for cygwin
5672 tdlname=$dlname
5673 case $host,$output,$installed,$module,$dlname in
5674 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5675 esac
5676 $echo > $output "\
5677# $outputname - a libtool library file
5678# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5679#
5680# Please DO NOT delete this file!
5681# It is necessary for linking the library.
5682
5683# The name that we can dlopen(3).
5684dlname='$tdlname'
5685
5686# Names of this library.
5687library_names='$library_names'
5688
5689# The name of the static archive.
5690old_library='$old_library'
5691
5692# Libraries that this one depends upon.
5693dependency_libs='$dependency_libs'
5694
5695# Version information for $libname.
5696current=$current
5697age=$age
5698revision=$revision
5699
5700# Is this an already installed library?
5701installed=$installed
5702
5703# Should we warn about portability when linking against -modules?
5704shouldnotlink=$module
5705
5706# Files to dlopen/dlpreopen
5707dlopen='$dlfiles'
5708dlpreopen='$dlprefiles'
5709
5710# Directory that this library needs to be installed in:
5711libdir='$install_libdir'"
5712 if test "$installed" = no && test "$need_relink" = yes; then
5713 $echo >> $output "\
5714relink_command=\"$relink_command\""
5715 fi
5716 done
5717 fi
5718
5719 # Do a symbolic link so that the libtool archive can be found in
5720 # LD_LIBRARY_PATH before the program is installed.
5721 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5722 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5723 ;;
5724 esac
5725 exit $EXIT_SUCCESS
5726 ;;
5727
5728 # libtool install mode
5729 install)
5730 modename="$modename: install"
5731
5732 # There may be an optional sh(1) argument at the beginning of
5733 # install_prog (especially on Windows NT).
5734 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5735 # Allow the use of GNU shtool's install command.
5736 $echo "X$nonopt" | grep shtool > /dev/null; then
5737 # Aesthetically quote it.
5738 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5739 case $arg in
5740 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5741 arg="\"$arg\""
5742 ;;
5743 esac
5744 install_prog="$arg "
5745 arg="$1"
5746 shift
5747 else
5748 install_prog=
5749 arg=$nonopt
5750 fi
5751
5752 # The real first argument should be the name of the installation program.
5753 # Aesthetically quote it.
5754 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5755 case $arg in
5756 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5757 arg="\"$arg\""
5758 ;;
5759 esac
5760 install_prog="$install_prog$arg"
5761
5762 # We need to accept at least all the BSD install flags.
5763 dest=
5764 files=
5765 opts=
5766 prev=
5767 install_type=
5768 isdir=no
5769 stripme=
5770 for arg
5771 do
5772 if test -n "$dest"; then
5773 files="$files $dest"
5774 dest=$arg
5775 continue
5776 fi
5777
5778 case $arg in
5779 -d) isdir=yes ;;
5780 -f)
5781 case " $install_prog " in
5782 *[\\\ /]cp\ *) ;;
5783 *) prev=$arg ;;
5784 esac
5785 ;;
5786 -g | -m | -o) prev=$arg ;;
5787 -s)
5788 stripme=" -s"
5789 continue
5790 ;;
5791 -*)
5792 ;;
5793 *)
5794 # If the previous option needed an argument, then skip it.
5795 if test -n "$prev"; then
5796 prev=
5797 else
5798 dest=$arg
5799 continue
5800 fi
5801 ;;
5802 esac
5803
5804 # Aesthetically quote the argument.
5805 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5806 case $arg in
5807 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5808 arg="\"$arg\""
5809 ;;
5810 esac
5811 install_prog="$install_prog $arg"
5812 done
5813
5814 if test -z "$install_prog"; then
5815 $echo "$modename: you must specify an install program" 1>&2
5816 $echo "$help" 1>&2
5817 exit $EXIT_FAILURE
5818 fi
5819
5820 if test -n "$prev"; then
5821 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5822 $echo "$help" 1>&2
5823 exit $EXIT_FAILURE
5824 fi
5825
5826 if test -z "$files"; then
5827 if test -z "$dest"; then
5828 $echo "$modename: no file or destination specified" 1>&2
5829 else
5830 $echo "$modename: you must specify a destination" 1>&2
5831 fi
5832 $echo "$help" 1>&2
5833 exit $EXIT_FAILURE
5834 fi
5835
5836 # Strip any trailing slash from the destination.
5837 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5838
5839 # Check to see that the destination is a directory.
5840 test -d "$dest" && isdir=yes
5841 if test "$isdir" = yes; then
5842 destdir="$dest"
5843 destname=
5844 else
5845 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5846 test "X$destdir" = "X$dest" && destdir=.
5847 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5848
5849 # Not a directory, so check to see that there is only one file specified.
5850 set dummy $files
5851 if test "$#" -gt 2; then
5852 $echo "$modename: \`$dest' is not a directory" 1>&2
5853 $echo "$help" 1>&2
5854 exit $EXIT_FAILURE
5855 fi
5856 fi
5857 case $destdir in
5858 [\\/]* | [A-Za-z]:[\\/]*) ;;
5859 *)
5860 for file in $files; do
5861 case $file in
5862 *.lo) ;;
5863 *)
5864 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5865 $echo "$help" 1>&2
5866 exit $EXIT_FAILURE
5867 ;;
5868 esac
5869 done
5870 ;;
5871 esac
5872
5873 # This variable tells wrapper scripts just to set variables rather
5874 # than running their programs.
5875 libtool_install_magic="$magic"
5876
5877 staticlibs=
5878 future_libdirs=
5879 current_libdirs=
5880 for file in $files; do
5881
5882 # Do each installation.
5883 case $file in
5884 *.$libext)
5885 # Do the static libraries later.
5886 staticlibs="$staticlibs $file"
5887 ;;
5888
5889 *.la)
5890 # Check to see that this really is a libtool archive.
5891 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5892 else
5893 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5894 $echo "$help" 1>&2
5895 exit $EXIT_FAILURE
5896 fi
5897
5898 library_names=
5899 old_library=
5900 relink_command=
5901 # If there is no directory component, then add one.
5902 case $file in
5903 */* | *\\*) . $file ;;
5904 *) . ./$file ;;
5905 esac
5906
5907 # Add the libdir to current_libdirs if it is the destination.
5908 if test "X$destdir" = "X$libdir"; then
5909 case "$current_libdirs " in
5910 *" $libdir "*) ;;
5911 *) current_libdirs="$current_libdirs $libdir" ;;
5912 esac
5913 else
5914 # Note the libdir as a future libdir.
5915 case "$future_libdirs " in
5916 *" $libdir "*) ;;
5917 *) future_libdirs="$future_libdirs $libdir" ;;
5918 esac
5919 fi
5920
5921 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5922 test "X$dir" = "X$file/" && dir=
5923 dir="$dir$objdir"
5924
5925 if test -n "$relink_command"; then
5926 # Determine the prefix the user has applied to our future dir.
5927 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5928
5929 # Don't allow the user to place us outside of our expected
5930 # location b/c this prevents finding dependent libraries that
5931 # are installed to the same prefix.
5932 # At present, this check doesn't affect windows .dll's that
5933 # are installed into $libdir/../bin (currently, that works fine)
5934 # but it's something to keep an eye on.
5935 if test "$inst_prefix_dir" = "$destdir"; then
5936 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5937 exit $EXIT_FAILURE
5938 fi
5939
5940 if test -n "$inst_prefix_dir"; then
5941 # Stick the inst_prefix_dir data into the link command.
5942 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5943 else
5944 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5945 fi
5946
5947 $echo "$modename: warning: relinking \`$file'" 1>&2
5948 $show "$relink_command"
5949 if $run eval "$relink_command"; then :
5950 else
5951 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5952 exit $EXIT_FAILURE
5953 fi
5954 fi
5955
5956 # See the names of the shared library.
5957 set dummy $library_names
5958 if test -n "$2"; then
5959 realname="$2"
5960 shift
5961 shift
5962
5963 srcname="$realname"
5964 test -n "$relink_command" && srcname="$realname"T
5965
5966 # Install the shared library and build the symlinks.
5967 $show "$install_prog $dir/$srcname $destdir/$realname"
5968 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5969 if test -n "$stripme" && test -n "$striplib"; then
5970 $show "$striplib $destdir/$realname"
5971 $run eval "$striplib $destdir/$realname" || exit $?
5972 fi
5973
5974 if test "$#" -gt 0; then
5975 # Delete the old symlinks, and create new ones.
5976 # Try `ln -sf' first, because the `ln' binary might depend on
5977 # the symlink we replace! Solaris /bin/ln does not understand -f,
5978 # so we also need to try rm && ln -s.
5979 for linkname
5980 do
5981 if test "$linkname" != "$realname"; then
5982 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5983 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5984 fi
5985 done
5986 fi
5987
5988 # Do each command in the postinstall commands.
5989 lib="$destdir/$realname"
5990 cmds=$postinstall_cmds
5991 save_ifs="$IFS"; IFS='~'
5992 for cmd in $cmds; do
5993 IFS="$save_ifs"
5994 eval cmd=\"$cmd\"
5995 $show "$cmd"
5996 $run eval "$cmd" || {
5997 lt_exit=$?
5998
5999 # Restore the uninstalled library and exit
6000 if test "$mode" = relink; then
6001 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6002 fi
6003
6004 exit $lt_exit
6005 }
6006 done
6007 IFS="$save_ifs"
6008 fi
6009
6010 # Install the pseudo-library for information purposes.
6011 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6012 instname="$dir/$name"i
6013 $show "$install_prog $instname $destdir/$name"
6014 $run eval "$install_prog $instname $destdir/$name" || exit $?
6015
6016 # Maybe install the static library, too.
6017 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6018 ;;
6019
6020 *.lo)
6021 # Install (i.e. copy) a libtool object.
6022
6023 # Figure out destination file name, if it wasn't already specified.
6024 if test -n "$destname"; then
6025 destfile="$destdir/$destname"
6026 else
6027 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6028 destfile="$destdir/$destfile"
6029 fi
6030
6031 # Deduce the name of the destination old-style object file.
6032 case $destfile in
6033 *.lo)
6034 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6035 ;;
6036 *.$objext)
6037 staticdest="$destfile"
6038 destfile=
6039 ;;
6040 *)
6041 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6042 $echo "$help" 1>&2
6043 exit $EXIT_FAILURE
6044 ;;
6045 esac
6046
6047 # Install the libtool object if requested.
6048 if test -n "$destfile"; then
6049 $show "$install_prog $file $destfile"
6050 $run eval "$install_prog $file $destfile" || exit $?
6051 fi
6052
6053 # Install the old object if enabled.
6054 if test "$build_old_libs" = yes; then
6055 # Deduce the name of the old-style object file.
6056 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6057
6058 $show "$install_prog $staticobj $staticdest"
6059 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6060 fi
6061 exit $EXIT_SUCCESS
6062 ;;
6063
6064 *)
6065 # Figure out destination file name, if it wasn't already specified.
6066 if test -n "$destname"; then
6067 destfile="$destdir/$destname"
6068 else
6069 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6070 destfile="$destdir/$destfile"
6071 fi
6072
6073 # If the file is missing, and there is a .exe on the end, strip it
6074 # because it is most likely a libtool script we actually want to
6075 # install
6076 stripped_ext=""
6077 case $file in
6078 *.exe)
6079 if test ! -f "$file"; then
6080 file=`$echo $file|${SED} 's,.exe$,,'`
6081 stripped_ext=".exe"
6082 fi
6083 ;;
6084 esac
6085
6086 # Do a test to see if this is really a libtool program.
6087 case $host in
6088 *cygwin*|*mingw*)
6089 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6090 ;;
6091 *)
6092 wrapper=$file
6093 ;;
6094 esac
6095 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6096 notinst_deplibs=
6097 relink_command=
6098
6099 # Note that it is not necessary on cygwin/mingw to append a dot to
6100 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6101 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6102 # `FILE.' does not work on cygwin managed mounts.
6103 #
6104 # If there is no directory component, then add one.
6105 case $wrapper in
6106 */* | *\\*) . ${wrapper} ;;
6107 *) . ./${wrapper} ;;
6108 esac
6109
6110 # Check the variables that should have been set.
6111 if test -z "$notinst_deplibs"; then
6112 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6113 exit $EXIT_FAILURE
6114 fi
6115
6116 finalize=yes
6117 for lib in $notinst_deplibs; do
6118 # Check to see that each library is installed.
6119 libdir=
6120 if test -f "$lib"; then
6121 # If there is no directory component, then add one.
6122 case $lib in
6123 */* | *\\*) . $lib ;;
6124 *) . ./$lib ;;
6125 esac
6126 fi
6127 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6128 if test -n "$libdir" && test ! -f "$libfile"; then
6129 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6130 finalize=no
6131 fi
6132 done
6133
6134 relink_command=
6135 # Note that it is not necessary on cygwin/mingw to append a dot to
6136 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6137 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6138 # `FILE.' does not work on cygwin managed mounts.
6139 #
6140 # If there is no directory component, then add one.
6141 case $wrapper in
6142 */* | *\\*) . ${wrapper} ;;
6143 *) . ./${wrapper} ;;
6144 esac
6145
6146 outputname=
6147 if test "$fast_install" = no && test -n "$relink_command"; then
6148 if test "$finalize" = yes && test -z "$run"; then
6149 tmpdir="/tmp"
6150 test -n "$TMPDIR" && tmpdir="$TMPDIR"
6151 tmpdir="$tmpdir/libtool-$$"
6152 save_umask=`umask`
6153 umask 0077
6154 if $mkdir "$tmpdir"; then
6155 umask $save_umask
6156 else
6157 umask $save_umask
6158 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
6159 continue
6160 fi
6161 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6162 outputname="$tmpdir/$file"
6163 # Replace the output file specification.
6164 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
6165
6166 $show "$relink_command"
6167 if $run eval "$relink_command"; then :
6168 else
6169 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6170 ${rm}r "$tmpdir"
6171 continue
6172 fi
6173 file="$outputname"
6174 else
6175 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6176 fi
6177 else
6178 # Install the binary that we compiled earlier.
6179 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6180 fi
6181 fi
6182
6183 # remove .exe since cygwin /usr/bin/install will append another
6184 # one anyway
6185 case $install_prog,$host in
6186 */usr/bin/install*,*cygwin*)
6187 case $file:$destfile in
6188 *.exe:*.exe)
6189 # this is ok
6190 ;;
6191 *.exe:*)
6192 destfile=$destfile.exe
6193 ;;
6194 *:*.exe)
6195 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6196 ;;
6197 esac
6198 ;;
6199 esac
6200 $show "$install_prog$stripme $file $destfile"
6201 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6202 test -n "$outputname" && ${rm}r "$tmpdir"
6203 ;;
6204 esac
6205 done
6206
6207 for file in $staticlibs; do
6208 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6209
6210 # Set up the ranlib parameters.
6211 oldlib="$destdir/$name"
6212
6213 $show "$install_prog $file $oldlib"
6214 $run eval "$install_prog \$file \$oldlib" || exit $?
6215
6216 if test -n "$stripme" && test -n "$old_striplib"; then
6217 $show "$old_striplib $oldlib"
6218 $run eval "$old_striplib $oldlib" || exit $?
6219 fi
6220
6221 # Do each command in the postinstall commands.
6222 cmds=$old_postinstall_cmds
6223 save_ifs="$IFS"; IFS='~'
6224 for cmd in $cmds; do
6225 IFS="$save_ifs"
6226 eval cmd=\"$cmd\"
6227 $show "$cmd"
6228 $run eval "$cmd" || exit $?
6229 done
6230 IFS="$save_ifs"
6231 done
6232
6233 if test -n "$future_libdirs"; then
6234 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6235 fi
6236
6237 if test -n "$current_libdirs"; then
6238 # Maybe just do a dry run.
6239 test -n "$run" && current_libdirs=" -n$current_libdirs"
6240 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6241 else
6242 exit $EXIT_SUCCESS
6243 fi
6244 ;;
6245
6246 # libtool finish mode
6247 finish)
6248 modename="$modename: finish"
6249 libdirs="$nonopt"
6250 admincmds=
6251
6252 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6253 for dir
6254 do
6255 libdirs="$libdirs $dir"
6256 done
6257
6258 for libdir in $libdirs; do
6259 if test -n "$finish_cmds"; then
6260 # Do each command in the finish commands.
6261 cmds=$finish_cmds
6262 save_ifs="$IFS"; IFS='~'
6263 for cmd in $cmds; do
6264 IFS="$save_ifs"
6265 eval cmd=\"$cmd\"
6266 $show "$cmd"
6267 $run eval "$cmd" || admincmds="$admincmds
6268 $cmd"
6269 done
6270 IFS="$save_ifs"
6271 fi
6272 if test -n "$finish_eval"; then
6273 # Do the single finish_eval.
6274 eval cmds=\"$finish_eval\"
6275 $run eval "$cmds" || admincmds="$admincmds
6276 $cmds"
6277 fi
6278 done
6279 fi
6280
6281 # Exit here if they wanted silent mode.
6282 test "$show" = : && exit $EXIT_SUCCESS
6283
6284 $echo "----------------------------------------------------------------------"
6285 $echo "Libraries have been installed in:"
6286 for libdir in $libdirs; do
6287 $echo " $libdir"
6288 done
6289 $echo
6290 $echo "If you ever happen to want to link against installed libraries"
6291 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6292 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6293 $echo "flag during linking and do at least one of the following:"
6294 if test -n "$shlibpath_var"; then
6295 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6296 $echo " during execution"
6297 fi
6298 if test -n "$runpath_var"; then
6299 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6300 $echo " during linking"
6301 fi
6302 if test -n "$hardcode_libdir_flag_spec"; then
6303 libdir=LIBDIR
6304 eval flag=\"$hardcode_libdir_flag_spec\"
6305
6306 $echo " - use the \`$flag' linker flag"
6307 fi
6308 if test -n "$admincmds"; then
6309 $echo " - have your system administrator run these commands:$admincmds"
6310 fi
6311 if test -f /etc/ld.so.conf; then
6312 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6313 fi
6314 $echo
6315 $echo "See any operating system documentation about shared libraries for"
6316 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6317 $echo "----------------------------------------------------------------------"
6318 exit $EXIT_SUCCESS
6319 ;;
6320
6321 # libtool execute mode
6322 execute)
6323 modename="$modename: execute"
6324
6325 # The first argument is the command name.
6326 cmd="$nonopt"
6327 if test -z "$cmd"; then
6328 $echo "$modename: you must specify a COMMAND" 1>&2
6329 $echo "$help"
6330 exit $EXIT_FAILURE
6331 fi
6332
6333 # Handle -dlopen flags immediately.
6334 for file in $execute_dlfiles; do
6335 if test ! -f "$file"; then
6336 $echo "$modename: \`$file' is not a file" 1>&2
6337 $echo "$help" 1>&2
6338 exit $EXIT_FAILURE
6339 fi
6340
6341 dir=
6342 case $file in
6343 *.la)
6344 # Check to see that this really is a libtool archive.
6345 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6346 else
6347 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6348 $echo "$help" 1>&2
6349 exit $EXIT_FAILURE
6350 fi
6351
6352 # Read the libtool library.
6353 dlname=
6354 library_names=
6355
6356 # If there is no directory component, then add one.
6357 case $file in
6358 */* | *\\*) . $file ;;
6359 *) . ./$file ;;
6360 esac
6361
6362 # Skip this library if it cannot be dlopened.
6363 if test -z "$dlname"; then
6364 # Warn if it was a shared library.
6365 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6366 continue
6367 fi
6368
6369 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6370 test "X$dir" = "X$file" && dir=.
6371
6372 if test -f "$dir/$objdir/$dlname"; then
6373 dir="$dir/$objdir"
6374 else
6375 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6376 exit $EXIT_FAILURE
6377 fi
6378 ;;
6379
6380 *.lo)
6381 # Just add the directory containing the .lo file.
6382 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6383 test "X$dir" = "X$file" && dir=.
6384 ;;
6385
6386 *)
6387 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6388 continue
6389 ;;
6390 esac
6391
6392 # Get the absolute pathname.
6393 absdir=`cd "$dir" && pwd`
6394 test -n "$absdir" && dir="$absdir"
6395
6396 # Now add the directory to shlibpath_var.
6397 if eval "test -z \"\$$shlibpath_var\""; then
6398 eval "$shlibpath_var=\"\$dir\""
6399 else
6400 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6401 fi
6402 done
6403
6404 # This variable tells wrapper scripts just to set shlibpath_var
6405 # rather than running their programs.
6406 libtool_execute_magic="$magic"
6407
6408 # Check if any of the arguments is a wrapper script.
6409 args=
6410 for file
6411 do
6412 case $file in
6413 -*) ;;
6414 *)
6415 # Do a test to see if this is really a libtool program.
6416 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6417 # If there is no directory component, then add one.
6418 case $file in
6419 */* | *\\*) . $file ;;
6420 *) . ./$file ;;
6421 esac
6422
6423 # Transform arg to wrapped name.
6424 file="$progdir/$program"
6425 fi
6426 ;;
6427 esac
6428 # Quote arguments (to preserve shell metacharacters).
6429 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6430 args="$args \"$file\""
6431 done
6432
6433 if test -z "$run"; then
6434 if test -n "$shlibpath_var"; then
6435 # Export the shlibpath_var.
6436 eval "export $shlibpath_var"
6437 fi
6438
6439 # Restore saved environment variables
6440 if test "${save_LC_ALL+set}" = set; then
6441 LC_ALL="$save_LC_ALL"; export LC_ALL
6442 fi
6443 if test "${save_LANG+set}" = set; then
6444 LANG="$save_LANG"; export LANG
6445 fi
6446
6447 # Now prepare to actually exec the command.
6448 exec_cmd="\$cmd$args"
6449 else
6450 # Display what would be done.
6451 if test -n "$shlibpath_var"; then
6452 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6453 $echo "export $shlibpath_var"
6454 fi
6455 $echo "$cmd$args"
6456 exit $EXIT_SUCCESS
6457 fi
6458 ;;
6459
6460 # libtool clean and uninstall mode
6461 clean | uninstall)
6462 modename="$modename: $mode"
6463 rm="$nonopt"
6464 files=
6465 rmforce=
6466 exit_status=0
6467
6468 # This variable tells wrapper scripts just to set variables rather
6469 # than running their programs.
6470 libtool_install_magic="$magic"
6471
6472 for arg
6473 do
6474 case $arg in
6475 -f) rm="$rm $arg"; rmforce=yes ;;
6476 -*) rm="$rm $arg" ;;
6477 *) files="$files $arg" ;;
6478 esac
6479 done
6480
6481 if test -z "$rm"; then
6482 $echo "$modename: you must specify an RM program" 1>&2
6483 $echo "$help" 1>&2
6484 exit $EXIT_FAILURE
6485 fi
6486
6487 rmdirs=
6488
6489 origobjdir="$objdir"
6490 for file in $files; do
6491 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6492 if test "X$dir" = "X$file"; then
6493 dir=.
6494 objdir="$origobjdir"
6495 else
6496 objdir="$dir/$origobjdir"
6497 fi
6498 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6499 test "$mode" = uninstall && objdir="$dir"
6500
6501 # Remember objdir for removal later, being careful to avoid duplicates
6502 if test "$mode" = clean; then
6503 case " $rmdirs " in
6504 *" $objdir "*) ;;
6505 *) rmdirs="$rmdirs $objdir" ;;
6506 esac
6507 fi
6508
6509 # Don't error if the file doesn't exist and rm -f was used.
6510 if (test -L "$file") >/dev/null 2>&1 \
6511 || (test -h "$file") >/dev/null 2>&1 \
6512 || test -f "$file"; then
6513 :
6514 elif test -d "$file"; then
6515 exit_status=1
6516 continue
6517 elif test "$rmforce" = yes; then
6518 continue
6519 fi
6520
6521 rmfiles="$file"
6522
6523 case $name in
6524 *.la)
6525 # Possibly a libtool archive, so verify it.
6526 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6527 . $dir/$name
6528
6529 # Delete the libtool libraries and symlinks.
6530 for n in $library_names; do
6531 rmfiles="$rmfiles $objdir/$n"
6532 done
6533 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6534 test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6535
6536 if test "$mode" = uninstall; then
6537 if test -n "$library_names"; then
6538 # Do each command in the postuninstall commands.
6539 cmds=$postuninstall_cmds
6540 save_ifs="$IFS"; IFS='~'
6541 for cmd in $cmds; do
6542 IFS="$save_ifs"
6543 eval cmd=\"$cmd\"
6544 $show "$cmd"
6545 $run eval "$cmd"
6546 if test "$?" -ne 0 && test "$rmforce" != yes; then
6547 exit_status=1
6548 fi
6549 done
6550 IFS="$save_ifs"
6551 fi
6552
6553 if test -n "$old_library"; then
6554 # Do each command in the old_postuninstall commands.
6555 cmds=$old_postuninstall_cmds
6556 save_ifs="$IFS"; IFS='~'
6557 for cmd in $cmds; do
6558 IFS="$save_ifs"
6559 eval cmd=\"$cmd\"
6560 $show "$cmd"
6561 $run eval "$cmd"
6562 if test "$?" -ne 0 && test "$rmforce" != yes; then
6563 exit_status=1
6564 fi
6565 done
6566 IFS="$save_ifs"
6567 fi
6568 # FIXME: should reinstall the best remaining shared library.
6569 fi
6570 fi
6571 ;;
6572
6573 *.lo)
6574 # Possibly a libtool object, so verify it.
6575 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6576
6577 # Read the .lo file
6578 . $dir/$name
6579
6580 # Add PIC object to the list of files to remove.
6581 if test -n "$pic_object" \
6582 && test "$pic_object" != none; then
6583 rmfiles="$rmfiles $dir/$pic_object"
6584 fi
6585
6586 # Add non-PIC object to the list of files to remove.
6587 if test -n "$non_pic_object" \
6588 && test "$non_pic_object" != none; then
6589 rmfiles="$rmfiles $dir/$non_pic_object"
6590 fi
6591 fi
6592 ;;
6593
6594 *)
6595 if test "$mode" = clean ; then
6596 noexename=$name
6597 case $file in
6598 *.exe)
6599 file=`$echo $file|${SED} 's,.exe$,,'`
6600 noexename=`$echo $name|${SED} 's,.exe$,,'`
6601 # $file with .exe has already been added to rmfiles,
6602 # add $file without .exe
6603 rmfiles="$rmfiles $file"
6604 ;;
6605 esac
6606 # Do a test to see if this is a libtool program.
6607 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6608 relink_command=
6609 . $dir/$noexename
6610
6611 # note $name still contains .exe if it was in $file originally
6612 # as does the version of $file that was added into $rmfiles
6613 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6614 if test "$fast_install" = yes && test -n "$relink_command"; then
6615 rmfiles="$rmfiles $objdir/lt-$name"
6616 fi
6617 if test "X$noexename" != "X$name" ; then
6618 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6619 fi
6620 fi
6621 fi
6622 ;;
6623 esac
6624 $show "$rm $rmfiles"
6625 $run $rm $rmfiles || exit_status=1
6626 done
6627 objdir="$origobjdir"
6628
6629 # Try to remove the ${objdir}s in the directories where we deleted files
6630 for dir in $rmdirs; do
6631 if test -d "$dir"; then
6632 $show "rmdir $dir"
6633 $run rmdir $dir >/dev/null 2>&1
6634 fi
6635 done
6636
6637 exit $exit_status
6638 ;;
6639
6640 "")
6641 $echo "$modename: you must specify a MODE" 1>&2
6642 $echo "$generic_help" 1>&2
6643 exit $EXIT_FAILURE
6644 ;;
6645 esac
6646
6647 if test -z "$exec_cmd"; then
6648 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6649 $echo "$generic_help" 1>&2
6650 exit $EXIT_FAILURE
6651 fi
6652fi # test -z "$show_help"
6653
6654if test -n "$exec_cmd"; then
6655 eval exec $exec_cmd
6656 exit $EXIT_FAILURE
6657fi
6658
6659# We need to display help for each of the modes.
6660case $mode in
6661"") $echo \
6662"Usage: $modename [OPTION]... [MODE-ARG]...
6663
6664Provide generalized library-building support services.
6665
6666 --config show all configuration variables
6667 --debug enable verbose shell tracing
6668-n, --dry-run display commands without modifying any files
6669 --features display basic configuration information and exit
6670 --finish same as \`--mode=finish'
6671 --help display this help message and exit
6672 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6673 --quiet same as \`--silent'
6674 --silent don't print informational messages
6675 --tag=TAG use configuration variables from tag TAG
6676 --version print version information
6677
6678MODE must be one of the following:
6679
6680 clean remove files from the build directory
6681 compile compile a source file into a libtool object
6682 execute automatically set library path, then run a program
6683 finish complete the installation of libtool libraries
6684 install install libraries or executables
6685 link create a library or an executable
6686 uninstall remove libraries from an installed directory
6687
6688MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6689a more detailed description of MODE.
6690
6691Report bugs to <bug-libtool@gnu.org>."
6692 exit $EXIT_SUCCESS
6693 ;;
6694
6695clean)
6696 $echo \
6697"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6698
6699Remove files from the build directory.
6700
6701RM is the name of the program to use to delete files associated with each FILE
6702(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6703to RM.
6704
6705If FILE is a libtool library, object or program, all the files associated
6706with it are deleted. Otherwise, only FILE itself is deleted using RM."
6707 ;;
6708
6709compile)
6710 $echo \
6711"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6712
6713Compile a source file into a libtool library object.
6714
6715This mode accepts the following additional options:
6716
6717 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6718 -prefer-pic try to building PIC objects only
6719 -prefer-non-pic try to building non-PIC objects only
6720 -static always build a \`.o' file suitable for static linking
6721
6722COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6723from the given SOURCEFILE.
6724
6725The output file name is determined by removing the directory component from
6726SOURCEFILE, then substituting the C source code suffix \`.c' with the
6727library object suffix, \`.lo'."
6728 ;;
6729
6730execute)
6731 $echo \
6732"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6733
6734Automatically set library path, then run a program.
6735
6736This mode accepts the following additional options:
6737
6738 -dlopen FILE add the directory containing FILE to the library path
6739
6740This mode sets the library path environment variable according to \`-dlopen'
6741flags.
6742
6743If any of the ARGS are libtool executable wrappers, then they are translated
6744into their corresponding uninstalled binary, and any of their required library
6745directories are added to the library path.
6746
6747Then, COMMAND is executed, with ARGS as arguments."
6748 ;;
6749
6750finish)
6751 $echo \
6752"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6753
6754Complete the installation of libtool libraries.
6755
6756Each LIBDIR is a directory that contains libtool libraries.
6757
6758The commands that this mode executes may require superuser privileges. Use
6759the \`--dry-run' option if you just want to see what would be executed."
6760 ;;
6761
6762install)
6763 $echo \
6764"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6765
6766Install executables or libraries.
6767
6768INSTALL-COMMAND is the installation command. The first component should be
6769either the \`install' or \`cp' program.
6770
6771The rest of the components are interpreted as arguments to that command (only
6772BSD-compatible install options are recognized)."
6773 ;;
6774
6775link)
6776 $echo \
6777"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6778
6779Link object files or libraries together to form another library, or to
6780create an executable program.
6781
6782LINK-COMMAND is a command using the C compiler that you would use to create
6783a program from several object files.
6784
6785The following components of LINK-COMMAND are treated specially:
6786
6787 -all-static do not do any dynamic linking at all
6788 -avoid-version do not add a version suffix if possible
6789 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6790 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6791 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6792 -export-symbols SYMFILE
6793 try to export only the symbols listed in SYMFILE
6794 -export-symbols-regex REGEX
6795 try to export only the symbols matching REGEX
6796 -LLIBDIR search LIBDIR for required installed libraries
6797 -lNAME OUTPUT-FILE requires the installed library libNAME
6798 -module build a library that can dlopened
6799 -no-fast-install disable the fast-install mode
6800 -no-install link a not-installable executable
6801 -no-undefined declare that a library does not refer to external symbols
6802 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6803 -objectlist FILE Use a list of object files found in FILE to specify objects
6804 -precious-files-regex REGEX
6805 don't remove output files matching REGEX
6806 -release RELEASE specify package release information
6807 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6808 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6809 -static do not do any dynamic linking of libtool libraries
6810 -version-info CURRENT[:REVISION[:AGE]]
6811 specify library version info [each variable defaults to 0]
6812
6813All other options (arguments beginning with \`-') are ignored.
6814
6815Every other argument is treated as a filename. Files ending in \`.la' are
6816treated as uninstalled libtool libraries, other files are standard or library
6817object files.
6818
6819If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6820only library objects (\`.lo' files) may be specified, and \`-rpath' is
6821required, except when creating a convenience library.
6822
6823If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6824using \`ar' and \`ranlib', or on Windows using \`lib'.
6825
6826If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6827is created, otherwise an executable program is created."
6828 ;;
6829
6830uninstall)
6831 $echo \
6832"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6833
6834Remove libraries from an installation directory.
6835
6836RM is the name of the program to use to delete files associated with each FILE
6837(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6838to RM.
6839
6840If FILE is a libtool library, all the files associated with it are deleted.
6841Otherwise, only FILE itself is deleted using RM."
6842 ;;
6843
6844*)
6845 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6846 $echo "$help" 1>&2
6847 exit $EXIT_FAILURE
6848 ;;
6849esac
6850
6851$echo
6852$echo "Try \`$modename --help' for more information about other modes."
6853
6854exit $?
6855
6856# The TAGs below are defined such that we never get into a situation
6857# in which we disable both kinds of libraries. Given conflicting
6858# choices, we go for a static library, that is the most portable,
6859# since we can't tell whether shared libraries were disabled because
6860# the user asked for that or because the platform doesn't support
6861# them. This is particularly important on AIX, because we don't
6862# support having both static and shared libraries enabled at the same
6863# time on that platform, so we default to a shared-only configuration.
6864# If a disable-shared tag is given, we'll fallback to a static-only
6865# configuration. But we'll never go from static-only to shared-only.
6866
6867# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6868build_libtool_libs=no
6869build_old_libs=yes
6870# ### END LIBTOOL TAG CONFIG: disable-shared
6871
6872# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6873build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6874# ### END LIBTOOL TAG CONFIG: disable-static
6875
6876# Local Variables:
6877# mode:shell-script
6878# sh-indentation:2
6879# End:
6880# ### BEGIN LIBTOOL TAG CONFIG: CXX
6881
6882# Libtool was configured on host linux-gk:
6883
6884# Shell to use when invoking shell scripts.
6885SHELL="/bin/sh"
6886
6887# Whether or not to build shared libraries.
6888build_libtool_libs=yes
6889
6890# Whether or not to build static libraries.
6891build_old_libs=yes
6892
6893# Whether or not to add -lc for building shared libraries.
6894build_libtool_need_lc=no
6895
6896# Whether or not to disallow shared libs when runtime libs are static
6897allow_libtool_libs_with_static_runtimes=no
6898
6899# Whether or not to optimize for fast installation.
6900fast_install=yes
6901
6902# The host system.
6903host_alias=
6904host=x86_64-unknown-linux-gnu
6905host_os=linux-gnu
6906
6907# The build system.
6908build_alias=
6909build=x86_64-unknown-linux-gnu
6910build_os=linux-gnu
6911
6912# An echo program that does not interpret backslashes.
6913echo="echo"
6914
6915# The archiver.
6916AR="ar"
6917AR_FLAGS="cru"
6918
6919# A C compiler.
6920LTCC="gcc"
6921
6922# A language-specific compiler.
6923CC="g++"
6924
6925# Is the compiler the GNU C compiler?
6926with_gcc=yes
6927
6928# An ERE matcher.
6929EGREP="/usr/bin/grep -E"
6930
6931# The linker used to build libraries.
6932LD="/usr/bin/ld -m elf_x86_64"
6933
6934# Whether we need hard or soft links.
6935LN_S="ln -s"
6936
6937# A BSD-compatible nm program.
6938NM="/usr/bin/nm -B"
6939
6940# A symbol stripping program
6941STRIP="strip"
6942
6943# Used to examine libraries when file_magic_cmd begins "file"
6944MAGIC_CMD=file
6945
6946# Used on cygwin: DLL creation program.
6947DLLTOOL="dlltool"
6948
6949# Used on cygwin: object dumper.
6950OBJDUMP="objdump"
6951
6952# Used on cygwin: assembler.
6953AS="as"
6954
6955# The name of the directory that contains temporary libtool files.
6956objdir=.libs
6957
6958# How to create reloadable object files.
6959reload_flag=" -r"
6960reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
6961
6962# How to pass a linker flag through the compiler.
6963wl="-Wl,"
6964
6965# Object file suffix (normally "o").
6966objext="o"
6967
6968# Old archive suffix (normally "a").
6969libext="a"
6970
6971# Shared library suffix (normally ".so").
6972shrext_cmds='.so'
6973
6974# Executable file suffix (normally "").
6975exeext=""
6976
6977# Additional compiler flags for building library objects.
6978pic_flag=" -fPIC -DPIC"
6979pic_mode=default
6980
6981# What is the maximum length of a command?
6982max_cmd_len=32768
6983
6984# Does compiler simultaneously support -c and -o options?
6985compiler_c_o="yes"
6986
6987# Must we lock files when doing compilation?
6988need_locks="no"
6989
6990# Do we need the lib prefix for modules?
6991need_lib_prefix=no
6992
6993# Do we need a version for libraries?
6994need_version=no
6995
6996# Whether dlopen is supported.
6997dlopen_support=unknown
6998
6999# Whether dlopen of programs is supported.
7000dlopen_self=unknown
7001
7002# Whether dlopen of statically linked programs is supported.
7003dlopen_self_static=unknown
7004
7005# Compiler flag to prevent dynamic linking.
7006link_static_flag="-static"
7007
7008# Compiler flag to turn off builtin functions.
7009no_builtin_flag=" -fno-builtin"
7010
7011# Compiler flag to allow reflexive dlopens.
7012export_dynamic_flag_spec="\${wl}--export-dynamic"
7013
7014# Compiler flag to generate shared objects directly from archives.
7015whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
7016
7017# Compiler flag to generate thread-safe objects.
7018thread_safe_flag_spec=""
7019
7020# Library versioning type.
7021version_type=linux
7022
7023# Format of library name prefix.
7024libname_spec="lib\$name"
7025
7026# List of archive names. First name is the real one, the rest are links.
7027# The last name is the one that the linker finds with -lNAME.
7028library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
7029
7030# The coded name of the library, if different from the real name.
7031soname_spec="\${libname}\${release}\${shared_ext}\$major"
7032
7033# Commands used to build and install an old-style archive.
7034RANLIB="ranlib"
7035old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib"
7036old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib"
7037old_postuninstall_cmds=""
7038
7039# Create an old-style archive from a shared archive.
7040old_archive_from_new_cmds=""
7041
7042# Create a temporary old-style archive to link instead of a shared archive.
7043old_archive_from_expsyms_cmds=""
7044
7045# Commands used to build and install a shared archive.
7046archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
7047archive_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"
7048postinstall_cmds=""
7049postuninstall_cmds=""
7050
7051# Commands used to build a loadable module (assumed same as above if empty)
7052module_cmds=""
7053module_expsym_cmds=""
7054
7055# Commands to strip libraries.
7056old_striplib="strip --strip-debug"
7057striplib="strip --strip-unneeded"
7058
7059# Dependencies to place before the objects being linked to create a
7060# shared library.
7061predep_objects="/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../lib/crti.o /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/crtbeginS.o"
7062
7063# Dependencies to place after the objects being linked to create a
7064# shared library.
7065postdep_objects="/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/crtendS.o /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../lib/crtn.o"
7066
7067# Dependencies to place before the objects being linked to create a
7068# shared library.
7069predeps=""
7070
7071# Dependencies to place after the objects being linked to create a
7072# shared library.
7073postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
7074
7075# The library search path used internally by the compiler when linking
7076# a shared library.
7077compiler_lib_search_path="-L/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0 -L/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../.."
7078
7079# Method to check whether dependent libraries are shared objects.
7080deplibs_check_method="pass_all"
7081
7082# Command to use when deplibs_check_method == file_magic.
7083file_magic_cmd="\$MAGIC_CMD"
7084
7085# Flag that allows shared libraries with undefined symbols to be built.
7086allow_undefined_flag=""
7087
7088# Flag that forces no undefined symbols.
7089no_undefined_flag=""
7090
7091# Commands used to finish a libtool library installation in a directory.
7092finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
7093
7094# Same as above, but a single script fragment to be evaled but not shown.
7095finish_eval=""
7096
7097# Take the output of nm and produce a listing of raw symbols and C names.
7098global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
7099
7100# Transform the output of nm in a proper C declaration
7101global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
7102
7103# Transform the output of nm in a C name address pair
7104global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'"
7105
7106# This is the shared library runtime path variable.
7107runpath_var=LD_RUN_PATH
7108
7109# This is the shared library path variable.
7110shlibpath_var=LD_LIBRARY_PATH
7111
7112# Is shlibpath searched before the hard-coded library search path?
7113shlibpath_overrides_runpath=no
7114
7115# How to hardcode a shared library path into an executable.
7116hardcode_action=immediate
7117
7118# Whether we should hardcode library paths into libraries.
7119hardcode_into_libs=yes
7120
7121# Flag to hardcode $libdir into a binary during linking.
7122# This must work even if $libdir does not exist.
7123hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
7124
7125# If ld is used when linking, flag to hardcode $libdir into
7126# a binary during linking. This must work even if $libdir does
7127# not exist.
7128hardcode_libdir_flag_spec_ld=""
7129
7130# Whether we need a single -rpath flag with a separated argument.
7131hardcode_libdir_separator=""
7132
7133# Set to yes if using DIR/libNAME during linking hardcodes DIR into the
7134# resulting binary.
7135hardcode_direct=no
7136
7137# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
7138# resulting binary.
7139hardcode_minus_L=no
7140
7141# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
7142# the resulting binary.
7143hardcode_shlibpath_var=
7144
7145# Set to yes if building a shared library automatically hardcodes DIR into the library
7146# and all subsequent libraries and executables linked against it.
7147hardcode_automatic=no
7148
7149# Variables whose values should be saved in libtool wrapper scripts and
7150# restored at relink time.
7151variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
7152
7153# Whether libtool must link a program against all its dependency libraries.
7154link_all_deplibs=unknown
7155
7156# Compile-time system search path for libraries
7157sys_lib_search_path_spec=" /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/ /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/lib/x86_64-unknown-linux-gnu/4.7.0/ /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/lib/../lib/ /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../x86_64-unknown-linux-gnu/4.7.0/ /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../lib/ /lib/x86_64-unknown-linux-gnu/4.7.0/ /lib/../lib/ /usr/lib/x86_64-unknown-linux-gnu/4.7.0/ /usr/lib/../lib/ /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/lib/ /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../ /lib/ /usr/lib/"
7158
7159# Run-time system search path for libraries
7160sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/libfakeroot /usr/lib32 /usr/lib/perl5/core_perl/CORE "
7161
7162# Fix the shell variable $srcfile for the compiler.
7163fix_srcfile_path=""
7164
7165# Set to yes if exported symbols are required.
7166always_export_symbols=no
7167
7168# The commands to list exported symbols.
7169export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
7170
7171# The commands to extract the exported symbol list from a shared archive.
7172extract_expsyms_cmds=""
7173
7174# Symbols that should not be listed in the preloaded symbols.
7175exclude_expsyms=""
7176
7177# Symbols that must always be exported.
7178include_expsyms=""
7179
7180# ### END LIBTOOL TAG CONFIG: CXX
7181
7182