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