diff --git a/src/modules/files/acconfig.h b/src/modules/files/acconfig.h
index 8366484ee95110b3a90569d7cd4699cf526b58c3..04b40a8253e30b22aff5c3e5d81b5df1891612db 100644
--- a/src/modules/files/acconfig.h
+++ b/src/modules/files/acconfig.h
@@ -1,5 +1,5 @@
 /*
- * $Id: acconfig.h,v 1.2 1997/06/01 22:57:26 grubba Exp $
+ * $Id: acconfig.h,v 1.3 1997/06/13 11:52:19 grubba Exp $
  */
 
 #ifndef FILE_MACHINE_H
@@ -9,7 +9,7 @@
 @BOTTOM@
 
 /* Define if your statfs() call takes 4 arguments */
-#undef HAVE_SGI_STATFS
+#undef HAVE_SYSV_STATFS
 
 /* Define if your statfs struct has the f_bavail member */
 #undef HAVE_STATFS_F_BAVAIL
diff --git a/src/modules/files/configure.in b/src/modules/files/configure.in
index 22324b4c4eb63346d169d3b16c5023a2bfdf15f7..4ce853f732ada24a381218f94942c9858ca3f51f 100644
--- a/src/modules/files/configure.in
+++ b/src/modules/files/configure.in
@@ -4,8 +4,8 @@ AC_CONFIG_HEADER(file_machine.h)
 sinclude(../module_configure.in)
 
 AC_HAVE_HEADERS(sys/types.h arpa/inet.h sys/socketvar.h netinet/in.h \
- sys/mount.h ustat.h sys/statfs.h sys/statvfs.h sys/vfs.h \
- sys/socket.h sys/stream.h sys/protosw.h netdb.h )
+ sys/mount.h ustat.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
+ sys/socket.h sys/stream.h sys/protosw.h netdb.h sys/sysproto.h)
 AC_HEADER_DIRENT
 AC_CHECK_LIB(bind, __inet_ntoa)
 AC_CHECK_LIB(socket, socket)
@@ -29,6 +29,12 @@ if test x$ac_cv_func_readdir_r = xyes ; then
 #include <ndri.h>
 #endif
 #endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_SYSPROTO_H
+#include <sys/sysproto.h>
+#endif
 
 int main()
 {
@@ -63,6 +69,12 @@ else
 #include <ndri.h>
 #endif
 #endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_SYSPROTO_H
+#include <sys/sysproto.h>
+#endif
 
 extern int errno;
 
@@ -107,9 +119,15 @@ 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_MSG_CHECKING(if statfs takes 2(BSD) or 4(SysV) arguments)
+  AC_CACHE_VAL(pike_cv_func_sysv_statfs, [
     AC_TRY_RUN([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_SYSPROTO_H
+#include <sys/sysproto.h>
+#endif
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -120,6 +138,9 @@ if test x$ac_cv_func_statfs = xyes ; then
 #ifdef HAVE_SYS_STATFS_H
 #include <sys/statfs.h>
 #endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
 #ifdef HAVE_SYS_MOUNT_H
 #include <sys/mount.h>
 #endif
@@ -129,20 +150,26 @@ int main()
   exit(0);
 
   /* NOT REACHED */
-  statfs((char *)0, (struct statfs *)0);
+  statfs((char *)0, (struct statfs *)0, 0, 0);
 }
-],pike_cv_func_sgi_statfs=no,pike_cv_func_sgi_statfs=yes)
+],pike_cv_func_sysv_statfs=yes,pike_cv_func_sysv_statfs=no)
   ])
-  if test x$pike_cv_func_sgi_statfs = xyes ; then
-    AC_MSG_RESULT(SGI style)
-    AC_DEFINE(HAVE_SGI_STATFS)
+  if test x$pike_cv_func_sysv_statfs = xyes ; then
+    AC_MSG_RESULT(SysV style)
+    AC_DEFINE(HAVE_SYSV_STATFS)
   else
-    AC_MSG_RESULT(Standard)
+    AC_MSG_RESULT(BSD style)
   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_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_SYSPROTO_H
+#include <sys/sysproto.h>
+#endif
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
diff --git a/src/modules/files/efuns.c b/src/modules/files/efuns.c
index 2402c7b3c76fee1c8d1006299e270352f1df4166..02fac75702ff93ae8d6c9aeb4cc2c79127e743e4 100644
--- a/src/modules/files/efuns.c
+++ b/src/modules/files/efuns.c
@@ -25,7 +25,9 @@
 #include <sys/types.h>
 #endif
 #include <sys/stat.h>
+#ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
+#endif
 #include <signal.h>
 #include <errno.h>
 
@@ -107,6 +109,9 @@ void f_file_stat(INT32 args)
 #ifdef HAVE_SYS_STATFS_H
 #include <sys/statfs.h>
 #endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
 #ifdef HAVE_SYS_MOUNT_H
 #include <sys/mount.h>
 #endif /* HAVE_SYS_MOUNT_H */
@@ -143,11 +148,11 @@ void f_filesystem_stat(INT32 args)
   i = statvfs(s, &st);
 #else
 #ifdef HAVE_STATFS
-#ifdef HAVE_SGI_STATFS
+#ifdef HAVE_SYSV_STATFS
   i = statfs(s, &st, sizeof(st), 0);
 #else
   i = statfs(s, &st);
-#endif /* HAVE_SGI_STATFS */
+#endif /* HAVE_SYSV_STATFS */
 #else
 #ifdef HAVE_USTAT
   if (!(i = stat(s, &statbuf))) {