Convert udev/pciaccess checks 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:34:13 +01:00
parent d3b05abfa9
commit 04ac20df3f
3 changed files with 62 additions and 53 deletions

View File

@ -100,8 +100,6 @@ LIBXML_REQUIRED="2.6.0"
GNUTLS_REQUIRED="1.0.25"
POLKIT_REQUIRED="0.6"
PARTED_REQUIRED="1.8.0"
UDEV_REQUIRED=145
PCIACCESS_REQUIRED=0.10.0
XMLRPC_REQUIRED=1.14.0
HAL_REQUIRED=0.5.0
DEVMAPPER_REQUIRED=1.0.0
@ -159,9 +157,11 @@ LIBVIRT_CHECK_CAPNG
LIBVIRT_CHECK_DBUS
LIBVIRT_CHECK_NETCF
LIBVIRT_CHECK_NUMACTL
LIBVIRT_CHECK_PCIACCESS
LIBVIRT_CHECK_SANLOCK
LIBVIRT_CHECK_SASL
LIBVIRT_CHECK_SELINUX
LIBVIRT_CHECK_UDEV
LIBVIRT_CHECK_YAJL
AC_MSG_CHECKING([for CPUID instruction])
@ -2300,52 +2300,6 @@ AC_SUBST([HAL_CFLAGS])
AC_SUBST([HAL_LIBS])
dnl udev/libpciaccess library check for alternate host device enumeration
UDEV_CFLAGS=
UDEV_LIBS=
PCIACCESS_CFLAGS=
PCIACCESS_LIBS=
AC_ARG_WITH([udev],
AC_HELP_STRING([--with-udev], [use libudev for host device enumeration @<:@default=check@:>@]),
[],
[with_udev=check])
if test "$with_libvirtd" = "no" ; then
with_udev=no
fi
if test "x$with_udev" = "xyes" || test "x$with_udev" = "xcheck"; then
PKG_CHECK_MODULES(UDEV, libudev >= $UDEV_REQUIRED,
[], [
if test "x$with_udev" = "xcheck" ; then
with_udev=no
else
AC_MSG_ERROR(
[You must install libudev-devel >= $UDEV_REQUIRED to compile libvirt])
fi
])
if test "x$with_udev" != "xno"; then
PKG_CHECK_MODULES(PCIACCESS, pciaccess >= $PCIACCESS_REQUIRED,
[with_udev=yes],
[
if test "x$with_udev" = "xcheck" ; then
with_udev=no
else
AC_MSG_ERROR(
[You must install libpciaccess-devel >= $PCIACCESS_REQUIRED to compile libvirt])
fi
])
fi
if test "x$with_udev" = "xyes" ; then
AC_DEFINE_UNQUOTED([WITH_UDEV], 1,
[use UDEV for host device enumeration])
fi
fi
AM_CONDITIONAL([WITH_UDEV], [test "x$with_udev" = "xyes"])
AC_SUBST([UDEV_CFLAGS])
AC_SUBST([UDEV_LIBS])
AC_SUBST([PCIACCESS_CFLAGS])
AC_SUBST([PCIACCESS_LIBS])
with_nodedev=no;
if test "$with_hal" = "yes" || test "$with_udev" = "yes";
then
@ -2666,9 +2620,11 @@ LIBVIRT_RESULT_CAPNG
LIBVIRT_RESULT_DBUS
LIBVIRT_RESULT_NETCF
LIBVIRT_RESULT_NUMACTL
LIBVIRT_RESULT_PCIACCESS
LIBVIRT_RESULT_SANLOCK
LIBVIRT_RESULT_SASL
LIBVIRT_RESULT_SELINUX
LIBVIRT_RESULT_UDEV
LIBVIRT_RESULT_YAJL
AC_MSG_NOTICE([ libxml: $LIBXML_CFLAGS $LIBXML_LIBS])
AC_MSG_NOTICE([ dlopen: $DLOPEN_LIBS])
@ -2727,11 +2683,6 @@ AC_MSG_NOTICE([ hal: $HAL_CFLAGS $HAL_LIBS])
else
AC_MSG_NOTICE([ hal: no])
fi
if test "$with_udev" = "yes" ; then
AC_MSG_NOTICE([ udev: $UDEV_CFLAGS $UDEV_LIBS $PCIACCESS_CFLAGS $PCIACCESS_LIBS])
else
AC_MSG_NOTICE([ udev: no])
fi
if test "$with_qemu" = "yes" && test "$LIBPCAP_FOUND" != "no"; then
AC_MSG_NOTICE([ pcap: $LIBPCAP_CFLAGS $LIBPCAP_LIBS])
else

26
m4/virt-pciaccess.m4 Normal file
View File

@ -0,0 +1,26 @@
dnl The libpciaccess.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_PCIACCESS],[
LIBVIRT_CHECK_PKG([PCIACCESS], [pciaccess], [0.10.0])
])
AC_DEFUN([LIBVIRT_RESULT_PCIACCESS],[
LIBVIRT_RESULT_LIB([PCIACCESS])
])

32
m4/virt-udev.m4 Normal file
View File

@ -0,0 +1,32 @@
dnl The libudev.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_UDEV],[
AC_REQUIRE([LIBVIRT_CHECK_PCIACCESS])
LIBVIRT_CHECK_PKG([UDEV], [libudev], [145])
if test "$with_udev" = "yes" && test "$with_pciaccess" != "yes" ; then
AC_MSG_ERROR([You must install the pciaccesss module to build with udev])
fi
])
AC_DEFUN([LIBVIRT_RESULT_UDEV],[
AC_REQUIRE([LIBVIRT_RESULT_PCIACCESS])
LIBVIRT_RESULT_LIB([UDEV])
])