Convert DBus check to use LIBVIRT_CHECK_PKG

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2012-09-20 15:12:08 +01:00
parent da77f04ed5
commit 832d140930
2 changed files with 38 additions and 32 deletions

View File

@ -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

36
m4/virt-dbus.m4 Normal file
View File

@ -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])
])