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