Index: config.h.in
--- config.h.in.orig	2005-07-11 11:37:36 +0200
+++ config.h.in	2005-10-03 13:00:37 +0200
@@ -183,6 +183,7 @@
 #define TARGET_LINUX  0
 #define TARGET_BSD    1
 #define TARGET_CYGWIN 2
+#define TARGET_SOLARIS 3
 
 /* Allow _ in domain names? (This option is obsolete and will be ignored.) */
 #undef UNDERSCORE
Index: configure
--- configure.orig	2005-07-11 11:37:42 +0200
+++ configure	2005-10-03 13:04:46 +0200
@@ -1149,6 +1149,14 @@
 	"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
 	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
       ;;
+    SunOS)
+      echo "$ac_t"""${uname_sys}"" 1>&6
+      cat >> confdefs.h <<\EOF
+#define TARGET TARGET_SOLARIS
+EOF
+
+      target="BSD"
+      ;;
     *)
       sed -n \
 	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
@@ -5829,6 +5837,9 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
 int
 main ()
 {
@@ -7232,7 +7243,7 @@
 
 
 
-for ac_func in nanosleep gettimeofday mkfifo select socket strerror uname snprintf vsnprintf
+for ac_func in gettimeofday mkfifo select socket strerror uname snprintf vsnprintf
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_func" >&5
Index: src/conff.h
--- src/conff.h.orig	2005-06-27 21:57:22 +0200
+++ src/conff.h	2005-10-03 13:00:37 +0200
@@ -33,6 +33,8 @@
 #include <stdio.h>
 #include <pthread.h>
 #include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/socket.h>
 #include <net/if.h>
 #include "ipvers.h"
 #include "list.h"
Index: src/dns.h
--- src/dns.h.orig	2005-07-01 14:33:35 +0200
+++ src/dns.h	2005-10-03 13:00:37 +0200
@@ -27,9 +27,9 @@
 
 #include <config.h>
 #include <arpa/inet.h>
+#include <sys/types.h>
 #include <sys/socket.h>
 #include <net/if.h>
-#include <sys/types.h>
 #include <inttypes.h>
 #include "rr_types.h"
 #include "list.h"
Index: src/thread.h
--- src/thread.h.orig	2005-07-08 20:16:36 +0200
+++ src/thread.h	2005-10-03 13:00:37 +0200
@@ -111,10 +111,16 @@
 */
 inline static int usleep_r(unsigned long useconds)
 {
+#if TARGET==TARGET_SOLARIS
+  struct timeval tv = { tv_sec: (useconds / 1000000),
+			 tv_usec: (useconds % 1000000) };
+  return select(0, NULL, NULL, NULL, &tv);
+#else
   struct timespec ts = { tv_sec: (useconds / 1000000),
 			 tv_nsec: (useconds % 1000000) * 1000ul };
 
   return nanosleep(&ts, NULL);
+#endif
 }
 
 /* This is a thread-safe sleep().
@@ -123,9 +129,14 @@
 */
 inline static int sleep_r (unsigned int seconds)
 {
+#if TARGET==TARGET_SOLARIS
+  struct timeval tv = { tv_sec: seconds , tv_usec: 0 };
+  return select(0, NULL, NULL, NULL, &tv);
+#else
   struct timespec ts = { tv_sec: seconds, tv_nsec: 0 };
 
   return nanosleep(&ts, NULL);
+#endif
 }
   
 
