Commit 02f319cf authored by Jan Včelák's avatar Jan Včelák 🚀

build: allow fastparser with clang >= 3.9.0

- The bug https://llvm.org/bugs/show_bug.cgi?id=23490 should be fixed then.
- Added --enable-fastparser=force option to override the detection.
parent 8e0cfe7b
......@@ -100,8 +100,6 @@ AM_CONDITIONAL([HAVE_DOCS], [test "$enable_documentation" = "yes"])
AC_PROG_INSTALL
AX_CC_LLVM
AC_ARG_ENABLE([fastparser],
AS_HELP_STRING([--disable-fastparser], [Disable use of fastest zone parser]),[],[
# Set zone parser type - fastest on release build, slowest on dev build
......@@ -112,12 +110,18 @@ AC_ARG_ENABLE([fastparser],
])
])
AX_CC_CLANG
AS_IF([test "$enable_fastparser" = "yes"],[
AS_IF([test "${CC_LLVM}" = "yes"],[
AC_MSG_WARN([LLVM based compiler detected; disabling fastest zone parser, see https://gitlab.labs.nic.cz/labs/knot/issues/351])
AS_IF([test -n "$CC_CLANG_VERSION"],[
clang_vernum=$(printf "%02d%02d%02d" $(tr "." " " <<< "$CC_CLANG_VERSION"))
AS_IF([test $clang_vernum -lt 030900],[
AC_MSG_WARN([Fast parser disabled due to a compiler bug, see https://llvm.org/bugs/show_bug.cgi?id=23490])
enable_fastparser=no
])
])
])
])
AS_IF([test "$enable_fastparser" = "force"],[enable_fastparser=yes])
AM_CONDITIONAL([FAST_PARSER], [test "$enable_fastparser" = "yes"])
......
dnl Check to see if the C compiler is clang and which version it is
dnl
AC_DEFUN([AX_CC_CLANG],[
AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING([whether C compiler is clang])
CC_CLANG_VERSION=$(
$CC -x c -dM -E /dev/null | \
$GREP '__clang_version__' | \
$EGREP -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'
)
AC_SUBST([CC_CLANG_VERSION])
if test -n "$CC_CLANG_VERSION"; then
AC_MSG_RESULT([$CC_CLANG_VERSION])
else
AC_MSG_RESULT([no])
fi
])
dnl Check to see if the C compiler is clang or llvm-gcc
dnl
AC_DEFUN([AX_CC_LLVM],[
AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING([whether C compiler has a LLVM backend])
$CC -x c /dev/null -dM -E > conftest.txt 2>&1
if grep "__llvm__" conftest.txt >/dev/null 2>&1; then
CC_LLVM=yes
else
CC_LLVM=no
fi
AC_SUBST([CC_LLVM])
AC_MSG_RESULT([$CC_LLVM])
rm -f conftest.txt
])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment