diff --git a/src/modules/files/configure.in b/src/modules/files/configure.in
index 96d80ac94922e405c323fd2e4a9a753b54bb07c8..63a1cde860e1c2bc6d7836f7a6d8b57442fb7b4f 100644
--- a/src/modules/files/configure.in
+++ b/src/modules/files/configure.in
@@ -3,8 +3,9 @@ AC_CONFIG_HEADER(file_machine.h)
 
 sinclude(../module_configure.in)
 
-AC_HAVE_HEADERS(arpa/inet.h sys/socketvar.h netinet/in.h sys/mount.h ustat.h\
- sys/socket.h sys/stream.h sys/protosw.h netdb.h sys/statvfs.h sys/vfs.h)
+AC_HAVE_HEADERS(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 )
 AC_HEADER_DIRENT
 AC_CHECK_LIB(bind, __inet_ntoa)
 AC_CHECK_LIB(socket, socket)
@@ -115,6 +116,9 @@ if test x$ac_cv_func_statfs = xyes ; then
 #ifdef HAVE_SYS_STATFS_H
 #include <sys/statfs.h>
 #endif
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
 
 int main()
 {
@@ -134,7 +138,13 @@ int main()
 
   AC_MSG_CHECKING(if the struct statfs has the member f_bavail)
   AC_CACHE_VAL(pike_cv_struct_statfs_f_bavail, [
+    echo -------
+    cat confdefs.h
+    echo -------
     AC_TRY_COMPILE([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
 #include <sys/stat.h>
 #ifdef HAVE_SYS_MOUNT_H
 #include <sys/mount.h>
@@ -143,14 +153,11 @@ int main()
 #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 ])
+      struct statfs st;
+      st.f_bavail = 0;
+    ], [ 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