+dnl check for JIT compiler
+AC_MSG_CHECKING(whether JIT compiled should be compiled)
+AC_ARG_ENABLE([jit],
+ [AS_HELP_STRING(--disable-jit,disable JIT compiler [[default=yes]])],
+ [case "${enableval}" in
+ no) ENABLE_JIT=no;;
+ *) ENABLE_JIT=yes;;
+ esac],
+ [ENABLE_JIT=yes])
+AC_MSG_RESULT(${ENABLE_JIT})
+AM_CONDITIONAL([ENABLE_JIT], test x"${ENABLE_JIT}" = "xyes")
+
+if test x"${ENABLE_JIT}" = "xyes"; then
+ AC_DEFINE([ENABLE_JIT], 1, [enable JIT compiler])
+fi
+
+
+dnl check for interpreter
+AC_ARG_ENABLE([intrp], [AS_HELP_STRING(--enable-intrp,enable interpreter [[default=no]])])
+
+AC_MSG_CHECKING(whether interpreter should be compiled)
+if test x"$enable_intrp" = "xyes"; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([ENABLE_INTRP], 1, [enable interpreter])
+ AM_CONDITIONAL([ENABLE_INTRP], [true])
+ ENABLE_INTRP=yes
+
+ AC_ASM_SKIP16
+
+ dnl check for libffi
+ AC_ARG_WITH([ffi],
+ [AS_HELP_STRING(--with-ffi,use libffi to call native functions)],
+ [WITH_FFI=yes
+ AC_CHECK_HEADERS([ffi.h],, [AC_MSG_ERROR(cannot find ffi.h)])
+ AC_CHECK_LIB(ffi, ffi_call,, [AC_MSG_ERROR(cannot find libffi)])
+ AC_DEFINE([WITH_FFI], 1, [use libffi])],
+ [WITH_FFI=no])
+
+ dnl check for libffcall
+ AC_ARG_WITH([ffcall],
+ [AS_HELP_STRING(--with-ffcall,use libffcall to call native functions)],
+ [WITH_FFCALL=yes
+ AC_CHECK_HEADERS([avcall.h],, [AC_MSG_ERROR(cannot find avcall.h)])
+ AC_CHECK_LIB(avcall, __builtin_avcall,, [AC_MSG_ERROR(cannot find libavcall (from libffcall))])
+ AC_DEFINE([WITH_FFCALL], 1, [use libffcall])],
+ [WITH_FFCALL=no])
+
+ dnl check for libffi or libffcall
+ if test x"${WITH_FFI}" = "xyes" -a x"${WITH_FFCALL}" = "xyes"; then
+ AC_ERROR(Enable only libffi or libffcall.)
+ fi
+ if test x"${WITH_FFI}" = "xno" -a x"${WITH_FFCALL}" = "xno"; then
+ AC_ERROR(Enable one of libffi or libffcall.)
+ fi