From 63efd2c2a2d1c45b8abdfbc0f4d76701dd2929c5 Mon Sep 17 00:00:00 2001
From: none <user@shredder>
Date: Fri, 29 May 2015 08:17:51 +0200
Subject: adjust Makefile for Haiku x86_64 and edit configure.sh script to
 search for pthread in order to enable multithreading in Haiku


diff --git a/Makefile b/Makefile
index 0677ef0..90640ee 100644
--- a/Makefile
+++ b/Makefile
@@ -57,8 +57,7 @@ else
     else
 # Haiku (needs to activate the GCC 4x)
       ifeq ($(OSTYPE),haiku)
-        setarch x86
-        LIBS += -lnetwork -lbe -llocale
+        LIBS += -lnetwork -lbe
       endif
     endif
   endif
@@ -118,7 +117,9 @@ ifneq ($(MULTI_THREAD),)
 #use lpthreadGC2d for debug alternatively
       LDFLAGS += -lpthreadGC2
     else
-      LDFLAGS += -lpthread
+      ifneq ($(OSTYPE),haiku)
+        LDFLAGS += -lpthread
+      endif
     endif
   endif
 endif
diff --git a/configure.sh b/configure.sh
index 918935f..9ddd40d 100644
--- a/configure.sh
+++ b/configure.sh
@@ -4221,13 +4221,12 @@ fi
 
 
 # optional (but highly recommended) multithreading
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_destroy in -lpthread" >&5
-$as_echo_n "checking for pthread_mutex_destroy in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_mutex_destroy+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_mutex_destroy" >&5
+$as_echo_n "checking for library containing pthread_mutex_destroy... " >&6; }
+if ${ac_cv_search_pthread_mutex_destroy+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
diff --git a/simsys.cc b/simsys.cc
index 49a1e26..9764f9e 100644
--- a/simsys.cc
+++ b/simsys.cc
@@ -7,7 +7,9 @@
 #ifdef __HAIKU__
 #include <Message.h>
 #include <LocaleRoster.h>
+#include <SupportDefs.h>
 #define NO_UINT32_TYPES
+#define NO_UINT64_TYPES
 #endif
 
 #include "macros.h"
diff --git a/simtypes.h b/simtypes.h
index b4ab8d2..b6cd4b2 100644
--- a/simtypes.h
+++ b/simtypes.h
@@ -131,7 +131,9 @@ typedef unsigned long       uint32;
 #endif
 #endif
 typedef   signed long long  sint64;
+#ifndef NO_UINT64_TYPES
 typedef unsigned long long  uint64;
+#endif
 #ifdef _MSC_VER
 #	define GCC_PACKED
 #	define GCC_ALIGN(a)
-- 
1.8.3.4

