Move WITH_XXX driver feature flags into config.h instead of direct compiler/linker args

This commit is contained in:
Daniel P. Berrange 2008-11-04 23:37:23 +00:00
parent 2ea1eceb75
commit c9ff52fb8a
7 changed files with 81 additions and 54 deletions

View File

@ -1,3 +1,14 @@
Tue Nov 4 23:33:31 UTC 2008 Daniel P. Berrange <berrange@redhat.com>
* configure.in: Set WITH_XXXX conditionals for drivers in
config.h instead of compiler args, and auto-disable stateful
drivers if daemon is disabled
* src/libvirt.c: Remove now redundant WITH_LIBVIRTD condition
* tests/Makefile.am, src/Makefile.am, qemud/Makefile.am: Remove
LIBVIRT_FEATURES args, now set via config.h instead. Add
explicit XEN_LIBS/CFLAGS instead of relying on setting via
global flags.
Tue Nov 4 23:33:31 UTC 2008 Daniel P. Berrange <berrange@redhat.com> Tue Nov 4 23:33:31 UTC 2008 Daniel P. Berrange <berrange@redhat.com>
Move domain events helpers into domain_events.c Move domain events helpers into domain_events.c

View File

@ -232,59 +232,69 @@ fi
AC_PATH_PROG([IPTABLES_PATH], [iptables], /sbin/iptables, [/usr/sbin:$PATH]) AC_PATH_PROG([IPTABLES_PATH], [iptables], /sbin/iptables, [/usr/sbin:$PATH])
AC_DEFINE_UNQUOTED([IPTABLES_PATH], "$IPTABLES_PATH", [path to iptables binary]) AC_DEFINE_UNQUOTED([IPTABLES_PATH], "$IPTABLES_PATH", [path to iptables binary])
dnl
dnl Specify the xen-distribution directory to be able to compile on a
dnl non-xenified host
dnl
AC_ARG_WITH([xen-distdir], [AC_HELP_STRING([--with-xen-distdir=path],
[distribution directory of Xen, default /usr])])
if test "x$with_xen_distdir" != "x"
then
CPPFLAGS="$CPPFLAGS -I$withval/install/usr/include"
LDFLAGS="$LDFLAGS -L$withval/install/usr/lib -L$withval/install/usr/lib64"
fi
LIBVIRT_FEATURES=
WITH_XEN=0
if test "$with_openvz" = "yes"; then if test "$with_openvz" = "yes"; then
LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_OPENVZ" AC_DEFINE_UNQUOTED([WITH_OPENVZ], 1, [whether OpenVZ driver is enabled])
fi fi
AM_CONDITIONAL([WITH_OPENVZ], [test "$with_openvz" = "yes"]) AM_CONDITIONAL([WITH_OPENVZ], [test "$with_openvz" = "yes"])
if test "$with_libvirtd" = "no" ; then
with_lxc=no
fi
if test "$with_lxc" = "yes" ; then if test "$with_lxc" = "yes" ; then
LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_LXC" AC_DEFINE_UNQUOTED([WITH_LXC], 1, [whether LXC driver is enabled])
fi fi
AM_CONDITIONAL([WITH_LXC], [test "$with_lxc" = "yes"]) AM_CONDITIONAL([WITH_LXC], [test "$with_lxc" = "yes"])
if test "$with_libvirtd" = "no" ; then
with_qemu=no
fi
if test "$with_qemu" = "yes" ; then if test "$with_qemu" = "yes" ; then
LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_QEMU" AC_DEFINE_UNQUOTED([WITH_QEMU], 1, [whether QEMU driver is enabled])
fi fi
AM_CONDITIONAL([WITH_QEMU], [test "$with_qemu" = "yes"]) AM_CONDITIONAL([WITH_QEMU], [test "$with_qemu" = "yes"])
if test "$with_test" = "yes" ; then if test "$with_test" = "yes" ; then
LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_TEST" AC_DEFINE_UNQUOTED([WITH_TEST], 1, [whether Test driver is enabled])
fi fi
AM_CONDITIONAL([WITH_TEST], [test "$with_test" = "yes"]) AM_CONDITIONAL([WITH_TEST], [test "$with_test" = "yes"])
if test "$with_remote" = "yes" ; then if test "$with_remote" = "yes" ; then
LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_REMOTE" AC_DEFINE_UNQUOTED([WITH_REMOTE], 1, [whether Remote driver is enabled])
fi fi
AM_CONDITIONAL([WITH_REMOTE], [test "$with_remote" = "yes"]) AM_CONDITIONAL([WITH_REMOTE], [test "$with_remote" = "yes"])
if test "$with_libvirtd" = "yes" ; then if test "$with_libvirtd" = "yes" ; then
LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_LIBVIRTD" AC_DEFINE_UNQUOTED([WITH_LIBVIRTD], 1, [whether libvirtd daemon is enabled])
fi fi
AM_CONDITIONAL([WITH_LIBVIRTD], [test "$with_libvirtd" = "yes"]) AM_CONDITIONAL([WITH_LIBVIRTD], [test "$with_libvirtd" = "yes"])
if test "$with_xen" = "yes" ; then XEN_LIBS=""
dnl search for the Xen store library XEN_CFLAGS=""
AC_SEARCH_LIBS(xs_read, [xenstore], dnl search for the Xen store library
[WITH_XEN=1], if test "$with_xen" != "no" ; then
[AC_MSG_RESULT([Xen store library not found])]) if test "$with_xen" != "yes" -a "$with_xen" != "check" ; then
if test "$WITH_XEN" != "0" ; then XEN_CFLAGS="-I$with_xen/include"
LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_XEN" XEN_LIBS="-L$with_xen/lib64 -L$with_xen/lib"
fi fi
fail=0
old_LIBS="$LIBS"
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $XEN_CFLAGS"
LIBS="$LIBS $XEN_LIBS"
AC_CHECK_LIB([xenstore], [xs_read], [
with_xen=yes
XEN_LIBS="$XEN_LIBS -lxenstore"
],[
if test "$with_xen" = "check" ; then
with_xen=no
else
with_xen=no
fail=1
fi
])
test $fail = 1 &&
AC_MSG_ERROR([You must install the Xen development package to compile Xen driver with -lxenstore])
AC_CHECK_HEADERS([xen/xen.h xen/version.h xen/dom0_ops.h],,[ AC_CHECK_HEADERS([xen/xen.h xen/version.h xen/dom0_ops.h],,[
AC_MSG_ERROR([Cannot find standard Xen headers. Is xen-devel installed?]) AC_MSG_ERROR([Cannot find standard Xen headers. Is xen-devel installed?])
@ -307,8 +317,15 @@ if test "$with_xen" = "yes" ; then
#include <stdint.h> #include <stdint.h>
#include <xen/xen.h> #include <xen/xen.h>
]) ])
LIBS="$old_LIBS"
CFLAGS="$old_CFLAGS"
fi fi
AM_CONDITIONAL([WITH_XEN], [test "$WITH_XEN" = "1"]) if test "$with_xen" = "yes"; then
AC_DEFINE_UNQUOTED([WITH_XEN], 1, [whether Xen driver is enabled])
fi
AM_CONDITIONAL([WITH_XEN], [test "$with_xen" = "yes"])
AC_SUBST([XEN_CFLAGS])
AC_SUBST([XEN_LIBS])
dnl dnl
dnl check for kernel headers required by src/bridge.c dnl check for kernel headers required by src/bridge.c
@ -641,9 +658,6 @@ fi
AC_SUBST([READLINE_CFLAGS]) AC_SUBST([READLINE_CFLAGS])
AC_SUBST([VIRSH_LIBS]) AC_SUBST([VIRSH_LIBS])
AC_SUBST([WITH_XEN])
AC_SUBST([LIBVIRT_FEATURES])
AC_ARG_WITH([network], AC_ARG_WITH([network],
[ --with-network with virtual network driver (on)],[],[with_network=yes]) [ --with-network with virtual network driver (on)],[],[with_network=yes])
@ -1124,6 +1138,11 @@ AC_MSG_NOTICE([ numactl: $NUMACTL_CFLAGS $NUMACTL_LIBS])
else else
AC_MSG_NOTICE([ numactl: no]) AC_MSG_NOTICE([ numactl: no])
fi fi
if test "$with_xen" = "yes" ; then
AC_MSG_NOTICE([ xen: $XEN_CFLAGS $XEN_LIBS])
else
AC_MSG_NOTICE([ xen: no])
fi
AC_MSG_NOTICE([]) AC_MSG_NOTICE([])
AC_MSG_NOTICE([Test suite]) AC_MSG_NOTICE([Test suite])
AC_MSG_NOTICE([]) AC_MSG_NOTICE([])

