From 3c6dff2a3728889f67afcc5e2e5a667d59aa2b84 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Sun, 19 Apr 2015 13:38:07 +0200
Subject: buildsystem configuration for Haiku


diff --git a/source/acinclude.m4 b/source/acinclude.m4
index 179c1c8..6a25dc4 100644
--- a/source/acinclude.m4
+++ b/source/acinclude.m4
@@ -470,6 +470,9 @@ AC_DEFUN([AC_CHECK_STRICT_COMPILE],
         if test "$GCC" = yes
         then
             case "${host}" in
+			*-*-haiku*)
+                CFLAGS="$CFLAGS -std=c9x"
+                ;;
             *)
                 # Do not use -ansi. It limits us to C90, and it breaks some platforms.
                 # We use -std=c99 to disable the gnu99 defaults and its associated warnings
diff --git a/source/config/mh-haiku b/source/config/mh-haiku
index ccf956e..55a3ed2 100644
--- a/source/config/mh-haiku
+++ b/source/config/mh-haiku
@@ -18,7 +18,7 @@ LIBCPPFLAGS =
 THREADSCPPFLAGS =
 
 #
-CPPFLAGS += -D__STDC_ISO_10646__ -DU_CHARSET_IS_UTF8=1
+CPPFLAGS += -DU_CHARSET_IS_UTF8=1
 
 ## Compiler switch to embed a runtime search path
 LD_RPATH=
-- 
2.2.2


From 12c3d34d0c531dcd3af7ae9c0119001bcdf8261a Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Fri, 3 Oct 2014 11:07:01 +0200
Subject: Don't call tzset and tzname on Haiku

While they exist, they are implemented using ICU, and trying to use them
within ICU results in a deadlock.

diff --git a/source/common/putilimp.h b/source/common/putilimp.h
index d2c1c66..a3e361f 100644
--- a/source/common/putilimp.h
+++ b/source/common/putilimp.h
@@ -105,7 +105,7 @@ typedef size_t uintptr_t;
     /* Use the predefined value. */
 #elif U_PLATFORM_USES_ONLY_WIN32_API
 #   define U_TZSET _tzset
-#elif U_PLATFORM == U_PF_OS400
+#elif U_PLATFORM == U_PF_OS400 || defined(__HAIKU__)
    /* not defined */
 #else
 #   define U_TZSET tzset
@@ -140,7 +140,7 @@ typedef size_t uintptr_t;
     /* Use the predefined value. */
 #elif U_PLATFORM_USES_ONLY_WIN32_API
 #   define U_TZNAME _tzname
-#elif U_PLATFORM == U_PF_OS400
+#elif U_PLATFORM == U_PF_OS400 || defined(__HAIKU__)
    /* not defined */
 #else
 #   define U_TZNAME tzname
diff --git a/source/configure.ac b/source/configure.ac
index b30c8d0..89902b4 100644
--- a/source/configure.ac
+++ b/source/configure.ac
@@ -790,50 +790,26 @@ else
 fi
 AC_SUBST(U_HAVE_POPEN)
 
-AC_CHECK_FUNC(tzset)
+#AC_CHECK_FUNC(tzset)
 U_HAVE_TZSET=0
-if test x$ac_cv_func_tzset = xyes
-then
-    U_TZSET=tzset
-    U_HAVE_TZSET=1
-else
-    AC_CHECK_FUNC(_tzset)
-    if test x$ac_cv_func__tzset = xyes
-    then
-        U_TZSET=_tzset
-        U_HAVE_TZSET=1
-    else
-      CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZSET=0"
-    fi
-fi
+#if test x$ac_cv_func_tzset = xyes
+#then
+#    U_TZSET=tzset
+#    U_HAVE_TZSET=1
+#else
+#    AC_CHECK_FUNC(_tzset)
+#    if test x$ac_cv_func__tzset = xyes
+#    then
+#        U_TZSET=_tzset
+#        U_HAVE_TZSET=1
+#    else
+#      CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZSET=0"
+#    fi
+#fi
 AC_SUBST(U_HAVE_TZSET)
 AC_SUBST(U_TZSET)
 
 U_HAVE_TZNAME=0
-AC_CACHE_CHECK(for tzname,ac_cv_var_tzname,
-[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifndef __USE_POSIX
-#define __USE_POSIX
-#endif
-#include <stdlib.h>
-#include <time.h>
-#ifndef tzname /* For SGI.  */
-extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
-#endif]], [atoi(*tzname);])],[ac_cv_var_tzname=yes],[ac_cv_var_tzname=no])])
-if test $ac_cv_var_tzname = yes; then
-  U_TZNAME=tzname
-  U_HAVE_TZNAME=1
-else
-  AC_CACHE_CHECK(for _tzname,ac_cv_var__tzname,
-  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
-  #include <time.h>
-  extern char *_tzname[];]], [atoi(*_tzname);])],[ac_cv_var__tzname=yes],[ac_cv_var__tzname=no])])
-    if test $ac_cv_var__tzname = yes; then
-      U_TZNAME=_tzname
-      U_HAVE_TZNAME=1
-    else
-     CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZNAME=0"
-    fi
-fi
 AC_SUBST(U_HAVE_TZNAME)
 AC_SUBST(U_TZNAME)
 
-- 
2.2.2


From 85cb05132c7caf7c17c786a816efb31a08a40319 Mon Sep 17 00:00:00 2001
From: Oliver Tappe <zooey@hirschkaefer.de>
Date: Fri, 14 Nov 2014 23:56:19 +0100
Subject: Restore missing parts for proper Haiku port.

* Actually set the platform to U_HAIKU for Haiku target.
* Use gcc to build icudt54l_dat.o for Haiku target.

diff --git a/source/configure.ac b/source/configure.ac
index 89902b4..9f3b893 100644
--- a/source/configure.ac
+++ b/source/configure.ac
@@ -626,7 +626,7 @@ AC_MSG_CHECKING([for genccode assembly])
 # Check to see if genccode can generate simple assembly.
 GENCCODE_ASSEMBLY=
 case "${host}" in
-*-linux*|*-kfreebsd*-gnu*|i*86-*-*bsd*|i*86-pc-gnu)
+*-linux*|*-kfreebsd*-gnu*|i*86-*-*bsd*|i*86-pc-gnu|*-haiku*)
     if test "$GCC" = yes; then
         # We're using gcc, and the simple -a gcc command line works for genccode
         GENCCODE_ASSEMBLY="-a gcc"
@@ -1227,6 +1227,7 @@ case "${host}" in
 	*-*-nto*)	platform=U_QNX ;;
 	*-dec-osf*) 	platform=U_OSF ;;
 	*-*-beos)		platform=U_BEOS ;;
+	*-*-haiku*)		platform=U_HAIKU ;;
 	*-*-irix*)		platform=U_IRIX ;;
 	*-ncr-*)		platform=U_MPRAS ;;
 	*) 		platform=U_UNKNOWN_PLATFORM ;;
-- 
2.2.2


