build: check linux headers version at build-time
PATCH 1/1 build: check linux headers version at build-time
From: Bartosz Golaszewski <[email protected]>
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 <[email protected]>
--- configure.ac | 9 +++++++++ 1 file changed, 9 insertions(+)
configure.ac +9 -0
@@ -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],
Signature · 1 line
2.23.0