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