Merge from upstream, upto version 5.22.
[emacs.git] / src / getpagesize.h
blobf38409da452d7a6bef96e91e5b81e6c99df4e981
1 /* Emulate getpagesize on systems that lack it.
2 Copyright (C) 1986, 1992, 1995, 2001, 2002, 2003, 2004,
3 2005, 2006 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
22 #ifndef HAVE_GETPAGESIZE
24 # ifdef VMS
25 # define getpagesize() 512
26 # endif
28 # ifdef HAVE_UNISTD_H
29 # include <unistd.h>
30 # endif
32 # ifdef _SC_PAGESIZE
33 # define getpagesize() sysconf(_SC_PAGESIZE)
34 # else /* no _SC_PAGESIZE */
35 # ifdef HAVE_SYS_PARAM_H
36 # include <sys/param.h>
37 # ifdef EXEC_PAGESIZE
38 # define getpagesize() EXEC_PAGESIZE
39 # else /* no EXEC_PAGESIZE */
40 # ifdef NBPG
41 # define getpagesize() NBPG * CLSIZE
42 # ifndef CLSIZE
43 # define CLSIZE 1
44 # endif /* no CLSIZE */
45 # else /* no NBPG */
46 # ifdef NBPC
47 # define getpagesize() NBPC
48 # else /* no NBPC */
49 # ifdef PAGESIZE
50 # define getpagesize() PAGESIZE
51 # endif /* PAGESIZE */
52 # endif /* no NBPC */
53 # endif /* no NBPG */
54 # endif /* no EXEC_PAGESIZE */
55 # else /* no HAVE_SYS_PARAM_H */
56 # define getpagesize() 8192 /* punt totally */
57 # endif /* no HAVE_SYS_PARAM_H */
58 # endif /* no _SC_PAGESIZE */
60 #endif /* no HAVE_GETPAGESIZE */
62 /* arch-tag: ff6206e3-97e2-4763-923a-e84bf28eabbc
63 (do not change this comment) */