Many files:
  Add #ifdef's for HAVE_SYS_STAT_H and HAVE_SYS_TYPES_H

diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index 59c7092..d7a5ace 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,3 +1,7 @@
+Sun Oct 19 18:56:22 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+	* Add #ifdef's for HAVE_SYS_STAT_H and HAVE_SYS_TYPES_H
+
 Fri Oct  3 13:35:59 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
 	* llseek.c (ext2fs_llseek): Fix type error for ext2fs_llseek()
diff --git a/lib/ext2fs/alloc.c b/lib/ext2fs/alloc.c
index 308e353..eaf2758 100644
--- a/lib/ext2fs/alloc.c
+++ b/lib/ext2fs/alloc.c
@@ -16,8 +16,12 @@
 #endif
 #include <stdlib.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
index a557db1..b888414 100644
--- a/lib/ext2fs/alloc_tables.c
+++ b/lib/ext2fs/alloc_tables.c
@@ -18,8 +18,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/lib/ext2fs/badblocks.c b/lib/ext2fs/badblocks.c
index 75f6df0..38e9f6e 100644
--- a/lib/ext2fs/badblocks.c
+++ b/lib/ext2fs/badblocks.c
@@ -17,8 +17,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/lib/ext2fs/bb_compat.c b/lib/ext2fs/bb_compat.c
index 2a2c1ec..d47a916 100644
--- a/lib/ext2fs/bb_compat.c
+++ b/lib/ext2fs/bb_compat.c
@@ -17,8 +17,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/lib/ext2fs/bb_inode.c b/lib/ext2fs/bb_inode.c
index 7a9609c..6859700 100644
--- a/lib/ext2fs/bb_inode.c
+++ b/lib/ext2fs/bb_inode.c
@@ -21,8 +21,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/lib/ext2fs/bitmaps.c b/lib/ext2fs/bitmaps.c
index 1fa4a90..9fe2d16 100644
--- a/lib/ext2fs/bitmaps.c
+++ b/lib/ext2fs/bitmaps.c
@@ -18,8 +18,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/lib/ext2fs/bitops.c b/lib/ext2fs/bitops.c
index 8ae0242..70f4f4c 100644
--- a/lib/ext2fs/bitops.c
+++ b/lib/ext2fs/bitops.c
@@ -11,7 +11,9 @@
  */
 
 #include <stdio.h>
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
diff --git a/lib/ext2fs/bmove.c b/lib/ext2fs/bmove.c
index ae9ac25..b100793 100644
--- a/lib/ext2fs/bmove.c
+++ b/lib/ext2fs/bmove.c
@@ -12,8 +12,12 @@
 #include <unistd.h>
 #endif
 #include <stdlib.h>
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
+#if HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/lib/ext2fs/check_desc.c b/lib/ext2fs/check_desc.c
index 6a75b08..602753d 100644
--- a/lib/ext2fs/check_desc.c
+++ b/lib/ext2fs/check_desc.c
@@ -17,8 +17,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
diff --git a/lib/ext2fs/cmp_bitmaps.c b/lib/ext2fs/cmp_bitmaps.c
index 638315f..9e583a7 100644
--- a/lib/ext2fs/cmp_bitmaps.c
+++ b/lib/ext2fs/cmp_bitmaps.c
@@ -17,8 +17,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index 1537968..1057ff6 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -18,8 +18,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/lib/ext2fs/inline.c b/lib/ext2fs/inline.c
index d5ee683..97c3d06 100644
--- a/lib/ext2fs/inline.c
+++ b/lib/ext2fs/inline.c
@@ -20,8 +20,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
index 86aa01e..c84b27f 100644
--- a/lib/ext2fs/inode.c
+++ b/lib/ext2fs/inode.c
@@ -15,8 +15,12 @@
 #include <unistd.h>
 #endif
 #include <stdlib.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/lib/ext2fs/llseek.c b/lib/ext2fs/llseek.c
index b06590a..689b239 100644
--- a/lib/ext2fs/llseek.c
+++ b/lib/ext2fs/llseek.c
@@ -9,7 +9,9 @@
  * %End-Header%
  */
 
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 
 #include <errno.h>
 #include <stdlib.h>
diff --git a/lib/ext2fs/mkdir.c b/lib/ext2fs/mkdir.c
index 649f05a..2bfceb9 100644
--- a/lib/ext2fs/mkdir.c
+++ b/lib/ext2fs/mkdir.c
@@ -17,8 +17,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index 791ebe1..6b27397 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -22,8 +22,12 @@
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
diff --git a/lib/ext2fs/read_bb.c b/lib/ext2fs/read_bb.c
index 7379bbd..99c653d 100644
--- a/lib/ext2fs/read_bb.c
+++ b/lib/ext2fs/read_bb.c
@@ -17,8 +17,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
diff --git a/lib/ext2fs/read_bb_file.c b/lib/ext2fs/read_bb_file.c
index 32a8083..7534c64 100644
--- a/lib/ext2fs/read_bb_file.c
+++ b/lib/ext2fs/read_bb_file.c
@@ -17,8 +17,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 
 #include <linux/ext2_fs.h>
 
diff --git a/lib/ext2fs/test_io.c b/lib/ext2fs/test_io.c
index 65c4d10..26332ea 100644
--- a/lib/ext2fs/test_io.c
+++ b/lib/ext2fs/test_io.c
@@ -17,8 +17,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 0baae38..b17ed7f 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -19,8 +19,12 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif