This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add the files from dist/meta to perl's repo
[metaconfig.git] / dist / U / d_getpagsz.U
CommitLineData
d8875586
MBT
1?RCS: $Id: d_getpagsz.U 1 2006-08-24 12:32:52Z rmanfredi $
2?RCS:
3?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4?RCS:
5?RCS: You may redistribute only under the terms of the Artistic Licence,
6?RCS: as specified in the README file that comes with the distribution.
7?RCS: You may reuse parts of this distribution only within the terms of
8?RCS: that same Artistic Licence; a copy of which may be found at the root
9?RCS: of the source tree for dist 4.0.
10?RCS:
11?RCS: $Log: d_getpagsz.U,v $
12?RCS: Revision 3.0.1.1 1994/10/29 16:13:10 ram
13?RCS: patch36: added ?F: line for metalint file checking
14?RCS:
15?RCS: Revision 3.0 1993/08/18 12:06:14 ram
16?RCS: Baseline for dist 3.0 netwide release.
17?RCS:
18?MAKE:d_getpagsz pagesize: Oldconfig Myread Inlibc cat contains +cc +ccflags \
19 libs rm Findhdr
20?MAKE: -pick add $@ %<
21?S:d_getpagsz:
22?S: This variable conditionally defines HAS_GETPAGESIZE if getpagesize()
23?S: is available to get the system page size.
24?S:.
25?S:pagesize (pagsize):
26?S: This variable holds the size in bytes of a system page.
27?S:.
28?C:HAS_GETPAGESIZE (GETPAGESIZE):
29?C: This symbol, if defined, indicates that the getpagesize system call
30?C: is available to get system page size, which is the granularity of
31?C: many memory management calls.
32?C:.
33?X: Don't name it PAGESIZE, this is sometimes used by <sys/param.h>
34?C:PAGESIZE_VALUE (PAGSIZE):
35?C: This symbol holds the size in bytes of a system page (obtained via
36?C: the getpagesize() system call at configuration time or asked to the
37?C: user if the system call is not available).
38?C:.
39?H:#$d_getpagsz HAS_GETPAGESIZE /**/
40?H:#define PAGESIZE_VALUE $pagesize /* System page size, in bytes */
41?H:.
42?F:!page
43?T:guess
44?LINT:set d_getpagsz
45: see if getpagesize exists
46set getpagesize d_getpagsz
47eval $inlibc
48
49@if pagesize || PAGESIZE_VALUE
50: determine the system page size
51echo " "
52guess=' (OK to guess)'
53case "$pagesize" in
54'')
55 $cat >page.c <<EOP
56extern int getpagesize();
57int main()
58{
59 printf("%d\n", getpagesize());
60}
61EOP
62 echo "Computing the granularity of memory management calls..." >&4
63 dflt='4096'
64 case "$d_getpagsz" in
65 "$define")
66 if $cc $ccflags -o page page.c $libs >/dev/null 2>&1; then
67 dflt=`./page`
68 guess=''
69 else
70 echo "(I can't seem to compile the test program--guessing)"
71 fi
72 ;;
73 *)
74 if $cc $ccflags -o page page.c $libs -lPW >/dev/null 2>&1; then
75 dflt=`./page`
76 guess=''
77 echo "(For your eyes only: I used the getpagesize() from -lPW.)"
78 else
79 if $contains PAGESIZE `./findhdr sys/param.h` >/dev/null 2>&1; then
80 $cat >page.c <<EOP
81#include <sys/param.h>
82int main()
83{
84 printf("%d\n", PAGESIZE);
85}
86EOP
87 if $cc $ccflags -o page page.c $libs >/dev/null 2>&1; then
88 dflt=`./page`
89 guess=''
90 echo "(Using value of PAGESIZE found in <sys/param.h>.)"
91 fi
92 fi
93 fi
94 ;;
95 esac
96 ;;
97*) dflt="$pagesize"; guess='';;
98esac
99rp="What is the system page size, in bytes$guess?"
100. ./myread
101pagesize=$ans
102$rm -f page.c page
103
104@end