build: define WITH_INTERFACE for the driver

Based exclusively on work by Eric Blake in a patch posted with the same
subject. However some modifications related to comments and my plans to
add another backend.

Added WITH_INTERFACE as the only automake variable deciding whether to
build the driver and using WITH_NETCF to identify that we're wanting to
use the netcf library as the backend.

* configure.ac: Added with_interface
* src/interface/netcf_driver.c: Renamed..
* src/interface/interface_backend_netcf.c: ..to this to match storage.
* src/interface/netcf_driver.h: Renamed..
* src/interface/interface_driver.h: ..to this.
* daemon/Makefile.am: Respect WITH_INTERFACE and WITH_NETCF.
* libvirt.spec.in: Add RPM support for --with-interface
This commit is contained in:
Doug Goldstein 2012-09-17 20:27:06 -05:00 committed by Eric Blake
parent c88a4f2a46
commit b95ad92e05
10 changed files with 73 additions and 22 deletions

View File

@ -2787,6 +2787,36 @@ if test "$with_nwfilter" = "yes" ; then
fi fi
AM_CONDITIONAL([WITH_NWFILTER], [test "$with_nwfilter" = "yes"]) AM_CONDITIONAL([WITH_NWFILTER], [test "$with_nwfilter" = "yes"])
dnl check if the interface driver should be compiled
AC_ARG_WITH([interface],
AC_HELP_STRING([--with-interface],
[with host interface driver @<:@default=check@:>@]), [],
[with_interface=check])
dnl Don't compile the interface driver without libvirtd
if test "$with_libvirtd" = "no" ; then
with_interface=no
fi
dnl The interface driver depends on the netcf library
if test "$with_interface:$with_netcf" = "check:yes" ; then
with_interface=yes
fi
if test "$with_interface:$with_netcf" = "check:no" ; then
with_interface=no
fi
if test "$with_interface:$with_netcf" = "yes:no" ; then
AC_MSG_ERROR([Requested the Interface driver without netcf support])
fi
if test "$with_interface" = "yes" ; then
AC_DEFINE_UNQUOTED([WITH_INTERFACE], [1],
[whether the interface driver is enabled])
fi
AM_CONDITIONAL([WITH_INTERFACE], [test "$with_interface" = "yes"])
dnl libblkid is used by several storage drivers; therefore we probe dnl libblkid is used by several storage drivers; therefore we probe
dnl for it unconditionally. dnl for it unconditionally.
AC_ARG_WITH([libblkid], AC_ARG_WITH([libblkid],
@ -3018,7 +3048,7 @@ AC_MSG_NOTICE([ Test: $with_test])
AC_MSG_NOTICE([ Remote: $with_remote]) AC_MSG_NOTICE([ Remote: $with_remote])
AC_MSG_NOTICE([ Network: $with_network]) AC_MSG_NOTICE([ Network: $with_network])
AC_MSG_NOTICE([ Libvirtd: $with_libvirtd]) AC_MSG_NOTICE([ Libvirtd: $with_libvirtd])
AC_MSG_NOTICE([ netcf: $with_netcf]) AC_MSG_NOTICE([Interface: $with_interface])
AC_MSG_NOTICE([ macvtap: $with_macvtap]) AC_MSG_NOTICE([ macvtap: $with_macvtap])
AC_MSG_NOTICE([ virtport: $with_virtualport]) AC_MSG_NOTICE([ virtport: $with_virtualport])
AC_MSG_NOTICE([]) AC_MSG_NOTICE([])

View File

@ -151,7 +151,7 @@ if WITH_NETWORK
libvirtd_LDADD += ../src/libvirt_driver_network.la libvirtd_LDADD += ../src/libvirt_driver_network.la
endif endif
if WITH_NETCF if WITH_INTERFACE
libvirtd_LDADD += ../src/libvirt_driver_interface.la libvirtd_LDADD += ../src/libvirt_driver_interface.la
endif endif

View File

@ -78,8 +78,8 @@
# ifdef WITH_NETWORK # ifdef WITH_NETWORK
# include "network/bridge_driver.h" # include "network/bridge_driver.h"
# endif # endif
# ifdef WITH_NETCF # ifdef WITH_INTERFACE
# include "interface/netcf_driver.h" # include "interface/interface_driver.h"
# endif # endif
# ifdef WITH_STORAGE # ifdef WITH_STORAGE
# include "storage/storage_driver.h" # include "storage/storage_driver.h"
@ -382,7 +382,7 @@ static void daemonInitialize(void)
# ifdef WITH_NWFILTER # ifdef WITH_NWFILTER
virDriverLoadModule("nwfilter"); virDriverLoadModule("nwfilter");
# endif # endif
# ifdef WITH_NETCF # ifdef WITH_INTERFACE
virDriverLoadModule("interface"); virDriverLoadModule("interface");
# endif # endif
# ifdef WITH_XEN # ifdef WITH_XEN
@ -404,7 +404,7 @@ static void daemonInitialize(void)
# ifdef WITH_NETWORK # ifdef WITH_NETWORK
networkRegister(); networkRegister();
# endif # endif
# ifdef WITH_NETCF # ifdef WITH_INTERFACE
interfaceRegister(); interfaceRegister();
# endif # endif
# ifdef WITH_STORAGE # ifdef WITH_STORAGE

View File

@ -70,6 +70,7 @@
%define with_parallels 0%{!?_without_parallels:1} %define with_parallels 0%{!?_without_parallels:1}
# Then the secondary host drivers, which run inside libvirtd # Then the secondary host drivers, which run inside libvirtd
%define with_interface 0%{!?_without_interface:%{server_drivers}}
%define with_network 0%{!?_without_network:%{server_drivers}} %define with_network 0%{!?_without_network:%{server_drivers}}
%define with_storage_fs 0%{!?_without_storage_fs:%{server_drivers}} %define with_storage_fs 0%{!?_without_storage_fs:%{server_drivers}}
%define with_storage_lvm 0%{!?_without_storage_lvm:%{server_drivers}} %define with_storage_lvm 0%{!?_without_storage_lvm:%{server_drivers}}
@ -207,6 +208,11 @@
%define with_hal 0%{!?_without_hal:%{server_drivers}} %define with_hal 0%{!?_without_hal:%{server_drivers}}
%endif %endif
# interface requires netcf
%if ! 0%{?with_netcf}
%define with_interface 0
%endif
# Enable yajl library for JSON mode with QEMU # Enable yajl library for JSON mode with QEMU
%if 0%{?fedora} >= 13 || 0%{?rhel} >= 6 %if 0%{?fedora} >= 13 || 0%{?rhel} >= 6
%define with_yajl 0%{!?_without_yajl:%{server_drivers}} %define with_yajl 0%{!?_without_yajl:%{server_drivers}}
@ -226,6 +232,7 @@
# Disable some drivers when building without libvirt daemon. # Disable some drivers when building without libvirt daemon.
# The logic is the same as in configure.ac # The logic is the same as in configure.ac
%if ! %{with_libvirtd} %if ! %{with_libvirtd}
%define with_interface 0
%define with_network 0 %define with_network 0
%define with_qemu 0 %define with_qemu 0
%define with_lxc 0 %define with_lxc 0
@ -281,12 +288,6 @@
%define with_nodedev 0 %define with_nodedev 0
%endif %endif
%if %{with_netcf}
%define with_interface 1
%else
%define with_interface 0
%endif
%if %{with_storage_fs} || %{with_storage_mpath} || %{with_storage_iscsi} || %{with_storage_lvm} || %{with_storage_disk} %if %{with_storage_fs} || %{with_storage_mpath} || %{with_storage_iscsi} || %{with_storage_lvm} || %{with_storage_disk}
%define with_storage 1 %define with_storage 1
%else %else
@ -1113,6 +1114,10 @@ of recent versions of Linux (and other OSes).
%define _with_rhel5_api --with-rhel5-api %define _with_rhel5_api --with-rhel5-api
%endif %endif
%if ! %{with_interface}
%define _without_interface --without-interface
%endif
%if ! %{with_network} %if ! %{with_network}
%define _without_network --without-network %define _without_network --without-network
%endif %endif
@ -1249,6 +1254,7 @@ autoreconf -if
%{?_without_hyperv} \ %{?_without_hyperv} \
%{?_without_vmware} \ %{?_without_vmware} \
%{?_without_parallels} \ %{?_without_parallels} \
%{?_without_interface} \
%{?_without_network} \ %{?_without_network} \
%{?_with_rhel5_api} \ %{?_with_rhel5_api} \
%{?_without_storage_fs} \ %{?_without_storage_fs} \

View File

@ -40,7 +40,7 @@ src/fdstream.c
src/hyperv/hyperv_driver.c src/hyperv/hyperv_driver.c
src/hyperv/hyperv_util.c src/hyperv/hyperv_util.c
src/hyperv/hyperv_wmi.c src/hyperv/hyperv_wmi.c
src/interface/netcf_driver.c src/interface/interface_backend_netcf.c
src/internal.h src/internal.h
src/libvirt.c src/libvirt.c
src/libvirt-qemu.c src/libvirt-qemu.c

View File

@ -552,8 +552,17 @@ PARALLELS_DRIVER_SOURCES = \
NETWORK_DRIVER_SOURCES = \ NETWORK_DRIVER_SOURCES = \
network/bridge_driver.h network/bridge_driver.c network/bridge_driver.h network/bridge_driver.c
INTERFACE_DRIVER_SOURCES = \ INTERFACE_DRIVER_SOURCES =
interface/netcf_driver.h interface/netcf_driver.c
if WITH_INTERFACE
INTERFACE_DRIVER_SOURCES += \
interface/interface_driver.h
endif
if WITH_NETCF
INTERFACE_DRIVER_SOURCES += \
interface/interface_backend_netcf.c
endif
SECRET_DRIVER_SOURCES = \ SECRET_DRIVER_SOURCES = \
secret/secret_driver.h secret/secret_driver.c secret/secret_driver.h secret/secret_driver.c
@ -1021,7 +1030,7 @@ endif
EXTRA_DIST += network/default.xml EXTRA_DIST += network/default.xml
if WITH_NETCF if WITH_INTERFACE
if WITH_DRIVER_MODULES if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_interface.la mod_LTLIBRARIES += libvirt_driver_interface.la
else else
@ -1029,10 +1038,13 @@ noinst_LTLIBRARIES += libvirt_driver_interface.la
# Stateful, so linked to daemon instead # Stateful, so linked to daemon instead
#libvirt_la_BUILT_LIBADD += libvirt_driver_interface.la #libvirt_la_BUILT_LIBADD += libvirt_driver_interface.la
endif endif
libvirt_driver_interface_la_CFLAGS = $(NETCF_CFLAGS) \ libvirt_driver_interface_la_CFLAGS = -I$(top_srcdir)/src/conf $(AM_CFLAGS)
-I$(top_srcdir)/src/conf $(AM_CFLAGS)
libvirt_driver_interface_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_interface_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_interface_la_LIBADD = $(NETCF_LIBS) libvirt_driver_interface_la_LIBADD =
if WITH_NETCF
libvirt_driver_interface_la_CFLAGS += $(NETCF_CFLAGS)
libvirt_driver_interface_la_LIBADD += $(NETCF_LIBS)
endif
if WITH_DRIVER_MODULES if WITH_DRIVER_MODULES
libvirt_driver_interface_la_LIBADD += ../gnulib/lib/libgnu.la libvirt_driver_interface_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_interface_la_LDFLAGS += -module -avoid-version libvirt_driver_interface_la_LDFLAGS += -module -avoid-version

View File

@ -27,7 +27,7 @@
#include "virterror_internal.h" #include "virterror_internal.h"
#include "datatypes.h" #include "datatypes.h"
#include "netcf_driver.h" #include "interface_driver.h"
#include "interface_conf.h" #include "interface_conf.h"
#include "memory.h" #include "memory.h"
#include "logging.h" #include "logging.h"

View File

@ -79,7 +79,7 @@ mymain(void)
#ifdef WITH_NWFILTER #ifdef WITH_NWFILTER
TEST("nwfilter", NULL); TEST("nwfilter", NULL);
#endif #endif
#ifdef WITH_NETCF #ifdef WITH_INTERFACE
TEST("interface", NULL); TEST("interface", NULL);
#endif #endif
#ifdef WITH_QEMU #ifdef WITH_QEMU

View File

@ -2707,8 +2707,11 @@ vshShowVersion(vshControl *ctl ATTRIBUTE_UNUSED)
#ifdef WITH_BRIDGE #ifdef WITH_BRIDGE
vshPrint(ctl, " Bridging"); vshPrint(ctl, " Bridging");
#endif #endif
#ifdef WITH_NETCF #if defined(WITH_INTERFACE)
vshPrint(ctl, " Interface"); vshPrint(ctl, " Interface");
# if defined(WITH_NETCF)
vshPrint(ctl, " netcf");
# endif
#endif #endif
#ifdef WITH_NWFILTER #ifdef WITH_NWFILTER
vshPrint(ctl, " Nwfilter"); vshPrint(ctl, " Nwfilter");