[ovs-dev] [linux-3.0 5/5] configure: Do not reject Linux 3.0 at configure time.

Ben Pfaff blp at nicira.com
Wed Jun 22 17:20:35 UTC 2011


Until now, the configure script has rejected any version of Linux other
than 2.6.  In preparation for Linux 3.0, this allows newer versions also.
---
 acinclude.m4                        |   20 +++++++++++++++-----
 datapath/linux-2.6/Makefile.main.in |    4 ----
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index e60fb44..830093b 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -112,17 +112,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 || \
diff --git a/datapath/linux-2.6/Makefile.main.in b/datapath/linux-2.6/Makefile.main.in
index a868cb6..1edfc34 100644
--- a/datapath/linux-2.6/Makefile.main.in
+++ b/datapath/linux-2.6/Makefile.main.in
@@ -31,10 +31,6 @@ else
   KOBJ := $(KSRC)
 endif
 
-ifneq ($(shell grep -c 'PATCHLEVEL = 6' $(KSRC)/Makefile),1)
-  $(error Linux kernel source in $(KSRC) not 2.6)
-endif
-
 VERSION_FILE := $(KOBJ)/include/linux/version.h
 ifeq (,$(wildcard $(VERSION_FILE)))
   $(error Linux kernel source not configured - missing version.h)
-- 
1.7.4.4




More information about the dev mailing list