1 sinclude(../libtool.m4)
2 dnl The lines below arrange for aclocal not to bring libtool.m4
3 dnl AC_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
4 dnl to add a definition of LIBTOOL to Makefile.in.
6 AC_DEFUN([AC_PROG_LIBTOOL],)
7 AC_DEFUN([AM_PROG_LIBTOOL],)
11 # mmap(2) blacklisting. Some platforms provide the mmap library routine
12 # but don't support all of the features we need from it.
13 AC_DEFUN([AC_FUNC_MMAP_BLACKLIST],
15 AC_CHECK_HEADER([sys/mman.h],
16 [libffi_header_sys_mman_h=yes], [libffi_header_sys_mman_h=no])
17 AC_CHECK_FUNC([mmap], [libffi_func_mmap=yes], [libffi_func_mmap=no])
18 if test "$libffi_header_sys_mman_h" != yes \
19 || test "$libffi_func_mmap" != yes; then
20 ac_cv_func_mmap_file=no
21 ac_cv_func_mmap_dev_zero=no
22 ac_cv_func_mmap_anon=no
24 AC_CACHE_CHECK([whether read-only mmap of a plain file works],
26 [# Add a system to this blacklist if
27 # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
28 # memory area containing the same data that you'd get if you applied
29 # read() to the same fd. The only system known to have a problem here
30 # is VMS, where text files have record structure.
33 ac_cv_func_mmap_file=no ;;
35 ac_cv_func_mmap_file=yes;;
37 AC_CACHE_CHECK([whether mmap from /dev/zero works],
38 ac_cv_func_mmap_dev_zero,
39 [# Add a system to this blacklist if it has mmap() but /dev/zero
40 # does not exist, or if mmapping /dev/zero does not give anonymous
41 # zeroed pages with both the following properties:
42 # 1. If you map N consecutive pages in with one call, and then
43 # unmap any subset of those pages, the pages that were not
44 # explicitly unmapped remain accessible.
45 # 2. If you map two adjacent blocks of memory and then unmap them
46 # both at once, they must both go away.
47 # Systems known to be in this category are Windows (all variants),
50 vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
51 ac_cv_func_mmap_dev_zero=no ;;
53 ac_cv_func_mmap_dev_zero=yes;;
56 # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
57 AC_CACHE_CHECK([for MAP_ANON(YMOUS)], ac_cv_decl_map_anon,
59 [#include <sys/types.h>
64 #define MAP_ANONYMOUS MAP_ANON
67 [int n = MAP_ANONYMOUS;],
68 ac_cv_decl_map_anon=yes,
69 ac_cv_decl_map_anon=no)])
71 if test $ac_cv_decl_map_anon = no; then
72 ac_cv_func_mmap_anon=no
74 AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
76 [# Add a system to this blacklist if it has mmap() and MAP_ANON or
77 # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
78 # doesn't give anonymous zeroed pages with the same properties listed
79 # above for use of /dev/zero.
80 # Systems known to be in this category are Windows, VMS, and SCO Unix.
82 vms* | cygwin* | pe | mingw* | sco* | udk* )
83 ac_cv_func_mmap_anon=no ;;
85 ac_cv_func_mmap_anon=yes;;
90 if test $ac_cv_func_mmap_file = yes; then
91 AC_DEFINE(HAVE_MMAP_FILE, 1,
92 [Define if read-only mmap of a plain file works.])
94 if test $ac_cv_func_mmap_dev_zero = yes; then
95 AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
96 [Define if mmap of /dev/zero works.])
98 if test $ac_cv_func_mmap_anon = yes; then
99 AC_DEFINE(HAVE_MMAP_ANON, 1,
100 [Define if mmap with MAP_ANON(YMOUS) works.])
104 sinclude(../config/accross.m4)