configure: Fix typo in user message.
[sliver-openvswitch.git] / acinclude.m4
index 61d1555..fc7155f 100644 (file)
@@ -57,6 +57,8 @@ AC_DEFUN([OVS_CHECK_LINUX], [
     elif test X"$with_l26_source" != X; then
       KSRC=$with_l26_source
       AC_MSG_WARN([--with-l26-source is deprecated, please use --with-linux-source instead])
+    else
+      KSRC=
     fi
   elif test X"$with_linux_source" != X || test X"$with_l26_source" != X; then
     AC_MSG_ERROR([Linux source directory may not be specified without Linux build directory])
@@ -91,7 +93,7 @@ AC_DEFUN([OVS_CHECK_LINUX], [
           *) KSRC=`pwd`/$KSRC ;;
       esac
       if test ! -e $KSRC/include/linux/kernel.h; then
-        AC_MSG_ERROR([$KSRC is not a kernel source directory)])
+        AC_MSG_ERROR([$KSRC is not a kernel source directory])
       fi
     else
       KSRC=$KBUILD
@@ -112,17 +114,27 @@ AC_DEFUN([OVS_CHECK_LINUX], [
     AC_MSG_RESULT([$KSRC])
 
     AC_MSG_CHECKING([for kernel version])
+    version=`sed -n 's/^VERSION = //p' "$KSRC/Makefile"`
     patchlevel=`sed -n 's/^PATCHLEVEL = //p' "$KSRC/Makefile"`
     sublevel=`sed -n 's/^SUBLEVEL = //p' "$KSRC/Makefile"`
-    if test -z "$patchlevel" || test -z "$sublevel"; then
+    if test X"$version" = X || test X"$patchlevel" = X; then
        AC_ERROR([cannot determine kernel version])
+    elif test X"$sublevel" = X; then
+       kversion=$version.$patchlevel
+    else
+       kversion=$version.$patchlevel.$sublevel
     fi
-    AC_MSG_RESULT([2.$patchlevel.$sublevel])
-    if test "2.$patchlevel" != '2.6'; then
+    AC_MSG_RESULT([$kversion])
+
+    if test "$version" -ge 3; then
+       : # Linux 3.x
+    elif test "$version" = 2 && test "$patchlevel" -ge 6; then
+       : # Linux 2.6.x
+    else
        if test "$KBUILD" = "$KSRC"; then
-         AC_ERROR([Linux kernel in $KBUILD is not version 2.6])
+         AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 2.6 or later is required])
        else
-         AC_ERROR([Linux kernel in build tree $KBUILD (source tree $KSRC) is not version 2.6])
+         AC_ERROR([Linux kernel in build tree $KBUILD (source tree $KSRC) is version $kversion, but version 2.6 or later is required])
        fi
     fi
     if test ! -e "$KBUILD"/include/linux/version.h || \