From ec136784d4328b4c75f622c08273cf9dc6cac40f Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 16 Nov 2010 20:12:26 -0600 Subject: Refactor statfs/statvfs type check Turn it into a configure-type typedef, which allows us to reduce the amount of duplicated code and clean up some #ifdef magic in the code itself. Adjust some of the other defined checks to look at the headers available rather than trying to pull in the right ones based on configure checks. Signed-off-by: Dan McGee Signed-off-by: Allan McRae --- acinclude.m4 | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index 740d9ecc..6693da44 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -77,7 +77,7 @@ AC_DEFUN([GCC_VISIBILITY_CC],[ if test $visibility_cv_cc = yes; then AC_DEFINE([ENABLE_VISIBILITY_CC], 1, [Define if symbol visibility C support is enabled.]) fi - AM_CONDITIONAL([ENABLE_VISIBILITY_CC], test "x$visibility_cv_cc" = "xyes") + AM_CONDITIONAL([ENABLE_VISIBILITY_CC], test "x$visibility_cv_cc" = "xyes") fi ]) @@ -97,7 +97,31 @@ AC_DEFUN([GCC_GNU89_INLINE_CC],[ if test $gnu89_inline_cv_cc = yes; then AC_DEFINE([ENABLE_GNU89_INLINE_CC], 1, [Define if gnu89 inlining semantics should be used.]) fi - AM_CONDITIONAL([ENABLE_GNU89_INLINE_CC], test "x$gnu89_inline_cv_cc" = "xyes") + AM_CONDITIONAL([ENABLE_GNU89_INLINE_CC], test "x$gnu89_inline_cv_cc" = "xyes") fi ]) +dnl Checks for getmntinfo and determines whether it uses statfs or statvfs +AC_DEFUN([FS_STATS_TYPE], + [AC_CACHE_CHECK([filesystem statistics type], fs_stats_cv_type, + [AC_CHECK_FUNC(getmntinfo, + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +# include +# include +#if HAVE_SYS_UCRED_H +#include +#endif +extern int getmntinfo (struct statfs **, int); +]], + [])], + [fs_stats_cv_type="struct statfs"], + [fs_stats_cv_type="struct statvfs"])], + [AC_CHECK_FUNC(getmntent, + [fs_stats_cv_type="struct statvfs"])] + )] + ) + AC_DEFINE_UNQUOTED(FSSTATSTYPE, [$fs_stats_cv_type], + [Defined as the filesystem stats type ('statvfs' or 'statfs')]) +]) + -- cgit v1.2.3-24-g4f1b