From: <sun...@us...> - 2008-07-24 10:33:40
|
Revision: 30514 http://crystal.svn.sourceforge.net/crystal/?rev=30514&view=rev Author: sunshine Date: 2008-07-24 10:33:38 +0000 (Thu, 24 Jul 2008) Log Message: ----------- Eric Sunshine augmented the sysinfo() check in configure.ac to test also for presence of <sys/sysinfo.h> and #defines CS_HAVE_SYS_SYSINFO_H if found. Furthermore, configure.ac now additionally checks for structure member sysinfo.totalram and #defines CS_HAVE_STRUCT_SYSINFO_TOTALRAM if found. This is needed since there are platforms, such as OpenSolaris, which supply <sys/sysinfo.h>, sysinfo(), and 'struct sysinfo' but which do not necessarily publish 'struct sysinfo.totalram'. Resolves issue mentioned in ticket #511. Modified Paths: -------------- CS/trunk/configure.ac CS/trunk/libs/csutil/unix/memutil_impl.cpp Modified: CS/trunk/configure.ac =================================================================== --- CS/trunk/configure.ac 2008-07-24 09:05:15 UTC (rev 30513) +++ CS/trunk/configure.ac 2008-07-24 10:33:38 UTC (rev 30514) @@ -1824,12 +1824,17 @@ [], [], [CS_HEADER_PROPERTY([CS_HAVE__ALIGNED_MALLOC])]) -CS_CHECK_BUILD([for sysinfo()], [cs_cv_sysinfo], - [AC_LANG_PROGRAM( - [[#include <sys/sysinfo.h>]], - [struct sysinfo x; sysinfo(&x);])], - [],[], - [CS_HEADER_PROPERTY([CS_HAVE_SYSINFO])]) +AC_CHECK_HEADERS([sys/sysinfo.h], + [CS_HEADER_PROPERTY([CS_HAVE_SYS_SYSINFO_H]) + CS_CHECK_BUILD([for sysinfo()], [cs_cv_sysinfo], + [AC_LANG_PROGRAM( + [[#include <sys/sysinfo.h>]], + [struct sysinfo x; sysinfo(&x);])], + [],[], + [CS_HEADER_PROPERTY([CS_HAVE_SYSINFO])]) + AC_CHECK_MEMBERS([struct sysinfo.totalram], + [CS_HEADER_PROPERTY([CS_HAVE_STRUCT_SYSINFO_TOTALRAM])], [], + [#include <sys/sysinfo.h>])]) Modified: CS/trunk/libs/csutil/unix/memutil_impl.cpp =================================================================== --- CS/trunk/libs/csutil/unix/memutil_impl.cpp 2008-07-24 09:05:15 UTC (rev 30513) +++ CS/trunk/libs/csutil/unix/memutil_impl.cpp 2008-07-24 10:33:38 UTC (rev 30514) @@ -20,7 +20,7 @@ #include "csutil/csstring.h" #include "csutil/sysfunc.h" #include "../memutil.h" -#if defined(CS_HAVE_SYSINFO) +#if defined(CS_HAVE_SYS_SYSINFO_H) #include <sys/sysinfo.h> #endif @@ -28,7 +28,7 @@ static size_t query_sysinfo() { size_t n = 0; -#if defined(CS_HAVE_SYSINFO) +#if defined(CS_HAVE_SYSINFO) && defined(CS_HAVE_STRUCT_SYSINFO_TOTALRAM) struct sysinfo x; if (sysinfo(&x) == 0) n = x.totalram / 1024; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |