From 8a2d6596f2cb43c097957ed6e003eb5225dd5003 Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@nicira.com>
Date: Wed, 22 Jun 2011 11:07:33 -0700
Subject: [PATCH] configure: Change --with-l26 to --with-linux.

Linux 3.0 will be out soon, so it seems like a good idea to reflect that
in our "configure" script options.
---
 ChangeLog                           |  4 +++
 INSTALL.Linux                       |  8 ++---
 acinclude.m4                        | 49 ++++++++++++++++++++---------
 debian/rules.modules                |  2 +-
 rhel/openvswitch-kmod-rhel5.spec.in |  2 +-
 rhel/openvswitch-kmod-rhel6.spec.in |  2 +-
 xenserver/openvswitch-xen.spec      |  2 +-
 7 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 75224ab81..735ff0e94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,10 @@ post v1.1.0
     - ovs-openflowd has been renamed test-openflowd and moved into the
       tests directory.  Its presence confused too many users.  Please
       use ovs-vswitchd instead.
+    - "configure" option --with-l26 has been renamed --with-linux, and
+      --with-l26-source has been renamed --with-linux-source.  The old
+      names will be removed after the next release, so please update
+      your scripts.
     - Feature removals:
       - Dropped support for "tun_id_from_cookie" OpenFlow extension.
 	(Use the extensible match extensions instead.)
diff --git a/INSTALL.Linux b/INSTALL.Linux
index 8ec82a25a..318c9a752 100644
--- a/INSTALL.Linux
+++ b/INSTALL.Linux
@@ -172,17 +172,17 @@ Prerequisites section, follow the procedure below to build.
    To build the Linux kernel module, so that you can run the
    kernel-based switch, pass the location of the kernel build
    directory on --with-l26.  For example, to build for a running
-   instance of Linux 2.6:
+   instance of Linux:
 
-      % ./configure --with-l26=/lib/modules/`uname -r`/build
+      % ./configure --with-linux=/lib/modules/`uname -r`/build
 
    If you wish to build the kernel module for an architecture other
    than the architecture of the machine used for the build, you may
    specify the kernel architecture string using the KARCH variable
    when invoking the configure script.  For example, to build for MIPS
-   with Linux 2.6:
+   with Linux:
 
-      % ./configure --with-l26=/path/to/linux-2.6 KARCH=mips
+      % ./configure --with-linux=/path/to/linux-2.6 KARCH=mips
 
    The configure script accepts a number of other options and honors
    additional environment variables.  For a full list, invoke
diff --git a/acinclude.m4 b/acinclude.m4
index 2c9b10a68..61d15552d 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -29,16 +29,39 @@ 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])
+    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 +71,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 +83,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
@@ -83,7 +106,7 @@ 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])
@@ -108,8 +131,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")
 ])
diff --git a/debian/rules.modules b/debian/rules.modules
index 4ca3d9285..d84348dd2 100755
--- a/debian/rules.modules
+++ b/debian/rules.modules
@@ -26,7 +26,7 @@ binary-modules: prep-deb-files
 	dh_testroot
 	dh_clean -k
 	tar xzf openvswitch.tar.gz
-	cd openvswitch && ./configure --with-l26=$(KSRC) $(DATAPATH_CONFIGURE_OPTS) --with-build-number=$(BUILD_NUMBER)
+	cd openvswitch && ./configure --with-linux=$(KSRC) $(DATAPATH_CONFIGURE_OPTS) --with-build-number=$(BUILD_NUMBER)
 	cd openvswitch && $(MAKE) -C datapath/linux-2.6
 	install -d -m755 $(DSTDIR)
 	install -m644 openvswitch/datapath/linux-2.6/*_mod.ko $(DSTDIR)/
diff --git a/rhel/openvswitch-kmod-rhel5.spec.in b/rhel/openvswitch-kmod-rhel5.spec.in
index f1bc02efd..cf2a077b2 100644
--- a/rhel/openvswitch-kmod-rhel5.spec.in
+++ b/rhel/openvswitch-kmod-rhel5.spec.in
@@ -63,7 +63,7 @@ echo "override %{kmod_name} * weak-updates/%{kmod_name}" > kmod-%{kmod_name}.con
 for kvariant in %{kvariants} ; do
     KSRC=%{_usrsrc}/kernels/%{kversion}${kvariant:+-$kvariant}-%{_target_cpu}
     cd _kmod_build_$kvariant
-    ../openvswitch-%{version}/configure --with-l26="$KSRC"
+    ../openvswitch-%{version}/configure --with-linux="$KSRC"
     %{__make} -C datapath/linux-2.6 %{?_smp_mflags}
     cd ..
 done
diff --git a/rhel/openvswitch-kmod-rhel6.spec.in b/rhel/openvswitch-kmod-rhel6.spec.in
index 5aa92bdc5..8f9b2efcb 100644
--- a/rhel/openvswitch-kmod-rhel6.spec.in
+++ b/rhel/openvswitch-kmod-rhel6.spec.in
@@ -40,7 +40,7 @@ Open vSwitch Linux kernel module.
 %build
 for flavor in %flavors_to_build; do
 	mkdir _$flavor
-	(cd _$flavor && ../configure --with-l26="%{kernel_source $flavor}")
+	(cd _$flavor && ../configure --with-linux="%{kernel_source $flavor}")
 	%{__make} -C _$flavor/datapath/linux-2.6 %{?_smp_mflags}
 done
 
diff --git a/xenserver/openvswitch-xen.spec b/xenserver/openvswitch-xen.spec
index da9ed1f24..f83a8d5a1 100644
--- a/xenserver/openvswitch-xen.spec
+++ b/xenserver/openvswitch-xen.spec
@@ -60,7 +60,7 @@ Open vSwitch Linux kernel module compiled against kernel version
 %setup -q -n openvswitch-%{openvswitch_version}
 
 %build
-./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} --with-l26=/lib/modules/%{xen_version}/build --enable-ssl %{build_number}
+./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} --with-linux=/lib/modules/%{xen_version}/build --enable-ssl %{build_number}
 make %{_smp_mflags}
 
 %install
-- 
2.47.0