ltp-kernel_devel.m4 1.4 KB
Newer Older
M
m00302376 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
dnl SPDX-License-Identifier: GPL-2.0-or-later
dnl Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
dnl Author: Alexey Kodanev <alexey.kodanev@oracle.com>
dnl Building kernel modules
dnl kernel development headers installed

AC_DEFUN([LTP_CHECK_KERNEL_DEVEL],[

AC_MSG_CHECKING([for kernel-devel])
AC_ARG_WITH(
	[linux-version],
	[AC_HELP_STRING([--with-linux-version=VERSION],
			[specify the Linux version to build modules for])],
	[LINUX_VERSION="${withval}"],
	AS_IF([test "$cross_compiling" = "no"],
		[LINUX_VERSION=`uname -r`]))

AC_SUBST(LINUX_VERSION)

AC_ARG_WITH([linux-dir],
	[AC_HELP_STRING([--with-linux-dir=DIR],
			[specify path to kernel-devel directory])],
	[LINUX_DIR="${withval}"],
	AS_IF([test -n "$LINUX_VERSION"],
		[LINUX_DIR="/lib/modules/$LINUX_VERSION/build"]))

AC_SUBST(LINUX_DIR)

if test -f "$LINUX_DIR/Makefile"; then
	LINUX_VERSION_MAJOR=`make -C ${LINUX_DIR} -s kernelversion | cut -d. -f1`
	LINUX_VERSION_PATCH=`make -C ${LINUX_DIR} -s kernelversion | cut -d. -f2`
fi

if test -n "$LINUX_VERSION_MAJOR" -a -n "$LINUX_VERSION_PATCH"; then
	WITH_MODULES="yes"
else
	WITH_MODULES="no"
fi

AC_SUBST(LINUX_VERSION_MAJOR)
AC_SUBST(LINUX_VERSION_PATCH)

AC_MSG_RESULT([$WITH_MODULES])

AC_ARG_WITH(
	[modules],
	[AC_HELP_STRING([--without-modules],
			[disable auto-building kernel modules])],
			[WITH_MODULES="no"],
			[])

AC_SUBST(WITH_MODULES)
])