Bruno Haible <[EMAIL PROTECTED]> writes: > Compiling the current coreutils CVS on MacOS X 10.3.9 now gives this error: > > stat.c: In function `print_statfs': > stat.c:416: error: incompatible types in initialization
Thanks for reporting this. Oops, this is another MacOS problem (I got misled by the subject line and thought I was done with MacOS). I hope it's the last one for now, but with this many fixes I probably messed something up. Anyway, I installed this patch, which I hope fixes things. 2006-08-29 Paul Eggert <[EMAIL PROTECTED]> * src/stat.c (HAVE_STRUCT_STATXFS_F_FSID_VAL, FSID_VAL): New macros, to work around a Mac OS X porting problem reported by Bruno Haible in <http://lists.gnu.org/archive/html/bug-coreutils/2006-08/msg00308.html>. (print_statfs): Use them. * m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Check for __val versus val components of fsid. Omit some checks that stat.c doesn't care about. --- src/stat.c 24 Aug 2006 21:47:37 -0000 1.99 +++ src/stat.c 29 Aug 2006 21:53:01 -0000 @@ -19,6 +19,8 @@ #include <config.h> +/* Keep this conditional in sync with the similar conditional in + ../m4/stat-prog.m4. */ #if (STAT_STATVFS \ && (HAVE_STRUCT_STATVFS_F_BASETYPE || HAVE_STRUCT_STATVFS_F_FSTYPENAME \ || (! HAVE_STRUCT_STATFS_F_FSTYPENAME && HAVE_STRUCT_STATVFS_F_TYPE))) @@ -69,6 +71,7 @@ #if USE_STATVFS # define STRUCT_STATVFS struct statvfs # define HAVE_STRUCT_STATXFS_F_FSID___VAL HAVE_STRUCT_STATVFS_F_FSID___VAL +# define HAVE_STRUCT_STATXFS_F_FSID_VAL HAVE_STRUCT_STATVFS_F_FSID_VAL # define HAVE_STRUCT_STATXFS_F_TYPE HAVE_STRUCT_STATVFS_F_TYPE # if HAVE_STRUCT_STATVFS_F_NAMEMAX # define SB_F_NAMEMAX(S) ((S)->f_namemax) @@ -111,14 +114,22 @@ statfs (char const *filename, struct fs_ # define f_ffree free_nodes # define STRUCT_STATVFS struct fs_info # define HAVE_STRUCT_STATXFS_F_FSID___VAL 0 +# define HAVE_STRUCT_STATXFS_F_FSID_VAL 0 # define STATFS_FRSIZE(S) ((S)->block_size) # else # define STRUCT_STATVFS struct statfs # define HAVE_STRUCT_STATXFS_F_FSID___VAL HAVE_STRUCT_STATFS_F_FSID___VAL +# define HAVE_STRUCT_STATXFS_F_FSID_VAL HAVE_STRUCT_STATFS_F_FSID_VAL # define STATFS_FRSIZE(S) 0 # endif #endif +#if HAVE_STRUCT_STATXFS_F_FSID___VAL +# define FSID_VAL __val +#elif HAVE_STRUCT_STATXFS_F_FSID_VAL +# define FSID_VAL val +#endif + #ifdef SB_F_NAMEMAX # define OUT_NAMEMAX out_uint #else @@ -404,13 +415,13 @@ print_statfs (char *pformat, size_t pref case 'i': { -#if HAVE_STRUCT_STATXFS_F_FSID___VAL - uintmax_t val0 = statfsbuf->f_fsid.__val[0]; - uintmax_t val1 = statfsbuf->f_fsid.__val[1]; +#ifdef FSID_VAL + uintmax_t val0 = statfsbuf->f_fsid.FSID_VAL[0]; + uintmax_t val1 = statfsbuf->f_fsid.FSID_VAL[1]; uintmax_t fsid = (val1 - + (sizeof statfsbuf->f_fsid.__val[1] < sizeof fsid - ? val0 << (CHAR_BIT * sizeof statfsbuf->f_fsid.__val[1]) + + (sizeof statfsbuf->f_fsid.FSID_VAL[1] < sizeof fsid + ? val0 << (CHAR_BIT * sizeof statfsbuf->f_fsid.FSID_VAL[1]) : 0)); #else uintmax_t fsid = statfsbuf->f_fsid; --- m4/stat-prog.m4 21 Aug 2006 07:30:47 -0000 1.7 +++ m4/stat-prog.m4 29 Aug 2006 21:53:01 -0000 @@ -52,16 +52,28 @@ $ac_includes_default # endif #endif " - 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]) - AC_CHECK_MEMBERS([struct statvfs.f_fsid.__val],,,[$statxfs_includes]) - AC_CHECK_MEMBERS([struct statfs.f_namemax],,,[$statxfs_includes]) - AC_CHECK_MEMBERS([struct statvfs.f_namemax],,,[$statxfs_includes]) - AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[$statxfs_includes]) - AC_CHECK_MEMBERS([struct statvfs.f_namelen],,,[$statxfs_includes]) + dnl Keep this long conditional in sync with the USE_STATVFS conditional + dnl in ../src/stat.c. + if test $ac_cv_header_sys_statvfs_h = yes && + { AC_CHECK_MEMBERS( + [struct statvfs.f_basetype, + struct statvfs.f_fstypename, + struct statvfs.f_type],,, + [$statxfs_includes]) + test $ac_cv_member_struct_statvfs_f_basetype = yes || + test $ac_cv_member_struct_statvfs_f_fstypename = yes || + { test $ac_cv_member_struct_statvfs_f_type = yes && + test $ac_cv_member_struct_statfs_f_fstypename != yes; }; }; then + AC_CHECK_MEMBERS( + [struct statvfs.f_fsid.__val, struct statvfs.f_fsid.val, + struct statvfs.f_namelen, struct statvfs.f_namemax],,, + [$statxfs_includes]) + else + AC_CHECK_MEMBERS( + [struct statfs.f_basetype, struct statfs.f_fsid.__val, + struct statfs.f_fsid.val, struct statfs.f_namelen, + struct statfs.f_namemax, struct statfs.f_type],,, + [$statxfs_includes]) + fi ])