diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-08 01:11:46 (GMT) |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-13 01:26:35 (GMT) |
commit | 74da141e618ef99959d509cb2e7be35a348a39db (patch) | |
tree | 88ebc38b381a1021fc2d74864a71e230ae591c3d /gl/m4/mmap-anon.m4 | |
parent | c63a4f726a0b6ad8cf6040f947754a81fd4683bb (diff) | |
download | monitoring-plugins-74da141e618ef99959d509cb2e7be35a348a39db.tar.gz |
Sync with the latest Gnulib code (177f525)
Signed-off-by: Thomas Guyot-Sionnest <dermoth@aei.ca>
Diffstat (limited to 'gl/m4/mmap-anon.m4')
-rw-r--r-- | gl/m4/mmap-anon.m4 | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4 new file mode 100644 index 0000000..a6b7b9a --- /dev/null +++ b/gl/m4/mmap-anon.m4 | |||
@@ -0,0 +1,59 @@ | |||
1 | # mmap-anon.m4 serial 8 | ||
2 | dnl Copyright (C) 2005, 2007, 2009-2010 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | ||
4 | dnl gives unlimited permission to copy and/or distribute it, | ||
5 | dnl with or without modifications, as long as this notice is preserved. | ||
6 | |||
7 | # Detect how mmap can be used to create anonymous (not file-backed) memory | ||
8 | # mappings. | ||
9 | # - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS | ||
10 | # and MAP_ANON exist and have the same value. | ||
11 | # - On HP-UX, only MAP_ANONYMOUS exists. | ||
12 | # - On MacOS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists. | ||
13 | # - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be | ||
14 | # used. | ||
15 | |||
16 | AC_DEFUN([gl_FUNC_MMAP_ANON], | ||
17 | [ | ||
18 | dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. | ||
19 | AC_REQUIRE([AC_PROG_CPP]) | ||
20 | AC_REQUIRE([AC_PROG_EGREP]) | ||
21 | |||
22 | dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS. | ||
23 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
24 | |||
25 | # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it | ||
26 | # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is | ||
27 | # irrelevant for anonymous mappings. | ||
28 | AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no]) | ||
29 | |||
30 | # Try to allow MAP_ANONYMOUS. | ||
31 | gl_have_mmap_anonymous=no | ||
32 | if test $gl_have_mmap = yes; then | ||
33 | AC_MSG_CHECKING([for MAP_ANONYMOUS]) | ||
34 | AC_EGREP_CPP([I cant identify this map.], [ | ||
35 | #include <sys/mman.h> | ||
36 | #ifdef MAP_ANONYMOUS | ||
37 | I cant identify this map. | ||
38 | #endif | ||
39 | ], | ||
40 | [gl_have_mmap_anonymous=yes]) | ||
41 | if test $gl_have_mmap_anonymous != yes; then | ||
42 | AC_EGREP_CPP([I cant identify this map.], [ | ||
43 | #include <sys/mman.h> | ||
44 | #ifdef MAP_ANON | ||
45 | I cant identify this map. | ||
46 | #endif | ||
47 | ], | ||
48 | [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON], | ||
49 | [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.]) | ||
50 | gl_have_mmap_anonymous=yes]) | ||
51 | fi | ||
52 | AC_MSG_RESULT([$gl_have_mmap_anonymous]) | ||
53 | if test $gl_have_mmap_anonymous = yes; then | ||
54 | AC_DEFINE([HAVE_MAP_ANONYMOUS], [1], | ||
55 | [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including | ||
56 | config.h and <sys/mman.h>.]) | ||
57 | fi | ||
58 | fi | ||
59 | ]) | ||