From 6b8d3751ad90f51336bf867485d98affe9bdd158 Mon Sep 17 00:00:00 2001
From: fbrosson <fbrosson@localhost>
Date: Sun, 3 Jul 2016 21:49:57 +0000
Subject: Haiku fixes for BZFlag 2.4

* Look for regcomp in libroot instead of libc.
* Haiku also has libmedia, libgame and libbe.

diff --git a/configure.ac b/configure.ac
index 48b45d6..d14c165 100644
--- a/configure.ac
+++ b/configure.ac
@@ -320,7 +320,7 @@ fi
 
 
 dnl detect a usable system regular expression library
-AC_CHECK_LIB(c, regcomp, LIBREGEX="-lc",
+AC_CHECK_LIB(root, regcomp, LIBREGEX="-lroot",
 [AC_CHECK_LIB(regex, regcomp, LIBREGEX="-lregex",
     [AC_CHECK_LIB(compat, regcomp, LIBREGEX="-lcompat", AC_MSG_ERROR([working regex library was not found]))]
 )]
@@ -362,6 +362,7 @@ AC_CHECK_LIB(m, sqrtf)
 # for BeOS - old network stack don't have those libs ( move it in the case switch ?)
 AC_CHECK_LIB([socket], [socket])
 AC_CHECK_LIB([socket], [gethostent], [], AC_CHECK_LIB([bind], [gethostent]))
+AC_CHECK_LIB([network], [gethostent], [], AC_CHECK_LIB([bind], [gethostent]))
 
 # see if pthreads are in libc_r (as on FreeBSD) or libpthread
 AC_CHECK_LIB([c_r], [pthread_create], LIBPTHREAD="-lc_r",
@@ -538,7 +539,7 @@ case $host_os in
     irix*)
 	GLIBS="-lXsgivc -lX11 -laudio $GLIBS"
 	;;
-    beos)
+    beos|haiku*)
 	GLIBS=" -lmedia -lgame $GLIBS"
 	LIBS="-lbe"
 	;;
@@ -552,7 +553,7 @@ esac
 
 # avoid using X11 in BeOS and Mac OS X
 case $host_os in
-    beos*)
+    beos*|haiku*)
 	;;
     darwin*)
 	;;
@@ -906,7 +907,7 @@ BZ_CONFIGURE_STAGE([services], [8 of 9])
 # need to consolidate them to here.
 
 case $host_os in
-    beos*)
+    beos*|haiku*)
 	beos=true
 	;;
     darwin*)
-- 
2.30.2


From f4c981a1a49598f25f0f33af0163f80af985bd5d Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Tue, 9 Jun 2015 15:21:49 +0200
Subject: more Haiku fixes

diff --git a/include/network.h b/include/network.h
index 4ef4c77..c512cc1 100644
--- a/include/network.h
+++ b/include/network.h
@@ -100,7 +100,7 @@ using CNCTType = sockaddr const; // only appears used in bzadmin
 # endif
 
 // BeOS net_server has closesocket(), which _must_ be used in place of close()
-# if defined(__BEOS__) && (IPPROTO_TCP != 6)
+# if defined(__BEOS__) ||defined(__HAIKU__) && (IPPROTO_TCP != 6)
 #  define close(__x) closesocket(__x)
 # endif
 
diff --git a/src/common/TimeKeeper.cxx b/src/common/TimeKeeper.cxx
index e0c30a7..014671e 100644
--- a/src/common/TimeKeeper.cxx
+++ b/src/common/TimeKeeper.cxx
@@ -20,7 +20,7 @@
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
-#ifdef __BEOS__
+#if defined(__BEOS__)||defined(__HAIKU__)
 #  include <OS.h>
 #endif
 #if !defined(_WIN32)
-- 
2.30.2

