+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.
configure.ac:
gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
Makefile.am:
configure.ac:
gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
Makefile.am:
configure.ac:
gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
Makefile.am:
configure.ac:
gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
AC_CHECK_DECLS_ONCE([alarm])
configure.ac:
gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
Makefile.am:
#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>
{
/* 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;