Tests for module 'strings'.
[gnulib.git] / lib / getpagesize.h
1 /* Emulate getpagesize on systems that lack it.
2    Copyright (C) 1999, 2000, 2004, 2005 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16
17 #ifndef HAVE_GETPAGESIZE
18
19 #include <unistd.h>
20
21 #if !defined getpagesize && defined _SC_PAGESIZE
22 # if ! (defined __VMS && __VMS_VER < 70000000)
23 #  define getpagesize() sysconf (_SC_PAGESIZE)
24 # endif
25 #endif
26
27 #if !defined getpagesize && defined __VMS
28 # ifdef __ALPHA
29 #  define getpagesize() 8192
30 # else
31 #  define getpagesize() 512
32 # endif
33 #endif
34
35 /* This is for BeOS.  */
36 #if !defined getpagesize && HAVE_OS_H
37 # include <OS.h>
38 # if defined B_PAGE_SIZE
39 #  define getpagesize() B_PAGE_SIZE
40 # endif
41 #endif
42
43 /* This is for AmigaOS4.0.  */
44 #if !defined getpagesize && defined __amigaos4__
45 # define getpagesize() 2048
46 #endif
47
48 #if !defined getpagesize && HAVE_SYS_PARAM_H
49 # include <sys/param.h>
50 # ifdef EXEC_PAGESIZE
51 #  define getpagesize() EXEC_PAGESIZE
52 # else
53 #  ifdef NBPG
54 #   ifndef CLSIZE
55 #    define CLSIZE 1
56 #   endif
57 #   define getpagesize() (NBPG * CLSIZE)
58 #  else
59 #   ifdef NBPC
60 #    define getpagesize() NBPC
61 #   endif
62 #  endif
63 # endif
64 #endif
65
66 #endif /* not HAVE_GETPAGESIZE */