This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Part 4 of a big cleanup action based on the upcoming dist-4.0
[metaconfig.git] / U / modified / d_mmap.U
CommitLineData
959f3c4c
JH
1?RCS: $Id$
2?RCS:
3?RCS: Copyright (c) 1999, Jarkko Hietaniemi
4c42341b 4?RCS:
959f3c4c
JH
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 3.0.
10?RCS:
11?MAKE:d_mmap mmaptype: Inlibc i_sysmman cat cc ccflags
12?MAKE: -pick add $@ %<
13?S:d_mmap:
14?S: This variable conditionally defines HAS_MMAP if mmap() is
15?S: available to map a file into memory.
16?S:.
17?S:mmaptype:
18?S: This symbol contains the type of pointer returned by mmap()
19?S: (and simultaneously the type of the first argument).
20?S: It can be 'void *' or 'caddr_t'.
21?S:.
22?C:HAS_MMAP:
23?C: This symbol, if defined, indicates that the mmap system call is
24?C: available to map a file into memory.
25?C:.
26?C:Mmap_t:
27?C: This symbol holds the return type of the mmap() system call
28?C: (and simultaneously the type of the first argument).
98232925 29?C: Usually set to 'void *' or 'caddr_t'.
959f3c4c
JH
30?C:.
31?H:#$d_mmap HAS_MMAP /**/
32?H:#define Mmap_t $mmaptype /**/
33?H:.
34?LINT:set d_mmap
959f3c4c
JH
35: see if mmap exists
36set mmap d_mmap
37eval $inlibc
38: see what shmat returns
39: default to something harmless
40mmaptype='void *'
41case "$i_sysmman$d_mmap" in
42"$define$define")
43 $cat >mmap.c <<'END'
44#include <sys/mman.h>
45void *mmap();
46END
47 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
48 mmaptype='void *'
49 else
50 mmaptype='caddr_t'
51 fi
52 echo "and it returns ($mmaptype)." >&4
53 ;;
54esac
55
56
57