blob: 1c4e71f734c5ed460287704d979fde1dbfe4e703 [file] [log] [blame]
Alexey Kodaneve0ad93b2013-06-19 15:56:43 +04001dnl Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
2dnl
3dnl This program is free software; you can redistribute it and/or
4dnl modify it under the terms of the GNU General Public License as
5dnl published by the Free Software Foundation; either version 2 of
6dnl the License, or (at your option) any later version.
7dnl
8dnl This program is distributed in the hope that it would be useful,
9dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11dnl GNU General Public License for more details.
12dnl
13dnl You should have received a copy of the GNU General Public License
14dnl along with this program; if not, write the Free Software Foundation,
15dnl Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16dnl
17dnl Author: Alexey Kodanev <alexey.kodanev@oracle.com>
18dnl
19
20dnl
21dnl LTP_CHECK_KERNEL_DEVEL
22dnl ----------------------------
23dnl Building kernel modules
24dnl requires kernel-devel installed
25dnl
26
27AC_DEFUN([LTP_CHECK_KERNEL_DEVEL],[dnl
28
29AC_MSG_CHECKING([for kernel-devel])
30AC_ARG_WITH(
31 [linux-version],
32 [AC_HELP_STRING([--with-linux-version=VERSION],
33 [specify the Linux version to build modules for])],
34 [LINUX_VERSION="${withval}"],
35 AS_IF([test "$cross_compiling" = "no"],
36 [LINUX_VERSION=`uname -r`]))
37
38AC_SUBST(LINUX_VERSION)
39
40AC_ARG_WITH([linux-dir],
41 [AC_HELP_STRING([--with-linux-dir=DIR],
42 [specify path to kernel-devel directory])],
43 [LINUX_DIR="${withval}"],
44 AS_IF([test -n "$LINUX_VERSION"],
45 [LINUX_DIR="/lib/modules/$LINUX_VERSION/build"]))
46
47AC_SUBST(LINUX_DIR)
48
49if test -f "$LINUX_DIR/Makefile"; then
Cyril Hrubis92250132014-08-21 16:54:09 +020050 LINUX_VERSION_MAJOR=`make -C ${LINUX_DIR} -s kernelversion | cut -d. -f1`
51 LINUX_VERSION_PATCH=`make -C ${LINUX_DIR} -s kernelversion | cut -d. -f2`
Alexey Kodaneve0ad93b2013-06-19 15:56:43 +040052fi
53
Cyril Hrubis33da69c2014-03-25 16:31:07 +010054if test -n "$LINUX_VERSION_MAJOR" -a -n "$LINUX_VERSION_PATCH"; then
Alexey Kodaneve0ad93b2013-06-19 15:56:43 +040055 WITH_MODULES="yes"
56else
57 WITH_MODULES="no"
58fi
59
60AC_SUBST(LINUX_VERSION_MAJOR)
61AC_SUBST(LINUX_VERSION_PATCH)
62
63AC_MSG_RESULT([$WITH_MODULES])
64
65AC_ARG_WITH(
66 [modules],
67 [AC_HELP_STRING([--without-modules],
68 [disable auto-building kernel modules])],
69 [WITH_MODULES="no"],
70 [])
71
72AC_SUBST(WITH_MODULES)
73])