diff -Naur transmission-1.42-orig/configure.ac transmission-1.42/configure.ac
--- transmission-1.42-orig/configure.ac	2009-03-07 00:31:25.000000000 +0000
+++ transmission-1.42/configure.ac	2009-03-07 00:31:54.000000000 +0000
@@ -43,7 +43,7 @@
 AC_PROG_CC
 AC_PROG_CXX
 if test "x$GCC" = "xyes" ; then
-    CFLAGS="-g -Wall -Wformat-security -W -Wmissing-prototypes -Wdeclaration-after-statement -O3 -funroll-loops"
+    CFLAGS="-g -Wall -Wformat-security -W -Wmissing-prototypes -O3 -funroll-loops"
     CXXFLAGS="-g -Wall -Wformat-security -W -O3 -funroll-loops"
 fi
 
diff -Naur transmission-1.42-orig/libtransmission/platform.c transmission-1.42/libtransmission/platform.c
--- transmission-1.42-orig/libtransmission/platform.c	2009-03-07 00:31:25.000000000 +0000
+++ transmission-1.42/libtransmission/platform.c	2009-03-07 00:33:53.000000000 +0000
@@ -22,6 +22,8 @@
 #else
  #ifdef SYS_DARWIN
   #include <CoreFoundation/CoreFoundation.h>
+ #elif defined(__HAIKU__)
+  #include <FindDirectory.h>  
  #endif
 
  #define _XOPEN_SOURCE 500  /* needed for recursive locks. */
