From: "Daniel P. Berrange" <berrange(a)redhat.com>
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
configure.ac | 34 ++--------------------------------
m4/virt-dbus.m4 | 19 +++++++++++++++++++
2 files changed, 21 insertions(+), 32 deletions(-)
create mode 100644 m4/virt-dbus.m4
diff --git a/configure.ac b/configure.ac
index 07ddecc..6f4fa90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,7 +113,6 @@ LIBNL_REQUIRED="1.1"
LIBSSH2_REQUIRED="1.0"
LIBSSH2_TRANSPORT_REQUIRED="1.3"
LIBBLKID_REQUIRED="2.17"
-DBUS_REQUIRED="1.0.0"
dnl Checks for C compiler.
AC_PROG_CC
@@ -150,6 +149,7 @@ LIBVIRT_COMPILE_WARNINGS
LIBVIRT_CHECK_APPARMOR
LIBVIRT_CHECK_AUDIT
LIBVIRT_CHECK_CAPNG
+LIBVIRT_CHECK_DBUS
LIBVIRT_CHECK_LIBATTR
LIBVIRT_CHECK_NETCF
LIBVIRT_CHECK_NUMACTL
@@ -1045,37 +1045,6 @@ AC_SUBST([GNUTLS_CFLAGS])
AC_SUBST([GNUTLS_LIBS])
-dnl DBus library
-DBUS_CFLAGS=
-DBUS_LIBS=
-AC_ARG_WITH([dbus],
- AC_HELP_STRING([--with-dbus], [enable communication with DBus
@<:@default=check@:>@]),
- [],
- [with_dbus=check])
-if test "$with_dbus" = "yes" || test "$with_dbus" =
"check" ; then
- PKG_CHECK_MODULES(DBUS, dbus-1 >= $DBUS_REQUIRED,
- [with_dbus=yes], [
- if test "$with_dbus" = "check" ; then
- with_dbus=no
- else
- AC_MSG_ERROR([You must install DBus >= $DBUS_REQUIRED to compile libvirt])
- fi])
-fi
-
-if test "$with_dbus" = "yes" ; then
- AC_DEFINE_UNQUOTED([WITH_DBUS], 1, [enable communication with DBus])
-
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS="$LIBS $DBUS_LIBS"
- CFLAGS="$CFLAGS $DBUS_CFLAGS"
- AC_CHECK_FUNCS([dbus_watch_get_unix_fd])
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-fi
-AM_CONDITIONAL([WITH_DBUS], [test "$have_dbus" = "yes"])
-
-
dnl PolicyKit library
POLKIT_CFLAGS=
POLKIT_LIBS=
@@ -2634,6 +2603,7 @@ AC_MSG_NOTICE([])
LIBVIRT_RESULT_APPARMOR
LIBVIRT_RESULT_AUDIT
LIBVIRT_RESULT_CAPNG
+LIBVIRT_RESULT_DBUS
LIBVIRT_RESULT_LIBATTR
LIBVIRT_RESULT_NETCF
LIBVIRT_RESULT_NUMACTL
diff --git a/m4/virt-dbus.m4 b/m4/virt-dbus.m4
new file mode 100644
index 0000000..4107b95
--- /dev/null
+++ b/m4/virt-dbus.m4
@@ -0,0 +1,19 @@
+dnl The libdbus.so library
+
+AC_DEFUN([LIBVIRT_CHECK_DBUS],[
+ LIBVIRT_CHECK_PKG([DBUS], [dbus], [dbus-1], [1.0.0])
+
+ if test "$with_dbus" = "yes" ; then
+ old_CFLAGS="$CFLAGS"
+ old_LIBS="$CFLAGS"
+ CFLAGS="$CFLAGS $DBUS_CFLAGS"
+ LIBS="$LIBS $DBUS_LIBS"
+ AC_CHECK_FUNCS([dbus_watch_get_unix_fd])
+ CFLAGS="$old_CFLAGS"
+ LIBS="$old_LIBS"
+ fi
+])
+
+AC_DEFUN([LIBVIRT_RESULT_DBUS],[
+ LIBVIRT_RESULT_LIB([DBUS], [dbus])
+])
--
1.7.11.4