X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=acinclude.m4;h=fc7155f7b2918a31132c2dcf3f2ccabe854b3751;hb=53319f95b9d3d025917110e2688a2cf0616f7071;hp=2c9b10a68e07c3f5d5494253860916000ea86d21;hpb=e3438006d3fe940aa90496f8dfc590b6c21dd8c5;p=sliver-openvswitch.git diff --git a/acinclude.m4 b/acinclude.m4 index 2c9b10a68..fc7155f7b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -29,16 +29,41 @@ dnl OVS_CHECK_LINUX dnl dnl Configure linux kernel source tree AC_DEFUN([OVS_CHECK_LINUX], [ - AC_ARG_WITH([l26], - [AC_HELP_STRING([--with-l26=/path/to/linux-2.6], - [Specify the linux 2.6 kernel build directory])], - [KBUILD="$withval"], [KBUILD=])dnl - AC_ARG_WITH([l26-source], - [AC_HELP_STRING([--with-l26-source=/path/to/linux-2.6-source], - [Specify the linux 2.6 kernel source directory + AC_ARG_WITH([linux], + [AC_HELP_STRING([--with-linux=/path/to/linux], + [Specify the Linux kernel build directory])]) + AC_ARG_WITH([linux-source], + [AC_HELP_STRING([--with-linux-source=/path/to/linux-source], + [Specify the Linux kernel source directory (usually figured out automatically from build - directory)])], - [KSRC="$withval"], [KSRC=])dnl + directory)])]) + + # Deprecated equivalents to --with-linux, --with-linux-source. + AC_ARG_WITH([l26]) + AC_ARG_WITH([l26-source]) + + if test X"$with_linux" != X; then + KBUILD=$with_linux + elif test X"$with_l26" != X; then + KBUILD=$with_l26 + AC_MSG_WARN([--with-l26 is deprecated, please use --with-linux instead]) + else + KBUILD= + fi + + if test X"$KBUILD" != X; then + if test X"$with_linux_source" != X; then + KSRC=$with_linux_source + 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]) + fi + if test -n "$KBUILD"; then KBUILD=`eval echo "$KBUILD"` case $KBUILD in @@ -48,7 +73,7 @@ AC_DEFUN([OVS_CHECK_LINUX], [ # The build directory is what the user provided. # Make sure that it exists. - AC_MSG_CHECKING([for Linux 2.6 build directory]) + AC_MSG_CHECKING([for Linux build directory]) if test -d "$KBUILD"; then AC_MSG_RESULT([$KBUILD]) AC_SUBST(KBUILD) @@ -60,7 +85,7 @@ AC_DEFUN([OVS_CHECK_LINUX], [ # Debian breaks kernel headers into "source" header and "build" headers. # We want the source headers, but $KBUILD gives us the "build" headers. # Use heuristics to find the source headers. - AC_MSG_CHECKING([for Linux 2.6 source directory]) + AC_MSG_CHECKING([for Linux source directory]) if test -n "$KSRC"; then KSRC=`eval echo "$KSRC"` case $KSRC in @@ -68,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 @@ -83,23 +108,33 @@ AC_DEFUN([OVS_CHECK_LINUX], [ esac fi if test ! -e $KSRC/include/linux/kernel.h; then - AC_MSG_ERROR([cannot find source directory (please use --with-l26-source)]) + AC_MSG_ERROR([cannot find source directory (please use --with-linux-source)]) fi fi 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 || \ @@ -108,8 +143,6 @@ AC_DEFUN([OVS_CHECK_LINUX], [ AC_MSG_ERROR([Linux kernel source in $KBUILD is not configured]) fi OVS_CHECK_LINUX_COMPAT - elif test -n "$KSRC"; then - AC_MSG_ERROR([--with-l26-source may not be specified without --with-l26]) fi AM_CONDITIONAL(LINUX_ENABLED, test -n "$KBUILD") ])