]> Pileus Git - ~andy/gtk/blob - ltmain.sh
Check for features.h.
[~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=
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       # Now set the variables for building old libraries.
1078       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1079         oldlibs="$oldlibs $objdir/$libname.a"
1080
1081         # Transform .lo files to .o files.
1082         oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^   ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1083       fi
1084
1085       if test "$build_libtool_libs" = yes; then
1086         # Get the real and link names of the library.
1087         eval library_names=\"$library_names_spec\"
1088         set dummy $library_names
1089         realname="$2"
1090         shift; shift
1091
1092         if test -n "$soname_spec"; then
1093           eval soname=\"$soname_spec\"
1094         else
1095           soname="$realname"
1096         fi
1097
1098         lib="$objdir/$realname"
1099         for link
1100         do
1101           linknames="$linknames $link"
1102         done
1103
1104         # Use standard objects if they are PIC.
1105         test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'`
1106
1107         if test -n "$whole_archive_flag_spec"; then
1108           if test -n "$convenience"; then
1109             eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
1110           fi
1111         else
1112           for xlib in $convenience; do
1113             # Extract the objects.
1114             xdir="$xlib"x
1115             generated="$generated $xdir"
1116             xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'`
1117
1118             $show "${rm}r $xdir"
1119             $run ${rm}r "$xdir"
1120             $show "mkdir $xdir"
1121             $run mkdir "$xdir"
1122             status=$?
1123             if test $status -ne 0 && test ! -d "$xdir"; then
1124               exit $status
1125             fi
1126             $show "(cd $xdir && $AR x ../$xlib)"
1127             $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1128
1129             libobjs="$libobjs `echo $xdir/*`"
1130           done
1131         fi
1132
1133         # Do each of the archive commands.
1134         eval cmds=\"$archive_cmds\"
1135         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
1136         for cmd in $cmds; do
1137           IFS="$save_ifs"
1138           $show "$cmd"
1139           $run eval "$cmd" || exit $?
1140         done
1141         IFS="$save_ifs"
1142
1143         # Create links to the real library.
1144         for linkname in $linknames; do
1145           if test "$realname" != "$linkname"; then
1146             $show "(cd $objdir && $LN_S $realname $linkname)"
1147             $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
1148           fi
1149         done
1150
1151         # If -export-dynamic was specified, set the dlname.
1152         if test "$export_dynamic" = yes; then
1153           # On all known operating systems, these are identical.
1154           dlname="$soname"
1155         fi
1156       fi
1157       ;;
1158
1159     *.lo | *.o)
1160       if test -n "$link_against_libtool_libs"; then
1161         $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
1162         exit 1
1163       fi
1164
1165       if test -n "$deplibs"; then
1166         $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
1167       fi
1168
1169       if test -n "$dlfiles$dlprefiles"; then
1170         $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
1171       fi
1172
1173       if test -n "$rpath"; then
1174         $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
1175       fi
1176
1177       if test -n "$vinfo"; then
1178         $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
1179       fi
1180
1181       if test -n "$release"; then
1182         $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
1183       fi
1184
1185       case "$output" in
1186       *.lo)
1187         if test -n "$objs"; then
1188           $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
1189           exit 1
1190         fi
1191         libobj="$output"
1192         obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'`
1193         ;;
1194       *)
1195         libobj=
1196         obj="$output"
1197         ;;
1198       esac
1199
1200       # Delete the old objects.
1201       $run $rm $obj $libobj
1202
1203       # Create the old-style object.
1204       reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^       ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1205
1206       output="$obj"
1207       eval cmds=\"$reload_cmds\"
1208       IFS="${IFS=       }"; save_ifs="$IFS"; IFS=';'
1209       for cmd in $cmds; do
1210         IFS="$save_ifs"
1211         $show "$cmd"
1212         $run eval "$cmd" || exit $?
1213       done
1214       IFS="$save_ifs"
1215
1216       # Exit if we aren't doing a library object file.
1217       test -z "$libobj" && exit 0
1218
1219       if test "$build_libtool_libs" != yes; then
1220         # Create an invalid libtool object if no PIC, so that we don't
1221         # accidentally link it into a program.
1222         $show "echo timestamp > $libobj"
1223         $run eval "echo timestamp > $libobj" || exit $?
1224         exit 0
1225       fi
1226
1227       if test -n "$pic_flag"; then
1228         # Only do commands if we really have different PIC objects.
1229         reload_objs="$libobjs"
1230         output="$libobj"
1231         eval cmds=\"$reload_cmds\"
1232         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
1233         for cmd in $cmds; do
1234           IFS="$save_ifs"
1235           $show "$cmd"
1236           $run eval "$cmd" || exit $?
1237         done
1238         IFS="$save_ifs"
1239       else
1240         # Just create a symlink.
1241         $show "$LN_S $obj $libobj"
1242         $run $LN_S $obj $libobj || exit $?
1243       fi
1244
1245       exit 0
1246       ;;
1247
1248     *)
1249       if test -n "$vinfo"; then
1250         $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
1251       fi
1252
1253       if test -n "$release"; then
1254         $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
1255       fi
1256
1257       if test -n "$rpath"; then
1258         # If the user specified any rpath flags, then add them.
1259         for libdir in $rpath; do
1260           if test -n "$hardcode_libdir_flag_spec"; then
1261             if test -n "$hardcode_libdir_separator"; then
1262               if test -z "$hardcode_libdirs"; then
1263                 # Put the magic libdir with the hardcode flag.
1264                 hardcode_libdirs="$libdir"
1265                 libdir="@HARDCODE_LIBDIRS@"
1266               else
1267                 # Just accumulate the unique libdirs.
1268                 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1269                 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1270                   ;;
1271                 *)
1272                   hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1273                   ;;
1274                 esac
1275                 libdir=
1276               fi
1277             fi
1278
1279             if test -n "$libdir"; then
1280               eval flag=\"$hardcode_libdir_flag_spec\"
1281
1282               compile_command="$compile_command $flag"
1283               finalize_command="$finalize_command $flag"
1284             fi
1285           elif test -n "$runpath_var"; then
1286             case "$perm_rpath " in
1287             *" $libdir "*) ;;
1288             *) perm_rpath="$perm_rpath $libdir" ;;
1289             esac
1290           fi
1291         done
1292       fi
1293
1294       # Substitute the hardcoded libdirs into the compile commands.
1295       if test -n "$hardcode_libdir_separator"; then
1296         compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1297         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1298       fi
1299
1300       if test -n "$libobjs" && test "$build_old_libs" = yes; then
1301         # Transform all the library objects into standard objects.
1302         compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1303         finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1304       fi
1305
1306       if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
1307         dlsyms="${output}S.c"
1308       else
1309         dlsyms=
1310       fi
1311
1312       if test -n "$dlsyms"; then
1313         # Add our own program objects to the preloaded list.
1314         dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1315
1316         # Discover the nlist of each of the dlfiles.
1317         nlist="$objdir/${output}.nm"
1318
1319         if test -d $objdir; then
1320           $show "$rm $nlist ${nlist}T"
1321           $run $rm "$nlist" "${nlist}T"
1322         else
1323           $show "$mkdir $objdir"
1324           $run $mkdir $objdir
1325           status=$?
1326           if test $status -ne 0 && test ! -d $objdir; then
1327             exit $status
1328           fi
1329         fi
1330
1331         for arg in $dlprefiles; do
1332           $show "extracting global C symbols from \`$arg'"
1333           $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
1334         done
1335
1336         # Parse the name list into a source file.
1337         $show "creating $objdir/$dlsyms"
1338         if test -z "$run"; then
1339           # Make sure we at least have an empty file.
1340           test -f "$nlist" || : > "$nlist"
1341
1342           # Try sorting and uniquifying the output.
1343           if sort "$nlist" | uniq > "$nlist"T; then
1344             mv -f "$nlist"T "$nlist"
1345             wcout=`wc "$nlist" 2>/dev/null`
1346             count=`echo "X$wcout" | $Xsed -e 's/^[      ]*\([0-9][0-9]*\).*$/\1/'`
1347             (test "$count" -ge 0) 2>/dev/null || count=-1
1348           else
1349             $rm "$nlist"T
1350             count=-1
1351           fi
1352
1353           case "$dlsyms" in
1354           "") ;;
1355           *.c)
1356             $echo > "$objdir/$dlsyms" "\
1357 /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
1358 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
1359
1360 #ifdef __cplusplus
1361 extern \"C\" {
1362 #endif
1363
1364 /* Prevent the only kind of declaration conflicts we can make. */
1365 #define dld_preloaded_symbol_count some_other_symbol
1366 #define dld_preloaded_symbols some_other_symbol
1367
1368 /* External symbol declarations for the compiler. */\
1369 "
1370
1371             if test -f "$nlist"; then
1372               sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
1373             else
1374               echo '/* NONE */' >> "$objdir/$dlsyms"
1375             fi
1376
1377             $echo >> "$objdir/$dlsyms" "\
1378
1379 #undef dld_preloaded_symbol_count
1380 #undef dld_preloaded_symbols
1381
1382 #if defined (__STDC__) && __STDC__
1383 # define __ptr_t void *
1384 #else
1385 # define __ptr_t char *
1386 #endif
1387
1388 /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
1389 int dld_preloaded_symbol_count = $count;
1390
1391 /* The mapping between symbol names and symbols. */
1392 struct {
1393   char *name;
1394   __ptr_t address;
1395 }
1396 dld_preloaded_symbols[] =
1397 {\
1398 "
1399
1400             if test -f "$nlist"; then
1401               sed 's/^\(.*\) \(.*\)$/  {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
1402             fi
1403
1404             $echo >> "$objdir/$dlsyms" "\
1405   {0, (__ptr_t) 0}
1406 };
1407
1408 #ifdef __cplusplus
1409 }
1410 #endif\
1411 "
1412             ;;
1413
1414           *)
1415             $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
1416             exit 1
1417             ;;
1418           esac
1419         fi
1420
1421         # Now compile the dynamic symbol file.
1422         $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
1423         $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
1424
1425         # Transform the symbol file into the correct name.
1426         compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
1427         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
1428       elif test "$export_dynamic" != yes; then
1429         test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
1430       else
1431         # We keep going just in case the user didn't refer to
1432         # dld_preloaded_symbols.  The linker will fail if global_symbol_pipe
1433         # really was required.
1434         $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
1435
1436         # Nullify the symbol file.
1437         compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1438         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1439       fi
1440
1441       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
1442         # Replace the output file specification.
1443         compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1444         finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1445
1446         # We have no uninstalled library dependencies, so finalize right now.
1447         $show "$compile_command"
1448         $run eval "$compile_command"
1449         exit $?
1450       fi
1451
1452       # Replace the output file specification.
1453       compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
1454       finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
1455
1456       # Create the binary in the object directory, then wrap it.
1457       if test ! -d $objdir; then
1458         $show "$mkdir $objdir"
1459         $run $mkdir $objdir
1460         status=$?
1461         if test $status -ne 0 && test ! -d $objdir; then
1462           exit $status
1463         fi
1464       fi
1465
1466       if test -n "$shlibpath_var"; then
1467         # We should set the shlibpath_var
1468         rpath=
1469         for dir in $temp_rpath; do
1470           case "$dir" in
1471           /* | [A-Za-z]:[/\\]*)
1472             # Absolute path.
1473             rpath="$rpath$dir:"
1474             ;;
1475           *)
1476             # Relative path: add a thisdir entry.
1477             rpath="$rpath\$thisdir/$dir:"
1478             ;;
1479           esac
1480         done
1481         temp_rpath="$rpath"
1482       fi
1483
1484       # Delete the old output file.
1485       $run $rm $output
1486
1487       if test -n "$compile_shlibpath"; then
1488         compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
1489       fi
1490       if test -n "$finalize_shlibpath"; then
1491         finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
1492       fi
1493
1494       if test -n "$runpath_var" && test -n "$perm_rpath"; then
1495         # We should set the runpath_var.
1496         rpath=
1497         for dir in $perm_rpath; do
1498           rpath="$rpath$dir:"
1499         done
1500         compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
1501         finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
1502       fi
1503
1504       if test "$hardcode_action" = relink; then
1505         # AGH! Flame the AIX and HP-UX people for me, will ya?
1506         $echo "$modename: warning: using a buggy system linker" 1>&2
1507         $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
1508       fi
1509
1510       $show "$compile_command"
1511       $run eval "$compile_command" || exit $?
1512
1513       # Now create the wrapper script.
1514       $show "creating $output"
1515
1516       # Quote the finalize command for shipping.
1517       finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
1518
1519       # Quote $echo for shipping.
1520       qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
1521
1522       # Only actually do things if our run command is non-null.
1523       if test -z "$run"; then
1524         $rm $output
1525         trap "$rm $output; exit 1" 1 2 15
1526
1527         $echo > $output "\
1528 #! $SHELL
1529
1530 # $output - temporary wrapper script for $objdir/$output
1531 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1532 #
1533 # The $output program cannot be directly executed until all the libtool
1534 # libraries that it depends on are installed.
1535 #
1536 # This wrapper script should never be moved out of \``pwd`'.
1537 # If it is, it will not operate correctly.
1538
1539 # Sed substitution that helps us do robust quoting.  It backslashifies
1540 # metacharacters that are still active within double-quoted strings.
1541 Xsed='sed -e s/^X//'
1542 sed_quote_subst='$sed_quote_subst'
1543
1544 # The HP-UX ksh and POSIX shell print the target directory to stdout
1545 # if CDPATH is set.
1546 if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
1547
1548 # This environment variable determines our operation mode.
1549 if test \"\$libtool_install_magic\" = \"$magic\"; then
1550   # install mode needs the following variables:
1551   link_against_libtool_libs='$link_against_libtool_libs'
1552   finalize_command=\"$finalize_command\"
1553 else
1554   # When we are sourced in execute mode, \$file and \$echo are already set.
1555   if test \"\$libtool_execute_magic\" != \"$magic\"; then
1556     echo=\"$qecho\"
1557     file=\"\$0\"
1558     # Make sure echo works.
1559     if test \"X\$1\" = X--no-reexec; then
1560       # Discard the --no-reexec flag, and continue.
1561       shift
1562     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
1563       # Yippee, \$echo works!
1564       :
1565     else
1566       # Restart under the correct shell, and then maybe \$echo will work.
1567       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
1568     fi
1569   fi\
1570 "
1571         $echo >> $output "\
1572
1573   # Find the directory that this script lives in.
1574   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
1575   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
1576
1577   # Follow symbolic links until we get to the real thisdir.
1578   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
1579   while test -n \"\$file\"; do
1580     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
1581
1582     # If there was a directory component, then change thisdir.
1583     if test \"x\$destdir\" != \"x\$file\"; then
1584       case \"\$destdir\" in
1585       /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;;
1586       *) thisdir=\"\$thisdir/\$destdir\" ;;
1587       esac
1588     fi
1589
1590     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
1591     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
1592   done
1593
1594   # Try to get the absolute directory name.
1595   absdir=\`cd \"\$thisdir\" && pwd\`
1596   test -n \"\$absdir\" && thisdir=\"\$absdir\"
1597
1598   progdir=\"\$thisdir/$objdir\"
1599   program='$output'
1600
1601   if test -f \"\$progdir/\$program\"; then"
1602
1603         # Export our shlibpath_var if we have one.
1604         if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1605           $echo >> $output "\
1606     # Add our own library path to $shlibpath_var
1607     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
1608
1609     # Some systems cannot cope with colon-terminated $shlibpath_var
1610     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
1611
1612     export $shlibpath_var
1613 "
1614         fi
1615
1616         $echo >> $output "\
1617     if test \"\$libtool_execute_magic\" != \"$magic\"; then
1618       # Run the actual program with our arguments.
1619
1620       # Export the path to the program.
1621       PATH=\"\$progdir:\$PATH\"
1622       export PATH
1623
1624       exec \$program \${1+\"\$@\"}
1625
1626       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
1627       exit 1
1628     fi
1629   else
1630     # The program doesn't exist.
1631     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
1632     \$echo \"This script is just a wrapper for \$program.\" 1>&2
1633     echo \"See the $PACKAGE documentation for more information.\" 1>&2
1634     exit 1
1635   fi
1636 fi\
1637 "
1638         chmod +x $output
1639       fi
1640       exit 0
1641       ;;
1642     esac
1643
1644     # See if we need to build an old-fashioned archive.
1645     for oldlib in $oldlibs; do
1646
1647       if test "$build_libtool_libs" = convenience; then
1648         oldobjs="$libobjs"
1649         addlibs="$convenience"
1650         build_libtool_libs=no
1651       else
1652         addlibs="$old_convenience"
1653       fi
1654
1655       # Add in members from convenience archives.
1656       for xlib in $addlibs; do
1657         # Extract the objects.
1658         xdir="$xlib"x
1659         generated="$generated $xdir"
1660         xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'`
1661
1662         $show "${rm}r $xdir"
1663         $run ${rm}r "$xdir"
1664         $show "mkdir $xdir"
1665         $run mkdir "$xdir"
1666         status=$?
1667         if test $status -ne 0 && test ! -d "$xdir"; then
1668           exit $status
1669         fi
1670         $show "(cd $xdir && $AR x ../$xlib)"
1671         $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1672
1673         oldobjs="$oldobjs `echo $xdir/*`"
1674       done
1675
1676       # Do each command in the archive commands.
1677       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
1678         eval cmds=\"$old_archive_from_new_cmds\"
1679       else
1680         eval cmds=\"$old_archive_cmds\"
1681       fi
1682       IFS="${IFS=       }"; save_ifs="$IFS"; IFS=';'
1683       for cmd in $cmds; do
1684         IFS="$save_ifs"
1685         $show "$cmd"
1686         $run eval "$cmd" || exit $?
1687       done
1688       IFS="$save_ifs"
1689     done
1690
1691     if test -n "$generated"; then
1692       $show "${rm}r$generated"
1693       $run ${rm}r$generated
1694     fi
1695
1696     # Now create the libtool archive.
1697     case "$output" in
1698     *.la)
1699       old_library=
1700       test "$build_old_libs" = yes && old_library="$libname.a"
1701       $show "creating $output"
1702
1703       # Only create the output if not a dry run.
1704       if test -z "$run"; then
1705         $echo > $output "\
1706 # $output - a libtool library file
1707 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1708
1709 # The name that we can dlopen(3).
1710 dlname='$dlname'
1711
1712 # Names of this library.
1713 library_names='$library_names'
1714
1715 # The name of the static archive.
1716 old_library='$old_library'
1717
1718 # Libraries that this one depends upon.
1719 dependency_libs='$dependency_libs'
1720
1721 # Version information for $libname.
1722 current=$current
1723 age=$age
1724 revision=$revision
1725
1726 # Directory that this library needs to be installed in:
1727 libdir='$install_libdir'\
1728 "
1729       fi
1730
1731       # Do a symbolic link so that the libtool archive can be found in
1732       # LD_LIBRARY_PATH before the program is installed.
1733       $show "(cd $objdir && $LN_S ../$output $output)"
1734       $run eval "(cd $objdir && $LN_S ../$output $output)" || exit $?
1735       ;;
1736     esac
1737     exit 0
1738     ;;
1739
1740   # libtool install mode
1741   install)
1742     modename="$modename: install"
1743
1744     # There may be an optional sh(1) argument at the beginning of
1745     # install_prog (especially on Windows NT).
1746     if test "$nonopt" = "$SHELL"; then
1747       # Aesthetically quote it.
1748       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
1749       case "$arg" in
1750       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
1751         arg="\"$arg\""
1752         ;;
1753       esac
1754       install_prog="$arg "
1755       arg="$1"
1756       shift
1757     else
1758       install_prog=
1759       arg="$nonopt"
1760     fi
1761
1762     # The real first argument should be the name of the installation program.
1763     # Aesthetically quote it.
1764     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1765     case "$arg" in
1766     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
1767       arg="\"$arg\""
1768       ;;
1769     esac
1770     install_prog="$install_prog$arg"
1771
1772     # We need to accept at least all the BSD install flags.
1773     dest=
1774     files=
1775     opts=
1776     prev=
1777     install_type=
1778     isdir=no
1779     stripme=
1780     for arg
1781     do
1782       if test -n "$dest"; then
1783         files="$files $dest"
1784         dest="$arg"
1785         continue
1786       fi
1787
1788       case "$arg" in
1789       -d) isdir=yes ;;
1790       -f) prev="-f" ;;
1791       -g) prev="-g" ;;
1792       -m) prev="-m" ;;
1793       -o) prev="-o" ;;
1794       -s)
1795         stripme=" -s"
1796         continue
1797         ;;
1798       -*) ;;
1799
1800       *)
1801         # If the previous option needed an argument, then skip it.
1802         if test -n "$prev"; then
1803           prev=
1804         else
1805           dest="$arg"
1806           continue
1807         fi
1808         ;;
1809       esac
1810
1811       # Aesthetically quote the argument.
1812       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1813       case "$arg" in
1814       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
1815         arg="\"$arg\""
1816         ;;
1817       esac
1818       install_prog="$install_prog $arg"
1819     done
1820
1821     if test -z "$install_prog"; then
1822       $echo "$modename: you must specify an install program" 1>&2
1823       $echo "$help" 1>&2
1824       exit 1
1825     fi
1826
1827     if test -n "$prev"; then
1828       $echo "$modename: the \`$prev' option requires an argument" 1>&2
1829       $echo "$help" 1>&2
1830       exit 1
1831     fi
1832
1833     if test -z "$files"; then
1834       if test -z "$dest"; then
1835         $echo "$modename: no file or destination specified" 1>&2
1836       else
1837         $echo "$modename: you must specify a destination" 1>&2
1838       fi
1839       $echo "$help" 1>&2
1840       exit 1
1841     fi
1842
1843     # Strip any trailing slash from the destination.
1844     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
1845
1846     # Check to see that the destination is a directory.
1847     test -d "$dest" && isdir=yes
1848     if test "$isdir" = yes; then
1849       destdir="$dest"
1850       destname=
1851     else
1852       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
1853       test "X$destdir" = "X$dest" && destdir=.
1854       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
1855
1856       # Not a directory, so check to see that there is only one file specified.
1857       set dummy $files
1858       if test $# -gt 2; then
1859         $echo "$modename: \`$dest' is not a directory" 1>&2
1860         $echo "$help" 1>&2
1861         exit 1
1862       fi
1863     fi
1864     case "$destdir" in
1865     /* | [A-Za-z]:[/\\]*) ;;
1866     *)
1867       for file in $files; do
1868         case "$file" in
1869         *.lo) ;;
1870         *)
1871           $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
1872           $echo "$help" 1>&2
1873           exit 1
1874           ;;
1875         esac
1876       done
1877       ;;
1878     esac
1879
1880     # This variable tells wrapper scripts just to set variables rather
1881     # than running their programs.
1882     libtool_install_magic="$magic"
1883
1884     staticlibs=
1885     future_libdirs=
1886     current_libdirs=
1887     for file in $files; do
1888
1889       # Do each installation.
1890       case "$file" in
1891       *.a)
1892         # Do the static libraries later.
1893         staticlibs="$staticlibs $file"
1894         ;;
1895
1896       *.la)
1897         # Check to see that this really is a libtool archive.
1898         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1899         else
1900           $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
1901           $echo "$help" 1>&2
1902           exit 1
1903         fi
1904
1905         library_names=
1906         old_library=
1907         # If there is no directory component, then add one.
1908         case "$file" in
1909         */* | *\\*) . $file ;;
1910         *) . ./$file ;;
1911         esac
1912
1913         # Add the libdir to current_libdirs if it is the destination.
1914         if test "X$destdir" = "X$libdir"; then
1915           case "$current_libdirs " in
1916           *" $libdir "*) ;;
1917           *) current_libdirs="$current_libdirs $libdir" ;;
1918           esac
1919         else
1920           # Note the libdir as a future libdir.
1921           case "$future_libdirs " in
1922           *" $libdir "*) ;;
1923           *) future_libdirs="$future_libdirs $libdir" ;;
1924           esac
1925         fi
1926
1927         dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
1928         test "X$dir" = "X$file/" && dir=
1929         dir="$dir$objdir"
1930
1931         # See the names of the shared library.
1932         set dummy $library_names
1933         if test -n "$2"; then
1934           realname="$2"
1935           shift
1936           shift
1937
1938           # Install the shared library and build the symlinks.
1939           $show "$install_prog $dir/$realname $destdir/$realname"
1940           $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
1941           test "X$dlname" = "X$realname" && dlname=
1942
1943           if test $# -gt 0; then
1944             # Delete the old symlinks.
1945             rmcmd="$rm"
1946             for linkname
1947             do
1948               rmcmd="$rmcmd $destdir/$linkname"
1949             done
1950             $show "$rmcmd"
1951             $run $rmcmd
1952
1953             # ... and create new ones.
1954             for linkname
1955             do
1956               test "X$dlname" = "X$linkname" && dlname=
1957               $show "(cd $destdir && $LN_S $realname $linkname)"
1958               $run eval "(cd $destdir && $LN_S $realname $linkname)"
1959             done
1960           fi
1961
1962           if test -n "$dlname"; then
1963             # Install the dynamically-loadable library.
1964             $show "$install_prog $dir/$dlname $destdir/$dlname"
1965             $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
1966           fi
1967
1968           # Do each command in the postinstall commands.
1969           lib="$destdir/$realname"
1970           eval cmds=\"$postinstall_cmds\"
1971           IFS="${IFS=   }"; save_ifs="$IFS"; IFS=';'
1972           for cmd in $cmds; do
1973             IFS="$save_ifs"
1974             $show "$cmd"
1975             $run eval "$cmd" || exit $?
1976           done
1977           IFS="$save_ifs"
1978         fi
1979
1980         # Install the pseudo-library for information purposes.
1981         name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1982         $show "$install_prog $file $destdir/$name"
1983         $run eval "$install_prog $file $destdir/$name" || exit $?
1984
1985         # Maybe install the static library, too.
1986         test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
1987         ;;
1988
1989       *.lo)
1990         # Install (i.e. copy) a libtool object.
1991
1992         # Figure out destination file name, if it wasn't already specified.
1993         if test -n "$destname"; then
1994           destfile="$destdir/$destname"
1995         else
1996           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1997           destfile="$destdir/$destfile"
1998         fi
1999
2000         # Deduce the name of the destination old-style object file.
2001         case "$destfile" in
2002         *.lo)
2003           staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/.o/'`
2004           ;;
2005         *.o)
2006           staticdest="$destfile"
2007           destfile=
2008           ;;
2009         *)
2010           $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
2011           $echo "$help" 1>&2
2012           exit 1
2013           ;;
2014         esac
2015
2016         # Install the libtool object if requested.
2017         if test -n "$destfile"; then
2018           $show "$install_prog $file $destfile"
2019           $run eval "$install_prog $file $destfile" || exit $?
2020         fi
2021
2022         # Install the old object if enabled.
2023         if test "$build_old_libs" = yes; then
2024           # Deduce the name of the old-style object file.
2025           staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/.o/'`
2026
2027           $show "$install_prog $staticobj $staticdest"
2028           $run eval "$install_prog \$staticobj \$staticdest" || exit $?
2029         fi
2030         exit 0
2031         ;;
2032
2033       *)
2034         # Figure out destination file name, if it wasn't already specified.
2035         if test -n "$destname"; then
2036           destfile="$destdir/$destname"
2037         else
2038           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2039           destfile="$destdir/$destfile"
2040         fi
2041
2042         # Do a test to see if this is really a libtool program.
2043         if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2044           link_against_libtool_libs=
2045           finalize_command=
2046
2047           # If there is no directory component, then add one.
2048           case "$file" in
2049           */* | *\\*) . $file ;;
2050           *) . ./$file ;;
2051           esac
2052
2053           # Check the variables that should have been set.
2054           if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
2055             $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
2056             exit 1
2057           fi
2058
2059           finalize=yes
2060           for lib in $link_against_libtool_libs; do
2061             # Check to see that each library is installed.
2062             libdir=
2063             if test -f "$lib"; then
2064               # If there is no directory component, then add one.
2065               case "$lib" in
2066               */* | *\\*) . $lib ;;
2067               *) . ./$lib ;;
2068               esac
2069             fi
2070             libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
2071             if test -n "$libdir" && test ! -f "$libfile"; then
2072               $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
2073               finalize=no
2074             fi
2075           done
2076
2077           if test "$hardcode_action" = relink; then
2078             if test "$finalize" = yes; then
2079               $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
2080               $show "$finalize_command"
2081               if $run eval "$finalize_command"; then :
2082               else
2083                 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
2084                 continue
2085               fi
2086               file="$objdir/$file"T
2087             else
2088               $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
2089             fi
2090           else
2091             # Install the binary that we compiled earlier.
2092             file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2093           fi
2094         fi
2095
2096         $show "$install_prog$stripme $file $destfile"
2097         $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
2098         ;;
2099       esac
2100     done
2101
2102     for file in $staticlibs; do
2103       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2104
2105       # Set up the ranlib parameters.
2106       oldlib="$destdir/$name"
2107
2108       $show "$install_prog $file $oldlib"
2109       $run eval "$install_prog \$file \$oldlib" || exit $?
2110
2111       # Do each command in the postinstall commands.
2112       eval cmds=\"$old_postinstall_cmds\"
2113       IFS="${IFS=       }"; save_ifs="$IFS"; IFS=';'
2114       for cmd in $cmds; do
2115         IFS="$save_ifs"
2116         $show "$cmd"
2117         $run eval "$cmd" || exit $?
2118       done
2119       IFS="$save_ifs"
2120     done
2121
2122     if test -n "$future_libdirs"; then
2123       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
2124     fi
2125
2126     if test -n "$current_libdirs"; then
2127       # Maybe just do a dry run.
2128       test -n "$run" && current_libdirs=" -n$current_libdirs"
2129       exec $SHELL $0 --finish$current_libdirs
2130       exit 1
2131     fi
2132
2133     exit 0
2134     ;;
2135
2136   # libtool finish mode
2137   finish)
2138     modename="$modename: finish"
2139     libdirs="$nonopt"
2140     admincmds=
2141
2142     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2143       for dir
2144       do
2145         libdirs="$libdirs $dir"
2146       done
2147
2148       for libdir in $libdirs; do
2149         if test -n "$finish_cmds"; then
2150           # Do each command in the finish commands.
2151           eval cmds=\"$finish_cmds\"
2152           IFS="${IFS=   }"; save_ifs="$IFS"; IFS=';'
2153           for cmd in $cmds; do
2154             IFS="$save_ifs"
2155             $show "$cmd"
2156             $run eval "$cmd" || admincmds="$admincmds
2157        $cmd"
2158           done
2159           IFS="$save_ifs"
2160         fi
2161         if test -n "$finish_eval"; then
2162           # Do the single finish_eval.
2163           eval cmds=\"$finish_eval\"
2164           $run eval "$cmds" || admincmds="$admincmds
2165        $cmds"
2166         fi
2167       done
2168     fi
2169
2170     echo "----------------------------------------------------------------------"
2171     echo "Libraries have been installed in:"
2172     for libdir in $libdirs; do
2173       echo "   $libdir"
2174     done
2175     echo
2176     echo "To link against installed libraries in a given directory, LIBDIR,"
2177     echo "you must use the \`-LLIBDIR' flag during linking."
2178     echo
2179     echo " You will also need to do at least one of the following:"
2180     if test -n "$shlibpath_var"; then
2181       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
2182       echo "     during execution"
2183     fi
2184     if test -n "$runpath_var"; then
2185       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
2186       echo "     during linking"
2187     fi
2188     if test -n "$hardcode_libdir_flag_spec"; then
2189       libdir=LIBDIR
2190       eval flag=\"$hardcode_libdir_flag_spec\"
2191
2192       echo "   - use the \`$flag' linker flag"
2193     fi
2194     if test -n "$admincmds"; then
2195       echo "   - have your system administrator run these commands:$admincmds"
2196     fi
2197     if test -f /etc/ld.so.conf; then
2198       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2199     fi
2200     echo
2201     echo "See any operating system documentation about shared libraries for"
2202     echo "more information, such as the ld(1) and ld.so(8) manual pages."
2203     echo "----------------------------------------------------------------------"
2204     exit 0
2205     ;;
2206
2207   # libtool execute mode
2208   execute)
2209     modename="$modename: execute"
2210
2211     # The first argument is the command name.
2212     cmd="$nonopt"
2213     if test -z "$cmd"; then
2214       $echo "$modename: you must specify a COMMAND" 1>&2
2215       $echo "$help"
2216       exit 1
2217     fi
2218
2219     # Handle -dlopen flags immediately.
2220     for file in $execute_dlfiles; do
2221       if test ! -f "$file"; then
2222         $echo "$modename: \`$file' is not a file" 1>&2
2223         $echo "$help" 1>&2
2224         exit 1
2225       fi
2226
2227       dir=
2228       case "$file" in
2229       *.la)
2230         # Check to see that this really is a libtool archive.
2231         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2232         else
2233           $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2234           $echo "$help" 1>&2
2235           exit 1
2236         fi
2237
2238         # Read the libtool library.
2239         dlname=
2240         library_names=
2241
2242         # If there is no directory component, then add one.
2243         case "$file" in
2244         */* | *\\*) . $file ;;
2245         *) . ./$file ;;
2246         esac
2247
2248         # Skip this library if it cannot be dlopened.
2249         if test -z "$dlname"; then
2250           # Warn if it was a shared library.
2251           test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
2252           continue
2253         fi
2254
2255         dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2256         test "X$dir" = "X$file" && dir=.
2257
2258         if test -f "$dir/$objdir/$dlname"; then
2259           dir="$dir/$objdir"
2260         else
2261           $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
2262           exit 1
2263         fi
2264         ;;
2265
2266       *.lo)
2267         # Just add the directory containing the .lo file.
2268         dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2269         test "X$dir" = "X$file" && dir=.
2270         ;;
2271
2272       *)
2273         $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
2274         continue
2275         ;;
2276       esac
2277
2278       # Get the absolute pathname.
2279       absdir=`cd "$dir" && pwd`
2280       test -n "$absdir" && dir="$absdir"
2281
2282       # Now add the directory to shlibpath_var.
2283       if eval "test -z \"\$$shlibpath_var\""; then
2284         eval "$shlibpath_var=\"\$dir\""
2285       else
2286         eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2287       fi
2288     done
2289
2290     # This variable tells wrapper scripts just to set shlibpath_var
2291     # rather than running their programs.
2292     libtool_execute_magic="$magic"
2293
2294     # Check if any of the arguments is a wrapper script.
2295     args=
2296     for file
2297     do
2298       case "$file" in
2299       -*) ;;
2300       *)
2301         # Do a test to see if this is really a libtool program.
2302         if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2303           # If there is no directory component, then add one.
2304           case "$file" in
2305           */* | *\\*) . $file ;;
2306           *) . ./$file ;;
2307           esac
2308
2309           # Transform arg to wrapped name.
2310           file="$progdir/$program"
2311         fi
2312         ;;
2313       esac
2314       # Quote arguments (to preserve shell metacharacters).
2315       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
2316       args="$args \"$file\""
2317     done
2318
2319     if test -z "$run"; then
2320       # Export the shlibpath_var.
2321       eval "export $shlibpath_var"
2322
2323       # Restore saved enviroment variables
2324       if test "${save_LC_ALL+set}" = set; then
2325         LC_ALL="$save_LC_ALL"; export LC_ALL
2326       fi
2327       if test "${save_LANG+set}" = set; then
2328         LANG="$save_LANG"; export LANG
2329       fi
2330
2331       # Now actually exec the command.
2332       eval "exec \$cmd$args"
2333
2334       $echo "$modename: cannot exec \$cmd$args"
2335       exit 1
2336     else
2337       # Display what would be done.
2338       eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
2339       $echo "export $shlibpath_var"
2340       $echo "$cmd$args"
2341       exit 0
2342     fi
2343     ;;
2344
2345   # libtool uninstall mode
2346   uninstall)
2347     modename="$modename: uninstall"
2348     rm="$nonopt"
2349     files=
2350
2351     for arg
2352     do
2353       case "$arg" in
2354       -*) rm="$rm $arg" ;;
2355       *) files="$files $arg" ;;
2356       esac
2357     done
2358
2359     if test -z "$rm"; then
2360       $echo "$modename: you must specify an RM program" 1>&2
2361       $echo "$help" 1>&2
2362       exit 1
2363     fi
2364
2365     for file in $files; do
2366       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2367       test "X$dir" = "X$file" && dir=.
2368       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2369
2370       rmfiles="$file"
2371
2372       case "$name" in
2373       *.la)
2374         # Possibly a libtool archive, so verify it.
2375         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2376           . $dir/$name
2377
2378           # Delete the libtool libraries and symlinks.
2379           for n in $library_names; do
2380             rmfiles="$rmfiles $dir/$n"
2381             test "X$n" = "X$dlname" && dlname=
2382           done
2383           test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
2384           test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
2385
2386           $show "$rm $rmfiles"
2387           $run $rm $rmfiles
2388
2389           if test -n "$library_names"; then
2390             # Do each command in the postuninstall commands.
2391             eval cmds=\"$postuninstall_cmds\"
2392             IFS="${IFS=         }"; save_ifs="$IFS"; IFS=';'
2393             for cmd in $cmds; do
2394               IFS="$save_ifs"
2395               $show "$cmd"
2396               $run eval "$cmd"
2397             done
2398             IFS="$save_ifs"
2399           fi
2400
2401           if test -n "$old_library"; then
2402             # Do each command in the old_postuninstall commands.
2403             eval cmds=\"$old_postuninstall_cmds\"
2404             IFS="${IFS=         }"; save_ifs="$IFS"; IFS=';'
2405             for cmd in $cmds; do
2406               IFS="$save_ifs"
2407               $show "$cmd"
2408               $run eval "$cmd"
2409             done
2410             IFS="$save_ifs"
2411           fi
2412
2413           # FIXME: should reinstall the best remaining shared library.
2414         fi
2415         ;;
2416
2417       *.lo)
2418         if test "$build_old_libs" = yes; then
2419           oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/.o/'`
2420           rmfiles="$rmfiles $dir/$oldobj"
2421         fi
2422         $show "$rm $rmfiles"
2423         $run $rm $rmfiles
2424         ;;
2425
2426       *)
2427         $show "$rm $rmfiles"
2428         $run $rm $rmfiles
2429         ;;
2430       esac
2431     done
2432     exit 0
2433     ;;
2434
2435   "")
2436     $echo "$modename: you must specify a MODE" 1>&2
2437     $echo "$generic_help" 1>&2
2438     exit 1
2439     ;;
2440   esac
2441
2442   $echo "$modename: invalid operation mode \`$mode'" 1>&2
2443   $echo "$generic_help" 1>&2
2444   exit 1
2445 fi # test -z "$show_help"
2446
2447 # We need to display help for each of the modes.
2448 case "$mode" in
2449 "") $echo \
2450 "Usage: $modename [OPTION]... [MODE-ARG]...
2451
2452 Provide generalized library-building support services.
2453
2454     --config          show all configuration variables
2455     --debug           enable verbose shell tracing
2456 -n, --dry-run         display commands without modifying any files
2457     --features        display basic configuration information and exit
2458     --finish          same as \`--mode=finish'
2459     --help            display this help message and exit
2460     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
2461     --quiet           same as \`--silent'
2462     --silent          don't print informational messages
2463     --version         print version information
2464
2465 MODE must be one of the following:
2466
2467       compile         compile a source file into a libtool object
2468       execute         automatically set library path, then run a program
2469       finish          complete the installation of libtool libraries
2470       install         install libraries or executables
2471       link            create a library or an executable
2472       uninstall       remove libraries from an installed directory
2473
2474 MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
2475 a more detailed description of MODE."
2476   exit 0
2477   ;;
2478
2479 compile)
2480   $echo \
2481 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2482
2483 Compile a source file into a libtool library object.
2484
2485 This mode accepts the following additional options:
2486
2487   -static           always build a \`.o' file suitable for static linking
2488
2489 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2490 from the given SOURCEFILE.
2491
2492 The output file name is determined by removing the directory component from
2493 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2494 library object suffix, \`.lo'."
2495   ;;
2496
2497 execute)
2498   $echo \
2499 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
2500
2501 Automatically set library path, then run a program.
2502
2503 This mode accepts the following additional options:
2504
2505   -dlopen FILE      add the directory containing FILE to the library path
2506
2507 This mode sets the library path environment variable according to \`-dlopen'
2508 flags.
2509
2510 If any of the ARGS are libtool executable wrappers, then they are translated
2511 into their corresponding uninstalled binary, and any of their required library
2512 directories are added to the library path.
2513
2514 Then, COMMAND is executed, with ARGS as arguments."
2515   ;;
2516
2517 finish)
2518   $echo \
2519 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
2520
2521 Complete the installation of libtool libraries.
2522
2523 Each LIBDIR is a directory that contains libtool libraries.
2524
2525 The commands that this mode executes may require superuser privileges.  Use
2526 the \`--dry-run' option if you just want to see what would be executed."
2527   ;;
2528
2529 install)
2530   $echo \
2531 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
2532
2533 Install executables or libraries.
2534
2535 INSTALL-COMMAND is the installation command.  The first component should be
2536 either the \`install' or \`cp' program.
2537
2538 The rest of the components are interpreted as arguments to that command (only
2539 BSD-compatible install options are recognized)."
2540   ;;
2541
2542 link)
2543   $echo \
2544 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
2545
2546 Link object files or libraries together to form another library, or to
2547 create an executable program.
2548
2549 LINK-COMMAND is a command using the C compiler that you would use to create
2550 a program from several object files.
2551
2552 The following components of LINK-COMMAND are treated specially:
2553
2554   -all-static       do not do any dynamic linking at all
2555   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
2556   -dlpreopen FILE   link in FILE and add its symbols to dld_preloaded_symbols
2557   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2558   -LLIBDIR          search LIBDIR for required installed libraries
2559   -lNAME            OUTPUT-FILE requires the installed library libNAME
2560   -no-undefined     declare that a library does not refer to external symbols
2561   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
2562   -release RELEASE  specify package release information
2563   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
2564   -static           do not do any dynamic linking of libtool libraries
2565   -version-info CURRENT[:REVISION[:AGE]]
2566                     specify library version info [each variable defaults to 0]
2567
2568 All other options (arguments beginning with \`-') are ignored.
2569
2570 Every other argument is treated as a filename.  Files ending in \`.la' are
2571 treated as uninstalled libtool libraries, other files are standard or library
2572 object files.
2573
2574 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
2575 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
2576
2577 If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
2578 and \`ranlib'.
2579
2580 If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
2581 created, otherwise an executable program is created."
2582   ;;
2583
2584 uninstall)
2585   $echo
2586 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2587
2588 Remove libraries from an installation directory.
2589
2590 RM is the name of the program to use to delete files associated with each FILE
2591 (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
2592 to RM.
2593
2594 If FILE is a libtool library, all the files associated with it are deleted.
2595 Otherwise, only FILE itself is deleted using RM."
2596   ;;
2597
2598 *)
2599   $echo "$modename: invalid operation mode \`$mode'" 1>&2
2600   $echo "$help" 1>&2
2601   exit 1
2602   ;;
2603 esac
2604
2605 echo
2606 $echo "Try \`$modename --help' for more information about other modes."
2607
2608 exit 0
2609
2610 # Local Variables:
2611 # mode:shell-script
2612 # sh-indentation:2
2613 # End: