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