summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--modules/memchr-tests1
-rw-r--r--modules/memchr2-tests1
-rw-r--r--modules/memcmp-tests1
-rw-r--r--modules/memmem-tests1
-rw-r--r--modules/memrchr-tests1
-rw-r--r--tests/zerosize-ptr.h8
7 files changed, 23 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index fe17d77418..eeab720dba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-05-20 Bruno Haible <bruno@clisp.org>
+
+ Make zeroptr.h work on mingw.
+ * tests/zerosize-ptr.h: Test for the presence of <sys/mman.h> and
+ mprotect.
+ * modules/memchr-tests (configure.ac): Also test for sys/mman.h.
+ * modules/memchr2-tests (configure.ac): Likewise.
+ * modules/memcmp-tests (configure.ac): Likewise.
+ * modules/memmem-tests (configure.ac): Likewise.
+ * modules/memrchr-tests (configure.ac): Likewise.
+ Reported by Simon Josefsson.
+
2009-05-20 Simon Josefsson <simon@josefsson.org>
* tests/test-glob.c: Include string.h for strcmp prototype.
diff --git a/modules/memchr-tests b/modules/memchr-tests
index c99e557d4f..c2c9e2bbd9 100644
--- a/modules/memchr-tests
+++ b/modules/memchr-tests
@@ -9,6 +9,7 @@ getpagesize
configure.ac:
gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
Makefile.am:
diff --git a/modules/memchr2-tests b/modules/memchr2-tests
index 44d220cd37..99c02b1fcc 100644
--- a/modules/memchr2-tests
+++ b/modules/memchr2-tests
@@ -9,6 +9,7 @@ getpagesize
configure.ac:
gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
Makefile.am:
diff --git a/modules/memcmp-tests b/modules/memcmp-tests
index ae1cc387e9..3f536d756c 100644
--- a/modules/memcmp-tests
+++ b/modules/memcmp-tests
@@ -9,6 +9,7 @@ getpagesize
configure.ac:
gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
Makefile.am:
diff --git a/modules/memmem-tests b/modules/memmem-tests
index ff47e515c7..45ef99181e 100644
--- a/modules/memmem-tests
+++ b/modules/memmem-tests
@@ -9,6 +9,7 @@ getpagesize
configure.ac:
gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
AC_CHECK_DECLS_ONCE([alarm])
diff --git a/modules/memrchr-tests b/modules/memrchr-tests
index 4885fb195f..967f92b03b 100644
--- a/modules/memrchr-tests
+++ b/modules/memrchr-tests
@@ -9,6 +9,7 @@ getpagesize
configure.ac:
gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
Makefile.am:
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;