[libvirt] [PATCH 01/23] build: set min version for CLang to 3.4 / XCode CLang to 5.1

Daniel P. Berrangé berrange at redhat.com
Thu Jan 2 14:53:35 UTC 2020


We have a strong check for GCC >= 4.8, but don't validate any
version number for CLang historically.

This defines the min CLang to be 3.4 which is what is available
for RHEL-7. macOS uses a different versioning scheme for CLang,
based off XCode versions. There is a mapping recorded at

  https://en.wikipedia.org/wiki/Xcode#Toolchain_versions

Here we see upstream CLang 3.4 corresponds to XCode 5.1

XCode 5.1 is available for macOS 10.8.4 or later which
trivially satisfies our platform support matrix requirements.

All these versions match what QEMU declares for its min GCC
and CLang checks.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 config-post.h | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/config-post.h b/config-post.h
index 7c07e05340..415cc8cc72 100644
--- a/config-post.h
+++ b/config-post.h
@@ -32,6 +32,20 @@
     ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
 #endif
 
-#if !(__GNUC_PREREQ(4, 8) || defined(__clang__))
-# error "Libvirt requires GCC >= 4.8, or CLang"
+#if defined(__clang_major__) && defined(__clang_minor__)
+# ifdef __apple_build_version__
+#  if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1)
+#   error You need at least XCode Clang v5.1 to compile QEMU
+#  endif
+# else
+#  if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4)
+#   error You need at least Clang v3.4 to compile QEMU
+#  endif
+# endif
+#elif defined(__GNUC__) && defined(__GNUC_MINOR__)
+# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
+#  error You need at least GCC v4.8 to compile QEMU
+# endif
+#else
+# error You either need at least GCC 4.8 or Clang 3.4 or XCode Clang 5.1 to compile libvirt
 #endif
-- 
2.24.1




More information about the libvir-list mailing list