Ticket #42751: libtool

File libtool, 215.6 KB (added by creativecommon@…, 10 years ago)

ranlib_symlinks_to_libtool

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