Index: /trunk/configure.ac
===================================================================
--- /trunk/configure.ac	(revision 383)
+++ /trunk/configure.ac	(revision 384)
@@ -97,9 +97,23 @@
 	;;
 
+	*freebsd8*|*freebsd9*)
+	AC_DEFINE(HOST_IS_FREEBSD)
+	selectconfig=freebsd
+	case "$host_cpu" in
+		amd64|x86_64)
+		dnmalloc_ok=no
+		AC_MSG_RESULT([no dnmalloc])
+		;;
+		*)
+		AC_MSG_RESULT([none])
+		;;
+	esac
+	;;
+	
 	*freebsd7*)
 	AC_DEFINE(HOST_IS_FREEBSD)
 	selectconfig=freebsd
 	case "$host_cpu" in
-		amd64)
+		amd64|x86_64)
 		sh_use_pie=no
 		dnmalloc_ok=no
@@ -330,4 +344,7 @@
 		AC_HEADER_EGREP([struct acct_v3],   sys/acct.h, AC_DEFINE(HAVE_ACCT_V3, ,
 								[Define if <sys/acct.h> has struct acct_v3.]))
+		AC_HEADER_EGREP([struct acctv2],    sys/acct.h, AC_DEFINE(HAVE_ACCTV2, ,
+								[Define if <sys/acct.h> has struct acctv2.]))
+
  )
 
Index: /trunk/docs/Changelog
===================================================================
--- /trunk/docs/Changelog	(revision 383)
+++ /trunk/docs/Changelog	(revision 384)
@@ -11,8 +11,8 @@
 	  wrong function call (OSX specific code), reported by S. Mirolo
 
-3.0.0a:
+3.0.0a (06-10-2011):
 	* Fix compile-time issues on RHEL5 (reported by Thomas)
 
-3.0.0 (01-10-2011):
+3.0.0 (01-11-2011):
 	* Add support for the inotify API
 	* If --disable-shellexpand is used, also disable setting
Index: /trunk/src/sh_log_parse_pacct.c
===================================================================
--- /trunk/src/sh_log_parse_pacct.c	(revision 383)
+++ /trunk/src/sh_log_parse_pacct.c	(revision 384)
@@ -225,16 +225,18 @@
 }
 
-/* This looks strange, but it's real ANSI C. */
-extern struct acct pacct_rd_never_used;
-#define COMM_LEN ((int) sizeof (pacct_rd_never_used.ac_comm))
-
-sh_string * sh_read_pacct (sh_string * record, struct sh_logfile * logfile)
-{
 #if defined(__linux__) && defined(HAVE_ACCT_V3)
 #  define STRUCT_ACCT struct acct_v3
+#elif defined(__FreeBSD__) && defined(HAVE_ACCTV2)
+#  define STRUCT_ACCT struct acctv2
 #else
 #  define STRUCT_ACCT struct acct
 #endif
 
+/* This looks strange, but it's real ANSI C. */
+extern STRUCT_ACCT pacct_rd_never_used;
+#define COMM_LEN ((int) sizeof (pacct_rd_never_used.ac_comm))
+
+sh_string * sh_read_pacct (sh_string * record, struct sh_logfile * logfile)
+{
   STRUCT_ACCT rec;
 
@@ -249,5 +251,9 @@
       char   out[64+COMM_LEN+1+5+8+8+32+4+19+7]; /* see printf format below */
       
-      expand_flags(rec.ac_flag, fl);
+#if defined(ac_flagx)
+      expand_flags(rec.ac_flagx, fl);
+#else
+      expand_flags(rec.ac_flag,  fl);
+#endif
       
       /* ac_comm may not be null terminated
Index: /trunk/src/sh_port2proc.c
===================================================================
--- /trunk/src/sh_port2proc.c	(revision 383)
+++ /trunk/src/sh_port2proc.c	(revision 384)
@@ -802,4 +802,7 @@
                                 continue;
                 } else if (inp->inp_vflag & INP_IPV6) {
+#ifndef in6p_fport
+#define in6p_fport inp_fport
+#endif
                         if ((inp->in6p_fport == 0 && !opt_l) ||
                             (inp->in6p_fport != 0 && !opt_c))
@@ -822,4 +825,7 @@
 		memset(sock, '\0', sizeof (*sock));
 
+#ifndef in6p_lport
+#define in6p_lport inp_lport
+#endif
                 sock->socket = so->xso_so;
                 sock->proto = proto;
@@ -917,6 +923,6 @@
   int n, hash;
   struct xfile *xf;
-  struct in_addr  * haddr;
-  struct in6_addr * haddr6;
+  struct in_addr  * haddr  = NULL;
+  struct in6_addr * haddr6 = NULL;
   struct sock * s;
   struct in6_addr   anyaddr = IN6ADDR_ANY_INIT; 
Index: /trunk/src/sh_processcheck.c
===================================================================
--- /trunk/src/sh_processcheck.c	(revision 383)
+++ /trunk/src/sh_processcheck.c	(revision 384)
@@ -27,5 +27,8 @@
 #include "config_xor.h"
 
-#define _XOPEN_SOURCE 500
+/* changed from 500 to 600 b/o FreeBSD (see sys/cdefs.h) 
+ * which needs _POSIX_C_SOURCE >= 200112 for lstat()
+ */
+#define _XOPEN_SOURCE 600
 
 #include <stdio.h>
@@ -34,6 +37,6 @@
 #include <string.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <dirent.h>
-#include <sys/stat.h>
 #include <signal.h>
 #include <unistd.h>
