]> xenbits.xensource.com Git - libvirt.git/commitdiff
macvtap support for libvirt -- build support
authorStefan Berger <stefanb@us.ibm.com>
Fri, 12 Feb 2010 17:03:07 +0000 (18:03 +0100)
committerDaniel Veillard <veillard@redhat.com>
Mon, 15 Feb 2010 16:47:28 +0000 (17:47 +0100)
This patch adds build support for libvirt checking for certain contents
of /usr/include/linux/if_link.h to see whether macvtap support is
compilable on that system. One can disable macvtap support in libvirt
via --without-macvtap passed to configure.
* configure.ac src/Makefile.am: new build support
* src/libvirt_macvtap.syms: list of exported symbols
* src/util/macvtap.c: empty module to not break compilation

configure.ac
src/Makefile.am
src/libvirt_macvtap.syms [new file with mode: 0644]
src/util/macvtap.c [new file with mode: 0644]

index 29c6396fed86bb27a5ec6119fdf777578e3c86c0..1c7c24cf6a5f13cc1734e201c4114cdbff4153c5 100644 (file)
@@ -1827,6 +1827,30 @@ AC_ARG_WITH([qemu-group],
 AC_DEFINE_UNQUOTED([QEMU_USER], ["$QEMU_USER"], [QEMU user account])
 AC_DEFINE_UNQUOTED([QEMU_GROUP], ["$QEMU_GROUP"], [QEMU group account])
 
+
+AC_ARG_WITH([macvtap],
+  AC_HELP_STRING([--with-macvtap],[enable macvtap device @<:@default=check@:>@]),
+  [with_macvtap=${withval}],
+  [with_macvtap=check])
+
+if test "$with_macvtap" != "no" ; then
+    AC_TRY_COMPILE([ #include <linux/if_link.h> ],
+                   [ int x = MACVLAN_MODE_BRIDGE; ],
+                   [ with_macvtap=yes ],
+                   [ if test "$with_macvtap" = "yes" ; then
+                         AC_MSG_ERROR([Installed linux headers don't show support for macvtap device.])
+                     fi
+                     with_macvtap=no ])
+    if test "$with_macvtap" = "yes" ; then
+        val=1
+    else
+        val=0
+    fi
+    AC_DEFINE_UNQUOTED([WITH_MACVTAP], $val, [whether macvtap support is enabled])
+fi
+AM_CONDITIONAL([WITH_MACVTAP], [test "$with_macvtap" = "yes"])
+
+
 # Only COPYING.LIB is under version control, yet COPYING
 # is included as part of the distribution tarball.
 # Copy one to the other, but only if this is a srcdir-build.
@@ -1878,6 +1902,7 @@ AC_MSG_NOTICE([  Remote: $with_remote])
 AC_MSG_NOTICE([ Network: $with_network])
 AC_MSG_NOTICE([Libvirtd: $with_libvirtd])
 AC_MSG_NOTICE([   netcf: $with_netcf])
+AC_MSG_NOTICE([ macvtap: $with_macvtap])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Storage Drivers])
 AC_MSG_NOTICE([])
index 32322569e9d6a2f622242958d62df692d282c604..2051e5d7ca85bc25f187b458d3a01f5d99cafcea 100644 (file)
@@ -55,6 +55,7 @@ UTIL_SOURCES =                                                        \
                util/ebtables.c util/ebtables.h                 \
                util/json.c util/json.h                         \
                util/logging.c util/logging.h                   \
+               util/macvtap.c util/macvtap.h                   \
                util/memory.c util/memory.h                     \
                util/pci.c util/pci.h                           \
                util/processinfo.c util/processinfo.h           \
@@ -784,12 +785,15 @@ if WITH_LINUX
 USED_SYM_FILES += libvirt_linux.syms
 endif
 
+USED_SYM_FILES += libvirt_macvtap.syms
+
 EXTRA_DIST += \
   libvirt_public.syms          \
   libvirt_private.syms         \
   libvirt_driver_modules.syms  \
   libvirt_bridge.syms          \
-  libvirt_linux.syms
+  libvirt_linux.syms           \
+  libvirt_macvtap.syms
 
 BUILT_SOURCES = libvirt.syms
 
diff --git a/src/libvirt_macvtap.syms b/src/libvirt_macvtap.syms
new file mode 100644 (file)
index 0000000..d02213d
--- /dev/null
@@ -0,0 +1,5 @@
+#
+
+# macvtap.h
+openMacvtapTap;
+delMacvtapByMACAddress;
diff --git a/src/util/macvtap.c b/src/util/macvtap.c
new file mode 100644 (file)
index 0000000..e69de29