*printf* tests: Remove unused includes.
[gnulib.git] / m4 / getpagesize.m4
blob60e5db7a7d373c8d3a16cecefe1995b4bfd39ab9
1 # getpagesize.m4
2 # serial 11
3 dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2024 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.
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
15     HAVE_GETPAGESIZE=0
16     AC_CHECK_HEADERS([OS.h])
17     if test $ac_cv_header_OS_h = yes; then
18       HAVE_OS_H=1
19     fi
20     AC_CHECK_HEADERS([sys/param.h])
21     if test $ac_cv_header_sys_param_h = yes; then
22       HAVE_SYS_PARAM_H=1
23     fi
24   fi
25   case "$host_os" in
26     mingw* | windows*)
27       REPLACE_GETPAGESIZE=1
28       ;;
29   esac
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],
42     [AC_LINK_IFELSE(
43        [AC_LANG_PROGRAM(
44           [[#include <unistd.h>]],
45           [[return getpagesize();]])
46        ],
47        [gl_cv_func_getpagesize=yes],
48        [gl_cv_func_getpagesize=no])
49     ])