View File

@ -5,7 +5,7 @@ INCLUDES = -I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
-I$(top_builddir)/include -I@top_srcdir@/include \ -I$(top_builddir)/include -I@top_srcdir@/include \
-I@top_srcdir@/proxy -I@top_srcdir@/src @LIBXML_CFLAGS@ \ -I@top_srcdir@/proxy -I@top_srcdir@/src @LIBXML_CFLAGS@ \
-DPROXY -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -DPROXY -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-DGETTEXT_PACKAGE=\"$(PACKAGE)\" $(WARN_CFLAGS) $(LIBVIRT_FEATURES) -DGETTEXT_PACKAGE=\"$(PACKAGE)\" $(WARN_CFLAGS) $(XEN_CFLAGS)
libexec_PROGRAMS = libvirt_proxy libexec_PROGRAMS = libvirt_proxy
@ -19,7 +19,7 @@ libvirt_proxy_SOURCES = libvirt_proxy.c @top_srcdir@/src/xend_internal.c \
@top_srcdir@/src/util.c \ @top_srcdir@/src/util.c \
@top_srcdir@/src/event.c \ @top_srcdir@/src/event.c \
@top_srcdir@/src/uuid.c @top_srcdir@/src/uuid.c
libvirt_proxy_LDFLAGS = $(WARN_CFLAGS) libvirt_proxy_LDFLAGS = $(WARN_CFLAGS) $(XEN_LIBS)
libvirt_proxy_DEPENDENCIES = libvirt_proxy_DEPENDENCIES =
libvirt_proxy_LDADD = ../gnulib/lib/libgnu.la libvirt_proxy_LDADD = ../gnulib/lib/libgnu.la

