tons of stuff
authorbrian <brian@brianweb.net>
Mon, 3 May 2004 06:42:40 +0000 (23:42 -0700)
committerbrian <brian@brianweb.net>
Mon, 3 May 2004 06:42:40 +0000 (23:42 -0700)
darcs-hash:20040503064240-24bed-172f43754294c3c370ed463d7fd3d05225419115.gz

13 files changed:
Makefile
src/org/ibex/nestedvm/ClassLoader.java [deleted file]
src/org/ibex/nestedvm/Runtime.java
src/org/ibex/nestedvm/UnixRuntime.java
src/org/ibex/nestedvm/UsermodeConstants.java
src/org/ibex/nestedvm/support.s
src/org/ibex/nestedvm/support_aux.c
src/org/ibex/nestedvm/syscalls.h
src/org/ibex/nestedvm/util/Seekable.java
src/tests/CallTest.java
src/tests/Fork.c
src/tests/FreeTypeDemo.java
upstream/patches/newlib-mips.patch

index ee8e941..f5c2a53 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -186,10 +186,12 @@ unixruntime.jar: $(unixruntime_classes:%=build/org/ibex/nestedvm/%.class)
 # This is only for Brian to use... don't mess with it
 rebuild-constants: $(tasks)/build_newlib
        @mkdir -p `dirname $@`
