From aff3a43fa099aab39927d93fc3f0cd861b15876d Mon Sep 17 00:00:00 2001 From: Evgen Bodunov Date: Thu, 23 Nov 2017 15:28:25 +0300 Subject: [PATCH] Fixed getpagesize detection on Android --- m4/check-libc.m4 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/m4/check-libc.m4 b/m4/check-libc.m4 index b1b5ef4..5bb4287 100644 --- a/m4/check-libc.m4 +++ b/m4/check-libc.m4 @@ -2,10 +2,23 @@ AC_DEFUN([CHECK_LIBC_COMPAT], [ # Check for libc headers AC_CHECK_HEADERS([err.h readpassphrase.h]) # Check for general libc functions -AC_CHECK_FUNCS([asprintf freezero getpagesize inet_ntop inet_pton memmem]) +AC_CHECK_FUNCS([asprintf freezero inet_ntop inet_pton memmem]) AC_CHECK_FUNCS([readpassphrase reallocarray recallocarray]) AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strsep strtonum]) AC_CHECK_FUNCS([timegm _mkgmtime]) +AC_CACHE_CHECK([for getpagesize], ac_cv_func_getpagesize, [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +// Since Android NDK v16 getpagesize is defined as inline inside unistd.h +#ifdef __ANDROID__ +# include +#endif + ]], [[ + getpagesize(); +]])], + [ ac_cv_func_getpagesize="yes" ], + [ ac_cv_func_getpagesize="no" + ]) +]) AM_CONDITIONAL([HAVE_ASPRINTF], [test "x$ac_cv_func_asprintf" = xyes]) AM_CONDITIONAL([HAVE_FREEZERO], [test "x$ac_cv_func_freezero" = xyes]) AM_CONDITIONAL([HAVE_GETPAGESIZE], [test "x$ac_cv_func_getpagesize" = xyes])