aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2013-04-17 01:51:45 +0800
committerLAN-TW <lantw44@gmail.com>2013-04-17 01:51:45 +0800
commitc3e4d51bc2d9c840b91d1c7b209a693107bd1e60 (patch)
treed23984ff9e4a2c227bd02025ff48ce6f791ff0ab
parent865556906ff35d09d16472ede01ef64228c94b5a (diff)
downloadtaiwan-online-judge-lantw44-c3e4d51bc2d9c840b91d1c7b209a693107bd1e60.tar.gz
taiwan-online-judge-lantw44-c3e4d51bc2d9c840b91d1c7b209a693107bd1e60.tar.zst
taiwan-online-judge-lantw44-c3e4d51bc2d9c840b91d1c7b209a693107bd1e60.zip
Add checks for kernel headers
-rw-r--r--configure.ac21
1 files changed, 17 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 27c9384..e782191 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,17 +62,30 @@ PKG_CHECK_MODULES([JSON], [json], [true],
AC_ARG_WITH([kernel-cc],
[AS_HELP_STRING([--with-kernel-cc=K_CC],
[C compiler used to compile kernel modules @<:@default=gcc@:>@])],
- [with_kernel_cc=$withval], [with_kernel_cc=gcc])
+ [with_kernel_cc="$withval"], [with_kernel_cc=gcc])
AC_ARG_WITH([kernel-ver],
[AS_HELP_STRING([--with-kernel-ver=K_VER],
[select the kernel header version @<:@default=$(shell uname -r)@:>@])],
- [with_kernel_ver=$withval], [with_kernel_ver='$(shell uname -r)'])
+ [with_kernel_ver="$withval"], [with_kernel_ver='$(shell uname -r)'])
+
+if test "${with_kernel_ver}" = '$(shell uname -r)'; then
+ k_ver_check="`echo ${with_kernel_ver} | sed 's/$(shell \(.*\))/\1/'`"
+ k_ver_check="`${k_ver_check}`"
+else
+ k_ver_check="${with_kernel_ver}"
+fi
+
AC_ARG_WITH([kernel-src],
[AS_HELP_STRING([--with-kernel-src=K_SRC],
[the path to your kernel source tree
@<:@default=/lib/modules/K_VER/build@:>@])],
- [with_kernel_src=$withval],
- [with_kernel_src=/lib/modules/$with_kernel_ver/build])
+ [with_kernel_src="$withval"],
+ [with_kernel_src="/lib/modules/${with_kernel_ver}/build"
+ k_src_check="/lib/modules/${k_ver_check}/build"])
+
+
+AC_CHECK_FILES([${k_src_check}/Makefile], [true],
+ [AC_MSG_ERROR([Linux kernel headers cannot be found. You should specify the path using --with-kernel-ver or --with-kernel-src])])
AC_SUBST([KERNEL_CC], ["$with_kernel_cc"])
AC_SUBST([KERNEL_SRC], ["$with_kernel_src"])