 +		os_is_macosx=false
 +		nonLinuxOS=false
 +		;;
-+esac
++esac		
 +AM_CONDITIONAL([IS_DARWIN], [test x$os_is_macosx = xtrue])
 +AM_COND_IF([IS_DARWIN],
 +	[AC_DEFINE([IS_DARWIN], [1], [Get HostOS Type is Darwin])])

 
 #include <string.h>
diff --git a/src/nlist.c b/src/nlist.c
index 0932f59..a3ba2be 100644
--- a/src/nlist.c
+++ b/src/nlist.c
@@ -27,6 +27,8 @@
  * SUCH DAMAGE.
  */
 
+#if !defined(darwin) && !defined(__APPLE__) && !defined(MACOSX)
+
 #include <sys/cdefs.h>
 
 #include <sys/param.h>
@@ -265,3 +267,5 @@ nlist(const char *name, struct nlist *list)
 	(void)close(fd);
 	return (n);
 }
+
+#endif
diff --git a/src/setproctitle.c b/src/setproctitle.c
index 038ac7d..d0ef01b 100644
--- a/src/setproctitle.c

 #define SHA512_DIGEST_LENGTH		64
 
diff --git a/src/hash/sha512c.c b/src/hash/sha512c.c
index b3c8d5e..f69013d 100644
--- a/src/hash/sha512c.c
+++ b/src/hash/sha512c.c
@@ -25,7 +25,13 @@
  */
 
 #include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#if defined(darwin) || defined(__APPLE__) || defined(MACOSX)
+#include <machine/endian.h>
+#else
