Rebased on https://patch-diff.githubusercontent.com/raw/ruby/ruby/pull/2995.patch which was originally based on this file. --- a/configure.ac +++ b/configure.ac @@ -2441,7 +2441,10 @@ AS_CASE([$rb_cv_coroutine], [yes|''], [ 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})