# HG changeset patch
# User Eduardo Lima (Etrunko)<eblima(a)br.ibm.com>
# Date 1310149559 10800
# Node ID 2823d4e157125fc47668a9f0d6ef2f52e52169ce
# Parent 395f2d684c1046455462db7e4e87d30e7aae0feb
Make libconfig requirement optional
libconfig is a required to build libvirt-cim since r1104, but the
package is not included in RHEL 5, which we still support. This patch
enables libvirt-cim to be built even if libconfig is not found.
Note that it will not be possible for users of that distro to configure
libvirt-cim to operate in read-only mode.
Signed-off-by: Eduardo Lima (Etrunko)<eblima(a)br.ibm.com>
diff --git a/acinclude.m4 b/acinclude.m4
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -272,7 +272,11 @@
AC_DEFUN([CHECK_LIBCONFIG],
[
- PKG_CHECK_MODULES([LIBCONFIG], [libconfig])
+ PKG_CHECK_MODULES([LIBCONFIG], [libconfig],
+ [LIBCONFIG_FOUND=yes], [LIBCONFIG_FOUND=no])
+ if test "$LIBCONFIG_FOUND" = "yes" ; then
+ AC_DEFINE(HAVE_LIBCONFIG, 1, [Define if libconfig development files were
found])
+ fi
AC_SUBST([LIBCONFIG_CFLAGS])
AC_SUBST([LIBCONFIG_LIBS])
CPPFLAGS="$CPPFLAGS $LIBCONFIG_CFLAGS"
diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in
--- a/libvirt-cim.spec.in
+++ b/libvirt-cim.spec.in
@@ -22,11 +22,11 @@
BuildRequires: e2fsprogs-devel
%else
BuildRequires: libuuid-devel
+BuildRequires: libconfig-devel
%endif
BuildRequires: libxml2-devel
BuildRequires: libcmpiutil-devel
-BuildRequires: libconfig-devel
BuildConflicts: sblim-cmpi-devel
%description
diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c
--- a/libxkutil/misc_util.c
+++ b/libxkutil/misc_util.c
@@ -20,6 +20,8 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "config.h"
+
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
@@ -35,12 +37,14 @@
#include<libcmpiutil/libcmpiutil.h>
#include<libcmpiutil/std_association.h>
+
+#ifdef HAVE_LIBCONFIG
#include<libconfig.h>
+#endif
#include "misc_util.h"
#include "cs_util.h"
-#include "config.h"
#define URI_ENV "HYPURI"
@@ -58,8 +62,11 @@
static int is_read_only(void)
{
+ int readonly = 0;
+
+#ifdef HAVE_LIBCONFIG
config_t conf;
- int ret, readonly = 0;
+ int ret;
const char *readonly_str = "readonly";
config_init(&conf);
@@ -82,6 +89,7 @@
LIBVIRTCIM_CONF, readonly);
out:
config_destroy(&conf);
+#endif
/* Default value is 0 (false) */
return readonly;
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Chip Vincent
Open Virtualization
IBM Linux Technology Center
cvincent(a)linux.vnet.ibm.com