diff --git a/Makefile.in b/Makefile.in index 0858897d55..11063e78b6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -144,6 +144,7 @@ XRUBY_RUBYHDRDIR = @XRUBY_RUBYHDRDIR@ BOOTSTRAPRUBY = @BOOTSTRAPRUBY@ COROUTINE_H = @X_FIBER_COROUTINE_H@ +COROUTINE_OBJ = $(COROUTINE_H:.h=.@OBJEXT@) #### End of system configuration section. #### diff --git a/common.mk b/common.mk index 245ba05eda..a2d9dcbf71 100644 --- a/common.mk +++ b/common.mk @@ -138,6 +138,7 @@ COMMONOBJS = array.$(OBJEXT) \ vm_backtrace.$(OBJEXT) \ vm_dump.$(OBJEXT) \ vm_trace.$(OBJEXT) \ + $(COROUTINE_OBJ) \ $(DTRACE_OBJ) \ $(BUILTIN_ENCOBJS) \ $(BUILTIN_TRANSOBJS) \ @@ -895,8 +896,9 @@ strstr.$(OBJEXT): {$(VPATH)}strstr.c nt.$(OBJEXT): {$(VPATH)}nt.c ia64.$(OBJEXT): {$(VPATH)}ia64.s $(CC) $(CFLAGS) -c $< -$(COROUTINE_H:.h=).$(OBJEXT): {$(VPATH)}$(COROUTINE_H:.h=).$(ASMEXT) -$(COROUTINE_H:.h=).$(OBJEXT): $(COROUTINE_H:Context.h=.time) +.coroutine_obj $(COROUTINE_OBJ): \ + {$(VPATH)}$(COROUTINE_H:.h=).$(ASMEXT) \ + $(COROUTINE_H:Context.h=.time) $(COROUTINE_H:Context.h=.time): $(Q) $(MAKEDIRS) $(@D) @exit > $@ diff --git a/configure.ac b/configure.ac index f59416a391..c214e96ba7 100644 --- a/configure.ac +++ b/configure.ac @@ -963,6 +963,7 @@ main() AS_IF([test "$target_cpu" = x64], [ ac_cv_func___builtin_setjmp=no ac_cv_func_round=no + rb_cv_fiber_coroutine=no # TODO: Enable this after AppVeyor msys2 build succeeds ]) ac_cv_func_tgamma=no rb_cv_negative_time_t=yes @@ -2326,38 +2327,35 @@ AS_IF([test "${universal_binary-no}" = yes ], [ AC_DEFINE_UNQUOTED(STACK_GROW_DIRECTION, $dir) ]) -AC_MSG_CHECKING(native coroutine implementation for ${target_cpu}-${target_os}) -AS_CASE(["$target_cpu-$target_os"], - [x*64-darwin*], [ - AC_MSG_RESULT(amd64) - COROUTINE_H=coroutine/amd64/Context.h +AC_ARG_ENABLE(fiber-coroutine, + AS_HELP_STRING([--disable-fiber-coroutine], [disable native coroutine implementation for fiber]), + [rb_cv_fiber_coroutine=$enableval]) +AS_CASE(["$rb_cv_fiber_coroutine"], [yes|''], [ + AC_MSG_CHECKING(native coroutine implementation for ${target_cpu}-${target_os}) + AS_CASE(["$target_cpu-$target_os"], + [x*64-darwin*], [ + rb_cv_fiber_coroutine=amd64 + ], + [x*64-linux], [ + rb_cv_fiber_coroutine=amd64 + ], + [*86-linux], [ + rb_cv_fiber_coroutine=x86 + ], + [x64-mingw32], [ + rb_cv_fiber_coroutine=win64 + ], + [*], [ + rb_cv_fiber_coroutine= + ] + ) + AC_MSG_RESULT(${rb_cv_fiber_coroutine:-no}) +]) +AS_IF([test "${rb_cv_fiber_coroutine:-no}" != no], [ + COROUTINE_H=coroutine/$rb_cv_fiber_coroutine/Context.h AC_DEFINE_UNQUOTED(FIBER_USE_COROUTINE, ["$COROUTINE_H"]) - AC_LIBOBJ([coroutine/amd64/Context]) - ], - [x*64-linux], [ - AC_MSG_RESULT(amd64) - COROUTINE_H=coroutine/amd64/Context.h - AC_DEFINE_UNQUOTED(FIBER_USE_COROUTINE, ["$COROUTINE_H"]) - AC_LIBOBJ([coroutine/amd64/Context]) - ], - [*86-linux], [ - AC_MSG_RESULT(x86) - COROUTINE_H=coroutine/x86/Context.h - AC_DEFINE_UNQUOTED(FIBER_USE_COROUTINE, ["$COROUTINE_H"]) - AC_LIBOBJ([coroutine/x86/Context]) - ], - # TODO: Enable this after AppVeyor msys2 build succeeds - # [x64-mingw32], [ - # AC_MSG_RESULT(win64) - # COROUTINE_H=coroutine/win64/Context.h - # AC_DEFINE_UNQUOTED(FIBER_USE_COROUTINE, ["$COROUTINE_H"]) - # AC_LIBOBJ([coroutine/win64/Context]) - # ], - [*], [ - AC_MSG_RESULT(no) - ] -) -AC_SUBST(X_FIBER_COROUTINE_H, [$COROUTINE_H]) + AC_SUBST(X_FIBER_COROUTINE_H, [$COROUTINE_H]) +]) AS_IF([test x"$enable_pthread" = xyes], [ for pthread_lib in thr pthread pthreads c c_r root; do diff --git a/win32/Makefile.sub b/win32/Makefile.sub index fbc7903061..9157ea5bf1 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -293,10 +293,10 @@ DLNOBJ = dln.obj COROUTINE_H = coroutine/Win64/Context.h !elseif "$(ARCH)" == "i386" COROUTINE_H = coroutine/Win32/Context.h +!else +COROUTINE_H = !endif -!if defined(COROUTINE_H) -MISSING = $(MISSING) $(COROUTINE_H:.h=.obj) -!endif +COROUTINE_OBJ = $(COROUTINE_H:.h=.obj) ARFLAGS = -machine:$(MACHINE) -out: LD = $(CC)