From: Bartosz Golaszewski Date: Wed, 11 Dec 2019 15:39:53 +0000 (+0100) Subject: build: check linux headers version at build-time X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=454aaaaccbd0506bf726d99fb28df34ea83139f8;p=qemu-gpiodev%2Flibgpiod.git build: check linux headers version at build-time 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 --- 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 +#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],