From b66daa576885031c18437e407300128785a1cc8c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Fri, 7 Jan 2022 15:15:24 -0500
Subject: configure: add proper check for fd_set.bits


diff --git a/configure.ac b/configure.ac
index a6008fa..02a7a3a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,6 +58,28 @@ case $host_os in
 	*)		fds_bits_found=false;;
 esac
 
+if test "x$fds_bits_found" = xfalse ; then
+   AC_CHECK_MEMBER(fd_set.bits,
+			   [
+			       fds_bits_found=plain_simple
+			       USE_FDS_BITS="bits"
+			   ],,
+			   [
+                               #ifdef HAVE_SYS_PARAM_H
+                               #include <sys/param.h>
+                               #endif
+                               #ifdef HAVE_SYS_TYPES_H
+                               #include <sys/types.h>
+                               #endif
+                               #ifdef HAVE_SYS_TIME_H
+                               #include <sys/time.h>
+                               #endif
+                               #ifdef HAVE_SYS_SELECT_H
+			       #include <sys/select.h>
+                               #endif
+			   ])
+fi
+
 if test "x$fds_bits_found" = xfalse ; then
    AC_CHECK_MEMBER(fd_set.fds_bits,
 			   [
-- 
2.30.2


From ae10146adf2902f7fbb66381fb518a61f3b80bdf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Sat, 14 Jul 2018 15:26:34 +0200
Subject: Assume Haiku uses POSIX thread safe functions


diff --git a/include/X11/Xos_r.h b/include/X11/Xos_r.h
index f963b64..f8b727b 100644
--- a/include/X11/Xos_r.h
+++ b/include/X11/Xos_r.h
@@ -88,6 +88,10 @@ in this Software without prior written authorization from The Open Group.
 # endif
 #endif /* _XOS_R_H */
 
+#ifdef __HAIKU__
+#define _POSIX_THREAD_SAFE_FUNCTIONS
+#endif
+
 #ifndef WIN32
 
 #ifdef __cplusplus
-- 
2.30.2


From e3cfb189dd01d1541611c533340c46d957febe1f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Sat, 14 Jul 2018 15:29:54 +0200
Subject: Haiku only has POSIX-mandated passwd fields


diff --git a/include/X11/Xos_r.h b/include/X11/Xos_r.h
index f8b727b..970f37d 100644
--- a/include/X11/Xos_r.h
+++ b/include/X11/Xos_r.h
@@ -252,7 +252,7 @@ typedef struct {
  */
 
 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
-    defined(__APPLE__) || defined(__DragonFly__)
+    defined(__APPLE__) || defined(__DragonFly__) || defined(__HAIKU__)
 static __inline__ void _Xpw_copyPasswd(_Xgetpwparams p)
 {
    memcpy(&(p).pws, (p).pwp, sizeof(struct passwd));
-- 
2.30.2

