[libvirt] [PATCH] Rework configure logic for virtualport support

In this patch I am reworking the logic around detecting virtual port support and requiring the libnl dependency. - It requires --with-macvtap and displays an error in case of --without-macvtap --with-virtualport. - It tests for availability of certain data in include files and displays an error in case the include file is not at the correct level and --with-virtualport was chosen - displays 'checking' messages for macvtap and virtualport support and results - libnl support is required when macvtap is found or requested; if libnl is not there, please supply without-macvtap Signed-off-by: Stefan Berger <stefanb@us.ibm.com> diff --git a/configure.ac b/configure.ac index 6100610..d94b510 100644 --- a/configure.ac +++ b/configure.ac @@ -2058,6 +2058,7 @@ AC_ARG_WITH([macvtap], [with_macvtap=${withval}], [with_macvtap=check]) +AC_MSG_CHECKING([whether to compile with macvtap support]) if test "$with_macvtap" != "no" ; then AC_TRY_COMPILE([ #include <sys/socket.h> #include <linux/rtnetlink.h> ], @@ -2075,19 +2076,31 @@ if test "$with_macvtap" != "no" ; then AC_DEFINE_UNQUOTED([WITH_MACVTAP], $val, [whether macvtap support is enabled]) fi AM_CONDITIONAL([WITH_MACVTAP], [test "$with_macvtap" = "yes"]) +AC_MSG_RESULT([$with_macvtap]) -AC_TRY_COMPILE([ #include <sys/socket.h> - #include <linux/rtnetlink.h> ], - [ int x = IFLA_PORT_MAX; ], - [ with_virtualport=yes ], - [ with_virtualport=no ]) -if test "$with_virtualport" = "yes"; then - val=1 -else - val=0 +val=0 +if test "$with_virtualport" != "no"; then + if test "$with_macvtap" = "no"; then + AC_MSG_ERROR([--with-virtualport requires --with-macvtap]) + fi + AC_MSG_CHECKING([whether to compile with virtual port support]) + AC_TRY_COMPILE([ #include <sys/socket.h> + #include <linux/rtnetlink.h> ], + [ int x = IFLA_PORT_MAX; ], + [ with_virtualport=yes ], + [ if test "$with_virtualport" = "yes" ; then + AC_MSG_ERROR([Installed linux headers don't show support for virtual port support.]) + fi + with_virtualport=no ]) + if test "$with_virtualport" = "yes"; then + val=1 + else + val=0 + fi + AC_DEFINE_UNQUOTED([WITH_VIRTUALPORT], $val, + [whether vsi vepa support is enabled]) + AC_MSG_RESULT([$with_virtualport]) fi -AC_DEFINE_UNQUOTED([WITH_VIRTUALPORT], $val, - [whether vsi vepa support is enabled]) AM_CONDITIONAL([WITH_VIRTUALPORT], [test "$with_virtualport" = "yes"]) @@ -2096,7 +2109,7 @@ dnl netlink library LIBNL_CFLAGS="" LIBNL_LIBS="" -if test "$with_macvtap" = "yes" || test "$with_virtualport" = "yes"; then +if test "$with_macvtap" = "yes"; then PKG_CHECK_MODULES([LIBNL], [libnl-1 >= $LIBNL_REQUIRED], [ ], [ AC_MSG_ERROR([libnl >= $LIBNL_REQUIRED is required for macvtap support])

On 09/28/2010 11:01 AM, Stefan Berger wrote:
In this patch I am reworking the logic around detecting virtual port support and requiring the libnl dependency.
- It requires --with-macvtap and displays an error in case of --without-macvtap --with-virtualport. - It tests for availability of certain data in include files and displays an error in case the include file is not at the correct level and --with-virtualport was chosen - displays 'checking' messages for macvtap and virtualport support and results - libnl support is required when macvtap is found or requested; if libnl is not there, please supply without-macvtap
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
diff --git a/configure.ac b/configure.ac index 6100610..d94b510 100644 --- a/configure.ac +++ b/configure.ac @@ -2058,6 +2058,7 @@ AC_ARG_WITH([macvtap], [with_macvtap=${withval}], [with_macvtap=check])
+AC_MSG_CHECKING([whether to compile with macvtap support]) if test "$with_macvtap" != "no" ; then AC_TRY_COMPILE([ #include <sys/socket.h> #include <linux/rtnetlink.h> ], @@ -2075,19 +2076,31 @@ if test "$with_macvtap" != "no" ; then AC_DEFINE_UNQUOTED([WITH_MACVTAP], $val, [whether macvtap support is enabled]) fi AM_CONDITIONAL([WITH_MACVTAP], [test "$with_macvtap" = "yes"]) +AC_MSG_RESULT([$with_macvtap])
This part's nice.
-AC_TRY_COMPILE([ #include <sys/socket.h> - #include <linux/rtnetlink.h> ], - [ int x = IFLA_PORT_MAX; ], - [ with_virtualport=yes ], - [ with_virtualport=no ]) -if test "$with_virtualport" = "yes"; then - val=1 -else - val=0 +val=0 +if test "$with_virtualport" != "no"; then
Hmm - here you use $with_virtualport without adding an AC_ARG_WITH([virtualport]), which means the user doesn't have an easy way to set this variable via ./configure --with-virtualport. I think we need a v2 that adds the AC_ARG_WITH.
-if test "$with_macvtap" = "yes" || test "$with_virtualport" = "yes"; then +if test "$with_macvtap" = "yes"; then PKG_CHECK_MODULES([LIBNL], [libnl-1 >= $LIBNL_REQUIRED], [
So virtualport doesn't require libnl. The rest of your logic looks okay, once we get the AC_ARG_WITH sorted out. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 09/28/2010 01:52 PM, Eric Blake wrote:
On 09/28/2010 11:01 AM, Stefan Berger wrote:
-AC_TRY_COMPILE([ #include <sys/socket.h> - #include <linux/rtnetlink.h> ], - [ int x = IFLA_PORT_MAX; ], - [ with_virtualport=yes ], - [ with_virtualport=no ]) -if test "$with_virtualport" = "yes"; then - val=1 -else - val=0 +val=0 +if test "$with_virtualport" != "no"; then
Hmm - here you use $with_virtualport without adding an AC_ARG_WITH([virtualport]), which means the user doesn't have an easy way to set this variable via ./configure --with-virtualport.
I think we need a v2 that adds the AC_ARG_WITH.
Ooops.
-if test "$with_macvtap" = "yes" || test "$with_virtualport" = "yes"; then +if test "$with_macvtap" = "yes"; then PKG_CHECK_MODULES([LIBNL], [libnl-1 >= $LIBNL_REQUIRED], [
So virtualport doesn't require libnl. The rest of your logic looks okay, once we get the AC_ARG_WITH sorted out.
virtualport support requires macvtap -- at least at the moment -- which in turn requires libnl. [virtualport support could be used with directly mapped PCI devices (not needing macvtap), but there is no support for this atm. In that case the two will become independent of each other.] Will send a V2 shortly. Stefan
participants (2)
-
Eric Blake
-
Stefan Berger