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