Add installation information for the tarball users and from a git checkout.
[libsigsegv.git] / m4 / getpagesize.m4
blob460291eeaa038f1d4732566ae21e1c66798ddd1f
1 # getpagesize.m4
2 # serial 4 (libsigsegv-2.15)
3 dnl Copyright (C) 2002-2024 Bruno Haible <bruno@clisp.org>
4 dnl This file is free software, distributed under the terms of the GNU
5 dnl General Public License as published by the Free Software Foundation;
6 dnl either version 2 of the License, or (at your option) any later version.
7 dnl As a special exception to the GNU General Public License, this file
8 dnl may be distributed as part of a program that contains a configuration
9 dnl script generated by Autoconf, under the same distribution terms as
10 dnl the rest of that program.
12 # How to determine the memory page size.
13 AC_DEFUN([SV_GETPAGESIZE],
15   AC_REQUIRE([AC_PROG_CC])
17   AC_CHECK_HEADERS([unistd.h])
19   dnl 1) getpagesize().
21   AC_CACHE_CHECK([for getpagesize], [sv_cv_func_getpagesize], [
22     AC_LINK_IFELSE([
23       AC_LANG_PROGRAM([[
24 #if HAVE_UNISTD_H
25 #include <sys/types.h>
26 #include <unistd.h>
27 #endif
28 ]],
29         [[int pgsz = getpagesize();]])],
30       [sv_cv_func_getpagesize=yes],
31       [sv_cv_func_getpagesize=no])])
32   if test $sv_cv_func_getpagesize = yes; then
33     AC_DEFINE([HAVE_GETPAGESIZE], [1],
34       [Define if getpagesize() is available as a function or a macro.])
35   fi
37   dnl 2) sysconf(_SC_PAGESIZE).
39   AC_CACHE_CHECK([for sysconf(_SC_PAGESIZE)], [sv_cv_func_sysconf_pagesize], [
40     AC_LINK_IFELSE([
41       AC_LANG_PROGRAM([[
42 #if HAVE_UNISTD_H
43 #include <sys/types.h>
44 #include <unistd.h>
45 #endif
46 ]],
47         [[int pgsz = sysconf (_SC_PAGESIZE);]])],
48       [sv_cv_func_sysconf_pagesize=yes],
49       [sv_cv_func_sysconf_pagesize=no])])
50   if test $sv_cv_func_sysconf_pagesize = yes; then
51     AC_DEFINE([HAVE_SYSCONF_PAGESIZE], [1],
52       [Define if sysconf(_SC_PAGESIZE) is available as a function or a macro.])
53   fi
55   dnl 3) PAGESIZE.
57   AC_CACHE_CHECK([for PAGESIZE in limits.h], [sv_cv_macro_pagesize], [
58     AC_LINK_IFELSE([
59       AC_LANG_PROGRAM([[#include <limits.h>]],
60         [[int pgsz = PAGESIZE;]])],
61       [sv_cv_macro_pagesize=yes],
62       [sv_cv_macro_pagesize=no])])
63   if test $sv_cv_macro_pagesize = yes; then
64     AC_DEFINE([HAVE_PAGESIZE], [1],
65       [Define if PAGESIZE is available as a macro.])
66   fi
68   dnl 4) On BeOS, you need to include <OS.h> and use B_PAGE_SIZE.