1 # getpagesize.m4 serial 2 (libsigsegv-2.2)
2 dnl Copyright (C) 2002-2003 Bruno Haible <bruno@clisp.org>
3 dnl This file is free software, distributed under the terms of the GNU
4 dnl General Public License. As a special exception to the GNU General
5 dnl Public License, this file may be distributed as part of a program
6 dnl that contains a configuration script generated by Autoconf, under
7 dnl the same distribution terms as the rest of that program.
9 # How to determine the memory page size.
10 AC_DEFUN([SV_GETPAGESIZE],
12 AC_REQUIRE([AC_PROG_CC])
14 AC_CHECK_HEADERS(unistd.h)
18 AC_CACHE_CHECK([for getpagesize], sv_cv_func_getpagesize, [
22 #include <sys/types.h>
26 [[int pgsz = getpagesize();]])],
27 [sv_cv_func_getpagesize=yes],
28 [sv_cv_func_getpagesize=no])])
29 if test $sv_cv_func_getpagesize = yes; then
30 AC_DEFINE(HAVE_GETPAGESIZE, 1,
31 [Define if getpagesize() is available as a function or a macro.])
34 dnl 2) sysconf(_SC_PAGESIZE).
36 AC_CACHE_CHECK([for sysconf(_SC_PAGESIZE)], sv_cv_func_sysconf_pagesize, [
40 #include <sys/types.h>
44 [[int pgsz = sysconf (_SC_PAGESIZE);]])],
45 [sv_cv_func_sysconf_pagesize=yes],
46 [sv_cv_func_sysconf_pagesize=no])])
47 if test $sv_cv_func_sysconf_pagesize = yes; then
48 AC_DEFINE(HAVE_SYSCONF_PAGESIZE, 1,
49 [Define if sysconf(_SC_PAGESIZE) is available as a function or a macro.])
54 AC_CACHE_CHECK([for PAGESIZE in limits.h], sv_cv_macro_pagesize, [
56 AC_LANG_PROGRAM([[#include <limits.h>]],
57 [[int pgsz = PAGESIZE;]])],
58 [sv_cv_macro_pagesize=yes],
59 [sv_cv_macro_pagesize=no])])
60 if test $sv_cv_macro_pagesize = yes; then
61 AC_DEFINE(HAVE_PAGESIZE, 1,
62 [Define if PAGESIZE is available as a macro.])
65 dnl 4) On BeOS, you need to include <OS.h> and use B_PAGE_SIZE.