diff options
author | Dan McGee <dan@archlinux.org> | 2010-11-16 20:12:26 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-12-12 20:31:51 -0600 |
commit | ec136784d4328b4c75f622c08273cf9dc6cac40f (patch) | |
tree | 645ba47c7ce525e5b21c792b19b649668e0dbf9c /acinclude.m4 | |
parent | 24684a616ed46c635a2236873c8168b9153b5bc1 (diff) | |
download | pacman-ec136784d4328b4c75f622c08273cf9dc6cac40f.tar.xz |
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 <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 28 |
1 files changed, 26 insertions, 2 deletions
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 <sys/param.h> +# include <sys/mount.h> +#if HAVE_SYS_UCRED_H +#include <sys/ucred.h> +#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')]) +]) + |