From 618ae4a0453576454b52924b74a30dd793d16379 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 4 Feb 2020 12:47:12 +0100
Subject: Fix build on Haiku

We don't have locale_t yet.

Some things should probably be tested by CMake instead of hardcoding ifdefs.

Some tests crash though.

diff --git a/src/nuspell/finder.cxx b/src/nuspell/finder.cxx
index 3cb8c85..ca84697 100644
--- a/src/nuspell/finder.cxx
+++ b/src/nuspell/finder.cxx
@@ -28,7 +28,8 @@
 #include <utility>
 
 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) ||               \
-                         (defined(__APPLE__) && defined(__MACH__)))
+                         (defined(__APPLE__) && defined(__MACH__)) ||          \
+                         defined(__HAIKU__))
 #include <unistd.h>
 #ifdef _POSIX_VERSION
 #include <dirent.h>
diff --git a/src/nuspell/main.cxx b/src/nuspell/main.cxx
index 17084cd..f9fb564 100644
--- a/src/nuspell/main.cxx
+++ b/src/nuspell/main.cxx
@@ -27,7 +27,7 @@
 #include <unicode/ucnv.h>
 
 #if defined(__MINGW32__) || defined(__unix__) || defined(__unix) ||            \
-    (defined(__APPLE__) && defined(__MACH__))
+    (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
 #include <getopt.h>
 #include <unistd.h>
 #endif
diff --git a/src/nuspell/utils.hxx b/src/nuspell/utils.hxx
index a401a7c..7d12bca 100644
--- a/src/nuspell/utils.hxx
+++ b/src/nuspell/utils.hxx
@@ -28,7 +28,8 @@
 #include <vector>
 
 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) ||               \
-                         (defined(__APPLE__) && defined(__MACH__)))
+                         (defined(__APPLE__) && defined(__MACH__)) ||               \
+                         defined(__HAIKU__))
 #include <unistd.h>
 #endif
 
@@ -152,7 +153,7 @@ class Encoding_Converter {
 };
 
 //#if _POSIX_VERSION >= 200809L
-#if defined(_POSIX_VERSION) && !defined(__NetBSD__)
+#if defined(_POSIX_VERSION) && !defined(__NetBSD__) && !defined(__HAIKU__)
 class Setlocale_To_C_In_Scope {
 	locale_t old_loc = nullptr;
 
diff --git a/tests/verify.cxx b/tests/verify.cxx
index db8c8e4..2d361e0 100644
--- a/tests/verify.cxx
+++ b/tests/verify.cxx
@@ -27,7 +27,7 @@
 #include <unicode/ucnv.h>
 
 #if defined(__MINGW32__) || defined(__unix__) || defined(__unix) ||            \
-    (defined(__APPLE__) && defined(__MACH__))
+    (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
 #include <getopt.h>
 #include <unistd.h>
 #endif
-- 
2.30.0

