OSDN Git Service

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