From: "Daniel P. Berrange" <berra...@redhat.com>

Signed-off-by: Daniel P. Berrange <berra...@redhat.com>
---
 configure.ac    | 34 ++--------------------------------
 m4/virt-dbus.m4 | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 32 deletions(-)
 create mode 100644 m4/virt-dbus.m4

diff --git a/configure.ac b/configure.ac
index 2893c7b..8a5a513 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"
 FUSE_REQUIRED="2.8.6"
 
 dnl Checks for C compiler.
@@ -157,6 +156,7 @@ LIBVIRT_COMPILE_WARNINGS
 LIBVIRT_CHECK_APPARMOR
 LIBVIRT_CHECK_AUDIT
 LIBVIRT_CHECK_CAPNG
+LIBVIRT_CHECK_DBUS
 LIBVIRT_CHECK_NETCF
 LIBVIRT_CHECK_NUMACTL
 LIBVIRT_CHECK_SANLOCK
@@ -1094,37 +1094,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 "$with_dbus" = "yes"])
-
-
 dnl PolicyKit library
 POLKIT_CFLAGS=
 POLKIT_LIBS=
@@ -2719,6 +2688,7 @@ AC_MSG_NOTICE([])
 LIBVIRT_RESULT_APPARMOR
 LIBVIRT_RESULT_AUDIT
 LIBVIRT_RESULT_CAPNG
+LIBVIRT_RESULT_DBUS
 LIBVIRT_RESULT_NETCF
 LIBVIRT_RESULT_NUMACTL
 LIBVIRT_RESULT_SANLOCK
diff --git a/m4/virt-dbus.m4 b/m4/virt-dbus.m4
new file mode 100644
index 0000000..16cb864
--- /dev/null
+++ b/m4/virt-dbus.m4
@@ -0,0 +1,36 @@
+dnl The libdbus.so library
+dnl
+dnl Copyright (C) 2012-2013 Red Hat, Inc.
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library.  If not, see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
+AC_DEFUN([LIBVIRT_CHECK_DBUS],[
+  LIBVIRT_CHECK_PKG([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])
+])
-- 
1.7.11.7

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to