]> git.sur5r.net Git - openldap/blob - build/ltmain.sh
Add changes to build environment support to support MacOS X (darwin).
[openldap] / build / ltmain.sh
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
3 #
4 # Copyright (C) 1996-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.4-freebsd-ports
58 TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
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           if test "$release_suffix" = all; then
956             release="$arg"
957           elif test "$release_suffix" = yes; then
958             release="-$arg"
959           fi
960           prev=
961           continue
962           ;;
963         rpath | xrpath)
964           # We need an absolute path.
965           case "$arg" in
966           [\\/]* | [A-Za-z]:[\\/]*) ;;
967           *)
968             $echo "$modename: only absolute run-paths are allowed" 1>&2
969             exit 1
970             ;;
971           esac
972           if test "$prev" = rpath; then
973             case "$rpath " in
974             *" $arg "*) ;;
975             *) rpath="$rpath $arg" ;;
976             esac
977           else
978             case "$xrpath " in
979             *" $arg "*) ;;
980             *) xrpath="$xrpath $arg" ;;
981             esac
982           fi
983           prev=
984           continue
985           ;;
986         *)
987           eval "$prev=\"\$arg\""
988           prev=
989           continue
990           ;;
991         esac
992       fi
993
994       prevarg="$arg"
995
996       case "$arg" in
997       -all-static)
998         if test -n "$link_static_flag"; then
999           compile_command="$compile_command $link_static_flag"
1000           finalize_command="$finalize_command $link_static_flag"
1001         fi
1002         continue
1003         ;;
1004
1005       -allow-undefined)
1006         # FIXME: remove this flag sometime in the future.
1007         $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1008         continue
1009         ;;
1010
1011       -avoid-version)
1012         build_old_libs=no
1013         avoid_version=yes
1014         continue
1015         ;;
1016
1017       -dlopen)
1018         prev=dlfiles
1019         continue
1020         ;;
1021
1022       -dlpreopen)
1023         prev=dlprefiles
1024         continue
1025         ;;
1026
1027       -export-dynamic)
1028         export_dynamic=yes
1029         continue
1030         ;;
1031
1032       -export-symbols | -export-symbols-regex)
1033         if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1034           $echo "$modename: not more than one -exported-symbols argument allowed"
1035           exit 1
1036         fi
1037         if test "X$arg" = "X-export-symbols"; then
1038           prev=expsyms
1039         else
1040           prev=expsyms_regex
1041         fi
1042         continue
1043         ;;
1044
1045       -L*)
1046         dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1047         # We need an absolute path.
1048         case "$dir" in
1049         [\\/]* | [A-Za-z]:[\\/]*) ;;
1050         *)
1051           absdir=`cd "$dir" && pwd`
1052           if test -z "$absdir"; then
1053             $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1054             $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1055             absdir="$dir"
1056           fi
1057           dir="$absdir"
1058           ;;
1059         esac
1060         case " $deplibs " in
1061         *" $arg "*) ;;
1062         *) deplibs="$deplibs $arg";;
1063         esac
1064         case " $lib_search_path " in
1065         *" $dir "*) ;;
1066         *) lib_search_path="$lib_search_path $dir";;
1067         esac
1068         case "$host" in
1069         *-*-cygwin* | *-*-mingw* | *-*-os2*)
1070           dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1071           case ":$dllsearchpath:" in
1072           ::) dllsearchpath="$dllsearchdir";;
1073           *":$dllsearchdir:"*) ;;
1074           *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
1075           esac
1076           ;;
1077         esac
1078         ;;
1079
1080       -l*)
1081         if test "$arg" = "-lc"; then
1082           case "$host" in
1083           *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1084             # These systems don't actually have c library (as such)
1085             continue
1086             ;;
1087           *-*-rhapsody* | *-*-darwin*)
1088             # Darwin C library is in the System framework
1089             deplibs="$deplibs -framework System"
1090             ;;
1091           esac
1092         elif test "$arg" = "-lm"; then
1093           case "$host" in
1094           *-*-cygwin* | *-*-beos*)
1095             # These systems don't actually have math library (as such)
1096             continue
1097             ;;
1098           *-*-rhapsody* | *-*-darwin*)
1099             # Darwin math library is in the System framework
1100             deplibs="$deplibs -framework System"
1101             ;;
1102           esac
1103         fi
1104         deplibs="$deplibs $arg"
1105         ;;
1106
1107       -?thread)
1108         deplibs="$deplibs $arg"
1109         ;;
1110
1111       -module)
1112         module=yes
1113         continue
1114         ;;
1115
1116       -no-undefined)
1117         allow_undefined=no
1118         continue
1119         ;;
1120
1121       -o) prev=output ;;
1122
1123       -release)
1124         prev=release
1125         continue
1126         ;;
1127
1128       -rpath)
1129         prev=rpath
1130         continue
1131         ;;
1132
1133       -R)
1134         prev=xrpath
1135         continue
1136         ;;
1137
1138       -R*)
1139         dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1140         # We need an absolute path.
1141         case "$dir" in
1142         [\\/]* | [A-Za-z]:[\\/]*) ;;
1143         *)
1144           $echo "$modename: only absolute run-paths are allowed" 1>&2
1145           exit 1
1146           ;;
1147         esac
1148         case "$xrpath " in
1149         *" $dir "*) ;;
1150         *) xrpath="$xrpath $dir" ;;
1151         esac
1152         continue
1153         ;;
1154
1155       -static)
1156         # If we have no pic_flag, then this is the same as -all-static.
1157         if test -z "$pic_flag" && test -n "$link_static_flag"; then
1158           compile_command="$compile_command $link_static_flag"
1159           finalize_command="$finalize_command $link_static_flag"
1160         fi
1161         continue
1162         ;;
1163
1164       -thread-safe)
1165         thread_safe=yes
1166         continue
1167         ;;
1168
1169       -version-info)
1170         prev=vinfo
1171         continue
1172         ;;
1173
1174       # Some other compiler flag.
1175       -* | +*)
1176         # Unknown arguments in both finalize_command and compile_command need
1177         # to be aesthetically quoted because they are evaled later.
1178         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1179         case "$arg" in
1180         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
1181           arg="\"$arg\""
1182           ;;
1183         esac
1184         ;;
1185
1186       *.o | *.obj | *.a | *.lib)
1187         # A standard object.
1188         libobjs="$libobjs $arg"
1189         ;;
1190
1191       *.lo)
1192         # A library object.
1193         if test "$prev" = dlfiles; then
1194           dlfiles="$dlfiles $arg"
1195           if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1196             prev=
1197             continue
1198           else
1199             # If libtool objects are unsupported, then we need to preload.
1200             prev=dlprefiles
1201           fi
1202         fi
1203
1204         if test "$prev" = dlprefiles; then
1205           # Preload the old-style object.
1206           dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1207           prev=
1208         fi
1209         libobjs="$libobjs $arg"
1210         ;;
1211
1212       *.la)
1213         # A libtool-controlled library.
1214
1215         dlname=
1216         libdir=
1217         library_names=
1218         old_library=
1219
1220         # Check to see that this really is a libtool archive.
1221         if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1222         else
1223           $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1224           exit 1
1225         fi
1226
1227         # If the library was installed with an old release of libtool,
1228         # it will not redefine variable installed.
1229         installed=yes
1230
1231         # Read the .la file
1232         # If there is no directory component, then add one.
1233         case "$arg" in
1234         */* | *\\*) . $arg ;;
1235         *) . ./$arg ;;
1236         esac
1237
1238         # Get the name of the library we link against.
1239         linklib=
1240         for l in $old_library $library_names; do
1241           linklib="$l"
1242         done
1243
1244         if test -z "$linklib"; then
1245           $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
1246           exit 1
1247         fi
1248
1249         # Find the relevant object directory and library name.
1250         name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1251
1252         if test "X$installed" = Xyes; then
1253           dir="$libdir"
1254         else
1255           dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1256           if test "X$dir" = "X$arg"; then
1257             dir="$objdir"
1258           else
1259             dir="$dir/$objdir"
1260           fi
1261         fi
1262
1263         if test -n "$dependency_libs"; then
1264           # Extract -R and -L from dependency_libs
1265           temp_deplibs=
1266           for deplib in $dependency_libs; do
1267             case "$deplib" in
1268             -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1269                  case " $rpath $xrpath " in
1270                  *" $temp_xrpath "*) ;;
1271                  *) xrpath="$xrpath $temp_xrpath";;
1272                  esac;;
1273             -L*) case "$compile_command $temp_deplibs " in
1274                  *" $deplib "*) ;;
1275                  *) temp_deplibs="$temp_deplibs $deplib";;
1276                  esac
1277                  temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1278                  case " $lib_search_path " in
1279                  *" $temp_dir "*) ;;
1280                  *) lib_search_path="$lib_search_path $temp_dir";;
1281                  esac
1282                  ;;
1283             *) temp_deplibs="$temp_deplibs $deplib";;
1284             esac
1285           done
1286           dependency_libs="$temp_deplibs"
1287         fi
1288
1289         if test -z "$libdir"; then
1290           # It is a libtool convenience library, so add in its objects.
1291           convenience="$convenience $dir/$old_library"
1292           old_convenience="$old_convenience $dir/$old_library"
1293           deplibs="$deplibs$dependency_libs"
1294           compile_command="$compile_command $dir/$old_library$dependency_libs"
1295           finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1296           continue
1297         fi
1298
1299         # This library was specified with -dlopen.
1300         if test "$prev" = dlfiles; then
1301           dlfiles="$dlfiles $arg"
1302           if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1303             # If there is no dlname, no dlopen support or we're linking statically,
1304             # we need to preload.
1305             prev=dlprefiles
1306           else
1307             # We should not create a dependency on this library, but we
1308             # may need any libraries it requires.
1309             compile_command="$compile_command$dependency_libs"
1310             finalize_command="$finalize_command$dependency_libs"
1311             prev=
1312             continue
1313           fi
1314         fi
1315
1316         # The library was specified with -dlpreopen.
1317         if test "$prev" = dlprefiles; then
1318           # Prefer using a static library (so that no silly _DYNAMIC symbols
1319           # are required to link).
1320           if test -n "$old_library"; then
1321             dlprefiles="$dlprefiles $dir/$old_library"
1322           else
1323             dlprefiles="$dlprefiles $dir/$linklib"
1324           fi
1325           prev=
1326         fi
1327
1328         if test -n "$library_names" &&
1329            { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1330           link_against_libtool_libs="$link_against_libtool_libs $arg"
1331           if test -n "$shlibpath_var"; then
1332             # Make sure the rpath contains only unique directories.
1333             case "$temp_rpath " in
1334             *" $dir "*) ;;
1335             *) temp_rpath="$temp_rpath $dir" ;;
1336             esac
1337           fi
1338
1339           # We need an absolute path.
1340           case "$dir" in
1341           [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1342           *)
1343             absdir=`cd "$dir" && pwd`
1344             if test -z "$absdir"; then
1345               $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1346               $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1347               absdir="$dir"
1348             fi
1349             ;;
1350           esac
1351           
1352           # This is the magic to use -rpath.
1353           # Skip directories that are in the system default run-time
1354           # search path, unless they have been requested with -R.
1355           case " $sys_lib_dlsearch_path " in
1356           *" $absdir "*) ;;
1357           *)
1358             case "$compile_rpath " in
1359             *" $absdir "*) ;;
1360             *) compile_rpath="$compile_rpath $absdir" 
1361             esac
1362             ;;
1363           esac
1364
1365           case " $sys_lib_dlsearch_path " in
1366           *" $libdir "*) ;;
1367           *)
1368             case "$finalize_rpath " in
1369             *" $libdir "*) ;;
1370             *) finalize_rpath="$finalize_rpath $libdir"
1371             esac
1372             ;;
1373           esac
1374
1375           lib_linked=yes
1376           case "$hardcode_action" in
1377           immediate | unsupported)
1378             if test "$hardcode_direct" = no; then
1379               compile_command="$compile_command $dir/$linklib"
1380               deplibs="$deplibs $dir/$linklib"
1381               case "$host" in
1382               *-*-cygwin* | *-*-mingw* | *-*-os2*)
1383                 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1384                 if test -n "$dllsearchpath"; then
1385                   dllsearchpath="$dllsearchpath:$dllsearchdir"
1386                 else
1387                   dllsearchpath="$dllsearchdir"
1388                 fi
1389                 ;;
1390               esac
1391             elif test "$hardcode_minus_L" = no; then
1392               case "$host" in
1393               *-*-sunos*)
1394                 compile_shlibpath="$compile_shlibpath$dir:"
1395                 ;;
1396               esac
1397               case "$compile_command " in
1398               *" -L$dir "*) ;;
1399               *) compile_command="$compile_command -L$dir";;
1400               esac
1401               compile_command="$compile_command -l$name"
1402               deplibs="$deplibs -L$dir -l$name"
1403             elif test "$hardcode_shlibpath_var" = no; then
1404               case ":$compile_shlibpath:" in
1405               *":$dir:"*) ;;
1406               *) compile_shlibpath="$compile_shlibpath$dir:";;
1407               esac
1408               compile_command="$compile_command -l$name"
1409               deplibs="$deplibs -l$name"
1410             else
1411               lib_linked=no
1412             fi
1413             ;;
1414
1415           relink)
1416             if test "$hardcode_direct" = yes; then
1417               compile_command="$compile_command $absdir/$linklib"
1418               deplibs="$deplibs $absdir/$linklib"
1419             elif test "$hardcode_minus_L" = yes; then
1420               case "$compile_command " in
1421               *" -L$absdir "*) ;;
1422               *) compile_command="$compile_command -L$absdir";;
1423               esac
1424               compile_command="$compile_command -l$name"
1425               deplibs="$deplibs -L$absdir -l$name"
1426             elif test "$hardcode_shlibpath_var" = yes; then
1427               case ":$compile_shlibpath:" in
1428               *":$absdir:"*) ;;
1429               *) compile_shlibpath="$compile_shlibpath$absdir:";;
1430               esac
1431               compile_command="$compile_command -l$name"
1432               deplibs="$deplibs -l$name"
1433             else
1434               lib_linked=no
1435             fi
1436             ;;
1437
1438           *)
1439             lib_linked=no
1440             ;;
1441           esac
1442
1443           if test "$lib_linked" != yes; then
1444             $echo "$modename: configuration error: unsupported hardcode properties"
1445             exit 1
1446           fi
1447
1448           # Finalize command for both is simple: just hardcode it.
1449           if test "$hardcode_direct" = yes; then
1450             finalize_command="$finalize_command $libdir/$linklib"
1451           elif test "$hardcode_minus_L" = yes; then
1452             case "$finalize_command " in
1453             *" -L$libdir "*) ;;
1454             *) finalize_command="$finalize_command -L$libdir";;
1455             esac
1456             finalize_command="$finalize_command -l$name"
1457           elif test "$hardcode_shlibpath_var" = yes; then
1458             case ":$finalize_shlibpath:" in
1459             *":$libdir:"*) ;;
1460             *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1461             esac
1462             finalize_command="$finalize_command -l$name"
1463           else
1464             # We cannot seem to hardcode it, guess we'll fake it.
1465             case "$finalize_command " in
1466             *" -L$dir "*) ;;
1467             *) finalize_command="$finalize_command -L$libdir";;
1468             esac
1469             finalize_command="$finalize_command -l$name"
1470           fi
1471         else
1472           # Transform directly to old archives if we don't build new libraries.
1473           if test -n "$pic_flag" && test -z "$old_library"; then
1474             $echo "$modename: cannot find static library for \`$arg'" 1>&2
1475             exit 1
1476           fi
1477
1478           # Here we assume that one of hardcode_direct or hardcode_minus_L
1479           # is not unsupported.  This is valid on all known static and
1480           # shared platforms.
1481           if test "$hardcode_direct" != unsupported; then
1482             test -n "$old_library" && linklib="$old_library"
1483             compile_command="$compile_command $dir/$linklib"
1484             finalize_command="$finalize_command $dir/$linklib"
1485           else
1486             case "$compile_command " in
1487             *" -L$dir "*) ;;
1488             *) compile_command="$compile_command -L$dir";;
1489             esac
1490             compile_command="$compile_command -l$name"
1491             case "$finalize_command " in
1492             *" -L$dir "*) ;;
1493             *) finalize_command="$finalize_command -L$dir";;
1494             esac
1495             finalize_command="$finalize_command -l$name"
1496           fi
1497         fi
1498
1499         # Add in any libraries that this one depends upon.
1500         compile_command="$compile_command$dependency_libs"
1501         finalize_command="$finalize_command$dependency_libs"
1502         continue
1503         ;;
1504
1505       # Some other compiler argument.
1506       *)
1507         # Unknown arguments in both finalize_command and compile_command need
1508         # to be aesthetically quoted because they are evaled later.
1509         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1510         case "$arg" in
1511         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
1512           arg="\"$arg\""
1513           ;;
1514         esac
1515         ;;
1516       esac
1517
1518       # Now actually substitute the argument into the commands.
1519       if test -n "$arg"; then
1520         compile_command="$compile_command $arg"
1521         finalize_command="$finalize_command $arg"
1522       fi
1523     done
1524
1525     if test -n "$prev"; then
1526       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1527       $echo "$help" 1>&2
1528       exit 1
1529     fi
1530
1531     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1532       eval arg=\"$export_dynamic_flag_spec\"
1533       compile_command="$compile_command $arg"
1534       finalize_command="$finalize_command $arg"
1535     fi
1536
1537     oldlibs=
1538     # calculate the name of the file, without its directory
1539     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1540     libobjs_save="$libobjs"
1541
1542     case "$output" in
1543     "")
1544       $echo "$modename: you must specify an output file" 1>&2
1545       $echo "$help" 1>&2
1546       exit 1
1547       ;;
1548
1549     *.a | *.lib)
1550       if test -n "$link_against_libtool_libs"; then
1551         $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1552         exit 1
1553       fi
1554
1555       if test -n "$deplibs"; then
1556         $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1557       fi
1558
1559       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1560         $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1561       fi
1562
1563       if test -n "$rpath"; then
1564         $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
1565       fi
1566
1567       if test -n "$xrpath"; then
1568         $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
1569       fi
1570
1571       if test -n "$vinfo"; then
1572         $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
1573       fi
1574
1575       if test -n "$release"; then
1576         $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
1577       fi
1578
1579       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1580         $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
1581       fi
1582
1583       # Now set the variables for building old libraries.
1584       build_libtool_libs=no
1585       oldlibs="$output"
1586       ;;
1587
1588     *.la)
1589       # Make sure we only generate libraries of the form `libNAME.la'.
1590       case "$outputname" in
1591       lib*)
1592         name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1593         eval libname=\"$libname_spec\"
1594         ;;
1595       *)
1596         if test "$module" = no; then
1597           $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
1598           $echo "$help" 1>&2
1599           exit 1
1600         fi
1601         if test "$need_lib_prefix" != no; then
1602           # Add the "lib" prefix for modules if required
1603           name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1604           eval libname=\"$libname_spec\"
1605         else
1606           libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1607         fi
1608         ;;
1609       esac
1610
1611       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1612       if test "X$output_objdir" = "X$output"; then
1613         output_objdir="$objdir"
1614       else
1615         output_objdir="$output_objdir/$objdir"
1616       fi
1617
1618       if test -n "$objs"; then
1619         $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1620         exit 1
1621       fi
1622
1623       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1624         $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
1625       fi
1626
1627       set dummy $rpath
1628       if test $# -gt 2; then
1629         $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1630       fi
1631       install_libdir="$2"
1632
1633       oldlibs=
1634       if test -z "$rpath"; then
1635         if test "$build_libtool_libs" = yes; then
1636           # Building a libtool convenience library.
1637           libext=al
1638           oldlibs="$output_objdir/$libname.$libext $oldlibs"
1639           build_libtool_libs=convenience
1640           build_old_libs=yes
1641         fi
1642         dependency_libs="$deplibs"
1643
1644         if test -n "$vinfo"; then
1645           $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1646         fi
1647
1648         if test -n "$release"; then
1649           $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
1650         fi
1651       else
1652
1653         # Parse the version information argument.
1654         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
1655         set dummy $vinfo 0 0 0
1656         IFS="$save_ifs"
1657
1658         if test -n "$8"; then
1659           $echo "$modename: too many parameters to \`-version-info'" 1>&2
1660           $echo "$help" 1>&2
1661           exit 1
1662         fi
1663
1664         current="$2"
1665         revision="$3"
1666         age="$4"
1667
1668         # Check that each of the things are valid numbers.
1669         case "$current" in
1670         0 | [1-9] | [1-9][0-9]*) ;;
1671         *)
1672           $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1673           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1674           exit 1
1675           ;;
1676         esac
1677
1678         case "$revision" in
1679         0 | [1-9] | [1-9][0-9]*) ;;
1680         *)
1681           $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1682           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1683           exit 1
1684           ;;
1685         esac
1686
1687         case "$age" in
1688         0 | [1-9] | [1-9][0-9]*) ;;
1689         *)
1690           $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1691           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1692           exit 1
1693           ;;
1694         esac
1695
1696         if test $age -gt $current; then
1697           $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1698           $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1699           exit 1
1700         fi
1701
1702         # Calculate the version variables.
1703         major=
1704         versuffix=
1705         verstring=
1706         case "$version_type" in
1707         none) ;;
1708
1709         irix)
1710           major=`expr $current - $age + 1`
1711           versuffix="$major.$revision"
1712           verstring="sgi$major.$revision"
1713
1714           # Add in all the interfaces that we are compatible with.
1715           loop=$revision
1716           while test $loop != 0; do
1717             iface=`expr $revision - $loop`
1718             loop=`expr $loop - 1`
1719             verstring="sgi$major.$iface:$verstring"
1720           done
1721           ;;
1722
1723         linux)
1724           major=.`expr $current - $age`
1725           versuffix="$major.$age.$revision"
1726           ;;
1727
1728         osf)
1729           major=`expr $current - $age`
1730           versuffix=".$current.$age.$revision"
1731           verstring="$current.$age.$revision"
1732
1733           # Add in all the interfaces that we are compatible with.
1734           loop=$age
1735           while test $loop != 0; do
1736             iface=`expr $current - $loop`
1737             loop=`expr $loop - 1`
1738             verstring="$verstring:${iface}.0"
1739           done
1740
1741           # Make executables depend on our current version.
1742           verstring="$verstring:${current}.0"
1743           ;;
1744
1745         sunos)
1746           major=".$current"
1747           versuffix=".$current.$revision"
1748           ;;
1749
1750         freebsd-aout)
1751           major=".$current"
1752           versuffix=".$current.$revision";
1753           ;;
1754
1755         freebsd-elf)
1756           major=".$current"
1757           versuffix=".$current";
1758           ;;
1759
1760         windows)
1761           # Like Linux, but with '-' rather than '.', since we only
1762           # want one extension on Windows 95.
1763           major=`expr $current - $age`
1764           versuffix="-$major-$age-$revision"
1765           ;;
1766
1767         *)
1768           $echo "$modename: unknown library version type \`$version_type'" 1>&2
1769           echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
1770           exit 1
1771           ;;
1772         esac
1773
1774         # Clear the version info if we defaulted, and they specified a release.
1775         if test -z "$vinfo" && test -n "$release"; then
1776           major=
1777           verstring="0.0"
1778           if test "$need_version" = no; then
1779             versuffix=
1780           else
1781             versuffix=".0.0"
1782           fi
1783         fi
1784
1785         # Remove version info from name if versioning should be avoided
1786         if test "$avoid_version" = yes && test "$need_version" = no; then
1787           major=
1788           versuffix=
1789           verstring=""
1790         fi
1791         
1792         # Check to see if the archive will have undefined symbols.
1793         if test "$allow_undefined" = yes; then
1794           if test "$allow_undefined_flag" = unsupported; then
1795             $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1796             build_libtool_libs=no
1797             build_old_libs=yes
1798           fi
1799         else
1800           # Don't allow undefined symbols.
1801           allow_undefined_flag="$no_undefined_flag"
1802         fi
1803
1804         dependency_libs="$deplibs"
1805         case "$host" in
1806         *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1807           # these systems don't actually have a c library (as such)!
1808           ;;
1809         *-*-freebsd*)
1810           # FreeBSD doesn't need this...
1811           ;;
1812         *)
1813           # Add libc to deplibs on all other systems.
1814           deplibs="$deplibs -lc"
1815           ;;
1816         esac
1817       fi
1818
1819       if test -n "$rpath$xrpath"; then
1820         # If the user specified any rpath flags, then add them.
1821         for libdir in $rpath $xrpath; do
1822           # This is the magic to use -rpath.
1823           case "$compile_rpath " in
1824           *" $libdir "*) ;;
1825           *) compile_rpath="$compile_rpath $libdir" ;;
1826           esac
1827           case "$finalize_rpath " in
1828           *" $libdir "*) ;;
1829           *) finalize_rpath="$finalize_rpath $libdir" ;;
1830           esac
1831         done
1832       fi
1833
1834       # Now hardcode the library paths
1835       rpath=
1836       hardcode_libdirs=
1837       for libdir in $compile_rpath; do
1838         if test -n "$hardcode_libdir_flag_spec"; then
1839           if test -n "$hardcode_libdir_separator"; then
1840             if test -z "$hardcode_libdirs"; then
1841               hardcode_libdirs="$libdir"
1842             else
1843               # Just accumulate the unique libdirs.
1844               case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1845               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1846                 ;;
1847               *)
1848                 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1849                 ;;
1850               esac
1851             fi
1852           else
1853             eval flag=\"$hardcode_libdir_flag_spec\"
1854             rpath="$rpath $flag"
1855           fi
1856         elif test -n "$runpath_var"; then
1857           case "$perm_rpath " in
1858           *" $libdir "*) ;;
1859           *) perm_rpath="$perm_rpath $libdir" ;;
1860           esac
1861         fi
1862       done
1863       # Substitute the hardcoded libdirs into the rpath.
1864       if test -n "$hardcode_libdir_separator" &&
1865          test -n "$hardcode_libdirs"; then
1866         libdir="$hardcode_libdirs"
1867         eval rpath=\" $hardcode_libdir_flag_spec\"
1868       fi
1869       compile_rpath="$rpath"
1870
1871       rpath=
1872       hardcode_libdirs=
1873       for libdir in $finalize_rpath; do
1874         if test -n "$hardcode_libdir_flag_spec"; then
1875           if test -n "$hardcode_libdir_separator"; then
1876             if test -z "$hardcode_libdirs"; then
1877               hardcode_libdirs="$libdir"
1878             else
1879               # Just accumulate the unique libdirs.
1880               case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1881               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1882                 ;;
1883               *)
1884                 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1885                 ;;
1886               esac
1887             fi
1888           else
1889             eval flag=\"$hardcode_libdir_flag_spec\"
1890             rpath="$rpath $flag"
1891           fi
1892         elif test -n "$runpath_var"; then
1893           case "$finalize_perm_rpath " in
1894           *" $libdir "*) ;;
1895           *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
1896           esac
1897         fi
1898       done
1899       # Substitute the hardcoded libdirs into the rpath.
1900       if test -n "$hardcode_libdir_separator" &&
1901          test -n "$hardcode_libdirs"; then
1902         libdir="$hardcode_libdirs"
1903         eval rpath=\" $hardcode_libdir_flag_spec\"
1904       fi
1905       finalize_rpath="$rpath"
1906
1907       # Create the output directory, or remove our outputs if we need to.
1908       if test -d $output_objdir; then
1909         $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1910         $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1911       else
1912         $show "$mkdir $output_objdir"
1913         $run $mkdir $output_objdir
1914         status=$?
1915         if test $status -ne 0 && test ! -d $output_objdir; then
1916           exit $status
1917         fi
1918       fi
1919
1920       # Now set the variables for building old libraries.
1921       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1922         if test "$release_suffix" = all; then
1923          oldlibs="$oldlibs $output_objdir/$libname$release.$libext"
1924         else
1925          oldlibs="$oldlibs $output_objdir/$libname.$libext"
1926         fi
1927
1928         # Transform .lo files to .o files.
1929         oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1930       fi
1931
1932       if test "$build_libtool_libs" = yes; then
1933         # Transform deplibs into only deplibs that can be linked in shared.
1934         name_save=$name
1935         libname_save=$libname
1936         release_save=$release
1937         versuffix_save=$versuffix
1938         major_save=$major
1939         # I'm not sure if I'm treating the release correctly.  I think
1940         # release should show up in the -l (ie -lgmp5) so we don't want to
1941         # add it in twice.  Is that correct?
1942         release=""
1943         versuffix=""
1944         major=""
1945         newdeplibs=
1946         droppeddeps=no
1947         case "$deplibs_check_method" in
1948         pass_all)
1949           # Don't check for shared/static.  Everything works.
1950           # This might be a little naive.  We might want to check
1951           # whether the library exists or not.  But this is on
1952           # osf3 & osf4 and I'm not really sure... Just
1953           # implementing what was already the behaviour.
1954           newdeplibs=$deplibs
1955           ;;
1956         test_compile)
1957           # This code stresses the "libraries are programs" paradigm to its
1958           # limits. Maybe even breaks it.  We compile a program, linking it
1959           # against the deplibs as a proxy for the library.  Then we can check
1960           # whether they linked in statically or dynamically with ldd.
1961           $rm conftest.c
1962           cat > conftest.c <<EOF
1963           int main() { return 0; }
1964 EOF
1965           $rm conftest
1966           $CC -o conftest conftest.c $deplibs
1967           if test $? -eq 0 ; then
1968             ldd_output=`ldd conftest`
1969             for i in $deplibs; do
1970               name="`expr $i : '-l\(.*\)'`"
1971               # If $name is empty we are operating on a -L argument.
1972               if test "$name" != "" ; then
1973                 libname=`eval \\$echo \"$libname_spec\"`
1974                 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1975                 set dummy $deplib_matches
1976                 deplib_match=$2
1977                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1978                   newdeplibs="$newdeplibs $i"
1979                 else
1980                   droppeddeps=yes
1981                   echo
1982                   echo "*** Warning: This library needs some functionality provided by $i."
1983                   echo "*** I have the capability to make that library automatically link in when"
1984                   echo "*** you link to this library.  But I can only do this if you have a"
1985                   echo "*** shared version of the library, which you do not appear to have."
1986                 fi
1987               else
1988                 newdeplibs="$newdeplibs $i"
1989               fi
1990             done
1991           else
1992             # Error occured in the first compile.  Let's try to salvage the situation:
1993             # Compile a seperate program for each library.
1994             for i in $deplibs; do
1995               name="`expr $i : '-l\(.*\)'`"
1996              # If $name is empty we are operating on a -L argument.
1997               if test "$name" != "" ; then
1998                 $rm conftest
1999                 $CC -o conftest conftest.c $i
2000                 # Did it work?
2001                 if test $? -eq 0 ; then
2002                   ldd_output=`ldd conftest`
2003                   libname=`eval \\$echo \"$libname_spec\"`
2004                   deplib_matches=`eval \\$echo \"$library_names_spec\"`
2005                   set dummy $deplib_matches
2006                   deplib_match=$2
2007                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2008                     newdeplibs="$newdeplibs $i"
2009                   else
2010                     droppeddeps=yes
2011                     echo
2012                     echo "*** Warning: This library needs some functionality provided by $i."
2013                     echo "*** I have the capability to make that library automatically link in when"
2014                     echo "*** you link to this library.  But I can only do this if you have a"
2015                     echo "*** shared version of the library, which you do not appear to have."
2016                   fi
2017                 else
2018                   droppeddeps=yes
2019                   echo
2020                   echo "*** Warning!  Library $i is needed by this library but I was not able to"
2021                   echo "***  make it link in!  You will probably need to install it or some"
2022                   echo "*** library that it depends on before this library will be fully"
2023                   echo "*** functional.  Installing it before continuing would be even better."
2024                 fi
2025               else
2026                 newdeplibs="$newdeplibs $i"
2027               fi
2028             done
2029           fi
2030           ;;
2031         file_magic*)
2032           set dummy $deplibs_check_method
2033           file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
2034           for a_deplib in $deplibs; do
2035             name="`expr $a_deplib : '-l\(.*\)'`"
2036             # If $name is empty we are operating on a -L argument.
2037             if test "$name" != "" ; then
2038               libname=`eval \\$echo \"$libname_spec\"`
2039               for i in $lib_search_path; do
2040                     potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2041                     for potent_lib in $potential_libs; do
2042                       # Follow soft links.
2043                       if ls -lLd "$potent_lib" 2>/dev/null \
2044                          | grep " -> " >/dev/null; then
2045                         continue 
2046                       fi
2047                       # The statement above tries to avoid entering an
2048                       # endless loop below, in case of cyclic links.
2049                       # We might still enter an endless loop, since a link
2050                       # loop can be closed while we follow links,
2051                       # but so what?
2052                       potlib="$potent_lib"
2053                       while test -h "$potlib" 2>/dev/null; do
2054                         potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2055                         case "$potliblink" in
2056                         [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2057                         *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2058                         esac
2059                       done
2060                       if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2061                          | sed 10q \
2062                          | egrep "$file_magic_regex" > /dev/null; then
2063                         newdeplibs="$newdeplibs $a_deplib"
2064                         a_deplib=""
2065                         break 2
2066                       fi
2067                     done
2068               done
2069               if test -n "$a_deplib" ; then
2070                 droppeddeps=yes
2071                 echo
2072                 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2073                 echo "*** I have the capability to make that library automatically link in when"
2074                 echo "*** you link to this library.  But I can only do this if you have a"
2075                 echo "*** shared version of the library, which you do not appear to have."
2076               fi
2077             else
2078               # Add a -L argument.
2079               newdeplibs="$newdeplibs $a_deplib"
2080             fi
2081           done # Gone through all deplibs.
2082           ;;
2083         none | unknown | *)
2084           newdeplibs=""
2085           if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2086                -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
2087              grep . >/dev/null; then
2088             echo
2089             if test "X$deplibs_check_method" = "Xnone"; then
2090               echo "*** Warning: inter-library dependencies are not supported in this platform."
2091             else
2092               echo "*** Warning: inter-library dependencies are not known to be supported."
2093             fi
2094             echo "*** All declared inter-library dependencies are being dropped."
2095             droppeddeps=yes
2096           fi
2097           ;;
2098         esac
2099         versuffix=$versuffix_save
2100         major=$major_save
2101         release=$release_save
2102         libname=$libname_save
2103         name=$name_save
2104
2105         if test "$droppeddeps" = yes; then
2106           if test "$module" = yes; then
2107             echo
2108             echo "*** Warning: libtool could not satisfy all declared inter-library"
2109             echo "*** dependencies of module $libname.  Therefore, libtool will create"
2110             echo "*** a static module, that should work as long as the dlopening"
2111             echo "*** application is linked with the -dlopen flag."
2112             if test -z "$global_symbol_pipe"; then
2113               echo
2114               echo "*** However, this would only work if libtool was able to extract symbol"
2115               echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2116               echo "*** not find such a program.  So, this module is probably useless."
2117               echo "*** \`nm' from GNU binutils and a full rebuild may help."
2118             fi
2119             if test "$build_old_libs" = no; then
2120               if test "$release_suffix" = all; then
2121                 oldlibs="$output_objdir/$libname$release.$libext"
2122               else
2123                 oldlibs="$output_objdir/$libname.$libext"
2124               fi
2125               build_libtool_libs=module
2126               build_old_libs=yes
2127             else
2128               build_libtool_libs=no
2129             fi
2130           else
2131             echo "*** The inter-library dependencies that have been dropped here will be"
2132             echo "*** automatically added whenever a program is linked with this library"
2133             echo "*** or is declared to -dlopen it."
2134           fi
2135         fi
2136         # Done checking deplibs!
2137         deplibs=$newdeplibs
2138       fi
2139
2140       # All the library-specific variables (install_libdir is set above).
2141       library_names=
2142       old_library=
2143       dlname=
2144       
2145       # Test again, we may have decided not to build it any more
2146       if test "$build_libtool_libs" = yes; then
2147         # Get the real and link names of the library.
2148         eval library_names=\"$library_names_spec\"
2149         set dummy $library_names
2150         realname="$2"
2151         shift; shift
2152
2153         if test -n "$soname_spec"; then
2154           eval soname=\"$soname_spec\"
2155         else
2156           soname="$realname"
2157         fi
2158
2159         lib="$output_objdir/$realname"
2160         for link
2161         do
2162           linknames="$linknames $link"
2163         done
2164
2165         # Ensure that we have .o objects for linkers which dislike .lo
2166         # (e.g. aix) in case we are running --disable-static
2167         for obj in $libobjs; do
2168           xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2169           if test "X$xdir" = "X$obj"; then
2170             xdir="."
2171           else
2172             xdir="$xdir"
2173           fi
2174           baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2175           oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2176           if test ! -f $xdir/$oldobj; then
2177             $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2178             $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2179           fi
2180         done
2181
2182         # Use standard objects if they are pic
2183         test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2184
2185         # Prepare the list of exported symbols
2186         if test -z "$export_symbols"; then
2187           if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2188             $show "generating symbol list for \`$libname.la'"
2189             export_symbols="$output_objdir/$libname.exp"
2190             $run $rm $export_symbols
2191             eval cmds=\"$export_symbols_cmds\"
2192             IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
2193             for cmd in $cmds; do
2194               IFS="$save_ifs"
2195               $show "$cmd"
2196               $run eval "$cmd" || exit $?
2197             done
2198             IFS="$save_ifs"
2199             if test -n "$export_symbols_regex"; then
2200               $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2201               $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2202               $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2203               $run eval '$mv "${export_symbols}T" "$export_symbols"'
2204             fi
2205           fi
2206         fi
2207
2208         if test -n "$export_symbols" && test -n "$include_expsyms"; then
2209           $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2210         fi
2211
2212         if test -n "$convenience"; then
2213           if test -n "$whole_archive_flag_spec"; then
2214             eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2215           else
2216             gentop="$output_objdir/${outputname}x"
2217             $show "${rm}r $gentop"
2218             $run ${rm}r "$gentop"
2219             $show "mkdir $gentop"
2220             $run mkdir "$gentop"
2221             status=$?
2222             if test $status -ne 0 && test ! -d "$gentop"; then
2223               exit $status
2224             fi
2225             generated="$generated $gentop"
2226
2227             for xlib in $convenience; do
2228               # Extract the objects.
2229               case "$xlib" in
2230               [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2231               *) xabs=`pwd`"/$xlib" ;;
2232               esac
2233               xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2234               xdir="$gentop/$xlib"
2235
2236               $show "${rm}r $xdir"
2237               $run ${rm}r "$xdir"
2238               $show "mkdir $xdir"
2239               $run mkdir "$xdir"
2240               status=$?
2241               if test $status -ne 0 && test ! -d "$xdir"; then
2242                 exit $status
2243               fi
2244               $show "(cd $xdir && $AR x $xabs)"
2245               $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2246
2247               libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2248             done
2249           fi
2250         fi
2251
2252         if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2253           eval flag=\"$thread_safe_flag_spec\"
2254           linkopts="$linkopts $flag"
2255         fi
2256
2257         # Do each of the archive commands.
2258         if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2259           eval cmds=\"$archive_expsym_cmds\"
2260         else
2261           eval cmds=\"$archive_cmds\"
2262         fi
2263         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
2264         for cmd in $cmds; do
2265           IFS="$save_ifs"
2266           $show "$cmd"
2267           $run eval "$cmd" || exit $?
2268         done
2269         IFS="$save_ifs"
2270
2271         # Create links to the real library.
2272         for linkname in $linknames; do
2273           if test "$realname" != "$linkname"; then
2274             $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2275             $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2276           fi
2277         done
2278
2279         # If -module or -export-dynamic was specified, set the dlname.
2280         if test "$module" = yes || test "$export_dynamic" = yes; then
2281           # On all known operating systems, these are identical.
2282           dlname="$soname"
2283         fi
2284       fi
2285       ;;
2286
2287     *.lo | *.o | *.obj)
2288       if test -n "$link_against_libtool_libs"; then
2289         $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2290         exit 1
2291       fi
2292
2293       if test -n "$deplibs"; then
2294         $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2295       fi
2296
2297       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2298         $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2299       fi
2300
2301       if test -n "$rpath"; then
2302         $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2303       fi
2304
2305       if test -n "$xrpath"; then
2306         $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2307       fi
2308
2309       if test -n "$vinfo"; then
2310         $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2311       fi
2312
2313       if test -n "$release"; then
2314         $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2315       fi
2316
2317       case "$output" in
2318       *.lo)
2319         if test -n "$objs"; then
2320           $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2321           exit 1
2322         fi
2323         libobj="$output"
2324         obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2325         ;;
2326       *)
2327         libobj=
2328         obj="$output"
2329         ;;
2330       esac
2331
2332       # Delete the old objects.
2333       $run $rm $obj $libobj
2334
2335       # Objects from convenience libraries.  This assumes
2336       # single-version convenience libraries.  Whenever we create
2337       # different ones for PIC/non-PIC, this we'll have to duplicate
2338       # the extraction.
2339       reload_conv_objs=
2340       gentop=
2341       # reload_cmds runs $LD directly, so let us get rid of
2342       # -Wl from whole_archive_flag_spec
2343       wl= 
2344
2345       if test -n "$convenience"; then
2346         if test -n "$whole_archive_flag_spec"; then
2347           eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2348         else
2349           gentop="$output_objdir/${obj}x"
2350           $show "${rm}r $gentop"
2351           $run ${rm}r "$gentop"
2352           $show "mkdir $gentop"
2353           $run mkdir "$gentop"
2354           status=$?
2355           if test $status -ne 0 && test ! -d "$gentop"; then
2356             exit $status
2357           fi
2358           generated="$generated $gentop"
2359
2360           for xlib in $convenience; do
2361             # Extract the objects.
2362             case "$xlib" in
2363             [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2364             *) xabs=`pwd`"/$xlib" ;;
2365             esac
2366             xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2367             xdir="$gentop/$xlib"
2368
2369             $show "${rm}r $xdir"
2370             $run ${rm}r "$xdir"
2371             $show "mkdir $xdir"
2372             $run mkdir "$xdir"
2373             status=$?
2374             if test $status -ne 0 && test ! -d "$xdir"; then
2375               exit $status
2376             fi
2377             $show "(cd $xdir && $AR x $xabs)"
2378             $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2379
2380             reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2381           done
2382         fi
2383       fi
2384
2385       # Create the old-style object.
2386       reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
2387
2388       output="$obj"
2389       eval cmds=\"$reload_cmds\"
2390       IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
2391       for cmd in $cmds; do
2392         IFS="$save_ifs"
2393         $show "$cmd"
2394         $run eval "$cmd" || exit $?
2395       done
2396       IFS="$save_ifs"
2397
2398       # Exit if we aren't doing a library object file.
2399       if test -z "$libobj"; then
2400         if test -n "$gentop"; then
2401           $show "${rm}r $gentop"
2402           $run ${rm}r $gentop
2403         fi
2404
2405         exit 0
2406       fi
2407
2408       if test "$build_libtool_libs" != yes; then
2409         if test -n "$gentop"; then
2410           $show "${rm}r $gentop"
2411           $run ${rm}r $gentop
2412         fi
2413
2414         # Create an invalid libtool object if no PIC, so that we don't
2415         # accidentally link it into a program.
2416         $show "echo timestamp > $libobj"
2417         $run eval "echo timestamp > $libobj" || exit $?
2418         exit 0
2419       fi
2420
2421       if test -n "$pic_flag"; then
2422         # Only do commands if we really have different PIC objects.
2423         reload_objs="$libobjs $reload_conv_objs"
2424         output="$libobj"
2425         eval cmds=\"$reload_cmds\"
2426         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
2427         for cmd in $cmds; do
2428           IFS="$save_ifs"
2429           $show "$cmd"
2430           $run eval "$cmd" || exit $?
2431         done
2432         IFS="$save_ifs"
2433       else
2434         # Just create a symlink.
2435         $show $rm $libobj
2436         $run $rm $libobj
2437         xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
2438         if test "X$xdir" = "X$libobj"; then
2439           xdir="."
2440         else
2441           xdir="$xdir"
2442         fi
2443         baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
2444         oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2445         $show "(cd $xdir && $LN_S $oldobj $baseobj)"
2446         $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
2447       fi
2448
2449       if test -n "$gentop"; then
2450         $show "${rm}r $gentop"
2451         $run ${rm}r $gentop
2452       fi
2453
2454       exit 0
2455       ;;
2456
2457     # Anything else should be a program.
2458     *)
2459       if test -n "$vinfo"; then
2460         $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2461       fi
2462
2463       if test -n "$release"; then
2464         $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
2465       fi
2466
2467       if test "$preload" = yes; then
2468         if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
2469            test "$dlopen_self_static" = unknown; then
2470           $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2471         fi 
2472       fi
2473     
2474       if test -n "$rpath$xrpath"; then
2475         # If the user specified any rpath flags, then add them.
2476         for libdir in $rpath $xrpath; do
2477           # This is the magic to use -rpath.
2478           case "$compile_rpath " in
2479           *" $libdir "*) ;;
2480           *) compile_rpath="$compile_rpath $libdir" ;;
2481           esac
2482           case "$finalize_rpath " in
2483           *" $libdir "*) ;;
2484           *) finalize_rpath="$finalize_rpath $libdir" ;;
2485           esac
2486         done
2487       fi
2488
2489       # Now hardcode the library paths
2490       rpath=
2491       hardcode_libdirs=
2492       for libdir in $compile_rpath $finalize_rpath; do
2493         if test -n "$hardcode_libdir_flag_spec"; then
2494           if test -n "$hardcode_libdir_separator"; then
2495             if test -z "$hardcode_libdirs"; then
2496               hardcode_libdirs="$libdir"
2497             else
2498               # Just accumulate the unique libdirs.
2499               case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2500               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2501                 ;;
2502               *)
2503                 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2504                 ;;
2505               esac
2506             fi
2507           else
2508             eval flag=\"$hardcode_libdir_flag_spec\"
2509             rpath="$rpath $flag"
2510           fi
2511         elif test -n "$runpath_var"; then
2512           case "$perm_rpath " in
2513           *" $libdir "*) ;;
2514           *) perm_rpath="$perm_rpath $libdir" ;;
2515           esac
2516         fi
2517       done
2518       # Substitute the hardcoded libdirs into the rpath.
2519       if test -n "$hardcode_libdir_separator" &&
2520          test -n "$hardcode_libdirs"; then
2521         libdir="$hardcode_libdirs"
2522         eval rpath=\" $hardcode_libdir_flag_spec\"
2523       fi
2524       compile_rpath="$rpath"
2525
2526       rpath=
2527       hardcode_libdirs=
2528       for libdir in $finalize_rpath; do
2529         if test -n "$hardcode_libdir_flag_spec"; then
2530           if test -n "$hardcode_libdir_separator"; then
2531             if test -z "$hardcode_libdirs"; then
2532               hardcode_libdirs="$libdir"
2533             else
2534               # Just accumulate the unique libdirs.
2535               case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2536               *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2537                 ;;
2538               *)
2539                 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2540                 ;;
2541               esac
2542             fi
2543           else
2544             eval flag=\"$hardcode_libdir_flag_spec\"
2545             rpath="$rpath $flag"
2546           fi
2547         elif test -n "$runpath_var"; then
2548           case "$finalize_perm_rpath " in
2549           *" $libdir "*) ;;
2550           *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
2551           esac
2552         fi
2553       done
2554       # Substitute the hardcoded libdirs into the rpath.
2555       if test -n "$hardcode_libdir_separator" &&
2556          test -n "$hardcode_libdirs"; then
2557         libdir="$hardcode_libdirs"
2558         eval rpath=\" $hardcode_libdir_flag_spec\"
2559       fi
2560       finalize_rpath="$rpath"
2561
2562       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2563       if test "X$output_objdir" = "X$output"; then
2564         output_objdir="$objdir"
2565       else
2566         output_objdir="$output_objdir/$objdir"
2567       fi
2568
2569       # Create the binary in the object directory, then wrap it.
2570       if test ! -d $output_objdir; then
2571         $show "$mkdir $output_objdir"
2572         $run $mkdir $output_objdir
2573         status=$?
2574         if test $status -ne 0 && test ! -d $output_objdir; then
2575           exit $status
2576         fi
2577       fi
2578
2579       if test -n "$libobjs" && test "$build_old_libs" = yes; then
2580         # Transform all the library objects into standard objects.
2581         compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2582         finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2583       fi
2584
2585       dlsyms=
2586       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2587         if test -n "$NM" && test -n "$global_symbol_pipe"; then
2588           dlsyms="${outputname}S.c"
2589         else
2590           $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
2591         fi
2592       fi
2593
2594       if test -n "$dlsyms"; then
2595         case "$dlsyms" in
2596         "") ;;
2597         *.c)
2598           # Discover the nlist of each of the dlfiles.
2599           nlist="$output_objdir/${outputname}.nm"
2600
2601           $show "$rm $nlist ${nlist}S ${nlist}T"
2602           $run $rm "$nlist" "${nlist}S" "${nlist}T"
2603
2604           # Parse the name list into a source file.
2605           $show "creating $output_objdir/$dlsyms"
2606
2607           test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
2608 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
2609 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
2610
2611 #ifdef __cplusplus
2612 extern \"C\" {
2613 #endif
2614
2615 /* Prevent the only kind of declaration conflicts we can make. */
2616 #define lt_preloaded_symbols some_other_symbol
2617
2618 /* External symbol declarations for the compiler. */\
2619 "
2620
2621           if test "$dlself" = yes; then
2622             $show "generating symbol list for \`$output'"
2623
2624             test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
2625
2626             # Add our own program objects to the symbol list.
2627             progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2628             for arg in $progfiles; do
2629               $show "extracting global C symbols from \`$arg'"
2630               $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2631             done
2632
2633             if test -n "$exclude_expsyms"; then
2634               $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2635               $run eval '$mv "$nlist"T "$nlist"'
2636             fi
2637             
2638             if test -n "$export_symbols_regex"; then
2639               $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2640               $run eval '$mv "$nlist"T "$nlist"'
2641             fi
2642
2643             # Prepare the list of exported symbols
2644             if test -z "$export_symbols"; then
2645               export_symbols="$output_objdir/$output.exp"
2646               $run $rm $export_symbols
2647               $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2648             else
2649               $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
2650               $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
2651               $run eval 'mv "$nlist"T "$nlist"'
2652             fi
2653           fi
2654
2655           for arg in $dlprefiles; do
2656             $show "extracting global C symbols from \`$arg'"
2657             name=`echo "$arg" | sed -e 's%^.*/%%'`
2658             $run eval 'echo ": $name " >> "$nlist"'
2659             $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2660           done
2661
2662           if test -z "$run"; then
2663             # Make sure we have at least an empty file.
2664             test -f "$nlist" || : > "$nlist"
2665
2666             if test -n "$exclude_expsyms"; then
2667               egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2668               $mv "$nlist"T "$nlist"
2669             fi
2670
2671             # Try sorting and uniquifying the output.
2672             if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
2673               :
2674             else
2675               grep -v "^: " < "$nlist" > "$nlist"S
2676             fi
2677
2678             if test -f "$nlist"S; then
2679               eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
2680             else
2681               echo '/* NONE */' >> "$output_objdir/$dlsyms"
2682             fi
2683
2684             $echo >> "$output_objdir/$dlsyms" "\
2685
2686 #undef lt_preloaded_symbols
2687
2688 #if defined (__STDC__) && __STDC__
2689 # define lt_ptr_t void *
2690 #else
2691 # define lt_ptr_t char *
2692 # define const
2693 #endif
2694
2695 /* The mapping between symbol names and symbols. */
2696 const struct {
2697   const char *name;
2698   lt_ptr_t address;
2699 }
2700 lt_preloaded_symbols[] =
2701 {\
2702 "
2703
2704             sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
2705                 -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
2706                   < "$nlist" >> "$output_objdir/$dlsyms"
2707
2708             $echo >> "$output_objdir/$dlsyms" "\
2709   {0, (lt_ptr_t) 0}
2710 };
2711
2712 /* This works around a problem in FreeBSD linker */
2713 #ifdef FREEBSD_WORKAROUND
2714 static const void *lt_preloaded_setup() {
2715   return lt_preloaded_symbols;
2716 }
2717 #endif
2718
2719 #ifdef __cplusplus
2720 }
2721 #endif\
2722 "
2723           fi
2724
2725           pic_flag_for_symtable=
2726           case "$host" in
2727           # compiling the symbol table file with pic_flag works around
2728           # a FreeBSD bug that causes programs to crash when -lm is
2729           # linked before any other PIC object.  But we must not use
2730           # pic_flag when linking with -static.  The problem exists in
2731           # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2732           *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)\r
2733             case "$compile_command " in
2734             *" -static "*) ;;
2735             *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
2736             esac;;
2737           *-*-hpux*)
2738             case "$compile_command " in
2739             *" -static "*) ;;
2740             *) pic_flag_for_symtable=" $pic_flag -DPIC";;
2741             esac
2742           esac
2743
2744           # Now compile the dynamic symbol file.
2745           $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
2746           $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
2747
2748           # Clean up the generated files.
2749           $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
2750           $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
2751
2752           # Transform the symbol file into the correct name.
2753           compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2754           finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2755           ;;
2756         *)
2757           $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
2758           exit 1
2759           ;;
2760         esac
2761       else
2762         # We keep going just in case the user didn't refer to
2763         # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
2764         # really was required.
2765
2766         # Nullify the symbol file.
2767         compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2768         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2769       fi
2770
2771       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
2772         # Replace the output file specification.
2773         compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2774         link_command="$compile_command$compile_rpath"
2775
2776         # We have no uninstalled library dependencies, so finalize right now.
2777         $show "$link_command"
2778         $run eval "$link_command"
2779         status=$?
2780         
2781         # Delete the generated files.
2782         if test -n "$dlsyms"; then
2783           $show "$rm $output_objdir/${outputname}S.${objext}"
2784           $run $rm "$output_objdir/${outputname}S.${objext}"
2785         fi
2786
2787         exit $status
2788       fi
2789
2790       if test -n "$shlibpath_var"; then
2791         # We should set the shlibpath_var
2792         rpath=
2793         for dir in $temp_rpath; do
2794           case "$dir" in
2795           [\\/]* | [A-Za-z]:[\\/]*)
2796             # Absolute path.
2797             rpath="$rpath$dir:"
2798             ;;
2799           *)
2800             # Relative path: add a thisdir entry.
2801             rpath="$rpath\$thisdir/$dir:"
2802             ;;
2803           esac
2804         done
2805         temp_rpath="$rpath"
2806       fi
2807
2808       if test -n "$compile_shlibpath$finalize_shlibpath"; then
2809         compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
2810       fi
2811       if test -n "$finalize_shlibpath"; then
2812         finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
2813       fi
2814
2815       compile_var=
2816       finalize_var=
2817       if test -n "$runpath_var"; then
2818         if test -n "$perm_rpath"; then
2819           # We should set the runpath_var.
2820           rpath=
2821           for dir in $perm_rpath; do
2822             rpath="$rpath$dir:"
2823           done
2824           compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
2825         fi
2826         if test -n "$finalize_perm_rpath"; then
2827           # We should set the runpath_var.
2828           rpath=
2829           for dir in $finalize_perm_rpath; do
2830             rpath="$rpath$dir:"
2831           done
2832           finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
2833         fi
2834       fi
2835
2836       if test "$hardcode_action" = relink; then
2837         # Fast installation is not supported
2838         link_command="$compile_var$compile_command$compile_rpath"
2839         relink_command="$finalize_var$finalize_command$finalize_rpath"
2840         
2841         $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2842         $echo "$modename: \`$output' will be relinked during installation" 1>&2
2843       else
2844         if test "$fast_install" != no; then
2845           link_command="$finalize_var$compile_command$finalize_rpath"
2846           if test "$fast_install" = yes; then
2847             relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
2848           else
2849             # fast_install is set to needless
2850             relink_command=
2851           fi
2852         else
2853           link_command="$compile_var$compile_command$compile_rpath"
2854           relink_command="$finalize_var$finalize_command$finalize_rpath"
2855         fi
2856       fi
2857
2858       # Replace the output file specification.
2859       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2860       
2861       # Delete the old output files.
2862       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2863
2864       $show "$link_command"
2865       $run eval "$link_command" || exit $?
2866
2867       # Now create the wrapper script.
2868       $show "creating $output"
2869
2870       # Quote the relink command for shipping.
2871       if test -n "$relink_command"; then
2872         relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2873       fi
2874
2875       # Quote $echo for shipping.
2876       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2877         case "$0" in
2878         [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
2879         *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
2880         esac
2881         qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
2882       else
2883         qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
2884       fi
2885
2886       # Only actually do things if our run command is non-null.
2887       if test -z "$run"; then
2888         # win32 will think the script is a binary if it has
2889         # a .exe suffix, so we strip it off here.
2890         case $output in
2891           *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
2892         esac
2893         $rm $output
2894         trap "$rm $output; exit 1" 1 2 15
2895
2896         $echo > $output "\
2897 #! $SHELL
2898
2899 # $output - temporary wrapper script for $objdir/$outputname
2900 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2901 #
2902 # The $output program cannot be directly executed until all the libtool
2903 # libraries that it depends on are installed.
2904 #
2905 # This wrapper script should never be moved out of the build directory.
2906 # If it is, it will not operate correctly.
2907
2908 # Sed substitution that helps us do robust quoting.  It backslashifies
2909 # metacharacters that are still active within double-quoted strings.
2910 Xsed='sed -e 1s/^X//'
2911 sed_quote_subst='$sed_quote_subst'
2912
2913 # The HP-UX ksh and POSIX shell print the target directory to stdout
2914 # if CDPATH is set.
2915 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
2916
2917 relink_command=\"$relink_command\"
2918
2919 # This environment variable determines our operation mode.
2920 if test \"\$libtool_install_magic\" = \"$magic\"; then
2921   # install mode needs the following variable:
2922   link_against_libtool_libs='$link_against_libtool_libs'
2923 else
2924   # When we are sourced in execute mode, \$file and \$echo are already set.
2925   if test \"\$libtool_execute_magic\" != \"$magic\"; then
2926     echo=\"$qecho\"
2927     file=\"\$0\"
2928     # Make sure echo works.
2929     if test \"X\$1\" = X--no-reexec; then
2930       # Discard the --no-reexec flag, and continue.
2931       shift
2932     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
2933       # Yippee, \$echo works!
2934       :
2935     else
2936       # Restart under the correct shell, and then maybe \$echo will work.
2937       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2938     fi
2939   fi\
2940 "
2941         $echo >> $output "\
2942
2943   # Find the directory that this script lives in.
2944   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2945   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2946
2947   # Follow symbolic links until we get to the real thisdir.
2948   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
2949   while test -n \"\$file\"; do
2950     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2951
2952     # If there was a directory component, then change thisdir.
2953     if test \"x\$destdir\" != \"x\$file\"; then
2954       case \"\$destdir\" in
2955       [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
2956       *) thisdir=\"\$thisdir/\$destdir\" ;;
2957       esac
2958     fi
2959
2960     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2961     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
2962   done
2963
2964   # Try to get the absolute directory name.
2965   absdir=\`cd \"\$thisdir\" && pwd\`
2966   test -n \"\$absdir\" && thisdir=\"\$absdir\"
2967 "
2968
2969         if test "$fast_install" = yes; then
2970           echo >> $output "\
2971   program=lt-'$outputname'
2972   progdir=\"\$thisdir/$objdir\"
2973   
2974   if test ! -f \"\$progdir/\$program\" || \\
2975      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
2976        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2977
2978     file=\"\$\$-\$program\"
2979
2980     if test ! -d \"\$progdir\"; then
2981       $mkdir \"\$progdir\"
2982     else
2983       $rm \"\$progdir/\$file\"
2984     fi"
2985
2986           echo >> $output "\
2987
2988     # relink executable if necessary
2989     if test -n \"\$relink_command\"; then
2990       if (cd \"\$thisdir\" && eval \$relink_command); then :
2991       else
2992         $rm \"\$progdir/\$file\"
2993         exit 1
2994       fi
2995     fi
2996
2997     $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2998     { $rm \"\$progdir/\$program\";
2999       $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3000     $rm \"\$progdir/\$file\"
3001   fi"
3002         else
3003           echo >> $output "\
3004   program='$outputname'
3005   progdir=\"\$thisdir/$objdir\"
3006 "
3007         fi
3008
3009         echo >> $output "\
3010
3011   if test -f \"\$progdir/\$program\"; then"
3012
3013         # Export our shlibpath_var if we have one.
3014         if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3015           $echo >> $output "\
3016     # Add our own library path to $shlibpath_var
3017     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3018
3019     # Some systems cannot cope with colon-terminated $shlibpath_var
3020     # The second colon is a workaround for a bug in BeOS R4 sed
3021     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3022
3023     export $shlibpath_var
3024 "
3025         fi
3026
3027         # fixup the dll searchpath if we need to.
3028         if test -n "$dllsearchpath"; then
3029           $echo >> $output "\
3030     # Add the dll search path components to the executable PATH
3031     PATH=$dllsearchpath:\$PATH
3032 "
3033         fi
3034
3035         $echo >> $output "\
3036     if test \"\$libtool_execute_magic\" != \"$magic\"; then
3037       # Run the actual program with our arguments.
3038 "
3039         case $host in
3040         *-*-cygwin* | *-*-mingw | *-*-os2*)
3041           # win32 systems need to use the prog path for dll
3042           # lookup to work
3043           $echo >> $output "\
3044       exec \$progdir\\\\\$program \${1+\"\$@\"}
3045 "
3046           ;;
3047         *)
3048           $echo >> $output "\
3049       # Export the path to the program.
3050       PATH=\"\$progdir:\$PATH\"
3051       export PATH
3052
3053       exec \$program \${1+\"\$@\"}
3054 "
3055           ;;
3056         esac
3057         $echo >> $output "\
3058       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3059       exit 1
3060     fi
3061   else
3062     # The program doesn't exist.
3063     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3064     \$echo \"This script is just a wrapper for \$program.\" 1>&2
3065     echo \"See the $PACKAGE documentation for more information.\" 1>&2
3066     exit 1
3067   fi
3068 fi\
3069 "
3070         chmod +x $output
3071       fi
3072       exit 0
3073       ;;
3074     esac
3075
3076     # See if we need to build an old-fashioned archive.
3077     for oldlib in $oldlibs; do
3078
3079       if test "$build_libtool_libs" = convenience; then
3080         oldobjs="$libobjs_save"
3081         addlibs="$convenience"
3082         build_libtool_libs=no
3083       else
3084         if test "$build_libtool_libs" = module; then
3085           oldobjs="$libobjs_save"
3086           build_libtool_libs=no
3087         else
3088           oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3089         fi
3090         addlibs="$old_convenience"
3091       fi
3092
3093       if test -n "$addlibs"; then
3094         gentop="$output_objdir/${outputname}x"
3095         $show "${rm}r $gentop"
3096         $run ${rm}r "$gentop"
3097         $show "mkdir $gentop"
3098         $run mkdir "$gentop"
3099         status=$?
3100         if test $status -ne 0 && test ! -d "$gentop"; then
3101           exit $status
3102         fi
3103         generated="$generated $gentop"
3104           
3105         # Add in members from convenience archives.
3106         for xlib in $addlibs; do
3107           # Extract the objects.
3108           case "$xlib" in
3109           [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3110           *) xabs=`pwd`"/$xlib" ;;
3111           esac
3112           xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3113           xdir="$gentop/$xlib"
3114
3115           $show "${rm}r $xdir"
3116           $run ${rm}r "$xdir"
3117           $show "mkdir $xdir"
3118           $run mkdir "$xdir"
3119           status=$?
3120           if test $status -ne 0 && test ! -d "$xdir"; then
3121             exit $status
3122           fi
3123           $show "(cd $xdir && $AR x $xabs)"
3124           $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3125
3126           oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3127         done
3128       fi
3129
3130       # Do each command in the archive commands.
3131       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3132         eval cmds=\"$old_archive_from_new_cmds\"
3133       else
3134         # Ensure that we have .o objects in place in case we decided
3135         # not to build a shared library, and have fallen back to building
3136         # static libs even though --disable-static was passed!
3137         for oldobj in $oldobjs; do
3138           if test ! -f $oldobj; then
3139             xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3140             if test "X$xdir" = "X$oldobj"; then
3141               xdir="."
3142             else
3143               xdir="$xdir"
3144             fi
3145             baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3146             obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3147             $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3148             $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3149           fi
3150         done
3151
3152         eval cmds=\"$old_archive_cmds\"
3153       fi
3154       IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
3155       for cmd in $cmds; do
3156         IFS="$save_ifs"
3157         $show "$cmd"
3158         $run eval "$cmd" || exit $?
3159       done
3160       IFS="$save_ifs"
3161     done
3162
3163     if test -n "$generated"; then
3164       $show "${rm}r$generated"
3165       $run ${rm}r$generated
3166     fi
3167
3168     # Now create the libtool archive.
3169     case "$output" in
3170     *.la)
3171       old_library=
3172       if test "$release_suffix" = all; then
3173         test "$build_old_libs" = yes && old_library="$libname$release.$libext"
3174       else
3175         test "$build_old_libs" = yes && old_library="$libname.$libext"
3176       fi
3177       $show "creating $output"
3178
3179       if test -n "$xrpath"; then
3180         temp_xrpath=
3181         for libdir in $xrpath; do
3182           temp_xrpath="$temp_xrpath -R$libdir"
3183         done
3184         dependency_libs="$temp_xrpath $dependency_libs"
3185       fi
3186
3187       # Only create the output if not a dry run.
3188       if test -z "$run"; then
3189         for installed in no yes; do
3190           if test "$installed" = yes; then
3191             if test -z "$install_libdir"; then
3192               break
3193             fi
3194             output="$output_objdir/$outputname"i
3195           fi
3196           $rm $output
3197           $echo > $output "\
3198 # $outputname - a libtool library file
3199 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3200 #
3201 # Please DO NOT delete this file!
3202 # It is necessary for linking the library.
3203
3204 # The name that we can dlopen(3).
3205 dlname='$dlname'
3206
3207 # Names of this library.
3208 library_names='$library_names'
3209
3210 # The name of the static archive.
3211 old_library='$old_library'
3212
3213 # Libraries that this one depends upon.
3214 dependency_libs='$dependency_libs'
3215
3216 # Version information for $libname.
3217 current=$current
3218 age=$age
3219 revision=$revision
3220
3221 # Is this an already installed library?
3222 installed=$installed
3223
3224 # Directory that this library needs to be installed in:
3225 libdir='$install_libdir'\
3226 "
3227         done
3228       fi
3229
3230       # Do a symbolic link so that the libtool archive can be found in
3231       # LD_LIBRARY_PATH before the program is installed.
3232       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3233       $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
3234       ;;
3235     esac
3236     exit 0
3237     ;;
3238
3239   # libtool install mode
3240   install)
3241     modename="$modename: install"
3242
3243     # There may be an optional sh(1) argument at the beginning of
3244     # install_prog (especially on Windows NT).
3245     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
3246       # Aesthetically quote it.
3247       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3248       case "$arg" in
3249       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
3250         arg="\"$arg\""
3251         ;;
3252       esac
3253       install_prog="$arg "
3254       arg="$1"
3255       shift
3256     else
3257       install_prog=
3258       arg="$nonopt"
3259     fi
3260
3261     # The real first argument should be the name of the installation program.
3262     # Aesthetically quote it.
3263     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3264     case "$arg" in
3265     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
3266       arg="\"$arg\""
3267       ;;
3268     esac
3269     install_prog="$install_prog$arg"
3270
3271     # We need to accept at least all the BSD install flags.
3272     dest=
3273     files=
3274     opts=
3275     prev=
3276     install_type=
3277     isdir=no
3278     stripme=
3279     for arg
3280     do
3281       if test -n "$dest"; then
3282         files="$files $dest"
3283         dest="$arg"
3284         continue
3285       fi
3286
3287       case "$arg" in
3288       -d) isdir=yes ;;
3289       -f) prev="-f" ;;
3290       -g) prev="-g" ;;
3291       -m) prev="-m" ;;
3292       -o) prev="-o" ;;
3293       -s)
3294         stripme=" -s"
3295         continue
3296         ;;
3297       -*) ;;
3298
3299       *)
3300         # If the previous option needed an argument, then skip it.
3301         if test -n "$prev"; then
3302           prev=
3303         else
3304           dest="$arg"
3305           continue
3306         fi
3307         ;;
3308       esac
3309
3310       # Aesthetically quote the argument.
3311       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3312       case "$arg" in
3313       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
3314         arg="\"$arg\""
3315         ;;
3316       esac
3317       install_prog="$install_prog $arg"
3318     done
3319
3320     if test -z "$install_prog"; then
3321       $echo "$modename: you must specify an install program" 1>&2
3322       $echo "$help" 1>&2
3323       exit 1
3324     fi
3325
3326     if test -n "$prev"; then
3327       $echo "$modename: the \`$prev' option requires an argument" 1>&2
3328       $echo "$help" 1>&2
3329       exit 1
3330     fi
3331
3332     if test -z "$files"; then
3333       if test -z "$dest"; then
3334         $echo "$modename: no file or destination specified" 1>&2
3335       else
3336         $echo "$modename: you must specify a destination" 1>&2
3337       fi
3338       $echo "$help" 1>&2
3339       exit 1
3340     fi
3341
3342     # Strip any trailing slash from the destination.
3343     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
3344
3345     # Check to see that the destination is a directory.
3346     test -d "$dest" && isdir=yes
3347     if test "$isdir" = yes; then
3348       destdir="$dest"
3349       destname=
3350     else
3351       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
3352       test "X$destdir" = "X$dest" && destdir=.
3353       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
3354
3355       # Not a directory, so check to see that there is only one file specified.
3356       set dummy $files
3357       if test $# -gt 2; then
3358         $echo "$modename: \`$dest' is not a directory" 1>&2
3359         $echo "$help" 1>&2
3360         exit 1
3361       fi
3362     fi
3363     case "$destdir" in
3364     [\\/]* | [A-Za-z]:[\\/]*) ;;
3365     *)
3366       for file in $files; do
3367         case "$file" in
3368         *.lo) ;;
3369         *)
3370           $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3371           $echo "$help" 1>&2
3372           exit 1
3373           ;;
3374         esac
3375       done
3376       ;;
3377     esac
3378
3379     # This variable tells wrapper scripts just to set variables rather
3380     # than running their programs.
3381     libtool_install_magic="$magic"
3382
3383     staticlibs=
3384     future_libdirs=
3385     current_libdirs=
3386     for file in $files; do
3387
3388       # Do each installation.
3389       case "$file" in
3390       *.a | *.lib)
3391         # Do the static libraries later.
3392         staticlibs="$staticlibs $file"
3393         ;;
3394
3395       *.la)
3396         # Check to see that this really is a libtool archive.
3397         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3398         else
3399           $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
3400           $echo "$help" 1>&2
3401           exit 1
3402         fi
3403
3404         library_names=
3405         old_library=
3406         # If there is no directory component, then add one.
3407         case "$file" in
3408         */* | *\\*) . $file ;;
3409         *) . ./$file ;;
3410         esac
3411
3412         # Add the libdir to current_libdirs if it is the destination.
3413         if test "X$destdir" = "X$libdir"; then
3414           case "$current_libdirs " in
3415           *" $libdir "*) ;;
3416           *) current_libdirs="$current_libdirs $libdir" ;;
3417           esac
3418         else
3419           # Note the libdir as a future libdir.
3420           case "$future_libdirs " in
3421           *" $libdir "*) ;;
3422           *) future_libdirs="$future_libdirs $libdir" ;;
3423           esac
3424         fi
3425
3426         dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
3427         test "X$dir" = "X$file/" && dir=
3428         dir="$dir$objdir"
3429
3430         # See the names of the shared library.
3431         set dummy $library_names
3432         if test -n "$2"; then
3433           realname="$2"
3434           shift
3435           shift
3436
3437           # Install the shared library and build the symlinks.
3438           $show "$install_prog $dir/$realname $destdir/$realname"
3439           $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
3440
3441           if test $# -gt 0; then
3442             # Delete the old symlinks, and create new ones.
3443             for linkname
3444             do
3445               if test "$linkname" != "$realname"; then
3446                 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3447                 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3448               fi
3449             done
3450           fi
3451
3452           # Do each command in the postinstall commands.
3453           lib="$destdir/$realname"
3454           eval cmds=\"$postinstall_cmds\"
3455           IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
3456           for cmd in $cmds; do
3457             IFS="$save_ifs"
3458             $show "$cmd"
3459             $run eval "$cmd" || exit $?
3460           done
3461           IFS="$save_ifs"
3462         fi
3463
3464         # Install the pseudo-library for information purposes.
3465         if test "$install_ltlibs" = yes; then
3466           name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3467           instname="$dir/$name"i
3468           $show "$install_prog $instname $destdir/$name"
3469           $run eval "$install_prog $instname $destdir/$name" || exit $?
3470         fi
3471
3472         # Maybe install the static library, too.
3473         test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
3474         ;;
3475
3476       *.lo)
3477         # Install (i.e. copy) a libtool object.
3478
3479         # Figure out destination file name, if it wasn't already specified.
3480         if test -n "$destname"; then
3481           destfile="$destdir/$destname"
3482         else
3483           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3484           destfile="$destdir/$destfile"
3485         fi
3486
3487         # Deduce the name of the destination old-style object file.
3488         case "$destfile" in
3489         *.lo)
3490           staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3491           ;;
3492         *.o | *.obj)
3493           staticdest="$destfile"
3494           destfile=
3495           ;;
3496         *)
3497           $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
3498           $echo "$help" 1>&2
3499           exit 1
3500           ;;
3501         esac
3502
3503         # Install the libtool object if requested.
3504         if test -n "$destfile"; then
3505           $show "$install_prog $file $destfile"
3506           $run eval "$install_prog $file $destfile" || exit $?
3507         fi
3508
3509         # Install the old object if enabled.
3510         if test "$build_old_libs" = yes; then
3511           # Deduce the name of the old-style object file.
3512           staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
3513
3514           $show "$install_prog $staticobj $staticdest"
3515           $run eval "$install_prog \$staticobj \$staticdest" || exit $?
3516         fi
3517         exit 0
3518         ;;
3519
3520       *)
3521         # Figure out destination file name, if it wasn't already specified.
3522         if test -n "$destname"; then
3523           destfile="$destdir/$destname"
3524         else
3525           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3526           destfile="$destdir/$destfile"
3527         fi
3528
3529         # Do a test to see if this is really a libtool program.
3530         if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3531           link_against_libtool_libs=
3532           relink_command=
3533
3534           # If there is no directory component, then add one.
3535           case "$file" in
3536           */* | *\\*) . $file ;;
3537           *) . ./$file ;;
3538           esac
3539
3540           # Check the variables that should have been set.
3541           if test -z "$link_against_libtool_libs"; then
3542             $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
3543             exit 1
3544           fi
3545
3546           finalize=yes
3547           for lib in $link_against_libtool_libs; do
3548             # Check to see that each library is installed.
3549             libdir=
3550             if test -f "$lib"; then
3551               # If there is no directory component, then add one.
3552               case "$lib" in
3553               */* | *\\*) . $lib ;;
3554               *) . ./$lib ;;
3555               esac
3556             fi
3557             libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
3558             if test -n "$libdir" && test ! -f "$libfile"; then
3559               finalize=no
3560             fi
3561           done
3562
3563           outputname=
3564           if test "$fast_install" = no && test -n "$relink_command"; then
3565             if test "$finalize" = yes && test -z "$run"; then
3566               tmpdir="/tmp"
3567               test -n "$TMPDIR" && tmpdir="$TMPDIR"
3568               tmpdir="$tmpdir/libtool-$$"
3569               if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
3570               else
3571                 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
3572                 continue
3573               fi
3574               outputname="$tmpdir/$file"
3575               # Replace the output file specification.
3576               relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3577
3578               $show "$relink_command"
3579               if $run eval "$relink_command"; then :
3580               else
3581                 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
3582                 ${rm}r "$tmpdir"
3583                 continue
3584               fi
3585               file="$outputname"
3586             else
3587               $echo "$modename: warning: cannot relink \`$file'" 1>&2
3588             fi
3589           else
3590             # Install the binary that we compiled earlier.
3591             file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
3592           fi
3593         fi
3594
3595         $show "$install_prog$stripme $file $destfile"
3596         $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
3597         test -n "$outputname" && ${rm}r "$tmpdir"
3598         ;;
3599       esac
3600     done
3601
3602     for file in $staticlibs; do
3603       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3604
3605       # Set up the ranlib parameters.
3606       oldlib="$destdir/$name"
3607
3608       $show "$install_prog $file $oldlib"
3609       $run eval "$install_prog \$file \$oldlib" || exit $?
3610
3611       # Do each command in the postinstall commands.
3612       eval cmds=\"$old_postinstall_cmds\"
3613       IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
3614       for cmd in $cmds; do
3615         IFS="$save_ifs"
3616         $show "$cmd"
3617         $run eval "$cmd" || exit $?
3618       done
3619       IFS="$save_ifs"
3620     done
3621
3622     if test -n "$future_libdirs"; then
3623       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
3624     fi
3625
3626     if test -n "$current_libdirs"; then
3627       # Maybe just do a dry run.
3628       test -n "$run" && current_libdirs=" -n$current_libdirs"
3629       exec $SHELL $0 --finish$current_libdirs
3630       exit 1
3631     fi
3632
3633     exit 0
3634     ;;
3635
3636   # libtool finish mode
3637   finish)
3638     modename="$modename: finish"
3639     libdirs="$nonopt"
3640     admincmds=
3641
3642     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3643       for dir
3644       do
3645         libdirs="$libdirs $dir"
3646       done
3647
3648       for libdir in $libdirs; do
3649         if test -n "$finish_cmds"; then
3650           # Do each command in the finish commands.
3651           eval cmds=\"$finish_cmds\"
3652           IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
3653           for cmd in $cmds; do
3654             IFS="$save_ifs"
3655             $show "$cmd"
3656             $run eval "$cmd" || admincmds="$admincmds
3657        $cmd"
3658           done
3659           IFS="$save_ifs"
3660         fi
3661         if test -n "$finish_eval"; then
3662           # Do the single finish_eval.
3663           eval cmds=\"$finish_eval\"
3664           $run eval "$cmds" || admincmds="$admincmds
3665        $cmds"
3666         fi
3667       done
3668     fi
3669
3670     # Exit here if they wanted silent mode.
3671     test "$show" = : && exit 0
3672
3673     echo "----------------------------------------------------------------------"
3674     echo "Libraries have been installed in:"
3675     for libdir in $libdirs; do
3676       echo "   $libdir"
3677     done
3678     echo
3679     echo "If you ever happen to want to link against installed libraries"
3680     echo "in a given directory, LIBDIR, you must either use libtool, and"
3681     echo "specify the full pathname of the library, or use \`-LLIBDIR'"
3682     echo "flag during linking and do at least one of the following:"
3683     if test -n "$shlibpath_var"; then
3684       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
3685       echo "     during execution"
3686     fi
3687     if test -n "$runpath_var"; then
3688       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
3689       echo "     during linking"
3690     fi
3691     if test -n "$hardcode_libdir_flag_spec"; then
3692       libdir=LIBDIR
3693       eval flag=\"$hardcode_libdir_flag_spec\"
3694
3695       echo "   - use the \`$flag' linker flag"
3696     fi
3697     if test -n "$admincmds"; then
3698       echo "   - have your system administrator run these commands:$admincmds"
3699     fi
3700     if test -f /etc/ld.so.conf; then
3701       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3702     fi
3703     echo
3704     echo "See any operating system documentation about shared libraries for"
3705     echo "more information, such as the ld(1) and ld.so(8) manual pages."
3706     echo "----------------------------------------------------------------------"
3707     exit 0
3708     ;;
3709
3710   # libtool execute mode
3711   execute)
3712     modename="$modename: execute"
3713
3714     # The first argument is the command name.
3715     cmd="$nonopt"
3716     if test -z "$cmd"; then
3717       $echo "$modename: you must specify a COMMAND" 1>&2
3718       $echo "$help"
3719       exit 1
3720     fi
3721
3722     # Handle -dlopen flags immediately.
3723     for file in $execute_dlfiles; do
3724       if test ! -f "$file"; then
3725         $echo "$modename: \`$file' is not a file" 1>&2
3726         $echo "$help" 1>&2
3727         exit 1
3728       fi
3729
3730       dir=
3731       case "$file" in
3732       *.la)
3733         # Check to see that this really is a libtool archive.
3734         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3735         else
3736           $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3737           $echo "$help" 1>&2
3738           exit 1
3739         fi
3740
3741         # Read the libtool library.
3742         dlname=
3743         library_names=
3744
3745         # If there is no directory component, then add one.
3746         case "$file" in
3747         */* | *\\*) . $file ;;
3748         *) . ./$file ;;
3749         esac
3750
3751         # Skip this library if it cannot be dlopened.
3752         if test -z "$dlname"; then
3753           # Warn if it was a shared library.
3754           test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
3755           continue
3756         fi
3757
3758         dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3759         test "X$dir" = "X$file" && dir=.
3760
3761         if test -f "$dir/$objdir/$dlname"; then
3762           dir="$dir/$objdir"
3763         else
3764           $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
3765           exit 1
3766         fi
3767         ;;
3768
3769       *.lo)
3770         # Just add the directory containing the .lo file.
3771         dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3772         test "X$dir" = "X$file" && dir=.
3773         ;;
3774
3775       *)
3776         $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
3777         continue
3778         ;;
3779       esac
3780
3781       # Get the absolute pathname.
3782       absdir=`cd "$dir" && pwd`
3783       test -n "$absdir" && dir="$absdir"
3784
3785       # Now add the directory to shlibpath_var.
3786       if eval "test -z \"\$$shlibpath_var\""; then
3787         eval "$shlibpath_var=\"\$dir\""
3788       else
3789         eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3790       fi
3791     done
3792
3793     # This variable tells wrapper scripts just to set shlibpath_var
3794     # rather than running their programs.
3795     libtool_execute_magic="$magic"
3796
3797     # Check if any of the arguments is a wrapper script.
3798     args=
3799     for file
3800     do
3801       case "$file" in
3802       -*) ;;
3803       *)
3804         # Do a test to see if this is really a libtool program.
3805         if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3806           # If there is no directory component, then add one.
3807           case "$file" in
3808           */* | *\\*) . $file ;;
3809           *) . ./$file ;;
3810           esac
3811
3812           # Transform arg to wrapped name.
3813           file="$progdir/$program"
3814         fi
3815         ;;
3816       esac
3817       # Quote arguments (to preserve shell metacharacters).
3818       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
3819       args="$args \"$file\""
3820     done
3821
3822     if test -z "$run"; then
3823       if test -n "$shlibpath_var"; then
3824         # Export the shlibpath_var.
3825         eval "export $shlibpath_var"
3826       fi
3827
3828       # Restore saved enviroment variables
3829       if test "${save_LC_ALL+set}" = set; then
3830         LC_ALL="$save_LC_ALL"; export LC_ALL
3831       fi
3832       if test "${save_LANG+set}" = set; then
3833         LANG="$save_LANG"; export LANG
3834       fi
3835
3836       # Now actually exec the command.
3837       eval "exec \$cmd$args"
3838
3839       $echo "$modename: cannot exec \$cmd$args"
3840       exit 1
3841     else
3842       # Display what would be done.
3843       if test -n "$shlibpath_var"; then
3844         eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
3845         $echo "export $shlibpath_var"
3846       fi
3847       $echo "$cmd$args"
3848       exit 0
3849     fi
3850     ;;
3851
3852   # libtool uninstall mode
3853   uninstall)
3854     modename="$modename: uninstall"
3855     rm="$nonopt"
3856     files=
3857
3858     for arg
3859     do
3860       case "$arg" in
3861       -*) rm="$rm $arg" ;;
3862       *) files="$files $arg" ;;
3863       esac
3864     done
3865
3866     if test -z "$rm"; then
3867       $echo "$modename: you must specify an RM program" 1>&2
3868       $echo "$help" 1>&2
3869       exit 1
3870     fi
3871
3872     for file in $files; do
3873       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3874       test "X$dir" = "X$file" && dir=.
3875       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3876
3877       rmfiles="$file"
3878
3879       case "$name" in
3880       *.la)
3881         # Possibly a libtool archive, so verify it.
3882         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3883           . $dir/$name
3884
3885           # Delete the libtool libraries and symlinks.
3886           for n in $library_names; do
3887             rmfiles="$rmfiles $dir/$n"
3888           done
3889           test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
3890
3891           $show "$rm $rmfiles"
3892           $run $rm $rmfiles
3893
3894           if test -n "$library_names"; then
3895             # Do each command in the postuninstall commands.
3896             eval cmds=\"$postuninstall_cmds\"
3897             IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
3898             for cmd in $cmds; do
3899               IFS="$save_ifs"
3900               $show "$cmd"
3901               $run eval "$cmd"
3902             done
3903             IFS="$save_ifs"
3904           fi
3905
3906           if test -n "$old_library"; then
3907             # Do each command in the old_postuninstall commands.
3908             eval cmds=\"$old_postuninstall_cmds\"
3909             IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
3910             for cmd in $cmds; do
3911               IFS="$save_ifs"
3912               $show "$cmd"
3913               $run eval "$cmd"
3914             done
3915             IFS="$save_ifs"
3916           fi
3917
3918           # FIXME: should reinstall the best remaining shared library.
3919         fi
3920         ;;
3921
3922       *.lo)
3923         if test "$build_old_libs" = yes; then
3924           oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
3925           rmfiles="$rmfiles $dir/$oldobj"
3926         fi
3927         $show "$rm $rmfiles"
3928         $run $rm $rmfiles
3929         ;;
3930
3931       *)
3932         $show "$rm $rmfiles"
3933         $run $rm $rmfiles
3934         ;;
3935       esac
3936     done
3937     exit 0
3938     ;;
3939
3940   "")
3941     $echo "$modename: you must specify a MODE" 1>&2
3942     $echo "$generic_help" 1>&2
3943     exit 1
3944     ;;
3945   esac
3946
3947   $echo "$modename: invalid operation mode \`$mode'" 1>&2
3948   $echo "$generic_help" 1>&2
3949   exit 1
3950 fi # test -z "$show_help"
3951
3952 # We need to display help for each of the modes.
3953 case "$mode" in
3954 "") $echo \
3955 "Usage: $modename [OPTION]... [MODE-ARG]...
3956
3957 Provide generalized library-building support services.
3958
3959     --config          show all configuration variables
3960     --debug           enable verbose shell tracing
3961 -n, --dry-run         display commands without modifying any files
3962     --features        display basic configuration information and exit
3963     --finish          same as \`--mode=finish'
3964     --help            display this help message and exit
3965     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
3966     --quiet           same as \`--silent'
3967     --silent          don't print informational messages
3968     --version         print version information
3969
3970 MODE must be one of the following:
3971
3972       compile         compile a source file into a libtool object
3973       execute         automatically set library path, then run a program
3974       finish          complete the installation of libtool libraries
3975       install         install libraries or executables
3976       link            create a library or an executable
3977       uninstall       remove libraries from an installed directory
3978
3979 MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
3980 a more detailed description of MODE."
3981   exit 0
3982   ;;
3983
3984 compile)
3985   $echo \
3986 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3987
3988 Compile a source file into a libtool library object.
3989
3990 This mode accepts the following additional options:
3991
3992   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
3993   -static           always build a \`.o' file suitable for static linking
3994
3995 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
3996 from the given SOURCEFILE.
3997
3998 The output file name is determined by removing the directory component from
3999 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4000 library object suffix, \`.lo'."
4001   ;;
4002
4003 execute)
4004   $echo \
4005 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4006
4007 Automatically set library path, then run a program.
4008
4009 This mode accepts the following additional options:
4010
4011   -dlopen FILE      add the directory containing FILE to the library path
4012
4013 This mode sets the library path environment variable according to \`-dlopen'
4014 flags.
4015
4016 If any of the ARGS are libtool executable wrappers, then they are translated
4017 into their corresponding uninstalled binary, and any of their required library
4018 directories are added to the library path.
4019
4020 Then, COMMAND is executed, with ARGS as arguments."
4021   ;;
4022
4023 finish)
4024   $echo \
4025 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4026
4027 Complete the installation of libtool libraries.
4028
4029 Each LIBDIR is a directory that contains libtool libraries.
4030
4031 The commands that this mode executes may require superuser privileges.  Use
4032 the \`--dry-run' option if you just want to see what would be executed."
4033   ;;
4034
4035 install)
4036   $echo \
4037 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4038
4039 Install executables or libraries.
4040
4041 INSTALL-COMMAND is the installation command.  The first component should be
4042 either the \`install' or \`cp' program.
4043
4044 The rest of the components are interpreted as arguments to that command (only
4045 BSD-compatible install options are recognized)."
4046   ;;
4047
4048 link)
4049   $echo \
4050 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4051
4052 Link object files or libraries together to form another library, or to
4053 create an executable program.
4054
4055 LINK-COMMAND is a command using the C compiler that you would use to create
4056 a program from several object files.
4057
4058 The following components of LINK-COMMAND are treated specially:
4059
4060   -all-static       do not do any dynamic linking at all
4061   -avoid-version    do not add a version suffix if possible
4062   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
4063   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
4064   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4065   -export-symbols SYMFILE
4066                     try to export only the symbols listed in SYMFILE
4067   -export-symbols-regex REGEX
4068                     try to export only the symbols matching REGEX
4069   -LLIBDIR          search LIBDIR for required installed libraries
4070   -lNAME            OUTPUT-FILE requires the installed library libNAME
4071   -module           build a library that can dlopened
4072   -no-undefined     declare that a library does not refer to external symbols
4073   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
4074   -release RELEASE  specify package release information
4075   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
4076   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
4077   -static           do not do any dynamic linking of libtool libraries
4078   -version-info CURRENT[:REVISION[:AGE]]
4079                     specify library version info [each variable defaults to 0]
4080
4081 All other options (arguments beginning with \`-') are ignored.
4082
4083 Every other argument is treated as a filename.  Files ending in \`.la' are
4084 treated as uninstalled libtool libraries, other files are standard or library
4085 object files.
4086
4087 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4088 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4089 required, except when creating a convenience library.
4090
4091 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4092 using \`ar' and \`ranlib', or on Windows using \`lib'.
4093
4094 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4095 is created, otherwise an executable program is created."
4096   ;;
4097
4098 uninstall)
4099   $echo \
4100 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4101
4102 Remove libraries from an installation directory.
4103
4104 RM is the name of the program to use to delete files associated with each FILE
4105 (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
4106 to RM.
4107
4108 If FILE is a libtool library, all the files associated with it are deleted.
4109 Otherwise, only FILE itself is deleted using RM."
4110   ;;
4111
4112 *)
4113   $echo "$modename: invalid operation mode \`$mode'" 1>&2
4114   $echo "$help" 1>&2
4115   exit 1
4116   ;;
4117 esac
4118
4119 echo
4120 $echo "Try \`$modename --help' for more information about other modes."
4121
4122 exit 0
4123
4124 # Local Variables:
4125 # mode:shell-script
4126 # sh-indentation:2
4127 # End: