Index: src/os/unix/ngx_errno.c
===================================================================
--- src/os/unix/ngx_errno.c	(revision 4615)
+++ src/os/unix/ngx_errno.c	(working copy)
@@ -9,6 +9,8 @@
 #include <ngx_core.h>
 
 
+#if (NGX_SYS_NERR)
+
 /*
  * The strerror() messages are copied because:
  *
@@ -85,3 +87,5 @@
 
     return NGX_ERROR;
 }
+
+#endif /* NGX_SYS_NERR */
Index: auto/os/conf
===================================================================
--- auto/os/conf	(revision 4615)
+++ auto/os/conf	(working copy)
@@ -59,6 +59,16 @@
         CORE_SRCS="$UNIX_SRCS"
     ;;
 
+    Haiku:*)
+        # Haiku
+        have=NGX_HAIKU . auto/have_headers
+        CORE_INCS="$UNIX_INCS"
+        CORE_DEPS="$UNIX_DEPS $POSIX_DEPS"
+        CORE_SRCS="$UNIX_SRCS"
+        NGX_PREFIX="${NGX_PREFIX:-`finddir B_COMMON_DIRECTORY`}"
+        NGX_SBIN_PATH="${NGX_SBIN_PATH:-`finddir B_COMMON_BIN_DIRECTORY`/nginx}"
+    ;;
+
     *)
         CORE_INCS="$UNIX_INCS"
         CORE_DEPS="$UNIX_DEPS $POSIX_DEPS"
@@ -70,7 +80,7 @@
 
 case "$NGX_MACHINE" in
 
-    i386 | i686 | i86pc)
+    i386 | i686 | i86pc | BePC)
         have=NGX_HAVE_NONALIGNED . auto/have
         NGX_MACH_CACHE_LINE=32
     ;;
Index: auto/unix
===================================================================
--- auto/unix	(revision 4615)
+++ auto/unix	(working copy)
@@ -555,9 +555,10 @@
 fi
 
 
-if [ $ngx_found = no ]; then
+if [ $ngx_found = no  -a "$NGX_SYSTEM" != "Haiku" ]; then
 
-    # Solaris has no sys_nerr
+    # Solaris has no sys_nerr, so test for the maximum
+    # Haiku neither but has negative error codes, so skip this
     ngx_feature='maximum errno'
     ngx_feature_name=NGX_SYS_NERR
     ngx_feature_run=value
