bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

coreutils-6.0: compilation failure on NetBSD 3.0 (2)


From: Bruno Haible
Subject: coreutils-6.0: compilation failure on NetBSD 3.0 (2)
Date: Fri, 18 Aug 2006 14:18:49 +0200
User-agent: KMail/1.9.1

Hi,

On NetBSD 3.0/x86, coreutils fail to compile like this:

if gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I. -I..  -I.. -I. -I../lib -I../lib  
-Wall -I/home/bruno/gnu/include  -g -O2 -MT stat.o -MD -MP -MF ".deps/stat.Tpo" 
-c -o stat.o stat.c;  then mv -f ".deps/stat.Tpo" ".deps/stat.Po"; else rm -f 
".deps/stat.Tpo"; exit 1; fi
stat.c: In function `human_fstype':
stat.c:147: error: structure has no member named `f_type'
stat.c:284: error: structure has no member named `f_type'
*** Error code 1

The reason is that the code expects either a member f_basetype or f_type in
'struct statvfs'. However, NetBSD 3.0 has a 'struct statvfs' with member
f_fstypename and no f_basetype, and 'struct statfs' doesn't exist any more.

This patch works on NetBSD 3.0, and passes "make check".


2006-08-18  Bruno Haible  <address@hidden>

        Add support for NetBSD 3.0.
        * m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Test also for f_fstypename
        in struct statvfs.
        * src/stat.c (USE_STATVFS): Set to 1 if 'struct statvfs' has a field
        f_fstypename.
        (STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME): Define also if 'struct statvfs'
        has a field f_fstypename.

--- m4/stat-prog.m4.bak 2005-05-14 09:58:31.000000000 +0200
+++ m4/stat-prog.m4     2006-08-18 03:44:53.000000000 +0200
@@ -1,7 +1,7 @@
-# stat-prog.m4 serial 2
+# stat-prog.m4 serial 3
 # Record the prerequisites of src/stat.c from the coreutils package.
 
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -60,6 +60,7 @@
   AC_CHECK_MEMBERS([struct statfs.f_basetype],,,[$statxfs_includes])
   AC_CHECK_MEMBERS([struct statvfs.f_basetype],,,[$statxfs_includes])
   AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$statxfs_includes])
+  AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,,[$statxfs_includes])
   AC_CHECK_MEMBERS([struct statfs.f_type],,,[$statxfs_includes])
   AC_CHECK_MEMBERS([struct statvfs.f_type],,,[$statxfs_includes])
   AC_CHECK_MEMBERS([struct statfs.f_fsid.__val],,,[$statxfs_includes])
--- src/stat.c.bak      2006-07-09 19:20:43.000000000 +0200
+++ src/stat.c  2006-08-18 03:40:12.000000000 +0200
@@ -20,7 +20,8 @@
 #include <config.h>
 
 #if (STAT_STATVFS \
-     && (HAVE_STRUCT_STATVFS_F_BASETYPE || ! HAVE_STRUCT_STATFS_F_FSTYPENAME))
+     && (HAVE_STRUCT_STATVFS_F_BASETYPE || HAVE_STRUCT_STATVFS_F_FSTYPENAME \
+        || ! HAVE_STRUCT_STATFS_F_FSTYPENAME))
 # define USE_STATVFS 1
 #else
 # define USE_STATVFS 0
@@ -92,7 +93,7 @@
 #if HAVE_STRUCT_STATVFS_F_BASETYPE
 # define STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME f_basetype
 #else
-# if HAVE_STRUCT_STATFS_F_FSTYPENAME
+# if HAVE_STRUCT_STATVFS_F_FSTYPENAME || HAVE_STRUCT_STATFS_F_FSTYPENAME
 #  define STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME f_fstypename
 # endif
 #endif
@@ -136,6 +137,7 @@
 
 /* Return the type of the specified file system.
    Some systems have statfvs.f_basetype[FSTYPSZ]. (AIX, HP-UX, and Solaris)
+   Others have statvfs.f_fstypename[_VFS_NAMELEN]. (NetBSD 3.0)
    Others have statfs.f_fstypename[MFSNAMELEN]. (NetBSD 1.5.2)
    Still others have neither and have to get by with f_type (Linux).  */
 static char const *




reply via email to

[Prev in Thread] Current Thread [Next in Thread]