fix libtool 1.2b bug
[platform/upstream/binutils.git] / 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-1998 Free Software Foundation, Inc.
5 # 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`($echo '\t') 2>/dev/null`" = 'X\t'; then
31   # Yippee, $echo works!
32   :
33 else
34   # Restart under the correct shell, and then maybe $echo will work.
35   exec $SHELL "$0" --no-reexec ${1+"$@"}
36 fi
37
38 # The name of this program.
39 progname=`$echo "$0" | sed 's%^.*/%%'`
40 modename="$progname"
41
42 # Constants.
43 PROGRAM=ltmain.sh
44 PACKAGE=libtool
45 VERSION=1.2b
46
47 default_mode=
48 help="Try \`$progname --help' for more information."
49 magic="%%%MAGIC variable%%%"
50 mkdir="mkdir"
51 mv="mv -f"
52 rm="rm -f"
53
54 # Sed substitution that helps us do robust quoting.  It backslashifies
55 # metacharacters that are still active within double-quoted strings.
56 Xsed='sed -e s/^X//'
57 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
58
59 # NLS nuisances.
60 # Only set LANG and LC_ALL to C if already set.
61 # These must not be set unconditionally because not all systems understand
62 # e.g. LANG=C (notably SCO).
63 # We save the old values to restore during execute mode.
64 if test "${LC_ALL+set}" = set; then
65   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
66 fi
67 if test "${LANG+set}" = set; then
68   save_LANG="$LANG"; LANG=C; export LANG
69 fi
70
71 if test "$LTCONFIG_VERSION" != "$VERSION"; then
72   echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
73   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
74   exit 1
75 fi
76
77 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
78   echo "$modename: not configured to build any kind of library" 1>&2
79   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
80   exit 1
81 fi
82
83 # Global variables.
84 mode=$default_mode
85 nonopt=
86 prev=
87 prevopt=
88 run=
89 show="$echo"
90 show_help=
91 execute_dlfiles=
92 lo2o="s/\\.lo\$/.${objext}/"
93 los2o="s/\\.lo /.${objext} /g"
94
95 # Parse our command line options once, thoroughly.
96 while test $# -gt 0
97 do
98   arg="$1"
99   shift
100
101   case "$arg" in
102   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
103   *) optarg= ;;
104   esac
105
106   # If the previous option needs an argument, assign it.
107   if test -n "$prev"; then
108     case "$prev" in
109     execute_dlfiles)
110       eval "$prev=\"\$$prev \$arg\""
111       ;;
112     *)
113       eval "$prev=\$arg"
114       ;;
115     esac
116
117     prev=
118     prevopt=
119     continue
120   fi
121
122   # Have we seen a non-optional argument yet?
123   case "$arg" in
124   --help)
125     show_help=yes
126     ;;
127
128   --version)
129     echo "$PROGRAM (GNU $PACKAGE) $VERSION"
130     exit 0
131     ;;
132
133   --config)
134     sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
135     exit 0
136     ;;
137
138   --debug)
139     echo "$progname: enabling shell trace mode"
140     set -x
141     ;;
142
143   --dry-run | -n)
144     run=:
145     ;;
146
147   --features)
148     echo "host: $host"
149     if test "$build_libtool_libs" = yes; then
150       echo "enable shared libraries"
151     else
152       echo "disable shared libraries"
153     fi
154     if test "$build_old_libs" = yes; then
155       echo "enable static libraries"
156     else
157       echo "disable static libraries"
158     fi
159     exit 0
160     ;;
161
162   --finish) mode="finish" ;;
163
164   --mode) prevopt="--mode" prev=mode ;;
165   --mode=*) mode="$optarg" ;;
166
167   --quiet | --silent)
168     show=:
169     ;;
170
171   -dlopen)
172     prevopt="-dlopen"
173     prev=execute_dlfiles
174     ;;
175
176   -*)
177     $echo "$modename: unrecognized option \`$arg'" 1>&2
178     $echo "$help" 1>&2
179     exit 1
180     ;;
181
182   *)
183     nonopt="$arg"
184     break
185     ;;
186   esac
187 done
188
189 if test -n "$prevopt"; then
190   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
191   $echo "$help" 1>&2
192   exit 1
193 fi
194
195 if test -z "$show_help"; then
196
197   # Infer the operation mode.
198   if test -z "$mode"; then
199     case "$nonopt" in
200     *cc | *++ | gcc* | *-gcc*)
201       mode=link
202       for arg
203       do
204         case "$arg" in
205         -c)
206            mode=compile
207            break
208            ;;
209         esac
210       done
211       ;;
212     *db | *dbx | *strace | *truss)
213       mode=execute
214       ;;
215     *install*|cp|mv)
216       mode=install
217       ;;
218     *rm)
219       mode=uninstall
220       ;;
221     *)
222       # If we have no mode, but dlfiles were specified, then do execute mode.
223       test -n "$execute_dlfiles" && mode=execute
224
225       # Just use the default operation mode.
226       if test -z "$mode"; then
227         if test -n "$nonopt"; then
228           $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
229         else
230           $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
231         fi
232       fi
233       ;;
234     esac
235   fi
236
237   # Only execute mode is allowed to have -dlopen flags.
238   if test -n "$execute_dlfiles" && test "$mode" != execute; then
239     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
240     $echo "$help" 1>&2
241     exit 1
242   fi
243
244   # Change the help message to a mode-specific one.
245   generic_help="$help"
246   help="Try \`$modename --help --mode=$mode' for more information."
247
248   # These modes are in order of execution frequency so that they run quickly.
249   case "$mode" in
250   # libtool compile mode
251   compile)
252     modename="$modename: compile"
253     # Get the compilation command and the source file.
254     base_compile=
255     lastarg=
256     srcfile="$nonopt"
257     suppress_output=
258
259     for arg
260     do
261       # Accept any command-line options.
262       case "$arg" in
263       -o)
264         $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2
265         $echo "$help" 1>&2
266         exit 1
267         ;;
268
269       -static)
270         build_old_libs=yes
271         continue
272         ;;
273       esac
274
275       # Accept the current argument as the source file.
276       lastarg="$srcfile"
277       srcfile="$arg"
278
279       # Aesthetically quote the previous argument.
280
281       # Backslashify any backslashes, double quotes, and dollar signs.
282       # These are the only characters that are still specially
283       # interpreted inside of double-quoted scrings.
284       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
285
286       # Double-quote args containing other shell metacharacters.
287       # Many Bourne shells cannot handle close brackets correctly in scan
288       # sets, so we specify it separately.
289       case "$lastarg" in
290       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
291         lastarg="\"$lastarg\""
292         ;;
293       esac
294
295       # Add the previous argument to base_compile.
296       if test -z "$base_compile"; then
297         base_compile="$lastarg"
298       else
299         base_compile="$base_compile $lastarg"
300       fi
301     done
302
303     # Get the name of the library object.
304     libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
305
306     # Recognize several different file suffixes.
307     xform='[cCFSfms]'
308     case "$libobj" in
309     *.ada) xform=ada ;;
310     *.adb) xform=adb ;;
311     *.ads) xform=ads ;;
312     *.asm) xform=asm ;;
313     *.c++) xform=c++ ;;
314     *.cc) xform=cc ;;
315     *.cpp) xform=cpp ;;
316     *.cxx) xform=cxx ;;
317     *.f90) xform=f90 ;;
318     *.for) xform=for ;;
319     esac
320
321     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
322
323     case "$libobj" in
324     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
325     *)
326       $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2
327       exit 1
328       ;;
329     esac
330
331     if test -z "$base_compile"; then
332       $echo "$modename: you must specify a compilation command" 1>&2
333       $echo "$help" 1>&2
334       exit 1
335     fi
336
337     # Delete any leftover library objects.
338     if test "$build_old_libs" = yes; then
339       $run $rm $obj $libobj
340       trap "$run $rm $obj $libobj; exit 1" 1 2 15
341     else
342       $run $rm $libobj
343       trap "$run $rm $libobj; exit 1" 1 2 15
344     fi
345
346     if test -n "$fix_srcfile_path"; then
347       eval srcfile=\"$fix_srcfile_path\"
348     fi
349
350     # Only build a PIC object if we are building libtool libraries.
351     if test "$build_libtool_libs" = yes; then
352       # Without this assignment, base_compile gets emptied.
353       fbsd_hideous_sh_bug=$base_compile
354
355       # All platforms use -DPIC, to notify preprocessed assembler code.
356       $show "$base_compile$pic_flag -DPIC $srcfile"
357       if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
358       else
359         test -n "$obj" && $run $rm $obj
360         exit 1
361       fi
362
363       # If we have no pic_flag, then copy the object into place and finish.
364       if test -z "$pic_flag"; then
365         $show "$LN_S $obj $libobj"
366         $run $LN_S $obj $libobj
367         exit $?
368       fi
369
370       # Just move the object, then go on to compile the next one
371       $show "$mv $obj $libobj"
372       $run $mv $obj $libobj || exit $?
373
374       # Allow error messages only from the first compilation.
375       suppress_output=' >/dev/null 2>&1'
376     fi
377
378     # Only build a position-dependent object if we build old libraries.
379     if test "$build_old_libs" = yes; then
380       # Suppress compiler output if we already did a PIC compilation.
381       $show "$base_compile $srcfile$suppress_output"
382       if $run eval "$base_compile \$srcfile$suppress_output"; then :
383       else
384         $run $rm $obj $libobj
385         exit 1
386       fi
387     fi
388
389     # Create an invalid libtool object if no PIC, so that we do not
390     # accidentally link it into a program.
391     if test "$build_libtool_libs" != yes; then
392       $show "echo timestamp > $libobj"
393       $run eval "echo timestamp > \$libobj" || exit $?
394     fi
395
396     exit 0
397     ;;
398
399   # libtool link mode
400   link)
401     modename="$modename: link"
402     CC="$nonopt"
403     allow_undefined=yes
404     compile_command="$CC"
405     finalize_command="$CC"
406
407     compile_shlibpath=
408     finalize_shlibpath=
409     convenience=
410     old_convenience=
411     deplibs=
412     dlfiles=
413     dlprefiles=
414     export_dynamic=no
415     generated=
416     hardcode_libdirs=
417     libobjs=
418     link_against_libtool_libs=
419     ltlibs=
420     objs=
421     prev=
422     prevarg=
423     release=
424     rpath=
425     perm_rpath=
426     temp_rpath=
427     vinfo=
428
429     # We need to know -static, to get the right output filenames.
430     for arg
431     do
432       case "$arg" in
433       -all-static | -static)
434         if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
435             $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
436         fi
437         build_libtool_libs=no
438         build_old_libs=yes
439         break
440         ;;
441       esac
442     done
443
444     # See if our shared archives depend on static archives.
445     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
446
447     # Go through the arguments, transforming them on the way.
448     while test $# -gt 0; do
449       arg="$1"
450       shift
451
452       # If the previous option needs an argument, assign it.
453       if test -n "$prev"; then
454         case "$prev" in
455         output)
456           compile_command="$compile_command @OUTPUT@"
457           finalize_command="$finalize_command @OUTPUT@"
458           ;;
459         esac
460
461         case "$prev" in
462         dlfiles|dlprefiles)
463           case "$arg" in
464           *.la | *.lo) ;;  # We handle these cases below.
465           *)
466             dlprefiles="$dlprefiles $arg"
467             test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
468             prev=
469             ;;
470           esac
471           ;;
472         release)
473           release="-$arg"
474           prev=
475           continue
476           ;;
477         rpath)
478           rpath="$rpath $arg"
479           prev=
480           continue
481           ;;
482         *)
483           eval "$prev=\"\$arg\""
484           prev=
485           continue
486           ;;
487         esac
488       fi
489
490       prevarg="$arg"
491
492       case "$arg" in
493       -all-static)
494         if test -n "$link_static_flag"; then
495           compile_command="$compile_command $link_static_flag"
496           finalize_command="$finalize_command $link_static_flag"
497         fi
498         continue
499         ;;
500
501       -allow-undefined)
502         # FIXME: remove this flag sometime in the future.
503         $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
504         continue
505         ;;
506
507       -dlopen)
508         prev=dlfiles
509         continue
510         ;;
511
512       -dlpreopen)
513         prev=dlprefiles
514         continue
515         ;;
516
517       -export-dynamic)
518         if test "$export_dynamic" != yes; then
519           export_dynamic=yes
520           if test -n "$export_dynamic_flag_spec"; then
521             eval arg=\"$export_dynamic_flag_spec\"
522           else
523             arg=
524           fi
525
526           # Add the symbol object into the linking commands.
527           compile_command="$compile_command @SYMFILE@"
528           finalize_command="$finalize_command @SYMFILE@"
529         fi
530         ;;
531
532       -L*)
533         dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
534         case "$dir" in
535         /* | [A-Za-z]:[/\\]*)
536           # Add the corresponding hardcode_libdir_flag, if it is not identical.
537           ;;
538         *)
539           $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
540           exit 1
541           ;;
542         esac
543         deplibs="$deplibs $arg"
544         ;;
545
546       -l*) deplibs="$deplibs $arg" ;;
547
548       -no-undefined)
549         allow_undefined=no
550         continue
551         ;;
552
553       -o) prev=output ;;
554
555       -release)
556         prev=release
557         continue
558         ;;
559
560       -rpath)
561         prev=rpath
562         continue
563         ;;
564
565       -static)
566         # If we have no pic_flag, then this is the same as -all-static.
567         if test -z "$pic_flag" && test -n "$link_static_flag"; then
568           compile_command="$compile_command $link_static_flag"
569           finalize_command="$finalize_command $link_static_flag"
570         fi
571         continue
572         ;;
573
574       -version-info)
575         prev=vinfo
576         continue
577         ;;
578
579       # Some other compiler flag.
580       -* | +*)
581         # Unknown arguments in both finalize_command and compile_command need
582         # to be aesthetically quoted because they are evaled later.
583         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
584         case "$arg" in
585         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
586           arg="\"$arg\""
587           ;;
588         esac
589         ;;
590
591       *.o | *.obj | *.a | *.lib)
592         # A standard object.
593         objs="$objs $arg"
594         ;;
595
596       *.lo)
597         # A library object.
598         if test "$prev" = dlfiles; then
599           dlfiles="$dlfiles $arg"
600           if test "$build_libtool_libs" = yes; then
601             prev=
602             continue
603           else
604             # If libtool objects are unsupported, then we need to preload.
605             prev=dlprefiles
606           fi
607         fi
608
609         if test "$prev" = dlprefiles; then
610           # Preload the old-style object.
611           dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
612           prev=
613         fi
614         libobjs="$libobjs $arg"
615         ;;
616
617       *.la)
618         # A libtool-controlled library.
619
620         dlname=
621         libdir=
622         library_names=
623         old_library=
624
625         # Check to see that this really is a libtool archive.
626         if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
627         else
628           $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
629           exit 1
630         fi
631
632         # If there is no directory component, then add one.
633         case "$arg" in
634         */* | *\\*) . $arg ;;
635         *) . ./$arg ;;
636         esac
637
638         # Get the name of the library we link against.
639         linklib=
640         for l in $old_library $library_names; do
641           linklib="$l"
642         done
643
644         if test -z "$linklib"; then
645           $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
646           exit 1
647         fi
648
649         # Find the relevant object directory and library name.
650         name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
651         dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
652         if test "X$dir" = "X$arg"; then
653           dir="$objdir"
654         else
655           dir="$dir/$objdir"
656         fi
657
658         if test -z "$libdir"; then
659           # It is a libtool convenience library, so add in its objects.
660           convenience="$convenience $dir/$old_library"l
661           old_convenience="$old_convenience $dir/$old_library"
662           compile_command="$compile_command $dir/$old_library"
663           finalize_command="$finalize_command $dir/$old_library"
664           continue
665         fi
666
667         # This library was specified with -dlopen.
668         if test "$prev" = dlfiles; then
669           dlfiles="$dlfiles $arg"
670           if test -z "$dlname"; then
671             # If there is no dlname, we need to preload.
672             prev=dlprefiles
673           else
674             # We should not create a dependency on this library, but we
675             # may need any libraries it requires.
676             compile_command="$compile_command$dependency_libs"
677             finalize_command="$finalize_command$dependency_libs"
678             prev=
679             continue
680           fi
681         fi
682
683         # The library was specified with -dlpreopen.
684         if test "$prev" = dlprefiles; then
685           # Prefer using a static library (so that no silly _DYNAMIC symbols
686           # are required to link).
687           if test -n "$old_library"; then
688             dlprefiles="$dlprefiles $dir/$old_library"
689           else
690             dlprefiles="$dlprefiles $dir/$linklib"
691           fi
692           prev=
693         fi
694
695         if test "$build_libtool_libs" = yes && test -n "$library_names"; then
696           link_against_libtool_libs="$link_against_libtool_libs $arg"
697           if test -n "$shlibpath_var"; then
698             # Make sure the rpath contains only unique directories.
699             case "$temp_rpath " in
700             *" $dir "*) ;;
701             *) temp_rpath="$temp_rpath $dir" ;;
702             esac
703           fi
704
705           # This is the magic to use -rpath.
706           if test -n "$hardcode_libdir_flag_spec"; then
707             if test -n "$hardcode_libdir_separator"; then
708               if test -z "$hardcode_libdirs"; then
709                 # Put the magic libdir with the hardcode flag.
710                 hardcode_libdirs="$libdir"
711                 libdir="@HARDCODE_LIBDIRS@"
712               else
713                 # Just accumulate the unique libdirs.
714                 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
715                 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
716                   ;;
717                 *)
718                   hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
719                   ;;
720                 esac
721                 libdir=
722               fi
723             fi
724
725             if test -n "$libdir"; then
726               eval flag=\"$hardcode_libdir_flag_spec\"
727
728               compile_command="$compile_command $flag"
729               finalize_command="$finalize_command $flag"
730             fi
731           elif test -n "$runpath_var"; then
732             # Do the same for the permanent run path.
733             case "$perm_rpath " in
734             *" $libdir "*) ;;
735             *) perm_rpath="$perm_rpath $libdir" ;;
736             esac
737           fi
738
739
740           lib_linked=yes
741           case "$hardcode_action" in
742           immediate | unsupported)
743             if test "$hardcode_direct" = no; then
744               compile_command="$compile_command $dir/$linklib"
745             elif test "$hardcode_minus_L" = no; then
746               compile_command="$compile_command -L$dir -l$name"
747             elif test "$hardcode_shlibpath_var" = no; then
748               compile_shlibpath="$compile_shlibpath$dir:"
749               compile_command="$compile_command -l$name"
750             else
751               lib_linked=no
752             fi
753             ;;
754
755           relink)
756             # We need an absolute path.
757             case "$dir" in
758             /* | [A-Za-z]:[/\\]*) ;;
759             *)
760               absdir=`cd "$dir" && pwd`
761               if test -z "$absdir"; then
762                 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
763                 exit 1
764               fi
765               dir="$absdir"
766               ;;
767             esac
768
769             if test "$hardcode_direct" = yes; then
770               compile_command="$compile_command $dir/$linklib"
771             elif test "$hardcode_minus_L" = yes; then
772               compile_command="$compile_command -L$dir -l$name"
773             elif test "$hardcode_shlibpath_var" = yes; then
774               compile_shlibpath="$compile_shlibpath$dir:"
775               compile_command="$compile_command -l$name"
776             else
777               lib_linked=no
778             fi
779             ;;
780
781           *)
782             lib_linked=no
783             ;;
784           esac
785
786           if test "$lib_linked" != yes; then
787             $echo "$modename: configuration error: unsupported hardcode properties"
788             exit 1
789           fi
790
791           # Finalize command for both is simple: just hardcode it.
792           if test "$hardcode_direct" = yes; then
793             finalize_command="$finalize_command $libdir/$linklib"
794           elif test "$hardcode_minus_L" = yes; then
795             finalize_command="$finalize_command -L$libdir -l$name"
796           elif test "$hardcode_shlibpath_var" = yes; then
797             finalize_shlibpath="$finalize_shlibpath$libdir:"
798             finalize_command="$finalize_command -l$name"
799           else
800             # We cannot seem to hardcode it, guess we'll fake it.
801             finalize_command="$finalize_command -L$libdir -l$name"
802           fi
803         else
804           # Transform directly to old archives if we don't build new libraries.
805           if test -n "$pic_flag" && test -z "$old_library"; then
806             $echo "$modename: cannot find static library for \`$arg'" 1>&2
807             exit 1
808           fi
809
810           # Here we assume that one of hardcode_direct or hardcode_minus_L
811           # is not unsupported.  This is valid on all known static and
812           # shared platforms.
813           if test "$hardcode_direct" != unsupported; then
814             test -n "$old_library" && linklib="$old_library"
815             compile_command="$compile_command $dir/$linklib"
816             finalize_command="$finalize_command $dir/$linklib"
817           else
818             compile_command="$compile_command -L$dir -l$name"
819             finalize_command="$finalize_command -L$dir -l$name"
820           fi
821         fi
822
823         # Add in any libraries that this one depends upon.
824         compile_command="$compile_command$dependency_libs"
825         finalize_command="$finalize_command$dependency_libs"
826         continue
827         ;;
828
829       # Some other compiler argument.
830       *)
831         # Unknown arguments in both finalize_command and compile_command need
832         # to be aesthetically quoted because they are evaled later.
833         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
834         case "$arg" in
835         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
836           arg="\"$arg\""
837           ;;
838         esac
839         ;;
840       esac
841
842       # Now actually substitute the argument into the commands.
843       if test -n "$arg"; then
844         compile_command="$compile_command $arg"
845         finalize_command="$finalize_command $arg"
846       fi
847     done
848
849     if test -n "$prev"; then
850       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
851       $echo "$help" 1>&2
852       exit 1
853     fi
854
855     oldlibs=
856     case "$output" in
857     "")
858       $echo "$modename: you must specify an output file" 1>&2
859       $echo "$help" 1>&2
860       exit 1
861       ;;
862
863     */* | *\\*)
864       $echo "$modename: output file \`$output' must have no directory components" 1>&2
865       $echo "$help" 1>&2
866       exit 1
867       ;;
868
869     *.a | *.lib)
870       if test -n "$link_against_libtool_libs"; then
871         $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
872         exit 1
873       fi
874
875       if test -n "$deplibs"; then
876         $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
877       fi
878
879       if test -n "$dlfiles$dlprefiles"; then
880         $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
881       fi
882
883       if test -n "$rpath"; then
884         $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
885       fi
886
887       if test -n "$vinfo"; then
888         $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
889       fi
890
891       if test -n "$release"; then
892         $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
893       fi
894
895       # Now set the variables for building old libraries.
896       build_libtool_libs=no
897       oldlibs="$output"
898       ;;
899
900     *.la)
901       # Make sure we only generate libraries of the form `libNAME.la'.
902       case "$output" in
903       lib*) ;;
904       *)
905         $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
906         $echo "$help" 1>&2
907         exit 1
908         ;;
909       esac
910
911       name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
912       eval libname=\"$libname_spec\"
913
914       # All the library-specific variables (install_libdir is set above).
915       library_names=
916       old_library=
917       dlname=
918
919       if test -n "$objs"; then
920         $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
921         exit 1
922       fi
923
924       # How the heck are we supposed to write a wrapper for a shared library?
925       if test -n "$link_against_libtool_libs"; then
926         $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
927         exit 1
928       fi
929
930       if test -n "$dlfiles$dlprefiles"; then
931         $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
932       fi
933
934       set dummy $rpath
935       if test $# -gt 2; then
936         $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
937       fi
938       install_libdir="$2"
939
940       # Now set the variables for building old libraries.
941       oldlibs="$objdir/$libname.$libext"
942       if test -z "$rpath"; then
943         # Building a libtool convenience library.
944         oldlibs="$objdir/$libname.al $oldlibs"
945         build_libtool_libs=convenience
946
947         if test -n "$vinfo"; then
948           $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
949         fi
950
951         if test -n "$release"; then
952           $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
953         fi
954       else
955
956         # Parse the version information argument.
957         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
958         set dummy $vinfo 0 0 0
959         IFS="$save_ifs"
960
961         if test -n "$8"; then
962           $echo "$modename: too many parameters to \`-version-info'" 1>&2
963           $echo "$help" 1>&2
964           exit 1
965         fi
966
967         current="$2"
968         revision="$3"
969         age="$4"
970
971         # Check that each of the things are valid numbers.
972         case "$current" in
973         0 | [1-9] | [1-9][0-9]*) ;;
974         *)
975           $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
976           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
977           exit 1
978           ;;
979         esac
980
981         case "$revision" in
982         0 | [1-9] | [1-9][0-9]*) ;;
983         *)
984           $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
985           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
986           exit 1
987           ;;
988         esac
989
990         case "$age" in
991         0 | [1-9] | [1-9][0-9]*) ;;
992         *)
993           $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
994           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
995           exit 1
996           ;;
997         esac
998
999         if test $age -gt $current; then
1000           $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1001           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1002           exit 1
1003         fi
1004
1005         # Calculate the version variables.
1006         major=
1007         versuffix=
1008         verstring=
1009         case "$version_type" in
1010         none) ;;
1011
1012         linux)
1013           major=.`expr $current - $age`
1014           versuffix="$major.$age.$revision"
1015           ;;
1016
1017         osf)
1018           major=`expr $current - $age`
1019           versuffix=".$current.$age.$revision"
1020           verstring="$current.$age.$revision"
1021
1022           # Add in all the interfaces that we are compatible with.
1023           loop=$age
1024           while test $loop != 0; do
1025             iface=`expr $current - $loop`
1026             loop=`expr $loop - 1`
1027             verstring="$verstring:${iface}.0"
1028           done
1029
1030           # Make executables depend on our current version.
1031           verstring="$verstring:${current}.0"
1032           ;;
1033
1034         sunos)
1035           major=".$current"
1036           versuffix=".$current.$revision"
1037           ;;
1038
1039         windows)
1040           # Like Linux, but with '-' rather than '.', since we only
1041           # want one extension on Windows 95.
1042           major=`expr $current - $age`
1043           versuffix="-$major-$age-$revision"
1044           ;;
1045
1046         *)
1047           $echo "$modename: unknown library version type \`$version_type'" 1>&2
1048           echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
1049           exit 1
1050           ;;
1051         esac
1052
1053         # Clear the version info if we defaulted, and they specified a release.
1054         if test -z "$vinfo" && test -n "$release"; then
1055           major=
1056           versuffix=
1057           verstring="0.0"
1058           case "$version_type" in
1059           sunos)
1060             versuffix=".0.0"
1061             ;;
1062           esac
1063         fi
1064
1065         # Check to see if the archive will have undefined symbols.
1066         if test "$allow_undefined" = yes; then
1067           if test "$allow_undefined_flag" = unsupported; then
1068             $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1069             build_libtool_libs=no
1070             build_old_libs=yes
1071           fi
1072         else
1073           # Don't allow undefined symbols.
1074           allow_undefined_flag="$no_undefined_flag"
1075         fi
1076
1077         # Add libc to deplibs on all systems.
1078         dependency_libs="$deplibs"
1079         deplibs="$deplibs -lc"
1080       fi
1081
1082       # Create the output directory, or remove our outputs if we need to.
1083       if test -d $objdir; then
1084         $show "${rm}r $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*"
1085         $run ${rm}r $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*
1086       else
1087         $show "$mkdir $objdir"
1088         $run $mkdir $objdir
1089         status=$?
1090         if test $status -ne 0 && test ! -d $objdir; then
1091           exit $status
1092         fi
1093       fi
1094
1095       if test "$build_libtool_libs" = yes; then
1096         # Get the real and link names of the library.
1097         eval library_names=\"$library_names_spec\"
1098         set dummy $library_names
1099         realname="$2"
1100         shift; shift
1101
1102         if test -n "$soname_spec"; then
1103           eval soname=\"$soname_spec\"
1104         else
1105           soname="$realname"
1106         fi
1107
1108         lib="$objdir/$realname"
1109         for link
1110         do
1111           linknames="$linknames $link"
1112         done
1113
1114         # Use standard objects if they are PIC.
1115         test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e "$los2o" -e 's/ $//g'`
1116
1117         # Transform .lo files to .o files.
1118         test "$build_old_libs" = yes && oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^   ]*\.a //g' -e 's/[^   ]*\.lib //g' -e "$los2o" -e 's/ $//g'`
1119
1120         if test -n "$whole_archive_flag_spec"; then
1121           if test -n "$convenience"; then
1122             eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
1123           fi
1124         else
1125           for xlib in $convenience; do
1126             # Extract the objects.
1127             xdir="$xlib"x
1128             generated="$generated $xdir"
1129             xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'`
1130
1131             $show "${rm}r $xdir"
1132             $run ${rm}r "$xdir"
1133             $show "mkdir $xdir"
1134             $run mkdir "$xdir"
1135             status=$?
1136             if test $status -ne 0 && test ! -d "$xdir"; then
1137               exit $status
1138             fi
1139             $show "(cd $xdir && $AR x ../$xlib)"
1140             $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1141
1142             libobjs="$libobjs `echo $xdir/*`"
1143           done
1144         fi
1145
1146         # Do each of the archive commands.
1147         eval cmds=\"$archive_cmds\"
1148         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
1149         for cmd in $cmds; do
1150           IFS="$save_ifs"
1151           $show "$cmd"
1152           $run eval "$cmd" || exit $?
1153         done
1154         IFS="$save_ifs"
1155
1156         # Create links to the real library.
1157         for linkname in $linknames; do
1158           if test "$realname" != "$linkname"; then
1159             $show "(cd $objdir && $LN_S $realname $linkname)"
1160             $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
1161           fi
1162         done
1163
1164         # If -export-dynamic was specified, set the dlname.
1165         if test "$export_dynamic" = yes; then
1166           # On all known operating systems, these are identical.
1167           dlname="$soname"
1168         fi
1169       fi
1170       ;;
1171
1172     *.lo | *.o | *.obj)
1173       if test -n "$link_against_libtool_libs"; then
1174         $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
1175         exit 1
1176       fi
1177
1178       if test -n "$deplibs"; then
1179         $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
1180       fi
1181
1182       if test -n "$dlfiles$dlprefiles"; then
1183         $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
1184       fi
1185
1186       if test -n "$rpath"; then
1187         $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
1188       fi
1189
1190       if test -n "$vinfo"; then
1191         $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
1192       fi
1193
1194       if test -n "$release"; then
1195         $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
1196       fi
1197
1198       case "$output" in
1199       *.lo)
1200         if test -n "$objs"; then
1201           $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
1202           exit 1
1203         fi
1204         libobj="$output"
1205         obj=`$echo "X$output" | $Xsed -e "$lo2o"`
1206         ;;
1207       *)
1208         libobj=
1209         obj="$output"
1210         ;;
1211       esac
1212
1213       # Delete the old objects.
1214       $run $rm $obj $libobj
1215
1216       # Create the old-style object.
1217       reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^       ]*\.a //g' -e 's/[^       ]*\.lib //g' -e "$los2o" -e 's/ $//g'`
1218
1219       output="$obj"
1220       eval cmds=\"$reload_cmds\"
1221       IFS="${IFS=       }"; save_ifs="$IFS"; IFS=';'
1222       for cmd in $cmds; do
1223         IFS="$save_ifs"
1224         $show "$cmd"
1225         $run eval "$cmd" || exit $?
1226       done
1227       IFS="$save_ifs"
1228
1229       # Exit if we aren't doing a library object file.
1230       test -z "$libobj" && exit 0
1231
1232       if test "$build_libtool_libs" != yes; then
1233         # Create an invalid libtool object if no PIC, so that we don't
1234         # accidentally link it into a program.
1235         $show "echo timestamp > $libobj"
1236         $run eval "echo timestamp > $libobj" || exit $?
1237         exit 0
1238       fi
1239
1240       if test -n "$pic_flag"; then
1241         # Only do commands if we really have different PIC objects.
1242         reload_objs="$libobjs"
1243         output="$libobj"
1244         eval cmds=\"$reload_cmds\"
1245         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
1246         for cmd in $cmds; do
1247           IFS="$save_ifs"
1248           $show "$cmd"
1249           $run eval "$cmd" || exit $?
1250         done
1251         IFS="$save_ifs"
1252       else
1253         # Just create a symlink.
1254         $show "$LN_S $obj $libobj"
1255         $run $LN_S $obj $libobj || exit $?
1256       fi
1257
1258       exit 0
1259       ;;
1260
1261     *)
1262       if test -n "$vinfo"; then
1263         $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
1264       fi
1265
1266       if test -n "$release"; then
1267         $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
1268       fi
1269
1270       if test -n "$rpath"; then
1271         # If the user specified any rpath flags, then add them.
1272         for libdir in $rpath; do
1273           if test -n "$hardcode_libdir_flag_spec"; then
1274             if test -n "$hardcode_libdir_separator"; then
1275               if test -z "$hardcode_libdirs"; then
1276                 # Put the magic libdir with the hardcode flag.
1277                 hardcode_libdirs="$libdir"
1278                 libdir="@HARDCODE_LIBDIRS@"
1279               else
1280                 # Just accumulate the unique libdirs.
1281                 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1282                 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1283                   ;;
1284                 *)
1285                   hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1286                   ;;
1287                 esac
1288                 libdir=
1289               fi
1290             fi
1291
1292             if test -n "$libdir"; then
1293               eval flag=\"$hardcode_libdir_flag_spec\"
1294
1295               compile_command="$compile_command $flag"
1296               finalize_command="$finalize_command $flag"
1297             fi
1298           elif test -n "$runpath_var"; then
1299             case "$perm_rpath " in
1300             *" $libdir "*) ;;
1301             *) perm_rpath="$perm_rpath $libdir" ;;
1302             esac
1303           fi
1304         done
1305       fi
1306
1307       # Substitute the hardcoded libdirs into the compile commands.
1308       if test -n "$hardcode_libdir_separator"; then
1309         compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1310         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1311       fi
1312
1313       if test -n "$libobjs" && test "$build_old_libs" = yes; then
1314         # Transform all the library objects into standard objects.
1315         compile_command=`$echo "X$compile_command " | $Xsed -e "$los2o" -e 's/ $//'`
1316         finalize_command=`$echo "X$finalize_command " | $Xsed -e "$los2o" -e 's/ $//'`
1317       fi
1318
1319       if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
1320         dlsyms="${output}S.c"
1321       else
1322         dlsyms=
1323       fi
1324
1325       if test -n "$dlsyms"; then
1326         # Add our own program objects to the preloaded list.
1327         dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e "$los2o" -e 's/ $//'`
1328
1329         # Discover the nlist of each of the dlfiles.
1330         nlist="$objdir/${output}.nm"
1331
1332         if test -d $objdir; then
1333           $show "$rm $nlist ${nlist}T"
1334           $run $rm "$nlist" "${nlist}T"
1335         else
1336           $show "$mkdir $objdir"
1337           $run $mkdir $objdir
1338           status=$?
1339           if test $status -ne 0 && test ! -d $objdir; then
1340             exit $status
1341           fi
1342         fi
1343
1344         for arg in $dlprefiles; do
1345           $show "extracting global C symbols from \`$arg'"
1346           $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
1347         done
1348
1349         # Parse the name list into a source file.
1350         $show "creating $objdir/$dlsyms"
1351         if test -z "$run"; then
1352           # Make sure we at least have an empty file.
1353           test -f "$nlist" || : > "$nlist"
1354
1355           # Try sorting and uniquifying the output.
1356           if sort "$nlist" | uniq > "$nlist"T; then
1357             mv -f "$nlist"T "$nlist"
1358             wcout=`wc "$nlist" 2>/dev/null`
1359             count=`echo "X$wcout" | $Xsed -e 's/^[      ]*\([0-9][0-9]*\).*$/\1/'`
1360             (test "$count" -ge 0) 2>/dev/null || count=-1
1361           else
1362             $rm "$nlist"T
1363             count=-1
1364           fi
1365
1366           case "$dlsyms" in
1367           "") ;;
1368           *.c)
1369             $echo > "$objdir/$dlsyms" "\
1370 /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
1371 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
1372
1373 #ifdef __cplusplus
1374 extern \"C\" {
1375 #endif
1376
1377 /* Prevent the only kind of declaration conflicts we can make. */
1378 #define dld_preloaded_symbol_count some_other_symbol
1379 #define dld_preloaded_symbols some_other_symbol
1380
1381 /* External symbol declarations for the compiler. */\
1382 "
1383
1384             if test -f "$nlist"; then
1385               sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
1386             else
1387               echo '/* NONE */' >> "$objdir/$dlsyms"
1388             fi
1389
1390             $echo >> "$objdir/$dlsyms" "\
1391
1392 #undef dld_preloaded_symbol_count
1393 #undef dld_preloaded_symbols
1394
1395 #if defined (__STDC__) && __STDC__
1396 # define __ptr_t void *
1397 #else
1398 # define __ptr_t char *
1399 #endif
1400
1401 /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
1402 int dld_preloaded_symbol_count = $count;
1403
1404 /* The mapping between symbol names and symbols. */
1405 struct {
1406   char *name;
1407   __ptr_t address;
1408 }
1409 dld_preloaded_symbols[] =
1410 {\
1411 "
1412
1413             if test -f "$nlist"; then
1414               sed 's/^\(.*\) \(.*\)$/  {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
1415             fi
1416
1417             $echo >> "$objdir/$dlsyms" "\
1418   {0, (__ptr_t) 0}
1419 };
1420
1421 #ifdef __cplusplus
1422 }
1423 #endif\
1424 "
1425             ;;
1426
1427           *)
1428             $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
1429             exit 1
1430             ;;
1431           esac
1432         fi
1433
1434         # Now compile the dynamic symbol file.
1435         $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
1436         $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
1437
1438         # Transform the symbol file into the correct name.
1439         compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
1440         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
1441       elif test "$export_dynamic" != yes; then
1442         test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
1443       else
1444         # We keep going just in case the user didn't refer to
1445         # dld_preloaded_symbols.  The linker will fail if global_symbol_pipe
1446         # really was required.
1447         $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
1448
1449         # Nullify the symbol file.
1450         compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1451         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1452       fi
1453
1454       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
1455         # Replace the output file specification.
1456         compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1457         finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1458
1459         # We have no uninstalled library dependencies, so finalize right now.
1460         $show "$compile_command"
1461         $run eval "$compile_command"
1462         exit $?
1463       fi
1464
1465       # Replace the output file specification.
1466       compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
1467       finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
1468
1469       # Create the binary in the object directory, then wrap it.
1470       if test ! -d $objdir; then
1471         $show "$mkdir $objdir"
1472         $run $mkdir $objdir
1473         status=$?
1474         if test $status -ne 0 && test ! -d $objdir; then
1475           exit $status
1476         fi
1477       fi
1478
1479       if test -n "$shlibpath_var"; then
1480         # We should set the shlibpath_var
1481         rpath=
1482         for dir in $temp_rpath; do
1483           case "$dir" in
1484           /* | [A-Za-z]:[/\\]*)
1485             # Absolute path.
1486             rpath="$rpath$dir:"
1487             ;;
1488           *)
1489             # Relative path: add a thisdir entry.
1490             rpath="$rpath\$thisdir/$dir:"
1491             ;;
1492           esac
1493         done
1494         temp_rpath="$rpath"
1495       fi
1496
1497       # Delete the old output file.
1498       $run $rm $output
1499
1500       if test -n "$compile_shlibpath"; then
1501         compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
1502       fi
1503       if test -n "$finalize_shlibpath"; then
1504         finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
1505       fi
1506
1507       if test -n "$runpath_var" && test -n "$perm_rpath"; then
1508         # We should set the runpath_var.
1509         rpath=
1510         for dir in $perm_rpath; do
1511           rpath="$rpath$dir:"
1512         done
1513         compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
1514         finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
1515       fi
1516
1517       if test "$hardcode_action" = relink; then
1518         # AGH! Flame the AIX and HP-UX people for me, will ya?
1519         $echo "$modename: warning: using a buggy system linker" 1>&2
1520         $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
1521       fi
1522
1523       $show "$compile_command"
1524       $run eval "$compile_command" || exit $?
1525
1526       # Now create the wrapper script.
1527       $show "creating $output"
1528
1529       # Quote the finalize command for shipping.
1530       finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
1531
1532       # Quote $echo for shipping.
1533       qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
1534
1535       # Only actually do things if our run command is non-null.
1536       if test -z "$run"; then
1537         $rm $output
1538         trap "$rm $output; exit 1" 1 2 15
1539
1540         $echo > $output "\
1541 #! $SHELL
1542
1543 # $output - temporary wrapper script for $objdir/$output
1544 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1545 #
1546 # The $output program cannot be directly executed until all the libtool
1547 # libraries that it depends on are installed.
1548 #
1549 # This wrapper script should never be moved out of \``pwd`'.
1550 # If it is, it will not operate correctly.
1551
1552 # Sed substitution that helps us do robust quoting.  It backslashifies
1553 # metacharacters that are still active within double-quoted strings.
1554 Xsed='sed -e s/^X//'
1555 sed_quote_subst='$sed_quote_subst'
1556
1557 # The HP-UX ksh and POSIX shell print the target directory to stdout
1558 # if CDPATH is set.
1559 if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
1560
1561 # This environment variable determines our operation mode.
1562 if test \"\$libtool_install_magic\" = \"$magic\"; then
1563   # install mode needs the following variables:
1564   link_against_libtool_libs='$link_against_libtool_libs'
1565   finalize_command=\"$finalize_command\"
1566 else
1567   # When we are sourced in execute mode, \$file and \$echo are already set.
1568   if test \"\$libtool_execute_magic\" != \"$magic\"; then
1569     echo=\"$qecho\"
1570     file=\"\$0\"
1571     # Make sure echo works.
1572     if test \"X\$1\" = X--no-reexec; then
1573       # Discard the --no-reexec flag, and continue.
1574       shift
1575     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
1576       # Yippee, \$echo works!
1577       :
1578     else
1579       # Restart under the correct shell, and then maybe \$echo will work.
1580       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
1581     fi
1582   fi\
1583 "
1584         $echo >> $output "\
1585
1586   # Find the directory that this script lives in.
1587   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
1588   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
1589
1590   # Follow symbolic links until we get to the real thisdir.
1591   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
1592   while test -n \"\$file\"; do
1593     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
1594
1595     # If there was a directory component, then change thisdir.
1596     if test \"x\$destdir\" != \"x\$file\"; then
1597       case \"\$destdir\" in
1598       /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;;
1599       *) thisdir=\"\$thisdir/\$destdir\" ;;
1600       esac
1601     fi
1602
1603     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
1604     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
1605   done
1606
1607   # Try to get the absolute directory name.
1608   absdir=\`cd \"\$thisdir\" && pwd\`
1609   test -n \"\$absdir\" && thisdir=\"\$absdir\"
1610
1611   progdir=\"\$thisdir/$objdir\"
1612   program='$output'
1613
1614   if test -f \"\$progdir/\$program\"; then"
1615
1616         # Export our shlibpath_var if we have one.
1617         if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1618           $echo >> $output "\
1619     # Add our own library path to $shlibpath_var
1620     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
1621
1622     # Some systems cannot cope with colon-terminated $shlibpath_var
1623     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
1624
1625     export $shlibpath_var
1626 "
1627         fi
1628
1629         $echo >> $output "\
1630     if test \"\$libtool_execute_magic\" != \"$magic\"; then
1631       # Run the actual program with our arguments.
1632
1633       # Export the path to the program.
1634       PATH=\"\$progdir:\$PATH\"
1635       export PATH
1636
1637       exec \$program \${1+\"\$@\"}
1638
1639       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
1640       exit 1
1641     fi
1642   else
1643     # The program doesn't exist.
1644     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
1645     \$echo \"This script is just a wrapper for \$program.\" 1>&2
1646     echo \"See the $PACKAGE documentation for more information.\" 1>&2
1647     exit 1
1648   fi
1649 fi\
1650 "
1651         chmod +x $output
1652       fi
1653       exit 0
1654       ;;
1655     esac
1656
1657     # See if we need to build an old-fashioned archive.
1658     for oldlib in $oldlibs; do
1659
1660       if test "$build_libtool_libs" = convenience; then
1661         oldobjs="$libobjs"
1662         addlibs="$convenience"
1663         build_libtool_libs=no
1664       else
1665         oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^   ]*\.a //g' -e 's/[^   ]*\.lib //g' -e "$los2o" -e 's/ $//g'`
1666         addlibs="$old_convenience"
1667       fi
1668
1669       # Add in members from convenience archives.
1670       for xlib in $addlibs; do
1671         # Extract the objects.
1672         xdir="$xlib"x
1673         generated="$generated $xdir"
1674         xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'`
1675
1676         $show "${rm}r $xdir"
1677         $run ${rm}r "$xdir"
1678         $show "mkdir $xdir"
1679         $run mkdir "$xdir"
1680         status=$?
1681         if test $status -ne 0 && test ! -d "$xdir"; then
1682           exit $status
1683         fi
1684         $show "(cd $xdir && $AR x ../$xlib)"
1685         $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1686
1687         oldobjs="$oldobjs `echo $xdir/*`"
1688       done
1689
1690       # Do each command in the archive commands.
1691       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
1692         eval cmds=\"$old_archive_from_new_cmds\"
1693       else
1694         eval cmds=\"$old_archive_cmds\"
1695       fi
1696       IFS="${IFS=       }"; save_ifs="$IFS"; IFS=';'
1697       for cmd in $cmds; do
1698         IFS="$save_ifs"
1699         $show "$cmd"
1700         $run eval "$cmd" || exit $?
1701       done
1702       IFS="$save_ifs"
1703     done
1704
1705     if test -n "$generated"; then
1706       $show "${rm}r$generated"
1707       $run ${rm}r$generated
1708     fi
1709
1710     # Now create the libtool archive.
1711     case "$output" in
1712     *.la)
1713       old_library=
1714       test "$build_old_libs" = yes && old_library="$libname.$libext"
1715       $show "creating $output"
1716
1717       # Only create the output if not a dry run.
1718       if test -z "$run"; then
1719         $echo > $output "\
1720 # $output - a libtool library file
1721 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1722
1723 # The name that we can dlopen(3).
1724 dlname='$dlname'
1725
1726 # Names of this library.
1727 library_names='$library_names'
1728
1729 # The name of the static archive.
1730 old_library='$old_library'
1731
1732 # Libraries that this one depends upon.
1733 dependency_libs='$dependency_libs'
1734
1735 # Version information for $libname.
1736 current=$current
1737 age=$age
1738 revision=$revision
1739
1740 # Directory that this library needs to be installed in:
1741 libdir='$install_libdir'\
1742 "
1743       fi
1744
1745       # Do a symbolic link so that the libtool archive can be found in
1746       # LD_LIBRARY_PATH before the program is installed.
1747       $show "(cd $objdir && $LN_S ../$output $output)"
1748       $run eval "(cd $objdir && $LN_S ../$output $output)" || exit $?
1749       ;;
1750     esac
1751     exit 0
1752     ;;
1753
1754   # libtool install mode
1755   install)
1756     modename="$modename: install"
1757
1758     # There may be an optional sh(1) argument at the beginning of
1759     # install_prog (especially on Windows NT).
1760     if test "$nonopt" = "$SHELL"; then
1761       # Aesthetically quote it.
1762       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
1763       case "$arg" in
1764       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
1765         arg="\"$arg\""
1766         ;;
1767       esac
1768       install_prog="$arg "
1769       arg="$1"
1770       shift
1771     else
1772       install_prog=
1773       arg="$nonopt"
1774     fi
1775
1776     # The real first argument should be the name of the installation program.
1777     # Aesthetically quote it.
1778     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1779     case "$arg" in
1780     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
1781       arg="\"$arg\""
1782       ;;
1783     esac
1784     install_prog="$install_prog$arg"
1785
1786     # We need to accept at least all the BSD install flags.
1787     dest=
1788     files=
1789     opts=
1790     prev=
1791     install_type=
1792     isdir=no
1793     stripme=
1794     for arg
1795     do
1796       if test -n "$dest"; then
1797         files="$files $dest"
1798         dest="$arg"
1799         continue
1800       fi
1801
1802       case "$arg" in
1803       -d) isdir=yes ;;
1804       -f) prev="-f" ;;
1805       -g) prev="-g" ;;
1806       -m) prev="-m" ;;
1807       -o) prev="-o" ;;
1808       -s)
1809         stripme=" -s"
1810         continue
1811         ;;
1812       -*) ;;
1813
1814       *)
1815         # If the previous option needed an argument, then skip it.
1816         if test -n "$prev"; then
1817           prev=
1818         else
1819           dest="$arg"
1820           continue
1821         fi
1822         ;;
1823       esac
1824
1825       # Aesthetically quote the argument.
1826       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1827       case "$arg" in
1828       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
1829         arg="\"$arg\""
1830         ;;
1831       esac
1832       install_prog="$install_prog $arg"
1833     done
1834
1835     if test -z "$install_prog"; then
1836       $echo "$modename: you must specify an install program" 1>&2
1837       $echo "$help" 1>&2
1838       exit 1
1839     fi
1840
1841     if test -n "$prev"; then
1842       $echo "$modename: the \`$prev' option requires an argument" 1>&2
1843       $echo "$help" 1>&2
1844       exit 1
1845     fi
1846
1847     if test -z "$files"; then
1848       if test -z "$dest"; then
1849         $echo "$modename: no file or destination specified" 1>&2
1850       else
1851         $echo "$modename: you must specify a destination" 1>&2
1852       fi
1853       $echo "$help" 1>&2
1854       exit 1
1855     fi
1856
1857     # Strip any trailing slash from the destination.
1858     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
1859
1860     # Check to see that the destination is a directory.
1861     test -d "$dest" && isdir=yes
1862     if test "$isdir" = yes; then
1863       destdir="$dest"
1864       destname=
1865     else
1866       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
1867       test "X$destdir" = "X$dest" && destdir=.
1868       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
1869
1870       # Not a directory, so check to see that there is only one file specified.
1871       set dummy $files
1872       if test $# -gt 2; then
1873         $echo "$modename: \`$dest' is not a directory" 1>&2
1874         $echo "$help" 1>&2
1875         exit 1
1876       fi
1877     fi
1878     case "$destdir" in
1879     /* | [A-Za-z]:[/\\]*) ;;
1880     *)
1881       for file in $files; do
1882         case "$file" in
1883         *.lo) ;;
1884         *)
1885           $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
1886           $echo "$help" 1>&2
1887           exit 1
1888           ;;
1889         esac
1890       done
1891       ;;
1892     esac
1893
1894     # This variable tells wrapper scripts just to set variables rather
1895     # than running their programs.
1896     libtool_install_magic="$magic"
1897
1898     staticlibs=
1899     future_libdirs=
1900     current_libdirs=
1901     for file in $files; do
1902
1903       # Do each installation.
1904       case "$file" in
1905       *.a | *.lib)
1906         # Do the static libraries later.
1907         staticlibs="$staticlibs $file"
1908         ;;
1909
1910       *.la)
1911         # Check to see that this really is a libtool archive.
1912         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1913         else
1914           $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
1915           $echo "$help" 1>&2
1916           exit 1
1917         fi
1918
1919         library_names=
1920         old_library=
1921         # If there is no directory component, then add one.
1922         case "$file" in
1923         */* | *\\*) . $file ;;
1924         *) . ./$file ;;
1925         esac
1926
1927         # Add the libdir to current_libdirs if it is the destination.
1928         if test "X$destdir" = "X$libdir"; then
1929           case "$current_libdirs " in
1930           *" $libdir "*) ;;
1931           *) current_libdirs="$current_libdirs $libdir" ;;
1932           esac
1933         else
1934           # Note the libdir as a future libdir.
1935           case "$future_libdirs " in
1936           *" $libdir "*) ;;
1937           *) future_libdirs="$future_libdirs $libdir" ;;
1938           esac
1939         fi
1940
1941         dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
1942         test "X$dir" = "X$file/" && dir=
1943         dir="$dir$objdir"
1944
1945         # See the names of the shared library.
1946         set dummy $library_names
1947         if test -n "$2"; then
1948           realname="$2"
1949           shift
1950           shift
1951
1952           # Install the shared library and build the symlinks.
1953           $show "$install_prog $dir/$realname $destdir/$realname"
1954           $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
1955           test "X$dlname" = "X$realname" && dlname=
1956
1957           if test $# -gt 0; then
1958             # Delete the old symlinks.
1959             rmcmd="$rm"
1960             for linkname
1961             do
1962               if test "X$linkname" != "X$realname"; then
1963                 rmcmd="$rmcmd $destdir/$linkname"
1964               fi
1965             done
1966             $show "$rmcmd"
1967             $run $rmcmd
1968
1969             # ... and create new ones.
1970             for linkname
1971             do
1972               if test "X$linkname" != "X$realname"; then
1973                 test "X$dlname" = "X$linkname" && dlname=
1974                 $show "(cd $destdir && $LN_S $realname $linkname)"
1975                 $run eval "(cd $destdir && $LN_S $realname $linkname)"
1976               fi
1977             done
1978           fi
1979
1980           if test -n "$dlname"; then
1981             # Install the dynamically-loadable library.
1982             $show "$install_prog $dir/$dlname $destdir/$dlname"
1983             $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
1984           fi
1985
1986           # Do each command in the postinstall commands.
1987           lib="$destdir/$realname"
1988           eval cmds=\"$postinstall_cmds\"
1989           IFS="${IFS=   }"; save_ifs="$IFS"; IFS=';'
1990           for cmd in $cmds; do
1991             IFS="$save_ifs"
1992             $show "$cmd"
1993             $run eval "$cmd" || exit $?
1994           done
1995           IFS="$save_ifs"
1996         fi
1997
1998         # Install the pseudo-library for information purposes.
1999         name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2000         $show "$install_prog $file $destdir/$name"
2001         $run eval "$install_prog $file $destdir/$name" || exit $?
2002
2003         # Maybe install the static library, too.
2004         test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2005         ;;
2006
2007       *.lo)
2008         # Install (i.e. copy) a libtool object.
2009
2010         # Figure out destination file name, if it wasn't already specified.
2011         if test -n "$destname"; then
2012           destfile="$destdir/$destname"
2013         else
2014           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2015           destfile="$destdir/$destfile"
2016         fi
2017
2018         # Deduce the name of the destination old-style object file.
2019         case "$destfile" in
2020         *.lo)
2021           staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
2022           ;;
2023         *.o | *.obj)
2024           staticdest="$destfile"
2025           destfile=
2026           ;;
2027         *)
2028           $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
2029           $echo "$help" 1>&2
2030           exit 1
2031           ;;
2032         esac
2033
2034         # Install the libtool object if requested.
2035         if test -n "$destfile"; then
2036           $show "$install_prog $file $destfile"
2037           $run eval "$install_prog $file $destfile" || exit $?
2038         fi
2039
2040         # Install the old object if enabled.
2041         if test "$build_old_libs" = yes; then
2042           # Deduce the name of the old-style object file.
2043           staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
2044
2045           $show "$install_prog $staticobj $staticdest"
2046           $run eval "$install_prog \$staticobj \$staticdest" || exit $?
2047         fi
2048         exit 0
2049         ;;
2050
2051       *)
2052         # Figure out destination file name, if it wasn't already specified.
2053         if test -n "$destname"; then
2054           destfile="$destdir/$destname"
2055         else
2056           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2057           destfile="$destdir/$destfile"
2058         fi
2059
2060         # Do a test to see if this is really a libtool program.
2061         if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2062           link_against_libtool_libs=
2063           finalize_command=
2064
2065           # If there is no directory component, then add one.
2066           case "$file" in
2067           */* | *\\*) . $file ;;
2068           *) . ./$file ;;
2069           esac
2070
2071           # Check the variables that should have been set.
2072           if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
2073             $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
2074             exit 1
2075           fi
2076
2077           finalize=yes
2078           for lib in $link_against_libtool_libs; do
2079             # Check to see that each library is installed.
2080             libdir=
2081             if test -f "$lib"; then
2082               # If there is no directory component, then add one.
2083               case "$lib" in
2084               */* | *\\*) . $lib ;;
2085               *) . ./$lib ;;
2086               esac
2087             fi
2088             libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
2089             if test -n "$libdir" && test ! -f "$libfile"; then
2090               $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
2091               finalize=no
2092             fi
2093           done
2094
2095           if test "$hardcode_action" = relink; then
2096             if test "$finalize" = yes; then
2097               $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
2098               $show "$finalize_command"
2099               if $run eval "$finalize_command"; then :
2100               else
2101                 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
2102                 continue
2103               fi
2104               file="$objdir/$file"T
2105             else
2106               $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
2107             fi
2108           else
2109             # Install the binary that we compiled earlier.
2110             file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2111           fi
2112         fi
2113
2114         $show "$install_prog$stripme $file $destfile"
2115         $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
2116         ;;
2117       esac
2118     done
2119
2120     for file in $staticlibs; do
2121       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2122
2123       # Set up the ranlib parameters.
2124       oldlib="$destdir/$name"
2125
2126       $show "$install_prog $file $oldlib"
2127       $run eval "$install_prog \$file \$oldlib" || exit $?
2128
2129       # Do each command in the postinstall commands.
2130       eval cmds=\"$old_postinstall_cmds\"
2131       IFS="${IFS=       }"; save_ifs="$IFS"; IFS=';'
2132       for cmd in $cmds; do
2133         IFS="$save_ifs"
2134         $show "$cmd"
2135         $run eval "$cmd" || exit $?
2136       done
2137       IFS="$save_ifs"
2138     done
2139
2140     if test -n "$future_libdirs"; then
2141       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
2142     fi
2143
2144     if test -n "$current_libdirs"; then
2145       # Maybe just do a dry run.
2146       test -n "$run" && current_libdirs=" -n$current_libdirs"
2147       exec $SHELL $0 --finish$current_libdirs
2148       exit 1
2149     fi
2150
2151     exit 0
2152     ;;
2153
2154   # libtool finish mode
2155   finish)
2156     modename="$modename: finish"
2157     libdirs="$nonopt"
2158     admincmds=
2159
2160     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2161       for dir
2162       do
2163         libdirs="$libdirs $dir"
2164       done
2165
2166       for libdir in $libdirs; do
2167         if test -n "$finish_cmds"; then
2168           # Do each command in the finish commands.
2169           eval cmds=\"$finish_cmds\"
2170           IFS="${IFS=   }"; save_ifs="$IFS"; IFS=';'
2171           for cmd in $cmds; do
2172             IFS="$save_ifs"
2173             $show "$cmd"
2174             $run eval "$cmd" || admincmds="$admincmds
2175        $cmd"
2176           done
2177           IFS="$save_ifs"
2178         fi
2179         if test -n "$finish_eval"; then
2180           # Do the single finish_eval.
2181           eval cmds=\"$finish_eval\"
2182           $run eval "$cmds" || admincmds="$admincmds
2183        $cmds"
2184         fi
2185       done
2186     fi
2187
2188     echo "----------------------------------------------------------------------"
2189     echo "Libraries have been installed in:"
2190     for libdir in $libdirs; do
2191       echo "   $libdir"
2192     done
2193     echo
2194     echo "To link against installed libraries in a given directory, LIBDIR,"
2195     echo "you must use the \`-LLIBDIR' flag during linking."
2196     echo
2197     echo " You will also need to do at least one of the following:"
2198     if test -n "$shlibpath_var"; then
2199       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
2200       echo "     during execution"
2201     fi
2202     if test -n "$runpath_var"; then
2203       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
2204       echo "     during linking"
2205     fi
2206     if test -n "$hardcode_libdir_flag_spec"; then
2207       libdir=LIBDIR
2208       eval flag=\"$hardcode_libdir_flag_spec\"
2209
2210       echo "   - use the \`$flag' linker flag"
2211     fi
2212     if test -n "$admincmds"; then
2213       echo "   - have your system administrator run these commands:$admincmds"
2214     fi
2215     if test -f /etc/ld.so.conf; then
2216       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2217     fi
2218     echo
2219     echo "See any operating system documentation about shared libraries for"
2220     echo "more information, such as the ld(1) and ld.so(8) manual pages."
2221     echo "----------------------------------------------------------------------"
2222     exit 0
2223     ;;
2224
2225   # libtool execute mode
2226   execute)
2227     modename="$modename: execute"
2228
2229     # The first argument is the command name.
2230     cmd="$nonopt"
2231     if test -z "$cmd"; then
2232       $echo "$modename: you must specify a COMMAND" 1>&2
2233       $echo "$help"
2234       exit 1
2235     fi
2236
2237     # Handle -dlopen flags immediately.
2238     for file in $execute_dlfiles; do
2239       if test ! -f "$file"; then
2240         $echo "$modename: \`$file' is not a file" 1>&2
2241         $echo "$help" 1>&2
2242         exit 1
2243       fi
2244
2245       dir=
2246       case "$file" in
2247       *.la)
2248         # Check to see that this really is a libtool archive.
2249         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2250         else
2251           $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2252           $echo "$help" 1>&2
2253           exit 1
2254         fi
2255
2256         # Read the libtool library.
2257         dlname=
2258         library_names=
2259
2260         # If there is no directory component, then add one.
2261         case "$file" in
2262         */* | *\\*) . $file ;;
2263         *) . ./$file ;;
2264         esac
2265
2266         # Skip this library if it cannot be dlopened.
2267         if test -z "$dlname"; then
2268           # Warn if it was a shared library.
2269           test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
2270           continue
2271         fi
2272
2273         dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2274         test "X$dir" = "X$file" && dir=.
2275
2276         if test -f "$dir/$objdir/$dlname"; then
2277           dir="$dir/$objdir"
2278         else
2279           $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
2280           exit 1
2281         fi
2282         ;;
2283
2284       *.lo)
2285         # Just add the directory containing the .lo file.
2286         dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2287         test "X$dir" = "X$file" && dir=.
2288         ;;
2289
2290       *)
2291         $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
2292         continue
2293         ;;
2294       esac
2295
2296       # Get the absolute pathname.
2297       absdir=`cd "$dir" && pwd`
2298       test -n "$absdir" && dir="$absdir"
2299
2300       # Now add the directory to shlibpath_var.
2301       if eval "test -z \"\$$shlibpath_var\""; then
2302         eval "$shlibpath_var=\"\$dir\""
2303       else
2304         eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2305       fi
2306     done
2307
2308     # This variable tells wrapper scripts just to set shlibpath_var
2309     # rather than running their programs.
2310     libtool_execute_magic="$magic"
2311
2312     # Check if any of the arguments is a wrapper script.
2313     args=
2314     for file
2315     do
2316       case "$file" in
2317       -*) ;;
2318       *)
2319         # Do a test to see if this is really a libtool program.
2320         if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2321           # If there is no directory component, then add one.
2322           case "$file" in
2323           */* | *\\*) . $file ;;
2324           *) . ./$file ;;
2325           esac
2326
2327           # Transform arg to wrapped name.
2328           file="$progdir/$program"
2329         fi
2330         ;;
2331       esac
2332       # Quote arguments (to preserve shell metacharacters).
2333       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
2334       args="$args \"$file\""
2335     done
2336
2337     if test -z "$run"; then
2338       # Export the shlibpath_var.
2339       eval "export $shlibpath_var"
2340
2341       # Restore saved enviroment variables
2342       if test "${save_LC_ALL+set}" = set; then
2343         LC_ALL="$save_LC_ALL"; export LC_ALL
2344       fi
2345       if test "${save_LANG+set}" = set; then
2346         LANG="$save_LANG"; export LANG
2347       fi
2348
2349       # Now actually exec the command.
2350       eval "exec \$cmd$args"
2351
2352       $echo "$modename: cannot exec \$cmd$args"
2353       exit 1
2354     else
2355       # Display what would be done.
2356       eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
2357       $echo "export $shlibpath_var"
2358       $echo "$cmd$args"
2359       exit 0
2360     fi
2361     ;;
2362
2363   # libtool uninstall mode
2364   uninstall)
2365     modename="$modename: uninstall"
2366     rm="$nonopt"
2367     files=
2368
2369     for arg
2370     do
2371       case "$arg" in
2372       -*) rm="$rm $arg" ;;
2373       *) files="$files $arg" ;;
2374       esac
2375     done
2376
2377     if test -z "$rm"; then
2378       $echo "$modename: you must specify an RM program" 1>&2
2379       $echo "$help" 1>&2
2380       exit 1
2381     fi
2382
2383     for file in $files; do
2384       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2385       test "X$dir" = "X$file" && dir=.
2386       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2387
2388       rmfiles="$file"
2389
2390       case "$name" in
2391       *.la)
2392         # Possibly a libtool archive, so verify it.
2393         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2394           . $dir/$name
2395
2396           # Delete the libtool libraries and symlinks.
2397           for n in $library_names; do
2398             rmfiles="$rmfiles $dir/$n"
2399             test "X$n" = "X$dlname" && dlname=
2400           done
2401           test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
2402           test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
2403
2404           $show "$rm $rmfiles"
2405           $run $rm $rmfiles
2406
2407           if test -n "$library_names"; then
2408             # Do each command in the postuninstall commands.
2409             eval cmds=\"$postuninstall_cmds\"
2410             IFS="${IFS=         }"; save_ifs="$IFS"; IFS=';'
2411             for cmd in $cmds; do
2412               IFS="$save_ifs"
2413               $show "$cmd"
2414               $run eval "$cmd"
2415             done
2416             IFS="$save_ifs"
2417           fi
2418
2419           if test -n "$old_library"; then
2420             # Do each command in the old_postuninstall commands.
2421             eval cmds=\"$old_postuninstall_cmds\"
2422             IFS="${IFS=         }"; save_ifs="$IFS"; IFS=';'
2423             for cmd in $cmds; do
2424               IFS="$save_ifs"
2425               $show "$cmd"
2426               $run eval "$cmd"
2427             done
2428             IFS="$save_ifs"
2429           fi
2430
2431           # FIXME: should reinstall the best remaining shared library.
2432         fi
2433         ;;
2434
2435       *.lo)
2436         if test "$build_old_libs" = yes; then
2437           oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
2438           rmfiles="$rmfiles $dir/$oldobj"
2439         fi
2440         $show "$rm $rmfiles"
2441         $run $rm $rmfiles
2442         ;;
2443
2444       *)
2445         $show "$rm $rmfiles"
2446         $run $rm $rmfiles
2447         ;;
2448       esac
2449     done
2450     exit 0
2451     ;;
2452
2453   "")
2454     $echo "$modename: you must specify a MODE" 1>&2
2455     $echo "$generic_help" 1>&2
2456     exit 1
2457     ;;
2458   esac
2459
2460   $echo "$modename: invalid operation mode \`$mode'" 1>&2
2461   $echo "$generic_help" 1>&2
2462   exit 1
2463 fi # test -z "$show_help"
2464
2465 # We need to display help for each of the modes.
2466 case "$mode" in
2467 "") $echo \
2468 "Usage: $modename [OPTION]... [MODE-ARG]...
2469
2470 Provide generalized library-building support services.
2471
2472     --config          show all configuration variables
2473     --debug           enable verbose shell tracing
2474 -n, --dry-run         display commands without modifying any files
2475     --features        display basic configuration information and exit
2476     --finish          same as \`--mode=finish'
2477     --help            display this help message and exit
2478     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
2479     --quiet           same as \`--silent'
2480     --silent          don't print informational messages
2481     --version         print version information
2482
2483 MODE must be one of the following:
2484
2485       compile         compile a source file into a libtool object
2486       execute         automatically set library path, then run a program
2487       finish          complete the installation of libtool libraries
2488       install         install libraries or executables
2489       link            create a library or an executable
2490       uninstall       remove libraries from an installed directory
2491
2492 MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
2493 a more detailed description of MODE."
2494   exit 0
2495   ;;
2496
2497 compile)
2498   $echo \
2499 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2500
2501 Compile a source file into a libtool library object.
2502
2503 This mode accepts the following additional options:
2504
2505   -static           always build a \`.o' file suitable for static linking
2506
2507 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2508 from the given SOURCEFILE.
2509
2510 The output file name is determined by removing the directory component from
2511 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2512 library object suffix, \`.lo'."
2513   ;;
2514
2515 execute)
2516   $echo \
2517 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
2518
2519 Automatically set library path, then run a program.
2520
2521 This mode accepts the following additional options:
2522
2523   -dlopen FILE      add the directory containing FILE to the library path
2524
2525 This mode sets the library path environment variable according to \`-dlopen'
2526 flags.
2527
2528 If any of the ARGS are libtool executable wrappers, then they are translated
2529 into their corresponding uninstalled binary, and any of their required library
2530 directories are added to the library path.
2531
2532 Then, COMMAND is executed, with ARGS as arguments."
2533   ;;
2534
2535 finish)
2536   $echo \
2537 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
2538
2539 Complete the installation of libtool libraries.
2540
2541 Each LIBDIR is a directory that contains libtool libraries.
2542
2543 The commands that this mode executes may require superuser privileges.  Use
2544 the \`--dry-run' option if you just want to see what would be executed."
2545   ;;
2546
2547 install)
2548   $echo \
2549 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
2550
2551 Install executables or libraries.
2552
2553 INSTALL-COMMAND is the installation command.  The first component should be
2554 either the \`install' or \`cp' program.
2555
2556 The rest of the components are interpreted as arguments to that command (only
2557 BSD-compatible install options are recognized)."
2558   ;;
2559
2560 link)
2561   $echo \
2562 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
2563
2564 Link object files or libraries together to form another library, or to
2565 create an executable program.
2566
2567 LINK-COMMAND is a command using the C compiler that you would use to create
2568 a program from several object files.
2569
2570 The following components of LINK-COMMAND are treated specially:
2571
2572   -all-static       do not do any dynamic linking at all
2573   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
2574   -dlpreopen FILE   link in FILE and add its symbols to dld_preloaded_symbols
2575   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2576   -LLIBDIR          search LIBDIR for required installed libraries
2577   -lNAME            OUTPUT-FILE requires the installed library libNAME
2578   -no-undefined     declare that a library does not refer to external symbols
2579   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
2580   -release RELEASE  specify package release information
2581   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
2582   -static           do not do any dynamic linking of libtool libraries
2583   -version-info CURRENT[:REVISION[:AGE]]
2584                     specify library version info [each variable defaults to 0]
2585
2586 All other options (arguments beginning with \`-') are ignored.
2587
2588 Every other argument is treated as a filename.  Files ending in \`.la' are
2589 treated as uninstalled libtool libraries, other files are standard or library
2590 object files.
2591
2592 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
2593 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
2594
2595 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2596 using \`ar' and \`ranlib', or on WIndows using \`lib'.
2597
2598 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2599 is created, otherwise an executable program is created."
2600   ;;
2601
2602 uninstall)
2603   $echo
2604 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2605
2606 Remove libraries from an installation directory.
2607
2608 RM is the name of the program to use to delete files associated with each FILE
2609 (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
2610 to RM.
2611
2612 If FILE is a libtool library, all the files associated with it are deleted.
2613 Otherwise, only FILE itself is deleted using RM."
2614   ;;
2615
2616 *)
2617   $echo "$modename: invalid operation mode \`$mode'" 1>&2
2618   $echo "$help" 1>&2
2619   exit 1
2620   ;;
2621 esac
2622
2623 echo
2624 $echo "Try \`$modename --help' for more information about other modes."
2625
2626 exit 0
2627
2628 # Local Variables:
2629 # mode:shell-script
2630 # sh-indentation:2
2631 # End: