1 dnl =================================================================================
2 dnl Distributed under the terms of the GNU GPL version 2.
3 dnl Copyright (c) 2007, 2008 The Board of Trustees of The Leland Stanford Junior University
4 dnl =================================================================================
8 dnl CHECK_LINUX(OPTION, VERSION, VARIABLE, CONDITIONAL)
10 dnl Configure linux kernel source tree
12 AC_DEFUN([CHECK_LINUX], [
14 [AC_HELP_STRING([--with-$1=/path/to/linux-$3],
15 [Specify the linux $3 kernel sources])],
16 [path="$withval"], [path=])dnl
17 if test -n "$path"; then
18 path=`eval echo "$path"`
20 AC_MSG_CHECKING([for $path directory])
21 if test -d "$path"; then
27 AC_ERROR([source dir $path doesn't exist])
30 AC_MSG_CHECKING([for $path kernel version])
31 version=`grep '^PATCHLEVEL = ' "$path/Makefile" | sed 's/PATCHLEVEL = '//`
32 AC_MSG_RESULT([2.$version])
33 if test "2.$version" != '$3'; then
34 AC_ERROR([Linux kernel source in $path is not version $3])
36 if ! test -e "$path"/include/linux/version.h || \
37 ! test -e "$path"/include/linux/autoconf.h; then
38 AC_MSG_ERROR([Linux kernel source in $path is not configured])
41 AM_CONDITIONAL($5, test -n "$path")