3 dnl Copyright (C) 2002 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; version 2 of the License.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 dnl Usage: ENSC_KERNEL_HEADERS(<var>)
19 dnl <var> ... basedir of kernel-headers (without the '/linux');
20 dnl this value will be AC_SUBST'ed
22 AC_DEFUN([_ENSC_KERNEL_DIR],
24 AC_CACHE_CHECK([for linux kernel dir], [ensc_cv_path_kerneldir],
26 AC_ARG_WITH([kerneldir],
27 [AC_HELP_STRING([--with-kerneldir=DIR],
28 [assume kernelsources in DIR (default: /lib/modules/<current>/build)])],
30 yes|no) AC_MSG_ERROR(['$withval' is not a valid value for kerneldir]);;
31 *) ensc_cv_path_kerneldir=$withval;;
33 [ensc_cv_path_kerneldir=
34 for i in /lib/modules/$(uname -r)/build /usr/src/linux /usr; do
35 test -e $i/include/linux/version.h && { ensc_cv_path_kerneldir=$i; break; }
39 test "$ensc_cv_path_kerneldir" -a -e "$ensc_cv_path_kerneldir"/include/linux/version.h || {
40 AC_MSG_ERROR([Can not find kernelsources])
44 AC_DEFUN([ENSC_KERNEL_HEADERS],
46 AC_REQUIRE([_ENSC_KERNEL_DIR])
48 AC_CACHE_CHECK([for linux kernel headers], [ensc_cv_path_kernelheaders],
50 ensc_cv_path_kernelheaders=$ensc_cv_path_kerneldir/include
53 if test x"$1" != x; then
54 $1=$ensc_cv_path_kernelheaders