summaryrefslogtreecommitdiff
blob: ed47c54e29c7c8d5c4f12dff2e71abbfc1cda083 (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
Adapted for Gentoo version 2.7.4

From b570e7de87aaad8c903176d835e8124127f627b3 Mon Sep 17 00:00:00 2001
From: Andrew Aladjev <aladjev.andrew@gmail.com>
Date: Sat, 26 Sep 2020 12:58:06 +0300
Subject: [PATCH] fixed default coroutine selection for musl

---
 configure.ac             | 5 ++++-
 coroutine/copy/Context.c | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index ab5d532c103b..084f0936c006 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2364,7 +2364,10 @@
             rb_cv_coroutine=copy
         ],
         [*], [
-            rb_cv_coroutine=ucontext
+            AC_CHECK_FUNCS([getcontext swapcontext makecontext],
+                [rb_cv_coroutine=ucontext],
+                [rb_cv_coroutine=copy; break]
+            )
         ]
     )
     AC_MSG_RESULT(${rb_cv_coroutine})
diff --git a/coroutine/copy/Context.c b/coroutine/copy/Context.c
index c1b4144e9857..94a7f57f7d89 100644
--- a/coroutine/copy/Context.c
+++ b/coroutine/copy/Context.c
@@ -5,6 +5,8 @@
  *  Copyright, 2019, by Samuel Williams.
 */
 
+#include <sys/types.h>
+
 #include "Context.h"
 
 // http://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html