From 4718cb2a5bf8ab1936f738118d7235af5bd07073 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sun, 7 Jun 2015 22:05:26 +0000
Subject: Haiku patch


diff --git a/src/libutil/sysutil.cpp b/src/libutil/sysutil.cpp
index de7b9ac..dc6e1be 100644
--- a/src/libutil/sysutil.cpp
+++ b/src/libutil/sysutil.cpp
@@ -70,6 +70,12 @@
 # include <sys/ioctl.h>
 #endif
 
+#if defined (__HAIKU__)
+# include <sys/types.h>
+# include <sys/resource.h>
+# include <unistd.h>
+#endif
+
 #include "OpenImageIO/dassert.h"
 #include "OpenImageIO/sysutil.h"
 
@@ -244,7 +250,7 @@ Sysutil::this_program_path ()
     size_t cb = sizeof(filename);
     int r=1;
     sysctl(mib, 4, filename, &cb, NULL, 0);
-#elif defined(__GNU__) || defined(__OpenBSD__)
+#elif defined(__GNU__) || defined(__OpenBSD__) || defined(__HAIKU__)
     int r = 0;
 #else
     // No idea what platform this is
diff --git a/src/make/detectplatform.mk b/src/make/detectplatform.mk
index bc29f4b..8d439ae 100644
--- a/src/make/detectplatform.mk
+++ b/src/make/detectplatform.mk
@@ -46,6 +46,14 @@ ifeq (${platform},unknown)
     endif
   endif
 
+  # Haiku
+  ifeq (${uname},haiku)
+    platform := haiku
+    ifeq (${hw},x86_64)
+      platform := haiku64
+    endif
+  endif
+
   # Windows
   ifeq (${uname},cygwin)
     platform := windows
-- 
1.8.3.4

