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