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