--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -213,6 +213,10 @@ endif()
 #    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -stdlib=libc++")
 #endif()
 
+if(HAIKU)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
+endif()
+
 
 if(WIN32 AND NOT MSVC)
     if(EXISTS "C:/MinGW/include")
--- a/Opcodes/control.c
+++ b/Opcodes/control.c
@@ -28,7 +28,7 @@
 #include <sys/types.h>
 #include <signal.h>
 
-#if defined(__MACH__)
+#if defined(__MACH__) || defined(__HAIKU__)
 #include <unistd.h>
 #endif
 
--- a/Opcodes/urandom.c
+++ b/Opcodes/urandom.c
@@ -21,6 +21,8 @@
     02111-1307 USA
 */
 
+#include <fcntl.h>
+
 #include "csdl.h"
 //#include <ieee754.h>
 
--- a/Engine/cs_par_base.c
+++ b/Engine/cs_par_base.c
@@ -66,7 +66,7 @@ extern int barrier_init(barrier_t *b, void *,unsigned int max);
 extern int barrier_destroy(barrier_t *b);
 extern int barrier_wait(barrier_t *b);
 
-#ifndef PTHREAD_BARRIER_SERIAL_THREAD
+#if !defined(PTHREAD_BARRIER_SERIAL_THREAD) || defined(__HAIKU__)
 /*#define pthread_barrier_t barrier_t */
 #define PTHREAD_BARRIER_SERIAL_THREAD BARRIER_SERIAL_THREAD
 #define pthread_barrier_init(barrier, attr, count) \
--- a/Engine/cs_par_base.c
+++ b/Engine/cs_par_base.c
@@ -53,7 +53,7 @@ int csp_thread_index_get(CSOUND *csound)
 
 
 /* **** An implementation of Barriers for MAC that lacks them **** */
-#if defined(__MACH__) || defined(ANDROID) || defined(NACL)
+#if defined(__MACH__) || defined(ANDROID) || defined(NACL) || defined(__HAIKU__)
 /*#define BARRIER_SERIAL_THREAD (-1)
 
 typedef struct {
--- a/include/csoundCore.h
+++ b/include/csoundCore.h
@@ -71,7 +71,7 @@ extern "C" {
 #include <xlocale.h>
 #endif
 
-#if (defined(__MACH__) || defined(ANDROID) || defined(NACL) || defined(__CYGWIN__))
+#if (defined(__MACH__) || defined(ANDROID) || defined(__HAIKU__) || defined(NACL) || defined(__CYGWIN__))
 #define BARRIER_SERIAL_THREAD (-1)
 typedef struct {
   pthread_mutex_t mut;
@@ -79,7 +79,7 @@ typedef struct {
   unsigned int count, max, iteration;
 } barrier_t;
 
-#ifndef PTHREAD_BARRIER_SERIAL_THREAD
+#if !defined(PTHREAD_BARRIER_SERIAL_THREAD) || defined(__HAIKU__)
 #define pthread_barrier_t barrier_t
 #endif /* PTHREAD_BARRIER_SERIAL_THREAD */
 #endif /* __MACH__ */