-       cat \
-               src/org/ibex/nestedvm/syscalls.h \
-               $(usr)/mips-unknown-elf/include/sys/{errno.h,unistd.h,syslimits.h} \
-       | ( \
+       ( \
+               cat \
+                       src/org/ibex/nestedvm/syscalls.h \
+                       $(usr)/mips-unknown-elf/include/sys/{errno.h,unistd.h,syslimits.h}; \
+               $(MIPS_CC) -E -dM $(usr)/mips-unknown-elf/include/sys/fcntl.h | awk '$$2 ~ /^[OF]_/ { print; }'; \
+       ) | ( \
                echo "// THIS FILE IS AUTOGENERATED! DO NOT EDIT!"; \
                echo "// run \"make rebuild-constants\" if it needs to be updated"; \
                echo ""; \
@@ -284,12 +286,12 @@ build/tests/DJpeg.mips: $(mips_objects) $(tasks)/build_libjpeg
 # Busybox
 #
 BusyBox_COMPILERFLAGS = -o unixruntime
-build/tests/BusyBox.mips: $(mips_object) $(tasks)/build_busybox
+build/tests/BusyBox.mips: $(mips_objects) $(tasks)/build_busybox
        @mkdir -p `dirname $@`
        cp upstream/build/busybox/busybox $@
        
 busyboxtest: build/tests/BusyBox.class
-       $(JAVA) -cp build tests.BusyBox ash
+       $(JAVA) -cp $(classpath) tests.BusyBox ash
 
 #
 # Boehm GC
diff --git a/src/org/ibex/nestedvm/ClassLoader.java b/src/org/ibex/nestedvm/ClassLoader.java
deleted file mode 100644 (file)
index 2ef8fa8..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.ibex.nestedvm;
-
-//import java.io.*;
-import java.util.*;
-
-//import org.ibex.nestedvm.util.*;
-
-// FIXME: This is totally broken now
-
-// FEATURE: This is just a quick hack, it is really ugly and broken
-
-// FEATURE: Cache based on org.ibex.util.Cache
-// FEATURE: Base64 encode some id to form package name
-// FEATURE: Timestamped cache entries, requests carry minimum timestamp
-// NOTE: Need to handle binaries spanned accross many classfiles
-
-public class ClassLoader extends java.lang.ClassLoader {
-    private Hashtable cache = new Hashtable();
-    
-    public Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
-        Class c;
-        if(name.startsWith("nestedvm.")) {
-            throw new Error("probably shouldn't be here");
-            /*String path = name.substring(5).replace('.','/') + ".mips";
-            try {
-                ByteArrayOutputStream bos = new ByteArrayOutputStream();
-                new ClassFileCompiler(path,name,bos).go();
-                bos.close();
-                byte[] buf = bos.toByteArray();
-                c = defineClass(name,buf,0,buf.length);
-            } catch(IOException e) {
-                throw new ClassNotFoundException(name);
-            } catch(Compiler.Exn e) {
-                throw new ClassNotFoundException(e.getMessage());
-            }*/
-        } else {
-            c = findSystemClass(name);
-        }
-            
-        if(c == null) throw new ClassNotFoundException(name);
-        if(resolve) resolveClass(c);
-        return c;
-    }
-    
-    /*public synchronized void clearCache() {
-        cache.clear();
-    }
-    
-    public synchronized Class getCachedClass(String key, long timeStamp) {
-        String name = "nestedvm." + Base64.encode(key);
-        CacheEnt ent = (CacheEnt) cache.get(name);
-        if(ent.timeStamp < timeStamp) {
-                   cache.remove(key);
-            return null;
-        }
-        return ent.klass;
-    }
-    
-    public synchronized Class createClass(String key, long timeStamp, Seekable data) {
-           Class klass = getCachedClass(key,timeStamp);
-        if(klass != null) return klass;
-        try {
-            ByteArrayOutputStream bos = new ByteArrayOutputStream();
-            new ClassFileCompiler(data,name,bos).go();
-            bos.close();
-            byte[] buf = bos.toByteArray();
-            klass = defineClass(name,buf,0,buf.length);
-            resolveClass(klass);
-            cache.put(key,new CacheEnt(klass,timeStamp));
-            return klass;
-        } catch(Exception e) {
-                   e.printStackTrace();
-            return null;
-        }
-    }
-    
-    private class CacheEnt {
-        public CacheEnt(Class klass, long timeStamp) { this.klass = klass; this.timeStamp = timeStamp; }
-           public Class klass;
-        public long timeStamp;
-    }*/
-    
-    /*public Class classFromBinary(String path) throws ClassNotFoundException {
-        if(!path.endsWith(".mips")) throw new IllegalArgumentException("isn't a .mips");
-        return loadClass("mips." + path.substring(0,path.length()-5).replace('/','.'));
-    }
-    
-    public Runtime runtimeFromBinary(String path) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
-        return (Runtime) classFromBinary(path).newInstance();
-    }
-    
-    public static void main(String[] args) throws Exception {
-        System.exit(new ClassLoader().runtimeFromBinary(args[0]).run(args));
-    }*/
-}
index 39a4f14..a745084 100644 (file)
@@ -72,10 +72,13 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
     FD[] fds = new FD[OPEN_MAX]; // package-private for UnixRuntime
     boolean closeOnExec[] = new boolean[OPEN_MAX];
     
+    /** Pointer to a SecurityManager for this process */
+    protected SecurityManager sm;
+    public void setSecurityManager(SecurityManager sm) { this.sm = sm; }
+    
     /** Pointer to a callback for the call_java syscall */
-    protected CallJavaCB callJavaCB;
+    private CallJavaCB callJavaCB;
     public void setCallJavaCB(CallJavaCB callJavaCB) { this.callJavaCB = callJavaCB; }
-    public CallJavaCB getCallJavaCB() { return callJavaCB; }
         
     /** Temporary buffer for read/write operations */
     private byte[] _byteBuf;
@@ -126,11 +129,11 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         
         int heapStart = heapStart();
         int totalMemory = totalPages * pageSize;
-        int stackSize = max(totalMemory/64,ARG_MAX+65536);
+        int stackSize = max(totalMemory/512,ARG_MAX+65536);
         int stackPages = 0;
         if(totalPages > 1) {
             stackSize = max(stackSize,pageSize);
-            stackSize = (stackSize + pageSize) & ~(pageSize-1);
+            stackSize = (stackSize + pageSize - 1) & ~(pageSize-1);
             stackPages = stackSize >>> pageShift;
             heapStart = (heapStart + pageSize) & ~(pageSize-1);
             if(stackPages + STACK_GUARD_PAGES + (heapStart >>> pageShift) >= totalPages)
@@ -146,11 +149,13 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         readPages = new int[totalPages][];
         writePages = new int[totalPages][];
         
-        if(totalPages == 1)
+        if(totalPages == 1) {
             readPages[0] = writePages[0] = new int[pageSize>>2];
-        else
-                   for(int i=stackBottom >>> pageShift;i<writePages.length;i++)
+        } else {
+                   for(int i=(stackBottom >>> pageShift);i<writePages.length;i++) {
                            readPages[i] = writePages[i] = new int[pageSize>>2];
+            }
+        }
     
         addFD(new StdinFD(System.in));
         addFD(new StdoutFD(System.out));
@@ -555,33 +560,65 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         
         state = PAUSED;
         
-        _start();        
+        _started();        
     }
     
     /** Hook for subclasses to do their own startup */
-    protected void _start() { /* noop */ }
+    protected void _started() {  }
     
-    // FEATURE: call() that accepts an Object[] array and automatically allocates strings/arrays/etc on the stack
-    public final int call(String sym) throws CallException { return call(sym,0,0,0,0,0,0,0); }
-    public final int call(String sym, int a0) throws CallException  { return call(sym,a0,0,0,0,0,0,0); }
-    public final int call(String sym, int a0, int a1) throws CallException  { return call(sym,a0,a1,0,0,0,0,0); }
-    public final int call(String sym, int a0, int a1, int a2) throws CallException  { return call(sym,a0,a1,a2,0,0,0,0); }
-    public final int call(String sym, int a0, int a1, int a2, int a3) throws CallException  { return call(sym,a0,a1,a2,a3,0,0,0); }
-    public final int call(String sym, int a0, int a1, int a2, int a3, int a4) throws CallException  { return call(sym,a0,a1,a2,a3,a4,0,0); }
-    public final int call(String sym, int a0, int a1, int a2, int a3, int a4, int a5) throws CallException  { return call(sym,a0,a1,a2,a3,a4,a5,0); }
+    public final int call(String sym, Object[] args) throws CallException, FaultException {
+        if(state != PAUSED && state != CALLJAVA) throw new IllegalStateException("call() called in inappropriate state");
+        if(args.length > 7) throw new IllegalArgumentException("args.length > 7");
+        CPUState state = new CPUState();
+        getCPUState(state);
+        
+        int sp = state.r[SP];
+        int[] ia = new int[args.length];
+        for(int i=0;i<args.length;i++) {
+                   Object o = args[i];
+            byte[] buf = null;
+            if(o instanceof String) {
+                   buf = getBytes((String)o);
+            } else if(o instanceof byte[]) {
+                   buf = (byte[]) o;
+            } else if(o instanceof Number) {
+                   ia[i] = ((Number)o).intValue();
+            }
+            if(buf != null) {
+                   sp -= buf.length;
+                copyout(buf,sp,buf.length);
+                ia[i] = sp;
+            }
+        }
+        int oldSP = state.r[SP];
+        if(oldSP == sp) return call(sym,ia);
+        
+        state.r[SP] = sp;
+        setCPUState(state);
+        int ret = call(sym,ia);
+        state.r[SP] = oldSP;
+        setCPUState(state);
+        return ret;
+    }
+    
+    public final int call(String sym) throws CallException { return call(sym,new int[]{}); }
+    public final int call(String sym, int a0) throws CallException  { return call(sym,new int[]{a0}); }
+    public final int call(String sym, int a0, int a1) throws CallException  { return call(sym,new int[]{a0,a1}); }
     
     /** Calls a function in the process with the given arguments */
-    public final int call(String sym, int a0, int a1, int a2, int a3, int a4, int a5, int a6) throws CallException {
+    public final int call(String sym, int[] args) throws CallException {
         int func = lookupSymbol(sym);
         if(func == -1) throw new CallException(sym + " not found");
         int helper = lookupSymbol("_call_helper");
         if(helper == -1) throw new CallException("_call_helper not found");
-        return call(helper,func,a0,a1,a2,a3,a4,a5,a6);
+        return call(helper,func,args);
     }
     
     /** Executes the code at <i>addr</i> in the process setting A0-A3 and S0-S3 to the given arguments
         and returns the contents of V1 when the the pause syscall is invoked */
-    public final int call(int addr, int a0, int a1, int a2, int a3, int s0, int s1, int s2, int s3) {
+    //public final int call(int addr, int a0, int a1, int a2, int a3, int s0, int s1, int s2, int s3) {
+    public final int call(int addr, int a0, int[] rest) throws CallException {
+        if(rest.length > 7) throw new IllegalArgumentException("rest.length > 7");
         if(state != PAUSED && state != CALLJAVA) throw new IllegalStateException("call() called in inappropriate state");
         int oldState = state;
         CPUState saved = new CPUState();        
@@ -591,13 +628,15 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         cpustate.r[SP] = cpustate.r[SP]&~15;
         cpustate.r[RA] = 0xdeadbeef;
         cpustate.r[A0] = a0;
-        cpustate.r[A1] = a1;
-        cpustate.r[A2] = a2;
-        cpustate.r[A3] = a3;
-        cpustate.r[S0] = s0;
-        cpustate.r[S1] = s1;
-        cpustate.r[S2] = s2;
-        cpustate.r[S3] = s3;
+        switch(rest.length) {            
+            case 7: cpustate.r[S3] = rest[6];
+            case 6: cpustate.r[S2] = rest[5];
+            case 5: cpustate.r[S1] = rest[4];
+            case 4: cpustate.r[S0] = rest[3];
+            case 3: cpustate.r[A3] = rest[2];
+            case 2: cpustate.r[A2] = rest[1];
+            case 1: cpustate.r[A1] = rest[0];
+        }
         cpustate.pc = addr;
         
         state = RUNNING;
@@ -607,10 +646,8 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         getCPUState(cpustate);
         setCPUState(saved);
 
-        if(state != PAUSED)
-            System.out.println("WARNING: Process exit()ed while servicing a call() request");
-        else
-            state = oldState;
+        if(state != PAUSED) throw new CallException("Process exit()ed while servicing a call() request");
+        state = oldState;
         
         return cpustate.r[V1];
     }
@@ -656,7 +693,6 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         return i;
     }
 
-    // FEATURE: These should be pulled in from UsermodeConstants but fcntl.h is hard to parse
     public static final int RD_ONLY = 0;
     public static final int WR_ONLY = 1;
     public static final int RDWR = 2;
@@ -667,53 +703,57 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
     public static final int O_TRUNC = 0x0400;
     public static final int O_NONBLOCK = 0x4000;
     
-    // FEATURE: Lots of duplicate code between this and UnixRuntime.HostFS.open()
-    protected FD open(String path, int flags, int mode) throws IOException {
-        final File f = new File(path);
-        // NOTE: createNewFile is a Java2 function
-        if((flags & (O_EXCL|O_CREAT)) == (O_EXCL|O_CREAT))
-            if(!f.createNewFile()) throw new ErrnoException(EEXIST);
-        if(!f.exists() && (flags&O_CREAT) == 0) return null;
-        if(f.isDirectory()) return null;
-        final Seekable.File sf = new Seekable.File(path,mode!=RD_ONLY);
-        if((flags&O_TRUNC)!=0) sf.setLength(0);
-        return new SeekableFD(sf,flags) {
-            protected FStat _fstat() { return new HostFStat(f) {
-                public int size() {
-                    try { return sf.length(); } catch(IOException e) { return 0; }
-                }
-            };}
-        };
-    }
-    
-    /** The open syscall */
-    private int sys_open(int addr, int flags, int mode) {
-        if((flags & O_NONBLOCK) != 0) {
-            System.err.println("WARNING: O_NONBLOCK not supported");
-            return -EOPNOTSUPP;
+    FD hostFSOpen(final File f, int flags, int mode) throws ErrnoException {
+        if((flags & ~(3|O_CREAT|O_EXCL|O_APPEND|O_TRUNC)) != 0) {
+            System.err.println("WARNING: Unsupported flags passed to open(): " + toHex(flags & ~(3|O_CREAT|O_EXCL|O_APPEND|O_TRUNC)));
+            throw new ErrnoException(ENOTSUP);
         }
+        boolean write = mode!=RD_ONLY;
 
-        try {
-            FD fd = open(cstring(addr),flags,mode);
-            if(fd == null) return -ENOENT;
-            int fdn = addFD(fd);
-            if(fdn == -1) {
-                fd.close();
-                return -ENFILE;
+        if(sm != null && !(write ? sm.allowWrite(f) : sm.allowRead(f))) throw new ErrnoException(EACCES);
+        
+        if((flags & (O_EXCL|O_CREAT)) == (O_EXCL|O_CREAT)) {
+            try {
+                // NOTE: createNewFile is a Java2 function
+                if(!f.createNewFile()) throw new ErrnoException(EEXIST);
+            } catch(IOException e) {
+                throw new ErrnoException(EIO);
             }
-            return fdn;
-        }
-        catch(ErrnoException e) { return -e.errno; }
-        catch(FileNotFoundException e) {
-            if(e.getMessage() != null && e.getMessage().indexOf("Permission denied") >= 0) return -EACCES;
-            return -ENOENT;
+        } else if(!f.exists()) {
+            if((flags&O_CREAT)==0) return null;
+        } else if(f.isDirectory()) {
+            return hostFSDirFD(f);
         }
-        catch(IOException e) { return -EIO; }
-        catch(FaultException e) { return -EFAULT; }
+        
+        final Seekable.File sf;
+        try {
+            sf = new Seekable.File(f,write);
+        } catch(FileNotFoundException e) {
+            if(e.getMessage() != null && e.getMessage().indexOf("Permission denied") >= 0) throw new ErrnoException(EACCES);
+            return null;
+        } catch(IOException e) { throw new ErrnoException(EIO); }
+        
+        return new SeekableFD(sf,flags) { protected FStat _fstat() { return hostFStat(f); } };
+    }
+    
+    FStat hostFStat(File f) { return new HostFStat(f); }
+    FD hostFSDirFD(File f) { return null; }
+    
+    FD _open(String path, int flags, int mode) throws ErrnoException {
+        return hostFSOpen(new File(path),flags,mode);
+    }
+    
+    /** The open syscall */
+    private int sys_open(int addr, int flags, int mode) throws ErrnoException, FaultException {
+        FD fd = _open(cstring(addr),flags,mode);
+        if(fd == null) return -ENOENT;
+        int fdn = addFD(fd);
+        if(fdn == -1) { fd.close(); return -ENFILE; }
+        return fdn;
     }
 
     /** The write syscall */
-    private int sys_write(int fdn, int addr, int count) {
+    private int sys_write(int fdn, int addr, int count) throws FaultException {
         count = Math.min(count,MAX_CHUNK);
         if(fdn < 0 || fdn >= OPEN_MAX) return -EBADFD;
         if(fds[fdn] == null || !fds[fdn].writable()) return -EBADFD;
@@ -721,19 +761,15 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
             byte[] buf = byteBuf(count);
             copyin(addr,buf,count);
             return fds[fdn].write(buf,0,count);
-        } catch(FaultException e) {
-            System.err.println(e);
-            return -EFAULT;
         } catch(IOException e) {
-            // FEATURE: We should support signals and send a SIGPIPE
+            // NOTE: This should really send a SIGPIPE
             if(e.getMessage().equals("Pipe closed")) return sys_exit(128+13);
-            System.err.println(e);
             return -EIO;
         }
     }
 
     /** The read syscall */
-    private int sys_read(int fdn, int addr, int count) {
+    private int sys_read(int fdn, int addr, int count) throws FaultException {
         count = Math.min(count,MAX_CHUNK);
         if(fdn < 0 || fdn >= OPEN_MAX) return -EBADFD;
         if(fds[fdn] == null || !fds[fdn].readable()) return -EBADFD;
@@ -742,11 +778,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
             int n = fds[fdn].read(buf,0,count);
             copyout(buf,addr,n);
             return n;
-        } catch(FaultException e) {
-            System.err.println(e);
-            return -EFAULT;
         } catch(IOException e) {
-            System.err.println(e);
             return -EIO;
         }
     }
@@ -771,32 +803,27 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
     }
     
     /** The stat/fstat syscall helper */
-    int stat(FStat fs, int addr) {
-        try {
-            memWrite(addr+0,(fs.dev()<<16)|(fs.inode()&0xffff)); // st_dev (top 16), // st_ino (bottom 16)
-            memWrite(addr+4,((fs.type()&0xf000))|(fs.mode()&0xfff)); // st_mode
-            memWrite(addr+8,1<<16); // st_nlink (top 16) // st_uid (bottom 16)
-            memWrite(addr+12,0); // st_gid (top 16) // st_rdev (bottom 16)
-            memWrite(addr+16,fs.size()); // st_size
-            memWrite(addr+20,fs.atime()); // st_atime
-            // memWrite(addr+24,0) // st_spare1
-            memWrite(addr+28,fs.mtime()); // st_mtime
-            // memWrite(addr+32,0) // st_spare2
-            memWrite(addr+36,fs.ctime()); // st_ctime
-            // memWrite(addr+40,0) // st_spare3
-            memWrite(addr+44,fs.blksize()); // st_bklsize;
-            memWrite(addr+48,fs.blocks()); // st_blocks
-            // memWrite(addr+52,0) // st_spare4[0]
-            // memWrite(addr+56,0) // st_spare4[1]
-        } catch(FaultException e) {
-            System.err.println(e);
-            return -EFAULT;
-        }
+    int stat(FStat fs, int addr) throws FaultException {
+        memWrite(addr+0,(fs.dev()<<16)|(fs.inode()&0xffff)); // st_dev (top 16), // st_ino (bottom 16)
+        memWrite(addr+4,((fs.type()&0xf000))|(fs.mode()&0xfff)); // st_mode
+        memWrite(addr+8,1<<16); // st_nlink (top 16) // st_uid (bottom 16)
+        memWrite(addr+12,0); // st_gid (top 16) // st_rdev (bottom 16)
+        memWrite(addr+16,fs.size()); // st_size
+        memWrite(addr+20,fs.atime()); // st_atime
+        // memWrite(addr+24,0) // st_spare1
+        memWrite(addr+28,fs.mtime()); // st_mtime
+        // memWrite(addr+32,0) // st_spare2
+        memWrite(addr+36,fs.ctime()); // st_ctime
+        // memWrite(addr+40,0) // st_spare3
+        memWrite(addr+44,fs.blksize()); // st_bklsize;
+        memWrite(addr+48,fs.blocks()); // st_blocks
+        // memWrite(addr+52,0) // st_spare4[0]
+        // memWrite(addr+56,0) // st_spare4[1]
         return 0;
     }
     
     /** The fstat syscall */
-    private int sys_fstat(int fdn, int addr) {
+    private int sys_fstat(int fdn, int addr) throws FaultException {
         if(fdn < 0 || fdn >= OPEN_MAX) return -EBADFD;
         if(fds[fdn] == null) return -EBADFD;
         return stat(fds[fdn].fstat(),addr);
@@ -808,17 +835,13 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
     long tv_usec;
     };
     */
-    private int sys_gettimeofday(int timevalAddr, int timezoneAddr) {
+    private int sys_gettimeofday(int timevalAddr, int timezoneAddr) throws FaultException {
         long now = System.currentTimeMillis();
         int tv_sec = (int)(now / 1000);
         int tv_usec = (int)((now%1000)*1000);
-        try {
-            memWrite(timevalAddr+0,tv_sec);
-            memWrite(timevalAddr+4,tv_usec);
-            return 0;
-        } catch(FaultException e) {
-            return -EFAULT;
-        }
+        memWrite(timevalAddr+0,tv_sec);
+        memWrite(timevalAddr+4,tv_usec);
+        return 0;
     }
     
     private int sys_sleep(int sec) {
@@ -904,7 +927,14 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         if(state != RUNNING) throw new IllegalStateException("wound up calling sys_calljava while not in RUNNING");
         if(callJavaCB != null) {
             state = CALLJAVA;
-            int ret = callJavaCB.call(a,b,c,d);
+            int ret;
+            try {
+                ret = callJavaCB.call(a,b,c,d);
+            } catch(RuntimeException e) {
+                System.err.println("Error while executing callJavaCB");
+                   e.printStackTrace();
+                ret = 0;
+            }
             state = RUNNING;
             return ret;
         } else {
@@ -927,21 +957,18 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
     }
 
     
-    /** Hook for subclasses to do something when the process exits (MUST set state = EXITED) */
-    protected void _exit() { state = EXITED; }
+    /** Hook for subclasses to do something when the process exits  */
+    protected void _exited() {  }
+    
     private int sys_exit(int status) {
         exitStatus = status;
         for(int i=0;i<fds.length;i++) if(fds[i] != null) closeFD(i);
-        _exit();
+        state = EXITED;
+        _exited();
         return 0;
     }
        
     private int sys_fcntl(int fdn, int cmd, int arg) {
-           // FEATURE: Pull these from fcntl.h
-        final int F_DUPFD = 0;
-        final int F_GETFD = 1;
-        final int F_SETFD = 2;
-        final int F_GETFL = 3;
         int i;
             
         if(fdn < 0 || fdn >= OPEN_MAX) return -EBADFD;
@@ -976,7 +1003,21 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         <i>syscall</i> should be the contents of V0 and <i>a</i>, <i>b</i>, <i>c</i>, and <i>d</i> should be 
         the contenst of A0, A1, A2, and A3. The call MAY change the state
         @see Runtime#state state */
-    protected int syscall(int syscall, int a, int b, int c, int d) {
+    protected final int syscall(int syscall, int a, int b, int c, int d) {
+        try {
+                   return _syscall(syscall,a,b,c,d);
+        } catch(ErrnoException e) {
+            e.printStackTrace();
+                   return -e.errno;
+        } catch(FaultException e) {
+                   return -EFAULT;
+        } catch(RuntimeException e) {
+            e.printStackTrace();
+                   throw new Error("Internal Error in _syscall()");
+        }
+    }
+    
+    int _syscall(int syscall, int a, int b, int c, int d) throws ErrnoException, FaultException {
         switch(syscall) {
             case SYS_null: return 0;
             case SYS_exit: return sys_exit(a);
@@ -1189,17 +1230,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         private final boolean executable; 
         public HostFStat(File f) {
             this.f = f;
-            boolean _executable = false;
-            // FEATURE: This might be too expensive
-            try {
-                FileInputStream fis = new FileInputStream(f);
-                switch(fis.read()) {
-                    case '\177': _executable = fis.read() == 'E' && fis.read() == 'L' && fis.read() == 'F'; break;
-                    case '#': _executable = fis.read() == '!';
-                }
-                fis.close();
-            } catch(IOException e) { /* ignore */ }
-            executable = _executable;
+            executable = executable();
         }
         public int dev() { return 1; }
         public int inode() { return f.getName().hashCode() & 0xffff; }
@@ -1215,6 +1246,8 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         }
         public int size() { return (int) f.length(); }
         public int mtime() { return (int)(f.lastModified()/1000); }
+        
+        boolean executable() { return false; }
     }
     
     // Exceptions
@@ -1240,7 +1273,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         public CallException(String s) { super(s); }
     }
     
-    protected static class ErrnoException extends IOException {
+    protected static class ErrnoException extends Exception {
         public int errno;
         public ErrnoException(int errno) { super("Errno: " + errno); this.errno = errno; }
     }
@@ -1270,6 +1303,12 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         }
     }
     
+    public static class SecurityManager {
+           public boolean allowRead(File f) { return true; }
+        public boolean allowWrite(File f) { return true; }
+        public boolean allowStat(File f) { return true; }
+    }
+    
     // Null pointer check helper function
     protected final void nullPointerCheck(int addr) throws ExecutionException {
         if(addr < 65536)
@@ -1292,7 +1331,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         }
     }
     
-    /** Decode an packed string.. FEATURE: document this better */
+    /** Decode a packed string */
     protected static final int[] decodeData(String s, int words) {
         if(s.length() % 8 != 0) throw new IllegalArgumentException("string length must be a multiple of 8");
         if((s.length() / 8) * 7 < words*4) throw new IllegalArgumentException("string isn't big enough");
index 5b47219..051a50b 100644 (file)
@@ -4,25 +4,19 @@ import org.ibex.nestedvm.util.*;
 import java.io.*;
 import java.util.*;
 
+// FEATURE: Remove System.{out,err}.printlns and throw Errors where applicable
+
 // FEATURE: BusyBox's ASH doesn't like \r\n at the end of lines
 // is ash just broken or are many apps like this? if so workaround in nestedvm
 
-// FEATURE: Throw ErrnoException and catch in syscall whereever possible 
-// (only in cases where we've already paid the price for a throw)
-
 public abstract class UnixRuntime extends Runtime implements Cloneable {
     /** The pid of this "process" */
     private int pid;
-    private int ppid;
+    private UnixRuntime parent;
     protected int getPid() { return pid; }
     
-    /** processes filesystem */
-    private FS fs;
-    public FS getFS() { return fs; }
-    public void setFS(FS fs) {
-        if(state != STOPPED) throw new IllegalStateException("Can't change fs while process is running");
-        this.fs = fs;
-    }
+    private static final GlobalState defaultGD = new GlobalState();
+    private GlobalState gd = defaultGD;
     
     /** proceses' current working directory - absolute path WITHOUT leading slash
         "" = root, "bin" = /bin "usr/bin" = /usr/bin */
@@ -30,40 +24,14 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
     
     /** The runtime that should be run next when in state == EXECED */
     private UnixRuntime execedRuntime;
-    
-    /* Static stuff */
-    // FEATURE: Most of this is O(n) or worse - fix it
-    private final Object waitNotification = new Object();
-    private final static int MAX_TASKS = 256;
-    private final static UnixRuntime[] tasks = new UnixRuntime[MAX_TASKS];
-    private static int addTask(UnixRuntime rt) {
-        synchronized(tasks) {
-            for(int i=1;i<MAX_TASKS;i++) {
-                if(tasks[i] == null) {
-                    tasks[i] = rt;
-                    rt.pid = i;
-                    return i;
-                }
-            }
-            return -1;
-        }
-    }
-    private static void removeTask(UnixRuntime rt) {
-        synchronized(tasks) {
-            for(int i=1;i<MAX_TASKS;i++)
-                if(tasks[i] == rt) { tasks[i] = null; break; }
-        }
-    }
+
+    private Object children; // used only for synchronizatin
+    private Vector activeChildren;
+    private Vector exitedChildren;
     
     public UnixRuntime(int pageSize, int totalPages) {
         super(pageSize,totalPages);
-        
-        FS root = new HostFS();
-        FS dev = new DevFS();
-        MountPointFS mounts = new MountPointFS(root);
-        mounts.add("/dev",dev);
-        fs = mounts;
-        
+                
         // FEATURE: Do the proper mangling for non-unix hosts
         String userdir = getSystemProperty("user.dir");
         cwd = userdir != null && userdir.startsWith("/") && File.separatorChar == '/'  ? userdir.substring(1) : "";
@@ -108,25 +76,27 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
         return env;
     }
     
-    protected void _start() {
-        if(addTask(this) < 0) throw new Error("Task list full");
-    }
+    private static class ProcessTableFullExn extends RuntimeException { }
     
-    protected void _exit() {
-        synchronized(tasks) {
-            if(ppid == 0) removeTask(this);
-            for(int i=0;i<MAX_TASKS;i++) {
-                if(tasks[i] != null && tasks[i].ppid == pid) {
-                    if(tasks[i].state == EXITED) removeTask(tasks[i]);
-                    else tasks[i].ppid = 0;
-                }
+    protected void _started() {
+        UnixRuntime[] tasks = gd.tasks;
+        synchronized(gd) {
+            if(pid != 0) {
+                if(tasks[pid] == null || tasks[pid].pid != pid) throw new Error("should never happen");
+            } else {
+                int newpid = -1;
+                int nextPID = gd.nextPID;
+                   for(int i=nextPID;i<tasks.length;i++) if(tasks[i] == null) { newpid = i; break; }
+                   if(newpid == -1) for(int i=1;i<nextPID;i++) if(tasks[i] == null) { newpid = i; break; }
+                   if(newpid == -1) throw new ProcessTableFullExn();
+                   pid = newpid;
+                gd.nextPID = newpid + 1;
             }
-            state = EXITED;
-            if(ppid != 0) synchronized(tasks[ppid].waitNotification) { tasks[ppid].waitNotification.notify(); }
+            tasks[pid] = this;
         }
     }
-
-    protected int syscall(int syscall, int a, int b, int c, int d) {
+    
+    int _syscall(int syscall, int a, int b, int c, int d) throws ErrnoException, FaultException {
         switch(syscall) {
             case SYS_kill: return sys_kill(a,b);
             case SYS_fork: return sys_fork();
@@ -134,22 +104,20 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
             case SYS_dup2: return sys_dup2(a,b);
             case SYS_waitpid: return sys_waitpid(a,b,c);
             case SYS_stat: return sys_stat(a,b);
+            case SYS_lstat: return sys_lstat(a,b);
             case SYS_mkdir: return sys_mkdir(a,b);
             case SYS_getcwd: return sys_getcwd(a,b);
             case SYS_chdir: return sys_chdir(a);
-            case SYS_execve: return sys_execve(a,b,c);
+            case SYS_exec: return sys_exec(a,b,c);
 
-            default: return super.syscall(syscall,a,b,c,d);
+            default: return super._syscall(syscall,a,b,c,d);
         }
     }
     
-    protected FD open(String path, int flags, int mode) throws IOException {
-        return fs.open(normalizePath(path),flags,mode);
+    protected FD _open(String path, int flags, int mode) throws ErrnoException {
+        return gd.open(this,normalizePath(path),flags,mode);
     }
 
-    // FEATURE: Allow simple, broken signal delivery to other processes 
-    // (check if a signal was delivered before and after syscalls)
-    // FEATURE: Implement raise() in terms of call("raise",...) - kinda cheap, but it keeps the complexity in newlib
     /** The kill syscall.
        SIGSTOP, SIGTSTO, SIGTTIN, and SIGTTOUT pause the process.
        SIGCONT, SIGCHLD, SIGIO, and SIGWINCH are ignored.
@@ -178,45 +146,87 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
         return 0;
     }
 
-    private int sys_waitpid(int pid, int statusAddr, int options) {
+    private int sys_waitpid(int pid, int statusAddr, int options) throws FaultException, ErrnoException {
+        System.err.println("PID: " + this.pid + " is waiting on " + pid);
         final int WNOHANG = 1;
         if((options & ~(WNOHANG)) != 0) return -EINVAL;
-        if(pid !=-1 && (pid <= 0 || pid >= MAX_TASKS)) return -ECHILD;
-        for(;;) {
-            synchronized(tasks) {
-                UnixRuntime task = null;
+        if(pid == 0 || pid < -1) {
+            System.err.println("WARNING: waitpid called with a pid of " + pid);
+            return -ECHILD;
+        }
+        boolean blocking = (options&WNOHANG)==0;
+        
+        if(pid !=-1 && (pid <= 0 || pid >= gd.tasks.length)) return -ECHILD;
+        if(children == null) return blocking ? -ECHILD : 0;
+        
+        UnixRuntime done = null;
+        
+        synchronized(children) {
+            for(;;) {
                 if(pid == -1) {
-                    for(int i=0;i<MAX_TASKS;i++) {
-                        if(tasks[i] != null && tasks[i].ppid == this.pid && tasks[i].state == EXITED) {
-                            task = tasks[i];
-                            break;
-                        }
+                    if(exitedChildren.size() > 0) done = (UnixRuntime)exitedChildren.remove(exitedChildren.size() - 1);
+                } else if(pid > 0) {
+                    UnixRuntime t = gd.tasks[pid];
+                    if(t.parent != this) return -ECHILD;
+                    if(t.state == EXITED) {
+                        if(!exitedChildren.remove(t)) throw new Error("should never happen");
+                        done = t;
                     }
-                } else if(tasks[pid] != null && tasks[pid].ppid == this.pid && tasks[pid].state == EXITED) {
-                    task = tasks[pid];
+                } else {
+                    // process group stuff, EINVAL returned above
+                           throw new Error("should never happen");
                 }
-                
-                if(task != null) {
-                    removeTask(task);
-                    try {
-                        if(statusAddr!=0) memWrite(statusAddr,task.exitStatus()<<8);
-                    } catch(FaultException e) {
-                        return -EFAULT;
-                    }
-
-                    return task.pid;
+                if(done == null) {
+                    if(!blocking) return 0;
+                    try { children.wait(); } catch(InterruptedException e) {}
+                    System.err.println("waitpid woke up: " + exitedChildren.size());
+                } else {
+                    gd.tasks[done.pid] = null;
+                    break;
                 }
             }
-            if((options&WNOHANG)!=0) return 0;
-            synchronized(waitNotification) {
-                try { waitNotification.wait(); } catch(InterruptedException e) { /* ignore */ }
+        }
+        if(statusAddr!=0) memWrite(statusAddr,done.exitStatus()<<8);
+        return done.pid;
+    }
+    
+    
+    protected void _exited() {
+        if(children != null) synchronized(children) {
+            for(Enumeration e = exitedChildren.elements(); e.hasMoreElements(); ) {
+                UnixRuntime child = (UnixRuntime) e.nextElement();
+                    gd.tasks[child.pid] = null;
+            }
+            exitedChildren.clear();
+            for(Enumeration e = activeChildren.elements(); e.hasMoreElements(); ) {
+                UnixRuntime child = (UnixRuntime) e.nextElement();
+                child.parent = null;
+            }
+            activeChildren.clear();
+        }
+        
+        UnixRuntime _parent = parent;
+        if(_parent == null) {
+            gd.tasks[pid] = null;
+        } else {
+            synchronized(_parent.children) {
+                if(parent == null) {
+                    gd.tasks[pid] = null;
+                } else {
+                    parent.activeChildren.remove(this);
+                    parent.exitedChildren.add(this);
+                    parent.children.notify();
+                }
             }
         }
     }
     
     protected Object clone() throws CloneNotSupportedException {
            UnixRuntime r = (UnixRuntime) super.clone();
-        r.pid = r.ppid = 0;
+        r.pid = 0;
+        r.parent = null;
+        r.children = null;
+        r.activeChildren = r.exitedChildren = null;
         return r;
     }
 
@@ -232,29 +242,37 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
             e.printStackTrace();
             return -ENOMEM;
         }
-        
-        int childPID = addTask(r);
-        if(childPID < 0) return -ENOMEM;
-        
-        r.ppid = pid;
+
+        r.parent = this;
+
+        try {
+            r._started();
+        } catch(ProcessTableFullExn e) {
+                   return -ENOMEM;
+        }
+
+        System.err.println("fork " + pid + " -> " + r.pid + " tasks[" + r.pid + "] = " + gd.tasks[r.pid]);
+        if(children == null) {
+            children = new Object();
+            activeChildren = new Vector();
+            exitedChildren = new Vector();
+        }
+        activeChildren.add(r);
         
         state.r[V0] = 0; // return 0 to child
         state.pc += 4; // skip over syscall instruction
         r.setCPUState(state);
         r.state = PAUSED;
         
-        new Thread() {
-            public void run() {
-                try {
-                    while(!r.execute());
-                } catch(Exception e) {
-                    System.err.println("Forked process threw exception: ");
-                    e.printStackTrace();
-                }
-            }
-        }.start();
+        new ForkedProcess(r);
         
-        return childPID;
+        return r.pid;
+    }
+    
+    public static final class ForkedProcess extends Thread {
+        private final UnixRuntime initial;
+        public ForkedProcess(UnixRuntime initial) { this.initial = initial; start(); }
+        public void run() { UnixRuntime.executeAndExec(initial); }
     }
     
     public static int runAndExec(UnixRuntime r, String argv0, String[] rest) { return runAndExec(r,concatArgv(argv0,rest)); }
@@ -279,73 +297,40 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
         return a;
     }
     
-    // FEATURE: call the syscall just "exec"
-    private int sys_execve(int cpath, int cargv, int cenvp) {
-        try {
-                   return exec(normalizePath(cstring(cpath)),readStringArray(cargv),readStringArray(cenvp));
-        } catch(FaultException e) {
-            return -EFAULT;
-        }
+    private int sys_exec(int cpath, int cargv, int cenvp) throws ErrnoException, FaultException {
+           return exec(normalizePath(cstring(cpath)),readStringArray(cargv),readStringArray(cenvp));
     }
-    
-    private int exec(String path, String[] argv, String[] envp) {
-        if(argv.length == 0) argv = new String[]{""};
-        Seekable s;
-        FD fd;
-        
-        try {
-            fd = fs.open(path,RD_ONLY,0);
-            System.err.println(fd + "  " + path);
-            if(fd == null) return -ENOENT;
-            s = fd.seekable();
-            if(s == null) return -ENOEXEC;
-        }
-        catch(ErrnoException e) { return -e.errno; }
-        catch(FileNotFoundException e) {
-            if(e.getMessage() != null && e.getMessage().indexOf("Permission denied") >= 0) return -EACCES;
-            return -ENOENT;
-        }
-        catch(IOException e) { return -EIO; }
         
-        try {
-            int p = 0;
-            byte[] buf = new byte[4096];
-            OUTER: for(;;) {
-                   int n = s.read(buf,p,buf.length-p);
-                if(n == -1) break;
-                for(;n > 0; n--) if(buf[p++] == '\n' || p == 4096) break OUTER;
-            }
-            if(buf[0] == '!' && buf[1] == '#') {
-                   String cmd = new String(buf,2,p-2);
-                String argv1 = null;
-                if((p = cmd.indexOf(' ')) != -1) {
-                    do { p++; } while(cmd.charAt(p)==' ');
-                           argv1 = cmd.substring(p);
-                    cmd = cmd.substring(0,p-1);
-                }
-                String[] newArgv = new String[argv.length + argv1 != null ? 2 : 1];
-                p = 0;
-                newArgv[p++] = argv[0];
-                if(argv1 != null) newArgv[p++] = argv1;
-                newArgv[p++] = path;
-                for(int i=1;i<argv.length;i++) newArgv[p++] = argv[i];
-                fd.close();
-                return exec(cmd,newArgv,envp);
-            } else if(buf[0] == '\177' && buf[1] == 'E' && buf[2] == 'L' && buf[3] == 'F') {
-                s.seek(0);
-                   UnixRuntime r = new Interpreter(s);
-                fd.close();
-                return exec(r,argv,envp);
-            } else {
-                   return -ENOEXEC;
+    private int exec(String normalizedPath, String[] argv, String[] envp) throws ErrnoException {
+        if(argv.length == 0) argv = new String[]{""};
+
+        Object o = gd.exec(this,normalizedPath);
+        if(o == null) return -ENOENT;
+
+        if(o instanceof Class) {
+            Class c = (Class) o;
+            try {
+                   return exec((UnixRuntime) c.newInstance(),argv,envp);
+            } catch(Exception e) {
+                   e.printStackTrace();
+                return -ENOEXEC;
             }
-        } catch(IOException e) {
-                   e.printStackTrace();
-            return -ENOEXEC;
+        } else {
+            String[] command = (String[]) o;
+            String[] newArgv = new String[argv.length + command[1] != null ? 2 : 1];
+            int p = command[0].lastIndexOf('/');
+            newArgv[0] = p == -1 ? command[0] : command[0].substring(p+1);
+            p = 1;
+            if(command[1] != null) newArgv[p++] = command[1];
+            newArgv[p++] = "/" + normalizedPath;
+            for(int i=1;i<argv.length;i++) newArgv[p++] = argv[i];
+            return exec(command[0],newArgv,envp);
         }
     }
     
-    private int exec(UnixRuntime r, String[] argv, String[] envp) {        
+    private int exec(UnixRuntime r, String[] argv, String[] envp) {     
+        
+        System.err.println("Execing " + r);
         for(int i=0;i<OPEN_MAX;i++) if(closeOnExec[i]) closeFD(i);
         r.fds = fds;
         r.closeOnExec = closeOnExec;
@@ -353,12 +338,13 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
         fds = null;
         closeOnExec = null;
         
+        r.gd = gd;
+        r.sm = sm;
         r.cwd = cwd;
-        r.fs = fs;
         r.pid = pid;
-        r.ppid = ppid;
+        r.parent = parent;
         r.start(argv,envp);
-        
+                
         state = EXECED;
         execedRuntime = r;
         
@@ -366,7 +352,7 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
     }
     
     // FEATURE: Use custom PipeFD - be sure to support PIPE_BUF of data
-    private int sys_pipe(int addr) {
+    private int sys_pipe(int addr) throws FaultException {
         PipedOutputStream writerStream = new PipedOutputStream();
         PipedInputStream readerStream;
         try {
@@ -401,107 +387,261 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
         return 0;
     }
     
-    private int sys_stat(int cstring, int addr) {
-        try {
-            String path = normalizePath(cstring(cstring));
-            return stat(fs.stat(path),addr);
-        }
-        catch(ErrnoException e) { return -e.errno; }
-        catch(FileNotFoundException e) {
-            if(e.getMessage() != null && e.getMessage().indexOf("Permission denied") >= 0) return -EACCES;
-            return -ENOENT;
-        }
-        catch(IOException e) { return -EIO; }
-        catch(FaultException e) { return -EFAULT; }
+    private int sys_stat(int cstring, int addr) throws FaultException, ErrnoException {
+        FStat s = gd.stat(this,normalizePath(cstring(cstring)));
+        if(s == null) return -ENOENT;
+        return stat(s,addr);
     }
     
+    private int sys_lstat(int cstring, int addr) throws FaultException, ErrnoException {
+        FStat s = gd.lstat(this,normalizePath(cstring(cstring)));
+        if(s == null) return -ENOENT;
+        return stat(s,addr);
+    }
     
-    private int sys_mkdir(int cstring, int mode) {
-        try {
-            fs.mkdir(normalizePath(cstring(cstring)));
-            return 0;
-        }
-        catch(ErrnoException e) { return -e.errno; }
-        catch(FileNotFoundException e) { return -ENOENT; }
-        catch(IOException e) { return -EIO; }
-        catch(FaultException e) { return -EFAULT; }
+    private int sys_mkdir(int cstring, int mode) throws FaultException, ErrnoException {
+        gd.mkdir(this,normalizePath(cstring(cstring)),mode);
+        return 0;
     }
    
     
-    private int sys_getcwd(int addr, int size) {
+    private int sys_getcwd(int addr, int size) throws FaultException, ErrnoException {
         byte[] b = getBytes(cwd);
         if(size == 0) return -EINVAL;
         if(size < b.length+2) return -ERANGE;
-        try {
-            memset(addr,'/',1);
-            copyout(b,addr+1,b.length);
-            memset(addr+b.length+1,0,1);
-            return addr;
-        } catch(FaultException e) {
-            return -EFAULT;
-        }
+        memset(addr,'/',1);
+        copyout(b,addr+1,b.length);
+        memset(addr+b.length+1,0,1);
+        return addr;
     }
     
-    private int sys_chdir(int addr) {
-        try {
-            String path = normalizePath(cstring(addr));
-            System.err.println("Chdir: " + cstring(addr) + " -> " + path + " pwd: " + cwd);
-            if(fs.stat(path).type() != FStat.S_IFDIR) return -ENOTDIR;
-            cwd = path;
-            System.err.println("Now: [" + cwd + "]");
-            return 0;
-        }
-        catch(ErrnoException e) { return -e.errno; }
-        catch(FileNotFoundException e) { return -ENOENT; }
-        catch(IOException e) { return -EIO; }
-        catch(FaultException e) { return -EFAULT; }
+    private int sys_chdir(int addr) throws ErrnoException, FaultException {
+        String path = normalizePath(cstring(addr));
+        System.err.println("Chdir: " + cstring(addr) + " -> " + path + " pwd: " + cwd);
+        if(gd.stat(this,path).type() != FStat.S_IFDIR) return -ENOTDIR;
+        cwd = path;
+        System.err.println("Now: [" + cwd + "]");
+        return 0;
     }
-
-    public void chdir(String dir) throws FileNotFoundException {
-        if(state != STOPPED) throw new IllegalStateException("Can't chdir while process is running");
-        try {
-            dir = normalizePath(dir);
-            if(fs.stat(dir).type() != FStat.S_IFDIR) throw new FileNotFoundException();
-        } catch(IOException e) {
-            throw new FileNotFoundException();
+    
+    //  FEATURE: Run through the fork/wait stuff one more time
+    public static class GlobalState {    
+        protected static final int OPEN = 1;
+        protected static final int STAT = 2;
+        protected static final int LSTAT = 3;
+        protected static final int MKDIR = 4;
+        
+        // Make this protected (need to fix _exit)
+        private final UnixRuntime[] tasks;
+        private int nextPID = 1;
+        
+        private final MP[][] mps = new MP[128][];
+        private FS root;
+        
+        public GlobalState() { this(255); }
+        public GlobalState(int maxProcs) { this(maxProcs,true); }
+        public GlobalState(int maxProcs, boolean defaultMounts) {
+            tasks = new UnixRuntime[maxProcs+1];
+            if(defaultMounts) {
+                   root = new HostFS();
+                addMount("/dev",new DevFS());
+            }
         }
-        cwd = dir;
-    }
         
-    public abstract static class FS {
-        protected FD _open(String path, int flags, int mode) throws IOException { return null; }
-        protected FStat _stat(String path) throws IOException { return null; }
-        protected void _mkdir(String path) throws IOException { throw new ErrnoException(EROFS); }
+        private static class MP {
+            public MP(String path, FS fs) { this.path = path; this.fs = fs; }
+            public String path;
+            public FS fs;
+            public int compareTo(Object o) {
+                if(!(o instanceof MP)) return 1;
+                return -path.compareTo(((MP)o).path);
+            }
+        }
         
-        protected static final int OPEN = 1;
-        protected static final int STAT = 2;
-        protected static final int MKDIR = 3;
+        public synchronized FS getMount(String path) {
+            if(!path.startsWith("/")) throw new IllegalArgumentException("Mount point doesn't start with a /");
+            if(path.equals("/")) return root;
+            path  = path.substring(1);
+            int f = path.charAt(0) & 0x7f;
+            for(int i=0;mps[f] != null && i < mps[f].length;i++)
+                if(mps[f][i].path.equals(path)) return mps[f][i].fs;
+            return null;
+        }
+        
+        public synchronized void addMount(String path, FS fs) {
+            if(getMount(path) != null) throw new IllegalArgumentException("mount point already exists");
+            if(!path.startsWith("/")) throw new IllegalArgumentException("Mount point doesn't start with a /");
+            if(path.equals("/")) { root = fs; return; }
+            path = path.substring(1);
+            int f = path.charAt(0) & 0x7f;
+            int oldLength = mps[f] == null ? 0 : mps[f].length;
+            MP[] newList = new MP[oldLength + 1];
+            if(oldLength != 0) System.arraycopy(mps[f],0,newList,0,oldLength);
+            newList[oldLength] = new MP(path,fs);
+            Arrays.sort(newList);
+            mps[f] = newList;
+        }
+        
+        public synchronized void removeMount(String path) {
+            if(getMount(path) == null) throw new IllegalArgumentException("mount point doesn't exist");
+            if(!path.startsWith("/")) throw new IllegalArgumentException("Mount point doesn't start with a /");
+            if(path.equals("/")) { root = null; return; }
+            path = path.substring(1);
+            int f = path.charAt(0) & 0x7f;
+            MP[] oldList = mps[f];
+            MP[] newList = new MP[oldList.length - 1];
+            int p = 0;
+            for(p=0;p<oldList.length;p++) if(oldList[p].path.equals(path)) break;
+            if(p == oldList.length) throw new Error("should never happen");
+            System.arraycopy(oldList,0,newList,0,p);
+            System.arraycopy(oldList,0,newList,p,oldList.length-p-1);
+            mps[f] = newList;
+        }
+        
+        private Object fsop(int op, UnixRuntime r, String path, int arg1, int arg2) throws ErrnoException {
+            int pl = path.length();
+            if(pl != 0) {
+                   MP[] list = mps[path.charAt(0) & 0x7f];
+                if(list != null) {
+                    for(int i=0;i<list.length;i++) {
+                           MP mp = list[i];
+                           int mpl = mp.path.length();
+                        if(path.startsWith(mp.path) && (pl == mpl || (pl < mpl && path.charAt(mpl) == '/')))
+                                   return dispatch(mp.fs,op,r,pl == mpl ? "" : path.substring(mpl+1),arg1,arg2);
+                    }
+                }
+            }
+            return dispatch(root,op,r,path,arg1,arg2);
+        }
         
-        protected Object op(int op, String path, int arg1, int arg2) throws IOException {
-                       switch(op) {
-                               case OPEN: return _open(path,arg1,arg2);
-                               case STAT: return _stat(path);
-                               case MKDIR: _mkdir(path); return null;
-                               default: throw new IllegalArgumentException("Unknown FS OP");
-                       }
+        private static Object dispatch(FS fs, int op, UnixRuntime r, String path, int arg1, int arg2) throws ErrnoException {
+            switch(op) {
+                   case OPEN: return fs.open(r,path,arg1,arg2);
+                case STAT: return fs.stat(r,path);
+                case LSTAT: return fs.lstat(r,path);
+                case MKDIR: fs.mkdir(r,path,arg1); return null;
+                default: throw new Error("should never happen");
+            }
         }
         
-        public final FD open(String path, int flags, int mode) throws IOException { return (FD) op(OPEN,path,flags,mode); }
-        public final FStat stat(String path) throws IOException { return (FStat) op(STAT,path,0,0); }
-        public final void mkdir(String path) throws IOException { op(MKDIR,path,0,0); }
+        public final FD open(UnixRuntime r, String path, int flags, int mode) throws ErrnoException { return (FD) fsop(OPEN,r,path,flags,mode); }
+        public final FStat stat(UnixRuntime r, String path) throws ErrnoException { return (FStat) fsop(STAT,r,path,0,0); }
+        public final FStat lstat(UnixRuntime r, String path) throws ErrnoException { return (FStat) fsop(LSTAT,r,path,0,0); }
+        public final void mkdir(UnixRuntime r, String path, int mode) throws ErrnoException { fsop(MKDIR,r,path,mode,0); }
         
-               
+        private Hashtable execCache = new Hashtable();
+        private static class CacheEnt {
+            public final long time;
+            public final long size;
+            public final Object o;
+            public CacheEnt(long time, long size, Object o) { this.time = time; this.size = size; this.o = o; }
+        }
+
+        public synchronized Object exec(UnixRuntime r, String path) throws ErrnoException {
+            FStat fstat = stat(r,path);
+            if(fstat == null) return null;
+            long mtime = fstat.mtime();
+            long size = fstat.size();
+            CacheEnt ent = (CacheEnt) execCache.get(path);
+            if(ent != null) {
+                System.err.println("Found cached entry for " + path);
+                   if(ent.time == mtime && ent.size == size) return ent.o;
+                System.err.println("Cache was out of date");
+                execCache.remove(path);
+            }
+            FD fd = open(r,path,RD_ONLY,0);
+            if(fd == null) return null;
+            Seekable s = fd.seekable();
+            
+            String[] command  = null;
+
+            if(s == null) throw new ErrnoException(EACCES);
+            byte[] buf = new byte[4096];
+            
+            try {
+                int n = s.read(buf,0,buf.length);
+                if(n == -1) throw new Error("zero length file");
+                
+                switch(buf[0]) {
+                    case '\177': // possible ELF
+                        if(n < 4 && s.tryReadFully(buf,n,4-n) != 4-n) throw new ErrnoException(ENOEXEC);
+                        if(buf[1] != 'E' || buf[2] != 'L' || buf[3] != 'F') throw new ErrnoException(ENOEXEC);
+                        break;
+                    case '#':
+                        if(n == 1) {
+                                   int n2 = s.read(buf,1,buf.length-1);
+                            if(n2 == -1) throw new ErrnoException(ENOEXEC);
+                            n += n2;
+                        }
+                        if(buf[1] != '!') throw new ErrnoException(ENOEXEC);
+                        int p = 2;
+                        n -= 2;
+                        OUTER: for(;;) {
+                                   for(int i=p;i<p+n;i++) if(buf[i] == '\n') { p = i; break OUTER; }
+                            p += n;
+                            if(p == buf.length) break OUTER;
+                            n = s.read(buf,p,buf.length-p);
+                        }
+                        command = new String[2];
+                        int arg;
+                        for(arg=2;arg<p;arg++) if(buf[arg] == ' ') break;
+                        if(arg < p) {
+                            int cmdEnd = arg;
+                                   while(arg < p && buf[arg] == ' ') arg++;
+                            command[0] = new String(buf,2,cmdEnd);
+                            command[1] = arg < p ? new String(buf,arg,p-arg) : null;
+                        } else {
+                                   command[0] = new String(buf,2,p-2);
+                        }
+                        System.err.println("command[0]: " + command[0] + " command[1]: " + command[1]);
+                        break;
+                    default:
+                        throw new ErrnoException(ENOEXEC);
+                }
+            } catch(IOException e) {
+                fd.close();
+                   throw new ErrnoException(EIO);
+            }
+                        
+            if(command == null) {
+                // its an elf binary
+                try {
+                    s.seek(0);
+                           Class c = RuntimeCompiler.compile(s);
+                    System.err.println("Compile succeeded: " + c);
+                    ent = new CacheEnt(mtime,size,c);
+                } catch(Compiler.Exn e) {
+                    throw new ErrnoException(ENOEXEC);
+                } catch(IOException e) {
+                           throw new ErrnoException(EIO);
+                }
+            } else {
+                   ent = new CacheEnt(mtime,size,command);
+            }
+            
+            fd.close();
+            
+            execCache.put(path,ent);
+            return ent.o;
+        }
+    }
+        
+    public abstract static class FS {
                // FEATURE: inode stuff
         // FEATURE: Implement whatever is needed to get newlib's opendir and friends to work - that patch is a pain
-        protected static FD directoryFD(String[] files, int hashCode) throws IOException {
+        protected static FD directoryFD(String[] files, int hashCode)  {
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             DataOutputStream dos = new DataOutputStream(bos);
-            for(int i=0;i<files.length;i++) {
-                byte[] b = getBytes(files[i]);
-                int inode = (files[i].hashCode() ^ hashCode) & 0xfffff;
-                dos.writeInt(inode);
-                dos.writeInt(b.length);
-                dos.write(b,0,b.length);
+            try {
+                   for(int i=0;i<files.length;i++) {
+                               byte[] b = getBytes(files[i]);
+                    int inode = (files[i].hashCode() ^ hashCode) & 0xfffff;
+                    dos.writeInt(inode);
+                    dos.writeInt(b.length);
+                    dos.write(b,0,b.length);
+                }
+            } catch(IOException e) {
+                   return null;
             }
             final byte[] data = bos.toByteArray();
             return new SeekableFD(new Seekable.ByteArray(data,false),RD_ONLY) {
@@ -511,6 +651,14 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
                 }; }
             };
         }
+
+        public FStat lstat(UnixRuntime r, String path) throws ErrnoException { return stat(r,path); }
+
+        // If this returns null it'll be truned into an ENOENT
+        public abstract FD open(UnixRuntime r, String path, int flags, int mode) throws ErrnoException;
+        // If this returns null it'll be turned into an ENOENT
+        public abstract FStat stat(UnixRuntime r, String path) throws ErrnoException;
+        public abstract void mkdir(UnixRuntime r, String path, int mode) throws ErrnoException;
     }
         
     private String normalizePath(String path) {
@@ -555,76 +703,22 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
         //System.err.println("normalize: " + path + " -> " + new String(out,0,outp) + " (cwd: " + cwd + ")");
         return new String(out,0,outp);
     }
+         
+    // FEATURE: override Runtime.hostFStat to add executable type checking
+    // hostFStat
+    /*             try {
+                FileInputStream fis = new FileInputStream(f);
+                switch(fis.read()) {
+                    case '\177': _executable = fis.read() == 'E' && fis.read() == 'L' && fis.read() == 'F'; break;
+                    case '#': _executable = fis.read() == '!';
+                }
+                fis.close();
+            } catch(IOException e) { }
+    */
+
+    // FEATURE: inode stuff
+    FD hostFSDirFD(File f) { return FS.directoryFD(f.list(),f.hashCode()); }
     
-    public static class MountPointFS extends FS {
-        private static class MP {
-            public MP(String path, FS fs) { this.path = path; this.fs = fs; }
-            public String path;
-            public FS fs;
-            public int compareTo(Object o) {
-                if(!(o instanceof MP)) return 1;
-                return -path.compareTo(((MP)o).path);
-            }
-        }
-        private final MP[][] mps = new MP[128][];
-        private final FS root;
-        public MountPointFS(FS root) { this.root = root; }
-        
-        private static String fixup(String path) {
-            if(!path.startsWith("/")) throw new IllegalArgumentException("Mount point doesn't start with a /");
-            path = path.substring(1);
-            if(path.length() == 0) throw new IllegalArgumentException("Zero length mount point path");
-            return path;
-        }
-        public synchronized FS get(String path) {
-            path = fixup(path);
-            int f = path.charAt(0) & 0x7f;
-            for(int i=0;mps[f] != null && i < mps[f].length;i++)
-                if(mps[f][i].path.equals(path)) return mps[f][i].fs;
-            return null;
-        }
-        
-        public synchronized void add(String path, FS fs) {
-            if(get(path) != null) throw new IllegalArgumentException("mount point already exists");
-            path = fixup(path);
-            int f = path.charAt(0) & 0x7f;
-            int oldLength = mps[f] == null ? 0 : mps[f].length;
-            MP[] newList = new MP[oldLength + 1];
-            if(oldLength != 0) System.arraycopy(mps[f],0,newList,0,oldLength);
-            newList[oldLength] = new MP(path,fs);
-            Arrays.sort(newList);
-            mps[f] = newList;
-        }
-        
-        public synchronized void remove(String path) {
-            path = fixup(path);
-            if(get(path) == null) throw new IllegalArgumentException("mount point doesn't exist");
-            int f = path.charAt(0) & 0x7f;
-            MP[] oldList = mps[f];
-            MP[] newList = new MP[oldList.length - 1];
-            int p = 0;
-            for(p=0;p<oldList.length;p++) if(oldList[p].path.equals(path)) break;
-            if(p == oldList.length) throw new Error("should never happen");
-            System.arraycopy(oldList,0,newList,0,p);
-            System.arraycopy(oldList,0,newList,p,oldList.length-p-1);
-            mps[f] = newList;
-        }
-        
-        protected Object op(int op, String path, int arg1, int arg2) throws IOException {
-            int pl = path.length();
-            if(pl != 0) {
-                   MP[] list = mps[path.charAt(0) & 0x7f];
-                   if(list != null) for(int i=0;i<list.length;i++) {
-                               MP mp = list[i];
-                               int mpl = mp.path.length();
-                               if(pl == mpl || (pl < mpl && path.charAt(mpl) == '/'))
-                               return mp.fs.op(op,pl == mpl ? "" : path.substring(mpl+1),arg1,arg2);
-                 }
-            }
-            return root.op(op,path,arg1,arg2);
-        }
-    }
-        
     public static class HostFS extends FS {
         protected File root;
         public File getRoot() { return root; }
@@ -637,7 +731,7 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
             return f;
         }
         
-        File hostFile(String path) {
+        private File hostFile(String path) {
             char sep = File.separatorChar;
             if(sep != '/') {
                 char buf[] = path.toCharArray();
@@ -656,38 +750,21 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
         public HostFS(File root) { this.root = root; }
         
         
-        // FEATURE: This shares a lot with Runtime.open
-        // NOTE: createNewFile is a Java2 function
-        public FD _open(String path, int flags, int mode) throws IOException {
+        public FD open(UnixRuntime r, String path, int flags, int mode) throws ErrnoException {
             final File f = hostFile(path);
-            System.err.println(path + " -> " + f + " " + f.exists());
-            if(f.isDirectory()) {
-                if((flags&3)!=RD_ONLY) throw new ErrnoException(EACCES);
-                return directoryFD(f.list(),path.hashCode());
-            }
-            if((flags & (O_EXCL|O_CREAT)) == (O_EXCL|O_CREAT))
-                if(!f.createNewFile()) throw new ErrnoException(EEXIST);
-            if((flags&O_CREAT) == 0 && !f.exists())
-                return null;
-            final Seekable.File sf = new Seekable.File(f,(flags&3)!=RD_ONLY);
-            if((flags&O_TRUNC)!=0) sf.setLength(0);
-            return new SeekableFD(sf,mode) {
-                protected FStat _fstat() { return new HostFStat(f) {
-                    public int size() {
-                        try { return sf.length(); } catch(IOException e) { return 0; }
-                    }
-                };}
-            };
+            return r.hostFSOpen(f,flags,mode);
         }
         
-        public FStat _stat(String path) throws FileNotFoundException {
+        public FStat stat(UnixRuntime r, String path) throws ErrnoException {
             File f = hostFile(path);
-            if(!f.exists()) throw new FileNotFoundException();
-            return new HostFStat(f);
+            if(r.sm != null && !r.sm.allowStat(f)) throw new ErrnoException(EACCES);
+            if(!f.exists()) return null;
+            return r.hostFStat(f);
         }
         
-        public void _mkdir(String path) throws IOException {
+        public void mkdir(UnixRuntime r, String path, int mode) throws ErrnoException {
             File f = hostFile(path);
+            if(r.sm != null && !r.sm.allowWrite(f)) throw new ErrnoException(EACCES);
             if(f.exists() && f.isDirectory()) throw new ErrnoException(EEXIST);
             if(f.exists()) throw new ErrnoException(ENOTDIR);
             File parent = f.getParentFile();
@@ -696,80 +773,78 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
         }
     }
         
-    private static class DevFStat extends FStat {
-        public int dev() { return 1; }
-        public int mode() { return 0666; }
-        public int type() { return S_IFCHR; }
-        public int nlink() { return 1; }
-    }
-    private static FD devZeroFD = new FD() {
-        public boolean readable() { return true; }
-        public boolean writable() { return true; }
-        public int read(byte[] a, int off, int length) { Arrays.fill(a,off,off+length,(byte)0); return length; }
-        public int write(byte[] a, int off, int length) { return length; }
-        public int seek(int n, int whence) { return 0; }
-        public FStat _fstat() { return new DevFStat(); }
-    };
-    private static FD devNullFD = new FD() {
-        public boolean readable() { return true; }
-        public boolean writable() { return true; }
-        public int read(byte[] a, int off, int length) { return 0; }
-        public int write(byte[] a, int off, int length) { return length; }
-        public int seek(int n, int whence) { return 0; }
-        public FStat _fstat() { return new DevFStat(); }
-    };    
-    
-    // FIXME: Support /dev/fd (need to have syscalls pass along Runtime instance)
     public static class DevFS extends FS {
-        public FD _open(String path, int mode, int flags) throws IOException {
+        private static class DevFStat extends FStat {
+            public int dev() { return 1; }
+            public int mode() { return 0666; }
+            public int type() { return S_IFCHR; }
+            public int nlink() { return 1; }
+        }
+        private static FD devZeroFD = new FD() {
+            public boolean readable() { return true; }
+            public boolean writable() { return true; }
+            public int read(byte[] a, int off, int length) { Arrays.fill(a,off,off+length,(byte)0); return length; }
+            public int write(byte[] a, int off, int length) { return length; }
+            public int seek(int n, int whence) { return 0; }
+            public FStat _fstat() { return new DevFStat(); }
+        };
+        private static FD devNullFD = new FD() {
+            public boolean readable() { return true; }
+            public boolean writable() { return true; }
+            public int read(byte[] a, int off, int length) { return 0; }
+            public int write(byte[] a, int off, int length) { return length; }
+            public int seek(int n, int whence) { return 0; }
+            public FStat _fstat() { return new DevFStat(); }
+        }; 
+        
+        public FD open(UnixRuntime r, String path, int mode, int flags) throws ErrnoException {
             if(path.equals("null")) return devNullFD;
             if(path.equals("zero")) return devZeroFD;
-            /*if(path.startsWith("fd/")) {
+            if(path.startsWith("fd/")) {
                 int n;
                 try {
                     n = Integer.parseInt(path.substring(4));
                 } catch(NumberFormatException e) {
-                    throw new FileNotFoundException();
+                    return null;
                 }
-                if(n < 0 || n >= OPEN_MAX) throw new FileNotFoundException();
-                if(fds[n] == null) throw new FileNotFoundException();
-                return fds[n].dup();
+                if(n < 0 || n >= OPEN_MAX) return null;
+                if(r.fds[n] == null) return null;
+                return r.fds[n].dup();
             }
             if(path.equals("fd")) {
                 int count=0;
-                for(int i=0;i<OPEN_MAX;i++) if(fds[i] != null) count++; 
+                for(int i=0;i<OPEN_MAX;i++) if(r.fds[i] != null) count++; 
                 String[] files = new String[count];
                 count = 0;
-                for(int i=0;i<OPEN_MAX;i++) if(fds[i] != null) files[count++] = Integer.toString(i);
+                for(int i=0;i<OPEN_MAX;i++) if(r.fds[i] != null) files[count++] = Integer.toString(i);
                 return directoryFD(files,hashCode());
-            }*/
+            }
             if(path.equals("")) {
                 String[] files = { "null", "zero", "fd" };
                 return directoryFD(files,hashCode());
             }
-            throw new FileNotFoundException();
+            return null;
         }
         
-        public FStat _stat(String path) throws IOException {
+        public FStat stat(UnixRuntime r,String path) throws ErrnoException {
             if(path.equals("null")) return devNullFD.fstat();
             if(path.equals("zero")) return devZeroFD.fstat();            
-            /*if(path.startsWith("fd/")) {
+            if(path.startsWith("fd/")) {
                 int n;
                 try {
                     n = Integer.parseInt(path.substring(4));
                 } catch(NumberFormatException e) {
-                    throw new FileNotFoundException();
+                    return null;
                 }
-                if(n < 0 || n >= OPEN_MAX) throw new FileNotFoundException();
-                if(fds[n] == null) throw new FileNotFoundException();
-                return fds[n].fstat();
+                if(n < 0 || n >= OPEN_MAX) return null;
+                if(r.fds[n] == null) return null;
+                return r.fds[n].fstat();
             }
             if(path.equals("fd")) return new FStat() { public int type() { return S_IFDIR; } public int mode() { return 0444; }};
-            */
             if(path.equals("")) return new FStat() { public int type() { return S_IFDIR; } public int mode() { return 0444; }};
-            throw new FileNotFoundException();
+            return null;
         }
         
-        public void _mkdir(String path) throws IOException { throw new ErrnoException(EACCES); }
+        public void mkdir(UnixRuntime r, String path, int mode) throws ErrnoException { throw new ErrnoException(EACCES); }
     }
 }
index 4fc38b9..53aa0f6 100644 (file)
@@ -31,10 +31,14 @@ public interface UsermodeConstants {
     public static final int SYS_fork = 25;
     public static final int SYS_waitpid = 26;
     public static final int SYS_getcwd = 27;
-    public static final int SYS_execve = 28;
+    public static final int SYS_exec = 28;
     public static final int SYS_fcntl = 29;
     public static final int SYS_rmdir = 30;
     public static final int SYS_sysconf = 31;
+    public static final int SYS_readlink = 32;
+    public static final int SYS_lstat = 33;
+    public static final int SYS_symlink = 34;
+    public static final int SYS_link = 35;
     public static final int EPERM = 1; /* Not super-user */
     public static final int ENOENT = 2; /* No such file or directory */
     public static final int ESRCH = 3; /* No such process */
@@ -258,4 +262,25 @@ public interface UsermodeConstants {
     public static final int EXPR_NEST_MAX = 32; /* max expressions nested in expr(1) */
     public static final int LINE_MAX = 2048; /* max bytes in an input line */
     public static final int RE_DUP_MAX = 255; /* max RE's in interval notation */
+    public static final int F_UNLKSYS = 4;
+    public static final int F_CNVT = 12;
+    public static final int F_SETFD = 2;
+    public static final int F_SETFL = 4;
+    public static final int F_SETLK = 8;
+    public static final int F_SETOWN = 6;
+    public static final int F_RDLCK = 1;
+    public static final int F_WRLCK = 2;
+    public static final int F_SETLKW = 9;
+    public static final int F_GETFD = 1;
+    public static final int F_DUPFD = 0;
+    public static final int O_WRONLY = 1;
+    public static final int F_RSETLKW = 13;
+    public static final int O_RDWR = 2;
+    public static final int F_RGETLK = 10;
+    public static final int O_RDONLY = 0;
+    public static final int F_UNLCK = 3;
+    public static final int F_GETOWN = 5;
+    public static final int F_RSETLK = 11;
+    public static final int F_GETFL = 3;
+    public static final int F_GETLK = 7;
 }
index b7781d5..c05c5b1 100644 (file)
@@ -29,13 +29,14 @@ name:               \
     nop;            \
     .end name;
 
-#define SYSCALL_R(name)        \
-    .section .text._##name##_r,"ax",@progbits; \
+#define SYSCALL_R(name) SYSCALL_R2(_##name##_r,SYS_##name)
+#define SYSCALL_R2(name,number) \
+    .section .text.name,"ax",@progbits; \
     .align 2;                  \
-    .globl _##name##_r;        \
-    .ent _##name##_r;          \
-_##name##_r:                   \
-    li v0, SYS_##name;         \
+    .globl name;               \
+    .ent name;                 \
+name:                          \
+    li v0, number;             \
     move t0, a0;               \
     move a0, a1;               \
     move a1, a2;               \
@@ -52,7 +53,7 @@ $L##name##_errno:              \
     move a1, v0;               \
     j _syscall_set_errno;      \
     nop;                       \
-    .end _##name##_r;
+    .end name;
 
 
     .align   2
@@ -116,7 +117,11 @@ SYSCALL_R(dup2)
 SYSCALL_R(fork)
 SYSCALL_R(waitpid)
 SYSCALL_R(getcwd)
-SYSCALL_R(execve)
+SYSCALL_R2(__execve_r,SYS_exec)
 SYSCALL_R(fcntl)
 SYSCALL_R(rmdir)
 SYSCALL_R(sysconf)
+SYSCALL_R(readlink)
+SYSCALL_R(lstat)
+SYSCALL_R(symlink)
+SYSCALL_R(link)
index 9800e4a..59164cb 100644 (file)
@@ -13,11 +13,14 @@ int _syscall_set_errno(struct _reent *ptr, int err) {
     return -1;
 }
 
-extern int _stat_r(struct _reent *ptr, const char *path, struct stat *sb);
-int _lstat_r(struct _reent *ptr, const char *path, struct stat *sb) {
-    return _stat_r(ptr,path,sb);
+extern int _stat_r(struct _reent *, const char *, struct stat *);
+int _access_r(struct _reent *ptr, const char *pathname, int mode) {
+    struct stat statbuf;
+    if(_stat_r(ptr,pathname,&statbuf) < 0) return -1;
+    return 0;
 }
 
+/* NestedVM doesn't, and probably never will, support this security related stuff */
 uid_t getuid() { return 0; }
 gid_t getgid() { return 0; }
 uid_t geteuid() { return 0; }
@@ -27,34 +30,48 @@ int getgroups(int gidsetlen, gid_t *gidset) {
     return 1;
 }
 mode_t umask(mode_t new) { return 0022; }
+int _chmod_r(struct _reent *ptr, const char *f, mode_t mode) { return 0; }
+int _fchmod_r(struct _reent *ptr, int fd, mode_t mode) { return 0; }
+int _chown_r(struct _reent *ptr, const char *f, uid_t uid, gid_t gid) { return 0; }
+int _fchown_r(struct _reent *ptr, int fd, uid_t uid, gid_t gid) { return 0; }
 
-static int syscall_nosys(struct _reent *ptr) {
-    ptr->_errno = ENOSYS;
-    return -1;
-}
+#define REENT_WRAPPER1R(f,rt,t1) \
+    extern rt _##f##_r(struct _reent *ptr, t1 a); \
+    rt f(t1 a) { return _##f##_r(_REENT,a); }
+#define REENT_WRAPPER1(f,t1) REENT_WRAPPER1R(f,int,t1)
 
-int _access_r(struct _reent *ptr, const char *pathname, int mode) {
-    struct stat statbuf;
-    if(_stat_r(ptr,pathname,&statbuf) < 0) return -1;
-    return 0;
-}
+#define REENT_WRAPPER2R(f,rt,t1,t2) \
+    extern rt _##f##_r(struct _reent *ptr, t1 a, t2 b); \
+    rt f(t1 a, t2 b) { return _##f##_r(_REENT,a,b); }
+#define REENT_WRAPPER2(f,t1,t2) REENT_WRAPPER2R(f,int,t1,t2)
 
-/* FIXME: These should be in newlib */
-int access(const char *pathname, int mode) { return _access_r(_REENT,pathname,mode); }
-extern int _rmdir_r(struct _reent *ptr, const char *pathname);
-int rmdir(const char *pathname) { return _rmdir_r(_REENT,pathname); }
-extern long _sysconf_r(struct _reent *ptr, int n);
-long sysconf(int n) { return _sysconf_r(_REENT,n); }
+#define REENT_WRAPPER3R(f,rt,t1,t2,t3) \
+    extern rt _##f##_r(struct _reent *ptr, t1 a, t2 b, t3 c); \
+    rt f(t1 a, t2 b, t3 c) { return _##f##_r(_REENT,a,b,c); }
+#define REENT_WRAPPER3(f,t1,t2,t3) REENT_WRAPPER3R(f,int,t1,t2,t3)
 
-#define SYSCALL_NOSYS_R(name) int _##name##_r(struct _reent *ptr) { return syscall_nosys(ptr); }
+REENT_WRAPPER2(mkdir,const char *,mode_t)
+REENT_WRAPPER2(access,const char *,int)
+REENT_WRAPPER1(rmdir,const char *)
+REENT_WRAPPER1R(sysconf,long,int)
+REENT_WRAPPER1(chdir,const char*)
+REENT_WRAPPER2(utime,const char *,const struct utimbuf *)
+REENT_WRAPPER1(pipe,int *)
+REENT_WRAPPER2(dup2,int,int)
+REENT_WRAPPER3(waitpid,pid_t,int *,int)
+REENT_WRAPPER2R(getcwd,char *,char *,size_t)
+REENT_WRAPPER2(symlink,const char *,const char *)
+REENT_WRAPPER3(readlink,const char *, char *,int)
+REENT_WRAPPER3(chown,const char *,uid_t,gid_t)
+REENT_WRAPPER3(fchown,int,uid_t,gid_t)
+REENT_WRAPPER2(chmod,const char *,mode_t)
+REENT_WRAPPER2(fchmod,int,mode_t)
+REENT_WRAPPER2(lstat,const char *,struct stat *)
 
-SYSCALL_NOSYS_R(link)
-SYSCALL_NOSYS_R(symlink)
-SYSCALL_NOSYS_R(readlink)
-SYSCALL_NOSYS_R(chown)
-SYSCALL_NOSYS_R(fchown)
-SYSCALL_NOSYS_R(chmod)
-SYSCALL_NOSYS_R(fchmod)
+extern int __execve_r(struct _reent *ptr, const char *path, char *const argv[], char *const envp[]);
+int _execve(const char *path, char *const argv[], char *const envp[]) {
+    return __execve_r(_REENT,path,argv,envp);
+}
 
 static int read_fully(int fd, void *buf, size_t size) {
     int n;
@@ -88,11 +105,11 @@ DIR *opendir(const char *path) {
         return NULL;
     }
     dir->dd_fd = fd;
-    dir->dd_pos = 0;
+    //dir->dd_pos = 0;
     return dir;
 }
 
-static int readdir_r(DIR *dir,struct dirent *entry, struct dirent **result) {
+int readdir_r(DIR *dir,struct dirent *entry, struct dirent **result) {
     struct {
         int inode;
         int name_len;
@@ -106,7 +123,7 @@ again:
     if(read_fully(dir->dd_fd,entry->d_name,h.name_len) < 0) goto fail;
     
     entry->d_name[h.name_len] = '\0';
-    dir->dd_pos += h.name_len + 8;
+    //dir->dd_pos += h.name_len + 8;
     
     if(result) *result = entry;
     return 0;
@@ -115,7 +132,10 @@ fail:
     return -1;    
 }
 
-struct dirent *readdir(DIR *dir) { return readdir_r(dir,&dir->ent,NULL) == 0 ? &dir->ent : NULL; }
+// FIXME: Rewrite all this dirent stuff in terms of a getdirentries syscall
+static struct dirent static_dir_ent;
+
+struct dirent *readdir(DIR *dir) { return readdir_r(dir,&static_dir_ent,NULL) == 0 ? &static_dir_ent : NULL; }
 
 int closedir(DIR *dir) {
     close(dir->dd_fd);
index 5a1edf3..b4a36ed 100644 (file)
 #define SYS_fork 25
 #define SYS_waitpid 26
 #define SYS_getcwd 27
-#define SYS_execve 28
+#define SYS_exec 28
 #define SYS_fcntl 29
 #define SYS_rmdir 30
 #define SYS_sysconf 31
+#define SYS_readlink 32
+#define SYS_lstat 33
+#define SYS_symlink 34
+#define SYS_link 35
index 98f2c8e..2e48a7d 100644 (file)
@@ -16,6 +16,18 @@ public abstract class Seekable {
         return n == -1 ? -1 : buf[0]&0xff;
     }
     
+    public int tryReadFully(byte[] buf, int off, int len) throws IOException {
+        int total = 0;
+        while(len > 0) {
+                   int n = read(buf,off,len);
+                   if(n == -1) break;
+                   off += n;
+                   len -= n;
+            total += n;
+        }
+        return total == 0 ? -1 : total;
+    }
+    
     public static class ByteArray extends Seekable {
         protected byte[] data;
         protected int pos;
index 77fd217..978eb87 100644 (file)
@@ -43,12 +43,13 @@ public class CallTest {
         
         System.out.println("== Start of CallTest ==");
         System.out.println("Back in java... calling callme()");
-        int ret = rt.call("callme",a1,a2,a3,a4,a5,a6);
+        int ret = rt.call("callme",new int[]{a1,a2,a3,a4,a5,a6});
         System.out.println("callme returned: " + ret);
         
         int addr = rt.strdup("Hello, World from java");
         rt.call("echo",addr,4);
         rt.free(addr);
+        rt.call("echo",new Object[]{"Hello, World, from the Object[] call method",new Integer(2)});
         System.out.println("== End of CallTest ==");
         
         rt.execute();
index 088ebaf..fce4546 100644 (file)
@@ -5,10 +5,11 @@
 
 int main() {
     fprintf(stderr,"In the main process (pid: %d), about to fork\n",getpid());
-    pid_t pid = fork();
+    pid_t pid;
     int status;
     int i;
     
+    pid = fork();
     switch(pid) {
         case -1: perror("fork"); break;
         case 0: 
@@ -34,6 +35,7 @@ int main() {
             fprintf(stderr,"2nd fork exiting\n");
             _exit(0);
         }
+        fprintf(stderr,"1st fork (pid: %d) exiting\n",getpid());
         _exit(0);
     } else  {
         waitpid(pid,NULL,0);
@@ -41,11 +43,13 @@ int main() {
     }
     fprintf(stderr,"Sleeping for a bit\n");
     sleep(10);
+    
     fprintf(stderr,"Next few pids should be sequential\n");
     for(i=0;i<10;i++) {
         if(fork() == 0) {
             fprintf(stderr,"I am a child %d\n",getpid());
-            sleep(i%4);
+            sleep(i%4 + 5);
+            fprintf(stderr,"Child %d exiting\n",getpid());
             _exit(0);
         }
     }
index cf6ed96..6749728 100644 (file)
@@ -106,7 +106,8 @@ public class FreeTypeDemo {
             }
             rt.copyout(b,stringAddr,b.length);
             long start = System.currentTimeMillis();
-            if(rt.call("render",stringAddr,size,renderAddr,OURWIDTH,OURHEIGHT,BASELINE)==0) throw new Error("render() failed");
+            if(rt.call("render",new int[]{stringAddr,size,renderAddr,OURWIDTH,OURHEIGHT,BASELINE})==0)
+                throw new Error("render() failed");
             System.out.println(name + ": Render of: " + s + " took " + (System.currentTimeMillis()-start) + " ms");
             rt.copyin(renderAddr,render,render.length);
             createImage();
index 474d0d3..5746917 100644 (file)
@@ -90,27 +90,27 @@ diff -urN ../newlib-1.11.0.orig/libgloss/configure.in ./libgloss/configure.in
 diff -urN ../newlib-1.11.0.orig/newlib/configure.host ./newlib/configure.host
 --- ../newlib-1.11.0.orig/newlib/configure.host        Tue Nov 25 09:05:13 2003
 +++ ./newlib/configure.host    Tue Nov 25 08:30:02 2003
-@@ -356,6 +356,9 @@
-   m8*-bug-*)
-       sys_dir=m88kbug
-       ;;
-+  mips*-unknown-elf*)
-+      sys_dir=mipsunknown
-+      ;;
+@@ -359,6 +359,9 @@
    mips*-dec-*)
-       sys_dir=decstation
-       ;;
+       sys_dir=decstation
+       ;;
++  mips-unknown-elf*)
++        posix_dir=posix
++        ;;
+   mmix-knuth-mmixware)
+       sys_dir=mmixware
+       ;;
 @@ -508,6 +511,10 @@
-       newlib_cflags="${newlib_cflags}"
-       syscall_dir=syscalls
-       ;;
+       newlib_cflags="${newlib_cflags}"
+       syscall_dir=syscalls
+       ;;
 +  mips*-unknown-elf*)
-+      newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_GETTIMEOFDAY -DHAVE_FCNTL"
-+      syscall_dir=syscalls
++       newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_GETTIMEOFDAY -DHAVE_FCNTL -DHAVE_OPENDIR"
++       syscall_dir=syscalls
 +        ;;
    mmix-*)
-       syscall_dir=syscalls
-       # We need every symbol 32-bit aligned, so the invalid
+       syscall_dir=syscalls
+       # We need every symbol 32-bit aligned, so the invalid
 diff -urN ../newlib-1.11.0.orig/newlib/libc/include/paths.h ./newlib/libc/include/paths.h
 --- ../newlib-1.11.0.orig/newlib/libc/include/paths.h  Thu Feb 17 14:39:46 2000
 +++ ./newlib/libc/include/paths.h      Tue Nov 25 09:48:09 2003
@@ -183,2681 +183,57 @@ diff -urN ../newlib-1.11.0.orig/newlib/libc/include/sys/unistd.h ./newlib/libc/i
  
  #define       F_OK    0
  #define       R_OK    4
-diff -urN ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/Makefile.am ./newlib/libc/sys/mipsunknown/Makefile.am
---- ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/Makefile.am      Wed Dec 31 19:00:00 1969
-+++ ./newlib/libc/sys/mipsunknown/Makefile.am  Mon Nov 24 21:04:11 2003
-@@ -0,0 +1,14 @@
-+## Process this file with automake to generate Makefile.in
-+
-+AUTOMAKE_OPTIONS = cygnus
-+
-+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
-+
-+noinst_LIBRARIES = lib.a
-+
-+lib_a_SOURCES = syscalls.c
-+
-+all: crt0.o
-+
-+ACLOCAL_AMFLAGS = -I ../../..
-+CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
-diff -urN ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/Makefile.in ./newlib/libc/sys/mipsunknown/Makefile.in
---- ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/Makefile.in      Wed Dec 31 19:00:00 1969
-+++ ./newlib/libc/sys/mipsunknown/Makefile.in  Mon Nov 24 21:04:22 2003
-@@ -0,0 +1,329 @@
-+# Makefile.in generated automatically by automake 1.4 from Makefile.am
-+
-+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
-+# This Makefile.in is free software; the Free Software Foundation
-+# gives unlimited permission to copy and/or distribute it,
-+# with or without modifications, as long as this notice is preserved.
-+
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-+# PARTICULAR PURPOSE.
-+
-+
-+SHELL = @SHELL@
-+
-+srcdir = @srcdir@
-+top_srcdir = @top_srcdir@
-+VPATH = @srcdir@
-+prefix = @prefix@
-+exec_prefix = @exec_prefix@
-+
-+bindir = @bindir@
-+sbindir = @sbindir@
-+libexecdir = @libexecdir@
-+datadir = @datadir@
-+sysconfdir = @sysconfdir@
-+sharedstatedir = @sharedstatedir@
-+localstatedir = @localstatedir@
-+libdir = @libdir@
-+infodir = @infodir@
-+mandir = @mandir@
-+includedir = @includedir@
-+oldincludedir = /usr/include
-+
-+DESTDIR =
-+
-+pkgdatadir = $(datadir)/@PACKAGE@
-+pkglibdir = $(libdir)/@PACKAGE@
-+pkgincludedir = $(includedir)/@PACKAGE@
-+
-+top_builddir = .
-+
-+ACLOCAL = @ACLOCAL@
-+AUTOCONF = @AUTOCONF@
-+AUTOMAKE = @AUTOMAKE@
-+AUTOHEADER = @AUTOHEADER@
-+
-+INSTALL = @INSTALL@
-+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-+INSTALL_DATA = @INSTALL_DATA@
-+INSTALL_SCRIPT = @INSTALL_SCRIPT@
-+transform = @program_transform_name@
-+
-+NORMAL_INSTALL = :
-+PRE_INSTALL = :
-+POST_INSTALL = :
-+NORMAL_UNINSTALL = :
-+PRE_UNINSTALL = :
-+POST_UNINSTALL = :
-+build_alias = @build_alias@
-+build_triplet = @build@
-+host_alias = @host_alias@
-+host_triplet = @host@
-+target_alias = @target_alias@
-+target_triplet = @target@
-+AR = @AR@
-+AS = @AS@
-+CC = @CC@
-+CPP = @CPP@
-+EXEEXT = @EXEEXT@
-+LDFLAGS = @LDFLAGS@
-+MAINT = @MAINT@
-+MAKEINFO = @MAKEINFO@
-+NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
-+OBJEXT = @OBJEXT@
-+PACKAGE = @PACKAGE@
-+RANLIB = @RANLIB@
-+VERSION = @VERSION@
-+aext = @aext@
-+libm_machine_dir = @libm_machine_dir@
-+machine_dir = @machine_dir@
-+newlib_basedir = @newlib_basedir@
-+oext = @oext@
-+sys_dir = @sys_dir@
-+
-+AUTOMAKE_OPTIONS = cygnus
-+
-+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
-+
-+noinst_LIBRARIES = lib.a
-+
-+lib_a_SOURCES = syscalls.c
-+
-+ACLOCAL_AMFLAGS = -I ../../..
-+CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
-+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-+mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs
-+CONFIG_CLEAN_FILES = 
-+LIBRARIES =  $(noinst_LIBRARIES)
-+
-+
-+DEFS = @DEFS@ -I. -I$(srcdir) 
-+CPPFLAGS = @CPPFLAGS@
-+LIBS = @LIBS@
-+lib_a_LIBADD = 
-+lib_a_OBJECTS =  syscalls.o
-+CFLAGS = @CFLAGS@
-+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-+CCLD = $(CC)
-+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-+DIST_COMMON =  Makefile.am Makefile.in aclocal.m4 configure configure.in
-+
-+
-+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-+
-+TAR = gnutar
-+GZIP_ENV = --best
-+SOURCES = $(lib_a_SOURCES)
-+OBJECTS = $(lib_a_OBJECTS)
-+
-+all: all-redirect
-+.SUFFIXES:
-+.SUFFIXES: .S .c .o .s
-+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
-+      cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
-+
-+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
-+      cd $(top_builddir) \
-+        && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
-+
-+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in  \
-+              ../../../acinclude.m4 ../../../aclocal.m4 \
-+              ../../../libtool.m4
-+      cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-+
-+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-+      $(SHELL) ./config.status --recheck
-+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
-+      cd $(srcdir) && $(AUTOCONF)
-+
-+mostlyclean-noinstLIBRARIES:
-+
-+clean-noinstLIBRARIES:
-+      -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-+
-+distclean-noinstLIBRARIES:
-+
-+maintainer-clean-noinstLIBRARIES:
-+
-+.c.o:
-+      $(COMPILE) -c $<
-+
-+.s.o:
-+      $(COMPILE) -c $<
-+
-+.S.o:
-+      $(COMPILE) -c $<
-+
-+mostlyclean-compile:
-+      -rm -f *.o core *.core
-+
-+clean-compile:
-+
-+distclean-compile:
-+      -rm -f *.tab.c
-+
-+maintainer-clean-compile:
-+
-+lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES)
-+      -rm -f lib.a
-+      $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
-+      $(RANLIB) lib.a
-+
-+tags: TAGS
-+
-+ID: $(HEADERS) $(SOURCES) $(LISP)
-+      list='$(SOURCES) $(HEADERS)'; \
-+      unique=`for i in $$list; do echo $$i; done | \
-+        awk '    { files[$$0] = 1; } \
-+             END { for (i in files) print i; }'`; \
-+      here=`pwd` && cd $(srcdir) \
-+        && mkid -f$$here/ID $$unique $(LISP)
-+
-+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
-+      tags=; \
-+      here=`pwd`; \
-+      list='$(SOURCES) $(HEADERS)'; \
-+      unique=`for i in $$list; do echo $$i; done | \
-+        awk '    { files[$$0] = 1; } \
-+             END { for (i in files) print i; }'`; \
-+      test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
-+        || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags  $$unique $(LISP) -o $$here/TAGS)
-+
-+mostlyclean-tags:
-+
-+clean-tags:
-+
-+distclean-tags:
-+      -rm -f TAGS ID
-+
-+maintainer-clean-tags:
-+
-+distdir = $(PACKAGE)-$(VERSION)
-+top_distdir = $(distdir)
-+
-+# This target untars the dist file and tries a VPATH configuration.  Then
-+# it guarantees that the distribution is self-contained by making another
-+# tarfile.
-+distcheck: dist
-+      -rm -rf $(distdir)
-+      GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
-+      mkdir $(distdir)/=build
-+      mkdir $(distdir)/=inst
-+      dc_install_base=`cd $(distdir)/=inst && pwd`; \
-+      cd $(distdir)/=build \
-+        && ../configure --srcdir=.. --prefix=$$dc_install_base \
-+        && $(MAKE) $(AM_MAKEFLAGS) \
-+        && $(MAKE) $(AM_MAKEFLAGS) dvi \
-+        && $(MAKE) $(AM_MAKEFLAGS) check \
-+        && $(MAKE) $(AM_MAKEFLAGS) install \
-+        && $(MAKE) $(AM_MAKEFLAGS) installcheck \
-+        && $(MAKE) $(AM_MAKEFLAGS) dist
-+      -rm -rf $(distdir)
-+      @banner="$(distdir).tar.gz is ready for distribution"; \
-+      dashes=`echo "$$banner" | sed s/./=/g`; \
-+      echo "$$dashes"; \
-+      echo "$$banner"; \
-+      echo "$$dashes"
-+dist: distdir
-+      -chmod -R a+r $(distdir)
-+      GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-+      -rm -rf $(distdir)
-+dist-all: distdir
-+      -chmod -R a+r $(distdir)
-+      GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-+      -rm -rf $(distdir)
-+distdir: $(DISTFILES)
-+      -rm -rf $(distdir)
-+      mkdir $(distdir)
-+      -chmod 777 $(distdir)
-+      @for file in $(DISTFILES); do \
-+        if test -f $$file; then d=.; else d=$(srcdir); fi; \
-+        if test -d $$d/$$file; then \
-+          cp -pr $$/$$file $(distdir)/$$file; \
-+        else \
-+          test -f $(distdir)/$$file \
-+          || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-+          || cp -p $$d/$$file $(distdir)/$$file || :; \
-+        fi; \
-+      done
-+info-am:
-+info: info-am
-+dvi-am:
-+dvi: dvi-am
-+check-am:
-+check: check-am
-+installcheck-am:
-+installcheck: installcheck-am
-+install-info-am: 
-+install-info: install-info-am
-+install-exec-am:
-+install-exec: install-exec-am
-+
-+install-data-am:
-+install-data: install-data-am
-+
-+install-am: all-am
-+      @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-+install: install-am
-+uninstall-am:
-+uninstall: uninstall-am
-+all-am: Makefile $(LIBRARIES)
-+all-redirect: all-am
-+install-strip:
-+      $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-+installdirs:
-+
-+
-+mostlyclean-generic:
-+
-+clean-generic:
-+
-+distclean-generic:
-+      -rm -f Makefile $(CONFIG_CLEAN_FILES)
-+      -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-+
-+maintainer-clean-generic:
-+mostlyclean-am:  mostlyclean-noinstLIBRARIES mostlyclean-compile \
-+              mostlyclean-tags mostlyclean-generic
-+
-+mostlyclean: mostlyclean-am
-+
-+clean-am:  clean-noinstLIBRARIES clean-compile clean-tags clean-generic \
-+              mostlyclean-am
-+
-+clean: clean-am
-+
-+distclean-am:  distclean-noinstLIBRARIES distclean-compile \
-+              distclean-tags distclean-generic clean-am
-+
-+distclean: distclean-am
-+      -rm -f config.status
-+
-+maintainer-clean-am:  maintainer-clean-noinstLIBRARIES \
-+              maintainer-clean-compile maintainer-clean-tags \
-+              maintainer-clean-generic distclean-am
-+      @echo "This command is intended for maintainers to use;"
-+      @echo "it deletes files that may require special tools to rebuild."
-+
-+maintainer-clean: maintainer-clean-am
-+      -rm -f config.status
-+
-+.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
-+clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
-+mostlyclean-compile distclean-compile clean-compile \
-+maintainer-clean-compile tags mostlyclean-tags distclean-tags \
-+clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
-+check-am installcheck-am installcheck install-info-am install-info \
-+install-exec-am install-exec install-data-am install-data install-am \
-+install uninstall-am uninstall all-redirect all-am all installdirs \
-+mostlyclean-generic distclean-generic clean-generic \
-+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
-+
-+
-+all: crt0.o 
-+
-+# Tell versions [3.59,3.63) of GNU make to not export all variables.
-+# Otherwise a system limit (for SysV at least) may be exceeded.
-+.NOEXPORT:
-diff -urN ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/aclocal.m4 ./newlib/libc/sys/mipsunknown/aclocal.m4
---- ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/aclocal.m4       Wed Dec 31 19:00:00 1969
-+++ ./newlib/libc/sys/mipsunknown/aclocal.m4   Mon Nov 24 20:40:47 2003
-@@ -0,0 +1,324 @@
-+dnl aclocal.m4 generated automatically by aclocal 1.4
-+
-+dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
-+dnl This file is free software; the Free Software Foundation
-+dnl gives unlimited permission to copy and/or distribute it,
-+dnl with or without modifications, as long as this notice is preserved.
-+
-+dnl This program is distributed in the hope that it will be useful,
-+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-+dnl PARTICULAR PURPOSE.
-+
-+dnl This provides configure definitions used by all the newlib
-+dnl configure.in files.
-+
-+dnl Basic newlib configury.  This calls basic introductory stuff,
-+dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST.  It also runs
-+dnl configure.host.  The only argument is the relative path to the top
-+dnl newlib directory.
-+
-+AC_DEFUN(NEWLIB_CONFIGURE,
-+[
-+dnl Default to --enable-multilib
-+AC_ARG_ENABLE(multilib,
-+[  --enable-multilib         build many library versions (default)],
-+[case "${enableval}" in
-+  yes) multilib=yes ;;
-+  no)  multilib=no ;;
-+  *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
-+ esac], [multilib=yes])dnl
-+
-+dnl Support --enable-target-optspace
-+AC_ARG_ENABLE(target-optspace,
-+[  --enable-target-optspace  optimize for space],
-+[case "${enableval}" in
-+  yes) target_optspace=yes ;;
-+  no)  target_optspace=no ;;
-+  *)   AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;;
-+ esac], [target_optspace=])dnl
-+
-+dnl Support --enable-malloc-debugging - currently only supported for Cygwin
-+AC_ARG_ENABLE(malloc-debugging,
-+[  --enable-malloc-debugging indicate malloc debugging requested],
-+[case "${enableval}" in
-+  yes) malloc_debugging=yes ;;
-+  no)  malloc_debugging=no ;;
-+  *)   AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;;
-+ esac], [malloc_debugging=])dnl
-+
-+dnl Support --enable-newlib-mb
-+AC_ARG_ENABLE(newlib-mb,
-+[  --enable-newlib-mb        enable multibyte support],
-+[case "${enableval}" in
-+  yes) newlib_mb=yes ;;
-+  no)  newlib_mb=no ;;
-+  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
-+ esac], [newlib_mb=])dnl
-+
-+dnl Support --enable-newlib-multithread
-+AC_ARG_ENABLE(newlib-multithread,
-+[  --enable-newlib-multithread        enable support for multiple threads],
-+[case "${enableval}" in
-+  yes) newlib_multithread=yes ;;
-+  no)  newlib_multithread=no ;;
-+  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;;
-+ esac], [newlib_multithread=yes])dnl
-+
-+dnl Support --enable-newlib-elix-level
-+AC_ARG_ENABLE(newlib-elix-level,
-+[  --enable-newlib-elix-level         supply desired elix library level (1-4)],
-+[case "${enableval}" in
-+  0)   newlib_elix_level=0 ;;
-+  1)   newlib_elix_level=1 ;;
-+  2)   newlib_elix_level=2 ;;
-+  3)   newlib_elix_level=3 ;;
-+  4)   newlib_elix_level=4 ;;
-+  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;;
-+ esac], [newlib_elix_level=0])dnl
-+
-+dnl Support --disable-newlib-io-float
-+AC_ARG_ENABLE(newlib-io-float,
-+[  --disable-newlib-io-float disable printf/scanf family float support],
-+[case "${enableval}" in
-+  yes) newlib_io_float=yes ;;
-+  no)  newlib_io_float=no ;;
-+  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;;
-+ esac], [newlib_io_float=yes])dnl
-+
-+
-+dnl We may get other options which we don't document:
-+dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
-+
-+test -z "[$]{with_target_subdir}" && with_target_subdir=.
-+
-+if test "[$]{srcdir}" = "."; then
-+  if test "[$]{with_target_subdir}" != "."; then
-+    newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
-+  else
-+    newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
-+  fi
-+else
-+  newlib_basedir="[$]{srcdir}/$1"
-+fi
-+AC_SUBST(newlib_basedir)
-+
-+AC_CANONICAL_SYSTEM
-+
-+AM_INIT_AUTOMAKE(newlib, 1.11.0)
-+
-+# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
-+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
-+# are probably using a cross compiler, which will not be able to fully
-+# link an executable.  This should really be fixed in autoconf
-+# itself.
-+
-+AC_DEFUN(LIB_AC_PROG_CC,
-+[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-+AC_CHECK_PROG(CC, gcc, gcc)
-+if test -z "$CC"; then
-+  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
-+  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-+fi
-+
-+AC_PROG_CC_GNU
-+
-+if test $ac_cv_prog_gcc = yes; then
-+  GCC=yes
-+dnl Check whether -g works, even if CFLAGS is set, in case the package
-+dnl plays around with CFLAGS (such as to build both debugging and
-+dnl normal versions of a library), tasteless as that idea is.
-+  ac_test_CFLAGS="${CFLAGS+set}"
-+  ac_save_CFLAGS="$CFLAGS"
-+  CFLAGS=
-+  AC_PROG_CC_G
-+  if test "$ac_test_CFLAGS" = set; then
-+    CFLAGS="$ac_save_CFLAGS"
-+  elif test $ac_cv_prog_cc_g = yes; then
-+    CFLAGS="-g -O2"
-+  else
-+    CFLAGS="-O2"
-+  fi
-+else
-+  GCC=
-+  test "${CFLAGS+set}" = set || CFLAGS="-g"
-+fi
-+])
-+
-+LIB_AC_PROG_CC
-+
-+AC_CHECK_TOOL(AS, as)
-+AC_CHECK_TOOL(AR, ar)
-+AC_CHECK_TOOL(RANLIB, ranlib, :)
-+
-+AC_PROG_INSTALL
-+
-+AM_MAINTAINER_MODE
-+
-+# We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
-+# at least currently, we never actually build a program, so we never
-+# need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
-+# fails, because we are probably configuring with a cross compiler
-+# which can't create executables.  So we include AC_EXEEXT to keep
-+# automake happy, but we don't execute it, since we don't care about
-+# the result.
-+if false; then
-+  AC_EXEEXT
-+fi
-+
-+. [$]{newlib_basedir}/configure.host
-+
-+newlib_cflags="[$]{newlib_cflags} -fno-builtin"
-+
-+NEWLIB_CFLAGS=${newlib_cflags}
-+AC_SUBST(NEWLIB_CFLAGS)
-+
-+LDFLAGS=${ldflags}
-+AC_SUBST(LDFLAGS)
-+
-+AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
-+AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
-+AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
-+AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3)
-+AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4)
-+
-+AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes)
-+
-+# Hard-code OBJEXT.  Normally it is set by AC_OBJEXT, but we
-+# use oext, which is set in configure.host based on the target platform.
-+OBJEXT=${oext}
-+
-+AC_SUBST(OBJEXT)
-+AC_SUBST(oext)
-+AC_SUBST(aext)
-+
-+AC_SUBST(libm_machine_dir)
-+AC_SUBST(machine_dir)
-+AC_SUBST(sys_dir)
-+])
-+
-+# Do all the work for Automake.  This macro actually does too much --
-+# some checks are only needed if your package does certain things.
-+# But this isn't really a big deal.
-+
-+# serial 1
-+
-+dnl Usage:
-+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
-+
-+AC_DEFUN(AM_INIT_AUTOMAKE,
-+[AC_REQUIRE([AC_PROG_INSTALL])
-+PACKAGE=[$1]
-+AC_SUBST(PACKAGE)
-+VERSION=[$2]
-+AC_SUBST(VERSION)
-+dnl test to see if srcdir already configured
-+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
-+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
-+fi
-+ifelse([$3],,
-+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
-+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
-+AC_REQUIRE([AM_SANITY_CHECK])
-+AC_REQUIRE([AC_ARG_PROGRAM])
-+dnl FIXME This is truly gross.
-+missing_dir=`cd $ac_aux_dir && pwd`
-+AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
-+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
-+AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
-+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
-+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
-+AC_REQUIRE([AC_PROG_MAKE_SET])])
-+
-+#
-+# Check to make sure that the build environment is sane.
-+#
-+
-+AC_DEFUN(AM_SANITY_CHECK,
-+[AC_MSG_CHECKING([whether build environment is sane])
-+# Just in case
-+sleep 1
-+echo timestamp > conftestfile
-+# Do `set' in a subshell so we don't clobber the current shell's
-+# arguments.  Must try -L first in case configure is actually a
-+# symlink; some systems play weird games with the mod time of symlinks
-+# (eg FreeBSD returns the mod time of the symlink's containing
-+# directory).
-+if (
-+   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
-+   if test "[$]*" = "X"; then
-+      # -L didn't work.
-+      set X `ls -t $srcdir/configure conftestfile`
-+   fi
-+   if test "[$]*" != "X $srcdir/configure conftestfile" \
-+      && test "[$]*" != "X conftestfile $srcdir/configure"; then
-+
-+      # If neither matched, then we have a broken ls.  This can happen
-+      # if, for instance, CONFIG_SHELL is bash and it inherits a
-+      # broken ls alias from the environment.  This has actually
-+      # happened.  Such a system could not be considered "sane".
-+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
-+alias in your environment])
-+   fi
-+
-+   test "[$]2" = conftestfile
-+   )
-+then
-+   # Ok.
-+   :
-+else
-+   AC_MSG_ERROR([newly created file is older than distributed files!
-+Check your system clock])
-+fi
-+rm -f conftest*
-+AC_MSG_RESULT(yes)])
-+
-+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
-+dnl The program must properly implement --version.
-+AC_DEFUN(AM_MISSING_PROG,
-+[AC_MSG_CHECKING(for working $2)
-+# Run test in a subshell; some versions of sh will print an error if
-+# an executable is not found, even if stderr is redirected.
-+# Redirect stdin to placate older versions of autoconf.  Sigh.
-+if ($2 --version) < /dev/null > /dev/null 2>&1; then
-+   $1=$2
-+   AC_MSG_RESULT(found)
-+else
-+   $1="$3/missing $2"
-+   AC_MSG_RESULT(missing)
-+fi
-+AC_SUBST($1)])
-+
-+# Add --enable-maintainer-mode option to configure.
-+# From Jim Meyering
-+
-+# serial 1
-+
-+AC_DEFUN(AM_MAINTAINER_MODE,
-+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
-+  dnl maintainer-mode is disabled by default
-+  AC_ARG_ENABLE(maintainer-mode,
-+[  --enable-maintainer-mode enable make rules and dependencies not useful
-+                          (and sometimes confusing) to the casual installer],
-+      USE_MAINTAINER_MODE=$enableval,
-+      USE_MAINTAINER_MODE=no)
-+  AC_MSG_RESULT($USE_MAINTAINER_MODE)
-+  AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
-+  MAINT=$MAINTAINER_MODE_TRUE
-+  AC_SUBST(MAINT)dnl
-+]
-+)
-+
-+# Define a conditional.
-+
-+AC_DEFUN(AM_CONDITIONAL,
-+[AC_SUBST($1_TRUE)
-+AC_SUBST($1_FALSE)
-+if $2; then
-+  $1_TRUE=
-+  $1_FALSE='#'
-+else
-+  $1_TRUE='#'
-+  $1_FALSE=
-+fi])
-+
-diff -urN ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/configure ./newlib/libc/sys/mipsunknown/configure
---- ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/configure        Wed Dec 31 19:00:00 1969
-+++ ./newlib/libc/sys/mipsunknown/configure    Mon Nov 24 20:43:05 2003
-@@ -0,0 +1,1863 @@
-+#! /bin/sh
-+
-+# Guess values for system-dependent variables and create Makefiles.
-+# Generated automatically using autoconf version 2.13 
-+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-+#
-+# This configure script is free software; the Free Software Foundation
-+# gives unlimited permission to copy, distribute and modify it.
-+
-+# Defaults:
-+ac_help=
-+ac_default_prefix=/usr/local
-+# Any additions from configure.in:
-+ac_help="$ac_help
-+  --enable-multilib         build many library versions (default)"
-+ac_help="$ac_help
-+  --enable-target-optspace  optimize for space"
-+ac_help="$ac_help
-+  --enable-malloc-debugging indicate malloc debugging requested"
-+ac_help="$ac_help
-+  --enable-newlib-mb        enable multibyte support"
-+ac_help="$ac_help
-+  --enable-newlib-multithread        enable support for multiple threads"
-+ac_help="$ac_help
-+  --enable-newlib-elix-level         supply desired elix library level (1-4)"
-+ac_help="$ac_help
-+  --disable-newlib-io-float disable printf/scanf family float support"
-+ac_help="$ac_help
-+  --enable-maintainer-mode enable make rules and dependencies not useful
-+                          (and sometimes confusing) to the casual installer"
-+
-+# Initialize some variables set by options.
-+# The variables have the same names as the options, with
-+# dashes changed to underlines.
-+build=NONE
-+cache_file=./config.cache
-+exec_prefix=NONE
-+host=NONE
-+no_create=
-+nonopt=NONE
-+no_recursion=
-+prefix=NONE
-+program_prefix=NONE
-+program_suffix=NONE
-+program_transform_name=s,x,x,
-+silent=
-+site=
-+sitefile=
-+srcdir=
-+target=NONE
-+verbose=
-+x_includes=NONE
-+x_libraries=NONE
-+bindir='${exec_prefix}/bin'
-+sbindir='${exec_prefix}/sbin'
-+libexecdir='${exec_prefix}/libexec'
-+datadir='${prefix}/share'
-+sysconfdir='${prefix}/etc'
-+sharedstatedir='${prefix}/com'
-+localstatedir='${prefix}/var'
-+libdir='${exec_prefix}/lib'
-+includedir='${prefix}/include'
-+oldincludedir='/usr/include'
-+infodir='${prefix}/info'
-+mandir='${prefix}/man'
-+
-+# Initialize some other variables.
-+subdirs=
-+MFLAGS= MAKEFLAGS=
-+SHELL=${CONFIG_SHELL-/bin/sh}
-+# Maximum number of lines to put in a shell here document.
-+ac_max_here_lines=12
-+
-+ac_prev=
-+for ac_option
-+do
-+
-+  # If the previous option needs an argument, assign it.
-+  if test -n "$ac_prev"; then
-+    eval "$ac_prev=\$ac_option"
-+    ac_prev=
-+    continue
-+  fi
-+
-+  case "$ac_option" in
-+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-+  *) ac_optarg= ;;
-+  esac
-+
-+  # Accept the important Cygnus configure options, so we can diagnose typos.
-+
-+  case "$ac_option" in
-+
-+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
-+    ac_prev=bindir ;;
-+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-+    bindir="$ac_optarg" ;;
-+
-+  -build | --build | --buil | --bui | --bu)
-+    ac_prev=build ;;
-+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-+    build="$ac_optarg" ;;
-+
-+  -cache-file | --cache-file | --cache-fil | --cache-fi \
-+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
-+    ac_prev=cache_file ;;
-+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
-+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-+    cache_file="$ac_optarg" ;;
-+
-+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
-+    ac_prev=datadir ;;
-+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
-+  | --da=*)
-+    datadir="$ac_optarg" ;;
-+
-+  -disable-* | --disable-*)
-+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
-+    # Reject names that are not valid shell variable names.
-+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
-+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-+    fi
-+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-+    eval "enable_${ac_feature}=no" ;;
-+
-+  -enable-* | --enable-*)
-+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
-+    # Reject names that are not valid shell variable names.
-+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
-+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-+    fi
-+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-+    case "$ac_option" in
-+      *=*) ;;
-+      *) ac_optarg=yes ;;
-+    esac
-+    eval "enable_${ac_feature}='$ac_optarg'" ;;
-+
-+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
-+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
-+  | --exec | --exe | --ex)
-+    ac_prev=exec_prefix ;;
-+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
-+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
-+  | --exec=* | --exe=* | --ex=*)
-+    exec_prefix="$ac_optarg" ;;
-+
-+  -gas | --gas | --ga | --g)
-+    # Obsolete; use --with-gas.
-+    with_gas=yes ;;
-+
-+  -help | --help | --hel | --he)
-+    # Omit some internal or obsolete options to make the list less imposing.
-+    # This message is too long to be a string in the A/UX 3.1 sh.
-+    cat << EOF
-+Usage: configure [options] [host]
-+Options: [defaults in brackets after descriptions]
-+Configuration:
-+  --cache-file=FILE       cache test results in FILE
-+  --help                  print this message
-+  --no-create             do not create output files
-+  --quiet, --silent       do not print \`checking...' messages
-+  --site-file=FILE        use FILE as the site file
-+  --version               print the version of autoconf that created configure
-+Directory and file names:
-+  --prefix=PREFIX         install architecture-independent files in PREFIX
-+                          [$ac_default_prefix]
-+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-+                          [same as prefix]
-+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
-+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
-+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
-+  --datadir=DIR           read-only architecture-independent data in DIR
-+                          [PREFIX/share]
-+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
-+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
-+                          [PREFIX/com]
-+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
-+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
-+  --includedir=DIR        C header files in DIR [PREFIX/include]
-+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
-+  --infodir=DIR           info documentation in DIR [PREFIX/info]
-+  --mandir=DIR            man documentation in DIR [PREFIX/man]
-+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
-+  --program-prefix=PREFIX prepend PREFIX to installed program names
-+  --program-suffix=SUFFIX append SUFFIX to installed program names
-+  --program-transform-name=PROGRAM
-+                          run sed PROGRAM on installed program names
-+EOF
-+    cat << EOF
-+Host type:
-+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
-+  --host=HOST             configure for HOST [guessed]
-+  --target=TARGET         configure for TARGET [TARGET=HOST]
-+Features and packages:
-+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-+  --x-includes=DIR        X include files are in DIR
-+  --x-libraries=DIR       X library files are in DIR
-+EOF
-+    if test -n "$ac_help"; then
-+      echo "--enable and --with options recognized:$ac_help"
-+    fi
-+    exit 0 ;;
-+
-+  -host | --host | --hos | --ho)
-+    ac_prev=host ;;
-+  -host=* | --host=* | --hos=* | --ho=*)
-+    host="$ac_optarg" ;;
-+
-+  -includedir | --includedir | --includedi | --included | --include \
-+  | --includ | --inclu | --incl | --inc)
-+    ac_prev=includedir ;;
-+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
-+  | --includ=* | --inclu=* | --incl=* | --inc=*)
-+    includedir="$ac_optarg" ;;
-+
-+  -infodir | --infodir | --infodi | --infod | --info | --inf)
-+    ac_prev=infodir ;;
-+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-+    infodir="$ac_optarg" ;;
-+
-+  -libdir | --libdir | --libdi | --libd)
-+    ac_prev=libdir ;;
-+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
-+    libdir="$ac_optarg" ;;
-+
-+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
-+  | --libexe | --libex | --libe)
-+    ac_prev=libexecdir ;;
-+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
-+  | --libexe=* | --libex=* | --libe=*)
-+    libexecdir="$ac_optarg" ;;
-+
-+  -localstatedir | --localstatedir | --localstatedi | --localstated \
-+  | --localstate | --localstat | --localsta | --localst \
-+  | --locals | --local | --loca | --loc | --lo)
-+    ac_prev=localstatedir ;;
-+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
-+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
-+    localstatedir="$ac_optarg" ;;
-+
-+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
-+    ac_prev=mandir ;;
-+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-+    mandir="$ac_optarg" ;;
-+
-+  -nfp | --nfp | --nf)
-+    # Obsolete; use --without-fp.
-+    with_fp=no ;;
-+
-+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-+  | --no-cr | --no-c)
-+    no_create=yes ;;
-+
-+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
-+    no_recursion=yes ;;
-+
-+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
-+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
-+  | --oldin | --oldi | --old | --ol | --o)
-+    ac_prev=oldincludedir ;;
-+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
-+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
-+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-+    oldincludedir="$ac_optarg" ;;
-+
-+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
-+    ac_prev=prefix ;;
-+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-+    prefix="$ac_optarg" ;;
-+
-+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
-+  | --program-pre | --program-pr | --program-p)
-+    ac_prev=program_prefix ;;
-+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
-+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-+    program_prefix="$ac_optarg" ;;
-+
-+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
-+  | --program-suf | --program-su | --program-s)
-+    ac_prev=program_suffix ;;
-+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
-+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-+    program_suffix="$ac_optarg" ;;
-+
-+  -program-transform-name | --program-transform-name \
-+  | --program-transform-nam | --program-transform-na \
-+  | --program-transform-n | --program-transform- \
-+  | --program-transform | --program-transfor \
-+  | --program-transfo | --program-transf \
-+  | --program-trans | --program-tran \
-+  | --progr-tra | --program-tr | --program-t)
-+    ac_prev=program_transform_name ;;
-+  -program-transform-name=* | --program-transform-name=* \
-+  | --program-transform-nam=* | --program-transform-na=* \
-+  | --program-transform-n=* | --program-transform-=* \
-+  | --program-transform=* | --program-transfor=* \
-+  | --program-transfo=* | --program-transf=* \
-+  | --program-trans=* | --program-tran=* \
-+  | --progr-tra=* | --program-tr=* | --program-t=*)
-+    program_transform_name="$ac_optarg" ;;
-+
-+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-+  | -silent | --silent | --silen | --sile | --sil)
-+    silent=yes ;;
-+
-+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
-+    ac_prev=sbindir ;;
-+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
-+  | --sbi=* | --sb=*)
-+    sbindir="$ac_optarg" ;;
-+
-+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
-+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
-+  | --sharedst | --shareds | --shared | --share | --shar \
-+  | --sha | --sh)
-+    ac_prev=sharedstatedir ;;
-+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
-+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
-+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
-+  | --sha=* | --sh=*)
-+    sharedstatedir="$ac_optarg" ;;
-+
-+  -site | --site | --sit)
-+    ac_prev=site ;;
-+  -site=* | --site=* | --sit=*)
-+    site="$ac_optarg" ;;
-+
-+  -site-file | --site-file | --site-fil | --site-fi | --site-f)
-+    ac_prev=sitefile ;;
-+  -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
-+    sitefile="$ac_optarg" ;;
-+
-+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
-+    ac_prev=srcdir ;;
-+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-+    srcdir="$ac_optarg" ;;
-+
-+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
-+  | --syscon | --sysco | --sysc | --sys | --sy)
-+    ac_prev=sysconfdir ;;
-+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
-+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-+    sysconfdir="$ac_optarg" ;;
-+
-+  -target | --target | --targe | --targ | --tar | --ta | --t)
-+    ac_prev=target ;;
-+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-+    target="$ac_optarg" ;;
-+
-+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
-+    verbose=yes ;;
-+
-+  -version | --version | --versio | --versi | --vers)
-+    echo "configure generated by autoconf version 2.13"
-+    exit 0 ;;
-+
-+  -with-* | --with-*)
-+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
-+    # Reject names that are not valid shell variable names.
-+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
-+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-+    fi
-+    ac_package=`echo $ac_package| sed 's/-/_/g'`
-+    case "$ac_option" in
-+      *=*) ;;
-+      *) ac_optarg=yes ;;
-+    esac
-+    eval "with_${ac_package}='$ac_optarg'" ;;
-+
-+  -without-* | --without-*)
-+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
-+    # Reject names that are not valid shell variable names.
-+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
-+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-+    fi
-+    ac_package=`echo $ac_package| sed 's/-/_/g'`
-+    eval "with_${ac_package}=no" ;;
-+
-+  --x)
-+    # Obsolete; use --with-x.
-+    with_x=yes ;;
-+
-+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
-+  | --x-incl | --x-inc | --x-in | --x-i)
-+    ac_prev=x_includes ;;
-+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
-+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-+    x_includes="$ac_optarg" ;;
-+
-+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
-+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
-+    ac_prev=x_libraries ;;
-+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
-+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-+    x_libraries="$ac_optarg" ;;
-+
-+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
-+    ;;
-+
-+  *)
-+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
-+      echo "configure: warning: $ac_option: invalid host type" 1>&2
-+    fi
-+    if test "x$nonopt" != xNONE; then
-+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
-+    fi
-+    nonopt="$ac_option"
-+    ;;
-+
-+  esac
-+done
-+
-+if test -n "$ac_prev"; then
-+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-+fi
-+
-+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-+
-+# File descriptor usage:
-+# 0 standard input
-+# 1 file creation
-+# 2 errors and warnings
-+# 3 some systems may open it to /dev/tty
-+# 4 used on the Kubota Titan
-+# 6 checking for... messages and results
-+# 5 compiler messages saved in config.log
-+if test "$silent" = yes; then
-+  exec 6>/dev/null
-+else
-+  exec 6>&1
-+fi
-+exec 5>./config.log
-+
-+echo "\
-+This file contains any messages produced by compilers while
-+running configure, to aid debugging if configure makes a mistake.
-+" 1>&5
-+
-+# Strip out --no-create and --no-recursion so they do not pile up.
-+# Also quote any args containing shell metacharacters.
-+ac_configure_args=
-+for ac_arg
-+do
-+  case "$ac_arg" in
-+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-+  | --no-cr | --no-c) ;;
-+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
-+  *" "*|*"    "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
-+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
-+  esac
-+done
-+
-+# NLS nuisances.
-+# Only set these to C if already set.  These must not be set unconditionally
-+# because not all systems understand e.g. LANG=C (notably SCO).
-+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-+# Non-C LC_CTYPE values break the ctype check.
-+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
-+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
-+
-+# confdefs.h avoids OS command line length limits that DEFS can exceed.
-+rm -rf conftest* confdefs.h
-+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-+echo > confdefs.h
-+
-+# A filename unique to this package, relative to the directory that
-+# configure is in, which we can look for to find out if srcdir is correct.
-+ac_unique_file=syscalls.c
-+
-+# Find the source files, if location was not specified.
-+if test -z "$srcdir"; then
-+  ac_srcdir_defaulted=yes
-+  # Try the directory containing this script, then its parent.
-+  ac_prog=$0
-+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
-+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
-+  srcdir=$ac_confdir
-+  if test ! -r $srcdir/$ac_unique_file; then
-+    srcdir=..
-+  fi
-+else
-+  ac_srcdir_defaulted=no
-+fi
-+if test ! -r $srcdir/$ac_unique_file; then
-+  if test "$ac_srcdir_defaulted" = yes; then
-+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
-+  else
-+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
-+  fi
-+fi
-+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-+
-+# Prefer explicitly selected file to automatically selected ones.
-+if test -z "$sitefile"; then
-+  if test -z "$CONFIG_SITE"; then
-+    if test "x$prefix" != xNONE; then
-+      CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
-+    else
-+      CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
-+    fi
-+  fi
-+else
-+  CONFIG_SITE="$sitefile"
-+fi
-+for ac_site_file in $CONFIG_SITE; do
-+  if test -r "$ac_site_file"; then
-+    echo "loading site script $ac_site_file"
-+    . "$ac_site_file"
-+  fi
-+done
-+
-+if test -r "$cache_file"; then
-+  echo "loading cache $cache_file"
-+  . $cache_file
-+else
-+  echo "creating cache $cache_file"
-+  > $cache_file
-+fi
-+
-+ac_ext=c
-+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-+ac_cpp='$CPP $CPPFLAGS'
-+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-+cross_compiling=$ac_cv_prog_cc_cross
-+
-+ac_exeext=
-+ac_objext=o
-+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
-+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
-+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
-+    ac_n= ac_c='
-+' ac_t='      '
-+  else
-+    ac_n=-n ac_c= ac_t=
-+  fi
-+else
-+  ac_n= ac_c='\c' ac_t=
-+fi
-+
-+
-+
-+ac_aux_dir=
-+for ac_dir in ../../../.. $srcdir/../../../..; do
-+  if test -f $ac_dir/install-sh; then
-+    ac_aux_dir=$ac_dir
-+    ac_install_sh="$ac_aux_dir/install-sh -c"
-+    break
-+  elif test -f $ac_dir/install.sh; then
-+    ac_aux_dir=$ac_dir
-+    ac_install_sh="$ac_aux_dir/install.sh -c"
-+    break
-+  fi
-+done
-+if test -z "$ac_aux_dir"; then
-+  { echo "configure: error: can not find install-sh or install.sh in ../../../.. $srcdir/../../../.." 1>&2; exit 1; }
-+fi
-+ac_config_guess=$ac_aux_dir/config.guess
-+ac_config_sub=$ac_aux_dir/config.sub
-+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-+
-+
-+# Find a good install program.  We prefer a C program (faster),
-+# so one script is as good as another.  But avoid the broken or
-+# incompatible versions:
-+# SysV /etc/install, /usr/sbin/install
-+# SunOS /usr/etc/install
-+# IRIX /sbin/install
-+# AIX /bin/install
-+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-+# ./install, which can be erroneously created by make from ./install.sh.
-+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-+echo "configure:586: checking for a BSD compatible install" >&5
-+if test -z "$INSTALL"; then
-+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+    IFS="${IFS=       }"; ac_save_IFS="$IFS"; IFS=":"
-+  for ac_dir in $PATH; do
-+    # Account for people who put trailing slashes in PATH elements.
-+    case "$ac_dir/" in
-+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
-+    *)
-+      # OSF1 and SCO ODT 3.0 have their own names for install.
-+      # Don't use installbsd from OSF since it installs stuff as root
-+      # by default.
-+      for ac_prog in ginstall scoinst install; do
-+        if test -f $ac_dir/$ac_prog; then
-+        if test $ac_prog = install &&
-+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
-+          # AIX install.  It has an incompatible calling convention.
-+          :
-+        else
-+          ac_cv_path_install="$ac_dir/$ac_prog -c"
-+          break 2
-+        fi
-+      fi
-+      done
-+      ;;
-+    esac
-+  done
-+  IFS="$ac_save_IFS"
-+
-+fi
-+  if test "${ac_cv_path_install+set}" = set; then
-+    INSTALL="$ac_cv_path_install"
-+  else
-+    # As a last resort, use the slow shell script.  We don't cache a
-+    # path for INSTALL within a source directory, because that will
-+    # break other packages using the cache if that directory is
-+    # removed, or if the path is relative.
-+    INSTALL="$ac_install_sh"
-+  fi
-+fi
-+echo "$ac_t""$INSTALL" 1>&6
-+
-+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-+# It thinks the first close brace ends the variable substitution.
-+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-+
-+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-+
-+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-+
-+echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-+echo "configure:639: checking whether build environment is sane" >&5
-+# Just in case
-+sleep 1
-+echo timestamp > conftestfile
-+# Do `set' in a subshell so we don't clobber the current shell's
-+# arguments.  Must try -L first in case configure is actually a
-+# symlink; some systems play weird games with the mod time of symlinks
-+# (eg FreeBSD returns the mod time of the symlink's containing
-+# directory).
-+if (
-+   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
-+   if test "$*" = "X"; then
-+      # -L didn't work.
-+      set X `ls -t $srcdir/configure conftestfile`
-+   fi
-+   if test "$*" != "X $srcdir/configure conftestfile" \
-+      && test "$*" != "X conftestfile $srcdir/configure"; then
-+
-+      # If neither matched, then we have a broken ls.  This can happen
-+      # if, for instance, CONFIG_SHELL is bash and it inherits a
-+      # broken ls alias from the environment.  This has actually
-+      # happened.  Such a system could not be considered "sane".
-+      { echo "configure: error: ls -t appears to fail.  Make sure there is not a broken
-+alias in your environment" 1>&2; exit 1; }
-+   fi
-+
-+   test "$2" = conftestfile
-+   )
-+then
-+   # Ok.
-+   :
-+else
-+   { echo "configure: error: newly created file is older than distributed files!
-+Check your system clock" 1>&2; exit 1; }
-+fi
-+rm -f conftest*
-+echo "$ac_t""yes" 1>&6
-+if test "$program_transform_name" = s,x,x,; then
-+  program_transform_name=
-+else
-+  # Double any \ or $.  echo might interpret backslashes.
-+  cat <<\EOF_SED > conftestsed
-+s,\\,\\\\,g; s,\$,$$,g
-+EOF_SED
-+  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
-+  rm -f conftestsed
-+fi
-+test "$program_prefix" != NONE &&
-+  program_transform_name="s,^,${program_prefix},; $program_transform_name"
-+# Use a double $ so make ignores it.
-+test "$program_suffix" != NONE &&
-+  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
-+
-+# sed with no file args requires a program.
-+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
-+
-+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-+echo "configure:696: checking whether ${MAKE-make} sets \${MAKE}" >&5
-+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+  cat > conftestmake <<\EOF
-+all:
-+      @echo 'ac_maketemp="${MAKE}"'
-+EOF
-+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-+if test -n "$ac_maketemp"; then
-+  eval ac_cv_prog_make_${ac_make}_set=yes
-+else
-+  eval ac_cv_prog_make_${ac_make}_set=no
-+fi
-+rm -f conftestmake
-+fi
-+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-+  echo "$ac_t""yes" 1>&6
-+  SET_MAKE=
-+else
-+  echo "$ac_t""no" 1>&6
-+  SET_MAKE="MAKE=${MAKE-make}"
-+fi
-+
-+if test $host != $build; then
-+  ac_tool_prefix=${host_alias}-
-+else
-+  ac_tool_prefix=
-+fi
-+
-+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-+echo "configure:729: checking for Cygwin environment" >&5
-+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+  cat > conftest.$ac_ext <<EOF
-+#line 734 "configure"
-+#include "confdefs.h"
-+
-+int main() {
-+
-+#ifndef __CYGWIN__
-+#define __CYGWIN__ __CYGWIN32__
-+#endif
-+return __CYGWIN__;
-+; return 0; }
-+EOF
-+if { (eval echo configure:745: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-+  rm -rf conftest*
-+  ac_cv_cygwin=yes
-+else
-+  echo "configure: failed program was:" >&5
-+  cat conftest.$ac_ext >&5
-+  rm -rf conftest*
-+  ac_cv_cygwin=no
-+fi
-+rm -f conftest*
-+rm -f conftest*
-+fi
-+
-+echo "$ac_t""$ac_cv_cygwin" 1>&6
-+CYGWIN=
-+test "$ac_cv_cygwin" = yes && CYGWIN=yes
-+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-+echo "configure:762: checking for mingw32 environment" >&5
-+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+  cat > conftest.$ac_ext <<EOF
-+#line 767 "configure"
-+#include "confdefs.h"
-+
-+int main() {
-+return __MINGW32__;
-+; return 0; }
-+EOF
-+if { (eval echo configure:774: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-+  rm -rf conftest*
-+  ac_cv_mingw32=yes
-+else
-+  echo "configure: failed program was:" >&5
-+  cat conftest.$ac_ext >&5
-+  rm -rf conftest*
-+  ac_cv_mingw32=no
-+fi
-+rm -f conftest*
-+rm -f conftest*
-+fi
-+
-+echo "$ac_t""$ac_cv_mingw32" 1>&6
-+MINGW32=
-+test "$ac_cv_mingw32" = yes && MINGW32=yes
-+
-+# Check whether --enable-multilib or --disable-multilib was given.
-+if test "${enable_multilib+set}" = set; then
-+  enableval="$enable_multilib"
-+  case "${enableval}" in
-+  yes) multilib=yes ;;
-+  no)  multilib=no ;;
-+  *)   { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;;
-+ esac
-+else
-+  multilib=yes
-+fi
-+
-+# Check whether --enable-target-optspace or --disable-target-optspace was given.
-+if test "${enable_target_optspace+set}" = set; then
-+  enableval="$enable_target_optspace"
-+  case "${enableval}" in
-+  yes) target_optspace=yes ;;
-+  no)  target_optspace=no ;;
-+  *)   { echo "configure: error: bad value ${enableval} for target-optspace option" 1>&2; exit 1; } ;;
-+ esac
-+else
-+  target_optspace=
-+fi
-+
-+# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given.
-+if test "${enable_malloc_debugging+set}" = set; then
-+  enableval="$enable_malloc_debugging"
-+  case "${enableval}" in
-+  yes) malloc_debugging=yes ;;
-+  no)  malloc_debugging=no ;;
-+  *)   { echo "configure: error: bad value ${enableval} for malloc-debugging option" 1>&2; exit 1; } ;;
-+ esac
-+else
-+  malloc_debugging=
-+fi
-+
-+# Check whether --enable-newlib-mb or --disable-newlib-mb was given.
-+if test "${enable_newlib_mb+set}" = set; then
-+  enableval="$enable_newlib_mb"
-+  case "${enableval}" in
-+  yes) newlib_mb=yes ;;
-+  no)  newlib_mb=no ;;
-+  *)   { echo "configure: error: bad value ${enableval} for newlib-mb option" 1>&2; exit 1; } ;;
-+ esac
-+else
-+  newlib_mb=
-+fi
-+
-+# Check whether --enable-newlib-multithread or --disable-newlib-multithread was given.
-+if test "${enable_newlib_multithread+set}" = set; then
-+  enableval="$enable_newlib_multithread"
-+  case "${enableval}" in
-+  yes) newlib_multithread=yes ;;
-+  no)  newlib_multithread=no ;;
-+  *)   { echo "configure: error: bad value ${enableval} for newlib-multithread option" 1>&2; exit 1; } ;;
-+ esac
-+else
-+  newlib_multithread=yes
-+fi
-+
-+# Check whether --enable-newlib-elix-level or --disable-newlib-elix-level was given.
-+if test "${enable_newlib_elix_level+set}" = set; then
-+  enableval="$enable_newlib_elix_level"
-+  case "${enableval}" in
-+  0)   newlib_elix_level=0 ;;
-+  1)   newlib_elix_level=1 ;;
-+  2)   newlib_elix_level=2 ;;
-+  3)   newlib_elix_level=3 ;;
-+  4)   newlib_elix_level=4 ;;
-+  *)   { echo "configure: error: bad value ${enableval} for newlib-elix-level option" 1>&2; exit 1; } ;;
-+ esac
-+else
-+  newlib_elix_level=0
-+fi
-+
-+# Check whether --enable-newlib-io-float or --disable-newlib-io-float was given.
-+if test "${enable_newlib_io_float+set}" = set; then
-+  enableval="$enable_newlib_io_float"
-+  case "${enableval}" in
-+  yes) newlib_io_float=yes ;;
-+  no)  newlib_io_float=no ;;
-+  *)   { echo "configure: error: bad value ${enableval} for newlib-io-float option" 1>&2; exit 1; } ;;
-+ esac
-+else
-+  newlib_io_float=yes
-+fi
-+
-+
-+
-+test -z "${with_target_subdir}" && with_target_subdir=.
-+
-+if test "${srcdir}" = "."; then
-+  if test "${with_target_subdir}" != "."; then
-+    newlib_basedir="${srcdir}/${with_multisrctop}../../../.."
-+  else
-+    newlib_basedir="${srcdir}/${with_multisrctop}../../.."
-+  fi
-+else
-+  newlib_basedir="${srcdir}/../../.."
-+fi
-+
-+
-+
-+# Do some error checking and defaulting for the host and target type.
-+# The inputs are:
-+#    configure --host=HOST --target=TARGET --build=BUILD NONOPT
-+#
-+# The rules are:
-+# 1. You are not allowed to specify --host, --target, and nonopt at the
-+#    same time.
-+# 2. Host defaults to nonopt.
-+# 3. If nonopt is not specified, then host defaults to the current host,
-+#    as determined by config.guess.
-+# 4. Target and build default to nonopt.
-+# 5. If nonopt is not specified, then target and build default to host.
-+
-+# The aliases save the names the user supplied, while $host etc.
-+# will get canonicalized.
-+case $host---$target---$nonopt in
-+NONE---*---* | *---NONE---* | *---*---NONE) ;;
-+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-+esac
-+
-+
-+# Make sure we can run config.sub.
-+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-+fi
-+
-+echo $ac_n "checking host system type""... $ac_c" 1>&6
-+echo "configure:921: checking host system type" >&5
-+
-+host_alias=$host
-+case "$host_alias" in
-+NONE)
-+  case $nonopt in
-+  NONE)
-+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
-+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
-+    fi ;;
-+  *) host_alias=$nonopt ;;
-+  esac ;;
-+esac
-+
-+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-+echo "$ac_t""$host" 1>&6
-+
-+echo $ac_n "checking target system type""... $ac_c" 1>&6
-+echo "configure:942: checking target system type" >&5
-+
-+target_alias=$target
-+case "$target_alias" in
-+NONE)
-+  case $nonopt in
-+  NONE) target_alias=$host_alias ;;
-+  *) target_alias=$nonopt ;;
-+  esac ;;
-+esac
-+
-+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-+echo "$ac_t""$target" 1>&6
-+
-+echo $ac_n "checking build system type""... $ac_c" 1>&6
-+echo "configure:960: checking build system type" >&5
-+
-+build_alias=$build
-+case "$build_alias" in
-+NONE)
-+  case $nonopt in
-+  NONE) build_alias=$host_alias ;;
-+  *) build_alias=$nonopt ;;
-+  esac ;;
-+esac
-+
-+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-+echo "$ac_t""$build" 1>&6
-+
-+test "$host_alias" != "$target_alias" &&
-+  test "$program_prefix$program_suffix$program_transform_name" = \
-+    NONENONEs,x,x, &&
-+  program_prefix=${target_alias}-
-+
-+
-+
-+PACKAGE=newlib
-+
-+VERSION=1.11.0
-+
-+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
-+  { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
-+fi
-+cat >> confdefs.h <<EOF
-+#define PACKAGE "$PACKAGE"
-+EOF
-+
-+cat >> confdefs.h <<EOF
-+#define VERSION "$VERSION"
-+EOF
-+
-+
-+
-+missing_dir=`cd $ac_aux_dir && pwd`
-+echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-+echo "configure:1003: checking for working aclocal" >&5
-+# Run test in a subshell; some versions of sh will print an error if
-+# an executable is not found, even if stderr is redirected.
-+# Redirect stdin to placate older versions of autoconf.  Sigh.
-+if (aclocal --version) < /dev/null > /dev/null 2>&1; then
-+   ACLOCAL=aclocal
-+   echo "$ac_t""found" 1>&6
-+else
-+   ACLOCAL="$missing_dir/missing aclocal"
-+   echo "$ac_t""missing" 1>&6
-+fi
-+
-+echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-+echo "configure:1016: checking for working autoconf" >&5
-+# Run test in a subshell; some versions of sh will print an error if
-+# an executable is not found, even if stderr is redirected.
-+# Redirect stdin to placate older versions of autoconf.  Sigh.
-+if (autoconf --version) < /dev/null > /dev/null 2>&1; then
-+   AUTOCONF=autoconf
-+   echo "$ac_t""found" 1>&6
-+else
-+   AUTOCONF="$missing_dir/missing autoconf"
-+   echo "$ac_t""missing" 1>&6
-+fi
-+
-+echo $ac_n "checking for working automake""... $ac_c" 1>&6
-+echo "configure:1029: checking for working automake" >&5
-+# Run test in a subshell; some versions of sh will print an error if
-+# an executable is not found, even if stderr is redirected.
-+# Redirect stdin to placate older versions of autoconf.  Sigh.
-+if (automake --version) < /dev/null > /dev/null 2>&1; then
-+   AUTOMAKE=automake
-+   echo "$ac_t""found" 1>&6
-+else
-+   AUTOMAKE="$missing_dir/missing automake"
-+   echo "$ac_t""missing" 1>&6
-+fi
-+
-+echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-+echo "configure:1042: checking for working autoheader" >&5
-+# Run test in a subshell; some versions of sh will print an error if
-+# an executable is not found, even if stderr is redirected.
-+# Redirect stdin to placate older versions of autoconf.  Sigh.
-+if (autoheader --version) < /dev/null > /dev/null 2>&1; then
-+   AUTOHEADER=autoheader
-+   echo "$ac_t""found" 1>&6
-+else
-+   AUTOHEADER="$missing_dir/missing autoheader"
-+   echo "$ac_t""missing" 1>&6
-+fi
-+
-+echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-+echo "configure:1055: checking for working makeinfo" >&5
-+# Run test in a subshell; some versions of sh will print an error if
-+# an executable is not found, even if stderr is redirected.
-+# Redirect stdin to placate older versions of autoconf.  Sigh.
-+if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
-+   MAKEINFO=makeinfo
-+   echo "$ac_t""found" 1>&6
-+else
-+   MAKEINFO="$missing_dir/missing makeinfo"
-+   echo "$ac_t""missing" 1>&6
-+fi
-+
-+
-+
-+# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
-+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
-+# are probably using a cross compiler, which will not be able to fully
-+# link an executable.  This should really be fixed in autoconf
-+# itself.
-+
-+
-+
-+# Extract the first word of "gcc", so it can be a program name with args.
-+set dummy gcc; ac_word=$2
-+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-+echo "configure:1080: checking for $ac_word" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+  if test -n "$CC"; then
-+  ac_cv_prog_CC="$CC" # Let the user override the test.
-+else
-+  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS=":"
-+  ac_dummy="$PATH"
-+  for ac_dir in $ac_dummy; do
-+    test -z "$ac_dir" && ac_dir=.
-+    if test -f $ac_dir/$ac_word; then
-+      ac_cv_prog_CC="gcc"
-+      break
-+    fi
-+  done
-+  IFS="$ac_save_ifs"
-+fi
-+fi
-+CC="$ac_cv_prog_CC"
-+if test -n "$CC"; then
-+  echo "$ac_t""$CC" 1>&6
-+else
-+  echo "$ac_t""no" 1>&6
-+fi
-+
-+if test -z "$CC"; then
-+  # Extract the first word of "cc", so it can be a program name with args.
-+set dummy cc; ac_word=$2
-+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-+echo "configure:1110: checking for $ac_word" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+  if test -n "$CC"; then
-+  ac_cv_prog_CC="$CC" # Let the user override the test.
-+else
-+  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS=":"
-+  ac_prog_rejected=no
-+  ac_dummy="$PATH"
-+  for ac_dir in $ac_dummy; do
-+    test -z "$ac_dir" && ac_dir=.
-+    if test -f $ac_dir/$ac_word; then
-+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
-+        ac_prog_rejected=yes
-+      continue
-+      fi
-+      ac_cv_prog_CC="cc"
-+      break
-+    fi
-+  done
-+  IFS="$ac_save_ifs"
-+if test $ac_prog_rejected = yes; then
-+  # We found a bogon in the path, so make sure we never use it.
-+  set dummy $ac_cv_prog_CC
-+  shift
-+  if test $# -gt 0; then
-+    # We chose a different compiler from the bogus one.
-+    # However, it has the same basename, so the bogon will be chosen
-+    # first if we set CC to just the basename; use the full file name.
-+    shift
-+    set dummy "$ac_dir/$ac_word" "$@"
-+    shift
-+    ac_cv_prog_CC="$@"
-+  fi
-+fi
-+fi
-+fi
-+CC="$ac_cv_prog_CC"
-+if test -n "$CC"; then
-+  echo "$ac_t""$CC" 1>&6
-+else
-+  echo "$ac_t""no" 1>&6
-+fi
-+
-+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-+fi
-+
-+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-+echo "configure:1159: checking whether we are using GNU C" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+  cat > conftest.c <<EOF
-+#ifdef __GNUC__
-+  yes;
-+#endif
-+EOF
-+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
-+  ac_cv_prog_gcc=yes
-+else
-+  ac_cv_prog_gcc=no
-+fi
-+fi
-+
-+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-+
-+if test $ac_cv_prog_gcc = yes; then
-+  GCC=yes
-+  ac_test_CFLAGS="${CFLAGS+set}"
-+  ac_save_CFLAGS="$CFLAGS"
-+  CFLAGS=
-+  echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-+echo "configure:1183: checking whether ${CC-cc} accepts -g" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+  echo 'void f(){}' > conftest.c
-+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
-+  ac_cv_prog_cc_g=yes
-+else
-+  ac_cv_prog_cc_g=no
-+fi
-+rm -f conftest*
-+
-+fi
-+
-+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-+  if test "$ac_test_CFLAGS" = set; then
-+    CFLAGS="$ac_save_CFLAGS"
-+  elif test $ac_cv_prog_cc_g = yes; then
-+    CFLAGS="-g -O2"
-+  else
-+    CFLAGS="-O2"
-+  fi
-+else
-+  GCC=
-+  test "${CFLAGS+set}" = set || CFLAGS="-g"
-+fi
-+
-+
-+# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
-+set dummy ${ac_tool_prefix}as; ac_word=$2
-+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-+echo "configure:1214: checking for $ac_word" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+  if test -n "$AS"; then
-+  ac_cv_prog_AS="$AS" # Let the user override the test.
-+else
-+  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS=":"
-+  ac_dummy="$PATH"
-+  for ac_dir in $ac_dummy; do
-+    test -z "$ac_dir" && ac_dir=.
-+    if test -f $ac_dir/$ac_word; then
-+      ac_cv_prog_AS="${ac_tool_prefix}as"
-+      break
-+    fi
-+  done
-+  IFS="$ac_save_ifs"
-+  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as"
-+fi
-+fi
-+AS="$ac_cv_prog_AS"
-+if test -n "$AS"; then
-+  echo "$ac_t""$AS" 1>&6
-+else
-+  echo "$ac_t""no" 1>&6
-+fi
-+
-+
-+
-+# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-+set dummy ${ac_tool_prefix}ar; ac_word=$2
-+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-+echo "configure:1246: checking for $ac_word" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+  if test -n "$AR"; then
-+  ac_cv_prog_AR="$AR" # Let the user override the test.
-+else
-+  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS=":"
-+  ac_dummy="$PATH"
-+  for ac_dir in $ac_dummy; do
-+    test -z "$ac_dir" && ac_dir=.
-+    if test -f $ac_dir/$ac_word; then
-+      ac_cv_prog_AR="${ac_tool_prefix}ar"
-+      break
-+    fi
-+  done
-+  IFS="$ac_save_ifs"
-+  test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
-+fi
-+fi
-+AR="$ac_cv_prog_AR"
-+if test -n "$AR"; then
-+  echo "$ac_t""$AR" 1>&6
-+else
-+  echo "$ac_t""no" 1>&6
-+fi
-+
-+
-+
-+# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-+echo "configure:1278: checking for $ac_word" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+  if test -n "$RANLIB"; then
-+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-+else
-+  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS=":"
-+  ac_dummy="$PATH"
-+  for ac_dir in $ac_dummy; do
-+    test -z "$ac_dir" && ac_dir=.
-+    if test -f $ac_dir/$ac_word; then
-+      ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-+      break
-+    fi
-+  done
-+  IFS="$ac_save_ifs"
-+fi
-+fi
-+RANLIB="$ac_cv_prog_RANLIB"
-+if test -n "$RANLIB"; then
-+  echo "$ac_t""$RANLIB" 1>&6
-+else
-+  echo "$ac_t""no" 1>&6
-+fi
-+
-+
-+if test -z "$ac_cv_prog_RANLIB"; then
-+if test -n "$ac_tool_prefix"; then
-+  # Extract the first word of "ranlib", so it can be a program name with args.
-+set dummy ranlib; ac_word=$2
-+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-+echo "configure:1310: checking for $ac_word" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+  if test -n "$RANLIB"; then
-+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-+else
-+  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS=":"
-+  ac_dummy="$PATH"
-+  for ac_dir in $ac_dummy; do
-+    test -z "$ac_dir" && ac_dir=.
-+    if test -f $ac_dir/$ac_word; then
-+      ac_cv_prog_RANLIB="ranlib"
-+      break
-+    fi
-+  done
-+  IFS="$ac_save_ifs"
-+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-+fi
-+fi
-+RANLIB="$ac_cv_prog_RANLIB"
-+if test -n "$RANLIB"; then
-+  echo "$ac_t""$RANLIB" 1>&6
-+else
-+  echo "$ac_t""no" 1>&6
-+fi
-+
-+else
-+  RANLIB=":"
-+fi
-+fi
-+
-+
-+# Find a good install program.  We prefer a C program (faster),
-+# so one script is as good as another.  But avoid the broken or
-+# incompatible versions:
-+# SysV /etc/install, /usr/sbin/install
-+# SunOS /usr/etc/install
-+# IRIX /sbin/install
-+# AIX /bin/install
-+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-+# ./install, which can be erroneously created by make from ./install.sh.
-+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-+echo "configure:1355: checking for a BSD compatible install" >&5
-+if test -z "$INSTALL"; then
-+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+    IFS="${IFS=       }"; ac_save_IFS="$IFS"; IFS=":"
-+  for ac_dir in $PATH; do
-+    # Account for people who put trailing slashes in PATH elements.
-+    case "$ac_dir/" in
-+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
-+    *)
-+      # OSF1 and SCO ODT 3.0 have their own names for install.
-+      # Don't use installbsd from OSF since it installs stuff as root
-+      # by default.
-+      for ac_prog in ginstall scoinst install; do
-+        if test -f $ac_dir/$ac_prog; then
-+        if test $ac_prog = install &&
-+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
-+          # AIX install.  It has an incompatible calling convention.
-+          :
-+        else
-+          ac_cv_path_install="$ac_dir/$ac_prog -c"
-+          break 2
-+        fi
-+      fi
-+      done
-+      ;;
-+    esac
-+  done
-+  IFS="$ac_save_IFS"
-+
-+fi
-+  if test "${ac_cv_path_install+set}" = set; then
-+    INSTALL="$ac_cv_path_install"
-+  else
-+    # As a last resort, use the slow shell script.  We don't cache a
-+    # path for INSTALL within a source directory, because that will
-+    # break other packages using the cache if that directory is
-+    # removed, or if the path is relative.
-+    INSTALL="$ac_install_sh"
-+  fi
-+fi
-+echo "$ac_t""$INSTALL" 1>&6
-+
-+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-+# It thinks the first close brace ends the variable substitution.
-+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-+
-+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-+
-+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-+
-+
-+echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-+echo "configure:1409: checking whether to enable maintainer-specific portions of Makefiles" >&5
-+    # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
-+if test "${enable_maintainer_mode+set}" = set; then
-+  enableval="$enable_maintainer_mode"
-+  USE_MAINTAINER_MODE=$enableval
-+else
-+  USE_MAINTAINER_MODE=no
-+fi
-+
-+  echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
-+  
-+
-+if test $USE_MAINTAINER_MODE = yes; then
-+  MAINTAINER_MODE_TRUE=
-+  MAINTAINER_MODE_FALSE='#'
-+else
-+  MAINTAINER_MODE_TRUE='#'
-+  MAINTAINER_MODE_FALSE=
-+fi
-+  MAINT=$MAINTAINER_MODE_TRUE
-+  
-+
-+
-+# We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
-+# at least currently, we never actually build a program, so we never
-+# need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
-+# fails, because we are probably configuring with a cross compiler
-+# which can't create executables.  So we include AC_EXEEXT to keep
-+# automake happy, but we don't execute it, since we don't care about
-+# the result.
-+if false; then
-+  
-+
-+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-+echo "configure:1443: checking for executable suffix" >&5
-+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
-+  echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
-+  ac_cv_exeext=.exe
-+else
-+  rm -f conftest*
-+  echo 'int main () { return 0; }' > conftest.$ac_ext
-+  ac_cv_exeext=
-+  if { (eval echo configure:1453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
-+    for file in conftest.*; do
-+      case $file in
-+      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
-+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
-+      esac
-+    done
-+  else
-+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
-+  fi
-+  rm -f conftest*
-+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
-+fi
-+fi
-+
-+EXEEXT=""
-+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
-+echo "$ac_t""${ac_cv_exeext}" 1>&6
-+ac_exeext=$EXEEXT
-+
-+fi
-+
-+. ${newlib_basedir}/configure.host
-+
-+newlib_cflags="${newlib_cflags} -fno-builtin"
-+
-+NEWLIB_CFLAGS=${newlib_cflags}
-+
-+
-+LDFLAGS=${ldflags}
-+
-+
-+
-+
-+if test x${newlib_elix_level} = x0; then
-+  ELIX_LEVEL_0_TRUE=
-+  ELIX_LEVEL_0_FALSE='#'
-+else
-+  ELIX_LEVEL_0_TRUE='#'
-+  ELIX_LEVEL_0_FALSE=
-+fi
-+
-+
-+if test x${newlib_elix_level} = x1; then
-+  ELIX_LEVEL_1_TRUE=
-+  ELIX_LEVEL_1_FALSE='#'
-+else
-+  ELIX_LEVEL_1_TRUE='#'
-+  ELIX_LEVEL_1_FALSE=
-+fi
-+
-+
-+if test x${newlib_elix_level} = x2; then
-+  ELIX_LEVEL_2_TRUE=
-+  ELIX_LEVEL_2_FALSE='#'
-+else
-+  ELIX_LEVEL_2_TRUE='#'
-+  ELIX_LEVEL_2_FALSE=
-+fi
-+
-+
-+if test x${newlib_elix_level} = x3; then
-+  ELIX_LEVEL_3_TRUE=
-+  ELIX_LEVEL_3_FALSE='#'
-+else
-+  ELIX_LEVEL_3_TRUE='#'
-+  ELIX_LEVEL_3_FALSE=
-+fi
-+
-+
-+if test x${newlib_elix_level} = x4; then
-+  ELIX_LEVEL_4_TRUE=
-+  ELIX_LEVEL_4_FALSE='#'
-+else
-+  ELIX_LEVEL_4_TRUE='#'
-+  ELIX_LEVEL_4_FALSE=
-+fi
-+
-+
-+
-+if test x${use_libtool} = xyes; then
-+  USE_LIBTOOL_TRUE=
-+  USE_LIBTOOL_FALSE='#'
-+else
-+  USE_LIBTOOL_TRUE='#'
-+  USE_LIBTOOL_FALSE=
-+fi
-+
-+# Hard-code OBJEXT.  Normally it is set by AC_OBJEXT, but we
-+# use oext, which is set in configure.host based on the target platform.
-+OBJEXT=${oext}
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+trap '' 1 2 15
-+cat > confcache <<\EOF
-+# This file is a shell script that caches the results of configure
-+# tests run on this system so they can be shared between configure
-+# scripts and configure runs.  It is not useful on other systems.
-+# If it contains results you don't want to keep, you may remove or edit it.
-+#
-+# By default, configure uses ./config.cache as the cache file,
-+# creating it if it does not exist already.  You can give configure
-+# the --cache-file=FILE option to use a different cache file; that is
-+# what configure does when it calls configure scripts in
-+# subdirectories, so they share the cache.
-+# Giving --cache-file=/dev/null disables caching, for debugging configure.
-+# config.status only pays attention to the cache file if you give it the
-+# --recheck option to rerun configure.
-+#
-+EOF
-+# The following way of writing the cache mishandles newlines in values,
-+# but we know of no workaround that is simple, portable, and efficient.
-+# So, don't put newlines in cache variables' values.
-+# Ultrix sh set writes to stderr and can't be redirected directly,
-+# and sets the high bit in the cache file unless we assign to the vars.
-+(set) 2>&1 |
-+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
-+  *ac_space=\ *)
-+    # `set' does not quote correctly, so add quotes (double-quote substitution
-+    # turns \\\\ into \\, and sed turns \\ into \).
-+    sed -n \
-+      -e "s/'/'\\\\''/g" \
-+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
-+    ;;
-+  *)
-+    # `set' quotes correctly as required by POSIX, so do not add quotes.
-+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
-+    ;;
-+  esac >> confcache
-+if cmp -s $cache_file confcache; then
-+  :
-+else
-+  if test -w $cache_file; then
-+    echo "updating cache $cache_file"
-+    cat confcache > $cache_file
-+  else
-+    echo "not updating unwritable cache $cache_file"
-+  fi
-+fi
-+rm -f confcache
-+
-+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-+
-+test "x$prefix" = xNONE && prefix=$ac_default_prefix
-+# Let make expand exec_prefix.
-+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-+
-+# Any assignment to VPATH causes Sun make to only execute
-+# the first set of double-colon rules, so remove it if not needed.
-+# If there is a colon in the path, we need to keep it.
-+if test "x$srcdir" = x.; then
-+  ac_vpsub='/^[       ]*VPATH[        ]*=[^:]*$/d'
-+fi
-+
-+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-+
-+# Transform confdefs.h into DEFS.
-+# Protect against shell expansion while executing Makefile rules.
-+# Protect against Makefile macro expansion.
-+cat > conftest.defs <<\EOF
-+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-+s%[   `~#$^&*(){}\\|;'"<>?]%\\&%g
-+s%\[%\\&%g
-+s%\]%\\&%g
-+s%\$%$$%g
-+EOF
-+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-+rm -f conftest.defs
-+
-+
-+# Without the "./", some shells look in PATH for config.status.
-+: ${CONFIG_STATUS=./config.status}
-+
-+echo creating $CONFIG_STATUS
-+rm -f $CONFIG_STATUS
-+cat > $CONFIG_STATUS <<EOF
-+#! /bin/sh
-+# Generated automatically by configure.
-+# Run this file to recreate the current configuration.
-+# This directory was configured as follows,
-+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-+#
-+# $0 $ac_configure_args
-+#
-+# Compiler output produced by configure, useful for debugging
-+# configure, is in ./config.log if it exists.
-+
-+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-+for ac_option
-+do
-+  case "\$ac_option" in
-+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
-+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
-+    exit 0 ;;
-+  -help | --help | --hel | --he | --h)
-+    echo "\$ac_cs_usage"; exit 0 ;;
-+  *) echo "\$ac_cs_usage"; exit 1 ;;
-+  esac
-+done
-+
-+ac_given_srcdir=$srcdir
-+ac_given_INSTALL="$INSTALL"
-+
-+trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-+EOF
-+cat >> $CONFIG_STATUS <<EOF
-+
-+# Protect against being on the right side of a sed subst in config.status.
-+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
-+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-+$ac_vpsub
-+$extrasub
-+s%@SHELL@%$SHELL%g
-+s%@CFLAGS@%$CFLAGS%g
-+s%@CPPFLAGS@%$CPPFLAGS%g
-+s%@CXXFLAGS@%$CXXFLAGS%g
-+s%@FFLAGS@%$FFLAGS%g
-+s%@DEFS@%$DEFS%g
-+s%@LDFLAGS@%$LDFLAGS%g
-+s%@LIBS@%$LIBS%g
-+s%@exec_prefix@%$exec_prefix%g
-+s%@prefix@%$prefix%g
-+s%@program_transform_name@%$program_transform_name%g
-+s%@bindir@%$bindir%g
-+s%@sbindir@%$sbindir%g
-+s%@libexecdir@%$libexecdir%g
-+s%@datadir@%$datadir%g
-+s%@sysconfdir@%$sysconfdir%g
-+s%@sharedstatedir@%$sharedstatedir%g
-+s%@localstatedir@%$localstatedir%g
-+s%@libdir@%$libdir%g
-+s%@includedir@%$includedir%g
-+s%@oldincludedir@%$oldincludedir%g
-+s%@infodir@%$infodir%g
-+s%@mandir@%$mandir%g
-+s%@newlib_basedir@%$newlib_basedir%g
-+s%@host@%$host%g
-+s%@host_alias@%$host_alias%g
-+s%@host_cpu@%$host_cpu%g
-+s%@host_vendor@%$host_vendor%g
-+s%@host_os@%$host_os%g
-+s%@target@%$target%g
-+s%@target_alias@%$target_alias%g
-+s%@target_cpu@%$target_cpu%g
-+s%@target_vendor@%$target_vendor%g
-+s%@target_os@%$target_os%g
-+s%@build@%$build%g
-+s%@build_alias@%$build_alias%g
-+s%@build_cpu@%$build_cpu%g
-+s%@build_vendor@%$build_vendor%g
-+s%@build_os@%$build_os%g
-+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-+s%@INSTALL_DATA@%$INSTALL_DATA%g
-+s%@PACKAGE@%$PACKAGE%g
-+s%@VERSION@%$VERSION%g
-+s%@ACLOCAL@%$ACLOCAL%g
-+s%@AUTOCONF@%$AUTOCONF%g
-+s%@AUTOMAKE@%$AUTOMAKE%g
-+s%@AUTOHEADER@%$AUTOHEADER%g
-+s%@MAKEINFO@%$MAKEINFO%g
-+s%@SET_MAKE@%$SET_MAKE%g
-+s%@CC@%$CC%g
-+s%@AS@%$AS%g
-+s%@AR@%$AR%g
-+s%@RANLIB@%$RANLIB%g
-+s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
-+s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
-+s%@MAINT@%$MAINT%g
-+s%@EXEEXT@%$EXEEXT%g
-+s%@NEWLIB_CFLAGS@%$NEWLIB_CFLAGS%g
-+s%@ELIX_LEVEL_0_TRUE@%$ELIX_LEVEL_0_TRUE%g
-+s%@ELIX_LEVEL_0_FALSE@%$ELIX_LEVEL_0_FALSE%g
-+s%@ELIX_LEVEL_1_TRUE@%$ELIX_LEVEL_1_TRUE%g
-+s%@ELIX_LEVEL_1_FALSE@%$ELIX_LEVEL_1_FALSE%g
-+s%@ELIX_LEVEL_2_TRUE@%$ELIX_LEVEL_2_TRUE%g
-+s%@ELIX_LEVEL_2_FALSE@%$ELIX_LEVEL_2_FALSE%g
-+s%@ELIX_LEVEL_3_TRUE@%$ELIX_LEVEL_3_TRUE%g
-+s%@ELIX_LEVEL_3_FALSE@%$ELIX_LEVEL_3_FALSE%g
-+s%@ELIX_LEVEL_4_TRUE@%$ELIX_LEVEL_4_TRUE%g
-+s%@ELIX_LEVEL_4_FALSE@%$ELIX_LEVEL_4_FALSE%g
-+s%@USE_LIBTOOL_TRUE@%$USE_LIBTOOL_TRUE%g
-+s%@USE_LIBTOOL_FALSE@%$USE_LIBTOOL_FALSE%g
-+s%@OBJEXT@%$OBJEXT%g
-+s%@oext@%$oext%g
-+s%@aext@%$aext%g
-+s%@libm_machine_dir@%$libm_machine_dir%g
-+s%@machine_dir@%$machine_dir%g
-+s%@sys_dir@%$sys_dir%g
-+
-+CEOF
-+EOF
-+
-+cat >> $CONFIG_STATUS <<\EOF
-+
-+# Split the substitutions into bite-sized pieces for seds with
-+# small command number limits, like on Digital OSF/1 and HP-UX.
-+ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script.
-+ac_file=1 # Number of current file.
-+ac_beg=1 # First line for current file.
-+ac_end=$ac_max_sed_cmds # Line after last line for current file.
-+ac_more_lines=:
-+ac_sed_cmds=""
-+while $ac_more_lines; do
-+  if test $ac_beg -gt 1; then
-+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
-+  else
-+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
-+  fi
-+  if test ! -s conftest.s$ac_file; then
-+    ac_more_lines=false
-+    rm -f conftest.s$ac_file
-+  else
-+    if test -z "$ac_sed_cmds"; then
-+      ac_sed_cmds="sed -f conftest.s$ac_file"
-+    else
-+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
-+    fi
-+    ac_file=`expr $ac_file + 1`
-+    ac_beg=$ac_end
-+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
-+  fi
-+done
-+if test -z "$ac_sed_cmds"; then
-+  ac_sed_cmds=cat
-+fi
-+EOF
-+
-+cat >> $CONFIG_STATUS <<EOF
-+
-+CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-+EOF
-+cat >> $CONFIG_STATUS <<\EOF
-+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
-+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-+  case "$ac_file" in
-+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
-+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-+  *) ac_file_in="${ac_file}.in" ;;
-+  esac
-+
-+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-+
-+  # Remove last slash and all that follows it.  Not all systems have dirname.
-+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
-+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-+    # The file is in a subdirectory.
-+    test ! -d "$ac_dir" && mkdir "$ac_dir"
-+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
-+    # A "../" for each directory in $ac_dir_suffix.
-+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
-+  else
-+    ac_dir_suffix= ac_dots=
-+  fi
-+
-+  case "$ac_given_srcdir" in
-+  .)  srcdir=.
-+      if test -z "$ac_dots"; then top_srcdir=.
-+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
-+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
-+  *) # Relative path.
-+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
-+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
-+  esac
-+
-+  case "$ac_given_INSTALL" in
-+  [/$]*) INSTALL="$ac_given_INSTALL" ;;
-+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
-+  esac
-+
-+  echo creating "$ac_file"
-+  rm -f "$ac_file"
-+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
-+  case "$ac_file" in
-+  *Makefile*) ac_comsub="1i\\
-+# $configure_input" ;;
-+  *) ac_comsub= ;;
-+  esac
-+
-+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
-+  sed -e "$ac_comsub
-+s%@configure_input@%$configure_input%g
-+s%@srcdir@%$srcdir%g
-+s%@top_srcdir@%$top_srcdir%g
-+s%@INSTALL@%$INSTALL%g
-+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-+fi; done
-+rm -f conftest.s*
-+
-+EOF
-+cat >> $CONFIG_STATUS <<EOF
-+
-+EOF
-+cat >> $CONFIG_STATUS <<\EOF
-+
-+exit 0
-+EOF
-+chmod +x $CONFIG_STATUS
-+rm -fr confdefs* $ac_clean_files
-+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-+
-diff -urN ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/configure.in ./newlib/libc/sys/mipsunknown/configure.in
---- ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/configure.in     Wed Dec 31 19:00:00 1969
-+++ ./newlib/libc/sys/mipsunknown/configure.in Mon Nov 24 20:33:46 2003
-@@ -0,0 +1,12 @@
-+dnl This is the newlib/libc/sys/mipsunknown configure.in file.
-+dnl Process this file with autoconf to produce a configure script.
-+
-+AC_PREREQ(2.5)
-+AC_INIT(syscalls.c)
-+
-+dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. 
-+AC_CONFIG_AUX_DIR(../../../..)
-+
-+NEWLIB_CONFIGURE(../../..)
-+
-+AC_OUTPUT(Makefile)
-diff -urN ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/crt0.c ./newlib/libc/sys/mipsunknown/crt0.c
---- ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/crt0.c   Wed Dec 31 19:00:00 1969
-+++ ./newlib/libc/sys/mipsunknown/crt0.c       Mon Nov 24 21:03:56 2003
-@@ -0,0 +1,7 @@
-+/* This is just here to make the build proccess happy. The real crt0.c is included in the
-+   mips2java dist and will replace this after mips2java is installed */
-+
-+extern void puts(const char *s);   
-+void _start() {
-+    puts("Your build is broken... you shouldn't be using the crt0.c in newlib");
-+}
-diff -urN ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/sys/dirent.h ./newlib/libc/sys/mipsunknown/sys/dirent.h
---- ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/sys/dirent.h     Wed Dec 31 19:00:00 1969
-+++ ./newlib/libc/sys/mipsunknown/sys/dirent.h Mon Nov 24 22:46:36 2003
-@@ -0,0 +1,24 @@
-+#ifndef _SYS_DIRENT_H
-+#define _SYS_DIRENT_H
+diff -urN ../newlib-1.11.0.orig/newlib/libc/include/sys/utime.h ./newlib/libc/include/sys/utime.h
+--- ../newlib-1.11.0.orig/newlib/libc/include/sys/utime.h       2000-02-17 14:39:46.000000000 -0500
++++ ./newlib/libc/include/sys/utime.h   2004-05-02 19:57:46.000000000 -0400
+@@ -15,6 +15,8 @@
+   time_t modtime; 
+ };
++extern int utime(const char *file, const struct utimbuf *buf);
 +
-+#include <sys/types.h>
+ #ifdef __cplusplus
+ };
+ #endif
+diff -rNu ../newlib-1.11.0.orig/newlib/libc/include/sys/dirent.h ./newlib/libc/include/sys/dirent.h
+--- ../newlib-1.11.0.orig/newlib/libc/include/sys/dirent.h     2000-02-17 14:39:46.000000000 -0500
++++ ./newlib/libc/include/sys/dirent.h 2004-05-03 01:17:15.000000000 -0400
+@@ -1,15 +1,29 @@
+-/* <dirent.h> includes <sys/dirent.h>, which is this file.  On a
+-   system which supports <dirent.h>, this file is overridden by
+-   dirent.h in the libc/sys/.../sys directory.  On a system which does
+-   not support <dirent.h>, we will get this file which tries to find
+-   any other <dirent.h> which may be lurking around.  If there isn't
+-   one, the user will get an error indicating that there is no
+-   <dirent.h>.  */
+-
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+-#include_next <dirent.h>
 +
++#define MAXNAMLEN 4087
++    
 +struct dirent {
-+      long    d_ino;
-+      char    d_name[1024];
++    unsigned long d_reclen;
++    unsigned long d_ino;
++    char d_name[MAXNAMLEN+1];
 +};
 +
 +typedef struct {
-+      int     dd_fd;
-+    int dd_pos;
-+    struct dirent ent;
++    int dd_fd;
++    char *dd_buf;
++    long dd_loc;
++    long dd_size;
++    long dd_len;
 +} DIR;
 +
-+# define __dirfd(dp)  ((dp)->dd_fd)
-+
 +DIR *opendir (const char *);
 +struct dirent *readdir (DIR *);
++int readdir_r(DIR *, struct dirent *, struct dirent **);
 +void rewinddir (DIR *);
 +int closedir (DIR *);
 +
-+#endif
-diff -urN ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/sys/utime.h ./newlib/libc/sys/mipsunknown/sys/utime.h
---- ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/sys/utime.h      Wed Dec 31 19:00:00 1969
-+++ ./newlib/libc/sys/mipsunknown/sys/utime.h  Tue Nov 25 09:45:17 2003
-@@ -0,0 +1,20 @@
-+#ifndef _SYS_UTIME_H
-+#define _SYS_UTIME_H
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+struct utimbuf 
-+{
-+  time_t actime;
-+  time_t modtime; 
-+};
-+
-+extern int utime(const char *file, const struct utimbuf *buf);
-+
-+#ifdef __cplusplus
-+};
-+#endif
-+
-+#endif /* _SYS_UTIME_H */
-diff -urN ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/syscalls.c ./newlib/libc/sys/mipsunknown/syscalls.c
---- ../newlib-1.11.0.orig/newlib/libc/sys/mipsunknown/syscalls.c       Wed Dec 31 19:00:00 1969
-+++ ./newlib/libc/sys/mipsunknown/syscalls.c   Tue Nov 25 09:33:57 2003
-@@ -0,0 +1,49 @@
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <utime.h>
-+#include <errno.h>
-+#undef errno
-+
-+/* These are just connectors for the reent versions */
-+
-+extern int _mkdir_r(struct _reent *ptr, const char *path, mode_t mode);
-+int mkdir(const char *path, mode_t mode) { return _mkdir_r(_REENT, path, mode); }
-+
-+extern int _utime_r(struct _reent *ptr, const char *file, struct utimbuf *buf);
-+int utime(const char *file, const struct utimbuf *buf) { return _utime_r(_REENT,file,buf); }
-+
-+extern int _lstat_r(struct _reent *ptr, const char *path, struct stat *sb);
-+int lstat(const char *path, struct stat *sb) { return _lstat_r(_REENT,path,sb); }
-+
-+extern int _chdir_r(struct _reent *ptr, const char *path);
-+int chdir(const char *path) { return _chdir_r(_REENT,path); }
-+
-+extern int _pipe_r(struct _reent *ptr, int *filedes);
-+int pipe(int *filedes) { return _pipe_r(_REENT,filedes); }
-+
-+extern int _dup2_r(struct _reent *ptr, int oldd, int newd);
-+int dup2(int oldd,int newd) { return _dup2_r(_REENT,oldd,newd); }
-+
-+extern int _waitpid_r(struct _reent *ptr, pid_t pid, int *status, int opts);
-+int waitpid(pid_t pid, int *status, int opts) { return _waitpid_r(_REENT,pid,status,opts); }
-+
-+extern char* _getcwd_r(struct _reent *ptr, char *buf, size_t size);
-+char* getcwd(char *buf, size_t size) { return _getcwd_r(_REENT,buf,size); }
-+
-+extern int _symlink_r(struct _reent *ptr, const char *name1, const char *name2);
-+int symlink(const char *name1, const char *name2) { return _symlink_r(_REENT,name1,name2); }
-+
-+extern int _readlink_r(struct _reent *ptr, const char *path, const char *buf, int bufsize);
-+int readlink(const char *path, const char *buf, int bufsize) { return _readlink_r(_REENT,path,buf,bufsize); }
-+
-+extern int _chown_r(struct _reent *ptr, const char *path, uid_t uid, gid_t gid);
-+int chown(const char *path, uid_t uid, gid_t gid) { return _chown_r(_REENT,path,uid,gid); }
-+
-+extern int _fchown_r(struct _reent *ptr, int fd, uid_t uid, gid_t gid);
-+int fchown(int fd, uid_t uid, gid_t gid) { return _fchown_r(_REENT,fd,uid,gid); }
-+
-+extern int _chmod_r(struct _reent *ptr, const char *path, mode_t mode);
-+int chmod(const char *path, mode_t mode) { return _chmod_r(_REENT,path,mode); }
-+
-+extern int _fchmod_r(struct _reent *ptr, int fd, mode_t mode);
-+int fchmod(int fd, mode_t mode) { return _fchmod_r(_REENT,fd,mode); }
+ #ifdef __cplusplus
+ }
+ #endif