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