xref: /netbsd-src/external/apache2/llvm/autoconf/autoconf/m4/header_mmap_anonymous.m4 (revision 76c7fc5f6b13ed0b1508e6b313e88e59977ed78e)
1*76c7fc5fSjoerg#
2*76c7fc5fSjoerg# Check for anonymous mmap macros.  This is modified from
3*76c7fc5fSjoerg# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html
4*76c7fc5fSjoerg#
5*76c7fc5fSjoergAC_DEFUN([AC_HEADER_MMAP_ANONYMOUS],
6*76c7fc5fSjoerg[AC_CACHE_CHECK(for MAP_ANONYMOUS vs. MAP_ANON,
7*76c7fc5fSjoergac_cv_header_mmap_anon,
8*76c7fc5fSjoerg[ AC_LANG_PUSH([C])
9*76c7fc5fSjoerg  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
10*76c7fc5fSjoerg    [[#include <sys/mman.h>
11*76c7fc5fSjoerg#include <unistd.h>
12*76c7fc5fSjoerg#include <fcntl.h>]],
13*76c7fc5fSjoerg  [[mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0);]])],
14*76c7fc5fSjoerg  ac_cv_header_mmap_anon=yes,
15*76c7fc5fSjoerg  ac_cv_header_mmap_anon=no)
16*76c7fc5fSjoerg  AC_LANG_POP([C])
17*76c7fc5fSjoerg])
18*76c7fc5fSjoergif test "$ac_cv_header_mmap_anon" = yes; then
19*76c7fc5fSjoerg   AC_DEFINE([HAVE_MMAP_ANONYMOUS],[1],[Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if it uses MAP_ANON])
20*76c7fc5fSjoergfi
21*76c7fc5fSjoerg])
22