OSDN Git Service

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