diff --git a/src/modules/files/configure.in b/src/modules/files/configure.in
index 489e39a2e25f432a880765f0de56e780cb009075..d3c840e8ca556453c929920bc8b106a72b319848 100644
--- a/src/modules/files/configure.in
+++ b/src/modules/files/configure.in
@@ -105,6 +105,58 @@ fi
 
 else :; fi
 
+if test x$ac_cv_func_statfs = xyes ; then
+  AC_MSG_CHECKING(if statfs takes 2(Standard) or 4(SGI) arguments)
+  AC_CACHE_VAL(pike_cv_func_sgi_statfs, [
+    AC_TRY_RUN([
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+
+int main()
+{
+  exit(0);
+
+  /* NOT REACHED */
+  statfs((char *)0, (struct statfs *)0);
+}
+],pike_cv_func_sgi_statfs=no,pike_cv_func_sgi_statfs=yes)
+  ])
+  if test x$pike_cv_func_sgi_statfs = xyes ; then
+    AC_MSG_RESULT(SGI style)
+    AC_DEFINE(HAVE_SGI_STATFS)
+  else
+    AC_MSG_RESULT(Standard)
+  fi
+
+  AC_MSG_CHECKING(if the struct statfs has the member f_bavail)
+  AC_CACHE_VAL(pike_cv_struct_statfs_f_bavail, [
+    AC_TRY_COMPILE([
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+    ], [
+      int main(int argc, char **argv)
+      {
+        struct statfs st;
+	st.f_bavail = 0;
+        return(st.f_bavail);
+      }
+    ], [ pike_cv_struct_statfs_f_bavail=yes ],
+    [ pike_cv_struct_statfs_f_bavail=no ])
+  ])
+  AC_MSG_RESULT($pike_cv_struct_statfs_f_bavail)
+  if test x$pike_cv_struct_statfs_f_bavail = xyes; then
+    AC_DEFINE(HAVE_STATFS_F_BAVAIL)
+  else :; fi
+else :; fi
+
 AC_MSG_CHECKING(for working (and failsafe) strerror)
 AC_CACHE_VAL(pike_cv_func_failsafe_strerror,
 [