This patch introduces a "--with-kernel-version" switch that allows the user to specify the specific kernel version that they want to compile the input-wacom modules for. This is especially useful to test that the code compiles correctly for different kernels without the associated requirement that those kernels be running at the moment.
To do this, we move the kernel version checks (and calculation of WCM_KERNEL_VER) above the code to search for the kernel directory so that it has an idea of where exactly to search. The version number checks that used to set MODUTS are kept as a sanity check. Signed-off-by: Jason Gerecke <jason.gere...@wacom.com> --- configure.ac | 107 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 55 insertions(+), 52 deletions(-) diff --git a/configure.ac b/configure.ac index 41e1445..d061fde 100644 --- a/configure.ac +++ b/configure.ac @@ -27,6 +27,43 @@ dnl kernel source, module versioning, etc WCM_ENV_KERNEL=no WCM_KERNEL_DIR= WCM_KERNEL_VER= +MODUTS= + +dnl Check which version of the driver we should compile +AC_ARG_WITH(kernel-version, + AS_HELP_STRING([--with-kernel-version=version], [Specify kernel version]), + [MODUTS="$withval"], + [MODUTS=`uname -r`]) + +AC_MSG_CHECKING(kernel version) +AC_MSG_RESULT([$MODUTS]) +MINOR=`echo $MODUTS | sed 's/[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\).*/\1/'` +if echo $MODUTS | grep "^2.4" >/dev/null; then + AC_MSG_WARN([kernel 2.4.x is not supported]) +elif echo $MODUTS | grep "^2.6" >/dev/null; then + if test $MINOR -ge 26; then + case $MINOR in + 26|27|28|29|30|31|32|33|34|35) WCM_KERNEL_VER="2.6.30";; + 36|37) WCM_KERNEL_VER="2.6.36";; + *) WCM_KERNEL_VER="2.6.38";; + esac + else + AC_MSG_WARN([kernels older than 2.6.26 is supported by linuxwacom]) + fi +elif echo $MODUTS | grep "^3." >/dev/null; then + MINOR=`echo $MODUTS | sed 's/[[0-9]]*\.\([[0-9]]*\).*/\1/'` + if test $MINOR -ge 17; then + WCM_KERNEL_VER="3.17" + elif test $MINOR -ge 7; then + WCM_KERNEL_VER="3.7" + else + WCM_KERNEL_VER="2.6.38" + fi +elif echo $MODUTS | grep "^4." >/dev/null; then + WCM_KERNEL_VER="3.17" +else + AC_MSG_WARN(kernel version $MODUTS not supported) +fi dnl Check for kernel build environment AC_ARG_WITH(kernel, @@ -36,29 +73,27 @@ AC_ARG_WITH(kernel, AC_MSG_CHECKING(for kernel source/headers) if test "$WCM_KERNEL_DIR" = "yes" -o -z "$WCM_KERNEL_DIR"; then AC_DEFUN([SEARCH_DIRECTORIES], [[ - [/lib/modules/`uname -r`/source], - [/lib/modules/`uname -r`/build], + [/lib/modules/$MODUTS/source], + [/lib/modules/$MODUTS/build], [/usr/src/linux], - [/usr/src/linux-`uname -r`], + [/usr/src/linux-$MODUTS], [/usr/src/linux-2.6] ]]) WCM_KERNEL_DIR= dnl Kernel source not specified, guess where it is m4_foreach([ROOTDIR], SEARCH_DIRECTORIES, [ - if test "$WCM_ENV_KERNEL" = "no"; then + if test -z "$WCM_KERNEL_DIR"; then if test -f "ROOTDIR/.config"; then WCM_KERNEL_DIR="ROOTDIR" - WCM_ENV_KERNEL=yes AC_MSG_RESULT($WCM_KERNEL_DIR) fi fi ]) m4_foreach([ROOTDIR], SEARCH_DIRECTORIES, [ - if test "$WCM_ENV_KERNEL" = "no"; then + if test -z "$WCM_KERNEL_DIR"; then if test -f "ROOTDIR/include/linux/input.h"; then WCM_KERNEL_DIR="ROOTDIR" - WCM_ENV_KERNEL=yes AC_MSG_RESULT($WCM_KERNEL_DIR) fi fi @@ -70,58 +105,26 @@ if test "$WCM_KERNEL_DIR" = "yes" -o -z "$WCM_KERNEL_DIR"; then fi elif test "$WCM_KERNEL_DIR" != "no"; then AC_MSG_RESULT([$WCM_KERNEL_DIR]) - if test -f "$WCM_KERNEL_DIR/include/linux/input.h"; then - WCM_ENV_KERNEL=yes + if test \! -f "$WCM_KERNEL_DIR/include/linux/input.h"; then + AC_MSG_NOTICE([Kernel directory does not appear to contain headers]) fi fi -if test "$WCM_ENV_KERNEL" = "no"; then - AC_MSG_ERROR([We could not find the kernel development environment dnl -to build the driver. Please install the kernel source or the kernel development dnl -package and try again.]) -fi -dnl Check which version of the driver we should compile -AC_MSG_CHECKING(kernel version) -MODUTS= -for a in "$WCM_KERNEL_DIR/include/linux/version.h" \ +dnl Final sanity check to make sure the kernel versions match +for F in "$WCM_KERNEL_DIR/include/linux/version.h" \ "$WCM_KERNEL_DIR/include/generated/utsrelease.h" \ "$WCM_KERNEL_DIR/include/linux/utsrelease.h"; do - if test -f $a; then - MODUTS=`grep UTS_RELEASE $a | sed -e 's/^[[^"]]*"\([[^"]]*\).*$/\1/g'` - fi - test -n "$MODUTS" && break -done -if test -z "$MODUTS"; then - AC_MSG_WARN(unable to identify kernel version) -else - AC_MSG_RESULT([$MODUTS]) - MINOR=`echo $MODUTS | sed 's/[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\).*/\1/'` - if echo $MODUTS | grep "^2.4" >/dev/null; then - AC_MSG_WARN([kernel 2.4.x is not supported]) - elif echo $MODUTS | grep "^2.6" >/dev/null; then - if test $MINOR -ge 26; then - case $MINOR in - 26|27|28|29|30|31|32|33|34|35) WCM_KERNEL_VER="2.6.30";; - 36|37) WCM_KERNEL_VER="2.6.36";; - *) WCM_KERNEL_VER="2.6.38";; - esac - else - AC_MSG_WARN([kernels older than 2.6.26 is supported by linuxwacom]) + if test -f $F; then + if test "$MODUTS" = "`grep UTS_RELEASE $F | sed -e 's/^[[^"]]*"\([[^"]]*\).*$/\1/g'`"; then + WCM_ENV_KERNEL=yes fi - elif echo $MODUTS | grep "^3." >/dev/null; then - MINOR=`echo $MODUTS | sed 's/[[0-9]]*\.\([[0-9]]*\).*/\1/'` - if test $MINOR -ge 17; then - WCM_KERNEL_VER="3.17" - elif test $MINOR -ge 7; then - WCM_KERNEL_VER="3.7" - else - WCM_KERNEL_VER="2.6.38" - fi - elif echo $MODUTS | grep "^4." >/dev/null; then - WCM_KERNEL_VER="3.17" - else - AC_MSG_WARN(kernel version $MODUTS not supported) fi +done + +if test "$WCM_ENV_KERNEL" = "no"; then + AC_MSG_ERROR([We could not find the development environment to dnl +build modules for the '$MODUTS' kernel. Please install the kernel source or dnl +the kernel development package and try again.]) fi dnl Separate test output from file-generation output -- 2.3.5 ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel