1dnl SPDX-License-Identifier: GPL-2.0-or-later 2dnl Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. 3dnl Author: Alexey Kodanev <alexey.kodanev@oracle.com> 4dnl Building kernel modules 5dnl kernel development headers installed 6 7AC_DEFUN([LTP_CHECK_KERNEL_DEVEL],[ 8 9AC_MSG_CHECKING([for kernel-devel]) 10AC_ARG_WITH( 11 [linux-version], 12 [AC_HELP_STRING([--with-linux-version=VERSION], 13 [specify the Linux version to build modules for])], 14 [LINUX_VERSION="${withval}"], 15 AS_IF([test "$cross_compiling" = "no"], 16 [LINUX_VERSION=`uname -r`])) 17 18AC_SUBST(LINUX_VERSION) 19 20AC_ARG_WITH([linux-dir], 21 [AC_HELP_STRING([--with-linux-dir=DIR], 22 [specify path to kernel-devel directory])], 23 [LINUX_DIR="${withval}"], 24 AS_IF([test -n "$LINUX_VERSION"], 25 [LINUX_DIR="/lib/modules/$LINUX_VERSION/build"])) 26 27AC_SUBST(LINUX_DIR) 28 29if test -f "$LINUX_DIR/Makefile"; then 30 LINUX_VERSION_MAJOR=`make -C ${LINUX_DIR} -s kernelversion | cut -d. -f1` 31 LINUX_VERSION_PATCH=`make -C ${LINUX_DIR} -s kernelversion | cut -d. -f2` 32fi 33 34if test -n "$LINUX_VERSION_MAJOR" -a -n "$LINUX_VERSION_PATCH"; then 35 WITH_MODULES="yes" 36else 37 WITH_MODULES="no" 38fi 39 40AC_SUBST(LINUX_VERSION_MAJOR) 41AC_SUBST(LINUX_VERSION_PATCH) 42 43AC_MSG_RESULT([$WITH_MODULES]) 44 45AC_ARG_WITH( 46 [modules], 47 [AC_HELP_STRING([--without-modules], 48 [disable auto-building kernel modules])], 49 [WITH_MODULES="no"], 50 []) 51 52AC_SUBST(WITH_MODULES) 53]) 54