View File

@ -1,7 +1,5 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
INCLUDES = $(LIBVIRT_FEATURES)
DAEMON_SOURCES = \ DAEMON_SOURCES = \
event.c event.h \ event.c event.h \
qemud.c qemud.h \ qemud.c qemud.h \

View File

@ -10,14 +10,15 @@ INCLUDES = \
$(SASL_CFLAGS) \ $(SASL_CFLAGS) \
$(SELINUX_CFLAGS) \ $(SELINUX_CFLAGS) \
$(NUMACTL_CFLAGS) \ $(NUMACTL_CFLAGS) \
$(XEN_CFLAGS) \
-DBINDIR=\""$(libexecdir)"\" \ -DBINDIR=\""$(libexecdir)"\" \
-DSBINDIR=\""$(sbindir)"\" \ -DSBINDIR=\""$(sbindir)"\" \
-DSYSCONF_DIR="\"$(sysconfdir)\"" \ -DSYSCONF_DIR="\"$(sysconfdir)\"" \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-DLOCAL_STATE_DIR=\""$(localstatedir)"\" \ -DLOCAL_STATE_DIR=\""$(localstatedir)"\" \
-DGETTEXT_PACKAGE=\"$(PACKAGE)\" \ -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
$(WARN_CFLAGS) \ $(WARN_CFLAGS)
$(LIBVIRT_FEATURES)
DEPS = libvirt.la DEPS = libvirt.la
LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) libvirt.la ../gnulib/lib/libgnu.la LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) libvirt.la ../gnulib/lib/libgnu.la
VIRSH_LIBS = @VIRSH_LIBS@ VIRSH_LIBS = @VIRSH_LIBS@
@ -48,7 +49,6 @@ GENERIC_LIB_SOURCES = \
iptables.c iptables.h \ iptables.c iptables.h \
memory.c memory.h \ memory.c memory.h \
qparams.c qparams.h \ qparams.c qparams.h \
stats_linux.c stats_linux.h \
uuid.c uuid.h \ uuid.c uuid.h \
util.c util.h \ util.c util.h \
virterror.c virterror_internal.h \ virterror.c virterror_internal.h \
@ -151,13 +151,13 @@ libvirt_la_SOURCES = \
internal.h \ internal.h \
datatypes.c datatypes.h \ datatypes.c datatypes.h \
domain_event.c domain_event.h \ domain_event.c domain_event.h \
stats_linux.c stats_linux.h \
libvirt.c libvirt_internal.h \ libvirt.c libvirt_internal.h \
$(GENERIC_LIB_SOURCES) \ $(GENERIC_LIB_SOURCES) \
$(DOMAIN_CONF_SOURCES) \ $(DOMAIN_CONF_SOURCES) \
$(NETWORK_CONF_SOURCES) \ $(NETWORK_CONF_SOURCES) \
$(STORAGE_CONF_SOURCES) $(STORAGE_CONF_SOURCES)
# Drivers usable outside daemon context
if WITH_TEST if WITH_TEST
libvirt_la_SOURCES += $(TEST_DRIVER_SOURCES) libvirt_la_SOURCES += $(TEST_DRIVER_SOURCES)
endif endif
@ -174,14 +174,6 @@ if WITH_OPENVZ
libvirt_la_SOURCES += $(OPENVZ_DRIVER_SOURCES) libvirt_la_SOURCES += $(OPENVZ_DRIVER_SOURCES)
endif endif
# Drivers usable inside daemon context
if WITH_LIBVIRTD
if WITH_NETWORK
libvirt_la_SOURCES += $(NETWORK_DRIVER_SOURCES)
endif
libvirt_la_SOURCES += $(STORAGE_DRIVER_SOURCES)
libvirt_la_SOURCES += $(STORAGE_DRIVER_FS_SOURCES)
if WITH_QEMU if WITH_QEMU
libvirt_la_SOURCES += $(QEMU_DRIVER_SOURCES) libvirt_la_SOURCES += $(QEMU_DRIVER_SOURCES)
endif endif
@ -190,6 +182,16 @@ if WITH_LXC
libvirt_la_SOURCES += $(LXC_DRIVER_SOURCES) libvirt_la_SOURCES += $(LXC_DRIVER_SOURCES)
endif endif
if WITH_NETWORK
libvirt_la_SOURCES += $(NETWORK_DRIVER_SOURCES)
endif
if WITH_STORAGE_DIR
libvirt_la_SOURCES += $(STORAGE_DRIVER_SOURCES)
libvirt_la_SOURCES += $(STORAGE_DRIVER_FS_SOURCES)
endif
if WITH_STORAGE_LVM if WITH_STORAGE_LVM
libvirt_la_SOURCES += $(STORAGE_DRIVER_LVM_SOURCES) libvirt_la_SOURCES += $(STORAGE_DRIVER_LVM_SOURCES)
endif endif
@ -201,7 +203,6 @@ endif
if WITH_STORAGE_DISK if WITH_STORAGE_DISK
libvirt_la_SOURCES += $(STORAGE_DRIVER_DISK_SOURCES) libvirt_la_SOURCES += $(STORAGE_DRIVER_DISK_SOURCES)
endif endif
endif
# Add all conditional sources just in case... # Add all conditional sources just in case...
EXTRA_DIST += \ EXTRA_DIST += \
@ -220,7 +221,7 @@ EXTRA_DIST += \
libvirt_la_LIBADD = $(LIBXML_LIBS) $(GNUTLS_LIBS) $(SASL_LIBS) $(SELINUX_LIBS) \ libvirt_la_LIBADD = $(LIBXML_LIBS) $(GNUTLS_LIBS) $(SASL_LIBS) $(SELINUX_LIBS) \
$(NUMACTL_LIBS) \ $(NUMACTL_LIBS) $(XEN_LIBS) \
@CYGWIN_EXTRA_LIBADD@ ../gnulib/lib/libgnu.la @CYGWIN_EXTRA_LIBADD@ ../gnulib/lib/libgnu.la
libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libvirt_sym.version \ libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libvirt_sym.version \
-version-info @LIBVIRT_VERSION_INFO@ \ -version-info @LIBVIRT_VERSION_INFO@ \

