diff -Naur pl-6.2.0/src/configure.in pl-6.2.0-haiku/src/configure.in
--- pl-6.2.0/src/configure.in	2012-08-21 13:12:53.016777216 +0100
+++ pl-6.2.0-haiku/src/configure.in	2012-08-23 17:06:25.987758592 +0100
@@ -728,6 +728,9 @@
 	AC_DEFINE(_THREAD_SAFE, 1,
 		  [Required in FreeBSD for compiling thread-safe code])
 	;;
+    *-haiku*)
+        pthread_ok=true
+        ;;
     *-win32|*-win64)
         pthread_ok=true
 	AC_CHECK_LIB(pthreadGC2, pthread_create)
diff -Naur pl-6.2.0/src/os/pl-files.c pl-6.2.0-haiku/src/os/pl-files.c
--- pl-6.2.0/src/os/pl-files.c	2012-08-21 13:12:53.026214400 +0100
+++ pl-6.2.0-haiku/src/os/pl-files.c	2012-08-23 17:07:04.695992320 +0100
@@ -302,7 +302,7 @@
       return TRUE;
   }
 
-#ifdef __unix__				/* doesn't work on most not Unix's */
+#if defined(__unix__) || defined(__HAIKU__) /* doesn't work on most not Unix's */
   { statstruct buf1;
     statstruct buf2;
     char tmp[MAXPATHLEN];
diff -Naur pl-6.2.0/src/os/pl-os.c pl-6.2.0-haiku/src/os/pl-os.c
--- pl-6.2.0/src/os/pl-os.c	2012-08-21 13:12:53.027000832 +0100
+++ pl-6.2.0-haiku/src/os/pl-os.c	2012-08-23 17:09:14.962330624 +0100
@@ -601,7 +601,7 @@
   }
 
 retry:
-#ifdef __unix__
+#if defined(__unix__) || defined(__HAIKU__)
 { static int MTOK_temp_counter = 0;
   const char *sep = id[0] ? "_" : "";
 
@@ -743,7 +743,7 @@
 }
 #endif /* O_HPFS */
 
-#ifdef __unix__
+#if defined(__unix__) || defined(__HAIKU__)
 char *
 PrologPath(const char *p, char *buf, size_t len)
 { strncpy(buf, p, len);
@@ -2507,7 +2507,7 @@
   return strcpy(buffer, file ? file : buf);
 }
 
-#ifdef __unix__
+#if defined(__unix__) || defined(__HAIKU__)
 static char *
 okToExec(const char *s)
 { statstruct stbuff;
diff -Naur pl-6.2.0/src/pl-term.c pl-6.2.0-haiku/src/pl-term.c
--- pl-6.2.0/src/pl-term.c	2012-08-21 13:12:53.038535168 +0100
+++ pl-6.2.0-haiku/src/pl-term.c	2012-08-23 17:09:57.306708480 +0100
@@ -296,7 +296,7 @@
   term_t r = A1;
   term_t c = A2;
 
-#ifdef __unix__
+#if defined(__unix__) || defined(__HAIKU__)
   int iorval;
 
 #ifdef TIOCGSIZE
