]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Fix portability problem on FreeBSD5.0: don't include
authorJim Meyering <jim@meyering.net>
Mon, 26 May 2003 20:23:14 +0000 (20:23 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 26 May 2003 20:23:14 +0000 (20:23 +0000)
<sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
Use #if/#elif/... cascade so we get only one set of include files.

src/stat.c

index 841cffa093ee5abbfe0de1c44bfeb7d525fcf755..af19a17bea9779f79d5fc52f30867f85c69f9d51 100644 (file)
 #include <grp.h>
 #include <unistd.h>
 #include <time.h>
-#if HAVE_SYS_STATVFS_H
-# include <sys/statvfs.h>
-#endif
 #if HAVE_SYS_VFS_H
 # include <sys/vfs.h>
-#endif
-
-#if !HAVE_SYS_STATVFS_H && !HAVE_SYS_VFS_H
-# if HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H
+#elif HAVE_SYS_STATVFS_H && HAVE_STRUCT_STATVFS_F_BASETYPE
+# include <sys/statvfs.h>
+#elif HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H
+/* NOTE: freebsd5.0 needs sys/param.h and sys/mount.h for statfs.
+   It does have statvfs.h, but shouldn't use it, since it doesn't
+   HAVE_STRUCT_STATVFS_F_BASETYPE.  So find a clean way to fix it.  */
 /* NetBSD 1.5.2 needs these, for the declaration of struct statfs. */
-#  include <sys/param.h>
-#  include <sys/mount.h>
-# elif HAVE_NETINET_IN_H && HAVE_NFS_NFS_CLNT_H && HAVE_NFS_VFS_H
+# include <sys/param.h>
+# include <sys/mount.h>
+#elif HAVE_NETINET_IN_H && HAVE_NFS_NFS_CLNT_H && HAVE_NFS_VFS_H
 /* Ultrix 4.4 needs these for the declaration of struct statfs.  */
-#  include <netinet/in.h>
-#  include <nfs/nfs_clnt.h>
-#  include <nfs/vfs.h>
-# endif
+# include <netinet/in.h>
+# include <nfs/nfs_clnt.h>
+# include <nfs/vfs.h>
 #endif
 
 #include "system.h"