summarylogtreecommitdiffstats
path: root/0130-configure.ac-default-to-with-nt-threads-with-mingw.patch
blob: a9192b00e44b0601d2d661cd6860a80678f353f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From 0973babb46f37ae7a2c7cf4f6884ea700802d9a9 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sun, 1 Aug 2021 18:33:52 +0200
Subject: [PATCH 130/N] configure.ac: default to --with-nt-threads with mingw

Everything else is untested, so make the default system dependent
---
 configure.ac | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 82bea12..0497199 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2215,24 +2215,31 @@ dnl impact build process. When a new functionality is added, developers
 dnl are responsible to update configure script to avoid thread models
 dnl to be mixed.
 
-AC_MSG_CHECKING([for NT threads])
+AC_MSG_CHECKING([for --with-nt-threads])
 AC_ARG_WITH(nt-threads,
-            AS_HELP_STRING([--with-nt-threads], [build with windows threads]),
+            AS_HELP_STRING([--with-nt-threads], [build with windows threads (default is system-dependent)]),
 [
 	case $withval in
 	no)	with_nt_threads=no;;
 	yes)	with_nt_threads=yes;;
 	*)	with_nt_threads=yes;;
-	esac], [
-	with_nt_threads=no])
+	esac
+], [
+	case $host in
+		*-*-mingw*) with_nt_threads=yes;;
+		*) with_nt_threads=no;;
+	esac
+])
+AC_MSG_RESULT([$with_nt_threads])
+
 if test $with_nt_threads = yes ; then
+AC_MSG_CHECKING([whether linking with nt-threads work])
 AC_LINK_IFELSE([
     AC_LANG_PROGRAM([[]],[[_beginthread(0, 0, 0);]])
   ],
-  [with_nt_threads=yes],
-  [with_nt_threads=no])
+  [AC_MSG_RESULT([yes])],
+  [AC_MSG_ERROR([failed to link with nt-threads])])
 fi
-AC_MSG_RESULT([$with_nt_threads])
 
 if test $with_nt_threads = yes ; then
   dnl temporary default flag to avoid additional pthread checks
-- 
2.32.0