Index: generic/tclCmdAH.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCmdAH.c,v
retrieving revision 1.121
diff -u -p -r1.121 tclCmdAH.c
--- generic/tclCmdAH.c	19 Aug 2009 14:32:12 -0000	1.121
+++ generic/tclCmdAH.c	9 Nov 2009 16:48:10 -0000
@@ -1623,7 +1623,7 @@ StoreStatData(
     STORE_ARY("uid",	Tcl_NewLongObj((long)statPtr->st_uid));
     STORE_ARY("gid",	Tcl_NewLongObj((long)statPtr->st_gid));
     STORE_ARY("size",	Tcl_NewWideIntObj((Tcl_WideInt)statPtr->st_size));
-#ifdef HAVE_ST_BLOCKS
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
     STORE_ARY("blocks",	Tcl_NewWideIntObj((Tcl_WideInt)statPtr->st_blocks));
 #endif
     STORE_ARY("atime",	Tcl_NewLongObj((long)statPtr->st_atime));
Index: generic/tclFileName.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclFileName.c,v
retrieving revision 1.98
diff -u -p -r1.98 tclFileName.c
--- generic/tclFileName.c	21 Aug 2009 19:06:06 -0000	1.98
+++ generic/tclFileName.c	9 Nov 2009 16:48:10 -0000
@@ -46,7 +46,7 @@ static int		DoGlob(Tcl_Interp *interp, T
  * specific files.
  */
 
-#if (!defined(HAVE_ST_BLOCKS) && !defined(GUESSED_BLOCK_SIZE))
+#if (!defined(HAVE_STRUCT_STAT_ST_BLOCKS) && !defined(GUESSED_BLOCK_SIZE))
 #define GUESSED_BLOCK_SIZE	1024
 #endif
 
@@ -2663,7 +2663,7 @@ Tcl_WideUInt
 Tcl_GetBlocksFromStat(
     const Tcl_StatBuf *statPtr)
 {
-#ifdef HAVE_ST_BLOCKS
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
     return (Tcl_WideUInt) statPtr->st_blocks;
 #else
     return ((Tcl_WideUInt) statPtr->st_size
@@ -2675,7 +2675,7 @@ unsigned
 Tcl_GetBlockSizeFromStat(
     const Tcl_StatBuf *statPtr)
 {
-#ifdef HAVE_ST_BLOCKS
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
     return (unsigned) statPtr->st_blksize;
 #else
     /*
Index: generic/tclIOUtil.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIOUtil.c,v
retrieving revision 1.164
diff -u -p -r1.164 tclIOUtil.c
--- generic/tclIOUtil.c	16 Jul 2009 21:24:39 -0000	1.164
+++ generic/tclIOUtil.c	9 Nov 2009 16:48:12 -0000
@@ -225,7 +225,7 @@ Tcl_Stat(
     Tcl_Obj *pathPtr = Tcl_NewStringObj(path,-1);
 #ifndef TCL_WIDE_INT_IS_LONG
     Tcl_WideInt tmp1, tmp2;
-#ifdef HAVE_ST_BLOCKS
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
     Tcl_WideInt tmp3;
 #endif
 #endif
@@ -253,12 +253,12 @@ Tcl_Stat(
 
 	tmp1 = (Tcl_WideInt) buf.st_ino;
 	tmp2 = (Tcl_WideInt) buf.st_size;
-#ifdef HAVE_ST_BLOCKS
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
 	tmp3 = (Tcl_WideInt) buf.st_blocks;
 #endif
 
 	if (OUT_OF_URANGE(tmp1) || OUT_OF_RANGE(tmp2)
-#ifdef HAVE_ST_BLOCKS
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
 		|| OUT_OF_RANGE(tmp3)
 #endif
 	    ) {
@@ -297,9 +297,9 @@ Tcl_Stat(
 	oldStyleBuf->st_atime	= buf.st_atime;
 	oldStyleBuf->st_mtime	= buf.st_mtime;
 	oldStyleBuf->st_ctime	= buf.st_ctime;
-#ifdef HAVE_ST_BLOCKS
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
 	oldStyleBuf->st_blksize	= buf.st_blksize;
-	oldStyleBuf->st_blocks	= (blkcnt_t) buf.st_blocks;
+	oldStyleBuf->st_blocks	= buf.st_blocks;
 #endif
     }
     return ret;
Index: unix/configure
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/configure,v
retrieving revision 1.270
diff -u -p -r1.270 configure
--- unix/configure	20 Oct 2009 17:21:23 -0000	1.270
+++ unix/configure	9 Nov 2009 16:48:20 -0000
@@ -14184,6 +14184,121 @@ fi
 
 
 #--------------------------------------------------------------------
+#	Some systems lack the st_blocks field in struct stat ?
+#--------------------------------------------------------------------
+
+echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5
+echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6
+if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_blocks)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_stat_st_blocks=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_blocks)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_stat_st_blocks=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_struct_stat_st_blocks=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5
+echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6
+if test $ac_cv_member_struct_stat_st_blocks = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BLOCKS 1
+_ACEOF
+
+
+fi
+
+
+#--------------------------------------------------------------------
 #       Some system have no memcmp or it does not work with 8 bit data, this
 #       checks it and add memcmp.o to LIBOBJS if needed
 #--------------------------------------------------------------------
Index: unix/configure.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/configure.in,v
retrieving revision 1.207
diff -u -p -r1.207 configure.in
--- unix/configure.in	10 Apr 2009 18:01:31 -0000	1.207
+++ unix/configure.in	9 Nov 2009 16:48:21 -0000
@@ -286,6 +286,12 @@ AC_STRUCT_ST_BLKSIZE
 AC_CHECK_FUNC(fstatfs, , [AC_DEFINE(NO_FSTATFS, 1, [Do we have fstatfs()?])])
 
 #--------------------------------------------------------------------
+#	Some systems lack the st_blocks field in struct stat ?
+#--------------------------------------------------------------------
+
+AC_CHECK_MEMBERS([struct stat.st_blocks])
+
+#--------------------------------------------------------------------
 #       Some system have no memcmp or it does not work with 8 bit data, this
 #       checks it and add memcmp.o to LIBOBJS if needed
 #--------------------------------------------------------------------
Index: unix/tclConfig.h.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclConfig.h.in,v
retrieving revision 1.39
diff -u -p -r1.39 tclConfig.h.in
--- unix/tclConfig.h.in	10 Apr 2009 18:01:32 -0000	1.39
+++ unix/tclConfig.h.in	9 Nov 2009 16:48:21 -0000
@@ -191,6 +191,9 @@
    `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */
 #undef HAVE_ST_BLKSIZE
 
+/* Define to 1 if `st_blocks' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BLOCKS
+
 /* Define to 1 if you have the <sys/filio.h> header file. */
 #undef HAVE_SYS_FILIO_H
 
