$OpenBSD: patch-configure_in,v 1.1 2003/07/23 06:03:01 jolan Exp $
--- configure.in.orig	Thu Jun 26 11:12:43 2003
+++ configure.in	Tue Jul 15 15:16:36 2003
@@ -593,6 +593,44 @@ AC_TRY_COMPILE([
   AC_MSG_RESULT(no)
 ])
 
+dnl * If mmap() plays nicely with write()
+AC_MSG_CHECKING([whether we need to use MS_INVALIDATE with mmaps])
+AC_TRY_RUN([
+  #include <stdio.h>
+  #include <sys/types.h>
+  #include <sys/stat.h>
+  #include <unistd.h>
+  #include <fcntl.h>
+  #include <sys/mman.h>
+  int main() {
+    /* return 0 if we're signed */
+    int f = open("conftest.mmap", O_RDWR|O_CREAT|O_TRUNC);
+    void *mem;
+    if (f == -1) {
+      perror("open()");
+      return 1;
+    }
+    write(f, "1", 2);
+    mem = mmap(NULL, 2, PROT_READ|PROT_WRITE, MAP_SHARED, f, 0);
+    if (mem == MAP_FAILED) {
+      perror("mmap()");
+      return 1;
+    }
+    strcpy(mem, "2");
+    msync(mem, 2, MS_SYNC);
+    lseek(f, 0, SEEK_SET);
+    write(f, "3", 2);
+  
+    return strcmp(mem, "3") == 0 ? 0 : 1;
+  }
+], [
+  AC_MSG_RESULT(no)
+], [
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(NEED_MS_INVALIDATE,, Define if your mmap() implementation requires use of MS_INVALIDATE to work with write())
+])
+
+
 dnl * Solaris compatible sendfilev()
 AC_CHECK_LIB(sendfile, sendfilev, [
   LIBS="$LIBS -lsendfile"
