$NetBSD: patch-ab,v 1.7 2007/11/21 07:50:14 martti Exp $

--- configure.ac	(revision 1235)
+++ configure.ac	(working copy)
@@ -49,6 +49,13 @@
 /* realloc does not support NULL as argument */
 #undef NO_NULL_REALLOC
 
+/* lets enable madvise defines in netbsd */
+#if defined(__NetBSD__)
+# if !defined(_NETBSD_SOURCE)
+#  define _NETBSD_SOURCE
+# endif
+#endif
+
  ])
 
 AH_BOTTOM([
@@ -58,6 +65,19 @@
 #include <fcntl.h>
 #endif
 
+#if !defined HAVE_MADVISE && defined HAVE_POSIX_MADVISE
+/* use posix_madvise family */
+# define madvise posix_madvise
+# define MADV_NORMAL POSIX_MADV_NORMAL
+# define MADV_RANDOM POSIX_MADV_RANDOM
+# define MADV_SEQUENTIAL POSIX_MADV_SEQUENTIAL
+# define MADV_WILLNEED POSIX_MADV_WILLNEED
+# define MADV_DONTNEED POSIX_MADV_DONTNEED
+#endif
+#if defined HAVE_MADVISE || defined HAVE_POSIX_MADVISE
+# define USE_MADVISE 1
+#endif
+
 /* define strrchr, strchr and memcpy, memmove in terms of bsd funcs
    make sure you are NOT using bcopy, index or rindex in the code */
       
