From 3c5c0386e0a63f34a79ce78f5d35c48599949508 Mon Sep 17 00:00:00 2001 From: stwo Date: Mon, 6 Sep 2010 12:57:31 +0000 Subject: Backport blkcnt_t detection/usage. --- ChangeLog | 7 ++++++ generic/tclIOUtil.c | 6 ++++- unix/configure | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++- unix/configure.in | 6 +++-- 4 files changed, 83 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5821e0f..753f81a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-09-06 Stuart Cassoff + + * unix/configure.in, generic/tclIOUtil.c (Tcl_Stat): Updated so that + we do not assume that all unix systems have the POSIX blkcnt_t type, + since OpenBSD apparently does not. Backported from HEAD (2010-02-16). + * unix/configure: autoconf-2.59 + 2010-09-02 Andreas Kupries *** 8.5.9 TAGGED FOR RELEASE *** diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 6c1e64b..abefdc1 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.151.2.2 2009/12/28 13:53:40 dkf Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.151.2.3 2010/09/06 12:57:33 stwo Exp $ */ #include "tclInt.h" @@ -134,7 +134,11 @@ Tcl_Stat( oldStyleBuf->st_blksize = buf.st_blksize; #endif #ifdef HAVE_STRUCT_STAT_ST_BLOCKS +#ifdef HAVE_BLKCNT_T oldStyleBuf->st_blocks = (blkcnt_t) buf.st_blocks; +#else + oldStyleBuf->st_blocks = (unsigned long) buf.st_blocks; +#endif #endif } return ret; diff --git a/unix/configure b/unix/configure index 2965f76..7eaf6ed 100755 --- a/unix/configure +++ b/unix/configure @@ -13696,7 +13696,8 @@ _ACEOF #-------------------------------------------------------------------- # Some systems (e.g., IRIX 4.0.5) lack some fields in struct stat. But -# we might be able to use fstatfs instead. +# we might be able to use fstatfs instead. Some systems (OpenBSD?) also +# lack blkcnt_t. #-------------------------------------------------------------------- echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5 @@ -13918,6 +13919,71 @@ _ACEOF fi +echo "$as_me:$LINENO: checking for blkcnt_t" >&5 +echo $ECHO_N "checking for blkcnt_t... $ECHO_C" >&6 +if test "${ac_cv_type_blkcnt_t+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 () +{ +if ((blkcnt_t *) 0) + return 0; +if (sizeof (blkcnt_t)) + 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_type_blkcnt_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_blkcnt_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_blkcnt_t" >&5 +echo "${ECHO_T}$ac_cv_type_blkcnt_t" >&6 +if test $ac_cv_type_blkcnt_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_BLKCNT_T 1 +_ACEOF + + +fi + echo "$as_me:$LINENO: checking for fstatfs" >&5 echo $ECHO_N "checking for fstatfs... $ECHO_C" >&6 if test "${ac_cv_func_fstatfs+set}" = set; then diff --git a/unix/configure.in b/unix/configure.in index c3d65b8..0953d51 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tcl installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.180.2.17 2010/08/12 00:11:22 hobbs Exp $ +# RCS: @(#) $Id: configure.in,v 1.180.2.18 2010/09/06 12:57:34 stwo Exp $ AC_INIT([tcl],[8.5]) AC_PREREQ(2.59) @@ -245,10 +245,12 @@ SC_TIME_HANDLER #-------------------------------------------------------------------- # Some systems (e.g., IRIX 4.0.5) lack some fields in struct stat. But -# we might be able to use fstatfs instead. +# we might be able to use fstatfs instead. Some systems (OpenBSD?) also +# lack blkcnt_t. #-------------------------------------------------------------------- AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_blksize]) +AC_CHECK_TYPES([blkcnt_t]) AC_CHECK_FUNC(fstatfs, , [AC_DEFINE(NO_FSTATFS, 1, [Do we have fstatfs()?])]) #-------------------------------------------------------------------- -- cgit v0.12