diff mbox series

[libgpiod] build: check linux headers version at build-time

Message ID 20191211154402.8946-1-brgl@bgdev.pl
State New
Headers show
Series [libgpiod] build: check linux headers version at build-time | expand

Commit Message

Bartosz Golaszewski Dec. 11, 2019, 3:44 p.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Original libgpiod relied on linux headers v4.8 to build but it was only
documented in README and not enforced at build-time. We now support
features first available in linux v5.5. Add a check to configure.ac that
verifies if recent enough kernel headers are available - otherwise we'd
fail only when trying to build the library.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 configure.ac | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index 62e2671..e939889 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,6 +89,15 @@  AC_CHECK_HEADERS([dirent.h], [], [HEADER_NOT_FOUND_LIB([dirent.h])])
 AC_CHECK_HEADERS([sys/poll.h], [], [HEADER_NOT_FOUND_LIB([sys/poll.h])])
 AC_CHECK_HEADERS([sys/sysmacros.h], [], [HEADER_NOT_FOUND_LIB([sys/sysmacros.h])])
 AC_CHECK_HEADERS([linux/gpio.h], [], [HEADER_NOT_FOUND_LIB([linux/gpio.h])])
+AC_CHECK_HEADERS([linux/version.h], [], [HEADER_NOT_FOUND_LIB([linux/version.h])])
+
+AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
+#error
+#endif
+)],
+[], [AC_MSG_ERROR(["libgpiod needs linux headers version >= v5.5.0"])])
 
 AC_ARG_ENABLE([tools],
 	[AC_HELP_STRING([--enable-tools],