View File

@ -289,7 +289,6 @@ virInitialize(void)
#ifdef WITH_XEN #ifdef WITH_XEN
if (xenUnifiedRegister () == -1) return -1; if (xenUnifiedRegister () == -1) return -1;
#endif #endif
#ifdef WITH_LIBVIRTD
#ifdef WITH_QEMU #ifdef WITH_QEMU
if (qemudRegister() == -1) return -1; if (qemudRegister() == -1) return -1;
#endif #endif
@ -302,6 +301,7 @@ virInitialize(void)
#ifdef WITH_NETWORK #ifdef WITH_NETWORK
if (networkRegister() == -1) return -1; if (networkRegister() == -1) return -1;
#endif #endif
#ifdef WITH_STORAGE_DIR
if (storageRegister() == -1) return -1; if (storageRegister() == -1) return -1;
#endif #endif
#ifdef WITH_REMOTE #ifdef WITH_REMOTE

View File

@ -15,11 +15,9 @@ INCLUDES = \
$(GNUTLS_CFLAGS) \ $(GNUTLS_CFLAGS) \
$(SASL_CFLAGS) \ $(SASL_CFLAGS) \
$(SELINUX_CFLAGS) \ $(SELINUX_CFLAGS) \
-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L \
-DGETTEXT_PACKAGE=\"$(PACKAGE)\" \ -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
$(COVERAGE_CFLAGS) \ $(COVERAGE_CFLAGS) \
$(WARN_CFLAGS) \ $(WARN_CFLAGS)
$(LIBVIRT_FEATURES)
LDADDS = \ LDADDS = \
@STATIC_BINARIES@ \ @STATIC_BINARIES@ \