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