]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
autotools: check if compiler is new enough
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 21 Aug 2018 22:04:19 +0000 (00:04 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 21 Aug 2018 22:04:19 +0000 (00:04 +0200)
We line up with the Linux kernel and won't support any compiler under 4.6.
Additionally, we also require at least gnu99 so this is due anyway.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
configure.ac

index 837d018e37d8d04e8e32614eca2e7da40101b9f3..19d9ea220a0fb672608236a26d3b9941091e0689 100644 (file)
@@ -45,6 +45,22 @@ AC_CANONICAL_HOST
 AM_PROG_CC_C_O
 AC_GNU_SOURCE
 
+# Test if we have a new enough compiler.
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#define GCC_VERSION \
+       (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+
+#define CLANG_VERSION \
+       (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
+
+#if GCC_VERSION < 40600 && CLANG_VERSION < 10000
+#error Sorry, your compiler is too old - please upgrade it
+#endif
+       ]])], [valid_compiler=yes], [valid_compiler=no])
+if test "x$valid_compiler" = "xno"; then
+       AC_MSG_ERROR([Sorry, your compiler is too old - please upgrade it])
+fi
+
 # libtool
 LT_INIT
 AC_SUBST([LIBTOOL_DEPS])