summaryrefslogtreecommitdiffstats
path: root/gl/m4/mmap-anon.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/mmap-anon.m4')
-rw-r--r--gl/m4/mmap-anon.m421
1 files changed, 8 insertions, 13 deletions
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4
index 3f7a6656..b5e323d4 100644
--- a/gl/m4/mmap-anon.m4
+++ b/gl/m4/mmap-anon.m4
@@ -1,6 +1,6 @@
1# mmap-anon.m4 1# mmap-anon.m4
2# serial 12 2# serial 15
3dnl Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
@@ -8,12 +8,10 @@ dnl This file is offered as-is, without any warranty.
8 8
9# Detect how mmap can be used to create anonymous (not file-backed) memory 9# Detect how mmap can be used to create anonymous (not file-backed) memory
10# mappings. 10# mappings.
11# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS 11# - On Linux, AIX, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS and
12# and MAP_ANON exist and have the same value. 12# MAP_ANON exist and have the same value.
13# - On HP-UX, only MAP_ANONYMOUS exists. 13# - On HP-UX, only MAP_ANONYMOUS exists.
14# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, only MAP_ANON exists. 14# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, only MAP_ANON exists.
15# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be
16# used.
17 15
18AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON], 16AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON],
19[ 17[
@@ -23,11 +21,13 @@ AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON],
23 # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it 21 # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it
24 # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is 22 # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is
25 # irrelevant for anonymous mappings. 23 # irrelevant for anonymous mappings.
26 AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no]) 24 # Instead, assume that mmap() exists if and only if <sys/mman.h> exists.
25 # Code needs to tests HAVE_SYS_MMAN_H, not HAVE_MMAP.
26 AC_CHECK_HEADERS_ONCE([sys/mman.h])
27 27
28 # Try to allow MAP_ANONYMOUS. 28 # Try to allow MAP_ANONYMOUS.
29 gl_have_mmap_anonymous=no 29 gl_have_mmap_anonymous=no
30 if test $gl_have_mmap = yes; then 30 if test $ac_cv_header_sys_mman_h = yes; then
31 AC_MSG_CHECKING([for MAP_ANONYMOUS]) 31 AC_MSG_CHECKING([for MAP_ANONYMOUS])
32 AC_EGREP_CPP([I cannot identify this map], [ 32 AC_EGREP_CPP([I cannot identify this map], [
33#include <sys/mman.h> 33#include <sys/mman.h>
@@ -48,10 +48,5 @@ AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON],
48 gl_have_mmap_anonymous=yes]) 48 gl_have_mmap_anonymous=yes])
49 fi 49 fi
50 AC_MSG_RESULT([$gl_have_mmap_anonymous]) 50 AC_MSG_RESULT([$gl_have_mmap_anonymous])
51 if test $gl_have_mmap_anonymous = yes; then
52 AC_DEFINE([HAVE_MAP_ANONYMOUS], [1],
53 [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including
54 config.h and <sys/mman.h>.])
55 fi
56 fi 51 fi
57]) 52])