summaryrefslogtreecommitdiff
path: root/tests/zerosize-ptr.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2009-05-20 13:26:51 +0200
committerBruno Haible <bruno@clisp.org>2009-05-20 13:26:51 +0200
commit8a8d9a4c3ec9708460aa68e9c65ed1efde4735ec (patch)
tree20e45e0762bd0d0d34fcb7f12bc479ac7b598cc6 /tests/zerosize-ptr.h
parent68e581a8126f13b42cd8015091cc0b6716df44f7 (diff)
downloadgnulib-8a8d9a4c3ec9708460aa68e9c65ed1efde4735ec.tar.gz
Make zeroptr.h work on mingw.
Diffstat (limited to 'tests/zerosize-ptr.h')
-rw-r--r--tests/zerosize-ptr.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/zerosize-ptr.h b/tests/zerosize-ptr.h
index fa00aeeee5..9918ac7210 100644
--- a/tests/zerosize-ptr.h
+++ b/tests/zerosize-ptr.h
@@ -20,7 +20,11 @@
#include <stdlib.h>
-#if HAVE_MPROTECT
+/* Test whether mmap() and mprotect() are available.
+ We don't use HAVE_MMAP, because AC_FUNC_MMAP would not define it on HP-UX.
+ HAVE_MPROTECT is not enough, because mingw does not have mmap() but has an
+ mprotect() function in libgcc.a. */
+#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
# include <fcntl.h>
# include <unistd.h>
# include <sys/types.h>
@@ -39,7 +43,7 @@ zerosize_ptr (void)
{
/* Use mmap and mprotect when they exist. Don't test HAVE_MMAP, because it is
not defined on HP-UX 11 (since it does not support MAP_FIXED). */
-#if HAVE_MPROTECT
+#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
# if HAVE_MAP_ANONYMOUS
const int flags = MAP_ANONYMOUS | MAP_PRIVATE;
const int fd = -1;