source: trunk/third/moira/libtool @ 24319

Revision 24319, 208.5 KB checked in by broder, 15 years ago (diff)
New Moira snapshot from SVN.
  • Property svn:executable set to *
RevLine 
[24250]1#! /bin/sh
[23882]2
3# libtoolT - Provide generalized library-building support services.
4# Generated automatically by  (GNU  )
5# NOTE: Changes made to this file will be lost: look at ltmain.sh.
6#
7# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
8# Free Software Foundation, Inc.
9#
10# This file is part of GNU Libtool:
11# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
12#
13# This program is free software; you can redistribute it and/or modify
14# it under the terms of the GNU General Public License as published by
15# the Free Software Foundation; either version 2 of the License, or
16# (at your option) any later version.
17#
18# This program is distributed in the hope that it will be useful, but
19# WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21# General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with this program; if not, write to the Free Software
25# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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.
[24250]33SED="/bin/sed"
[23882]34
35# Sed that helps us avoid accidentally triggering echo(1) options like -n.
[24250]36Xsed="/bin/sed -e s/^X//"
[23882]37
38# The HP-UX ksh and POSIX shell print the target directory to stdout
39# if CDPATH is set.
40if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
41
42# The names of the tagged configurations supported by this script.
43available_tags=" CXX F77"
44
45# ### BEGIN LIBTOOL CONFIG
46
[24319]47# Libtool was configured on host red-herring.mit.edu:
[23882]48
49# Shell to use when invoking shell scripts.
[24250]50SHELL="/bin/sh"
[23882]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.
[24250]59build_libtool_need_lc=no
[23882]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.
[24250]65fast_install=yes
[23882]66
67# The host system.
68host_alias=
[24319]69host=i686-redhat-linux-gnu
[23882]70
71# An echo program that does not interpret backslashes.
72echo="echo"
73
74# The archiver.
75AR="ar"
76AR_FLAGS="cru"
77
78# A C compiler.
79LTCC="gcc"
80
81# A language-specific compiler.
82CC="gcc"
83
84# Is the compiler the GNU C compiler?
85with_gcc=yes
86
87# An ERE matcher.
[24250]88EGREP="grep -E"
[23882]89
90# The linker used to build libraries.
[24319]91LD="/usr/bin/ld"
[23882]92
93# Whether we need hard or soft links.
94LN_S="ln -s"
95
96# A BSD-compatible nm program.
[24250]97NM="/usr/bin/nm -B"
[23882]98
99# A symbol stripping program
100STRIP="strip"
101
102# Used to examine libraries when file_magic_cmd begins "file"
103MAGIC_CMD=file
104
105# Used on cygwin: DLL creation program.
106DLLTOOL="dlltool"
107
108# Used on cygwin: object dumper.
109OBJDUMP="objdump"
110
111# Used on cygwin: assembler.
112AS="as"
113
114# The name of the directory that contains temporary libtool files.
115objdir=.libs
116
117# How to create reloadable object files.
118reload_flag=" -r"
119reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
120
121# How to pass a linker flag through the compiler.
122wl="-Wl,"
123
124# Object file suffix (normally "o").
125objext="o"
126
127# Old archive suffix (normally "a").
128libext="a"
129
130# Shared library suffix (normally ".so").
131shrext_cmds='.so'
132
133# Executable file suffix (normally "").
134exeext=""
135
136# Additional compiler flags for building library objects.
137pic_flag=" -fPIC -DPIC"
138pic_mode=default
139
140# What is the maximum length of a command?
[24250]141max_cmd_len=32768
[23882]142
143# Does compiler simultaneously support -c and -o options?
144compiler_c_o="yes"
145
146# Must we lock files when doing compilation ?
147need_locks="no"
148
149# Do we need the lib prefix for modules?
150need_lib_prefix=no
151
152# Do we need a version for libraries?
153need_version=no
154
155# Whether dlopen is supported.
156dlopen_support=unknown
157
158# Whether dlopen of programs is supported.
159dlopen_self=unknown
160
161# Whether dlopen of statically linked programs is supported.
162dlopen_self_static=unknown
163
164# Compiler flag to prevent dynamic linking.
165link_static_flag="-static"
166
167# Compiler flag to turn off builtin functions.
168no_builtin_flag=" -fno-builtin"
169
170# Compiler flag to allow reflexive dlopens.
[24250]171export_dynamic_flag_spec="\${wl}--export-dynamic"
[23882]172
173# Compiler flag to generate shared objects directly from archives.
[24250]174whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
[23882]175
176# Compiler flag to generate thread-safe objects.
177thread_safe_flag_spec=""
178
179# Library versioning type.
180version_type=linux
181
182# Format of library name prefix.
183libname_spec="lib\$name"
184
185# List of archive names.  First name is the real one, the rest are links.
186# The last name is the one that the linker finds with -lNAME.
187library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
188
189# The coded name of the library, if different from the real name.
190soname_spec="\${libname}\${release}\${shared_ext}\$major"
191
192# Commands used to build and install an old-style archive.
193RANLIB="ranlib"
194old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib"
195old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib"
196old_postuninstall_cmds=""
197
198# Create an old-style archive from a shared archive.
199old_archive_from_new_cmds=""
200
201# Create a temporary old-style archive to link instead of a shared archive.
202old_archive_from_expsyms_cmds=""
203
204# Commands used to build and install a shared archive.
[24250]205archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
206archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
207cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
208\$echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
209        \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
210postinstall_cmds=""
[23882]211postuninstall_cmds=""
212
213# Commands used to build a loadable module (assumed same as above if empty)
214module_cmds=""
215module_expsym_cmds=""
216
217# Commands to strip libraries.
[24250]218old_striplib="strip --strip-debug"
219striplib="strip --strip-unneeded"
[23882]220
221# Dependencies to place before the objects being linked to create a
222# shared library.
223predep_objects=""
224
225# Dependencies to place after the objects being linked to create a
226# shared library.
227postdep_objects=""
228
229# Dependencies to place before the objects being linked to create a
230# shared library.
231predeps=""
232
233# Dependencies to place after the objects being linked to create a
234# shared library.
235postdeps=""
236
237# The library search path used internally by the compiler when linking
238# a shared library.
239compiler_lib_search_path=""
240
241# Method to check whether dependent libraries are shared objects.
242deplibs_check_method="pass_all"
243
244# Command to use when deplibs_check_method == file_magic.
245file_magic_cmd="\$MAGIC_CMD"
246
247# Flag that allows shared libraries with undefined symbols to be built.
248allow_undefined_flag=""
249
250# Flag that forces no undefined symbols.
[24250]251no_undefined_flag=""
[23882]252
253# Commands used to finish a libtool library installation in a directory.
[24250]254finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
[23882]255
256# Same as above, but a single script fragment to be evaled but not shown.
257finish_eval=""
258
259# Take the output of nm and produce a listing of raw symbols and C names.
[24250]260global_symbol_pipe="sed -n -e 's/^.*[   ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[       ][      ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'"
[23882]261
262# Transform the output of nm in a proper C declaration
263global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
264
265# Transform the output of nm in a C name address pair
266global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/  {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/  {\"\\2\", (lt_ptr) \\&\\2},/p'"
267
268# This is the shared library runtime path variable.
[24250]269runpath_var=LD_RUN_PATH
[23882]270
271# This is the shared library path variable.
272shlibpath_var=LD_LIBRARY_PATH
273
274# Is shlibpath searched before the hard-coded library search path?
[24250]275shlibpath_overrides_runpath=no
[23882]276
277# How to hardcode a shared library path into an executable.
278hardcode_action=immediate
279
280# Whether we should hardcode library paths into libraries.
281hardcode_into_libs=yes
282
283# Flag to hardcode $libdir into a binary during linking.
284# This must work even if $libdir does not exist.
[24250]285hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
[23882]286
287# If ld is used when linking, flag to hardcode $libdir into
288# a binary during linking. This must work even if $libdir does
289# not exist.
290hardcode_libdir_flag_spec_ld=""
291
292# Whether we need a single -rpath flag with a separated argument.
293hardcode_libdir_separator=""
294
295# Set to yes if using DIR/libNAME during linking hardcodes DIR into the
296# resulting binary.
297hardcode_direct=no
298
299# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
300# resulting binary.
301hardcode_minus_L=no
302
303# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
304# the resulting binary.
[24250]305hardcode_shlibpath_var=unsupported
[23882]306
307# Set to yes if building a shared library automatically hardcodes DIR into the library
308# and all subsequent libraries and executables linked against it.
309hardcode_automatic=no
310
311# Variables whose values should be saved in libtool wrapper scripts and
312# restored at relink time.
[24250]313variables_saved_for_relink="PATH  LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
[23882]314
315# Whether libtool must link a program against all its dependency libraries.
[24250]316link_all_deplibs=unknown
[23882]317
318# Compile-time system search path for libraries
[24319]319sys_lib_search_path_spec=" /usr/lib/gcc/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../i386-redhat-linux/lib/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../ /lib/i386-redhat-linux/3.4.6/ /lib/ /usr/lib/i386-redhat-linux/3.4.6/ /usr/lib/"
[23882]320
321# Run-time system search path for libraries
[24319]322sys_lib_dlsearch_path_spec="/lib /usr/lib include ld.so.conf.d/*.conf /usr/i486-linux-libc5/lib /usr/athena/lib "
[23882]323
324# Fix the shell variable $srcfile for the compiler.
325fix_srcfile_path=""
326
327# Set to yes if exported symbols are required.
328always_export_symbols=no
329
330# The commands to list exported symbols.
331export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
332
333# The commands to extract the exported symbol list from a shared archive.
334extract_expsyms_cmds=""
335
336# Symbols that should not be listed in the preloaded symbols.
337exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
338
339# Symbols that must always be exported.
340include_expsyms=""
341
342# ### END LIBTOOL CONFIG
343
344# ltmain.sh - Provide generalized library-building support services.
345# NOTE: Changing this file will not affect anything until you rerun configure.
346#
347# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
348# Free Software Foundation, Inc.
349# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
350#
351# This program is free software; you can redistribute it and/or modify
352# it under the terms of the GNU General Public License as published by
353# the Free Software Foundation; either version 2 of the License, or
354# (at your option) any later version.
355#
356# This program is distributed in the hope that it will be useful, but
357# WITHOUT ANY WARRANTY; without even the implied warranty of
358# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
359# General Public License for more details.
360#
361# You should have received a copy of the GNU General Public License
362# along with this program; if not, write to the Free Software
363# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
364#
365# As a special exception to the GNU General Public License, if you
366# distribute this file as part of a program that contains a
367# configuration script generated by Autoconf, you may include it under
368# the same distribution terms that you use for the rest of that program.
369
370basename="s,^.*/,,g"
371
372# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
373# is ksh but when the shell is invoked as "sh" and the current value of
374# the _XPG environment variable is not equal to 1 (one), the special
375# positional parameter $0, within a function call, is the name of the
376# function.
377progpath="$0"
378
379# RH: define SED for historic ltconfig's generated by Libtool 1.3
380[ -z "$SED" ] && SED=sed
381
382# The name of this program:
383progname=`echo "$progpath" | $SED $basename`
384modename="$progname"
385
386# Global variables:
387EXIT_SUCCESS=0
388EXIT_FAILURE=1
389
390PROGRAM=ltmain.sh
391PACKAGE=libtool
392VERSION=1.5.6
393TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)"
394EGREP="grep -E"
395
396
397# Check that we have a working $echo.
398if test "X$1" = X--no-reexec; then
399  # Discard the --no-reexec flag, and continue.
400  shift
401elif test "X$1" = X--fallback-echo; then
402  # Avoid inline document here, it may be left over
403  :
404elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
405  # Yippee, $echo works!
406  :
407else
408  # Restart under the correct shell, and then maybe $echo will work.
409  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
410fi
411
412if test "X$1" = X--fallback-echo; then
413  # used as fallback echo
414  shift
415  cat <<EOF
416$*
417EOF
418  exit $EXIT_SUCCESS
419fi
420
421default_mode=
422help="Try \`$progname --help' for more information."
423magic="%%%MAGIC variable%%%"
424mkdir="mkdir"
425mv="mv -f"
426rm="rm -f"
427
428# Sed substitution that helps us do robust quoting.  It backslashifies
429# metacharacters that are still active within double-quoted strings.
430Xsed="${SED}"' -e 1s/^X//'
431sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
432# test EBCDIC or ASCII
433case `echo A|tr A '\301'` in
434 A) # EBCDIC based system
435  SP2NL="tr '\100' '\n'"
436  NL2SP="tr '\r\n' '\100\100'"
437  ;;
438 *) # Assume ASCII based system
439  SP2NL="tr '\040' '\012'"
440  NL2SP="tr '\015\012' '\040\040'"
441  ;;
442esac
443
444# NLS nuisances.
445# Only set LANG and LC_ALL to C if already set.
446# These must not be set unconditionally because not all systems understand
447# e.g. LANG=C (notably SCO).
448# We save the old values to restore during execute mode.
449if test "${LC_ALL+set}" = set; then
450  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
451fi
452if test "${LANG+set}" = set; then
453  save_LANG="$LANG"; LANG=C; export LANG
454fi
455
456# Make sure IFS has a sensible default
457: ${IFS="       
458"}
459
460if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
461  $echo "$modename: not configured to build any kind of library" 1>&2
462  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
463  exit $EXIT_FAILURE
464fi
465
466# Global variables.
467mode=$default_mode
468nonopt=
469prev=
470prevopt=
471run=
472show="$echo"
473show_help=
474execute_dlfiles=
475lo2o="s/\\.lo\$/.${objext}/"
476o2lo="s/\\.${objext}\$/.lo/"
477
478#####################################
479# Shell function definitions:
480# This seems to be the best place for them
481
482# func_win32_libid arg
483# return the library type of file 'arg'
484#
485# Need a lot of goo to handle *both* DLLs and import libs
486# Has to be a shell function in order to 'eat' the argument
487# that is supplied when $file_magic_command is called.
488func_win32_libid () {
489  win32_libid_type="unknown"
490  win32_fileres=`file -L $1 2>/dev/null`
491  case $win32_fileres in
492  *ar\ archive\ import\ library*) # definitely import
493    win32_libid_type="x86 archive import"
494    ;;
495  *ar\ archive*) # could be an import, or static
496    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
497      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
498      win32_nmres=`eval $NM -f posix -A $1 | \
499        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
500      if test "X$win32_nmres" = "Ximport" ; then
501        win32_libid_type="x86 archive import"
502      else
503        win32_libid_type="x86 archive static"
504      fi
505    fi
506    ;;
507  *DLL*)
508    win32_libid_type="x86 DLL"
509    ;;
510  *executable*) # but shell scripts are "executable" too...
511    case $win32_fileres in
512    *MS\ Windows\ PE\ Intel*)
513      win32_libid_type="x86 DLL"
514      ;;
515    esac
516    ;;
517  esac
518  $echo $win32_libid_type
519}
520
521
522# func_infer_tag arg
523# Infer tagged configuration to use if any are available and
524# if one wasn't chosen via the "--tag" command line option.
525# Only attempt this if the compiler in the base compile
526# command doesn't match the default compiler.
527# arg is usually of the form 'gcc ...'
528func_infer_tag () {
529    if test -n "$available_tags" && test -z "$tagname"; then
530      CC_quoted=
531      for arg in $CC; do
532        case $arg in
533          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
534          arg="\"$arg\""
535          ;;
536        esac
537        CC_quoted="$CC_quoted $arg"
538      done
539      case $@ in
540      # Blanks in the command may have been stripped by the calling shell,
541      # but not from the CC environment variable when configure was run.
542      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
543      # Blanks at the start of $base_compile will cause this to fail
544      # if we don't check for them as well.
545      *)
546        for z in $available_tags; do
547          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
548            # Evaluate the configuration.
549            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
550            CC_quoted=
551            for arg in $CC; do
552            # Double-quote args containing other shell metacharacters.
553            case $arg in
554              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
555              arg="\"$arg\""
556              ;;
557            esac
558            CC_quoted="$CC_quoted $arg"
559          done
560            case "$@ " in
561              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
562              # The compiler in the base compile command matches
563              # the one in the tagged configuration.
564              # Assume this is the tagged configuration we want.
565              tagname=$z
566              break
567              ;;
568            esac
569          fi
570        done
571        # If $tagname still isn't set, then no tagged configuration
572        # was found and let the user know that the "--tag" command
573        # line option must be used.
574        if test -z "$tagname"; then
575          $echo "$modename: unable to infer tagged configuration"
576          $echo "$modename: specify a tag with \`--tag'" 1>&2
577          exit $EXIT_FAILURE
578#        else
579#          $echo "$modename: using $tagname tagged configuration"
580        fi
581        ;;
582      esac
583    fi
584}
585# End of Shell function definitions
586#####################################
587
588# Darwin sucks
589eval std_shrext=\"$shrext_cmds\"
590
591# Parse our command line options once, thoroughly.
592while test "$#" -gt 0
593do
594  arg="$1"
595  shift
596
597  case $arg in
598  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
599  *) optarg= ;;
600  esac
601
602  # If the previous option needs an argument, assign it.
603  if test -n "$prev"; then
604    case $prev in
605    execute_dlfiles)
606      execute_dlfiles="$execute_dlfiles $arg"
607      ;;
608    tag)
609      tagname="$arg"
610      preserve_args="${preserve_args}=$arg"
611
612      # Check whether tagname contains only valid characters
613      case $tagname in
614      *[!-_A-Za-z0-9,/]*)
615        $echo "$progname: invalid tag name: $tagname" 1>&2
616        exit $EXIT_FAILURE
617        ;;
618      esac
619
620      case $tagname in
621      CC)
622        # Don't test for the "default" C tag, as we know, it's there, but
623        # not specially marked.
624        ;;
625      *)
626        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
627          taglist="$taglist $tagname"
628          # Evaluate the configuration.
629          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
630        else
631          $echo "$progname: ignoring unknown tag $tagname" 1>&2
632        fi
633        ;;
634      esac
635      ;;
636    *)
637      eval "$prev=\$arg"
638      ;;
639    esac
640
641    prev=
642    prevopt=
643    continue
644  fi
645
646  # Have we seen a non-optional argument yet?
647  case $arg in
648  --help)
649    show_help=yes
650    ;;
651
652  --version)
653    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
654    $echo
655    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
656    $echo "This is free software; see the source for copying conditions.  There is NO"
657    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
658    exit $EXIT_SUCCESS
659    ;;
660
661  --config)
662    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
663    # Now print the configurations for the tags.
664    for tagname in $taglist; do
665      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
666    done
667    exit $EXIT_SUCCESS
668    ;;
669
670  --debug)
671    $echo "$progname: enabling shell trace mode"
672    set -x
673    preserve_args="$preserve_args $arg"
674    ;;
675
676  --dry-run | -n)
677    run=:
678    ;;
679
680  --features)
681    $echo "host: $host"
682    if test "$build_libtool_libs" = yes; then
683      $echo "enable shared libraries"
684    else
685      $echo "disable shared libraries"
686    fi
687    if test "$build_old_libs" = yes; then
688      $echo "enable static libraries"
689    else
690      $echo "disable static libraries"
691    fi
692    exit $EXIT_SUCCESS
693    ;;
694
695  --finish) mode="finish" ;;
696
697  --mode) prevopt="--mode" prev=mode ;;
698  --mode=*) mode="$optarg" ;;
699
700  --preserve-dup-deps) duplicate_deps="yes" ;;
701
702  --quiet | --silent)
703    show=:
704    preserve_args="$preserve_args $arg"
705    ;;
706
707  --tag) prevopt="--tag" prev=tag ;;
708  --tag=*)
709    set tag "$optarg" ${1+"$@"}
710    shift
711    prev=tag
712    preserve_args="$preserve_args --tag"
713    ;;
714
715  -dlopen)
716    prevopt="-dlopen"
717    prev=execute_dlfiles
718    ;;
719
720  -*)
721    $echo "$modename: unrecognized option \`$arg'" 1>&2
722    $echo "$help" 1>&2
723    exit $EXIT_FAILURE
724    ;;
725
726  *)
727    nonopt="$arg"
728    break
729    ;;
730  esac
731done
732
733if test -n "$prevopt"; then
734  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
735  $echo "$help" 1>&2
736  exit $EXIT_FAILURE
737fi
738
739# If this variable is set in any of the actions, the command in it
740# will be execed at the end.  This prevents here-documents from being
741# left over by shells.
742exec_cmd=
743
744if test -z "$show_help"; then
745
746  # Infer the operation mode.
747  if test -z "$mode"; then
748    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
749    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
750    case $nonopt in
751    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
752      mode=link
753      for arg
754      do
755        case $arg in
756        -c)
757           mode=compile
758           break
759           ;;
760        esac
761      done
762      ;;
763    *db | *dbx | *strace | *truss)
764      mode=execute
765      ;;
766    *install*|cp|mv)
767      mode=install
768      ;;
769    *rm)
770      mode=uninstall
771      ;;
772    *)
773      # If we have no mode, but dlfiles were specified, then do execute mode.
774      test -n "$execute_dlfiles" && mode=execute
775
776      # Just use the default operation mode.
777      if test -z "$mode"; then
778        if test -n "$nonopt"; then
779          $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
780        else
781          $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
782        fi
783      fi
784      ;;
785    esac
786  fi
787
788  # Only execute mode is allowed to have -dlopen flags.
789  if test -n "$execute_dlfiles" && test "$mode" != execute; then
790    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
791    $echo "$help" 1>&2
792    exit $EXIT_FAILURE
793  fi
794
795  # Change the help message to a mode-specific one.
796  generic_help="$help"
797  help="Try \`$modename --help --mode=$mode' for more information."
798
799  # These modes are in order of execution frequency so that they run quickly.
800  case $mode in
801  # libtool compile mode
802  compile)
803    modename="$modename: compile"
804    # Get the compilation command and the source file.
805    base_compile=
806    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
807    suppress_opt=yes
808    suppress_output=
809    arg_mode=normal
810    libobj=
811    later=
812
813    for arg
814    do
815      case "$arg_mode" in
816      arg  )
817        # do not "continue".  Instead, add this to base_compile
818        lastarg="$arg"
819        arg_mode=normal
820        ;;
821
822      target )
823        libobj="$arg"
824        arg_mode=normal
825        continue
826        ;;
827
828      normal )
829        # Accept any command-line options.
830        case $arg in
831        -o)
832          if test -n "$libobj" ; then
833            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
834            exit $EXIT_FAILURE
835          fi
836          arg_mode=target
837          continue
838          ;;
839
840        -static | -prefer-pic | -prefer-non-pic)
841          later="$later $arg"
842          continue
843          ;;
844
845        -no-suppress)
846          suppress_opt=no
847          continue
848          ;;
849
850        -Xcompiler)
851          arg_mode=arg  #  the next one goes into the "base_compile" arg list
852          continue      #  The current "srcfile" will either be retained or
853          ;;            #  replaced later.  I would guess that would be a bug.
854
855        -Wc,*)
856          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
857          lastarg=
858          save_ifs="$IFS"; IFS=','
859          for arg in $args; do
860            IFS="$save_ifs"
861
862            # Double-quote args containing other shell metacharacters.
863            # Many Bourne shells cannot handle close brackets correctly
864            # in scan sets, so we specify it separately.
865            case $arg in
866              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
867              arg="\"$arg\""
868              ;;
869            esac
870            lastarg="$lastarg $arg"
871          done
872          IFS="$save_ifs"
873          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
874
875          # Add the arguments to base_compile.
876          base_compile="$base_compile $lastarg"
877          continue
878          ;;
879
880        * )
881          # Accept the current argument as the source file.
882          # The previous "srcfile" becomes the current argument.
883          #
884          lastarg="$srcfile"
885          srcfile="$arg"
886          ;;
887        esac  #  case $arg
888        ;;
889      esac    #  case $arg_mode
890
891      # Aesthetically quote the previous argument.
892      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
893
894      case $lastarg in
895      # Double-quote args containing other shell metacharacters.
896      # Many Bourne shells cannot handle close brackets correctly
897      # in scan sets, so we specify it separately.
898      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
899        lastarg="\"$lastarg\""
900        ;;
901      esac
902
903      base_compile="$base_compile $lastarg"
904    done # for arg
905
906    case $arg_mode in
907    arg)
908      $echo "$modename: you must specify an argument for -Xcompile"
909      exit $EXIT_FAILURE
910      ;;
911    target)
912      $echo "$modename: you must specify a target with \`-o'" 1>&2
913      exit $EXIT_FAILURE
914      ;;
915    *)
916      # Get the name of the library object.
917      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
918      ;;
919    esac
920
921    # Recognize several different file suffixes.
922    # If the user specifies -o file.o, it is replaced with file.lo
923    xform='[cCFSifmso]'
924    case $libobj in
925    *.ada) xform=ada ;;
926    *.adb) xform=adb ;;
927    *.ads) xform=ads ;;
928    *.asm) xform=asm ;;
929    *.c++) xform=c++ ;;
930    *.cc) xform=cc ;;
931    *.ii) xform=ii ;;
932    *.class) xform=class ;;
933    *.cpp) xform=cpp ;;
934    *.cxx) xform=cxx ;;
935    *.f90) xform=f90 ;;
936    *.for) xform=for ;;
937    *.java) xform=java ;;
938    esac
939
940    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
941
942    case $libobj in
943    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
944    *)
945      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
946      exit $EXIT_FAILURE
947      ;;
948    esac
949
950    func_infer_tag $base_compile
951
952    for arg in $later; do
953      case $arg in
954      -static)
955        build_old_libs=yes
956        continue
957        ;;
958
959      -prefer-pic)
960        pic_mode=yes
961        continue
962        ;;
963
964      -prefer-non-pic)
965        pic_mode=no
966        continue
967        ;;
968      esac
969    done
970
971    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
972    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
973    if test "X$xdir" = "X$obj"; then
974      xdir=
975    else
976      xdir=$xdir/
977    fi
978    lobj=${xdir}$objdir/$objname
979
980    if test -z "$base_compile"; then
981      $echo "$modename: you must specify a compilation command" 1>&2
982      $echo "$help" 1>&2
983      exit $EXIT_FAILURE
984    fi
985
986    # Delete any leftover library objects.
987    if test "$build_old_libs" = yes; then
988      removelist="$obj $lobj $libobj ${libobj}T"
989    else
990      removelist="$lobj $libobj ${libobj}T"
991    fi
992
993    $run $rm $removelist
994    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
995
996    # On Cygwin there's no "real" PIC flag so we must build both object types
997    case $host_os in
998    cygwin* | mingw* | pw32* | os2*)
999      pic_mode=default
1000      ;;
1001    esac
1002    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1003      # non-PIC code in shared libraries is not supported
1004      pic_mode=default
1005    fi
1006
1007    # Calculate the filename of the output object if compiler does
1008    # not support -o with -c
1009    if test "$compiler_c_o" = no; then
1010      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1011      lockfile="$output_obj.lock"
1012      removelist="$removelist $output_obj $lockfile"
1013      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
1014    else
1015      output_obj=
1016      need_locks=no
1017      lockfile=
1018    fi
1019
1020    # Lock this critical section if it is needed
1021    # We use this script file to make the link, it avoids creating a new file
1022    if test "$need_locks" = yes; then
1023      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
1024        $show "Waiting for $lockfile to be removed"
1025        sleep 2
1026      done
1027    elif test "$need_locks" = warn; then
1028      if test -f "$lockfile"; then
1029        $echo "\
1030*** ERROR, $lockfile exists and contains:
1031`cat $lockfile 2>/dev/null`
1032
1033This indicates that another process is trying to use the same
1034temporary object file, and libtool could not work around it because
1035your compiler does not support \`-c' and \`-o' together.  If you
1036repeat this compilation, it may succeed, by chance, but you had better
1037avoid parallel builds (make -j) in this platform, or get a better
1038compiler."
1039
1040        $run $rm $removelist
1041        exit $EXIT_FAILURE
1042      fi
1043      $echo $srcfile > "$lockfile"
1044    fi
1045
1046    if test -n "$fix_srcfile_path"; then
1047      eval srcfile=\"$fix_srcfile_path\"
1048    fi
1049
1050    $run $rm "$libobj" "${libobj}T"
1051
1052    # Create a libtool object file (analogous to a ".la" file),
1053    # but don't create it if we're doing a dry run.
1054    test -z "$run" && cat > ${libobj}T <<EOF
1055# $libobj - a libtool object file
1056# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
1057#
1058# Please DO NOT delete this file!
1059# It is necessary for linking the library.
1060
1061# Name of the PIC object.
1062EOF
1063
1064    # Only build a PIC object if we are building libtool libraries.
1065    if test "$build_libtool_libs" = yes; then
1066      # Without this assignment, base_compile gets emptied.
1067      fbsd_hideous_sh_bug=$base_compile
1068
1069      if test "$pic_mode" != no; then
1070        command="$base_compile $srcfile $pic_flag"
1071      else
1072        # Don't build PIC code
1073        command="$base_compile $srcfile"
1074      fi
1075
1076      if test ! -d "${xdir}$objdir"; then
1077        $show "$mkdir ${xdir}$objdir"
1078        $run $mkdir ${xdir}$objdir
1079        status=$?
1080        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
1081          exit $status
1082        fi
1083      fi
1084
1085      if test -z "$output_obj"; then
1086        # Place PIC objects in $objdir
1087        command="$command -o $lobj"
1088      fi
1089
1090      $run $rm "$lobj" "$output_obj"
1091
1092      $show "$command"
1093      if $run eval "$command"; then :
1094      else
1095        test -n "$output_obj" && $run $rm $removelist
1096        exit $EXIT_FAILURE
1097      fi
1098
1099      if test "$need_locks" = warn &&
1100         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1101        $echo "\
1102*** ERROR, $lockfile contains:
1103`cat $lockfile 2>/dev/null`
1104
1105but it should contain:
1106$srcfile
1107
1108This indicates that another process is trying to use the same
1109temporary object file, and libtool could not work around it because
1110your compiler does not support \`-c' and \`-o' together.  If you
1111repeat this compilation, it may succeed, by chance, but you had better
1112avoid parallel builds (make -j) in this platform, or get a better
1113compiler."
1114
1115        $run $rm $removelist
1116        exit $EXIT_FAILURE
1117      fi
1118
1119      # Just move the object if needed, then go on to compile the next one
1120      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1121        $show "$mv $output_obj $lobj"
1122        if $run $mv $output_obj $lobj; then :
1123        else
1124          error=$?
1125          $run $rm $removelist
1126          exit $error
1127        fi
1128      fi
1129
1130      # Append the name of the PIC object to the libtool object file.
1131      test -z "$run" && cat >> ${libobj}T <<EOF
1132pic_object='$objdir/$objname'
1133
1134EOF
1135
1136      # Allow error messages only from the first compilation.
1137      if test "$suppress_opt" = yes; then
1138        suppress_output=' >/dev/null 2>&1'
1139      fi
1140    else
1141      # No PIC object so indicate it doesn't exist in the libtool
1142      # object file.
1143      test -z "$run" && cat >> ${libobj}T <<EOF
1144pic_object=none
1145
1146EOF
1147    fi
1148
1149    # Only build a position-dependent object if we build old libraries.
1150    if test "$build_old_libs" = yes; then
1151      if test "$pic_mode" != yes; then
1152        # Don't build PIC code
1153        command="$base_compile $srcfile"
1154      else
1155        command="$base_compile $srcfile $pic_flag"
1156      fi
1157      if test "$compiler_c_o" = yes; then
1158        command="$command -o $obj"
1159      fi
1160
1161      # Suppress compiler output if we already did a PIC compilation.
1162      command="$command$suppress_output"
1163      $run $rm "$obj" "$output_obj"
1164      $show "$command"
1165      if $run eval "$command"; then :
1166      else
1167        $run $rm $removelist
1168        exit $EXIT_FAILURE
1169      fi
1170
1171      if test "$need_locks" = warn &&
1172         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1173        $echo "\
1174*** ERROR, $lockfile contains:
1175`cat $lockfile 2>/dev/null`
1176
1177but it should contain:
1178$srcfile
1179
1180This indicates that another process is trying to use the same
1181temporary object file, and libtool could not work around it because
1182your compiler does not support \`-c' and \`-o' together.  If you
1183repeat this compilation, it may succeed, by chance, but you had better
1184avoid parallel builds (make -j) in this platform, or get a better
1185compiler."
1186
1187        $run $rm $removelist
1188        exit $EXIT_FAILURE
1189      fi
1190
1191      # Just move the object if needed
1192      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1193        $show "$mv $output_obj $obj"
1194        if $run $mv $output_obj $obj; then :
1195        else
1196          error=$?
1197          $run $rm $removelist
1198          exit $error
1199        fi
1200      fi
1201
1202      # Append the name of the non-PIC object the libtool object file.
1203      # Only append if the libtool object file exists.
1204      test -z "$run" && cat >> ${libobj}T <<EOF
1205# Name of the non-PIC object.
1206non_pic_object='$objname'
1207
1208EOF
1209    else
1210      # Append the name of the non-PIC object the libtool object file.
1211      # Only append if the libtool object file exists.
1212      test -z "$run" && cat >> ${libobj}T <<EOF
1213# Name of the non-PIC object.
1214non_pic_object=none
1215
1216EOF
1217    fi
1218
1219    $run $mv "${libobj}T" "${libobj}"
1220
1221    # Unlock the critical section if it was locked
1222    if test "$need_locks" != no; then
1223      $run $rm "$lockfile"
1224    fi
1225
1226    exit $EXIT_SUCCESS
1227    ;;
1228
1229  # libtool link mode
1230  link | relink)
1231    modename="$modename: link"
1232    case $host in
1233    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1234      # It is impossible to link a dll without this setting, and
1235      # we shouldn't force the makefile maintainer to figure out
1236      # which system we are compiling for in order to pass an extra
1237      # flag for every libtool invocation.
1238      # allow_undefined=no
1239
1240      # FIXME: Unfortunately, there are problems with the above when trying
1241      # to make a dll which has undefined symbols, in which case not
1242      # even a static library is built.  For now, we need to specify
1243      # -no-undefined on the libtool link line when we can be certain
1244      # that all symbols are satisfied, otherwise we get a static library.
1245      allow_undefined=yes
1246      ;;
1247    *)
1248      allow_undefined=yes
1249      ;;
1250    esac
1251    libtool_args="$nonopt"
1252    base_compile="$nonopt $@"
1253    compile_command="$nonopt"
1254    finalize_command="$nonopt"
1255
1256    compile_rpath=
1257    finalize_rpath=
1258    compile_shlibpath=
1259    finalize_shlibpath=
1260    convenience=
1261    old_convenience=
1262    deplibs=
1263    old_deplibs=
1264    compiler_flags=
1265    linker_flags=
1266    dllsearchpath=
1267    lib_search_path=`pwd`
1268    inst_prefix_dir=
1269
1270    avoid_version=no
1271    dlfiles=
1272    dlprefiles=
1273    dlself=no
1274    export_dynamic=no
1275    export_symbols=
1276    export_symbols_regex=
1277    generated=
1278    libobjs=
1279    ltlibs=
1280    module=no
1281    no_install=no
1282    objs=
1283    non_pic_objects=
1284    precious_files_regex=
1285    prefer_static_libs=no
1286    preload=no
1287    prev=
1288    prevarg=
1289    release=
1290    rpath=
1291    xrpath=
1292    perm_rpath=
1293    temp_rpath=
1294    thread_safe=no
1295    vinfo=
1296    vinfo_number=no
1297
1298    func_infer_tag $base_compile
1299
1300    # We need to know -static, to get the right output filenames.
1301    for arg
1302    do
1303      case $arg in
1304      -all-static | -static)
1305        if test "X$arg" = "X-all-static"; then
1306          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1307            $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1308          fi
1309          if test -n "$link_static_flag"; then
1310            dlopen_self=$dlopen_self_static
1311          fi
1312        else
1313          if test -z "$pic_flag" && test -n "$link_static_flag"; then
1314            dlopen_self=$dlopen_self_static
1315          fi
1316        fi
1317        build_libtool_libs=no
1318        build_old_libs=yes
1319        prefer_static_libs=yes
1320        break
1321        ;;
1322      esac
1323    done
1324
1325    # See if our shared archives depend on static archives.
1326    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1327
1328    # Go through the arguments, transforming them on the way.
1329    while test "$#" -gt 0; do
1330      arg="$1"
1331      shift
1332      case $arg in
1333      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
1334        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1335        ;;
1336      *) qarg=$arg ;;
1337      esac
1338      libtool_args="$libtool_args $qarg"
1339
1340      # If the previous option needs an argument, assign it.
1341      if test -n "$prev"; then
1342        case $prev in
1343        output)
1344          compile_command="$compile_command @OUTPUT@"
1345          finalize_command="$finalize_command @OUTPUT@"
1346          ;;
1347        esac
1348
1349        case $prev in
1350        dlfiles|dlprefiles)
1351          if test "$preload" = no; then
1352            # Add the symbol object into the linking commands.
1353            compile_command="$compile_command @SYMFILE@"
1354            finalize_command="$finalize_command @SYMFILE@"
1355            preload=yes
1356          fi
1357          case $arg in
1358          *.la | *.lo) ;;  # We handle these cases below.
1359          force)
1360            if test "$dlself" = no; then
1361              dlself=needless
1362              export_dynamic=yes
1363            fi
1364            prev=
1365            continue
1366            ;;
1367          self)
1368            if test "$prev" = dlprefiles; then
1369              dlself=yes
1370            elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1371              dlself=yes
1372            else
1373              dlself=needless
1374              export_dynamic=yes
1375            fi
1376            prev=
1377            continue
1378            ;;
1379          *)
1380            if test "$prev" = dlfiles; then
1381              dlfiles="$dlfiles $arg"
1382            else
1383              dlprefiles="$dlprefiles $arg"
1384            fi
1385            prev=
1386            continue
1387            ;;
1388          esac
1389          ;;
1390        expsyms)
1391          export_symbols="$arg"
1392          if test ! -f "$arg"; then
1393            $echo "$modename: symbol file \`$arg' does not exist"
1394            exit $EXIT_FAILURE
1395          fi
1396          prev=
1397          continue
1398          ;;
1399        expsyms_regex)
1400          export_symbols_regex="$arg"
1401          prev=
1402          continue
1403          ;;
1404        inst_prefix)
1405          inst_prefix_dir="$arg"
1406          prev=
1407          continue
1408          ;;
1409        precious_regex)
1410          precious_files_regex="$arg"
1411          prev=
1412          continue
1413          ;;
1414        release)
1415          release="-$arg"
1416          prev=
1417          continue
1418          ;;
1419        objectlist)
1420          if test -f "$arg"; then
1421            save_arg=$arg
1422            moreargs=
1423            for fil in `cat $save_arg`
1424            do
1425#             moreargs="$moreargs $fil"
1426              arg=$fil
1427              # A libtool-controlled object.
1428
1429              # Check to see that this really is a libtool object.
1430              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1431                pic_object=
1432                non_pic_object=
1433
1434                # Read the .lo file
1435                # If there is no directory component, then add one.
1436                case $arg in
1437                */* | *\\*) . $arg ;;
1438                *) . ./$arg ;;
1439                esac
1440
1441                if test -z "$pic_object" || \
1442                   test -z "$non_pic_object" ||
1443                   test "$pic_object" = none && \
1444                   test "$non_pic_object" = none; then
1445                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1446                  exit $EXIT_FAILURE
1447                fi
1448
1449                # Extract subdirectory from the argument.
1450                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1451                if test "X$xdir" = "X$arg"; then
1452                  xdir=
1453                else
1454                  xdir="$xdir/"
1455                fi
1456
1457                if test "$pic_object" != none; then
1458                  # Prepend the subdirectory the object is found in.
1459                  pic_object="$xdir$pic_object"
1460
1461                  if test "$prev" = dlfiles; then
1462                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1463                      dlfiles="$dlfiles $pic_object"
1464                      prev=
1465                      continue
1466                    else
1467                      # If libtool objects are unsupported, then we need to preload.
1468                      prev=dlprefiles
1469                    fi
1470                  fi
1471
1472                  # CHECK ME:  I think I busted this.  -Ossama
1473                  if test "$prev" = dlprefiles; then
1474                    # Preload the old-style object.
1475                    dlprefiles="$dlprefiles $pic_object"
1476                    prev=
1477                  fi
1478
1479                  # A PIC object.
1480                  libobjs="$libobjs $pic_object"
1481                  arg="$pic_object"
1482                fi
1483
1484                # Non-PIC object.
1485                if test "$non_pic_object" != none; then
1486                  # Prepend the subdirectory the object is found in.
1487                  non_pic_object="$xdir$non_pic_object"
1488
1489                  # A standard non-PIC object
1490                  non_pic_objects="$non_pic_objects $non_pic_object"
1491                  if test -z "$pic_object" || test "$pic_object" = none ; then
1492                    arg="$non_pic_object"
1493                  fi
1494                fi
1495              else
1496                # Only an error if not doing a dry-run.
1497                if test -z "$run"; then
1498                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1499                  exit $EXIT_FAILURE
1500                else
1501                  # Dry-run case.
1502
1503                  # Extract subdirectory from the argument.
1504                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1505                  if test "X$xdir" = "X$arg"; then
1506                    xdir=
1507                  else
1508                    xdir="$xdir/"
1509                  fi
1510
1511                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1512                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1513                  libobjs="$libobjs $pic_object"
1514                  non_pic_objects="$non_pic_objects $non_pic_object"
1515                fi
1516              fi
1517            done
1518          else
1519            $echo "$modename: link input file \`$save_arg' does not exist"
1520            exit $EXIT_FAILURE
1521          fi
1522          arg=$save_arg
1523          prev=
1524          continue
1525          ;;
1526        rpath | xrpath)
1527          # We need an absolute path.
1528          case $arg in
1529          [\\/]* | [A-Za-z]:[\\/]*) ;;
1530          *)
1531            $echo "$modename: only absolute run-paths are allowed" 1>&2
1532            exit $EXIT_FAILURE
1533            ;;
1534          esac
1535          if test "$prev" = rpath; then
1536            case "$rpath " in
1537            *" $arg "*) ;;
1538            *) rpath="$rpath $arg" ;;
1539            esac
1540          else
1541            case "$xrpath " in
1542            *" $arg "*) ;;
1543            *) xrpath="$xrpath $arg" ;;
1544            esac
1545          fi
1546          prev=
1547          continue
1548          ;;
1549        xcompiler)
1550          compiler_flags="$compiler_flags $qarg"
1551          prev=
1552          compile_command="$compile_command $qarg"
1553          finalize_command="$finalize_command $qarg"
1554          continue
1555          ;;
1556        xlinker)
1557          linker_flags="$linker_flags $qarg"
1558          compiler_flags="$compiler_flags $wl$qarg"
1559          prev=
1560          compile_command="$compile_command $wl$qarg"
1561          finalize_command="$finalize_command $wl$qarg"
1562          continue
1563          ;;
1564        xcclinker)
1565          linker_flags="$linker_flags $qarg"
1566          compiler_flags="$compiler_flags $qarg"
1567          prev=
1568          compile_command="$compile_command $qarg"
1569          finalize_command="$finalize_command $qarg"
1570          continue
1571          ;;
1572        shrext)
1573          shrext_cmds="$arg"
1574          prev=
1575          continue
1576          ;;
1577        *)
1578          eval "$prev=\"\$arg\""
1579          prev=
1580          continue
1581          ;;
1582        esac
1583      fi # test -n "$prev"
1584
1585      prevarg="$arg"
1586
1587      case $arg in
1588      -all-static)
1589        if test -n "$link_static_flag"; then
1590          compile_command="$compile_command $link_static_flag"
1591          finalize_command="$finalize_command $link_static_flag"
1592        fi
1593        continue
1594        ;;
1595
1596      -allow-undefined)
1597        # FIXME: remove this flag sometime in the future.
1598        $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1599        continue
1600        ;;
1601
1602      -avoid-version)
1603        avoid_version=yes
1604        continue
1605        ;;
1606
1607      -dlopen)
1608        prev=dlfiles
1609        continue
1610        ;;
1611
1612      -dlpreopen)
1613        prev=dlprefiles
1614        continue
1615        ;;
1616
1617      -export-dynamic)
1618        export_dynamic=yes
1619        continue
1620        ;;
1621
1622      -export-symbols | -export-symbols-regex)
1623        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1624          $echo "$modename: more than one -exported-symbols argument is not allowed"
1625          exit $EXIT_FAILURE
1626        fi
1627        if test "X$arg" = "X-export-symbols"; then
1628          prev=expsyms
1629        else
1630          prev=expsyms_regex
1631        fi
1632        continue
1633        ;;
1634
1635      -inst-prefix-dir)
1636        prev=inst_prefix
1637        continue
1638        ;;
1639
1640      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1641      # so, if we see these flags be careful not to treat them like -L
1642      -L[A-Z][A-Z]*:*)
1643        case $with_gcc/$host in
1644        no/*-*-irix* | /*-*-irix*)
1645          compile_command="$compile_command $arg"
1646          finalize_command="$finalize_command $arg"
1647          ;;
1648        esac
1649        continue
1650        ;;
1651
1652      -L*)
1653        dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1654        # We need an absolute path.
1655        case $dir in
1656        [\\/]* | [A-Za-z]:[\\/]*) ;;
1657        *)
1658          absdir=`cd "$dir" && pwd`
1659          if test -z "$absdir"; then
1660            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1661            exit $EXIT_FAILURE
1662          fi
1663          dir="$absdir"
1664          ;;
1665        esac
1666        case "$deplibs " in
1667        *" -L$dir "*) ;;
1668        *)
1669          deplibs="$deplibs -L$dir"
1670          lib_search_path="$lib_search_path $dir"
1671          ;;
1672        esac
1673        case $host in
1674        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1675          case :$dllsearchpath: in
1676          *":$dir:"*) ;;
1677          *) dllsearchpath="$dllsearchpath:$dir";;
1678          esac
1679          ;;
1680        esac
1681        continue
1682        ;;
1683
1684      -l*)
1685        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1686          case $host in
1687          *-*-cygwin* | *-*-pw32* | *-*-beos*)
1688            # These systems don't actually have a C or math library (as such)
1689            continue
1690            ;;
1691          *-*-mingw* | *-*-os2*)
1692            # These systems don't actually have a C library (as such)
1693            test "X$arg" = "X-lc" && continue
1694            ;;
1695          *-*-openbsd* | *-*-freebsd*)
1696            # Do not include libc due to us having libc/libc_r.
1697            test "X$arg" = "X-lc" && continue
1698            ;;
1699          *-*-rhapsody* | *-*-darwin1.[012])
1700            # Rhapsody C and math libraries are in the System framework
1701            deplibs="$deplibs -framework System"
1702            continue
1703          esac
1704        elif test "X$arg" = "X-lc_r"; then
1705         case $host in
1706         *-*-openbsd* | *-*-freebsd*)
1707           # Do not include libc_r directly, use -pthread flag.
1708           continue
1709           ;;
1710         esac
1711        fi
1712        deplibs="$deplibs $arg"
1713        continue
1714        ;;
1715
1716     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1717        deplibs="$deplibs $arg"
1718        continue
1719        ;;
1720
1721      -module)
1722        module=yes
1723        continue
1724        ;;
1725
1726      # gcc -m* arguments should be passed to the linker via $compiler_flags
1727      # in order to pass architecture information to the linker
1728      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1729      # but this is not reliable with gcc because gcc may use -mfoo to
1730      # select a different linker, different libraries, etc, while
1731      # -Wl,-mfoo simply passes -mfoo to the linker.
1732      -m*)
1733        # Unknown arguments in both finalize_command and compile_command need
1734        # to be aesthetically quoted because they are evaled later.
1735        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1736        case $arg in
1737        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1738          arg="\"$arg\""
1739          ;;
1740        esac
1741        compile_command="$compile_command $arg"
1742        finalize_command="$finalize_command $arg"
1743        if test "$with_gcc" = "yes" ; then
1744          compiler_flags="$compiler_flags $arg"
1745        fi
1746        continue
1747        ;;
1748
1749      -shrext)
1750        prev=shrext
1751        continue
1752        ;;
1753
1754      -no-fast-install)
1755        fast_install=no
1756        continue
1757        ;;
1758
1759      -no-install)
1760        case $host in
1761        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1762          # The PATH hackery in wrapper scripts is required on Windows
1763          # in order for the loader to find any dlls it needs.
1764          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1765          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1766          fast_install=no
1767          ;;
1768        *) no_install=yes ;;
1769        esac
1770        continue
1771        ;;
1772
1773      -no-undefined)
1774        allow_undefined=no
1775        continue
1776        ;;
1777
1778      -objectlist)
1779        prev=objectlist
1780        continue
1781        ;;
1782
1783      -o) prev=output ;;
1784
1785      -precious-files-regex)
1786        prev=precious_regex
1787        continue
1788        ;;
1789
1790      -release)
1791        prev=release
1792        continue
1793        ;;
1794
1795      -rpath)
1796        prev=rpath
1797        continue
1798        ;;
1799
1800      -R)
1801        prev=xrpath
1802        continue
1803        ;;
1804
1805      -R*)
1806        dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1807        # We need an absolute path.
1808        case $dir in
1809        [\\/]* | [A-Za-z]:[\\/]*) ;;
1810        *)
1811          $echo "$modename: only absolute run-paths are allowed" 1>&2
1812          exit $EXIT_FAILURE
1813          ;;
1814        esac
1815        case "$xrpath " in
1816        *" $dir "*) ;;
1817        *) xrpath="$xrpath $dir" ;;
1818        esac
1819        continue
1820        ;;
1821
1822      -static)
1823        # The effects of -static are defined in a previous loop.
1824        # We used to do the same as -all-static on platforms that
1825        # didn't have a PIC flag, but the assumption that the effects
1826        # would be equivalent was wrong.  It would break on at least
1827        # Digital Unix and AIX.
1828        continue
1829        ;;
1830
1831      -thread-safe)
1832        thread_safe=yes
1833        continue
1834        ;;
1835
1836      -version-info)
1837        prev=vinfo
1838        continue
1839        ;;
1840      -version-number)
1841        prev=vinfo
1842        vinfo_number=yes
1843        continue
1844        ;;
1845
1846      -Wc,*)
1847        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1848        arg=
1849        save_ifs="$IFS"; IFS=','
1850        for flag in $args; do
1851          IFS="$save_ifs"
1852          case $flag in
1853            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1854            flag="\"$flag\""
1855            ;;
1856          esac
1857          arg="$arg $wl$flag"
1858          compiler_flags="$compiler_flags $flag"
1859        done
1860        IFS="$save_ifs"
1861        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1862        ;;
1863
1864      -Wl,*)
1865        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1866        arg=
1867        save_ifs="$IFS"; IFS=','
1868        for flag in $args; do
1869          IFS="$save_ifs"
1870          case $flag in
1871            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1872            flag="\"$flag\""
1873            ;;
1874          esac
1875          arg="$arg $wl$flag"
1876          compiler_flags="$compiler_flags $wl$flag"
1877          linker_flags="$linker_flags $flag"
1878        done
1879        IFS="$save_ifs"
1880        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1881        ;;
1882
1883      -Xcompiler)
1884        prev=xcompiler
1885        continue
1886        ;;
1887
1888      -Xlinker)
1889        prev=xlinker
1890        continue
1891        ;;
1892
1893      -XCClinker)
1894        prev=xcclinker
1895        continue
1896        ;;
1897
1898      # Some other compiler flag.
1899      -* | +*)
1900        # Unknown arguments in both finalize_command and compile_command need
1901        # to be aesthetically quoted because they are evaled later.
1902        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1903        case $arg in
1904        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1905          arg="\"$arg\""
1906          ;;
1907        esac
1908        ;;
1909
1910      *.$objext)
1911        # A standard object.
1912        objs="$objs $arg"
1913        ;;
1914
1915      *.lo)
1916        # A libtool-controlled object.
1917
1918        # Check to see that this really is a libtool object.
1919        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1920          pic_object=
1921          non_pic_object=
1922
1923          # Read the .lo file
1924          # If there is no directory component, then add one.
1925          case $arg in
1926          */* | *\\*) . $arg ;;
1927          *) . ./$arg ;;
1928          esac
1929
1930          if test -z "$pic_object" || \
1931             test -z "$non_pic_object" ||
1932             test "$pic_object" = none && \
1933             test "$non_pic_object" = none; then
1934            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1935            exit $EXIT_FAILURE
1936          fi
1937
1938          # Extract subdirectory from the argument.
1939          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1940          if test "X$xdir" = "X$arg"; then
1941            xdir=
1942          else
1943            xdir="$xdir/"
1944          fi
1945
1946          if test "$pic_object" != none; then
1947            # Prepend the subdirectory the object is found in.
1948            pic_object="$xdir$pic_object"
1949
1950            if test "$prev" = dlfiles; then
1951              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1952                dlfiles="$dlfiles $pic_object"
1953                prev=
1954                continue
1955              else
1956                # If libtool objects are unsupported, then we need to preload.
1957                prev=dlprefiles
1958              fi
1959            fi
1960
1961            # CHECK ME:  I think I busted this.  -Ossama
1962            if test "$prev" = dlprefiles; then
1963              # Preload the old-style object.
1964              dlprefiles="$dlprefiles $pic_object"
1965              prev=
1966            fi
1967
1968            # A PIC object.
1969            libobjs="$libobjs $pic_object"
1970            arg="$pic_object"
1971          fi
1972
1973          # Non-PIC object.
1974          if test "$non_pic_object" != none; then
1975            # Prepend the subdirectory the object is found in.
1976            non_pic_object="$xdir$non_pic_object"
1977
1978            # A standard non-PIC object
1979            non_pic_objects="$non_pic_objects $non_pic_object"
1980            if test -z "$pic_object" || test "$pic_object" = none ; then
1981              arg="$non_pic_object"
1982            fi
1983          fi
1984        else
1985          # Only an error if not doing a dry-run.
1986          if test -z "$run"; then
1987            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1988            exit $EXIT_FAILURE
1989          else
1990            # Dry-run case.
1991
1992            # Extract subdirectory from the argument.
1993            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1994            if test "X$xdir" = "X$arg"; then
1995              xdir=
1996            else
1997              xdir="$xdir/"
1998            fi
1999
2000            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
2001            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
2002            libobjs="$libobjs $pic_object"
2003            non_pic_objects="$non_pic_objects $non_pic_object"
2004          fi
2005        fi
2006        ;;
2007
2008      *.$libext)
2009        # An archive.
2010        deplibs="$deplibs $arg"
2011        old_deplibs="$old_deplibs $arg"
2012        continue
2013        ;;
2014
2015      *.la)
2016        # A libtool-controlled library.
2017
2018        if test "$prev" = dlfiles; then
2019          # This library was specified with -dlopen.
2020          dlfiles="$dlfiles $arg"
2021          prev=
2022        elif test "$prev" = dlprefiles; then
2023          # The library was specified with -dlpreopen.
2024          dlprefiles="$dlprefiles $arg"
2025          prev=
2026        else
2027          deplibs="$deplibs $arg"
2028        fi
2029        continue
2030        ;;
2031
2032      # Some other compiler argument.
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        ;;
2043      esac # arg
2044
2045      # Now actually substitute the argument into the commands.
2046      if test -n "$arg"; then
2047        compile_command="$compile_command $arg"
2048        finalize_command="$finalize_command $arg"
2049      fi
2050    done # argument parsing loop
2051
2052    if test -n "$prev"; then
2053      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2054      $echo "$help" 1>&2
2055      exit $EXIT_FAILURE
2056    fi
2057
2058    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2059      eval arg=\"$export_dynamic_flag_spec\"
2060      compile_command="$compile_command $arg"
2061      finalize_command="$finalize_command $arg"
2062    fi
2063
2064    oldlibs=
2065    # calculate the name of the file, without its directory
2066    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2067    libobjs_save="$libobjs"
2068
2069    if test -n "$shlibpath_var"; then
2070      # get the directories listed in $shlibpath_var
2071      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2072    else
2073      shlib_search_path=
2074    fi
2075    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2076    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2077
2078    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2079    if test "X$output_objdir" = "X$output"; then
2080      output_objdir="$objdir"
2081    else
2082      output_objdir="$output_objdir/$objdir"
2083    fi
2084    # Create the object directory.
2085    if test ! -d "$output_objdir"; then
2086      $show "$mkdir $output_objdir"
2087      $run $mkdir $output_objdir
2088      status=$?
2089      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
2090        exit $status
2091      fi
2092    fi
2093
2094    # Determine the type of output
2095    case $output in
2096    "")
2097      $echo "$modename: you must specify an output file" 1>&2
2098      $echo "$help" 1>&2
2099      exit $EXIT_FAILURE
2100      ;;
2101    *.$libext) linkmode=oldlib ;;
2102    *.lo | *.$objext) linkmode=obj ;;
2103    *.la) linkmode=lib ;;
2104    *) linkmode=prog ;; # Anything else should be a program.
2105    esac
2106
2107    case $host in
2108    *cygwin* | *mingw* | *pw32*)
2109      # don't eliminate duplications in $postdeps and $predeps
2110      duplicate_compiler_generated_deps=yes
2111      ;;
2112    *)
2113      duplicate_compiler_generated_deps=$duplicate_deps
2114      ;;
2115    esac
2116    specialdeplibs=
2117
2118    libs=
2119    # Find all interdependent deplibs by searching for libraries
2120    # that are linked more than once (e.g. -la -lb -la)
2121    for deplib in $deplibs; do
2122      if test "X$duplicate_deps" = "Xyes" ; then
2123        case "$libs " in
2124        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2125        esac
2126      fi
2127      libs="$libs $deplib"
2128    done
2129
2130    if test "$linkmode" = lib; then
2131      libs="$predeps $libs $compiler_lib_search_path $postdeps"
2132
2133      # Compute libraries that are listed more than once in $predeps
2134      # $postdeps and mark them as special (i.e., whose duplicates are
2135      # not to be eliminated).
2136      pre_post_deps=
2137      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2138        for pre_post_dep in $predeps $postdeps; do
2139          case "$pre_post_deps " in
2140          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2141          esac
2142          pre_post_deps="$pre_post_deps $pre_post_dep"
2143        done
2144      fi
2145      pre_post_deps=
2146    fi
2147
2148    deplibs=
2149    newdependency_libs=
2150    newlib_search_path=
2151    need_relink=no # whether we're linking any uninstalled libtool libraries
2152    notinst_deplibs= # not-installed libtool libraries
2153    notinst_path= # paths that contain not-installed libtool libraries
2154    case $linkmode in
2155    lib)
2156        passes="conv link"
2157        for file in $dlfiles $dlprefiles; do
2158          case $file in
2159          *.la) ;;
2160          *)
2161            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2162            exit $EXIT_FAILURE
2163            ;;
2164          esac
2165        done
2166        ;;
2167    prog)
2168        compile_deplibs=
2169        finalize_deplibs=
2170        alldeplibs=no
2171        newdlfiles=
2172        newdlprefiles=
2173        passes="conv scan dlopen dlpreopen link"
2174        ;;
2175    *)  passes="conv"
2176        ;;
2177    esac
2178    for pass in $passes; do
2179      if test "$linkmode,$pass" = "lib,link" ||
2180         test "$linkmode,$pass" = "prog,scan"; then
2181        libs="$deplibs"
2182        deplibs=
2183      fi
2184      if test "$linkmode" = prog; then
2185        case $pass in
2186        dlopen) libs="$dlfiles" ;;
2187        dlpreopen) libs="$dlprefiles" ;;
2188        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2189        esac
2190      fi
2191      if test "$pass" = dlopen; then
2192        # Collect dlpreopened libraries
2193        save_deplibs="$deplibs"
2194        deplibs=
2195      fi
2196      for deplib in $libs; do
2197        lib=
2198        found=no
2199        case $deplib in
2200        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2201          if test "$linkmode,$pass" = "prog,link"; then
2202            compile_deplibs="$deplib $compile_deplibs"
2203            finalize_deplibs="$deplib $finalize_deplibs"
2204          else
2205            deplibs="$deplib $deplibs"
2206          fi
2207          continue
2208          ;;
2209        -l*)
2210          if test "$linkmode" != lib && test "$linkmode" != prog; then
2211            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2212            continue
2213          fi
2214          if test "$pass" = conv; then
2215            deplibs="$deplib $deplibs"
2216            continue
2217          fi
2218          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2219          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2220            for search_ext in .la $std_shrext .so .a; do
2221              # Search the libtool library
2222              lib="$searchdir/lib${name}${search_ext}"
2223              if test -f "$lib"; then
2224                if test "$search_ext" = ".la"; then
2225                  found=yes
2226                else
2227                  found=no
2228                fi
2229                break 2
2230              fi
2231            done
2232          done
2233          if test "$found" != yes; then
2234            # deplib doesn't seem to be a libtool library
2235            if test "$linkmode,$pass" = "prog,link"; then
2236              compile_deplibs="$deplib $compile_deplibs"
2237              finalize_deplibs="$deplib $finalize_deplibs"
2238            else
2239              deplibs="$deplib $deplibs"
2240              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2241            fi
2242            continue
2243          else # deplib is a libtool library
2244            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2245            # We need to do some special things here, and not later.
2246            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2247              case " $predeps $postdeps " in
2248              *" $deplib "*)
2249                if (${SED} -e '2q' $lib |
2250                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2251                  library_names=
2252                  old_library=
2253                  case $lib in
2254                  */* | *\\*) . $lib ;;
2255                  *) . ./$lib ;;
2256                  esac
2257                  for l in $old_library $library_names; do
2258                    ll="$l"
2259                  done
2260                  if test "X$ll" = "X$old_library" ; then # only static version available
2261                    found=no
2262                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2263                    test "X$ladir" = "X$lib" && ladir="."
2264                    lib=$ladir/$old_library
2265                    if test "$linkmode,$pass" = "prog,link"; then
2266                      compile_deplibs="$deplib $compile_deplibs"
2267                      finalize_deplibs="$deplib $finalize_deplibs"
2268                    else
2269                      deplibs="$deplib $deplibs"
2270                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2271                    fi
2272                    continue
2273                  fi
2274                fi
2275                ;;
2276              *) ;;
2277              esac
2278            fi
2279          fi
2280          ;; # -l
2281        -L*)
2282          case $linkmode in
2283          lib)
2284            deplibs="$deplib $deplibs"
2285            test "$pass" = conv && continue
2286            newdependency_libs="$deplib $newdependency_libs"
2287            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2288            ;;
2289          prog)
2290            if test "$pass" = conv; then
2291              deplibs="$deplib $deplibs"
2292              continue
2293            fi
2294            if test "$pass" = scan; then
2295              deplibs="$deplib $deplibs"
2296            else
2297              compile_deplibs="$deplib $compile_deplibs"
2298              finalize_deplibs="$deplib $finalize_deplibs"
2299            fi
2300            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2301            ;;
2302          *)
2303            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2304            ;;
2305          esac # linkmode
2306          continue
2307          ;; # -L
2308        -R*)
2309          if test "$pass" = link; then
2310            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2311            # Make sure the xrpath contains only unique directories.
2312            case "$xrpath " in
2313            *" $dir "*) ;;
2314            *) xrpath="$xrpath $dir" ;;
2315            esac
2316          fi
2317          deplibs="$deplib $deplibs"
2318          continue
2319          ;;
2320        *.la) lib="$deplib" ;;
2321        *.$libext)
2322          if test "$pass" = conv; then
2323            deplibs="$deplib $deplibs"
2324            continue
2325          fi
2326          case $linkmode in
2327          lib)
2328            if test "$deplibs_check_method" != pass_all; then
2329              $echo
2330              $echo "*** Warning: Trying to link with static lib archive $deplib."
2331              $echo "*** I have the capability to make that library automatically link in when"
2332              $echo "*** you link to this library.  But I can only do this if you have a"
2333              $echo "*** shared version of the library, which you do not appear to have"
2334              $echo "*** because the file extensions .$libext of this argument makes me believe"
2335              $echo "*** that it is just a static archive that I should not used here."
2336            else
2337              $echo
2338              $echo "*** Warning: Linking the shared library $output against the"
2339              $echo "*** static library $deplib is not portable!"
2340              deplibs="$deplib $deplibs"
2341            fi
2342            continue
2343            ;;
2344          prog)
2345            if test "$pass" != link; then
2346              deplibs="$deplib $deplibs"
2347            else
2348              compile_deplibs="$deplib $compile_deplibs"
2349              finalize_deplibs="$deplib $finalize_deplibs"
2350            fi
2351            continue
2352            ;;
2353          esac # linkmode
2354          ;; # *.$libext
2355        *.lo | *.$objext)
2356          if test "$pass" = conv; then
2357            deplibs="$deplib $deplibs"
2358          elif test "$linkmode" = prog; then
2359            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2360              # If there is no dlopen support or we're linking statically,
2361              # we need to preload.
2362              newdlprefiles="$newdlprefiles $deplib"
2363              compile_deplibs="$deplib $compile_deplibs"
2364              finalize_deplibs="$deplib $finalize_deplibs"
2365            else
2366              newdlfiles="$newdlfiles $deplib"
2367            fi
2368          fi
2369          continue
2370          ;;
2371        %DEPLIBS%)
2372          alldeplibs=yes
2373          continue
2374          ;;
2375        esac # case $deplib
2376        if test "$found" = yes || test -f "$lib"; then :
2377        else
2378          $echo "$modename: cannot find the library \`$lib'" 1>&2
2379          exit $EXIT_FAILURE
2380        fi
2381
2382        # Check to see that this really is a libtool archive.
2383        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2384        else
2385          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2386          exit $EXIT_FAILURE
2387        fi
2388
2389        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2390        test "X$ladir" = "X$lib" && ladir="."
2391
2392        dlname=
2393        dlopen=
2394        dlpreopen=
2395        libdir=
2396        library_names=
2397        old_library=
2398        # If the library was installed with an old release of libtool,
2399        # it will not redefine variables installed, or shouldnotlink
2400        installed=yes
2401        shouldnotlink=no
2402
2403        # Read the .la file
2404        case $lib in
2405        */* | *\\*) . $lib ;;
2406        *) . ./$lib ;;
2407        esac
2408
2409        if test "$linkmode,$pass" = "lib,link" ||
2410           test "$linkmode,$pass" = "prog,scan" ||
2411           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2412          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2413          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2414        fi
2415
2416        if test "$pass" = conv; then
2417          # Only check for convenience libraries
2418          deplibs="$lib $deplibs"
2419          if test -z "$libdir"; then
2420            if test -z "$old_library"; then
2421              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2422              exit $EXIT_FAILURE
2423            fi
2424            # It is a libtool convenience library, so add in its objects.
2425            convenience="$convenience $ladir/$objdir/$old_library"
2426            old_convenience="$old_convenience $ladir/$objdir/$old_library"
2427            tmp_libs=
2428            for deplib in $dependency_libs; do
2429              deplibs="$deplib $deplibs"
2430              if test "X$duplicate_deps" = "Xyes" ; then
2431                case "$tmp_libs " in
2432                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2433                esac
2434              fi
2435              tmp_libs="$tmp_libs $deplib"
2436            done
2437          elif test "$linkmode" != prog && test "$linkmode" != lib; then
2438            $echo "$modename: \`$lib' is not a convenience library" 1>&2
2439            exit $EXIT_FAILURE
2440          fi
2441          continue
2442        fi # $pass = conv
2443
2444
2445        # Get the name of the library we link against.
2446        linklib=
2447        for l in $old_library $library_names; do
2448          linklib="$l"
2449        done
2450        if test -z "$linklib"; then
2451          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2452          exit $EXIT_FAILURE
2453        fi
2454
2455        # This library was specified with -dlopen.
2456        if test "$pass" = dlopen; then
2457          if test -z "$libdir"; then
2458            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2459            exit $EXIT_FAILURE
2460          fi
2461          if test -z "$dlname" ||
2462             test "$dlopen_support" != yes ||
2463             test "$build_libtool_libs" = no; then
2464            # If there is no dlname, no dlopen support or we're linking
2465            # statically, we need to preload.  We also need to preload any
2466            # dependent libraries so libltdl's deplib preloader doesn't
2467            # bomb out in the load deplibs phase.
2468            dlprefiles="$dlprefiles $lib $dependency_libs"
2469          else
2470            newdlfiles="$newdlfiles $lib"
2471          fi
2472          continue
2473        fi # $pass = dlopen
2474
2475        # We need an absolute path.
2476        case $ladir in
2477        [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2478        *)
2479          abs_ladir=`cd "$ladir" && pwd`
2480          if test -z "$abs_ladir"; then
2481            $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2482            $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2483            abs_ladir="$ladir"
2484          fi
2485          ;;
2486        esac
2487        laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2488
2489        # Find the relevant object directory and library name.
2490        if test "X$installed" = Xyes; then
2491          if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2492            $echo "$modename: warning: library \`$lib' was moved." 1>&2
2493            dir="$ladir"
2494            absdir="$abs_ladir"
2495            libdir="$abs_ladir"
2496          else
2497            dir="$libdir"
2498            absdir="$libdir"
2499          fi
2500        else
2501          dir="$ladir/$objdir"
2502          absdir="$abs_ladir/$objdir"
2503          # Remove this search path later
2504          notinst_path="$notinst_path $abs_ladir"
2505        fi # $installed = yes
2506        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2507
2508        # This library was specified with -dlpreopen.
2509        if test "$pass" = dlpreopen; then
2510          if test -z "$libdir"; then
2511            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2512            exit $EXIT_FAILURE
2513          fi
2514          # Prefer using a static library (so that no silly _DYNAMIC symbols
2515          # are required to link).
2516          if test -n "$old_library"; then
2517            newdlprefiles="$newdlprefiles $dir/$old_library"
2518          # Otherwise, use the dlname, so that lt_dlopen finds it.
2519          elif test -n "$dlname"; then
2520            newdlprefiles="$newdlprefiles $dir/$dlname"
2521          else
2522            newdlprefiles="$newdlprefiles $dir/$linklib"
2523          fi
2524        fi # $pass = dlpreopen
2525
2526        if test -z "$libdir"; then
2527          # Link the convenience library
2528          if test "$linkmode" = lib; then
2529            deplibs="$dir/$old_library $deplibs"
2530          elif test "$linkmode,$pass" = "prog,link"; then
2531            compile_deplibs="$dir/$old_library $compile_deplibs"
2532            finalize_deplibs="$dir/$old_library $finalize_deplibs"
2533          else
2534            deplibs="$lib $deplibs" # used for prog,scan pass
2535          fi
2536          continue
2537        fi
2538
2539
2540        if test "$linkmode" = prog && test "$pass" != link; then
2541          newlib_search_path="$newlib_search_path $ladir"
2542          deplibs="$lib $deplibs"
2543
2544          linkalldeplibs=no
2545          if test "$link_all_deplibs" != no || test -z "$library_names" ||
2546             test "$build_libtool_libs" = no; then
2547            linkalldeplibs=yes
2548          fi
2549
2550          tmp_libs=
2551          for deplib in $dependency_libs; do
2552            case $deplib in
2553            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2554            esac
2555            # Need to link against all dependency_libs?
2556            if test "$linkalldeplibs" = yes; then
2557              deplibs="$deplib $deplibs"
2558            else
2559              # Need to hardcode shared library paths
2560              # or/and link against static libraries
2561              newdependency_libs="$deplib $newdependency_libs"
2562            fi
2563            if test "X$duplicate_deps" = "Xyes" ; then
2564              case "$tmp_libs " in
2565              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2566              esac
2567            fi
2568            tmp_libs="$tmp_libs $deplib"
2569          done # for deplib
2570          continue
2571        fi # $linkmode = prog...
2572
2573        if test "$linkmode,$pass" = "prog,link"; then
2574          if test -n "$library_names" &&
2575             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2576            # We need to hardcode the library path
2577            if test -n "$shlibpath_var"; then
2578              # Make sure the rpath contains only unique directories.
2579              case "$temp_rpath " in
2580              *" $dir "*) ;;
2581              *" $absdir "*) ;;
2582              *) temp_rpath="$temp_rpath $dir" ;;
2583              esac
2584            fi
2585
2586            # Hardcode the library path.
2587            # Skip directories that are in the system default run-time
2588            # search path.
2589            case " $sys_lib_dlsearch_path " in
2590            *" $absdir "*) ;;
2591            *)
2592              case "$compile_rpath " in
2593              *" $absdir "*) ;;
2594              *) compile_rpath="$compile_rpath $absdir"
2595              esac
2596              ;;
2597            esac
2598            case " $sys_lib_dlsearch_path " in
2599            *" $libdir "*) ;;
2600            *)
2601              case "$finalize_rpath " in
2602              *" $libdir "*) ;;
2603              *) finalize_rpath="$finalize_rpath $libdir"
2604              esac
2605              ;;
2606            esac
2607          fi # $linkmode,$pass = prog,link...
2608
2609          if test "$alldeplibs" = yes &&
2610             { test "$deplibs_check_method" = pass_all ||
2611               { test "$build_libtool_libs" = yes &&
2612                 test -n "$library_names"; }; }; then
2613            # We only need to search for static libraries
2614            continue
2615          fi
2616        fi
2617
2618        link_static=no # Whether the deplib will be linked statically
2619        if test -n "$library_names" &&
2620           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2621          if test "$installed" = no; then
2622            notinst_deplibs="$notinst_deplibs $lib"
2623            need_relink=yes
2624          fi
2625          # This is a shared library
2626
2627          # Warn about portability, can't link against -module's on
2628          # some systems (darwin)
2629          if test "$shouldnotlink" = yes && test "$pass" = link ; then
2630            $echo
2631            if test "$linkmode" = prog; then
2632              $echo "*** Warning: Linking the executable $output against the loadable module"
2633            else
2634              $echo "*** Warning: Linking the shared library $output against the loadable module"
2635            fi
2636            $echo "*** $linklib is not portable!"
2637          fi
2638          if test "$linkmode" = lib &&
2639             test "$hardcode_into_libs" = yes; then
2640            # Hardcode the library path.
2641            # Skip directories that are in the system default run-time
2642            # search path.
2643            case " $sys_lib_dlsearch_path " in
2644            *" $absdir "*) ;;
2645            *)
2646              case "$compile_rpath " in
2647              *" $absdir "*) ;;
2648              *) compile_rpath="$compile_rpath $absdir"
2649              esac
2650              ;;
2651            esac
2652            case " $sys_lib_dlsearch_path " in
2653            *" $libdir "*) ;;
2654            *)
2655              case "$finalize_rpath " in
2656              *" $libdir "*) ;;
2657              *) finalize_rpath="$finalize_rpath $libdir"
2658              esac
2659              ;;
2660            esac
2661          fi
2662
2663          if test -n "$old_archive_from_expsyms_cmds"; then
2664            # figure out the soname
2665            set dummy $library_names
2666            realname="$2"
2667            shift; shift
2668            libname=`eval \\$echo \"$libname_spec\"`
2669            # use dlname if we got it. it's perfectly good, no?
2670            if test -n "$dlname"; then
2671              soname="$dlname"
2672            elif test -n "$soname_spec"; then
2673              # bleh windows
2674              case $host in
2675              *cygwin* | mingw*)
2676                major=`expr $current - $age`
2677                versuffix="-$major"
2678                ;;
2679              esac
2680              eval soname=\"$soname_spec\"
2681            else
2682              soname="$realname"
2683            fi
2684
2685            # Make a new name for the extract_expsyms_cmds to use
2686            soroot="$soname"
2687            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2688            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2689
2690            # If the library has no export list, then create one now
2691            if test -f "$output_objdir/$soname-def"; then :
2692            else
2693              $show "extracting exported symbol list from \`$soname'"
2694              save_ifs="$IFS"; IFS='~'
2695              cmds=$extract_expsyms_cmds
2696              for cmd in $cmds; do
2697                IFS="$save_ifs"
2698                eval cmd=\"$cmd\"
2699                $show "$cmd"
2700                $run eval "$cmd" || exit $?
2701              done
2702              IFS="$save_ifs"
2703            fi
2704
2705            # Create $newlib
2706            if test -f "$output_objdir/$newlib"; then :; else
2707              $show "generating import library for \`$soname'"
2708              save_ifs="$IFS"; IFS='~'
2709              cmds=$old_archive_from_expsyms_cmds
2710              for cmd in $cmds; do
2711                IFS="$save_ifs"
2712                eval cmd=\"$cmd\"
2713                $show "$cmd"
2714                $run eval "$cmd" || exit $?
2715              done
2716              IFS="$save_ifs"
2717            fi
2718            # make sure the library variables are pointing to the new library
2719            dir=$output_objdir
2720            linklib=$newlib
2721          fi # test -n "$old_archive_from_expsyms_cmds"
2722
2723          if test "$linkmode" = prog || test "$mode" != relink; then
2724            add_shlibpath=
2725            add_dir=
2726            add=
2727            lib_linked=yes
2728            case $hardcode_action in
2729            immediate | unsupported)
2730              if test "$hardcode_direct" = no; then
2731                add="$dir/$linklib"
2732                case $host in
2733                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2734                  *-*-darwin* )
2735                    # if the lib is a module then we can not link against
2736                    # it, someone is ignoring the new warnings I added
2737                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
2738                      $echo "** Warning, lib $linklib is a module, not a shared library"
2739                      if test -z "$old_library" ; then
2740                        $echo
2741                        $echo "** And there doesn't seem to be a static archive available"
2742                        $echo "** The link will probably fail, sorry"
2743                      else
2744                        add="$dir/$old_library"
2745                      fi
2746                    fi
2747                esac
2748              elif test "$hardcode_minus_L" = no; then
2749                case $host in
2750                *-*-sunos*) add_shlibpath="$dir" ;;
2751                esac
2752                add_dir="-L$dir"
2753                add="-l$name"
2754              elif test "$hardcode_shlibpath_var" = no; then
2755                add_shlibpath="$dir"
2756                add="-l$name"
2757              else
2758                lib_linked=no
2759              fi
2760              ;;
2761            relink)
2762              if test "$hardcode_direct" = yes; then
2763                add="$dir/$linklib"
2764              elif test "$hardcode_minus_L" = yes; then
2765                add_dir="-L$dir"
2766                # Try looking first in the location we're being installed to.
2767                if test -n "$inst_prefix_dir"; then
2768                  case "$libdir" in
2769                    [\\/]*)
2770                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2771                      ;;
2772                  esac
2773                fi
2774                add="-l$name"
2775              elif test "$hardcode_shlibpath_var" = yes; then
2776                add_shlibpath="$dir"
2777                add="-l$name"
2778              else
2779                lib_linked=no
2780              fi
2781              ;;
2782            *) lib_linked=no ;;
2783            esac
2784
2785            if test "$lib_linked" != yes; then
2786              $echo "$modename: configuration error: unsupported hardcode properties"
2787              exit $EXIT_FAILURE
2788            fi
2789
2790            if test -n "$add_shlibpath"; then
2791              case :$compile_shlibpath: in
2792              *":$add_shlibpath:"*) ;;
2793              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2794              esac
2795            fi
2796            if test "$linkmode" = prog; then
2797              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2798              test -n "$add" && compile_deplibs="$add $compile_deplibs"
2799            else
2800              test -n "$add_dir" && deplibs="$add_dir $deplibs"
2801              test -n "$add" && deplibs="$add $deplibs"
2802              if test "$hardcode_direct" != yes && \
2803                 test "$hardcode_minus_L" != yes && \
2804                 test "$hardcode_shlibpath_var" = yes; then
2805                case :$finalize_shlibpath: in
2806                *":$libdir:"*) ;;
2807                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2808                esac
2809              fi
2810            fi
2811          fi
2812
2813          if test "$linkmode" = prog || test "$mode" = relink; then
2814            add_shlibpath=
2815            add_dir=
2816            add=
2817            # Finalize command for both is simple: just hardcode it.
2818            if test "$hardcode_direct" = yes; then
2819              add="$libdir/$linklib"
2820            elif test "$hardcode_minus_L" = yes; then
2821              add_dir="-L$libdir"
2822              add="-l$name"
2823            elif test "$hardcode_shlibpath_var" = yes; then
2824              case :$finalize_shlibpath: in
2825              *":$libdir:"*) ;;
2826              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2827              esac
2828              add="-l$name"
2829            elif test "$hardcode_automatic" = yes; then
2830              if test -n "$inst_prefix_dir" &&
2831                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2832                add="$inst_prefix_dir$libdir/$linklib"
2833              else
2834                add="$libdir/$linklib"
2835              fi
2836            else
2837              # We cannot seem to hardcode it, guess we'll fake it.
2838              add_dir="-L$libdir"
2839              # Try looking first in the location we're being installed to.
2840              if test -n "$inst_prefix_dir"; then
2841                case "$libdir" in
2842                  [\\/]*)
2843                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2844                    ;;
2845                esac
2846              fi
2847              add="-l$name"
2848            fi
2849
2850            if test "$linkmode" = prog; then
2851              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2852              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2853            else
2854              test -n "$add_dir" && deplibs="$add_dir $deplibs"
2855              test -n "$add" && deplibs="$add $deplibs"
2856            fi
2857          fi
2858        elif test "$linkmode" = prog; then
2859          # Here we assume that one of hardcode_direct or hardcode_minus_L
2860          # is not unsupported.  This is valid on all known static and
2861          # shared platforms.
2862          if test "$hardcode_direct" != unsupported; then
2863            test -n "$old_library" && linklib="$old_library"
2864            compile_deplibs="$dir/$linklib $compile_deplibs"
2865            finalize_deplibs="$dir/$linklib $finalize_deplibs"
2866          else
2867            compile_deplibs="-l$name -L$dir $compile_deplibs"
2868            finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2869          fi
2870        elif test "$build_libtool_libs" = yes; then
2871          # Not a shared library
2872          if test "$deplibs_check_method" != pass_all; then
2873            # We're trying link a shared library against a static one
2874            # but the system doesn't support it.
2875
2876            # Just print a warning and add the library to dependency_libs so
2877            # that the program can be linked against the static library.
2878            $echo
2879            $echo "*** Warning: This system can not link to static lib archive $lib."
2880            $echo "*** I have the capability to make that library automatically link in when"
2881            $echo "*** you link to this library.  But I can only do this if you have a"
2882            $echo "*** shared version of the library, which you do not appear to have."
2883            if test "$module" = yes; then
2884              $echo "*** But as you try to build a module library, libtool will still create "
2885              $echo "*** a static module, that should work as long as the dlopening application"
2886              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2887              if test -z "$global_symbol_pipe"; then
2888                $echo
2889                $echo "*** However, this would only work if libtool was able to extract symbol"
2890                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2891                $echo "*** not find such a program.  So, this module is probably useless."
2892                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2893              fi
2894              if test "$build_old_libs" = no; then
2895                build_libtool_libs=module
2896                build_old_libs=yes
2897              else
2898                build_libtool_libs=no
2899              fi
2900            fi
2901          else
2902            convenience="$convenience $dir/$old_library"
2903            old_convenience="$old_convenience $dir/$old_library"
2904            deplibs="$dir/$old_library $deplibs"
2905            link_static=yes
2906          fi
2907        fi # link shared/static library?
2908
2909        if test "$linkmode" = lib; then
2910          if test -n "$dependency_libs" &&
2911             { test "$hardcode_into_libs" != yes ||
2912               test "$build_old_libs" = yes ||
2913               test "$link_static" = yes; }; then
2914            # Extract -R from dependency_libs
2915            temp_deplibs=
2916            for libdir in $dependency_libs; do
2917              case $libdir in
2918              -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2919                   case " $xrpath " in
2920                   *" $temp_xrpath "*) ;;
2921                   *) xrpath="$xrpath $temp_xrpath";;
2922                   esac;;
2923              *) temp_deplibs="$temp_deplibs $libdir";;
2924              esac
2925            done
2926            dependency_libs="$temp_deplibs"
2927          fi
2928
2929          newlib_search_path="$newlib_search_path $absdir"
2930          # Link against this library
2931          test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2932          # ... and its dependency_libs
2933          tmp_libs=
2934          for deplib in $dependency_libs; do
2935            newdependency_libs="$deplib $newdependency_libs"
2936            if test "X$duplicate_deps" = "Xyes" ; then
2937              case "$tmp_libs " in
2938              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2939              esac
2940            fi
2941            tmp_libs="$tmp_libs $deplib"
2942          done
2943
2944          if test "$link_all_deplibs" != no; then
2945            # Add the search paths of all dependency libraries
2946            for deplib in $dependency_libs; do
2947              case $deplib in
2948              -L*) path="$deplib" ;;
2949              *.la)
2950                dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2951                test "X$dir" = "X$deplib" && dir="."
2952                # We need an absolute path.
2953                case $dir in
2954                [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2955                *)
2956                  absdir=`cd "$dir" && pwd`
2957                  if test -z "$absdir"; then
2958                    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2959                    absdir="$dir"
2960                  fi
2961                  ;;
2962                esac
2963                if grep "^installed=no" $deplib > /dev/null; then
2964                  path="$absdir/$objdir"
2965                else
2966                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2967                  if test -z "$libdir"; then
2968                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2969                    exit $EXIT_FAILURE
2970                  fi
2971                  if test "$absdir" != "$libdir"; then
2972                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2973                  fi
2974                  path="$absdir"
2975                fi
2976                depdepl=
2977                case $host in
2978                *-*-darwin*)
2979                  # we do not want to link against static libs,
2980                  # but need to link against shared
2981                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2982                  if test -n "$deplibrary_names" ; then
2983                    for tmp in $deplibrary_names ; do
2984                      depdepl=$tmp
2985                    done
2986                    if test -f "$path/$depdepl" ; then
2987                      depdepl="$path/$depdepl"
2988                    fi
2989                    # do not add paths which are already there
2990                    case " $newlib_search_path " in
2991                    *" $path "*) ;;
2992                    *) newlib_search_path="$newlib_search_path $path";;
2993                    esac
2994                  fi
2995                  path=""
2996                  ;;
2997                *)
2998                  path="-L$path"
2999                  ;;
3000                esac
3001                ;;
3002              -l*)
3003                case $host in
3004                *-*-darwin*)
3005                  # Again, we only want to link against shared libraries
3006                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
3007                  for tmp in $newlib_search_path ; do
3008                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
3009                      eval depdepl="$tmp/lib$tmp_libs.dylib"
3010                      break
3011                    fi
3012                  done
3013                  path=""
3014                  ;;
3015                *) continue ;;
3016                esac
3017                ;;
3018              *) continue ;;
3019              esac
3020              case " $deplibs " in
3021              *" $depdepl "*) ;;
3022              *) deplibs="$depdepl $deplibs" ;;
3023              esac
3024              case " $deplibs " in
3025              *" $path "*) ;;
3026              *) deplibs="$deplibs $path" ;;
3027              esac
3028            done
3029          fi # link_all_deplibs != no
3030        fi # linkmode = lib
3031      done # for deplib in $libs
3032      dependency_libs="$newdependency_libs"
3033      if test "$pass" = dlpreopen; then
3034        # Link the dlpreopened libraries before other libraries
3035        for deplib in $save_deplibs; do
3036          deplibs="$deplib $deplibs"
3037        done
3038      fi
3039      if test "$pass" != dlopen; then
3040        if test "$pass" != conv; then
3041          # Make sure lib_search_path contains only unique directories.
3042          lib_search_path=
3043          for dir in $newlib_search_path; do
3044            case "$lib_search_path " in
3045            *" $dir "*) ;;
3046            *) lib_search_path="$lib_search_path $dir" ;;
3047            esac
3048          done
3049          newlib_search_path=
3050        fi
3051
3052        if test "$linkmode,$pass" != "prog,link"; then
3053          vars="deplibs"
3054        else
3055          vars="compile_deplibs finalize_deplibs"
3056        fi
3057        for var in $vars dependency_libs; do
3058          # Add libraries to $var in reverse order
3059          eval tmp_libs=\"\$$var\"
3060          new_libs=
3061          for deplib in $tmp_libs; do
3062            # FIXME: Pedantically, this is the right thing to do, so
3063            #        that some nasty dependency loop isn't accidentally
3064            #        broken:
3065            #new_libs="$deplib $new_libs"
3066            # Pragmatically, this seems to cause very few problems in
3067            # practice:
3068            case $deplib in
3069            -L*) new_libs="$deplib $new_libs" ;;
3070            -R*) ;;
3071            *)
3072              # And here is the reason: when a library appears more
3073              # than once as an explicit dependence of a library, or
3074              # is implicitly linked in more than once by the
3075              # compiler, it is considered special, and multiple
3076              # occurrences thereof are not removed.  Compare this
3077              # with having the same library being listed as a
3078              # dependency of multiple other libraries: in this case,
3079              # we know (pedantically, we assume) the library does not
3080              # need to be listed more than once, so we keep only the
3081              # last copy.  This is not always right, but it is rare
3082              # enough that we require users that really mean to play
3083              # such unportable linking tricks to link the library
3084              # using -Wl,-lname, so that libtool does not consider it
3085              # for duplicate removal.
3086              case " $specialdeplibs " in
3087              *" $deplib "*) new_libs="$deplib $new_libs" ;;
3088              *)
3089                case " $new_libs " in
3090                *" $deplib "*) ;;
3091                *) new_libs="$deplib $new_libs" ;;
3092                esac
3093                ;;
3094              esac
3095              ;;
3096            esac
3097          done
3098          tmp_libs=
3099          for deplib in $new_libs; do
3100            case $deplib in
3101            -L*)
3102              case " $tmp_libs " in
3103              *" $deplib "*) ;;
3104              *) tmp_libs="$tmp_libs $deplib" ;;
3105              esac
3106              ;;
3107            *) tmp_libs="$tmp_libs $deplib" ;;
3108            esac
3109          done
3110          eval $var=\"$tmp_libs\"
3111        done # for var
3112      fi
3113      # Last step: remove runtime libs from dependency_libs
3114      # (they stay in deplibs)
3115      tmp_libs=
3116      for i in $dependency_libs ; do
3117        case " $predeps $postdeps $compiler_lib_search_path " in
3118        *" $i "*)
3119          i=""
3120          ;;
3121        esac
3122        if test -n "$i" ; then
3123          tmp_libs="$tmp_libs $i"
3124        fi
3125      done
3126      dependency_libs=$tmp_libs
3127    done # for pass
3128    if test "$linkmode" = prog; then
3129      dlfiles="$newdlfiles"
3130      dlprefiles="$newdlprefiles"
3131    fi
3132
3133    case $linkmode in
3134    oldlib)
3135      if test -n "$deplibs"; then
3136        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3137      fi
3138
3139      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3140        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3141      fi
3142
3143      if test -n "$rpath"; then
3144        $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3145      fi
3146
3147      if test -n "$xrpath"; then
3148        $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3149      fi
3150
3151      if test -n "$vinfo"; then
3152        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3153      fi
3154
3155      if test -n "$release"; then
3156        $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3157      fi
3158
3159      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3160        $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3161      fi
3162
3163      # Now set the variables for building old libraries.
3164      build_libtool_libs=no
3165      oldlibs="$output"
3166      objs="$objs$old_deplibs"
3167      ;;
3168
3169    lib)
3170      # Make sure we only generate libraries of the form `libNAME.la'.
3171      case $outputname in
3172      lib*)
3173        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3174        eval shared_ext=\"$shrext_cmds\"
3175        eval libname=\"$libname_spec\"
3176        ;;
3177      *)
3178        if test "$module" = no; then
3179          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3180          $echo "$help" 1>&2
3181          exit $EXIT_FAILURE
3182        fi
3183        if test "$need_lib_prefix" != no; then
3184          # Add the "lib" prefix for modules if required
3185          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3186          eval shared_ext=\"$shrext_cmds\"
3187          eval libname=\"$libname_spec\"
3188        else
3189          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3190        fi
3191        ;;
3192      esac
3193
3194      if test -n "$objs"; then
3195        if test "$deplibs_check_method" != pass_all; then
3196          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3197          exit $EXIT_FAILURE
3198        else
3199          $echo
3200          $echo "*** Warning: Linking the shared library $output against the non-libtool"
3201          $echo "*** objects $objs is not portable!"
3202          libobjs="$libobjs $objs"
3203        fi
3204      fi
3205
3206      if test "$dlself" != no; then
3207        $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3208      fi
3209
3210      set dummy $rpath
3211      if test "$#" -gt 2; then
3212        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3213      fi
3214      install_libdir="$2"
3215
3216      oldlibs=
3217      if test -z "$rpath"; then
3218        if test "$build_libtool_libs" = yes; then
3219          # Building a libtool convenience library.
3220          # Some compilers have problems with a `.al' extension so
3221          # convenience libraries should have the same extension an
3222          # archive normally would.
3223          oldlibs="$output_objdir/$libname.$libext $oldlibs"
3224          build_libtool_libs=convenience
3225          build_old_libs=yes
3226        fi
3227
3228        if test -n "$vinfo"; then
3229          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3230        fi
3231
3232        if test -n "$release"; then
3233          $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3234        fi
3235      else
3236
3237        # Parse the version information argument.
3238        save_ifs="$IFS"; IFS=':'
3239        set dummy $vinfo 0 0 0
3240        IFS="$save_ifs"
3241
3242        if test -n "$8"; then
3243          $echo "$modename: too many parameters to \`-version-info'" 1>&2
3244          $echo "$help" 1>&2
3245          exit $EXIT_FAILURE
3246        fi
3247
3248        # convert absolute version numbers to libtool ages
3249        # this retains compatibility with .la files and attempts
3250        # to make the code below a bit more comprehensible
3251
3252        case $vinfo_number in
3253        yes)
3254          number_major="$2"
3255          number_minor="$3"
3256          number_revision="$4"
3257          #
3258          # There are really only two kinds -- those that
3259          # use the current revision as the major version
3260          # and those that subtract age and use age as
3261          # a minor version.  But, then there is irix
3262          # which has an extra 1 added just for fun
3263          #
3264          case $version_type in
3265          darwin|linux|osf|windows)
3266            current=`expr $number_major + $number_minor`
3267            age="$number_minor"
3268            revision="$number_revision"
3269            ;;
3270          freebsd-aout|freebsd-elf|sunos)
3271            current="$number_major"
3272            revision="$number_minor"
3273            age="0"
3274            ;;
3275          irix|nonstopux)
3276            current=`expr $number_major + $number_minor - 1`
3277            age="$number_minor"
3278            revision="$number_minor"
3279            ;;
3280          esac
3281          ;;
3282        no)
3283          current="$2"
3284          revision="$3"
3285          age="$4"
3286          ;;
3287        esac
3288
3289        # Check that each of the things are valid numbers.
3290        case $current in
3291        [0-9]*) ;;
3292        *)
3293          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
3294          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3295          exit $EXIT_FAILURE
3296          ;;
3297        esac
3298
3299        case $revision in
3300        [0-9]*) ;;
3301        *)
3302          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
3303          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3304          exit $EXIT_FAILURE
3305          ;;
3306        esac
3307
3308        case $age in
3309        [0-9]*) ;;
3310        *)
3311          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
3312          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3313          exit $EXIT_FAILURE
3314          ;;
3315        esac
3316
3317        if test "$age" -gt "$current"; then
3318          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3319          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3320          exit $EXIT_FAILURE
3321        fi
3322
3323        # Calculate the version variables.
3324        major=
3325        versuffix=
3326        verstring=
3327        case $version_type in
3328        none) ;;
3329
3330        darwin)
3331          # Like Linux, but with the current version available in
3332          # verstring for coding it into the library header
3333          major=.`expr $current - $age`
3334          versuffix="$major.$age.$revision"
3335          # Darwin ld doesn't like 0 for these options...
3336          minor_current=`expr $current + 1`
3337          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3338          ;;
3339
3340        freebsd-aout)
3341          major=".$current"
3342          versuffix=".$current.$revision";
3343          ;;
3344
3345        freebsd-elf)
3346          major=".$current"
3347          versuffix=".$current";
3348          ;;
3349
3350        irix | nonstopux)
3351          major=`expr $current - $age + 1`
3352
3353          case $version_type in
3354            nonstopux) verstring_prefix=nonstopux ;;
3355            *)         verstring_prefix=sgi ;;
3356          esac
3357          verstring="$verstring_prefix$major.$revision"
3358
3359          # Add in all the interfaces that we are compatible with.
3360          loop=$revision
3361          while test "$loop" -ne 0; do
3362            iface=`expr $revision - $loop`
3363            loop=`expr $loop - 1`
3364            verstring="$verstring_prefix$major.$iface:$verstring"
3365          done
3366
3367          # Before this point, $major must not contain `.'.
3368          major=.$major
3369          versuffix="$major.$revision"
3370          ;;
3371
3372        linux)
3373          major=.`expr $current - $age`
3374          versuffix="$major.$age.$revision"
3375          ;;
3376
3377        osf)
3378          major=.`expr $current - $age`
3379          versuffix=".$current.$age.$revision"
3380          verstring="$current.$age.$revision"
3381
3382          # Add in all the interfaces that we are compatible with.
3383          loop=$age
3384          while test "$loop" -ne 0; do
3385            iface=`expr $current - $loop`
3386            loop=`expr $loop - 1`
3387            verstring="$verstring:${iface}.0"
3388          done
3389
3390          # Make executables depend on our current version.
3391          verstring="$verstring:${current}.0"
3392          ;;
3393
3394        sunos)
3395          major=".$current"
3396          versuffix=".$current.$revision"
3397          ;;
3398
3399        windows)
3400          # Use '-' rather than '.', since we only want one
3401          # extension on DOS 8.3 filesystems.
3402          major=`expr $current - $age`
3403          versuffix="-$major"
3404          ;;
3405
3406        *)
3407          $echo "$modename: unknown library version type \`$version_type'" 1>&2
3408          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3409          exit $EXIT_FAILURE
3410          ;;
3411        esac
3412
3413        # Clear the version info if we defaulted, and they specified a release.
3414        if test -z "$vinfo" && test -n "$release"; then
3415          major=
3416          case $version_type in
3417          darwin)
3418            # we can't check for "0.0" in archive_cmds due to quoting
3419            # problems, so we reset it completely
3420            verstring=
3421            ;;
3422          *)
3423            verstring="0.0"
3424            ;;
3425          esac
3426          if test "$need_version" = no; then
3427            versuffix=
3428          else
3429            versuffix=".0.0"
3430          fi
3431        fi
3432
3433        # Remove version info from name if versioning should be avoided
3434        if test "$avoid_version" = yes && test "$need_version" = no; then
3435          major=
3436          versuffix=
3437          verstring=""
3438        fi
3439
3440        # Check to see if the archive will have undefined symbols.
3441        if test "$allow_undefined" = yes; then
3442          if test "$allow_undefined_flag" = unsupported; then
3443            $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3444            build_libtool_libs=no
3445            build_old_libs=yes
3446          fi
3447        else
3448          # Don't allow undefined symbols.
3449          allow_undefined_flag="$no_undefined_flag"
3450        fi
3451      fi
3452
3453      if test "$mode" != relink; then
3454        # Remove our outputs, but don't remove object files since they
3455        # may have been created when compiling PIC objects.
3456        removelist=
3457        tempremovelist=`$echo "$output_objdir/*"`
3458        for p in $tempremovelist; do
3459          case $p in
3460            *.$objext)
3461               ;;
3462            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3463               if test "X$precious_files_regex" != "X"; then
3464                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3465                 then
3466                   continue
3467                 fi
3468               fi
3469               removelist="$removelist $p"
3470               ;;
3471            *) ;;
3472          esac
3473        done
3474        if test -n "$removelist"; then
3475          $show "${rm}r $removelist"
3476          $run ${rm}r $removelist
3477        fi
3478      fi
3479
3480      # Now set the variables for building old libraries.
3481      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3482        oldlibs="$oldlibs $output_objdir/$libname.$libext"
3483
3484        # Transform .lo files to .o files.
3485        oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3486      fi
3487
3488      # Eliminate all temporary directories.
3489      for path in $notinst_path; do
3490        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3491        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3492        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3493      done
3494
3495      if test -n "$xrpath"; then
3496        # If the user specified any rpath flags, then add them.
3497        temp_xrpath=
3498        for libdir in $xrpath; do
3499          temp_xrpath="$temp_xrpath -R$libdir"
3500          case "$finalize_rpath " in
3501          *" $libdir "*) ;;
3502          *) finalize_rpath="$finalize_rpath $libdir" ;;
3503          esac
3504        done
3505        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3506          dependency_libs="$temp_xrpath $dependency_libs"
3507        fi
3508      fi
3509
3510      # Make sure dlfiles contains only unique files that won't be dlpreopened
3511      old_dlfiles="$dlfiles"
3512      dlfiles=
3513      for lib in $old_dlfiles; do
3514        case " $dlprefiles $dlfiles " in
3515        *" $lib "*) ;;
3516        *) dlfiles="$dlfiles $lib" ;;
3517        esac
3518      done
3519
3520      # Make sure dlprefiles contains only unique files
3521      old_dlprefiles="$dlprefiles"
3522      dlprefiles=
3523      for lib in $old_dlprefiles; do
3524        case "$dlprefiles " in
3525        *" $lib "*) ;;
3526        *) dlprefiles="$dlprefiles $lib" ;;
3527        esac
3528      done
3529
3530      if test "$build_libtool_libs" = yes; then
3531        if test -n "$rpath"; then
3532          case $host in
3533          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3534            # these systems don't actually have a c library (as such)!
3535            ;;
3536          *-*-rhapsody* | *-*-darwin1.[012])
3537            # Rhapsody C library is in the System framework
3538            deplibs="$deplibs -framework System"
3539            ;;
3540          *-*-netbsd*)
3541            # Don't link with libc until the a.out ld.so is fixed.
3542            ;;
3543          *-*-openbsd* | *-*-freebsd*)
3544            # Do not include libc due to us having libc/libc_r.
3545            test "X$arg" = "X-lc" && continue
3546            ;;
3547          *)
3548            # Add libc to deplibs on all other systems if necessary.
3549            if test "$build_libtool_need_lc" = "yes"; then
3550              deplibs="$deplibs -lc"
3551            fi
3552            ;;
3553          esac
3554        fi
3555
3556        # Transform deplibs into only deplibs that can be linked in shared.
3557        name_save=$name
3558        libname_save=$libname
3559        release_save=$release
3560        versuffix_save=$versuffix
3561        major_save=$major
3562        # I'm not sure if I'm treating the release correctly.  I think
3563        # release should show up in the -l (ie -lgmp5) so we don't want to
3564        # add it in twice.  Is that correct?
3565        release=""
3566        versuffix=""
3567        major=""
3568        newdeplibs=
3569        droppeddeps=no
3570        case $deplibs_check_method in
3571        pass_all)
3572          # Don't check for shared/static.  Everything works.
3573          # This might be a little naive.  We might want to check
3574          # whether the library exists or not.  But this is on
3575          # osf3 & osf4 and I'm not really sure... Just
3576          # implementing what was already the behavior.
3577          newdeplibs=$deplibs
3578          ;;
3579        test_compile)
3580          # This code stresses the "libraries are programs" paradigm to its
3581          # limits. Maybe even breaks it.  We compile a program, linking it
3582          # against the deplibs as a proxy for the library.  Then we can check
3583          # whether they linked in statically or dynamically with ldd.
3584          $rm conftest.c
3585          cat > conftest.c <<EOF
3586          int main() { return 0; }
3587EOF
3588          $rm conftest
3589          $LTCC -o conftest conftest.c $deplibs
3590          if test "$?" -eq 0 ; then
3591            ldd_output=`ldd conftest`
3592            for i in $deplibs; do
3593              name="`expr $i : '-l\(.*\)'`"
3594              # If $name is empty we are operating on a -L argument.
3595              if test "$name" != "" && test "$name" -ne "0"; then
3596                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3597                  case " $predeps $postdeps " in
3598                  *" $i "*)
3599                    newdeplibs="$newdeplibs $i"
3600                    i=""
3601                    ;;
3602                  esac
3603                fi
3604                if test -n "$i" ; then
3605                  libname=`eval \\$echo \"$libname_spec\"`
3606                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
3607                  set dummy $deplib_matches
3608                  deplib_match=$2
3609                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3610                    newdeplibs="$newdeplibs $i"
3611                  else
3612                    droppeddeps=yes
3613                    $echo
3614                    $echo "*** Warning: dynamic linker does not accept needed library $i."
3615                    $echo "*** I have the capability to make that library automatically link in when"
3616                    $echo "*** you link to this library.  But I can only do this if you have a"
3617                    $echo "*** shared version of the library, which I believe you do not have"
3618                    $echo "*** because a test_compile did reveal that the linker did not use it for"
3619                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3620                  fi
3621                fi
3622              else
3623                newdeplibs="$newdeplibs $i"
3624              fi
3625            done
3626          else
3627            # Error occurred in the first compile.  Let's try to salvage
3628            # the situation: Compile a separate program for each library.
3629            for i in $deplibs; do
3630              name="`expr $i : '-l\(.*\)'`"
3631              # If $name is empty we are operating on a -L argument.
3632              if test "$name" != "" && test "$name" != "0"; then
3633                $rm conftest
3634                $LTCC -o conftest conftest.c $i
3635                # Did it work?
3636                if test "$?" -eq 0 ; then
3637                  ldd_output=`ldd conftest`
3638                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3639                    case " $predeps $postdeps " in
3640                    *" $i "*)
3641                      newdeplibs="$newdeplibs $i"
3642                      i=""
3643                      ;;
3644                    esac
3645                  fi
3646                  if test -n "$i" ; then
3647                    libname=`eval \\$echo \"$libname_spec\"`
3648                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3649                    set dummy $deplib_matches
3650                    deplib_match=$2
3651                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3652                      newdeplibs="$newdeplibs $i"
3653                    else
3654                      droppeddeps=yes
3655                      $echo
3656                      $echo "*** Warning: dynamic linker does not accept needed library $i."
3657                      $echo "*** I have the capability to make that library automatically link in when"
3658                      $echo "*** you link to this library.  But I can only do this if you have a"
3659                      $echo "*** shared version of the library, which you do not appear to have"
3660                      $echo "*** because a test_compile did reveal that the linker did not use this one"
3661                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3662                    fi
3663                  fi
3664                else
3665                  droppeddeps=yes
3666                  $echo
3667                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3668                  $echo "***  make it link in!  You will probably need to install it or some"
3669                  $echo "*** library that it depends on before this library will be fully"
3670                  $echo "*** functional.  Installing it before continuing would be even better."
3671                fi
3672              else
3673                newdeplibs="$newdeplibs $i"
3674              fi
3675            done
3676          fi
3677          ;;
3678        file_magic*)
3679          set dummy $deplibs_check_method
3680          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3681          for a_deplib in $deplibs; do
3682            name="`expr $a_deplib : '-l\(.*\)'`"
3683            # If $name is empty we are operating on a -L argument.
3684            if test "$name" != "" && test  "$name" != "0"; then
3685              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3686                case " $predeps $postdeps " in
3687                *" $a_deplib "*)
3688                  newdeplibs="$newdeplibs $a_deplib"
3689                  a_deplib=""
3690                  ;;
3691                esac
3692              fi
3693              if test -n "$a_deplib" ; then
3694                libname=`eval \\$echo \"$libname_spec\"`
3695                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3696                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3697                  for potent_lib in $potential_libs; do
3698                      # Follow soft links.
3699                      if ls -lLd "$potent_lib" 2>/dev/null \
3700                         | grep " -> " >/dev/null; then
3701                        continue
3702                      fi
3703                      # The statement above tries to avoid entering an
3704                      # endless loop below, in case of cyclic links.
3705                      # We might still enter an endless loop, since a link
3706                      # loop can be closed while we follow links,
3707                      # but so what?
3708                      potlib="$potent_lib"
3709                      while test -h "$potlib" 2>/dev/null; do
3710                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3711                        case $potliblink in
3712                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3713                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3714                        esac
3715                      done
3716                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3717                         | ${SED} 10q \
3718                         | $EGREP "$file_magic_regex" > /dev/null; then
3719                        newdeplibs="$newdeplibs $a_deplib"
3720                        a_deplib=""
3721                        break 2
3722                      fi
3723                  done
3724                done
3725              fi
3726              if test -n "$a_deplib" ; then
3727                droppeddeps=yes
3728                $echo
3729                $echo "*** Warning: linker path does not have real file for library $a_deplib."
3730                $echo "*** I have the capability to make that library automatically link in when"
3731                $echo "*** you link to this library.  But I can only do this if you have a"
3732                $echo "*** shared version of the library, which you do not appear to have"
3733                $echo "*** because I did check the linker path looking for a file starting"
3734                if test -z "$potlib" ; then
3735                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
3736                else
3737                  $echo "*** with $libname and none of the candidates passed a file format test"
3738                  $echo "*** using a file magic. Last file checked: $potlib"
3739                fi
3740              fi
3741            else
3742              # Add a -L argument.
3743              newdeplibs="$newdeplibs $a_deplib"
3744            fi
3745          done # Gone through all deplibs.
3746          ;;
3747        match_pattern*)
3748          set dummy $deplibs_check_method
3749          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3750          for a_deplib in $deplibs; do
3751            name="`expr $a_deplib : '-l\(.*\)'`"
3752            # If $name is empty we are operating on a -L argument.
3753            if test -n "$name" && test "$name" != "0"; then
3754              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3755                case " $predeps $postdeps " in
3756                *" $a_deplib "*)
3757                  newdeplibs="$newdeplibs $a_deplib"
3758                  a_deplib=""
3759                  ;;
3760                esac
3761              fi
3762              if test -n "$a_deplib" ; then
3763                libname=`eval \\$echo \"$libname_spec\"`
3764                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3765                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3766                  for potent_lib in $potential_libs; do
3767                    potlib="$potent_lib" # see symlink-check above in file_magic test
3768                    if eval $echo \"$potent_lib\" 2>/dev/null \
3769                        | ${SED} 10q \
3770                        | $EGREP "$match_pattern_regex" > /dev/null; then
3771                      newdeplibs="$newdeplibs $a_deplib"
3772                      a_deplib=""
3773                      break 2
3774                    fi
3775                  done
3776                done
3777              fi
3778              if test -n "$a_deplib" ; then
3779                droppeddeps=yes
3780                $echo
3781                $echo "*** Warning: linker path does not have real file for library $a_deplib."
3782                $echo "*** I have the capability to make that library automatically link in when"
3783                $echo "*** you link to this library.  But I can only do this if you have a"
3784                $echo "*** shared version of the library, which you do not appear to have"
3785                $echo "*** because I did check the linker path looking for a file starting"
3786                if test -z "$potlib" ; then
3787                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3788                else
3789                  $echo "*** with $libname and none of the candidates passed a file format test"
3790                  $echo "*** using a regex pattern. Last file checked: $potlib"
3791                fi
3792              fi
3793            else
3794              # Add a -L argument.
3795              newdeplibs="$newdeplibs $a_deplib"
3796            fi
3797          done # Gone through all deplibs.
3798          ;;
3799        none | unknown | *)
3800          newdeplibs=""
3801          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3802            -e 's/ -[LR][^ ]*//g'`
3803          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3804            for i in $predeps $postdeps ; do
3805              # can't use Xsed below, because $i might contain '/'
3806              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3807            done
3808          fi
3809          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
3810            | grep . >/dev/null; then
3811            $echo
3812            if test "X$deplibs_check_method" = "Xnone"; then
3813              $echo "*** Warning: inter-library dependencies are not supported in this platform."
3814            else
3815              $echo "*** Warning: inter-library dependencies are not known to be supported."
3816            fi
3817            $echo "*** All declared inter-library dependencies are being dropped."
3818            droppeddeps=yes
3819          fi
3820          ;;
3821        esac
3822        versuffix=$versuffix_save
3823        major=$major_save
3824        release=$release_save
3825        libname=$libname_save
3826        name=$name_save
3827
3828        case $host in
3829        *-*-rhapsody* | *-*-darwin1.[012])
3830          # On Rhapsody replace the C library is the System framework
3831          newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3832          ;;
3833        esac
3834
3835        if test "$droppeddeps" = yes; then
3836          if test "$module" = yes; then
3837            $echo
3838            $echo "*** Warning: libtool could not satisfy all declared inter-library"
3839            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
3840            $echo "*** a static module, that should work as long as the dlopening"
3841            $echo "*** application is linked with the -dlopen flag."
3842            if test -z "$global_symbol_pipe"; then
3843              $echo
3844              $echo "*** However, this would only work if libtool was able to extract symbol"
3845              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3846              $echo "*** not find such a program.  So, this module is probably useless."
3847              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3848            fi
3849            if test "$build_old_libs" = no; then
3850              oldlibs="$output_objdir/$libname.$libext"
3851              build_libtool_libs=module
3852              build_old_libs=yes
3853            else
3854              build_libtool_libs=no
3855            fi
3856          else
3857            $echo "*** The inter-library dependencies that have been dropped here will be"
3858            $echo "*** automatically added whenever a program is linked with this library"
3859            $echo "*** or is declared to -dlopen it."
3860
3861            if test "$allow_undefined" = no; then
3862              $echo
3863              $echo "*** Since this library must not contain undefined symbols,"
3864              $echo "*** because either the platform does not support them or"
3865              $echo "*** it was explicitly requested with -no-undefined,"
3866              $echo "*** libtool will only create a static version of it."
3867              if test "$build_old_libs" = no; then
3868                oldlibs="$output_objdir/$libname.$libext"
3869                build_libtool_libs=module
3870                build_old_libs=yes
3871              else
3872                build_libtool_libs=no
3873              fi
3874            fi
3875          fi
3876        fi
3877        # Done checking deplibs!
3878        deplibs=$newdeplibs
3879      fi
3880
3881      # All the library-specific variables (install_libdir is set above).
3882      library_names=
3883      old_library=
3884      dlname=
3885
3886      # Test again, we may have decided not to build it any more
3887      if test "$build_libtool_libs" = yes; then
3888        if test "$hardcode_into_libs" = yes; then
3889          # Hardcode the library paths
3890          hardcode_libdirs=
3891          dep_rpath=
3892          rpath="$finalize_rpath"
3893          test "$mode" != relink && rpath="$compile_rpath$rpath"
3894          for libdir in $rpath; do
3895            if test -n "$hardcode_libdir_flag_spec"; then
3896              if test -n "$hardcode_libdir_separator"; then
3897                if test -z "$hardcode_libdirs"; then
3898                  hardcode_libdirs="$libdir"
3899                else
3900                  # Just accumulate the unique libdirs.
3901                  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3902                  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3903                    ;;
3904                  *)
3905                    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3906                    ;;
3907                  esac
3908                fi
3909              else
3910                eval flag=\"$hardcode_libdir_flag_spec\"
3911                dep_rpath="$dep_rpath $flag"
3912              fi
3913            elif test -n "$runpath_var"; then
3914              case "$perm_rpath " in
3915              *" $libdir "*) ;;
3916              *) perm_rpath="$perm_rpath $libdir" ;;
3917              esac
3918            fi
3919          done
3920          # Substitute the hardcoded libdirs into the rpath.
3921          if test -n "$hardcode_libdir_separator" &&
3922             test -n "$hardcode_libdirs"; then
3923            libdir="$hardcode_libdirs"
3924            if test -n "$hardcode_libdir_flag_spec_ld"; then
3925              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3926            else
3927              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3928            fi
3929          fi
3930          if test -n "$runpath_var" && test -n "$perm_rpath"; then
3931            # We should set the runpath_var.
3932            rpath=
3933            for dir in $perm_rpath; do
3934              rpath="$rpath$dir:"
3935            done
3936            eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3937          fi
3938          test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3939        fi
3940
3941        shlibpath="$finalize_shlibpath"
3942        test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3943        if test -n "$shlibpath"; then
3944          eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3945        fi
3946
3947        # Get the real and link names of the library.
3948        eval shared_ext=\"$shrext_cmds\"
3949        eval library_names=\"$library_names_spec\"
3950        set dummy $library_names
3951        realname="$2"
3952        shift; shift
3953
3954        if test -n "$soname_spec"; then
3955          eval soname=\"$soname_spec\"
3956        else
3957          soname="$realname"
3958        fi
3959        if test -z "$dlname"; then
3960          dlname=$soname
3961        fi
3962
3963        lib="$output_objdir/$realname"
3964        for link
3965        do
3966          linknames="$linknames $link"
3967        done
3968
3969        # Use standard objects if they are pic
3970        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3971
3972        # Prepare the list of exported symbols
3973        if test -z "$export_symbols"; then
3974          if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3975            $show "generating symbol list for \`$libname.la'"
3976            export_symbols="$output_objdir/$libname.exp"
3977            $run $rm $export_symbols
3978            cmds=$export_symbols_cmds
3979            save_ifs="$IFS"; IFS='~'
3980            for cmd in $cmds; do
3981              IFS="$save_ifs"
3982              eval cmd=\"$cmd\"
3983              if len=`expr "X$cmd" : ".*"` &&
3984               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3985                $show "$cmd"
3986                $run eval "$cmd" || exit $?
3987                skipped_export=false
3988              else
3989                # The command line is too long to execute in one step.
3990                $show "using reloadable object file for export list..."
3991                skipped_export=:
3992              fi
3993            done
3994            IFS="$save_ifs"
3995            if test -n "$export_symbols_regex"; then
3996              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3997              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3998              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3999              $run eval '$mv "${export_symbols}T" "$export_symbols"'
4000            fi
4001          fi
4002        fi
4003
4004        if test -n "$export_symbols" && test -n "$include_expsyms"; then
4005          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4006        fi
4007
4008        tmp_deplibs=
4009        for test_deplib in $deplibs; do
4010                case " $convenience " in
4011                *" $test_deplib "*) ;;
4012                *)
4013                        tmp_deplibs="$tmp_deplibs $test_deplib"
4014                        ;;
4015                esac
4016        done
4017        deplibs="$tmp_deplibs"
4018
4019        if test -n "$convenience"; then
4020          if test -n "$whole_archive_flag_spec"; then
4021            save_libobjs=$libobjs
4022            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4023          else
4024            gentop="$output_objdir/${outputname}x"
4025            $show "${rm}r $gentop"
4026            $run ${rm}r "$gentop"
4027            $show "$mkdir $gentop"
4028            $run $mkdir "$gentop"
4029            status=$?
4030            if test "$status" -ne 0 && test ! -d "$gentop"; then
4031              exit $status
4032            fi
4033            generated="$generated $gentop"
4034
4035            for xlib in $convenience; do
4036              # Extract the objects.
4037              case $xlib in
4038              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4039              *) xabs=`pwd`"/$xlib" ;;
4040              esac
4041              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4042              xdir="$gentop/$xlib"
4043
4044              $show "${rm}r $xdir"
4045              $run ${rm}r "$xdir"
4046              $show "$mkdir $xdir"
4047              $run $mkdir "$xdir"
4048              status=$?
4049              if test "$status" -ne 0 && test ! -d "$xdir"; then
4050                exit $status
4051              fi
4052              # We will extract separately just the conflicting names and we will no
4053              # longer touch any unique names. It is faster to leave these extract
4054              # automatically by $AR in one run.
4055              $show "(cd $xdir && $AR x $xabs)"
4056              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4057              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4058                :
4059              else
4060                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4061                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4062                $AR t "$xabs" | sort | uniq -cd | while read -r count name
4063                do
4064                  i=1
4065                  while test "$i" -le "$count"
4066                  do
4067                   # Put our $i before any first dot (extension)
4068                   # Never overwrite any file
4069                   name_to="$name"
4070                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4071                   do
4072                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4073                   done
4074                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4075                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4076                   i=`expr $i + 1`
4077                  done
4078                done
4079              fi
4080
4081              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4082            done
4083          fi
4084        fi
4085
4086        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4087          eval flag=\"$thread_safe_flag_spec\"
4088          linker_flags="$linker_flags $flag"
4089        fi
4090
4091        # Make a backup of the uninstalled library when relinking
4092        if test "$mode" = relink; then
4093          $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4094        fi
4095
4096        # Do each of the archive commands.
4097        if test "$module" = yes && test -n "$module_cmds" ; then
4098          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4099            eval test_cmds=\"$module_expsym_cmds\"
4100            cmds=$module_expsym_cmds
4101          else
4102            eval test_cmds=\"$module_cmds\"
4103            cmds=$module_cmds
4104          fi
4105        else
4106        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4107          eval test_cmds=\"$archive_expsym_cmds\"
4108          cmds=$archive_expsym_cmds
4109        else
4110          eval test_cmds=\"$archive_cmds\"
4111          cmds=$archive_cmds
4112          fi
4113        fi
4114
4115        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
4116           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4117          :
4118        else
4119          # The command line is too long to link in one step, link piecewise.
4120          $echo "creating reloadable object files..."
4121
4122          # Save the value of $output and $libobjs because we want to
4123          # use them later.  If we have whole_archive_flag_spec, we
4124          # want to use save_libobjs as it was before
4125          # whole_archive_flag_spec was expanded, because we can't
4126          # assume the linker understands whole_archive_flag_spec.
4127          # This may have to be revisited, in case too many
4128          # convenience libraries get linked in and end up exceeding
4129          # the spec.
4130          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4131            save_libobjs=$libobjs
4132          fi
4133          save_output=$output
4134
4135          # Clear the reloadable object creation command queue and
4136          # initialize k to one.
4137          test_cmds=
4138          concat_cmds=
4139          objlist=
4140          delfiles=
4141          last_robj=
4142          k=1
4143          output=$output_objdir/$save_output-${k}.$objext
4144          # Loop over the list of objects to be linked.
4145          for obj in $save_libobjs
4146          do
4147            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4148            if test "X$objlist" = X ||
4149               { len=`expr "X$test_cmds" : ".*"` &&
4150                 test "$len" -le "$max_cmd_len"; }; then
4151              objlist="$objlist $obj"
4152            else
4153              # The command $test_cmds is almost too long, add a
4154              # command to the queue.
4155              if test "$k" -eq 1 ; then
4156                # The first file doesn't have a previous command to add.
4157                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4158              else
4159                # All subsequent reloadable object files will link in
4160                # the last one created.
4161                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4162              fi
4163              last_robj=$output_objdir/$save_output-${k}.$objext
4164              k=`expr $k + 1`
4165              output=$output_objdir/$save_output-${k}.$objext
4166              objlist=$obj
4167              len=1
4168            fi
4169          done
4170          # Handle the remaining objects by creating one last
4171          # reloadable object file.  All subsequent reloadable object
4172          # files will link in the last one created.
4173          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4174          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4175
4176          if ${skipped_export-false}; then
4177            $show "generating symbol list for \`$libname.la'"
4178            export_symbols="$output_objdir/$libname.exp"
4179            $run $rm $export_symbols
4180            libobjs=$output
4181            # Append the command to create the export file.
4182            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4183          fi
4184
4185          # Set up a command to remove the reloadale object files
4186          # after they are used.
4187          i=0
4188          while test "$i" -lt "$k"
4189          do
4190            i=`expr $i + 1`
4191            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
4192          done
4193
4194          $echo "creating a temporary reloadable object file: $output"
4195
4196          # Loop through the commands generated above and execute them.
4197          save_ifs="$IFS"; IFS='~'
4198          for cmd in $concat_cmds; do
4199            IFS="$save_ifs"
4200            $show "$cmd"
4201            $run eval "$cmd" || exit $?
4202          done
4203          IFS="$save_ifs"
4204
4205          libobjs=$output
4206          # Restore the value of output.
4207          output=$save_output
4208
4209          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4210            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4211          fi
4212          # Expand the library linking commands again to reset the
4213          # value of $libobjs for piecewise linking.
4214
4215          # Do each of the archive commands.
4216          if test "$module" = yes && test -n "$module_cmds" ; then
4217            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4218              cmds=$module_expsym_cmds
4219            else
4220              cmds=$module_cmds
4221            fi
4222          else
4223          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4224            cmds=$archive_expsym_cmds
4225          else
4226            cmds=$archive_cmds
4227            fi
4228          fi
4229
4230          # Append the command to remove the reloadable object files
4231          # to the just-reset $cmds.
4232          eval cmds=\"\$cmds~\$rm $delfiles\"
4233        fi
4234        save_ifs="$IFS"; IFS='~'
4235        for cmd in $cmds; do
4236          IFS="$save_ifs"
4237          eval cmd=\"$cmd\"
4238          $show "$cmd"
4239          $run eval "$cmd" || exit $?
4240        done
4241        IFS="$save_ifs"
4242
4243        # Restore the uninstalled library and exit
4244        if test "$mode" = relink; then
4245          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4246          exit $EXIT_SUCCESS
4247        fi
4248
4249        # Create links to the real library.
4250        for linkname in $linknames; do
4251          if test "$realname" != "$linkname"; then
4252            $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4253            $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4254          fi
4255        done
4256
4257        # If -module or -export-dynamic was specified, set the dlname.
4258        if test "$module" = yes || test "$export_dynamic" = yes; then
4259          # On all known operating systems, these are identical.
4260          dlname="$soname"
4261        fi
4262      fi
4263      ;;
4264
4265    obj)
4266      if test -n "$deplibs"; then
4267        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4268      fi
4269
4270      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4271        $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4272      fi
4273
4274      if test -n "$rpath"; then
4275        $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4276      fi
4277
4278      if test -n "$xrpath"; then
4279        $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4280      fi
4281
4282      if test -n "$vinfo"; then
4283        $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4284      fi
4285
4286      if test -n "$release"; then
4287        $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4288      fi
4289
4290      case $output in
4291      *.lo)
4292        if test -n "$objs$old_deplibs"; then
4293          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4294          exit $EXIT_FAILURE
4295        fi
4296        libobj="$output"
4297        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4298        ;;
4299      *)
4300        libobj=
4301        obj="$output"
4302        ;;
4303      esac
4304
4305      # Delete the old objects.
4306      $run $rm $obj $libobj
4307
4308      # Objects from convenience libraries.  This assumes
4309      # single-version convenience libraries.  Whenever we create
4310      # different ones for PIC/non-PIC, this we'll have to duplicate
4311      # the extraction.
4312      reload_conv_objs=
4313      gentop=
4314      # reload_cmds runs $LD directly, so let us get rid of
4315      # -Wl from whole_archive_flag_spec
4316      wl=
4317
4318      if test -n "$convenience"; then
4319        if test -n "$whole_archive_flag_spec"; then
4320          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4321        else
4322          gentop="$output_objdir/${obj}x"
4323          $show "${rm}r $gentop"
4324          $run ${rm}r "$gentop"
4325          $show "$mkdir $gentop"
4326          $run $mkdir "$gentop"
4327          status=$?
4328          if test "$status" -ne 0 && test ! -d "$gentop"; then
4329            exit $status
4330          fi
4331          generated="$generated $gentop"
4332
4333          for xlib in $convenience; do
4334            # Extract the objects.
4335            case $xlib in
4336            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4337            *) xabs=`pwd`"/$xlib" ;;
4338            esac
4339            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4340            xdir="$gentop/$xlib"
4341
4342            $show "${rm}r $xdir"
4343            $run ${rm}r "$xdir"
4344            $show "$mkdir $xdir"
4345            $run $mkdir "$xdir"
4346            status=$?
4347            if test "$status" -ne 0 && test ! -d "$xdir"; then
4348              exit $status
4349            fi
4350            # We will extract separately just the conflicting names and we will no
4351            # longer touch any unique names. It is faster to leave these extract
4352            # automatically by $AR in one run.
4353            $show "(cd $xdir && $AR x $xabs)"
4354            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4355            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4356              :
4357            else
4358              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4359              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4360              $AR t "$xabs" | sort | uniq -cd | while read -r count name
4361              do
4362                i=1
4363                while test "$i" -le "$count"
4364                do
4365                 # Put our $i before any first dot (extension)
4366                 # Never overwrite any file
4367                 name_to="$name"
4368                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4369                 do
4370                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4371                 done
4372                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4373                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4374                 i=`expr $i + 1`
4375                done
4376              done
4377            fi
4378
4379            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4380          done
4381        fi
4382      fi
4383
4384      # Create the old-style object.
4385      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
4386
4387      output="$obj"
4388      cmds=$reload_cmds
4389      save_ifs="$IFS"; IFS='~'
4390      for cmd in $cmds; do
4391        IFS="$save_ifs"
4392        eval cmd=\"$cmd\"
4393        $show "$cmd"
4394        $run eval "$cmd" || exit $?
4395      done
4396      IFS="$save_ifs"
4397
4398      # Exit if we aren't doing a library object file.
4399      if test -z "$libobj"; then
4400        if test -n "$gentop"; then
4401          $show "${rm}r $gentop"
4402          $run ${rm}r $gentop
4403        fi
4404
4405        exit $EXIT_SUCCESS
4406      fi
4407
4408      if test "$build_libtool_libs" != yes; then
4409        if test -n "$gentop"; then
4410          $show "${rm}r $gentop"
4411          $run ${rm}r $gentop
4412        fi
4413
4414        # Create an invalid libtool object if no PIC, so that we don't
4415        # accidentally link it into a program.
4416        # $show "echo timestamp > $libobj"
4417        # $run eval "echo timestamp > $libobj" || exit $?
4418        exit $EXIT_SUCCESS
4419      fi
4420
4421      if test -n "$pic_flag" || test "$pic_mode" != default; then
4422        # Only do commands if we really have different PIC objects.
4423        reload_objs="$libobjs $reload_conv_objs"
4424        output="$libobj"
4425        cmds=$reload_cmds
4426        save_ifs="$IFS"; IFS='~'
4427        for cmd in $cmds; do
4428          IFS="$save_ifs"
4429          eval cmd=\"$cmd\"
4430          $show "$cmd"
4431          $run eval "$cmd" || exit $?
4432        done
4433        IFS="$save_ifs"
4434      fi
4435
4436      if test -n "$gentop"; then
4437        $show "${rm}r $gentop"
4438        $run ${rm}r $gentop
4439      fi
4440
4441      exit $EXIT_SUCCESS
4442      ;;
4443
4444    prog)
4445      case $host in
4446        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4447      esac
4448      if test -n "$vinfo"; then
4449        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4450      fi
4451
4452      if test -n "$release"; then
4453        $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4454      fi
4455
4456      if test "$preload" = yes; then
4457        if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4458           test "$dlopen_self_static" = unknown; then
4459          $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4460        fi
4461      fi
4462
4463      case $host in
4464      *-*-rhapsody* | *-*-darwin1.[012])
4465        # On Rhapsody replace the C library is the System framework
4466        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4467        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4468        ;;
4469      esac
4470
4471      case $host in
4472      *darwin*)
4473        # Don't allow lazy linking, it breaks C++ global constructors
4474        if test "$tagname" = CXX ; then
4475        compile_command="$compile_command ${wl}-bind_at_load"
4476        finalize_command="$finalize_command ${wl}-bind_at_load"
4477        fi
4478        ;;
4479      esac
4480
4481      compile_command="$compile_command $compile_deplibs"
4482      finalize_command="$finalize_command $finalize_deplibs"
4483
4484      if test -n "$rpath$xrpath"; then
4485        # If the user specified any rpath flags, then add them.
4486        for libdir in $rpath $xrpath; do
4487          # This is the magic to use -rpath.
4488          case "$finalize_rpath " in
4489          *" $libdir "*) ;;
4490          *) finalize_rpath="$finalize_rpath $libdir" ;;
4491          esac
4492        done
4493      fi
4494
4495      # Now hardcode the library paths
4496      rpath=
4497      hardcode_libdirs=
4498      for libdir in $compile_rpath $finalize_rpath; do
4499        if test -n "$hardcode_libdir_flag_spec"; then
4500          if test -n "$hardcode_libdir_separator"; then
4501            if test -z "$hardcode_libdirs"; then
4502              hardcode_libdirs="$libdir"
4503            else
4504              # Just accumulate the unique libdirs.
4505              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4506              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4507                ;;
4508              *)
4509                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4510                ;;
4511              esac
4512            fi
4513          else
4514            eval flag=\"$hardcode_libdir_flag_spec\"
4515            rpath="$rpath $flag"
4516          fi
4517        elif test -n "$runpath_var"; then
4518          case "$perm_rpath " in
4519          *" $libdir "*) ;;
4520          *) perm_rpath="$perm_rpath $libdir" ;;
4521          esac
4522        fi
4523        case $host in
4524        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4525          case :$dllsearchpath: in
4526          *":$libdir:"*) ;;
4527          *) dllsearchpath="$dllsearchpath:$libdir";;
4528          esac
4529          ;;
4530        esac
4531      done
4532      # Substitute the hardcoded libdirs into the rpath.
4533      if test -n "$hardcode_libdir_separator" &&
4534         test -n "$hardcode_libdirs"; then
4535        libdir="$hardcode_libdirs"
4536        eval rpath=\" $hardcode_libdir_flag_spec\"
4537      fi
4538      compile_rpath="$rpath"
4539
4540      rpath=
4541      hardcode_libdirs=
4542      for libdir in $finalize_rpath; do
4543        if test -n "$hardcode_libdir_flag_spec"; then
4544          if test -n "$hardcode_libdir_separator"; then
4545            if test -z "$hardcode_libdirs"; then
4546              hardcode_libdirs="$libdir"
4547            else
4548              # Just accumulate the unique libdirs.
4549              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4550              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4551                ;;
4552              *)
4553                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4554                ;;
4555              esac
4556            fi
4557          else
4558            eval flag=\"$hardcode_libdir_flag_spec\"
4559            rpath="$rpath $flag"
4560          fi
4561        elif test -n "$runpath_var"; then
4562          case "$finalize_perm_rpath " in
4563          *" $libdir "*) ;;
4564          *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4565          esac
4566        fi
4567      done
4568      # Substitute the hardcoded libdirs into the rpath.
4569      if test -n "$hardcode_libdir_separator" &&
4570         test -n "$hardcode_libdirs"; then
4571        libdir="$hardcode_libdirs"
4572        eval rpath=\" $hardcode_libdir_flag_spec\"
4573      fi
4574      finalize_rpath="$rpath"
4575
4576      if test -n "$libobjs" && test "$build_old_libs" = yes; then
4577        # Transform all the library objects into standard objects.
4578        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4579        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4580      fi
4581
4582      dlsyms=
4583      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4584        if test -n "$NM" && test -n "$global_symbol_pipe"; then
4585          dlsyms="${outputname}S.c"
4586        else
4587          $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4588        fi
4589      fi
4590
4591      if test -n "$dlsyms"; then
4592        case $dlsyms in
4593        "") ;;
4594        *.c)
4595          # Discover the nlist of each of the dlfiles.
4596          nlist="$output_objdir/${outputname}.nm"
4597
4598          $show "$rm $nlist ${nlist}S ${nlist}T"
4599          $run $rm "$nlist" "${nlist}S" "${nlist}T"
4600
4601          # Parse the name list into a source file.
4602          $show "creating $output_objdir/$dlsyms"
4603
4604          test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4605/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4606/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4607
4608#ifdef __cplusplus
4609extern \"C\" {
4610#endif
4611
4612/* Prevent the only kind of declaration conflicts we can make. */
4613#define lt_preloaded_symbols some_other_symbol
4614
4615/* External symbol declarations for the compiler. */\
4616"
4617
4618          if test "$dlself" = yes; then
4619            $show "generating symbol list for \`$output'"
4620
4621            test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4622
4623            # Add our own program objects to the symbol list.
4624            progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4625            for arg in $progfiles; do
4626              $show "extracting global C symbols from \`$arg'"
4627              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4628            done
4629
4630            if test -n "$exclude_expsyms"; then
4631              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4632              $run eval '$mv "$nlist"T "$nlist"'
4633            fi
4634
4635            if test -n "$export_symbols_regex"; then
4636              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4637              $run eval '$mv "$nlist"T "$nlist"'
4638            fi
4639
4640            # Prepare the list of exported symbols
4641            if test -z "$export_symbols"; then
4642              export_symbols="$output_objdir/$output.exp"
4643              $run $rm $export_symbols
4644              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4645            else
4646              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4647              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4648              $run eval 'mv "$nlist"T "$nlist"'
4649            fi
4650          fi
4651
4652          for arg in $dlprefiles; do
4653            $show "extracting global C symbols from \`$arg'"
4654            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4655            $run eval '$echo ": $name " >> "$nlist"'
4656            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4657          done
4658
4659          if test -z "$run"; then
4660            # Make sure we have at least an empty file.
4661            test -f "$nlist" || : > "$nlist"
4662
4663            if test -n "$exclude_expsyms"; then
4664              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4665              $mv "$nlist"T "$nlist"
4666            fi
4667
4668            # Try sorting and uniquifying the output.
4669            if grep -v "^: " < "$nlist" |
4670                if sort -k 3 </dev/null >/dev/null 2>&1; then
4671                  sort -k 3
4672                else
4673                  sort +2
4674                fi |
4675                uniq > "$nlist"S; then
4676              :
4677            else
4678              grep -v "^: " < "$nlist" > "$nlist"S
4679            fi
4680
4681            if test -f "$nlist"S; then
4682              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4683            else
4684              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4685            fi
4686
4687            $echo >> "$output_objdir/$dlsyms" "\
4688
4689#undef lt_preloaded_symbols
4690
4691#if defined (__STDC__) && __STDC__
4692# define lt_ptr void *
4693#else
4694# define lt_ptr char *
4695# define const
4696#endif
4697
4698/* The mapping between symbol names and symbols. */
4699const struct {
4700  const char *name;
4701  lt_ptr address;
4702}
4703lt_preloaded_symbols[] =
4704{\
4705"
4706
4707            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4708
4709            $echo >> "$output_objdir/$dlsyms" "\
4710  {0, (lt_ptr) 0}
4711};
4712
4713/* This works around a problem in FreeBSD linker */
4714#ifdef FREEBSD_WORKAROUND
4715static const void *lt_preloaded_setup() {
4716  return lt_preloaded_symbols;
4717}
4718#endif
4719
4720#ifdef __cplusplus
4721}
4722#endif\
4723"
4724          fi
4725
4726          pic_flag_for_symtable=
4727          case $host in
4728          # compiling the symbol table file with pic_flag works around
4729          # a FreeBSD bug that causes programs to crash when -lm is
4730          # linked before any other PIC object.  But we must not use
4731          # pic_flag when linking with -static.  The problem exists in
4732          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4733          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4734            case "$compile_command " in
4735            *" -static "*) ;;
4736            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4737            esac;;
4738          *-*-hpux*)
4739            case "$compile_command " in
4740            *" -static "*) ;;
4741            *) pic_flag_for_symtable=" $pic_flag";;
4742            esac
4743          esac
4744
4745          # Now compile the dynamic symbol file.
4746          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4747          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4748
4749          # Clean up the generated files.
4750          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4751          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4752
4753          # Transform the symbol file into the correct name.
4754          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4755          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4756          ;;
4757        *)
4758          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4759          exit $EXIT_FAILURE
4760          ;;
4761        esac
4762      else
4763        # We keep going just in case the user didn't refer to
4764        # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
4765        # really was required.
4766
4767        # Nullify the symbol file.
4768        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4769        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4770      fi
4771
4772      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4773        # Replace the output file specification.
4774        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4775        link_command="$compile_command$compile_rpath"
4776
4777        # We have no uninstalled library dependencies, so finalize right now.
4778        $show "$link_command"
4779        $run eval "$link_command"
4780        status=$?
4781
4782        # Delete the generated files.
4783        if test -n "$dlsyms"; then
4784          $show "$rm $output_objdir/${outputname}S.${objext}"
4785          $run $rm "$output_objdir/${outputname}S.${objext}"
4786        fi
4787
4788        exit $status
4789      fi
4790
4791      if test -n "$shlibpath_var"; then
4792        # We should set the shlibpath_var
4793        rpath=
4794        for dir in $temp_rpath; do
4795          case $dir in
4796          [\\/]* | [A-Za-z]:[\\/]*)
4797            # Absolute path.
4798            rpath="$rpath$dir:"
4799            ;;
4800          *)
4801            # Relative path: add a thisdir entry.
4802            rpath="$rpath\$thisdir/$dir:"
4803            ;;
4804          esac
4805        done
4806        temp_rpath="$rpath"
4807      fi
4808
4809      if test -n "$compile_shlibpath$finalize_shlibpath"; then
4810        compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4811      fi
4812      if test -n "$finalize_shlibpath"; then
4813        finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4814      fi
4815
4816      compile_var=
4817      finalize_var=
4818      if test -n "$runpath_var"; then
4819        if test -n "$perm_rpath"; then
4820          # We should set the runpath_var.
4821          rpath=
4822          for dir in $perm_rpath; do
4823            rpath="$rpath$dir:"
4824          done
4825          compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4826        fi
4827        if test -n "$finalize_perm_rpath"; then
4828          # We should set the runpath_var.
4829          rpath=
4830          for dir in $finalize_perm_rpath; do
4831            rpath="$rpath$dir:"
4832          done
4833          finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4834        fi
4835      fi
4836
4837      if test "$no_install" = yes; then
4838        # We don't need to create a wrapper script.
4839        link_command="$compile_var$compile_command$compile_rpath"
4840        # Replace the output file specification.
4841        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4842        # Delete the old output file.
4843        $run $rm $output
4844        # Link the executable and exit
4845        $show "$link_command"
4846        $run eval "$link_command" || exit $?
4847        exit $EXIT_SUCCESS
4848      fi
4849
4850      if test "$hardcode_action" = relink; then
4851        # Fast installation is not supported
4852        link_command="$compile_var$compile_command$compile_rpath"
4853        relink_command="$finalize_var$finalize_command$finalize_rpath"
4854
4855        $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4856        $echo "$modename: \`$output' will be relinked during installation" 1>&2
4857      else
4858        if test "$fast_install" != no; then
4859          link_command="$finalize_var$compile_command$finalize_rpath"
4860          if test "$fast_install" = yes; then
4861            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4862          else
4863            # fast_install is set to needless
4864            relink_command=
4865          fi
4866        else
4867          link_command="$compile_var$compile_command$compile_rpath"
</