]> git.sur5r.net Git - openldap/blob - build/ltmain.sh
Added dnPretty2/dnNormalize2 using preallocated destination berval
[openldap] / build / ltmain.sh
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
3
4 # $OpenLDAP$
5 #
6 # Copyright (C) 1996-1999 Free Software Foundation, Inc.
7 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #
23 # As a special exception to the GNU General Public License, if you
24 # distribute this file as part of a program that contains a
25 # configuration script generated by Autoconf, you may include it under
26 # the same distribution terms that you use for the rest of that program.
27
28 # Portions Copyright 1998-2001 OpenLDAP Foundation.
29 # This file is distributed with OpenLDAP Software, which contains a
30 # configuration script generated by autoconf and is distributable
31 # under the same distributions terms as OpenLDAP inself.
32 # See the OpenLDAP COPYRIGHT and LICENSE file for details.
33
34 # Check that we have a working $echo.
35 if test "X$1" = X--no-reexec; then
36   # Discard the --no-reexec flag, and continue.
37   shift
38 elif test "X$1" = X--fallback-echo; then
39   # Avoid inline document here, it may be left over
40   :
41 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
42   # Yippee, $echo works!
43   :
44 else
45   # Restart under the correct shell, and then maybe $echo will work.
46   exec $SHELL "$0" --no-reexec ${1+"$@"}
47 fi
48
49 if test "X$1" = X--fallback-echo; then
50   # used as fallback echo
51   shift
52   cat <<EOF
53 $*
54 EOF
55   exit 0
56 fi
57
58 # The name of this program.
59 progname=`$echo "$0" | sed 's%^.*/%%'`
60 modename="$progname"
61
62 # Constants.
63 PROGRAM=ltmain.sh
64 PACKAGE=libtool
65 VERSION=1.3.5+OpenLDAP
66 TIMESTAMP=" (1.385.2.206 2000/10/02 14:18:00)"
67
68 default_mode=
69 help="Try \`$progname --help' for more information."
70 magic="%%%MAGIC variable%%%"
71 mkdir="mkdir"
72 mv="mv -f"
73 rm="rm -f"
74
75 # Sed substitution that helps us do robust quoting.  It backslashifies
76 # metacharacters that are still active within double-quoted strings.
77 Xsed='sed -e 1s/^X//'
78 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
79 SP2NL='tr \040 \012'
80 NL2SP='tr \015\012 \040\040'
81
82 # NLS nuisances.
83 # Only set LANG and LC_ALL to C if already set.
84 # These must not be set unconditionally because not all systems understand
85 # e.g. LANG=C (notably SCO).
86 # We save the old values to restore during execute mode.
87 if test "${LC_ALL+set}" = set; then
88   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
89 fi
90 if test "${LANG+set}" = set; then
91   save_LANG="$LANG"; LANG=C; export LANG
92 fi
93
94 if test "$LTCONFIG_VERSION" != "$VERSION"; then
95   echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
96   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
97   exit 1
98 fi
99
100 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
101   echo "$modename: not configured to build any kind of library" 1>&2
102   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
103   exit 1
104 fi
105
106 # Global variables.
107 mode=$default_mode
108 nonopt=
109 prev=
110 prevopt=
111 run=
112 show="$echo"
113 show_help=
114 execute_dlfiles=
115 lo2o="s/\\.lo\$/.${objext}/"
116 o2lo="s/\\.${objext}\$/.lo/"
117
118 # Parse our command line options once, thoroughly.
119 while test $# -gt 0
120 do
121   arg="$1"
122   shift
123
124   case "$arg" in
125   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
126   *) optarg= ;;
127   esac
128
129   # If the previous option needs an argument, assign it.
130   if test -n "$prev"; then
131     case "$prev" in
132     execute_dlfiles)
133       eval "$prev=\"\$$prev \$arg\""
134       ;;
135     *)
136       eval "$prev=\$arg"
137       ;;
138     esac
139
140     prev=
141     prevopt=
142     continue
143   fi
144
145   # Have we seen a non-optional argument yet?
146   case "$arg" in
147   --help)
148     show_help=yes
149     ;;
150
151   --version)
152     echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
153     exit 0
154     ;;
155
156   --config)
157     sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
158     exit 0
159     ;;
160
161   --debug)
162     echo "$progname: enabling shell trace mode"
163     set -x
164     ;;
165
166   --dry-run | -n)
167     run=:
168     ;;
169
170   --features)
171     echo "host: $host"
172     if test "$build_libtool_libs" = yes; then
173       echo "enable shared libraries"
174     else
175       echo "disable shared libraries"
176     fi
177     if test "$build_old_libs" = yes; then
178       echo "enable static libraries"
179     else
180       echo "disable static libraries"
181     fi
182     exit 0
183     ;;
184
185   --finish) mode="finish" ;;
186
187   --mode) prevopt="--mode" prev=mode ;;
188   --mode=*) mode="$optarg" ;;
189
190   --only-shared)
191     build_libtool_libs=yes
192     build_old_libs=no
193     ;;
194
195   --only-static)
196     build_libtool_libs=no
197     build_old_libs=yes
198     ;;
199
200   --quiet | --silent)
201     show=:
202     ;;
203
204   -dlopen)
205     prevopt="-dlopen"
206     prev=execute_dlfiles
207     ;;
208
209   -*)
210     $echo "$modename: unrecognized option \`$arg'" 1>&2
211     $echo "$help" 1>&2
212     exit 1
213     ;;
214
215   *)
216     nonopt="$arg"
217     break
218     ;;
219   esac
220 done
221
222 if test -n "$prevopt"; then
223   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
224   $echo "$help" 1>&2
225   exit 1
226 fi
227
228 if test -z "$show_help"; then
229
230   # Infer the operation mode.
231   if test -z "$mode"; then
232     case "$nonopt" in
233     *cc | *++ | gcc* | *-gcc*)
234       mode=link
235       for arg
236       do
237         case "$arg" in
238         -c)
239            mode=compile
240            break
241            ;;
242         esac
243       done
244       ;;
245     *db | *dbx | *strace | *truss)
246       mode=execute
247       ;;
248     *install*|cp|mv)
249       mode=install
250       ;;
251     *rm)
252       mode=uninstall
253       ;;
254     *)
255       # If we have no mode, but dlfiles were specified, then do execute mode.
256       test -n "$execute_dlfiles" && mode=execute
257
258       # Just use the default operation mode.
259       if test -z "$mode"; then
260         if test -n "$nonopt"; then
261           $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
262         else
263           $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
264         fi
265       fi
266       ;;
267     esac
268   fi
269
270   # Only execute mode is allowed to have -dlopen flags.
271   if test -n "$execute_dlfiles" && test "$mode" != execute; then
272     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
273     $echo "$help" 1>&2
274     exit 1
275   fi
276
277   # Change the help message to a mode-specific one.
278   generic_help="$help"
279   help="Try \`$modename --help --mode=$mode' for more information."
280
281   # These modes are in order of execution frequency so that they run quickly.
282   case "$mode" in
283   # libtool compile mode
284   compile)
285     modename="$modename: compile"
286     # Get the compilation command and the source file.
287     base_compile=
288     lastarg=
289     srcfile="$nonopt"
290     suppress_output=
291
292     user_target=no
293     for arg
294     do
295       # Accept any command-line options.
296       case "$arg" in
297       -o)
298         if test "$user_target" != "no"; then
299           $echo "$modename: you cannot specify \`-o' more than once" 1>&2
300           exit 1
301         fi
302         user_target=next
303         ;;
304
305       -static)
306         build_old_libs=yes
307         continue
308         ;;
309       esac
310
311       case "$user_target" in
312       next)
313         # The next one is the -o target name
314         user_target=yes
315         continue
316         ;;
317       yes)
318         # We got the output file
319         user_target=set
320         libobj="$arg"
321         continue
322         ;;
323       esac
324
325       # Accept the current argument as the source file.
326       lastarg="$srcfile"
327       srcfile="$arg"
328
329       # Aesthetically quote the previous argument.
330
331       # Backslashify any backslashes, double quotes, and dollar signs.
332       # These are the only characters that are still specially
333       # interpreted inside of double-quoted scrings.
334       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
335
336       # Double-quote args containing other shell metacharacters.
337       # Many Bourne shells cannot handle close brackets correctly in scan
338       # sets, so we specify it separately.
339       case "$lastarg" in
340       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
341         lastarg="\"$lastarg\""
342         ;;
343       esac
344
345       # Add the previous argument to base_compile.
346       if test -z "$base_compile"; then
347         base_compile="$lastarg"
348       else
349         base_compile="$base_compile $lastarg"
350       fi
351     done
352
353     case "$user_target" in
354     set)
355       ;;
356     no)
357       # Get the name of the library object.
358       libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
359       ;;
360     *)
361       $echo "$modename: you must specify a target with \`-o'" 1>&2
362       exit 1
363       ;;
364     esac
365
366     # Recognize several different file suffixes.
367     # If the user specifies -o file.o, it is replaced with file.lo
368     xform='[cCFSfmso]'
369     case "$libobj" in
370     *.ada) xform=ada ;;
371     *.adb) xform=adb ;;
372     *.ads) xform=ads ;;
373     *.asm) xform=asm ;;
374     *.c++) xform=c++ ;;
375     *.cc) xform=cc ;;
376     *.cpp) xform=cpp ;;
377     *.cxx) xform=cxx ;;
378     *.f90) xform=f90 ;;
379     *.for) xform=for ;;
380     esac
381
382     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
383
384     case "$libobj" in
385     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
386     *)
387       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
388       exit 1
389       ;;
390     esac
391
392     if test -z "$base_compile"; then
393       $echo "$modename: you must specify a compilation command" 1>&2
394       $echo "$help" 1>&2
395       exit 1
396     fi
397
398     # Delete any leftover library objects.
399     if test "$build_old_libs" = yes; then
400       removelist="$obj $libobj"
401     else
402       removelist="$libobj"
403     fi
404
405     $run $rm $removelist
406     trap "$run $rm $removelist; exit 1" 1 2 15
407
408     # Calculate the filename of the output object if compiler does
409     # not support -o with -c
410     if test "$compiler_c_o" = no; then
411       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
412       lockfile="$output_obj.lock"
413       removelist="$removelist $output_obj $lockfile"
414       trap "$run $rm $removelist; exit 1" 1 2 15
415     else
416       need_locks=no
417       lockfile=
418     fi
419
420     # Lock this critical section if it is needed
421     # We use this script file to make the link, it avoids creating a new file
422     if test "$need_locks" = yes; then
423       until ln "$0" "$lockfile" 2>/dev/null; do
424         $show "Waiting for $lockfile to be removed"
425         sleep 2
426       done
427     elif test "$need_locks" = warn; then
428       if test -f "$lockfile"; then
429         echo "\
430 *** ERROR, $lockfile exists and contains:
431 `cat $lockfile 2>/dev/null`
432
433 This indicates that another process is trying to use the same
434 temporary object file, and libtool could not work around it because
435 your compiler does not support \`-c' and \`-o' together.  If you
436 repeat this compilation, it may succeed, by chance, but you had better
437 avoid parallel builds (make -j) in this platform, or get a better
438 compiler."
439
440         $run $rm $removelist
441         exit 1
442       fi
443       echo $srcfile > "$lockfile"
444     fi
445
446     if test -n "$fix_srcfile_path"; then
447       eval srcfile=\"$fix_srcfile_path\"
448     fi
449
450     # Only build a PIC object if we are building libtool libraries.
451     if test "$build_libtool_libs" = yes; then
452       # Without this assignment, base_compile gets emptied.
453       fbsd_hideous_sh_bug=$base_compile
454
455       # All platforms use -DPIC, to notify preprocessed assembler code.
456       command="$base_compile $srcfile $pic_flag -DPIC"
457       if test "$build_old_libs" = yes; then
458         lo_libobj="$libobj"
459         dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
460         if test "X$dir" = "X$libobj"; then
461           dir="$objdir"
462         else
463           dir="$dir/$objdir"
464         fi
465         libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
466
467         if test -d "$dir"; then
468           $show "$rm $libobj"
469           $run $rm $libobj
470         else
471           $show "$mkdir $dir"
472           $run $mkdir $dir
473           status=$?
474           if test $status -ne 0 && test ! -d $dir; then
475             exit $status
476           fi
477         fi
478       fi
479       if test "$compiler_o_lo" = yes; then
480         output_obj="$libobj"
481         command="$command -o $output_obj"
482       elif test "$compiler_c_o" = yes; then
483         output_obj="$obj"
484         command="$command -o $output_obj"
485       fi
486
487       $run $rm "$output_obj"
488       $show "$command"
489       if $run eval "$command"; then :
490       else
491         test -n "$output_obj" && $run $rm $removelist
492         exit 1
493       fi
494
495       if test "$need_locks" = warn &&
496          test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
497         echo "\
498 *** ERROR, $lockfile contains:
499 `cat $lockfile 2>/dev/null`
500
501 but it should contain:
502 $srcfile
503
504 This indicates that another process is trying to use the same
505 temporary object file, and libtool could not work around it because
506 your compiler does not support \`-c' and \`-o' together.  If you
507 repeat this compilation, it may succeed, by chance, but you had better
508 avoid parallel builds (make -j) in this platform, or get a better
509 compiler."
510
511         $run $rm $removelist
512         exit 1
513       fi
514
515       # Just move the object if needed, then go on to compile the next one
516       if test x"$output_obj" != x"$libobj"; then
517         $show "$mv $output_obj $libobj"
518         if $run $mv $output_obj $libobj; then :
519         else
520           error=$?
521           $run $rm $removelist
522           exit $error
523         fi
524       fi
525
526       # If we have no pic_flag, then copy the object into place and finish.
527       if test -z "$pic_flag" && test "$build_old_libs" = yes; then
528         # Rename the .lo from within objdir to obj
529         if test -f $obj; then
530           $show $rm $obj
531           $run $rm $obj
532         fi
533
534         $show "$mv $libobj $obj"
535         if $run $mv $libobj $obj; then :
536         else
537           error=$?
538           $run $rm $removelist
539           exit $error
540         fi
541
542         xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
543         if test "X$xdir" = "X$obj"; then
544           xdir="."
545         else
546           xdir="$xdir"
547         fi
548         baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
549         libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
550         # Now arrange that obj and lo_libobj become the same file
551         $show "(cd $xdir && $LN_S $baseobj $libobj)"
552         if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
553           exit 0
554         else
555           error=$?
556           $run $rm $removelist
557           exit $error
558         fi
559       fi
560
561       # Allow error messages only from the first compilation.
562       suppress_output=' >/dev/null 2>&1'
563     fi
564
565     # Only build a position-dependent object if we build old libraries.
566     if test "$build_old_libs" = yes; then
567       command="$base_compile $srcfile"
568       if test "$compiler_c_o" = yes; then
569         command="$command -o $obj"
570         output_obj="$obj"
571       fi
572
573       # Suppress compiler output if we already did a PIC compilation.
574       command="$command$suppress_output"
575       $run $rm "$output_obj"
576       $show "$command"
577       if $run eval "$command"; then :
578       else
579         $run $rm $removelist
580         exit 1
581       fi
582
583       if test "$need_locks" = warn &&
584          test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
585         echo "\
586 *** ERROR, $lockfile contains:
587 `cat $lockfile 2>/dev/null`
588
589 but it should contain:
590 $srcfile
591
592 This indicates that another process is trying to use the same
593 temporary object file, and libtool could not work around it because
594 your compiler does not support \`-c' and \`-o' together.  If you
595 repeat this compilation, it may succeed, by chance, but you had better
596 avoid parallel builds (make -j) in this platform, or get a better
597 compiler."
598
599         $run $rm $removelist
600         exit 1
601       fi
602
603       # Just move the object if needed
604       if test x"$output_obj" != x"$obj"; then
605         $show "$mv $output_obj $obj"
606         if $run $mv $output_obj $obj; then :
607         else
608           error=$?
609           $run $rm $removelist
610           exit $error
611         fi
612       fi
613
614       # Create an invalid libtool object if no PIC, so that we do not
615       # accidentally link it into a program.
616       if test "$build_libtool_libs" != yes; then
617         $show "echo timestamp > $libobj"
618         $run eval "echo timestamp > \$libobj" || exit $?
619       else
620         # Move the .lo from within objdir
621         $show "$mv $libobj $lo_libobj"
622         if $run $mv $libobj $lo_libobj; then :
623         else
624           error=$?
625           $run $rm $removelist
626           exit $error
627         fi
628       fi
629     fi
630
631     # Unlock the critical section if it was locked
632     if test "$need_locks" != no; then
633       $rm "$lockfile"
634     fi
635
636     exit 0
637     ;;
638
639   # libtool link mode
640   link)
641     modename="$modename: link"
642     case "$host" in
643     *-*-cygwin* | *-*-mingw* | *-*-os2*)
644       # It is impossible to link a dll without this setting, and
645       # we shouldn't force the makefile maintainer to figure out
646       # which system we are compiling for in order to pass an extra
647       # flag for every libtool invokation.
648       # allow_undefined=no
649
650       # FIXME: Unfortunately, there are problems with the above when trying
651       # to make a dll which has undefined symbols, in which case not
652       # even a static library is built.  For now, we need to specify
653       # -no-undefined on the libtool link line when we can be certain
654       # that all symbols are satisfied, otherwise we get a static library.
655       allow_undefined=yes
656
657       # This is a source program that is used to create dlls on Windows
658       # Don't remove nor modify the starting and closing comments
659 # /* ltdll.c starts here */
660 # #define WIN32_LEAN_AND_MEAN
661 # #include <windows.h>
662 # #undef WIN32_LEAN_AND_MEAN
663 # #include <stdio.h>
664 #
665 # #ifndef __CYGWIN__
666 # #  ifdef __CYGWIN32__
667 # #    define __CYGWIN__ __CYGWIN32__
668 # #  endif
669 # #endif
670 #
671 # #ifdef __cplusplus
672 # extern "C" {
673 # #endif
674 # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
675 # #ifdef __cplusplus
676 # }
677 # #endif
678 #
679 # #ifdef __CYGWIN__
680 # #include <cygwin/cygwin_dll.h>
681 # DECLARE_CYGWIN_DLL( DllMain );
682 # #endif
683 # HINSTANCE __hDllInstance_base;
684 #
685 # BOOL APIENTRY
686 # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
687 # {
688 #   __hDllInstance_base = hInst;
689 #   return TRUE;
690 # }
691 # /* ltdll.c ends here */
692       # This is a source program that is used to create import libraries
693       # on Windows for dlls which lack them. Don't remove nor modify the
694       # starting and closing comments
695 # /* impgen.c starts here */
696 # /*   Copyright (C) 1999 Free Software Foundation, Inc.
697
698 #  This file is part of GNU libtool.
699
700 #  This program is free software; you can redistribute it and/or modify
701 #  it under the terms of the GNU General Public License as published by
702 #  the Free Software Foundation; either version 2 of the License, or
703 #  (at your option) any later version.
704
705 #  This program is distributed in the hope that it will be useful,
706 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
707 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
708 #  GNU General Public License for more details.
709
710 #  You should have received a copy of the GNU General Public License
711 #  along with this program; if not, write to the Free Software
712 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
713 #  */
714
715 #  #include <stdio.h>           /* for printf() */
716 #  #include <unistd.h>          /* for open(), lseek(), read() */
717 #  #include <fcntl.h>           /* for O_RDONLY, O_BINARY */
718 #  #include <string.h>          /* for strdup() */
719
720 #  static unsigned int
721 #  pe_get16 (fd, offset)
722 #       int fd;
723 #       int offset;
724 #  {
725 #    unsigned char b[2];
726 #    lseek (fd, offset, SEEK_SET);
727 #    read (fd, b, 2);
728 #    return b[0] + (b[1]<<8);
729 #  }
730
731 #  static unsigned int
732 #  pe_get32 (fd, offset)
733 #      int fd;
734 #      int offset;
735 #  {
736 #    unsigned char b[4];
737 #    lseek (fd, offset, SEEK_SET);
738 #    read (fd, b, 4);
739 #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
740 #  }
741
742 #  static unsigned int
743 #  pe_as32 (ptr)
744 #       void *ptr;
745 #  {
746 #    unsigned char *b = ptr;
747 #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
748 #  }
749
750 #  int
751 #  main (argc, argv)
752 #      int argc;
753 #      char *argv[];
754 #  {
755 #      int dll;
756 #      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
757 #      unsigned long export_rva, export_size, nsections, secptr, expptr;
758 #      unsigned long name_rvas, nexp;
759 #      unsigned char *expdata, *erva;
760 #      char *filename, *dll_name;
761
762 #      filename = argv[1];
763
764 #      dll = open(filename, O_RDONLY|O_BINARY);
765 #      if (!dll)
766 #       return 1;
767
768 #      dll_name = filename;
769 #    
770 #      for (i=0; filename[i]; i++)
771 #       if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
772 #           dll_name = filename + i +1;
773
774 #      pe_header_offset = pe_get32 (dll, 0x3c);
775 #      opthdr_ofs = pe_header_offset + 4 + 20;
776 #      num_entries = pe_get32 (dll, opthdr_ofs + 92);
777
778 #      if (num_entries < 1) /* no exports */
779 #       return 1;
780
781 #      export_rva = pe_get32 (dll, opthdr_ofs + 96);
782 #      export_size = pe_get32 (dll, opthdr_ofs + 100);
783 #      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
784 #      secptr = (pe_header_offset + 4 + 20 +
785 #             pe_get16 (dll, pe_header_offset + 4 + 16));
786
787 #      expptr = 0;
788 #      for (i = 0; i < nsections; i++)
789 #      {
790 #       char sname[8];
791 #       unsigned long secptr1 = secptr + 40 * i;
792 #       unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
793 #       unsigned long vsize = pe_get32 (dll, secptr1 + 16);
794 #       unsigned long fptr = pe_get32 (dll, secptr1 + 20);
795 #       lseek(dll, secptr1, SEEK_SET);
796 #       read(dll, sname, 8);
797 #       if (vaddr <= export_rva && vaddr+vsize > export_rva)
798 #       {
799 #           expptr = fptr + (export_rva - vaddr);
800 #           if (export_rva + export_size > vaddr + vsize)
801 #               export_size = vsize - (export_rva - vaddr);
802 #           break;
803 #       }
804 #      }
805
806 #      expdata = (unsigned char*)malloc(export_size);
807 #      lseek (dll, expptr, SEEK_SET);
808 #      read (dll, expdata, export_size);
809 #      erva = expdata - export_rva;
810
811 #      nexp = pe_as32 (expdata+24);
812 #      name_rvas = pe_as32 (expdata+32);
813
814 #      printf ("EXPORTS\n");
815 #      for (i = 0; i<nexp; i++)
816 #      {
817 #       unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
818 #       printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
819 #      }
820
821 #      return 0;
822 #  }
823 # /* impgen.c ends here */
824       ;;
825     *)
826       allow_undefined=yes
827       ;;
828     esac
829     compile_command="$nonopt"
830     finalize_command="$nonopt"
831
832     compile_rpath=
833     finalize_rpath=
834     compile_shlibpath=
835     finalize_shlibpath=
836     convenience=
837     old_convenience=
838     deplibs=
839     linkopts=
840
841     if test -n "$shlibpath_var"; then
842       # get the directories listed in $shlibpath_var
843       eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
844     else
845       lib_search_path=
846     fi
847     # now prepend the system-specific ones
848     eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
849     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
850     
851     avoid_version=no
852     dlfiles=
853     dlprefiles=
854     dlself=no
855     export_dynamic=no
856     export_symbols=
857     export_symbols_regex=
858     generated=
859     libobjs=
860     link_against_libtool_libs=
861     ltlibs=
862     module=no
863     objs=
864     prefer_static_libs=no
865     preload=no
866     prev=
867     prevarg=
868     release=
869     rpath=
870     xrpath=
871     perm_rpath=
872     temp_rpath=
873     thread_safe=no
874     vinfo=
875
876     # We need to know -static, to get the right output filenames.
877     for arg
878     do
879       case "$arg" in
880       -all-static | -static)
881         if test "X$arg" = "X-all-static"; then
882           if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
883             $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
884           fi
885           if test -n "$link_static_flag"; then
886             dlopen_self=$dlopen_self_static
887           fi
888         else
889           if test -z "$pic_flag" && test -n "$link_static_flag"; then
890             dlopen_self=$dlopen_self_static
891           fi
892         fi
893         build_libtool_libs=no
894         build_old_libs=yes
895         prefer_static_libs=yes
896         break
897         ;;
898       esac
899     done
900
901     # See if our shared archives depend on static archives.
902     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
903
904     # Go through the arguments, transforming them on the way.
905     while test $# -gt 0; do
906       arg="$1"
907       shift
908
909       # If the previous option needs an argument, assign it.
910       if test -n "$prev"; then
911         case "$prev" in
912         output)
913           compile_command="$compile_command @OUTPUT@"
914           finalize_command="$finalize_command @OUTPUT@"
915           ;;
916         esac
917
918         case "$prev" in
919         dlfiles|dlprefiles)
920           if test "$preload" = no; then
921             # Add the symbol object into the linking commands.
922             compile_command="$compile_command @SYMFILE@"
923             finalize_command="$finalize_command @SYMFILE@"
924             preload=yes
925           fi
926           case "$arg" in
927           *.la | *.lo) ;;  # We handle these cases below.
928           force)
929             if test "$dlself" = no; then
930               dlself=needless
931               export_dynamic=yes
932             fi
933             prev=
934             continue
935             ;;
936           self)
937             if test "$prev" = dlprefiles; then
938               dlself=yes
939             elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
940               dlself=yes
941             else
942               dlself=needless
943               export_dynamic=yes
944             fi
945             prev=
946             continue
947             ;;
948           *)
949             if test "$prev" = dlfiles; then
950               dlfiles="$dlfiles $arg"
951             else
952               dlprefiles="$dlprefiles $arg"
953             fi
954             prev=
955             ;;
956           esac
957           ;;
958         expsyms)
959           export_symbols="$arg"
960           if test ! -f "$arg"; then
961             $echo "$modename: symbol file \`$arg' does not exist"
962             exit 1
963           fi
964           prev=
965           continue
966           ;;
967         expsyms_regex)
968           export_symbols_regex="$arg"
969           prev=
970           continue
971           ;;
972         release)
973           release="-$arg"
974           prev=
975           continue
976           ;;
977         rpath | xrpath)
978           # We need an absolute path.
979           case "$arg" in
980           [\\/]* | [A-Za-z]:[\\/]*) ;;
981           *)
982             $echo "$modename: only absolute run-paths are allowed" 1>&2
983             exit 1
984             ;;
985           esac
986           if test "$prev" = rpath; then
987             case "$rpath " in
988             *" $arg "*) ;;
989             *) rpath="$rpath $arg" ;;
990             esac
991           else
992             case "$xrpath " in
993             *" $arg "*) ;;
994             *) xrpath="$xrpath $arg" ;;
995             esac
996           fi
997           prev=
998           continue
999           ;;
1000         *)
1001           eval "$prev=\"\$arg\""
1002           prev=
1003           continue
1004           ;;
1005         esac
1006       fi
1007
1008       prevarg="$arg"
1009
1010       case "$arg" in
1011       -all-static)
1012         if test -n "$link_static_flag"; then
1013           compile_command="$compile_command $link_static_flag"
1014           finalize_command="$finalize_command $link_static_flag"
1015         fi
1016         continue
1017         ;;
1018
1019       -allow-undefined)
1020         # FIXME: remove this flag sometime in the future.
1021         $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1022         continue
1023         ;;
1024
1025       -avoid-version)
1026         avoid_version=yes
1027         continue
1028         ;;
1029
1030       -dlopen)
1031         prev=dlfiles
1032         continue
1033         ;;
1034
1035       -dlpreopen)
1036         prev=dlprefiles
1037         continue
1038         ;;
1039
1040       -export-dynamic)
1041         export_dynamic=yes
1042         continue
1043         ;;
1044
1045       -export-symbols | -export-symbols-regex)
1046         if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1047           $echo "$modename: not more than one -exported-symbols argument allowed"
1048           exit 1
1049         fi
1050         if test "X$arg" = "X-export-symbols"; then
1051           prev=expsyms
1052         else
1053           prev=expsyms_regex
1054         fi
1055         continue
1056         ;;
1057
1058       -L*)
1059         dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1060         # We need an absolute path.
1061         case "$dir" in
1062         [\\/]* | [A-Za-z]:[\\/]*) ;;
1063         *)
1064           absdir=`cd "$dir" && pwd`
1065           if test -z "$absdir"; then
1066             $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1067             $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1068             absdir="$dir"
1069           fi
1070           dir="$absdir"
1071           ;;
1072         esac
1073         case " $deplibs " in
1074         *" $arg "*) ;;
1075         *) deplibs="$deplibs $arg";;
1076         esac
1077         case " $lib_search_path " in
1078         *" $dir "*) ;;
1079         *) lib_search_path="$lib_search_path $dir";;
1080         esac
1081         case "$host" in
1082         *-*-cygwin* | *-*-mingw* | *-*-os2*)
1083           dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1084           case ":$dllsearchpath:" in
1085           ::) dllsearchpath="$dllsearchdir";;
1086           *":$dllsearchdir:"*) ;;
1087           *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
1088           esac
1089           ;;
1090         esac
1091         ;;
1092
1093       -l*)
1094         if test "$arg" = "-lc"; then
1095           case "$host" in
1096           *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-aix*)
1097             # These systems don't actually have c library (as such)
1098             continue
1099             ;;
1100           *-*-rhapsody* | *-*-darwin*)
1101             # Darwin C library is in the System framework
1102             deplibs="$deplibs -framework System"
1103             ;;
1104           esac
1105         elif test "$arg" = "-lm"; then
1106           case "$host" in
1107           *-*-cygwin* | *-*-beos*)
1108             # These systems don't actually have math library (as such)
1109             continue
1110             ;;
1111           *-*-rhapsody* | *-*-darwin*)
1112             # Darwin math library is in the System framework
1113             deplibs="$deplibs -framework System"
1114             ;;
1115           esac
1116         fi
1117         deplibs="$deplibs $arg"
1118         ;;
1119
1120       -module)
1121         module=yes
1122         continue
1123         ;;
1124
1125       -no-undefined)
1126         allow_undefined=no
1127         continue
1128         ;;
1129
1130       -o) prev=output ;;
1131
1132       -release)
1133         prev=release
1134         continue
1135         ;;
1136
1137       -rpath)
1138         prev=rpath
1139         continue
1140         ;;
1141
1142       -R)
1143         prev=xrpath
1144         continue
1145         ;;
1146
1147       -R*)
1148         dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1149         # We need an absolute path.
1150         case "$dir" in
1151         [\\/]* | [A-Za-z]:[\\/]*) ;;
1152         *)
1153           $echo "$modename: only absolute run-paths are allowed" 1>&2
1154           exit 1
1155           ;;
1156         esac
1157         case "$xrpath " in
1158         *" $dir "*) ;;
1159         *) xrpath="$xrpath $dir" ;;
1160         esac
1161         continue
1162         ;;
1163
1164       -static)
1165         # If we have no pic_flag, then this is the same as -all-static.
1166         if test -z "$pic_flag" && test -n "$link_static_flag"; then
1167           compile_command="$compile_command $link_static_flag"
1168           finalize_command="$finalize_command $link_static_flag"
1169         fi
1170         continue
1171         ;;
1172
1173       -thread-safe)
1174         thread_safe=yes
1175         continue
1176         ;;
1177
1178       -version-info)
1179         prev=vinfo
1180         continue
1181         ;;
1182
1183       # Some other compiler flag.
1184       -* | +*)
1185         # Unknown arguments in both finalize_command and compile_command need
1186         # to be aesthetically quoted because they are evaled later.
1187         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1188         case "$arg" in
1189         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
1190           arg="\"$arg\""
1191           ;;
1192         esac
1193         ;;
1194
1195       *.o | *.obj | *.a | *.lib)
1196         # A standard object.
1197         objs="$objs $arg"
1198         ;;
1199
1200       *.lo)
1201         # A library object.
1202         if test "$prev" = dlfiles; then
1203           dlfiles="$dlfiles $arg"
1204           if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1205             prev=
1206             continue
1207           else
1208             # If libtool objects are unsupported, then we need to preload.
1209             prev=dlprefiles
1210           fi
1211         fi
1212
1213         if test "$prev" = dlprefiles; then
1214           # Preload the old-style object.
1215           dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1216           prev=
1217         fi
1218         libobjs="$libobjs $arg"
1219         ;;
1220
1221       *.la)
1222         # A libtool-controlled library.
1223
1224         dlname=
1225         libdir=
1226         library_names=
1227         old_library=
1228
1229         # Check to see that this really is a libtool archive.
1230         if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1231         else
1232           $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1233           exit 1
1234         fi
1235
1236         # If the library was installed with an old release of libtool,
1237         # it will not redefine variable installed.
1238         installed=yes
1239
1240         # Read the .la file
1241         # If there is no directory component, then add one.
1242         case "$arg" in
1243         */* | *\\*) . $arg ;;
1244         *) . ./$arg ;;
1245         esac
1246
1247         # Get the name of the library we link against.
1248         linklib=
1249         for l in $old_library $library_names; do
1250           linklib="$l"
1251         done
1252
1253         if test -z "$linklib"; then
1254           $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
1255           exit 1
1256         fi
1257
1258         # Find the relevant object directory and library name.
1259         name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1260
1261         if test "X$installed" = Xyes; then
1262           dir="$libdir"
1263         else
1264           dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1265           if test "X$dir" = "X$arg"; then
1266             dir="$objdir"
1267           else
1268             dir="$dir/$objdir"
1269           fi
1270         fi
1271
1272         if test -n "$dependency_libs"; then
1273           # Extract -R and -L from dependency_libs
1274           temp_deplibs=
1275           for deplib in $dependency_libs; do
1276             case "$deplib" in
1277             -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1278                  case " $rpath $xrpath " in
1279                  *" $temp_xrpath "*) ;;
1280                  *) xrpath="$xrpath $temp_xrpath";;
1281                  esac;;
1282             -L*) case "$compile_command $temp_deplibs " in
1283                  *" $deplib "*) ;;
1284                  *) temp_deplibs="$temp_deplibs $deplib";;
1285                  esac
1286                  temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1287                  case " $lib_search_path " in
1288                  *" $temp_dir "*) ;;
1289                  *) lib_search_path="$lib_search_path $temp_dir";;
1290                  esac
1291                  ;;
1292             *) temp_deplibs="$temp_deplibs $deplib";;
1293             esac
1294           done
1295           dependency_libs="$temp_deplibs"
1296         fi
1297
1298         if test -z "$libdir"; then
1299           # It is a libtool convenience library, so add in its objects.
1300           convenience="$convenience $dir/$old_library"
1301           old_convenience="$old_convenience $dir/$old_library"
1302           deplibs="$deplibs$dependency_libs"
1303           compile_command="$compile_command $dir/$old_library$dependency_libs"
1304           finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1305           continue
1306         fi
1307
1308         # This library was specified with -dlopen.
1309         if test "$prev" = dlfiles; then
1310           dlfiles="$dlfiles $arg"
1311           if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1312             # If there is no dlname, no dlopen support or we're linking statically,
1313             # we need to preload.
1314             prev=dlprefiles
1315           else
1316             # We should not create a dependency on this library, but we
1317             # may need any libraries it requires.
1318             compile_command="$compile_command$dependency_libs"
1319             finalize_command="$finalize_command$dependency_libs"
1320             prev=
1321             continue
1322           fi
1323         fi
1324
1325         # The library was specified with -dlpreopen.
1326         if test "$prev" = dlprefiles; then
1327           # Prefer using a static library (so that no silly _DYNAMIC symbols
1328           # are required to link).
1329           if test -n "$old_library"; then
1330             dlprefiles="$dlprefiles $dir/$old_library"
1331           else
1332             dlprefiles="$dlprefiles $dir/$linklib"
1333           fi
1334           prev=
1335         fi
1336
1337         if test -n "$library_names" &&
1338            { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1339           link_against_libtool_libs="$link_against_libtool_libs $arg"
1340           if test -n "$shlibpath_var"; then
1341             # Make sure the rpath contains only unique directories.
1342             case "$temp_rpath " in
1343             *" $dir "*) ;;
1344             *) temp_rpath="$temp_rpath $dir" ;;
1345             esac
1346           fi
1347
1348           # We need an absolute path.
1349           case "$dir" in
1350           [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1351           *)
1352             absdir=`cd "$dir" && pwd`
1353             if test -z "$absdir"; then
1354               $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1355               $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1356               absdir="$dir"
1357             fi
1358             ;;
1359           esac
1360           
1361           # This is the magic to use -rpath.
1362           # Skip directories that are in the system default run-time
1363           # search path, unless they have been requested with -R.
1364           case " $sys_lib_dlsearch_path " in
1365           *" $absdir "*) ;;
1366           *)
1367             case "$compile_rpath " in
1368             *" $absdir "*) ;;
1369             *) compile_rpath="$compile_rpath $absdir" 
1370             esac
1371             ;;
1372           esac
1373
1374           case " $sys_lib_dlsearch_path " in
1375           *" $libdir "*) ;;
1376           *)
1377             case "$finalize_rpath " in
1378             *" $libdir "*) ;;
1379             *) finalize_rpath="$finalize_rpath $libdir"
1380             esac
1381             ;;
1382           esac
1383
1384           lib_linked=yes
1385           case "$hardcode_action" in
1386           immediate | unsupported)
1387             if test "$hardcode_direct" = no; then
1388               compile_command="$compile_command $dir/$linklib"
1389               deplibs="$deplibs $dir/$linklib"
1390               case "$host" in
1391               *-*-cygwin* | *-*-mingw* | *-*-os2*)
1392                 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1393                 if test -n "$dllsearchpath"; then
1394                   dllsearchpath="$dllsearchpath:$dllsearchdir"
1395                 else
1396                   dllsearchpath="$dllsearchdir"
1397                 fi
1398                 ;;
1399               esac
1400             elif test "$hardcode_minus_L" = no; then
1401               case "$host" in
1402               *-*-sunos*)
1403                 compile_shlibpath="$compile_shlibpath$dir:"
1404                 ;;
1405               esac
1406               case "$compile_command " in
1407               *" -L$dir "*) ;;
1408               *) compile_command="$compile_command -L$dir";;
1409               esac
1410               compile_command="$compile_command -l$name"
1411               deplibs="$deplibs -L$dir -l$name"
1412             elif test "$hardcode_shlibpath_var" = no; then
1413               case ":$compile_shlibpath:" in
1414               *":$dir:"*) ;;
1415               *) compile_shlibpath="$compile_shlibpath$dir:";;
1416               esac
1417               compile_command="$compile_command -l$name"
1418               deplibs="$deplibs -l$name"
1419             else
1420               lib_linked=no
1421             fi
1422             ;;
1423
1424           relink)
1425             if test "$hardcode_direct" = yes; then
1426               compile_command="$compile_command $absdir/$linklib"
1427               deplibs="$deplibs $absdir/$linklib"
1428             elif test "$hardcode_minus_L" = yes; then
1429               case "$compile_command " in
1430               *" -L$absdir "*) ;;
1431               *) compile_command="$compile_command -L$absdir";;
1432               esac
1433               compile_command="$compile_command -l$name"
1434               deplibs="$deplibs -L$absdir -l$name"
1435             elif test "$hardcode_shlibpath_var" = yes; then
1436               case ":$compile_shlibpath:" in
1437               *":$absdir:"*) ;;
1438               *) compile_shlibpath="$compile_shlibpath$absdir:";;
1439               esac
1440               compile_command="$compile_command -l$name"
1441               deplibs="$deplibs -l$name"
1442             else
1443               lib_linked=no
1444             fi
1445             ;;
1446
1447           *)
1448             lib_linked=no
1449             ;;
1450           esac
1451
1452           if test "$lib_linked" != yes; then
1453             $echo "$modename: configuration error: unsupported hardcode properties"
1454             exit 1
1455           fi
1456
1457           # Finalize command for both is simple: just hardcode it.
1458           if test "$hardcode_direct" = yes; then
1459             finalize_command="$finalize_command $libdir/$linklib"
1460           elif test "$hardcode_minus_L" = yes; then
1461             case "$finalize_command " in
1462             *" -L$libdir "*) ;;
1463             *) finalize_command="$finalize_command -L$libdir";;
1464             esac
1465             finalize_command="$finalize_command -l$name"
1466           elif test "$hardcode_shlibpath_var" = yes; then
1467             case ":$finalize_shlibpath:" in
1468             *":$libdir:"*) ;;
1469             *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1470             esac
1471             finalize_command="$finalize_command -l$name"
1472           else
1473             # We cannot seem to hardcode it, guess we'll fake it.
1474             case "$finalize_command " in
1475             *" -L$dir "*) ;;
1476             *) finalize_command="$finalize_command -L$libdir";;
1477             esac
1478             finalize_command="$finalize_command -l$name"
1479           fi
1480         else
1481           # Transform directly to old archives if we don't build new libraries.
1482           if test -n "$pic_flag" && test -z "$old_library"; then
1483             $echo "$modename: cannot find static library for \`$arg'" 1>&2
1484             exit 1
1485           fi
1486
1487           # Here we assume that one of hardcode_direct or hardcode_minus_L
1488           # is not unsupported.  This is valid on all known static and
1489           # shared platforms.
1490           if test "$hardcode_direct" != unsupported; then
1491             test -n "$old_library" && linklib="$old_library"
1492             compile_command="$compile_command $dir/$linklib"
1493             finalize_command="$finalize_command $dir/$linklib"
1494           else
1495             case "$compile_command " in
1496             *" -L$dir "*) ;;
1497             *) compile_command="$compile_command -L$dir";;
1498             esac
1499             compile_command="$compile_command -l$name"
1500             case "$finalize_command " in
1501             *" -L$dir "*) ;;
1502             *) finalize_command="$finalize_command -L$dir";;
1503             esac
1504             finalize_command="$finalize_command -l$name"
1505           fi
1506         fi
1507
1508         # Add in any libraries that this one depends upon.
1509         compile_command="$compile_command$dependency_libs"
1510         finalize_command="$finalize_command$dependency_libs"
1511         continue
1512         ;;
1513
1514       # Some other compiler argument.
1515       *)
1516         # Unknown arguments in both finalize_command and compile_command need
1517         # to be aesthetically quoted because they are evaled later.
1518         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1519         case "$arg" in
1520         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
1521           arg="\"$arg\""
1522           ;;
1523         esac
1524         ;;
1525       esac
1526
1527       # Now actually substitute the argument into the commands.
1528       if test -n "$arg"; then
1529         compile_command="$compile_command $arg"
1530         finalize_command="$finalize_command $arg"
1531       fi
1532     done
1533
1534     if test -n "$prev"; then
1535       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1536       $echo "$help" 1>&2
1537       exit 1
1538     fi
1539
1540     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1541       eval arg=\"$export_dynamic_flag_spec\"
1542       compile_command="$compile_command $arg"
1543       finalize_command="$finalize_command $arg"
1544     fi
1545
1546     oldlibs=
1547     # calculate the name of the file, without its directory
1548     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1549     libobjs_save="$libobjs"
1550
1551     case "$output" in
1552     "")
1553       $echo "$modename: you must specify an output file" 1>&2
1554       $echo "$help" 1>&2
1555       exit 1
1556       ;;
1557
1558     *.a | *.lib)
1559       if test -n "$link_against_libtool_libs"; then
1560         $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1561         exit 1
1562       fi
1563
1564       if test -n "$deplibs"; then
1565         $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1566       fi
1567
1568       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1569         $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1570       fi
1571
1572       if test -n "$rpath"; then
1573         $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
1574       fi
1575
1576       if test -n "$xrpath"; then
1577         $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
1578       fi
1579
1580       if test -n "$vinfo"; then
1581         $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
1582       fi
1583
1584       if test -n "$release"; then
1585         $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
1586       fi
1587
1588       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1589         $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
1590       fi
1591
1592       # Now set the variables for building old libraries.
1593       build_libtool_libs=no
1594       oldlibs="$output"
1595       ;;
1596
1597     *.la)
1598       # Make sure we only generate libraries of the form `libNAME.la'.
1599       case "$outputname" in
1600       lib*)
1601         name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1602         eval libname=\"$libname_spec\"
1603         ;;
1604       *)
1605         if test "$module" = no; then
1606           $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
1607           $echo "$help" 1>&2
1608           exit 1
1609         fi
1610         if test "$need_lib_prefix" != no; then
1611           # Add the "lib" prefix for modules if required
1612           name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1613           eval libname=\"$libname_spec\"
1614         else
1615           libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1616         fi
1617         ;;
1618       esac
1619
1620       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1621       if test "X$output_objdir" = "X$output"; then
1622         output_objdir="$objdir"
1623       else
1624         output_objdir="$output_objdir/$objdir"
1625       fi
1626
1627       if test -n "$objs"; then
1628         $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1629         exit 1
1630       fi
1631
1632       # How the heck are we supposed to write a wrapper for a shared library?
1633       if test -n "$link_against_libtool_libs"; then
1634          $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
1635          exit 1
1636       fi
1637
1638       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1639         $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
1640       fi
1641
1642       set dummy $rpath
1643       if test $# -gt 2; then
1644         $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1645       fi
1646       install_libdir="$2"
1647       if test -n "$hardcode_default_flag"; then
1648         eval linkopts=\"$linkopts$hardcode_default_flag\"
1649       fi
1650
1651       oldlibs=
1652       if test -z "$rpath"; then
1653         if test "$build_libtool_libs" = yes; then
1654           # Building a libtool convenience library.
1655           libext=al
1656           oldlibs="$output_objdir/$libname.$libext $oldlibs"
1657           build_libtool_libs=convenience
1658           build_old_libs=yes
1659         fi
1660         dependency_libs="$deplibs"
1661
1662         if test -n "$vinfo"; then
1663           $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1664         fi
1665
1666         if test -n "$release"; then
1667           $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
1668         fi
1669       else
1670
1671         # Parse the version information argument.
1672         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
1673         set dummy $vinfo 0 0 0
1674         IFS="$save_ifs"
1675
1676         if test -n "$8"; then
1677           $echo "$modename: too many parameters to \`-version-info'" 1>&2
1678           $echo "$help" 1>&2
1679           exit 1
1680         fi
1681
1682         current="$2"
1683         revision="$3"
1684         age="$4"
1685
1686         # Check that each of the things are valid numbers.
1687         case "$current" in
1688         0 | [1-9] | [1-9][0-9]*) ;;
1689         *)
1690           $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1691           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1692           exit 1
1693           ;;
1694         esac
1695
1696         case "$revision" in
1697         0 | [1-9] | [1-9][0-9]*) ;;
1698         *)
1699           $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1700           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1701           exit 1
1702           ;;
1703         esac
1704
1705         case "$age" in
1706         0 | [1-9] | [1-9][0-9]*) ;;
1707         *)
1708           $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1709           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1710           exit 1
1711           ;;
1712         esac
1713
1714         if test $age -gt $current; then
1715           $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1716           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1717           exit 1
1718         fi
1719
1720         # Calculate the version variables.
1721         major=
1722         versuffix=
1723         verstring=
1724         case "$version_type" in
1725         none) ;;
1726
1727         irix)
1728           major=`expr $current - $age + 1`
1729           versuffix="$major.$revision"
1730           verstring="sgi$major.$revision"
1731
1732           # Add in all the interfaces that we are compatible with.
1733           loop=$revision
1734           while test $loop != 0; do
1735             iface=`expr $revision - $loop`
1736             loop=`expr $loop - 1`
1737             verstring="sgi$major.$iface:$verstring"
1738           done
1739           ;;
1740
1741         linux)
1742           major=.`expr $current - $age`
1743           versuffix="$major.$age.$revision"
1744           ;;
1745
1746         osf)
1747           major=`expr $current - $age`
1748           versuffix=".$current.$age.$revision"
1749           verstring="$current.$age.$revision"
1750
1751           # Add in all the interfaces that we are compatible with.
1752           loop=$age
1753           while test $loop != 0; do
1754             iface=`expr $current - $loop`
1755             loop=`expr $loop - 1`
1756             verstring="$verstring:${iface}.0"
1757           done
1758
1759           # Make executables depend on our current version.
1760           verstring="$verstring:${current}.0"
1761           ;;
1762
1763         sunos)
1764           major=".$current"
1765           versuffix=".$current.$revision"
1766           ;;
1767
1768         freebsd-aout)
1769           major=".$current"
1770           versuffix=".$current.$revision";
1771           ;;
1772
1773         freebsd-elf)
1774           major=".$current"
1775           versuffix=".$current";
1776           ;;
1777
1778         windows)
1779           # Like Linux, but with '-' rather than '.', since we only
1780           # want one extension on Windows 95.
1781           major=`expr $current - $age`
1782           versuffix="-$major-$age-$revision"
1783           ;;
1784
1785         *)
1786           $echo "$modename: unknown library version type \`$version_type'" 1>&2
1787           echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
1788           exit 1
1789           ;;
1790         esac
1791
1792         # Clear the version info if we defaulted, and they specified a release.
1793         if test -z "$vinfo" && test -n "$release"; then
1794           major=
1795           verstring="0.0"
1796           if test "$need_version" = no; then
1797             versuffix=
1798           else
1799             versuffix=".0.0"
1800           fi
1801         fi
1802
1803         # Remove version info from name if versioning should be avoided
1804         if test "$avoid_version" = yes && test "$need_version" = no; then
1805           major=
1806           versuffix=
1807           verstring=""
1808         fi
1809         
1810         # Check to see if the archive will have undefined symbols.
1811         if test "$allow_undefined" = yes; then
1812           if test "$allow_undefined_flag" = unsupported; then
1813             $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1814             build_libtool_libs=no
1815             build_old_libs=yes
1816           fi
1817         else
1818           # Don't allow undefined symbols.
1819           allow_undefined_flag="$no_undefined_flag"
1820         fi
1821
1822         dependency_libs="$deplibs"
1823         case "$host" in
1824         *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-aix*)
1825           # these systems don't actually have a c library (as such)!
1826           ;;
1827         *-*-rhapsody*)
1828           # rhapsody is a little odd...
1829           deplibs="$deplibs -framework System"
1830           ;;
1831         *)
1832           # Add libc to deplibs on all other systems.
1833           deplibs="$deplibs -lc"
1834           ;;
1835         esac
1836       fi
1837
1838       # Create the output directory, or remove our outputs if we need to.
1839       if test -d $output_objdir; then
1840         $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1841         $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1842       else
1843         $show "$mkdir $output_objdir"
1844         $run $mkdir $output_objdir
1845         status=$?
1846         if test $status -ne 0 && test ! -d $output_objdir; then
1847           exit $status
1848         fi
1849       fi
1850
1851       # Now set the variables for building old libraries.
1852       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1853         oldlibs="$oldlibs $output_objdir/$libname.$libext"
1854
1855         # Transform .lo files to .o files.
1856         oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1857       fi
1858
1859       if test "$build_libtool_libs" = yes; then
1860         # Transform deplibs into only deplibs that can be linked in shared.
1861         name_save=$name
1862         libname_save=$libname
1863         release_save=$release
1864         versuffix_save=$versuffix
1865         major_save=$major
1866         # I'm not sure if I'm treating the release correctly.  I think
1867         # release should show up in the -l (ie -lgmp5) so we don't want to
1868         # add it in twice.  Is that correct?
1869         release=""
1870         versuffix=""
1871         major=""
1872         newdeplibs=
1873         droppeddeps=no
1874         case "$deplibs_check_method" in
1875         pass_all)
1876           # Don't check for shared/static.  Everything works.
1877           # This might be a little naive.  We might want to check
1878           # whether the library exists or not.  But this is on
1879           # osf3 & osf4 and I'm not really sure... Just
1880           # implementing what was already the behaviour.
1881           newdeplibs=$deplibs
1882           ;;
1883         test_compile)
1884           # This code stresses the "libraries are programs" paradigm to its
1885           # limits. Maybe even breaks it.  We compile a program, linking it
1886           # against the deplibs as a proxy for the library.  Then we can check
1887           # whether they linked in statically or dynamically with ldd.
1888           $rm conftest.c
1889           cat > conftest.c <<EOF
1890           int main() { return 0; }
1891 EOF
1892           $rm conftest
1893           $CC -o conftest conftest.c $deplibs
1894           if test $? -eq 0 ; then
1895             ldd_output=`ldd conftest`
1896             for i in $deplibs; do
1897               name="`expr $i : '-l\(.*\)'`"
1898               # If $name is empty we are operating on a -L argument.
1899               if test "$name" != "" ; then
1900                 libname=`eval \\$echo \"$libname_spec\"`
1901                 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1902                 set dummy $deplib_matches
1903                 deplib_match=$2
1904                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1905                   newdeplibs="$newdeplibs $i"
1906                 else
1907                   droppeddeps=yes
1908                   echo
1909                   echo "*** Warning: This library needs some functionality provided by $i."
1910                   echo "*** I have the capability to make that library automatically link in when"
1911                   echo "*** you link to this library.  But I can only do this if you have a"
1912                   echo "*** shared version of the library, which you do not appear to have."
1913                 fi
1914               else
1915                 newdeplibs="$newdeplibs $i"
1916               fi
1917             done
1918           else
1919             # Error occured in the first compile.  Let's try to salvage the situation:
1920             # Compile a seperate program for each library.
1921             for i in $deplibs; do
1922               name="`expr $i : '-l\(.*\)'`"
1923              # If $name is empty we are operating on a -L argument.
1924               if test "$name" != "" ; then
1925                 $rm conftest
1926                 $CC -o conftest conftest.c $i
1927                 # Did it work?
1928                 if test $? -eq 0 ; then
1929                   ldd_output=`ldd conftest`
1930                   libname=`eval \\$echo \"$libname_spec\"`
1931                   deplib_matches=`eval \\$echo \"$library_names_spec\"`
1932                   set dummy $deplib_matches
1933                   deplib_match=$2
1934                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1935                     newdeplibs="$newdeplibs $i"
1936                   else
1937                     droppeddeps=yes
1938                     echo
1939                     echo "*** Warning: This library needs some functionality provided by $i."
1940                     echo "*** I have the capability to make that library automatically link in when"
1941                     echo "*** you link to this library.  But I can only do this if you have a"
1942                     echo "*** shared version of the library, which you do not appear to have."
1943                   fi
1944                 else
1945                   droppeddeps=yes
1946                   echo
1947                   echo "*** Warning!  Library $i is needed by this library but I was not able to"
1948                   echo "***  make it link in!  You will probably need to install it or some"
1949                   echo "*** library that it depends on before this library will be fully"
1950                   echo "*** functional.  Installing it before continuing would be even better."
1951                 fi
1952               else
1953                 newdeplibs="$newdeplibs $i"
1954               fi
1955             done
1956           fi
1957           ;;
1958         file_magic*)
1959           set dummy $deplibs_check_method
1960           file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
1961           for a_deplib in $deplibs; do
1962             name="`expr $a_deplib : '-l\(.*\)'`"
1963             # If $name is empty we are operating on a -L argument.
1964             if test "$name" != "" ; then
1965               libname=`eval \\$echo \"$libname_spec\"`
1966               for i in $lib_search_path; do
1967                     potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1968                     for potent_lib in $potential_libs; do
1969                       # Follow soft links.
1970                       if ls -lLd "$potent_lib" 2>/dev/null \
1971                          | grep " -> " >/dev/null; then
1972                         continue 
1973                       fi
1974                       # The statement above tries to avoid entering an
1975                       # endless loop below, in case of cyclic links.
1976                       # We might still enter an endless loop, since a link
1977                       # loop can be closed while we follow links,
1978                       # but so what?
1979                       potlib="$potent_lib"
1980                       while test -h "$potlib" 2>/dev/null; do
1981                         potliblink=`ls -ld $potlib | sed 's/.* -> //'`
1982                         case "$potliblink" in
1983                         [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
1984                         *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
1985                         esac
1986                       done
1987                       if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
1988                          | sed 10q \
1989                          | egrep "$file_magic_regex" > /dev/null; then
1990                         newdeplibs="$newdeplibs $a_deplib"
1991                         a_deplib=""
1992                         break 2
1993                       fi
1994                     done
1995               done
1996               if test -n "$a_deplib" ; then
1997                 droppeddeps=yes
1998                 echo
1999                 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2000                 echo "*** I have the capability to make that library automatically link in when"
2001                 echo "*** you link to this library.  But I can only do this if you have a"
2002                 echo "*** shared version of the library, which you do not appear to have."
2003               fi
2004             else
2005               # Add a -L argument.
2006               newdeplibs="$newdeplibs $a_deplib"
2007             fi
2008           done # Gone through all deplibs.
2009           ;;
2010         none | unknown | *)
2011           newdeplibs=""
2012           if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2013                -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
2014              grep . >/dev/null; then
2015             echo
2016             if test "X$deplibs_check_method" = "Xnone"; then
2017               echo "*** Warning: inter-library dependencies are not supported in this platform."
2018             else
2019               echo "*** Warning: inter-library dependencies are not known to be supported."
2020             fi
2021             echo "*** All declared inter-library dependencies are being dropped."
2022             droppeddeps=yes
2023           fi
2024           ;;
2025         esac
2026         versuffix=$versuffix_save
2027         major=$major_save
2028         release=$release_save
2029         libname=$libname_save
2030         name=$name_save
2031
2032         if test "$droppeddeps" = yes; then
2033           if test "$module" = yes; then
2034             echo
2035             echo "*** Warning: libtool could not satisfy all declared inter-library"
2036             echo "*** dependencies of module $libname.  Therefore, libtool will create"
2037             echo "*** a static module, that should work as long as the dlopening"
2038             echo "*** application is linked with the -dlopen flag."
2039             if test -z "$global_symbol_pipe"; then
2040               echo
2041               echo "*** However, this would only work if libtool was able to extract symbol"
2042               echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2043               echo "*** not find such a program.  So, this module is probably useless."
2044               echo "*** \`nm' from GNU binutils and a full rebuild may help."
2045             fi
2046             if test "$build_old_libs" = no; then
2047               oldlibs="$output_objdir/$libname.$libext"
2048               build_libtool_libs=module
2049               build_old_libs=yes
2050             else
2051               build_libtool_libs=no
2052             fi
2053           else
2054             echo "*** The inter-library dependencies that have been dropped here will be"
2055             echo "*** automatically added whenever a program is linked with this library"
2056             echo "*** or is declared to -dlopen it."
2057           fi
2058         fi
2059         # Done checking deplibs!
2060         deplibs=$newdeplibs
2061       fi
2062
2063       # All the library-specific variables (install_libdir is set above).
2064       library_names=
2065       old_library=
2066       dlname=
2067       
2068       # Test again, we may have decided not to build it any more
2069       if test "$build_libtool_libs" = yes; then
2070         # Get the real and link names of the library.
2071         eval library_names=\"$library_names_spec\"
2072         set dummy $library_names
2073         realname="$2"
2074         shift; shift
2075
2076         if test -n "$soname_spec"; then
2077           eval soname=\"$soname_spec\"
2078         else
2079           soname="$realname"
2080         fi
2081
2082         lib="$output_objdir/$realname"
2083         for link
2084         do
2085           linknames="$linknames $link"
2086         done
2087
2088         # Ensure that we have .o objects for linkers which dislike .lo
2089         # (e.g. aix) in case we are running --disable-static
2090         for obj in $libobjs; do
2091           xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2092           if test "X$xdir" = "X$obj"; then
2093             xdir="."
2094           else
2095             xdir="$xdir"
2096           fi
2097           baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2098           oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2099           if test ! -f $xdir/$oldobj; then
2100             $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2101             $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2102           fi
2103         done
2104
2105         # Use standard objects if they are pic
2106         test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2107
2108         # Prepare the list of exported symbols
2109         if test -z "$export_symbols"; then
2110           if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2111             $show "generating symbol list for \`$libname.la'"
2112             export_symbols="$output_objdir/$libname.exp"
2113             $run $rm $export_symbols
2114             eval cmds=\"$export_symbols_cmds\"
2115             IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
2116             for cmd in $cmds; do
2117               IFS="$save_ifs"
2118               $show "$cmd"
2119               $run eval "$cmd" || exit $?
2120             done
2121             IFS="$save_ifs"
2122             if test -n "$export_symbols_regex"; then
2123               $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2124               $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2125               $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2126               $run eval '$mv "${export_symbols}T" "$export_symbols"'
2127             fi
2128           fi
2129         fi
2130
2131         if test -n "$export_symbols" && test -n "$include_expsyms"; then
2132           $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2133         fi
2134
2135         if test -n "$convenience"; then
2136           if test -n "$whole_archive_flag_spec"; then
2137             eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2138           else
2139             gentop="$output_objdir/${outputname}x"
2140             $show "${rm}r $gentop"
2141             $run ${rm}r "$gentop"
2142             $show "mkdir $gentop"
2143             $run mkdir "$gentop"
2144             status=$?
2145             if test $status -ne 0 && test ! -d "$gentop"; then
2146               exit $status
2147             fi
2148             generated="$generated $gentop"
2149
2150             for xlib in $convenience; do
2151               # Extract the objects.
2152               case "$xlib" in
2153               [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2154               *) xabs=`pwd`"/$xlib" ;;
2155               esac
2156               xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2157               xdir="$gentop/$xlib"
2158
2159               $show "${rm}r $xdir"
2160               $run ${rm}r "$xdir"
2161               $show "mkdir $xdir"
2162               $run mkdir "$xdir"
2163               status=$?
2164               if test $status -ne 0 && test ! -d "$xdir"; then
2165                 exit $status
2166               fi
2167               $show "(cd $xdir && $AR x $xabs)"
2168               $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2169
2170               libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2171             done
2172           fi
2173         fi
2174
2175         if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2176           eval flag=\"$thread_safe_flag_spec\"
2177           linkopts="$linkopts $flag"
2178         fi
2179
2180         # Do each of the archive commands.
2181         if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2182           eval cmds=\"$archive_expsym_cmds\"
2183         else
2184           eval cmds=\"$archive_cmds\"
2185         fi
2186         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
2187         for cmd in $cmds; do
2188           IFS="$save_ifs"
2189           $show "$cmd"
2190           $run eval "$cmd" || exit $?
2191         done
2192         IFS="$save_ifs"
2193
2194         # Create links to the real library.
2195         for linkname in $linknames; do
2196           if test "$realname" != "$linkname"; then
2197             $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2198             $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2199           fi
2200         done
2201
2202         # If -module or -export-dynamic was specified, set the dlname.
2203         if test "$module" = yes || test "$export_dynamic" = yes; then
2204           # On all known operating systems, these are identical.
2205           dlname="$soname"
2206         fi
2207       fi
2208       ;;
2209
2210     *.lo | *.o | *.obj)
2211       if test -n "$link_against_libtool_libs"; then
2212         $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2213         exit 1
2214       fi
2215
2216       if test -n "$deplibs"; then
2217         $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2218       fi
2219
2220       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2221         $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2222       fi
2223
2224       if test -n "$rpath"; then
2225         $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2226       fi
2227
2228       if test -n "$xrpath"; then
2229         $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2230       fi
2231
2232       if test -n "$vinfo"; then
2233         $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2234       fi
2235
2236       if test -n "$release"; then
2237         $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2238       fi
2239
2240       case "$output" in
2241       *.lo)
2242         if test -n "$objs"; then
2243           $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2244           exit 1
2245         fi
2246         libobj="$output"
2247         obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2248         ;;
2249       *)
2250         libobj=
2251         obj="$output"
2252         ;;
2253       esac
2254
2255       # Delete the old objects.
2256       $run $rm $obj $libobj
2257
2258       # Objects from convenience libraries.  This assumes
2259       # single-version convenience libraries.  Whenever we create
2260       # different ones for PIC/non-PIC, this we'll have to duplicate
2261       # the extraction.
2262       reload_conv_objs=
2263       gentop=
2264       # reload_cmds runs $LD directly, so let us get rid of
2265       # -Wl from whole_archive_flag_spec
2266       wl= 
2267
2268       if test -n "$convenience"; then
2269         if test -n "$whole_archive_flag_spec"; then
2270           eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2271         else
2272           gentop="$output_objdir/${obj}x"
2273           $show "${rm}r $gentop"
2274           $run ${rm}r "$gentop"
2275           $show "mkdir $gentop"
2276           $run mkdir "$gentop"
2277           status=$?
2278           if test $status -ne 0 && test ! -d "$gentop"; then
2279             exit $status
2280           fi
2281           generated="$generated $gentop"
2282
2283           for xlib in $convenience; do
2284             # Extract the objects.
2285             case "$xlib" in
2286             [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2287             *) xabs=`pwd`"/$xlib" ;;
2288             esac
2289             xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2290             xdir="$gentop/$xlib"
2291
2292             $show "${rm}r $xdir"
2293             $run ${rm}r "$xdir"
2294             $show "mkdir $xdir"
2295             $run mkdir "$xdir"
2296             status=$?
2297             if test $status -ne 0 && test ! -d "$xdir"; then
2298               exit $status
2299             fi
2300             $show "(cd $xdir && $AR x $xabs)"
2301             $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2302
2303             reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2304           done
2305         fi
2306       fi
2307
2308       # Create the old-style object.
2309       reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
2310
2311       output="$obj"
2312       eval cmds=\"$reload_cmds\"
2313       IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
2314       for cmd in $cmds; do
2315         IFS="$save_ifs"
2316         $show "$cmd"
2317         $run eval "$cmd" || exit $?
2318       done
2319       IFS="$save_ifs"
2320
2321       # Exit if we aren't doing a library object file.
2322       if test -z "$libobj"; then
2323         if test -n "$gentop"; then
2324           $show "${rm}r $gentop"
2325           $run ${rm}r $gentop
2326         fi
2327
2328         exit 0
2329       fi
2330
2331       if test "$build_libtool_libs" != yes; then
2332         if test -n "$gentop"; then
2333           $show "${rm}r $gentop"
2334           $run ${rm}r $gentop
2335         fi
2336
2337         # Create an invalid libtool object if no PIC, so that we don't
2338         # accidentally link it into a program.
2339         $show "echo timestamp > $libobj"
2340         $run eval "echo timestamp > $libobj" || exit $?
2341         exit 0
2342       fi
2343
2344       if test -n "$pic_flag"; then
2345         # Only do commands if we really have different PIC objects.
2346         reload_objs="$libobjs $reload_conv_objs"
2347         output="$libobj"
2348         eval cmds=\"$reload_cmds\"
2349         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
2350         for cmd in $cmds; do
2351           IFS="$save_ifs"
2352           $show "$cmd"
2353           $run eval "$cmd" || exit $?
2354         done
2355         IFS="$save_ifs"
2356       else
2357         # Just create a symlink.
2358         $show $rm $libobj
2359         $run $rm $libobj
2360         xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
2361         if test "X$xdir" = "X$libobj"; then
2362           xdir="."
2363         else
2364           xdir="$xdir"
2365         fi
2366         baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
2367         oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2368         $show "(cd $xdir && $LN_S $oldobj $baseobj)"
2369         $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
2370       fi
2371
2372       if test -n "$gentop"; then
2373         $show "${rm}r $gentop"
2374         $run ${rm}r $gentop
2375       fi
2376
2377       exit 0
2378       ;;
2379
2380     # Anything else should be a program.
2381     *)
2382       if test -n "$vinfo"; then
2383         $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2384       fi
2385
2386       if test -n "$release"; then
2387         $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
2388       fi
2389
2390       if test "$preload" = yes; then
2391         if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
2392            test "$dlopen_self_static" = unknown; then
2393           $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2394         fi 
2395       fi
2396     
2397       if test -n "$rpath$xrpath"; then
2398         # If the user specified any rpath flags, then add them.
2399         for libdir in $rpath $xrpath; do
2400           # This is the magic to use -rpath.
2401           case "$compile_rpath " in
2402           *" $libdir "*) ;;
2403           *) compile_rpath="$compile_rpath $libdir" ;;
2404           esac
2405           case "$finalize_rpath " in
2406           *" $libdir "*) ;;
2407           *) finalize_rpath="$finalize_rpath $libdir" ;;
2408           esac
2409         done
2410       fi
2411
2412       # Now hardcode the library paths
2413       rpath=
2414       hardcode_libdirs=
2415       for libdir in $compile_rpath $finalize_rpath; do
2416         if test -n "$hardcode_libdir_flag_spec"; then
2417           if test -n "$hardcode_libdir_separator"; then
2418             if test -z "$hardcode_libdirs"; then
2419               hardcode_libdirs="$libdir"
2420             else
2421               # Just accumulate the unique libdirs.
2422               case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2423               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2424                 ;;
2425               *)
2426                 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2427                 ;;
2428               esac
2429             fi
2430           else
2431             eval flag=\"$hardcode_libdir_flag_spec\"
2432             rpath="$rpath $flag"
2433           fi
2434         elif test -n "$runpath_var"; then
2435           case "$perm_rpath " in
2436           *" $libdir "*) ;;
2437           *) perm_rpath="$perm_rpath $libdir" ;;
2438           esac
2439         fi
2440       done
2441       # Substitute the hardcoded libdirs into the rpath.
2442       if test -n "$hardcode_libdir_separator" &&
2443          test -n "$hardcode_libdirs"; then
2444         libdir="$hardcode_libdirs"
2445         eval rpath=\" $hardcode_libdir_flag_spec\"
2446       fi
2447       compile_rpath="$rpath"
2448
2449       rpath=
2450       hardcode_libdirs=
2451       for libdir in $finalize_rpath; do
2452         if test -n "$hardcode_libdir_flag_spec"; then
2453           if test -n "$hardcode_libdir_separator"; then
2454             if test -z "$hardcode_libdirs"; then
2455               hardcode_libdirs="$libdir"
2456             else
2457               # Just accumulate the unique libdirs.
2458               case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2459               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2460                 ;;
2461               *)
2462                 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2463                 ;;
2464               esac
2465             fi
2466           else
2467             eval flag=\"$hardcode_libdir_flag_spec\"
2468             rpath="$rpath $flag"
2469           fi
2470         elif test -n "$runpath_var"; then
2471           case "$finalize_perm_rpath " in
2472           *" $libdir "*) ;;
2473           *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
2474           esac
2475         fi
2476       done
2477       # Substitute the hardcoded libdirs into the rpath.
2478       if test -n "$hardcode_libdir_separator" &&
2479          test -n "$hardcode_libdirs"; then
2480         libdir="$hardcode_libdirs"
2481         eval rpath=\" $hardcode_libdir_flag_spec\"
2482       fi
2483       finalize_rpath="$rpath"
2484
2485       if test -z "$compile_rpath" -a -n "$hardcode_default_flag"; then
2486         eval compile_rpath=\" $hardcode_default_flag\"
2487       fi
2488
2489       if test -z "$finalize_rpath" -a -n "$hardcode_default_flag"; then
2490         eval finalize_rpath=\" $hardcode_default_flag\"
2491       fi
2492
2493       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2494       if test "X$output_objdir" = "X$output"; then
2495         output_objdir="$objdir"
2496       else
2497         output_objdir="$output_objdir/$objdir"
2498       fi
2499
2500       # Create the binary in the object directory, then wrap it.
2501       if test ! -d $output_objdir; then
2502         $show "$mkdir $output_objdir"
2503         $run $mkdir $output_objdir
2504         status=$?
2505         if test $status -ne 0 && test ! -d $output_objdir; then
2506           exit $status
2507         fi
2508       fi
2509
2510       if test -n "$libobjs" && test "$build_old_libs" = yes; then
2511         # Transform all the library objects into standard objects.
2512         compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2513         finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2514       fi
2515
2516       dlsyms=
2517       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2518         if test -n "$NM" && test -n "$global_symbol_pipe"; then
2519           dlsyms="${outputname}S.c"
2520         else
2521           $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
2522         fi
2523       fi
2524
2525       if test -n "$dlsyms"; then
2526         case "$dlsyms" in
2527         "") ;;
2528         *.c)
2529           # Discover the nlist of each of the dlfiles.
2530           nlist="$output_objdir/${outputname}.nm"
2531
2532           $show "$rm $nlist ${nlist}S ${nlist}T"
2533           $run $rm "$nlist" "${nlist}S" "${nlist}T"
2534
2535           # Parse the name list into a source file.
2536           $show "creating $output_objdir/$dlsyms"
2537
2538           test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
2539 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
2540 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
2541
2542 #ifdef __cplusplus
2543 extern \"C\" {
2544 #endif
2545
2546 /* Prevent the only kind of declaration conflicts we can make. */
2547 #define lt_preloaded_symbols some_other_symbol
2548
2549 /* External symbol declarations for the compiler. */\
2550 "
2551
2552           if test "$dlself" = yes; then
2553             $show "generating symbol list for \`$output'"
2554
2555             test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
2556
2557             # Add our own program objects to the symbol list.
2558             progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2559             for arg in $progfiles; do
2560               $show "extracting global C symbols from \`$arg'"
2561               $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2562             done
2563
2564             if test -n "$exclude_expsyms"; then
2565               $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2566               $run eval '$mv "$nlist"T "$nlist"'
2567             fi
2568             
2569             if test -n "$export_symbols_regex"; then
2570               $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2571               $run eval '$mv "$nlist"T "$nlist"'
2572             fi
2573
2574             # Prepare the list of exported symbols
2575             if test -z "$export_symbols"; then
2576               export_symbols="$output_objdir/$output.exp"
2577               $run $rm $export_symbols
2578               $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2579             else
2580               $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
2581               $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
2582               $run eval 'mv "$nlist"T "$nlist"'
2583             fi
2584           fi
2585
2586         # Prepare the list of exported symbols
2587         if test -z "$export_symbols"; then
2588           if test "$always_export_symbols" = yes -a -n "$link_export_all"; then
2589             eval link_export=\"$link_export_all\"
2590           elif test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2591             $show "generating symbol list for \`$output'"
2592             export_symbols="$output_objdir/$output.exp"
2593             $run $rm $export_symbols
2594             libobjs="$objs"
2595             eval cmds=\"$export_symbols_cmds\"
2596             IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
2597             for cmd in $cmds; do
2598               IFS="$save_ifs"
2599               $show "$cmd"
2600               $run eval "$cmd" || exit $?
2601             done
2602             IFS="$save_ifs"
2603             if test -n "$export_symbols_regex"; then
2604               $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2605               $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2606               $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2607               $run eval '$mv "${export_symbols}T" "$export_symbols"'
2608             fi
2609           fi
2610         fi
2611
2612           for arg in $dlprefiles; do
2613             $show "extracting global C symbols from \`$arg'"
2614             name=`echo "$arg" | sed -e 's%^.*/%%'`
2615             $run eval 'echo ": $name " >> "$nlist"'
2616             $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2617           done
2618
2619           if test -z "$run"; then
2620             # Make sure we have at least an empty file.
2621             test -f "$nlist" || : > "$nlist"
2622
2623             if test -n "$exclude_expsyms"; then
2624               egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2625               $mv "$nlist"T "$nlist"
2626             fi
2627
2628             # Try sorting and uniquifying the output.
2629             if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
2630               :
2631             else
2632               grep -v "^: " < "$nlist" > "$nlist"S
2633             fi
2634
2635             if test -f "$nlist"S; then
2636               eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
2637             else
2638               echo '/* NONE */' >> "$output_objdir/$dlsyms"
2639             fi
2640
2641             $echo >> "$output_objdir/$dlsyms" "\
2642
2643 #undef lt_preloaded_symbols
2644
2645 #if defined (__STDC__) && __STDC__
2646 # define lt_ptr_t void *
2647 #else
2648 # define lt_ptr_t char *
2649 # define const
2650 #endif
2651
2652 /* The mapping between symbol names and symbols. */
2653 const struct {
2654   const char *name;
2655   lt_ptr_t address;
2656 }
2657 lt_preloaded_symbols[] =
2658 {\
2659 "
2660
2661             sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
2662                 -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
2663                   < "$nlist" >> "$output_objdir/$dlsyms"
2664
2665             $echo >> "$output_objdir/$dlsyms" "\
2666   {0, (lt_ptr_t) 0}
2667 };
2668
2669 /* This works around a problem in FreeBSD linker */
2670 #ifdef FREEBSD_WORKAROUND
2671 static const void *lt_preloaded_setup() {
2672   return lt_preloaded_symbols;
2673 }
2674 #endif
2675
2676 #ifdef __cplusplus
2677 }
2678 #endif\
2679 "
2680           fi
2681
2682           pic_flag_for_symtable=
2683           case "$host" in
2684           # compiling the symbol table file with pic_flag works around
2685           # a FreeBSD bug that causes programs to crash when -lm is
2686           # linked before any other PIC object.  But we must not use
2687           # pic_flag when linking with -static.  The problem exists in
2688           # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2689           *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2690             case "$compile_command " in
2691             *" -static "*) ;;
2692             *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
2693             esac;;
2694           *-*-hpux*)
2695             case "$compile_command " in
2696             *" -static "*) ;;
2697             *) pic_flag_for_symtable=" $pic_flag -DPIC";;
2698             esac
2699           esac
2700
2701           # Now compile the dynamic symbol file.
2702           $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
2703           $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
2704
2705           # Clean up the generated files.
2706           $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
2707           $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
2708
2709           # Transform the symbol file into the correct name.
2710           compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2711           finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2712           ;;
2713         *)
2714           $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
2715           exit 1
2716           ;;
2717         esac
2718       else
2719         # We keep going just in case the user didn't refer to
2720         # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
2721         # really was required.
2722
2723         # Nullify the symbol file.
2724         compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2725         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2726       fi
2727
2728       link_export_opt=
2729       if test -n "$export_symbols" -o -n "$dlsyms"; then
2730         eval link_export_opt=\"$link_export\"
2731       fi
2732
2733       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
2734         # Replace the output file specification.
2735         compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2736         link_command="$compile_command$compile_rpath$link_export_opt"
2737
2738         # We have no uninstalled library dependencies, so finalize right now.
2739         $show "$link_command"
2740         $run eval "$link_command"
2741         status=$?
2742         
2743         # Delete the generated files.
2744         if test -n "$dlsyms"; then
2745           $show "$rm $output_objdir/${outputname}S.${objext}"
2746           $run $rm "$output_objdir/${outputname}S.${objext}"
2747         fi
2748
2749         exit $status
2750       fi
2751
2752       if test -n "$shlibpath_var"; then
2753         # We should set the shlibpath_var
2754         rpath=
2755         for dir in $temp_rpath; do
2756           case "$dir" in
2757           [\\/]* | [A-Za-z]:[\\/]*)
2758             # Absolute path.
2759             rpath="$rpath$dir:"
2760             ;;
2761           *)
2762             # Relative path: add a thisdir entry.
2763             rpath="$rpath\$thisdir/$dir:"
2764             ;;
2765           esac
2766         done
2767         temp_rpath="$rpath"
2768       fi
2769
2770       if test -n "$compile_shlibpath$finalize_shlibpath"; then
2771         compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
2772       fi
2773       if test -n "$finalize_shlibpath"; then
2774         finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
2775       fi
2776
2777       compile_var=
2778       finalize_var=
2779       if test -n "$runpath_var"; then
2780         if test -n "$perm_rpath"; then
2781           # We should set the runpath_var.
2782           rpath=
2783           for dir in $perm_rpath; do
2784             rpath="$rpath$dir:"
2785           done
2786           compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
2787         fi
2788         if test -n "$finalize_perm_rpath"; then
2789           # We should set the runpath_var.
2790           rpath=
2791           for dir in $finalize_perm_rpath; do
2792             rpath="$rpath$dir:"
2793           done
2794           finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
2795         fi
2796       fi
2797
2798       if test "$hardcode_action" = relink; then
2799         # Fast installation is not supported
2800         link_command="$compile_var$compile_command$compile_rpath"
2801         relink_command="$finalize_var$finalize_command$finalize_rpath"
2802         
2803         $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2804         $echo "$modename: \`$output' will be relinked during installation" 1>&2
2805       else
2806         if test "$fast_install" != no; then
2807           link_command="$finalize_var$compile_command$finalize_rpath"
2808           if test "$fast_install" = yes; then
2809             relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
2810           else
2811             # fast_install is set to needless
2812             relink_command=
2813           fi
2814         else
2815           link_command="$compile_var$compile_command$compile_rpath"
2816           relink_command="$finalize_var$finalize_command$finalize_rpath"
2817         fi
2818       fi
2819
2820       # Replace the output file specification.
2821       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2822
2823       link_command="$link_command$link_export_opt"
2824
2825       # Delete the old output files.
2826       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2827
2828       $show "$link_command"
2829       $run eval "$link_command" || exit $?
2830
2831       # Now create the wrapper script.
2832       $show "creating $output"
2833
2834       # Quote the relink command for shipping.
2835       if test -n "$relink_command"; then
2836         relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2837       fi
2838
2839       # Quote $echo for shipping.
2840       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2841         case "$0" in
2842         [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
2843         *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
2844         esac
2845         qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
2846       else
2847         qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
2848       fi
2849
2850       # Only actually do things if our run command is non-null.
2851       if test -z "$run"; then
2852         # win32 will think the script is a binary if it has
2853         # a .exe suffix, so we strip it off here.
2854         case $output in
2855           *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
2856         esac
2857         $rm $output
2858         trap "$rm $output; exit 1" 1 2 15
2859
2860         $echo > $output "\
2861 #! $SHELL
2862
2863 # $output - temporary wrapper script for $objdir/$outputname
2864 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2865 #
2866 # The $output program cannot be directly executed until all the libtool
2867 # libraries that it depends on are installed.
2868 #
2869 # This wrapper script should never be moved out of the build directory.
2870 # If it is, it will not operate correctly.
2871
2872 # Sed substitution that helps us do robust quoting.  It backslashifies
2873 # metacharacters that are still active within double-quoted strings.
2874 Xsed='sed -e 1s/^X//'
2875 sed_quote_subst='$sed_quote_subst'
2876
2877 # The HP-UX ksh and POSIX shell print the target directory to stdout
2878 # if CDPATH is set.
2879 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
2880
2881 relink_command=\"$relink_command\"
2882
2883 # This environment variable determines our operation mode.
2884 if test \"\$libtool_install_magic\" = \"$magic\"; then
2885   # install mode needs the following variable:
2886   link_against_libtool_libs='$link_against_libtool_libs'
2887 else
2888   # When we are sourced in execute mode, \$file and \$echo are already set.
2889   if test \"\$libtool_execute_magic\" != \"$magic\"; then
2890     echo=\"$qecho\"
2891     file=\"\$0\"
2892     # Make sure echo works.
2893     if test \"X\$1\" = X--no-reexec; then
2894       # Discard the --no-reexec flag, and continue.
2895       shift
2896     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
2897       # Yippee, \$echo works!
2898       :
2899     else
2900       # Restart under the correct shell, and then maybe \$echo will work.
2901       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2902     fi
2903   fi\
2904 "
2905         $echo >> $output "\
2906
2907   # Find the directory that this script lives in.
2908   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2909   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2910
2911   # Follow symbolic links until we get to the real thisdir.
2912   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
2913   while test -n \"\$file\"; do
2914     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2915
2916     # If there was a directory component, then change thisdir.
2917     if test \"x\$destdir\" != \"x\$file\"; then
2918       case \"\$destdir\" in
2919       [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
2920       *) thisdir=\"\$thisdir/\$destdir\" ;;
2921       esac
2922     fi
2923
2924     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2925     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
2926   done
2927
2928   # Try to get the absolute directory name.
2929   absdir=\`cd \"\$thisdir\" && pwd\`
2930   test -n \"\$absdir\" && thisdir=\"\$absdir\"
2931 "
2932
2933         if test "$fast_install" = yes; then
2934           echo >> $output "\
2935   program=lt-'$outputname'
2936   progdir=\"\$thisdir/$objdir\"
2937   
2938   if test ! -f \"\$progdir/\$program\" || \\
2939      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
2940        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2941
2942     file=\"\$\$-\$program\"
2943
2944     if test ! -d \"\$progdir\"; then
2945       $mkdir \"\$progdir\"
2946     else
2947       $rm \"\$progdir/\$file\"
2948     fi"
2949
2950           echo >> $output "\
2951
2952     # relink executable if necessary
2953     if test -n \"\$relink_command\"; then
2954       if (cd \"\$thisdir\" && eval \$relink_command); then :
2955       else
2956         $rm \"\$progdir/\$file\"
2957         exit 1
2958       fi
2959     fi
2960
2961     $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2962     { $rm \"\$progdir/\$program\";
2963       $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2964     $rm \"\$progdir/\$file\"
2965   fi"
2966         else
2967           echo >> $output "\
2968   program='$outputname'
2969   progdir=\"\$thisdir/$objdir\"
2970 "
2971         fi
2972
2973         echo >> $output "\
2974
2975   if test -f \"\$progdir/\$program\"; then"
2976
2977         # Export our shlibpath_var if we have one.
2978         if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2979           $echo >> $output "\
2980     # Add our own library path to $shlibpath_var
2981     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2982
2983     # Some systems cannot cope with colon-terminated $shlibpath_var
2984     # The second colon is a workaround for a bug in BeOS R4 sed
2985     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2986
2987     export $shlibpath_var
2988 "
2989         fi
2990
2991         # fixup the dll searchpath if we need to.
2992         if test -n "$dllsearchpath"; then
2993           $echo >> $output "\
2994     # Add the dll search path components to the executable PATH
2995     PATH=$dllsearchpath:\$PATH
2996 "
2997         fi
2998
2999         $echo >> $output "\
3000     if test \"\$libtool_execute_magic\" != \"$magic\"; then
3001       # Run the actual program with our arguments.
3002 "
3003         case $host in
3004           # win32 systems need to use the prog path for dll
3005           # lookup to work
3006         *-*-cygwin*)
3007           $echo >> $output "\
3008       exec \$progdir/\$program \${1+\"\$@\"}
3009 "
3010           ;;
3011
3012         # Backslashes separate directories on plain windows
3013         *-*-mingw | *-*-os2*)
3014           $echo >> $output "\
3015       exec \$progdir\\\\\$program \${1+\"\$@\"}
3016 "
3017           ;;
3018
3019         *)
3020           $echo >> $output "\
3021       # Export the path to the program.
3022       PATH=\"\$progdir:\$PATH\"
3023       export PATH
3024
3025       exec \$program \${1+\"\$@\"}
3026 "
3027           ;;
3028         esac
3029         $echo >> $output "\
3030       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3031       exit 1
3032     fi
3033   else
3034     # The program doesn't exist.
3035     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3036     \$echo \"This script is just a wrapper for \$program.\" 1>&2
3037     echo \"See the $PACKAGE documentation for more information.\" 1>&2
3038     exit 1
3039   fi
3040 fi\
3041 "
3042         chmod +x $output
3043       fi
3044       exit 0
3045       ;;
3046     esac
3047
3048     # See if we need to build an old-fashioned archive.
3049     for oldlib in $oldlibs; do
3050
3051       if test "$build_libtool_libs" = convenience; then
3052         oldobjs="$libobjs_save"
3053         addlibs="$convenience"
3054         build_libtool_libs=no
3055       else
3056         if test "$build_libtool_libs" = module; then
3057           oldobjs="$libobjs_save"
3058           build_libtool_libs=no
3059         else
3060           oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3061         fi
3062         addlibs="$old_convenience"
3063       fi
3064
3065       if test -n "$addlibs"; then
3066         gentop="$output_objdir/${outputname}x"
3067         $show "${rm}r $gentop"
3068         $run ${rm}r "$gentop"
3069         $show "mkdir $gentop"
3070         $run mkdir "$gentop"
3071         status=$?
3072         if test $status -ne 0 && test ! -d "$gentop"; then
3073           exit $status
3074         fi
3075         generated="$generated $gentop"
3076           
3077         # Add in members from convenience archives.
3078         for xlib in $addlibs; do
3079           # Extract the objects.
3080           case "$xlib" in
3081           [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3082           *) xabs=`pwd`"/$xlib" ;;
3083           esac
3084           xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3085           xdir="$gentop/$xlib"
3086
3087           $show "${rm}r $xdir"
3088           $run ${rm}r "$xdir"
3089           $show "mkdir $xdir"
3090           $run mkdir "$xdir"
3091           status=$?
3092           if test $status -ne 0 && test ! -d "$xdir"; then
3093             exit $status
3094           fi
3095           $show "(cd $xdir && $AR x $xabs)"
3096           $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3097
3098           oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3099         done
3100       fi
3101
3102       # Do each command in the archive commands.
3103       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3104         eval cmds=\"$old_archive_from_new_cmds\"
3105       else
3106         # Ensure that we have .o objects in place in case we decided
3107         # not to build a shared library, and have fallen back to building
3108         # static libs even though --disable-static was passed!
3109         for oldobj in $oldobjs; do
3110           if test ! -f $oldobj; then
3111             xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3112             if test "X$xdir" = "X$oldobj"; then
3113               xdir="."
3114             else
3115               xdir="$xdir"
3116             fi
3117             baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3118             obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3119             $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3120             $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3121           fi
3122         done
3123
3124         eval cmds=\"$old_archive_cmds\"
3125       fi
3126       IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
3127       for cmd in $cmds; do
3128         IFS="$save_ifs"
3129         $show "$cmd"
3130         $run eval "$cmd" || exit $?
3131       done
3132       IFS="$save_ifs"
3133     done
3134
3135     if test -n "$generated"; then
3136       $show "${rm}r$generated"
3137       $run ${rm}r$generated
3138     fi
3139
3140     # Now create the libtool archive.
3141     case "$output" in
3142     *.la)
3143       old_library=
3144       test "$build_old_libs" = yes && old_library="$libname.$libext"
3145       $show "creating $output"
3146
3147       if test -n "$xrpath"; then
3148         temp_xrpath=
3149         for libdir in $xrpath; do
3150           temp_xrpath="$temp_xrpath -R$libdir"
3151         done
3152         dependency_libs="$temp_xrpath $dependency_libs"
3153       fi
3154
3155       # Only create the output if not a dry run.
3156       if test -z "$run"; then
3157         for installed in no yes; do
3158           if test "$installed" = yes; then
3159             if test -z "$install_libdir"; then
3160               break
3161             fi
3162             output="$output_objdir/$outputname"i
3163           fi
3164           $rm $output
3165           $echo > $output "\
3166 # $outputname - a libtool library file
3167 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3168 #
3169 # Please DO NOT delete this file!
3170 # It is necessary for linking the library.
3171
3172 # The name that we can dlopen(3).
3173 dlname='$dlname'
3174
3175 # Names of this library.
3176 library_names='$library_names'
3177
3178 # The name of the static archive.
3179 old_library='$old_library'
3180
3181 # Libraries that this one depends upon.
3182 dependency_libs='$dependency_libs'
3183
3184 # Version information for $libname.
3185 current=$current
3186 age=$age
3187 revision=$revision
3188
3189 # Is this an already installed library?
3190 installed=$installed
3191
3192 # Directory that this library needs to be installed in:
3193 libdir='$install_libdir'\
3194 "
3195         done
3196       fi
3197
3198       # Do a symbolic link so that the libtool archive can be found in
3199       # LD_LIBRARY_PATH before the program is installed.
3200       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3201       $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
3202       ;;
3203     esac
3204     exit 0
3205     ;;
3206
3207   # libtool install mode
3208   install)
3209     modename="$modename: install"
3210
3211     # There may be an optional sh(1) argument at the beginning of
3212     # install_prog (especially on Windows NT).
3213     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
3214       # Aesthetically quote it.
3215       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3216       case "$arg" in
3217       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
3218         arg="\"$arg\""
3219         ;;
3220       esac
3221       install_prog="$arg "
3222       arg="$1"
3223       shift
3224     else
3225       install_prog=
3226       arg="$nonopt"
3227     fi
3228
3229     # The real first argument should be the name of the installation program.
3230     # Aesthetically quote it.
3231     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3232     case "$arg" in
3233     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
3234       arg="\"$arg\""
3235       ;;
3236     esac
3237     install_prog="$install_prog$arg"
3238
3239     # We need to accept at least all the BSD install flags.
3240     dest=
3241     files=
3242     opts=
3243     prev=
3244     install_type=
3245     isdir=no
3246     stripme=
3247     for arg
3248     do
3249       if test -n "$dest"; then
3250         files="$files $dest"
3251         dest="$arg"
3252         continue
3253       fi
3254
3255       case "$arg" in
3256       -d) isdir=yes ;;
3257       -f) prev="-f" ;;
3258       -g) prev="-g" ;;
3259       -m) prev="-m" ;;
3260       -o) prev="-o" ;;
3261       -s)
3262         stripme=" -s"
3263         continue
3264         ;;
3265       -*) ;;
3266
3267       *)
3268         # If the previous option needed an argument, then skip it.
3269         if test -n "$prev"; then
3270           prev=
3271         else
3272           dest="$arg"
3273           continue
3274         fi
3275         ;;
3276       esac
3277
3278       # Aesthetically quote the argument.
3279       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3280       case "$arg" in
3281       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
3282         arg="\"$arg\""
3283         ;;
3284       esac
3285       install_prog="$install_prog $arg"
3286     done
3287
3288     if test -z "$install_prog"; then
3289       $echo "$modename: you must specify an install program" 1>&2
3290       $echo "$help" 1>&2
3291       exit 1
3292     fi
3293
3294     if test -n "$prev"; then
3295       $echo "$modename: the \`$prev' option requires an argument" 1>&2
3296       $echo "$help" 1>&2
3297       exit 1
3298     fi
3299
3300     if test -z "$files"; then
3301       if test -z "$dest"; then
3302         $echo "$modename: no file or destination specified" 1>&2
3303       else
3304         $echo "$modename: you must specify a destination" 1>&2
3305       fi
3306       $echo "$help" 1>&2
3307       exit 1
3308     fi
3309
3310     # Strip any trailing slash from the destination.
3311     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
3312
3313     # Check to see that the destination is a directory.
3314     test -d "$dest" && isdir=yes
3315     if test "$isdir" = yes; then
3316       destdir="$dest"
3317       destname=
3318     else
3319       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
3320       test "X$destdir" = "X$dest" && destdir=.
3321       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
3322
3323       # Not a directory, so check to see that there is only one file specified.
3324       set dummy $files
3325       if test $# -gt 2; then
3326         $echo "$modename: \`$dest' is not a directory" 1>&2
3327         $echo "$help" 1>&2
3328         exit 1
3329       fi
3330     fi
3331     case "$destdir" in
3332     [\\/]* | [A-Za-z]:[\\/]*) ;;
3333     *)
3334       for file in $files; do
3335         case "$file" in
3336         *.lo) ;;
3337         *)
3338           $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3339           $echo "$help" 1>&2
3340           exit 1
3341           ;;
3342         esac
3343       done
3344       ;;
3345     esac
3346
3347     # This variable tells wrapper scripts just to set variables rather
3348     # than running their programs.
3349     libtool_install_magic="$magic"
3350
3351     staticlibs=
3352     future_libdirs=
3353     current_libdirs=
3354     for file in $files; do
3355
3356       # Do each installation.
3357       case "$file" in
3358       *.a | *.lib)
3359         # Do the static libraries later.
3360         staticlibs="$staticlibs $file"
3361         ;;
3362
3363       *.la)
3364         # Check to see that this really is a libtool archive.
3365         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3366         else
3367           $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
3368           $echo "$help" 1>&2
3369           exit 1
3370         fi
3371
3372         library_names=
3373         old_library=
3374         # If there is no directory component, then add one.
3375         case "$file" in
3376         */* | *\\*) . $file ;;
3377         *) . ./$file ;;
3378         esac
3379
3380         # Add the libdir to current_libdirs if it is the destination.
3381         if test "X$destdir" = "X$libdir"; then
3382           case "$current_libdirs " in
3383           *" $libdir "*) ;;
3384           *) current_libdirs="$current_libdirs $libdir" ;;
3385           esac
3386         else
3387           # Note the libdir as a future libdir.
3388           case "$future_libdirs " in
3389           *" $libdir "*) ;;
3390           *) future_libdirs="$future_libdirs $libdir" ;;
3391           esac
3392         fi
3393
3394         dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
3395         test "X$dir" = "X$file/" && dir=
3396         dir="$dir$objdir"
3397
3398         # See the names of the shared library.
3399         set dummy $library_names
3400         if test -n "$2"; then
3401           realname="$2"
3402           shift
3403           shift
3404
3405           # Install the shared library and build the symlinks.
3406           $show "$install_prog $dir/$realname $destdir/$realname"
3407           $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
3408
3409           if test $# -gt 0; then
3410             # Delete the old symlinks, and create new ones.
3411             for linkname
3412             do
3413               if test "$linkname" != "$realname"; then
3414                 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3415                 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3416               fi
3417             done
3418           fi
3419
3420           # Do each command in the postinstall commands.
3421           lib="$destdir/$realname"
3422           eval cmds=\"$postinstall_cmds\"
3423           IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
3424           for cmd in $cmds; do
3425             IFS="$save_ifs"
3426             $show "$cmd"
3427             $run eval "$cmd" || exit $?
3428           done
3429           IFS="$save_ifs"
3430         fi
3431
3432         # Install the pseudo-library for information purposes.
3433         name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3434         instname="$dir/$name"i
3435         $show "$install_prog $instname $destdir/$name"
3436         $run eval "$install_prog $instname $destdir/$name" || exit $?
3437
3438         # Maybe install the static library, too.
3439         test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
3440         ;;
3441
3442       *.lo)
3443         # Install (i.e. copy) a libtool object.
3444
3445         # Figure out destination file name, if it wasn't already specified.
3446         if test -n "$destname"; then
3447           destfile="$destdir/$destname"
3448         else
3449           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3450           destfile="$destdir/$destfile"
3451         fi
3452
3453         # Deduce the name of the destination old-style object file.
3454         case "$destfile" in
3455         *.lo)
3456           staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3457           ;;
3458         *.o | *.obj)
3459           staticdest="$destfile"
3460           destfile=
3461           ;;
3462         *)
3463           $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
3464           $echo "$help" 1>&2
3465           exit 1
3466           ;;
3467         esac
3468
3469         # Install the libtool object if requested.
3470         if test -n "$destfile"; then
3471           $show "$install_prog $file $destfile"
3472           $run eval "$install_prog $file $destfile" || exit $?
3473         fi
3474
3475         # Install the old object if enabled.
3476         if test "$build_old_libs" = yes; then
3477           # Deduce the name of the old-style object file.
3478           staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
3479
3480           $show "$install_prog $staticobj $staticdest"
3481           $run eval "$install_prog \$staticobj \$staticdest" || exit $?
3482         fi
3483         exit 0
3484         ;;
3485
3486       *)
3487         # Figure out destination file name, if it wasn't already specified.
3488         if test -n "$destname"; then
3489           destfile="$destdir/$destname"
3490         else
3491           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3492           destfile="$destdir/$destfile"
3493         fi
3494
3495         # Do a test to see if this is really a libtool program.
3496         if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3497           link_against_libtool_libs=
3498           relink_command=
3499
3500           # If there is no directory component, then add one.
3501           case "$file" in
3502           */* | *\\*) . $file ;;
3503           *) . ./$file ;;
3504           esac
3505
3506           # Check the variables that should have been set.
3507           if test -z "$link_against_libtool_libs"; then
3508             $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
3509             exit 1
3510           fi
3511
3512           finalize=yes
3513           for lib in $link_against_libtool_libs; do
3514             # Check to see that each library is installed.
3515             libdir=
3516             if test -f "$lib"; then
3517               # If there is no directory component, then add one.
3518               case "$lib" in
3519               */* | *\\*) . $lib ;;
3520               *) . ./$lib ;;
3521               esac
3522             fi
3523             libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
3524             if test -n "$libdir" && test ! -f "$libfile"; then
3525               $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
3526               finalize=no
3527             fi
3528           done
3529
3530           outputname=
3531           if test "$fast_install" = no && test -n "$relink_command"; then
3532             if test "$finalize" = yes && test -z "$run"; then
3533               tmpdir="/tmp"
3534               test -n "$TMPDIR" && tmpdir="$TMPDIR"
3535               tmpdir="$tmpdir/libtool-$$"
3536               if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
3537               else
3538                 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
3539                 continue
3540               fi
3541               outputname="$tmpdir/$file"
3542               # Replace the output file specification.
3543               relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3544
3545               $show "$relink_command"
3546               if $run eval "$relink_command"; then :
3547               else
3548                 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
3549                 ${rm}r "$tmpdir"
3550                 continue
3551               fi
3552               file="$outputname"
3553             else
3554               $echo "$modename: warning: cannot relink \`$file'" 1>&2
3555             fi
3556           else
3557             # Install the binary that we compiled earlier.
3558             file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
3559           fi
3560         fi
3561
3562         $show "$install_prog$stripme $file $destfile"
3563         $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
3564         test -n "$outputname" && ${rm}r "$tmpdir"
3565         ;;
3566       esac
3567     done
3568
3569     for file in $staticlibs; do
3570       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3571
3572       # Set up the ranlib parameters.
3573       oldlib="$destdir/$name"
3574
3575       $show "$install_prog $file $oldlib"
3576       $run eval "$install_prog \$file \$oldlib" || exit $?
3577
3578       # Do each command in the postinstall commands.
3579       eval cmds=\"$old_postinstall_cmds\"
3580       IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
3581       for cmd in $cmds; do
3582         IFS="$save_ifs"
3583         $show "$cmd"
3584         $run eval "$cmd" || exit $?
3585       done
3586       IFS="$save_ifs"
3587     done
3588
3589     if test -n "$future_libdirs"; then
3590       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
3591     fi
3592
3593     if test -n "$current_libdirs"; then
3594       # Maybe just do a dry run.
3595       test -n "$run" && current_libdirs=" -n$current_libdirs"
3596       exec $SHELL $0 --finish$current_libdirs
3597       exit 1
3598     fi
3599
3600     exit 0
3601     ;;
3602
3603   # libtool finish mode
3604   finish)
3605     modename="$modename: finish"
3606     libdirs="$nonopt"
3607     admincmds=
3608
3609     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3610       for dir
3611       do
3612         libdirs="$libdirs $dir"
3613       done
3614
3615       for libdir in $libdirs; do
3616         if test -n "$finish_cmds"; then
3617           # Do each command in the finish commands.
3618           eval cmds=\"$finish_cmds\"
3619           IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
3620           for cmd in $cmds; do
3621             IFS="$save_ifs"
3622             $show "$cmd"
3623             $run eval "$cmd" || admincmds="$admincmds
3624        $cmd"
3625           done
3626           IFS="$save_ifs"
3627         fi
3628         if test -n "$finish_eval"; then
3629           # Do the single finish_eval.
3630           eval cmds=\"$finish_eval\"
3631           $run eval "$cmds" || admincmds="$admincmds
3632        $cmds"
3633         fi
3634       done
3635     fi
3636
3637     # Exit here if they wanted silent mode.
3638     test "$show" = : && exit 0
3639
3640     echo "----------------------------------------------------------------------"
3641     echo "Libraries have been installed in:"
3642     for libdir in $libdirs; do
3643       echo "   $libdir"
3644     done
3645     echo
3646     echo "If you ever happen to want to link against installed libraries"
3647     echo "in a given directory, LIBDIR, you must either use libtool, and"
3648     echo "specify the full pathname of the library, or use \`-LLIBDIR'"
3649     echo "flag during linking and do at least one of the following:"
3650     if test -n "$shlibpath_var"; then
3651       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
3652       echo "     during execution"
3653     fi
3654     if test -n "$runpath_var"; then
3655       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
3656       echo "     during linking"
3657     fi
3658     if test -n "$hardcode_libdir_flag_spec"; then
3659       libdir=LIBDIR
3660       eval flag=\"$hardcode_libdir_flag_spec\"
3661
3662       echo "   - use the \`$flag' linker flag"
3663     fi
3664     if test -n "$admincmds"; then
3665       echo "   - have your system administrator run these commands:$admincmds"
3666     fi
3667     if test -f /etc/ld.so.conf; then
3668       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3669     fi
3670     echo
3671     echo "See any operating system documentation about shared libraries for"
3672     echo "more information, such as the ld(1) and ld.so(8) manual pages."
3673     echo "----------------------------------------------------------------------"
3674     exit 0
3675     ;;
3676
3677   # libtool execute mode
3678   execute)
3679     modename="$modename: execute"
3680
3681     # The first argument is the command name.
3682     cmd="$nonopt"
3683     if test -z "$cmd"; then
3684       $echo "$modename: you must specify a COMMAND" 1>&2
3685       $echo "$help"
3686       exit 1
3687     fi
3688
3689     # Handle -dlopen flags immediately.
3690     for file in $execute_dlfiles; do
3691       if test ! -f "$file"; then
3692         $echo "$modename: \`$file' is not a file" 1>&2
3693         $echo "$help" 1>&2
3694         exit 1
3695       fi
3696
3697       dir=
3698       case "$file" in
3699       *.la)
3700         # Check to see that this really is a libtool archive.
3701         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3702         else
3703           $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3704           $echo "$help" 1>&2
3705           exit 1
3706         fi
3707
3708         # Read the libtool library.
3709         dlname=
3710         library_names=
3711
3712         # If there is no directory component, then add one.
3713         case "$file" in
3714         */* | *\\*) . $file ;;
3715         *) . ./$file ;;
3716         esac
3717
3718         # Skip this library if it cannot be dlopened.
3719         if test -z "$dlname"; then
3720           # Warn if it was a shared library.
3721           test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
3722           continue
3723         fi
3724
3725         dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3726         test "X$dir" = "X$file" && dir=.
3727
3728         if test -f "$dir/$objdir/$dlname"; then
3729           dir="$dir/$objdir"
3730         else
3731           $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
3732           exit 1
3733         fi
3734         ;;
3735
3736       *.lo)
3737         # Just add the directory containing the .lo file.
3738         dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3739         test "X$dir" = "X$file" && dir=.
3740         ;;
3741
3742       *)
3743         $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
3744         continue
3745         ;;
3746       esac
3747
3748       # Get the absolute pathname.
3749       absdir=`cd "$dir" && pwd`
3750       test -n "$absdir" && dir="$absdir"
3751
3752       # Now add the directory to shlibpath_var.
3753       if eval "test -z \"\$$shlibpath_var\""; then
3754         eval "$shlibpath_var=\"\$dir\""
3755       else
3756         eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3757       fi
3758     done
3759
3760     # This variable tells wrapper scripts just to set shlibpath_var
3761     # rather than running their programs.
3762     libtool_execute_magic="$magic"
3763
3764     # Check if any of the arguments is a wrapper script.
3765     args=
3766     for file
3767     do
3768       case "$file" in
3769       -*) ;;
3770       *)
3771         # Do a test to see if this is really a libtool program.
3772         if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3773           # If there is no directory component, then add one.
3774           case "$file" in
3775           */* | *\\*) . $file ;;
3776           *) . ./$file ;;
3777           esac
3778
3779           # Transform arg to wrapped name.
3780           file="$progdir/$program"
3781         fi
3782         ;;
3783       esac
3784       # Quote arguments (to preserve shell metacharacters).
3785       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
3786       args="$args \"$file\""
3787     done
3788
3789     if test -z "$run"; then
3790       if test -n "$shlibpath_var"; then
3791         # Export the shlibpath_var.
3792         eval "export $shlibpath_var"
3793       fi
3794
3795       # Restore saved enviroment variables
3796       if test "${save_LC_ALL+set}" = set; then
3797         LC_ALL="$save_LC_ALL"; export LC_ALL
3798       fi
3799       if test "${save_LANG+set}" = set; then
3800         LANG="$save_LANG"; export LANG
3801       fi
3802
3803       # Now actually exec the command.
3804       eval "exec \$cmd$args"
3805
3806       $echo "$modename: cannot exec \$cmd$args"
3807       exit 1
3808     else
3809       # Display what would be done.
3810       if test -n "$shlibpath_var"; then
3811         eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
3812         $echo "export $shlibpath_var"
3813       fi
3814       $echo "$cmd$args"
3815       exit 0
3816     fi
3817     ;;
3818
3819   # libtool uninstall mode
3820   uninstall)
3821     modename="$modename: uninstall"
3822     rm="$nonopt"
3823     files=
3824
3825     for arg
3826     do
3827       case "$arg" in
3828       -*) rm="$rm $arg" ;;
3829       *) files="$files $arg" ;;
3830       esac
3831     done
3832
3833     if test -z "$rm"; then
3834       $echo "$modename: you must specify an RM program" 1>&2
3835       $echo "$help" 1>&2
3836       exit 1
3837     fi
3838
3839     for file in $files; do
3840       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3841       test "X$dir" = "X$file" && dir=.
3842       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3843
3844       rmfiles="$file"
3845
3846       case "$name" in
3847       *.la)
3848         # Possibly a libtool archive, so verify it.
3849         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3850           . $dir/$name
3851
3852           # Delete the libtool libraries and symlinks.
3853           for n in $library_names; do
3854             rmfiles="$rmfiles $dir/$n"
3855           done
3856           test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
3857
3858           $show "$rm $rmfiles"
3859           $run $rm $rmfiles
3860
3861           if test -n "$library_names"; then
3862             # Do each command in the postuninstall commands.
3863             eval cmds=\"$postuninstall_cmds\"
3864             IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
3865             for cmd in $cmds; do
3866               IFS="$save_ifs"
3867               $show "$cmd"
3868               $run eval "$cmd"
3869             done
3870             IFS="$save_ifs"
3871           fi
3872
3873           if test -n "$old_library"; then
3874             # Do each command in the old_postuninstall commands.
3875             eval cmds=\"$old_postuninstall_cmds\"
3876             IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
3877             for cmd in $cmds; do
3878               IFS="$save_ifs"
3879               $show "$cmd"
3880               $run eval "$cmd"
3881             done
3882             IFS="$save_ifs"
3883           fi
3884
3885           # FIXME: should reinstall the best remaining shared library.
3886         fi
3887         ;;
3888
3889       *.lo)
3890         if test "$build_old_libs" = yes; then
3891           oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
3892           rmfiles="$rmfiles $dir/$oldobj"
3893         fi
3894         $show "$rm $rmfiles"
3895         $run $rm $rmfiles
3896         ;;
3897
3898       *)
3899         $show "$rm $rmfiles"
3900         $run $rm $rmfiles
3901         ;;
3902       esac
3903     done
3904     exit 0
3905     ;;
3906
3907   "")
3908     $echo "$modename: you must specify a MODE" 1>&2
3909     $echo "$generic_help" 1>&2
3910     exit 1
3911     ;;
3912   esac
3913
3914   $echo "$modename: invalid operation mode \`$mode'" 1>&2
3915   $echo "$generic_help" 1>&2
3916   exit 1
3917 fi # test -z "$show_help"
3918
3919 # We need to display help for each of the modes.
3920 case "$mode" in
3921 "") $echo \
3922 "Usage: $modename [OPTION]... [MODE-ARG]...
3923
3924 Provide generalized library-building support services.
3925
3926     --config          show all configuration variables
3927     --debug           enable verbose shell tracing
3928 -n, --dry-run         display commands without modifying any files
3929     --features        display basic configuration information and exit
3930     --finish          same as \`--mode=finish'
3931     --help            display this help message and exit
3932     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
3933     --quiet           same as \`--silent'
3934     --silent          don't print informational messages
3935     --version         print version information
3936
3937 MODE must be one of the following:
3938
3939       compile         compile a source file into a libtool object
3940       execute         automatically set library path, then run a program
3941       finish          complete the installation of libtool libraries
3942       install         install libraries or executables
3943       link            create a library or an executable
3944       uninstall       remove libraries from an installed directory
3945
3946 MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
3947 a more detailed description of MODE."
3948   exit 0
3949   ;;
3950
3951 compile)
3952   $echo \
3953 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3954
3955 Compile a source file into a libtool library object.
3956
3957 This mode accepts the following additional options:
3958
3959   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
3960   -static           always build a \`.o' file suitable for static linking
3961
3962 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
3963 from the given SOURCEFILE.
3964
3965 The output file name is determined by removing the directory component from
3966 SOURCEFILE, then substituting the C source code suffix \`.c' with the
3967 library object suffix, \`.lo'."
3968   ;;
3969
3970 execute)
3971   $echo \
3972 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
3973
3974 Automatically set library path, then run a program.
3975
3976 This mode accepts the following additional options:
3977
3978   -dlopen FILE      add the directory containing FILE to the library path
3979
3980 This mode sets the library path environment variable according to \`-dlopen'
3981 flags.
3982
3983 If any of the ARGS are libtool executable wrappers, then they are translated
3984 into their corresponding uninstalled binary, and any of their required library
3985 directories are added to the library path.
3986
3987 Then, COMMAND is executed, with ARGS as arguments."
3988   ;;
3989
3990 finish)
3991   $echo \
3992 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
3993
3994 Complete the installation of libtool libraries.
3995
3996 Each LIBDIR is a directory that contains libtool libraries.
3997
3998 The commands that this mode executes may require superuser privileges.  Use
3999 the \`--dry-run' option if you just want to see what would be executed."
4000   ;;
4001
4002 install)
4003   $echo \
4004 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4005
4006 Install executables or libraries.
4007
4008 INSTALL-COMMAND is the installation command.  The first component should be
4009 either the \`install' or \`cp' program.
4010
4011 The rest of the components are interpreted as arguments to that command (only
4012 BSD-compatible install options are recognized)."
4013   ;;
4014
4015 link)
4016   $echo \
4017 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4018
4019 Link object files or libraries together to form another library, or to
4020 create an executable program.
4021
4022 LINK-COMMAND is a command using the C compiler that you would use to create
4023 a program from several object files.
4024
4025 The following components of LINK-COMMAND are treated specially:
4026
4027   -all-static       do not do any dynamic linking at all
4028   -avoid-version    do not add a version suffix if possible
4029   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
4030   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
4031   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4032   -export-symbols SYMFILE
4033                     try to export only the symbols listed in SYMFILE
4034   -export-symbols-regex REGEX
4035                     try to export only the symbols matching REGEX
4036   -LLIBDIR          search LIBDIR for required installed libraries
4037   -lNAME            OUTPUT-FILE requires the installed library libNAME
4038   -module           build a library that can dlopened
4039   -no-undefined     declare that a library does not refer to external symbols
4040   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
4041   -release RELEASE  specify package release information
4042   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
4043   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
4044   -static           do not do any dynamic linking of libtool libraries
4045   -version-info CURRENT[:REVISION[:AGE]]
4046                     specify library version info [each variable defaults to 0]
4047
4048 All other options (arguments beginning with \`-') are ignored.
4049
4050 Every other argument is treated as a filename.  Files ending in \`.la' are
4051 treated as uninstalled libtool libraries, other files are standard or library
4052 object files.
4053
4054 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4055 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4056 required, except when creating a convenience library.
4057
4058 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4059 using \`ar' and \`ranlib', or on Windows using \`lib'.
4060
4061 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4062 is created, otherwise an executable program is created."
4063   ;;
4064
4065 uninstall)
4066   $echo \
4067 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4068
4069 Remove libraries from an installation directory.
4070
4071 RM is the name of the program to use to delete files associated with each FILE
4072 (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
4073 to RM.
4074
4075 If FILE is a libtool library, all the files associated with it are deleted.
4076 Otherwise, only FILE itself is deleted using RM."
4077   ;;
4078
4079 *)
4080   $echo "$modename: invalid operation mode \`$mode'" 1>&2
4081   $echo "$help" 1>&2
4082   exit 1
4083   ;;
4084 esac
4085
4086 echo
4087 $echo "Try \`$modename --help' for more information about other modes."
4088
4089 exit 0
4090
4091 # Local Variables:
4092 # mode:shell-script
4093 # sh-indentation:2
4094 # End: