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