3 dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2024 Free Software Foundation,
5 dnl This file is free software; the Free Software Foundation
6 dnl gives unlimited permission to copy and/or distribute it,
7 dnl with or without modifications, as long as this notice is preserved.
9 AC_DEFUN([gl_FUNC_GETPAGESIZE],
11 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
12 AC_REQUIRE([AC_CANONICAL_HOST])
13 gl_CHECK_FUNC_GETPAGESIZE
14 if test $gl_cv_func_getpagesize = no; then
16 AC_CHECK_HEADERS([OS.h])
17 if test $ac_cv_header_OS_h = yes; then
20 AC_CHECK_HEADERS([sys/param.h])
21 if test $ac_cv_header_sys_param_h = yes; then
30 dnl Also check whether it's declared.
31 dnl mingw has getpagesize() in libgcc.a but doesn't declare it.
32 AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0])
35 dnl Tests whether the function getpagesize() exists.
36 dnl Sets gl_cv_func_getpagesize.
37 AC_DEFUN([gl_CHECK_FUNC_GETPAGESIZE],
39 dnl We can't use AC_CHECK_FUNC here, because getpagesize() is defined as a
40 dnl static inline function when compiling for Android 4.4 or older.
41 AC_CACHE_CHECK([for getpagesize], [gl_cv_func_getpagesize],
44 [[#include <unistd.h>]],
45 [[return getpagesize();]])
47 [gl_cv_func_getpagesize=yes],
48 [gl_cv_func_getpagesize=no])