1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-15 16:20:17 +02:00

Add GUILE_ENABLE_JIT macro

* acinclude.m4 (GUILE_ENABLE_JIT): New macro.
* libguile/lightning/configure.ac: Remove now-unused file.
This commit is contained in:
Andy Wingo 2018-07-02 10:34:18 +02:00
parent f8b8f5f5c8
commit 0593a9aed7
2 changed files with 57 additions and 28 deletions

View file

@ -1,7 +1,7 @@
dnl -*- Autoconf -*- dnl -*- Autoconf -*-
dnl Copyright (C) 1997, 1999, 2000, 2001, 2002, 2004, 2006, dnl Copyright (C) 1997,1999-2002,2004,2006-2011,2013,2018
dnl 2007, 2008, 2009, 2010, 2011, 2013 Free Software Foundation, Inc. dnl Free Software Foundation, Inc.
dnl dnl
dnl This file is part of GUILE dnl This file is part of GUILE
dnl dnl
@ -578,3 +578,58 @@ AC_DEFUN([GUILE_CHECK_GUILE_FOR_BUILD], [
dnl Declare file $1 to be a script that needs configuring, dnl Declare file $1 to be a script that needs configuring,
dnl and arrange to make it executable in the process. dnl and arrange to make it executable in the process.
AC_DEFUN([GUILE_CONFIG_SCRIPT],[AC_CONFIG_FILES([$1],[chmod +x $1])]) AC_DEFUN([GUILE_CONFIG_SCRIPT],[AC_CONFIG_FILES([$1],[chmod +x $1])])
AC_DEFUN([GUILE_ENABLE_JIT], [
JIT_AVAILABLE=no
AC_MSG_CHECKING([if JIT code generation supported for target CPU])
case "$target_cpu" in
i?86|x86_64|amd64) JIT_AVAILABLE=yes ;;
*arm*) JIT_AVAILABLE=yes ;;
*mips*) JIT_AVAILABLE=yes ;;
*powerpc*) JIT_AVAILABLE=yes ;;
*sparc*) JIT_AVAILABLE=yes ;;
ia64) JIT_AVAILABLE=yes ;;
hppa*) JIT_AVAILABLE=yes ;;
aarch64) JIT_AVAILABLE=yes ;;
s390*) JIT_AVAILABLE=yes ;;
alpha*) JIT_AVAILABLE=yes ;;
*) ;;
esac
AC_MSG_RESULT($JIT_AVAILABLE)
case "$target_cpu" in
*arm*)
AC_CHECK_LIB(m, sqrtf, , [
JIT_AVAILABLE=no;
AC_MSG_WARN([JIT on ARM unavailable due to missing sqrtf])
])
;;
esac
AC_ARG_ENABLE(jit,
[AS_HELP_STRING([--enable-jit[=yes/no/auto]],
[enable just-in-time code generation [default=auto]])])
enable_jit=auto
AC_MSG_CHECKING([whether to enable JIT code generation])
case "$enable_jit" in
y*) enable_jit=yes ;;
n*) enable_jit=no ;;
a*) enable_jit=$JIT_AVAILABLE ;;
*) AC_MSG_ERROR(bad value $enable_jit for --enable-jit) ;;
esac
AC_MSG_RESULT($enable_jit)
if test $enable_jit = yes; then
if test $JIT_AVAILABLE = no; then
AC_MSG_ERROR(
[JIT explicitly enabled with --enable-jit but not supported on $target_cpu])
fi
AC_CHECK_FUNCS(mremap ffsl isnan isinf,,)
fi
AM_CONDITIONAL([ENABLE_JIT], [test "$enable_jit" = "yes"])
ENABLE_JIT_VAL=$(if test "$enable_jit" = "yes"; then echo 1; else echo 0; fi)
AC_DEFINE_UNQUOTED([ENABLE_JIT], [$ENABLE_JIT_VAL],
[Define to 1 if JIT compilation is enabled, or 0 otherwise.])
])

View file

@ -1,26 +0,0 @@
LIGHTNING_CFLAGS=
AC_CHECK_FUNCS(mremap ffsl isnan isinf,,)
cpu=
case "$target_cpu" in
i?86|x86_64|amd64) cpu=x86 ;;
*arm*) cpu=arm ;;
*mips*) cpu=mips ;;
*powerpc*) cpu=ppc ;;
*sparc*) cpu=sparc ;;
ia64) cpu=ia64 ;;
hppa*) cpu=hppa ;;
aarch64) cpu=aarch64 ;;
s390*) cpu=s390 ;;
alpha*) cpu=alpha ;;
*) ;;
esac
if test $cpu = arm; then
AC_CHECK_LIB(m, sqrtf, ,
[AC_MSG_ERROR([sqrtf required but not available])])
fi
AC_SUBST(cpu)
AC_SUBST([LIGHTNING_CFLAGS])