[RFC 02/21] maint: Check libclang and its python3 binding

Shi Lei shi_lei at massclouds.com
Wed Jun 10 01:20:30 UTC 2020


Make sure libclang and its python3 binding have been installed.

Signed-off-by: Shi Lei <shi_lei at massclouds.com>
---
 configure.ac | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/configure.ac b/configure.ac
index 6c8ac2f..747e52a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -707,6 +707,18 @@ if test -z "$FLAKE8"; then
     AC_MSG_WARN(['flake8' binary is required to check python code style])
 fi
 
+dnl Need libclang and its python3 binding to generate some functions
+LIBCLANG_LINE=`ldconfig -p | grep libclang`
+LIBCLANG_PATH=`expr "$LIBCLANG_LINE" : '.* => \(.*\)$'`
+if test -z "$LIBCLANG_PATH"; then
+    AC_MSG_ERROR([libclang is required by libvirt])
+fi
+HAVE_PY3_CLANG=`python3 -c 'import clang.cindex;print("ok")' 2>/dev/null`
+if test -z "$HAVE_PY3_CLANG"; then
+    AC_MSG_ERROR(['python3-clang' is required. Execute 'pip3 install clang'.])
+fi
+AC_SUBST(LIBCLANG_PATH)
+
 dnl Python3 < 3.7 treats the C locale as 7-bit only.
 dnl We must force env vars so it treats it as UTF-8
 dnl regardless of the user's locale.
-- 
2.17.1





More information about the libvir-list mailing list