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