--- ./winpr/libwinpr/synch/wait.c.orig
+++ ./winpr/libwinpr/synch/wait.c
@@ -109,12 +109,7 @@
 #if !defined(HAVE_PTHREAD_GNU_EXT)
 #include <pthread.h>
 
-#if defined(__FreeBSD__)
-/*the only way to get it work is to remove the static*/
 int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *timeout)
-#else
-static int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *timeout)
-#endif
 {
 	struct timespec timenow;
 	struct timespec sleepytime;
--- ./winpr/libwinpr/comm/comm_serial_sys.c.orig
+++ ./winpr/libwinpr/comm/comm_serial_sys.c
@@ -42,6 +42,9 @@
 #define TTY_THRESHOLD_UNTHROTTLE 	128
 #define N_TTY_BUF_SIZE			4096
 
+#ifndef CMSPAR
+#define CMSPAR   010000000000
+#endif
 
 #define _BAUD_TABLE_END	0010020	/* __MAX_BAUD + 1 */
 
--- ./winpr/libwinpr/synch/wait.c.orig
+++ ./winpr/libwinpr/synch/wait.c
@@ -24,6 +24,7 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#include <sys/select.h>
 
 #include <winpr/crt.h>
 #include <winpr/synch.h>
--- ./winpr/libwinpr/comm/comm_io.c.orig
+++ ./winpr/libwinpr/comm/comm_io.c
@@ -27,6 +27,7 @@
 #include <errno.h>
 #include <termios.h>
 #include <unistd.h>
+#include <sys/select.h>
 
 #include <winpr/io.h>
 #include <winpr/wlog.h>
