diff -urN mediatomb-0.12.1/configure.ac mediatomb-0.12.1-haiku/configure.ac
--- mediatomb-0.12.1/configure.ac	2010-04-07 22:38:51.058982400 +0000
+++ mediatomb-0.12.1-haiku/configure.ac	2011-02-06 23:56:23.000000000 +0000
@@ -45,6 +45,7 @@
 CYGWIN_OS=0
 FREEBSD_OS=0
 OPENBSD_OS=0
+HAIKU_OS=0
 
 LIBS_SAVE="$LIBS"
 
@@ -67,6 +68,11 @@
     *-*-openbsd*)
         OPENBSD_OS=1
         ;;
+    *-*-haiku*)
+        HAIKU_OS=1
+        SEARCH_DIR="/boot/common"
+        LIBS="$LIBS -lnetwork"
+        ;;   
 esac
 
 MT_SET_SEARCHPATH
@@ -721,7 +727,7 @@
                     AC_SUBST(NSL_LIBS)
                 ],
                 [
-                    if test $CYGWIN_OS -eq 0; then
+                    if ((test $CYGWIN_OS -eq 0) && (test $HAIKU_OS -eq 0)); then
                         AC_MSG_ERROR(required library function not found)
                     fi
                 ]
diff -urN mediatomb-0.12.1/src/tools.cc mediatomb-0.12.1-haiku/src/tools.cc
--- mediatomb-0.12.1/src/tools.cc	2010-03-25 14:58:11.015466496 +0000
+++ mediatomb-0.12.1-haiku/src/tools.cc	2011-02-07 01:45:18.225968128 +0000
@@ -46,7 +46,7 @@
 #include <string.h>
 #include "config_manager.h"
 
-#ifndef SOLARIS
+#if !defined SOLARIS && !defined __HAIKU__
     #include <net/if.h>
 #else
     #include <fcntl.h>
diff -urN mediatomb-0.12.1/tombupnp/threadutil/src/ThreadPool.c mediatomb-0.12.1-haiku/tombupnp/threadutil/src/ThreadPool.c
--- mediatomb-0.12.1/tombupnp/threadutil/src/ThreadPool.c	2010-03-25 14:58:13.043515904 +0000
+++ mediatomb-0.12.1-haiku/tombupnp/threadutil/src/ThreadPool.c	2011-02-07 01:07:38.354156544 +0000
@@ -372,7 +372,7 @@
     gettimeofday( &t, NULL );
 #if defined(WIN32)
     srand( ( unsigned int )(t.tv_usec/1000) + (unsigned int)ithread_get_current_thread_id(  ).p );
-#elif defined(__FreeBSD__) || defined (__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#elif defined(__FreeBSD__) || defined (__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
     srand( ( unsigned int )(t.tv_usec/1000) + (unsigned int)ithread_get_current_thread_id(  ) );
 #else
     srand( ( unsigned int )(t.tv_usec/1000) + ithread_get_current_thread_id(  ) );
diff -urN mediatomb-0.12.1/tombupnp/upnp/src/api/upnpapi.c mediatomb-0.12.1-haiku/tombupnp/upnp/src/api/upnpapi.c
--- mediatomb-0.12.1/tombupnp/upnp/src/api/upnpapi.c	2010-03-25 14:58:12.049283072 +0000
+++ mediatomb-0.12.1-haiku/tombupnp/upnp/src/api/upnpapi.c	2011-02-07 01:25:10.416546816 +0000
@@ -66,7 +66,7 @@
  #include <netinet/in.h>
  #include <arpa/inet.h>
 
- #ifndef SOLARIS
+ #if !defined SOLARIS && !defined __HAIKU__
 // #include <linux/if.h>
   #include <net/if.h>
  #else
diff -urN mediatomb-0.12.1/tombupnp/upnp/src/genlib/net/uri/uri.c mediatomb-0.12.1-haiku/tombupnp/upnp/src/genlib/net/uri/uri.c
--- mediatomb-0.12.1/tombupnp/upnp/src/genlib/net/uri/uri.c	2010-03-25 14:58:12.046661632 +0000
+++ mediatomb-0.12.1-haiku/tombupnp/upnp/src/genlib/net/uri/uri.c	2011-02-07 01:39:58.739770368 +0000
@@ -71,7 +71,6 @@
  #include "inet_pton.h"
 #endif
 
-
 /************************************************************************
 *	Function :	is_reserved
 *
@@ -639,7 +638,7 @@
         int errCode = 0;
 
         //call gethostbyname_r (reentrant form of gethostbyname)
-#if defined(WIN32) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__OpenBSD__)
+#if defined(WIN32) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__OpenBSD__) || defined(__HAIKU__)
         h=gethostbyname(temp_host_name);
 #elif defined(SOLARIS)
         h = gethostbyname_r( temp_host_name,
