From 246b729df87e94e405a8b257f34a22fa2719d30c Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Thu, 28 Jul 2016 14:26:38 +0100
Subject: [PATCH] configure: Force --disable-input-thread for MinGW

I don't think an input thread can ever be useful on Windows.

There is a pthread emulation, so having the thread itself isn't much of
a problem.

However, there is no device to wait on for Windows events, and even if
we were to replace select() with WFMO, Windows wants to send events for
a window to the thread which created that window.

So, disable input thread by default for MinGW

v2:
Also add similar to meson.build
---
 configure.ac        | 5 +++++
 include/meson.build | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/configure.ac b/configure.ac
index 5055d271d5..215dd64fe3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -791,6 +791,11 @@ if test "x$HAVE_RECURSIVE_MUTEX" = "xyes" ; then
 	THREAD_DEFAULT=yes
 fi
 
+case $host_os in
+	mingw*) THREAD_DEFAULT=no  ;;
+	*)
+esac
+
 AC_ARG_ENABLE(input-thread, AS_HELP_STRING([--enable-input-thread],
 	     [Enable input threads]),
 	     [INPUTTHREAD=$enableval], [INPUTTHREAD=$THREAD_DEFAULT])
diff --git a/include/meson.build b/include/meson.build
index 65781b7a01..527025b240 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -60,6 +60,9 @@ else
   if not enable_input_thread and get_option('input_thread') == 'true'
     error('Input thread enabled and PTHREAD_MUTEX_RECURSIVE not found')
   endif
+  if host_machine.system() == 'windows' and get_option('input_thread') == 'auto'
+      enable_input_thread = false
+  endif
 endif
 conf_data.set('HAVE_INPUTTHREAD', enable_input_thread)
 
-- 
GitLab