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