# HG changeset patch # User Bruno Haible # Date 1242818811 -7200 # Node ID 89e9741f299f1bd24a0d0aba50d6921480348f66 # Parent 6ca34e75d78f11c1f084cc441233f6653e06f8c4 Make zeroptr.h work on mingw. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-05-20 Bruno Haible + + Make zeroptr.h work on mingw. + * tests/zerosize-ptr.h: Test for the presence of 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 * tests/test-glob.c: Include string.h for strcmp prototype. diff --git a/modules/memchr-tests b/modules/memchr-tests --- a/modules/memchr-tests +++ b/modules/memchr-tests @@ -9,6 +9,7 @@ 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 --- a/modules/memchr2-tests +++ b/modules/memchr2-tests @@ -9,6 +9,7 @@ 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 --- a/modules/memcmp-tests +++ b/modules/memcmp-tests @@ -9,6 +9,7 @@ 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 --- a/modules/memmem-tests +++ b/modules/memmem-tests @@ -9,6 +9,7 @@ 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 --- a/modules/memrchr-tests +++ b/modules/memrchr-tests @@ -9,6 +9,7 @@ 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 --- a/tests/zerosize-ptr.h +++ b/tests/zerosize-ptr.h @@ -20,7 +20,11 @@ #include -#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 # include # include @@ -39,7 +43,7 @@ { /* 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;