Index: command.c
--- command.c.orig	2006-08-19 09:10:40 +0200
+++ command.c	2006-08-24 12:14:21 +0200
@@ -72,6 +72,9 @@
 #include "pyextend.h"
 #include "honeyd_overload.h"
 #include "util.h"
+#ifndef HAVE_SETENV
+#include "setenv.h"
+#endif
 
 ssize_t atomicio(ssize_t (*)(), int, void *, size_t);
 
Index: compat/getopt.h
--- compat/getopt.h.orig	2006-08-19 09:10:40 +0200
+++ compat/getopt.h	2006-08-24 12:14:21 +0200
@@ -40,7 +40,11 @@
 #ifndef _GETOPT_H_
 #define _GETOPT_H_
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#else
+#include "cdefs.h"
+#endif
 
 /*
  * GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions
Index: compat/sha1.h
--- compat/sha1.h.orig	2006-08-19 09:10:40 +0200
+++ compat/sha1.h	2006-08-24 12:14:21 +0200
@@ -15,7 +15,11 @@
     unsigned char buffer[64];
 } SHA1_CTX;
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#else
+#include "cdefs.h"
+#endif
 
 __BEGIN_DECLS
 void SHA1Transform(u_int32_t [5], const unsigned char [64])
Index: config.h.in
--- config.h.in.orig	2006-01-17 18:11:44 +0100
+++ config.h.in	2006-08-24 12:14:21 +0200
@@ -222,6 +222,9 @@
 /* Define to 1 if you have the `strtoul' function. */
 #undef HAVE_STRTOUL
 
+/* Define to 1 if you have the `setenv' function. */
+#undef HAVE_SETENV
+
 /* Define if your system defines struct sockaddr_storage */
 #undef HAVE_STRUCT_SOCKADDR_STORAGE
 
@@ -255,6 +258,9 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the <sys/cdefs.h> header file. */
+#undef HAVE_SYS_CDEFS_H
+
 /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
 #undef HAVE_SYS_WAIT_H
 
Index: configure
--- configure.orig	2006-08-19 09:11:11 +0200
+++ configure	2006-08-24 12:14:21 +0200
@@ -22317,7 +22317,7 @@
 
 
 
-for ac_header in stdarg.h errno.h fcntl.h paths.h stdlib.h string.h time.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/ioccom.h sys/file.h syslog.h unistd.h assert.h
+for ac_header in stdarg.h errno.h fcntl.h paths.h stdlib.h string.h time.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/ioccom.h sys/file.h syslog.h unistd.h assert.h sys/cdefs.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -23483,7 +23483,7 @@
 
 
 
-for ac_func in asprintf dup2 fgetln gettimeofday memmove memset strcasecmp strchr strdup strncasecmp strtoul strspn getaddrinfo getnameinfo freeaddrinfo setgroups sendmsg recvmsg setregid setruid kqueue
+for ac_func in asprintf dup2 fgetln gettimeofday memmove memset strcasecmp strchr strdup strncasecmp strtoul strspn getaddrinfo getnameinfo freeaddrinfo setgroups sendmsg recvmsg setregid setruid setenv kqueue
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_func" >&5
Index: dhcpclient.c
--- dhcpclient.c.orig	2006-08-19 09:10:41 +0200
+++ dhcpclient.c	2006-08-24 12:14:21 +0200
@@ -94,6 +94,13 @@
 
 #define NTRIES 10
 
+#ifndef MIN
+# define MIN(a,b)	(((a) < (b)) ? (a) : (b))
+#endif /* MIN */
+#ifndef MAX
+# define MAX(a,b)	(((a) > (b)) ? (a) : (b))
+#endif /* MAX */
+
 static int  _pack_request(struct dhcpclient_req *, void *, size_t *);
 static int  _pack_release(struct dhcpclient_req *, void *, size_t *);
 static int  _bcast(struct template *,
Index: honeyd.c
--- honeyd.c.orig	2006-08-19 09:14:36 +0200
+++ honeyd.c	2006-08-24 12:14:21 +0200
@@ -101,6 +101,9 @@
 #include "histogram.h"
 #include "update.h"
 #include "util.h"
+#ifndef HAVE_SETENV
+#include "setenv.h"
+#endif
 
 #ifdef HAVE_PYTHON
 #include <Python.h>
Index: honeyd_overload.c
--- honeyd_overload.c.orig	2006-08-19 09:10:41 +0200
+++ honeyd_overload.c	2006-08-24 12:14:21 +0200
@@ -295,7 +295,7 @@
 	struct fd *nfd;
 	int pair[2];
 
-	if (socketpair(AF_LOCAL, type, 0, pair) == -1) {
+	if (socketpair(AF_UNIX, type, 0, pair) == -1) {
 		warn("%s: socketpair", __func__);
 		return (NULL);
 	}
@@ -625,7 +625,7 @@
 	}
 
 	/* Get another socketpair */
-	if (socketpair(AF_LOCAL, SOCK_STREAM, 0, pair) == -1) {
+	if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) {
 		DPRINTF((stderr, "%s: socketpair failed", __func__));
 		errno = ETIMEDOUT; /* XXX */
 		return (-1);
@@ -732,6 +732,7 @@
 }
 #endif /* !__FreeBSD__ */
 
+#ifndef sun
 ssize_t
 recvfrom(int sock, void *buf, size_t len, int flags, struct sockaddr *from,
     socklen_t *fromlen)
@@ -759,6 +760,7 @@
  out:
 	return (ret);
 }
+#endif /* !sun */
 
 ssize_t
 sendto(int sock, const void *buf, size_t len, int flags,
@@ -795,6 +797,7 @@
 	return (ret);
 }
 
+#ifndef sun
 int
 getsockname(int sock, struct sockaddr *to, socklen_t *tolen)
 {
@@ -832,6 +835,7 @@
 
 	return (0);
 }
+#endif /* !sun */
 
 ssize_t
 recvmsg(int sock, struct msghdr *msg, int flags)
@@ -1120,6 +1124,7 @@
 	return (ret);
 }
 
+#ifndef sun
 int
 accept(int sock, struct sockaddr *addr, socklen_t *addrlen)
 {
@@ -1169,6 +1174,7 @@
 
 	return (fd);
 }
+#endif /* !sun */
 
 #if 0
 
Index: personality.c
--- personality.c.orig	2006-08-19 09:10:40 +0200
+++ personality.c	2006-08-24 12:14:21 +0200
@@ -32,6 +32,9 @@
 
 #include <sys/param.h>
 #include <sys/types.h>
+#ifndef UINT_MAX
+#define UINT_MAX    4294967295U
+#endif
 
 #include "config.h"
 
Index: pf_osfp.c
--- pf_osfp.c.orig	2006-08-19 09:10:40 +0200
+++ pf_osfp.c	2006-08-24 12:14:21 +0200
@@ -50,6 +50,10 @@
 #  define DPFPRINTF(format, x...)	((void)0)
 # endif /* PFDEBUG */
 
+#ifndef MAX
+# define MAX(a,b)  (((a) > (b)) ? (a) : (b))
+#endif
+
 SLIST_HEAD(pf_osfp_list, pf_os_fingerprint) pf_osfp_list;
 pool_t pf_osfp_entry_pl;
 pool_t pf_osfp_pl;
