[libvirt] [PATCH v2 1/5] config-post.h: define __GNUC_PREREQ if not defined

Fabian Freyer fabian.freyer at physik.tu-berlin.de
Sun Jun 12 12:28:04 UTC 2016


Several gnulib headers rely on feature.h being included by ctype.h to provide
__GNUC_PREREQ, but on systems without glibc, this is not provided. In these
cases __GNUC_PREREQ gets redefined to 0, which causes build errors from checks
in src/internal.h.
Therefore, define __GNUC_PREREQ as early as possible. config.h is probably the
first header that is included, before any other headers.
---
 config-post.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/config-post.h b/config-post.h
index 2398d3d..0aa8271 100644
--- a/config-post.h
+++ b/config-post.h
@@ -67,3 +67,14 @@
 # undef WITH_SECDRIVER_APPARMOR
 # undef WITH_CAPNG
 #endif /* LIBVIRT_NSS */
+
+#ifdef __GNUC__
+# ifndef __GNUC_PREREQ
+#  if defined __GNUC__ && defined __GNUC_MINOR__
+#   define __GNUC_PREREQ(maj, min)                                        \
+   ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#  else
+#   define __GNUC_PREREQ(maj, min) 0
+#  endif
+# endif
+#endif
-- 
2.7.0




More information about the libvir-list mailing list