From 9221c7a6778a0d6e91180f925998d8511e740d6d Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Wed, 25 Jun 2014 21:57:57 -0600
Subject: Haiku fixes


diff --git a/configure.ac b/configure.ac
index c4a1aba..b7bbad2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,7 +57,7 @@ LTDL_INIT([recursive])
 dnl Checks for libraries.
 
 dnl Checks for header files.
-AC_CHECK_HEADERS(limits.h string.h unistd.h stdarg.h sys/time.h fcntl.h)
+AC_CHECK_HEADERS(limits.h string.h unistd.h stdarg.h stdint.h sys/time.h fcntl.h)
 AC_CHECK_HEADERS(sys/resource.h)
 AC_HEADER_DIRENT
 if test ${ac_header_dirent} = no; then
diff --git a/libdb/db.h b/libdb/db.h
index 67ab8f3..c648202 100644
--- a/libdb/db.h
+++ b/libdb/db.h
@@ -42,6 +42,9 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
 
 #include "compat.h"
 
diff --git a/libutil/conf.h b/libutil/conf.h
index 4a3a625..bfd7c73 100644
--- a/libutil/conf.h
+++ b/libutil/conf.h
@@ -29,7 +29,11 @@
  */
 #define GTAGSCONF       "/etc/gtags.conf"
 #define DEBIANCONF      "/etc/gtags/gtags.conf"
+#ifdef __HAIKU__
+#define GTAGSRC    "globalrc"
+#else
 #define GTAGSRC 	".globalrc"
+#endif
 #ifdef __DJGPP__
 #define DOS_GTAGSRC	"_globalrc"
 #endif
diff --git a/libutil/env.c b/libutil/env.c
index d277578..1dfe23e 100644
--- a/libutil/env.c
+++ b/libutil/env.c
@@ -32,6 +32,11 @@
 #include <home_etc.h>
 #endif
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
 #include "conf.h"
 #include "die.h"
 #include "env.h"
@@ -74,6 +79,11 @@ get_home_directory(void)
 {
 #ifdef HAVE_HOME_ETC_H
 	return _HEdir;
+#elif defined(__HAIKU__)
+	char buffer[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH];
+	if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, buffer, sizeof(buffer)) != B_OK)
+		return NULL;
+	return strdup(buffer);
 #else
 	return getenv("HOME");
 #endif
diff --git a/m4/check_curses.m4 b/m4/check_curses.m4
index 14aaec5..a370ec6 100644
--- a/m4/check_curses.m4
+++ b/m4/check_curses.m4
@@ -240,6 +240,9 @@ AC_DEFUN([AC_SEARCH_NCURSES], [
 
     AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
 
+    AC_NCURSES(/boot/system/develop/headers, ncurses.h, -lncurses, -I/boot/system/develop/headers/, "ncurses in /boot/system")
+    AC_NCURSES(/boot/home/config/develop/headers, ncurses.h, -lncurses, -I/boot/home/config/develop/headers, "ncurses in /boot/home/config")
+
     dnl
     dnl We couldn't find ncurses, try SysV curses
     dnl
-- 
1.8.3.4

