Debian Codegraph @

m4/getpagesize.m4

raw
1 # getpagesize.m4
2 # serial 11
3 dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2025 Free Software Foundation,
4 dnl Inc.
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.
8 dnl This file is offered as-is, without any warranty.
9
10 AC_DEFUN([gl_FUNC_GETPAGESIZE],
11 [
12 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
13 AC_REQUIRE([AC_CANONICAL_HOST])
14 gl_CHECK_FUNC_GETPAGESIZE
15 if test $gl_cv_func_getpagesize = no; then
16 HAVE_GETPAGESIZE=0
17 AC_CHECK_HEADERS([OS.h])
18 if test $ac_cv_header_OS_h = yes; then
19 HAVE_OS_H=1
20 fi
21 AC_CHECK_HEADERS([sys/param.h])
22 if test $ac_cv_header_sys_param_h = yes; then
23 HAVE_SYS_PARAM_H=1
24 fi
25 fi
26 case "$host_os" in
27 mingw* | windows*)
28 REPLACE_GETPAGESIZE=1
29 ;;
30 esac
31 dnl Also check whether it's declared.
32 dnl mingw has getpagesize() in libgcc.a but doesn't declare it.
33 AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0])
34 ])
35
36 dnl Tests whether the function getpagesize() exists.
37 dnl Sets gl_cv_func_getpagesize.
38 AC_DEFUN([gl_CHECK_FUNC_GETPAGESIZE],
39 [
40 dnl We can't use AC_CHECK_FUNC here, because getpagesize() is defined as a
41 dnl static inline function when compiling for Android 4.4 or older.
42 AC_CACHE_CHECK([for getpagesize], [gl_cv_func_getpagesize],
43 [AC_LINK_IFELSE(
44 [AC_LANG_PROGRAM(
45 [[#include <unistd.h>]],
46 [[return getpagesize();]])
47 ],
48 [gl_cv_func_getpagesize=yes],
49 [gl_cv_func_getpagesize=no])
50 ])
51 ])