@@ -298,7 +300,7 @@
 
     if( !path )
     {
-#ifdef __BEOS__
+#if defined(__BEOS__) || defined(__HAIKU__)
         char buf[MAX_PATH_LENGTH];
         find_directory( B_USER_SETTINGS_DIRECTORY,
                        dev_for_path( "/boot" ), true,
@@ -348,7 +350,7 @@
 
     if( !path )
     {
-#if defined( __BEOS__ ) || defined( WIN32 )
+#if defined( __BEOS__ ) || defined(__HAIKU__) || defined( WIN32 )
         path = tr_buildPath( getOldConfigDir( ), "Cache", NULL );
 #elif defined( SYS_DARWIN )
         path = tr_buildPath( getHomeDir( ), "Library", "Caches", "Transmission", NULL );
@@ -467,6 +469,9 @@
 #ifdef SYS_DARWIN
             s = tr_buildPath( getHomeDir( ), "Library",
                               "Application Support", "Transmission", NULL );
+#elif defined(__HAIKU__)
+            s = tr_buildPath( getHomeDir( ), "config",
+                              "settings", "Transmission", NULL );
 #elif defined( WIN32 )
             char appdata[MAX_PATH]; /* SHGetFolderPath() requires MAX_PATH */
             SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata );
diff -Naur transmission-1.42-orig/third-party/libevent/test/bench.c transmission-1.42/third-party/libevent/test/bench.c
--- transmission-1.42-orig/third-party/libevent/test/bench.c	2009-03-07 00:31:23.000000000 +0000
+++ transmission-1.42/third-party/libevent/test/bench.c	2009-03-07 00:33:53.000000000 +0000
@@ -44,7 +44,7 @@
 #include <windows.h>
 #else
 #include <sys/socket.h>
-#include <sys/signal.h>
+#include <signal.h>
 #include <sys/resource.h>
 #endif
 #include <fcntl.h>
diff -Naur transmission-1.42-orig/third-party/libevent/test/regress.c transmission-1.42/third-party/libevent/test/regress.c
--- transmission-1.42-orig/third-party/libevent/test/regress.c	2009-03-07 00:31:23.000000000 +0000
+++ transmission-1.42/third-party/libevent/test/regress.c	2009-03-07 00:33:53.000000000 +0000
@@ -43,7 +43,7 @@
 #ifndef WIN32
 #include <sys/socket.h>
 #include <sys/wait.h>
-#include <sys/signal.h>
+#include <signal.h>
 #include <unistd.h>
 #include <netdb.h>
 #endif
diff -Naur transmission-1.42-orig/third-party/libevent/test/regress_dns.c transmission-1.42/third-party/libevent/test/regress_dns.c
--- transmission-1.42-orig/third-party/libevent/test/regress_dns.c	2009-03-07 00:31:23.000000000 +0000
+++ transmission-1.42/third-party/libevent/test/regress_dns.c	2009-03-07 00:33:53.000000000 +0000
@@ -42,7 +42,7 @@
 #include <sys/queue.h>
 #ifndef WIN32
 #include <sys/socket.h>
-#include <sys/signal.h>
+#include <signal.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <unistd.h>
@@ -89,7 +89,7 @@
 
 	switch (type) {
 	case DNS_IPv6_AAAA: {
-#if defined(HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_NTOP)
+#if defined(HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_NTOP) && defined(INET6_ADDRSTRLEN)
 		struct in6_addr *in6_addrs = addresses;
 		char buf[INET6_ADDRSTRLEN+1];
 		int i;
@@ -258,7 +258,7 @@
 		break;
 	}
 	case DNS_IPv6_AAAA: {
-#if defined (HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_NTOP)
+#if defined (HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_NTOP) && defined(INET6_ADDRSTRLEN)
 		struct in6_addr *in6_addrs = addresses;
 		char buf[INET6_ADDRSTRLEN+1];
 		if (memcmp(&in6_addrs[0].s6_addr, "abcdefghijklmnop", 16)
diff -Naur transmission-1.42-orig/third-party/libevent/test/regress_http.c transmission-1.42/third-party/libevent/test/regress_http.c
--- transmission-1.42-orig/third-party/libevent/test/regress_http.c	2009-03-07 00:31:23.000000000 +0000
+++ transmission-1.42/third-party/libevent/test/regress_http.c	2009-03-07 00:33:53.000000000 +0000
@@ -42,7 +42,7 @@
 #include <sys/queue.h>
 #ifndef WIN32
 #include <sys/socket.h>
-#include <sys/signal.h>
+#include <signal.h>
 #include <unistd.h>
 #include <netdb.h>
 #endif
diff -Naur transmission-1.42-orig/third-party/libevent/test/regress_rpc.c transmission-1.42/third-party/libevent/test/regress_rpc.c
--- transmission-1.42-orig/third-party/libevent/test/regress_rpc.c	2009-03-07 00:31:23.000000000 +0000
+++ transmission-1.42/third-party/libevent/test/regress_rpc.c	2009-03-07 00:33:53.000000000 +0000
@@ -42,7 +42,7 @@
 #include <sys/queue.h>
 #ifndef WIN32
 #include <sys/socket.h>
-#include <sys/signal.h>
+#include <signal.h>
 #include <unistd.h>
 #include <netdb.h>
 #endif
diff -Naur transmission-1.42-orig/third-party/libnatpmp/getgateway.c transmission-1.42/third-party/libnatpmp/getgateway.c
--- transmission-1.42-orig/third-party/libnatpmp/getgateway.c	2009-03-07 00:31:23.000000000 +0000
+++ transmission-1.42/third-party/libnatpmp/getgateway.c	2009-03-07 00:33:53.000000000 +0000
@@ -37,6 +37,18 @@
 #undef USE_SYSCTL_NET_ROUTE
 #endif
 
+#ifdef __HAIKU__
+#undef USE_PROC_NET_ROUTE
+#undef USE_SOCKET_ROUTE
+#undef USE_SYSCTL_NET_ROUTE
+/* Note: 2009-jan-10 
+ * 
+ * Haiku uses a BSD-like network stack.
+ * However its network stack is not yet feature complete.
+ * So for now, a workaround is needed */
+#define USE_HAIKU_WORKAROUND
+#endif
+
 #ifdef __APPLE__
 #undef USE_PROC_NET_ROUTE
 #undef USE_SOCKET_ROUTE
@@ -82,6 +94,14 @@
 #define FAILED  (-1)
 #endif
 
+
+#ifdef USE_HAIKU_WORKAROUND
+int getdefaultgateway(in_addr_t * addr) 
+{
+	return FAILED;
+}
+#endif
+
 #ifdef USE_PROC_NET_ROUTE
 int getdefaultgateway(in_addr_t * addr)
 {
diff -Naur transmission-1.42-orig/third-party/miniupnp/upnpreplyparse.h transmission-1.42/third-party/miniupnp/upnpreplyparse.h
--- transmission-1.42-orig/third-party/miniupnp/upnpreplyparse.h	2009-03-07 00:31:24.000000000 +0000
+++ transmission-1.42/third-party/miniupnp/upnpreplyparse.h	2009-03-07 00:34:44.000000000 +0000
@@ -8,7 +8,7 @@
 #ifndef __UPNPREPLYPARSE_H__
 #define __UPNPREPLYPARSE_H__
 
-#if defined(NO_SYS_QUEUE_H) || defined(WIN32)
+#if defined(NO_SYS_QUEUE_H) || defined(WIN32) || defined(__HAIKU__)
 #include "bsdqueue.h"
 #else
 #include <sys/queue.h>
