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