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