1879N/Adnl Copyright (C) 2005, 2007, 2009-2010 Free Software Foundation, Inc.
0N/Adnl This file is free software; the Free Software Foundation
0N/Adnl gives unlimited permission to copy
and/or distribute it,
0N/Adnl with or without modifications, as long as this notice is preserved.
0N/A# Detect how mmap can be used to create anonymous (not file-backed) memory
0N/A# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS
0N/A# and MAP_ANON exist and have the same value.
0N/A# - On HP-UX, only MAP_ANONYMOUS exists.
0N/A# - On MacOS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists.
0N/A# - On IRIX, neither exists, and a file descriptor opened to
/dev/zero must be
0N/AAC_DEFUN([gl_FUNC_MMAP_ANON],
0N/A dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
1472N/A AC_REQUIRE([AC_PROG_EGREP])
0N/A AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
1879N/A # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it
1879N/A # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is
1879N/A # irrelevant for anonymous mappings.
1879N/A AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no])
1879N/A # Try to allow MAP_ANONYMOUS.
1879N/A if test $gl_have_mmap = yes; then
1879N/A AC_MSG_CHECKING([for MAP_ANONYMOUS])
1879N/A AC_EGREP_CPP([I cant identify this map.], [
0N/A I cant identify this map.
1522N/A [gl_have_mmap_anonymous=yes])
1522N/A if test $gl_have_mmap_anonymous != yes; then
0N/A AC_EGREP_CPP([I cant identify this map.], [
0N/A I cant identify this map.
0N/A [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON],
0N/A [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.])
973N/A gl_have_mmap_anonymous=yes])
973N/A AC_MSG_RESULT([$gl_have_mmap_anonymous])
973N/A if test $gl_have_mmap_anonymous = yes; then
973N/A AC_DEFINE([HAVE_MAP_ANONYMOUS], [1],
973N/A [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including