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