Index: polyml/configure.ac
===================================================================
--- polyml/configure.ac	(revision 1799)
+++ polyml/configure.ac	(working copy)
@@ -91,6 +91,9 @@
 
 AM_PROG_AS
 
+# Activate large file mode if needed
+AC_SYS_LARGEFILE
+
 # Checks for libraries.
 AC_CHECK_LIB(gcc, main)
 AC_CHECK_LIB(gcc_s, main)
Index: polyml/libpolyml/arb.cpp
===================================================================
--- polyml/libpolyml/arb.cpp	(revision 1799)
+++ polyml/libpolyml/arb.cpp	(working copy)
@@ -463,7 +463,8 @@
     return ArbitraryPrecionFromUnsigned(taskData, uval);
 }
 
-#if (SIZEOF_LONG_LONG != 0 && SIZEOF_LONG_LONG <= SIZEOF_VOIDP)
+#if SIZEOF_LONG_LONG != 0
+#if SIZEOF_LONG_LONG <= SIZEOF_VOIDP
 Handle Make_arbitrary_precision(TaskData *taskData, long long val)
 {
     return ArbitraryPrecionFromSigned(taskData, val);
@@ -473,7 +474,42 @@
 {
     return ArbitraryPrecionFromUnsigned(taskData, uval);
 }
+#else
+Handle Make_arbitrary_precision(TaskData *taskData, long long val)
+{
+    if (val < 0)
+    {
+        Handle pos;
+
+        // Have to handle the most negative long long specially
+        if (val == -val)
+        {
+            val = -(val + 1LL);
+            pos = Make_arb_from_pair(taskData,
+                                     (unsigned)(val >> (sizeof(unsigned) * 8)),
+                                     (unsigned)val);
+            Handle one = Make_arbitrary_precision(taskData, 1);
+            return neg_longc(taskData, add_longc(taskData, pos, one));
+        }
+        val = -val;
+        pos = Make_arb_from_pair(taskData,
+                                 (unsigned)(val >> (sizeof(unsigned) * 8)),
+                                 (unsigned)val);
+        return neg_longc(taskData, pos);
+    }
+    return Make_arb_from_pair(taskData,
+                              (unsigned)(val >> (sizeof(unsigned) * 8)),
+                              (unsigned)val);
+}
+
+Handle Make_arbitrary_precision(TaskData *taskData, unsigned long long uval)
+{
+    return Make_arb_from_pair(taskData,
+                              (unsigned)(uval >> (sizeof(unsigned) * 8)),
+                              (unsigned)uval);
+}
 #endif
+#endif
 
 /* Creates an arbitrary precision number from two words.
    At present this is used for 64-bit quantities. */
Index: polyml/libpolyml/arb.h
===================================================================
--- polyml/libpolyml/arb.h	(revision 1799)
+++ polyml/libpolyml/arb.h	(working copy)
@@ -34,7 +34,7 @@
 extern Handle Make_arbitrary_precision(TaskData *taskData, int);
 extern Handle Make_arbitrary_precision(TaskData *taskData, unsigned);
 
-#if (SIZEOF_LONG_LONG != 0 && SIZEOF_LONG_LONG <= SIZEOF_VOIDP)
+#if SIZEOF_LONG_LONG != 0
 extern Handle Make_arbitrary_precision(TaskData *taskData, long long);
 extern Handle Make_arbitrary_precision(TaskData *taskData, unsigned long long);
 #endif
Index: polyml/libpolyml/basicio.cpp
===================================================================
--- polyml/libpolyml/basicio.cpp	(revision 1799)
+++ polyml/libpolyml/basicio.cpp	(working copy)
@@ -1385,7 +1385,7 @@
     struct stat fbuff;
     if (proper_stat(string_buffer, &fbuff) != 0)
         raise_syscall(taskData, "stat failed", errno);
-    return Make_arbitrary_precision(taskData, (POLYUNSIGNED)fbuff.st_size);
+    return Make_arbitrary_precision(taskData, fbuff.st_size);
     }
 #endif
 }
@@ -1886,7 +1886,7 @@
             if (proper_stat(string_buffer, &fbuff) != 0)
                 raise_syscall(taskData, "stat failed", errno);
             /* Assume that inodes are always non-negative. */
-            return Make_arbitrary_precision(taskData, (POLYUNSIGNED)fbuff.st_ino);
+            return Make_arbitrary_precision(taskData, fbuff.st_ino);
 #endif
         }
 
Index: polyml/libpolyml/unix_specific.cpp
===================================================================
--- polyml/libpolyml/unix_specific.cpp	(revision 1799)
+++ polyml/libpolyml/unix_specific.cpp	(working copy)
@@ -1369,12 +1369,12 @@
     else if ((buf->st_mode & S_IFMT) == S_IFSOCK) kind = 6;
     else /* Regular. */ kind = 0;
     kindHandle = Make_arbitrary_precision(taskData, kind);
-    inoHandle = Make_arbitrary_precision(taskData, (POLYUNSIGNED)buf->st_ino);
-    devHandle = Make_arbitrary_precision(taskData, (POLYUNSIGNED)buf->st_dev);
+    inoHandle = Make_arbitrary_precision(taskData, buf->st_ino);
+    devHandle = Make_arbitrary_precision(taskData, buf->st_dev);
     linkHandle = Make_arbitrary_precision(taskData, buf->st_nlink);
     uidHandle = Make_arbitrary_precision(taskData, buf->st_uid);
     gidHandle = Make_arbitrary_precision(taskData, buf->st_gid);
-    sizeHandle = Make_arbitrary_precision(taskData, (POLYUNSIGNED)buf->st_size);
+    sizeHandle = Make_arbitrary_precision(taskData, buf->st_size);
     /* TODO: The only really standard time fields give the seconds part.  There
        are various extensions which would give us microseconds or nanoseconds. */
     atimeHandle = Make_arb_from_pair_scaled(taskData, buf->st_atime, 0, 1000000);
