WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-cim

[Xen-cim] configure patch

To: xen-cim@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-cim] configure patch
From: Jim Fehlig <jfehlig@xxxxxxxxxx>
Date: Wed, 26 Apr 2006 18:14:54 -0600
Delivery-date: Wed, 26 Apr 2006 17:15:10 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-cim-request@lists.xensource.com?subject=help>
List-id: xen-cim mailing list <xen-cim.lists.xensource.com>
List-post: <mailto:xen-cim@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-cim>, <mailto:xen-cim-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-cim>, <mailto:xen-cim-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-cim-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)
Attached is a patch to look for libvirt and libxml2 during configure. configure will abort if either not found. It uses pkg-config or simply AC_CHECK_LIB if pkg-config is not available. Hmm, now that I think about it this patch is probably insufficient if pkg-config is not available since CFLAGS will not have proper include search paths.

I wanted to get people's thoughts on using pkg-config to look for required packages or is another approach preferred?

BTW, the libxml2 stuff will go away once we move exclusively to libvirt. I'm using it in libxm shim now to parse libvirt's xml into xm_config structure.

Thanks,
Jim
diff -r bdf24cd56bed Makefile.am
--- a/Makefile.am       Wed Apr 26 12:28:36 2006 -0600
+++ b/Makefile.am       Wed Apr 26 17:51:56 2006 -0600
@@ -89,7 +89,8 @@ noinst_HEADERS = \
 # libxm is the Xen API for the CMPI providers
 lib_LTLIBRARIES = libxm.la
 libxm_la_SOURCES = src/xm.c
-libxm_la_LIBADD = -lvirt -lxenstore
+libxm_la_CFLAGS = $(LIBXM_CFLAGS)
+libxm_la_LIBADD = $(LIBXM_LIBS)
 
 # LIST EACH PROVIDER LIBRARY, ITS SOURCE FILE(S), AND ANY LIBS REQUIRED 
 # FOR LINKING HERE
@@ -136,10 +137,6 @@ provider_LTLIBRARIES = \
        libXen_CSSettingDataComponent.la \
        libXen_ProcessorCapabilitiesSettingData.la \
        libXen_MemoryCapabilitiesSettingData.la
-
-#libxm_la_SOURCES = src/xm.c
-#libxm_la_LIBADD = -lxenstore -L/usr/local/lib -lvirt
-#libxm_la_CFLAGS = -I../
 
 libXen_ComputerSystem_la_SOURCES = src/Xen_ComputerSystem.c 
src/Xen_ComputerSystem_Resource.c src/cmpiutil.c src/cmpitrace.c
 libXen_ComputerSystem_la_LIBADD = $(COMMON_LIBS) #-lxenstore -luuid -lxm 
diff -r bdf24cd56bed configure.ac
--- a/configure.ac      Wed Apr 26 12:28:36 2006 -0600
+++ b/configure.ac      Wed Apr 26 17:51:56 2006 -0600
@@ -50,11 +50,35 @@ AC_CONFIG_FILES([sblim-cmpi-xen.spec])
 
 # Check for required header files
 # ADD CHECKS FOR ANY REQUIRED NON-CMPI HEADER FILES HERE
-AC_CHECK_HEADERS([stdarg.h errno.h xm.h])
+AC_CHECK_HEADERS([stdarg.h errno.h])
 
 # Check for required library functions
 # ADD CHECKS FOR ANY REQUIRED NON_CMPI LIBRARY FUNCTIONS HERE
 AC_CHECK_FUNCS([popen pclose fgets vfprintf fprintf sprintf sscanf])
+
+# Is pkg-config available?
+AC_CHECK_PROG([PKG_CONFIG], [pkg-config], [yes], [no])
+if test "x$PKG_CONFIG" = "xyes"; then
+   export 
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig"
+
+    LIBVIRT_MIN_VER=0.1.0
+    LIBXML2_MIN_VER=2.5.0
+    PKG_CHECK_MODULES([LIBVIRT], [libvirt >= $LIBVIRT_MIN_VER])
+    PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= $LIBXML2_MIN_VER])
+else
+    AC_CHECK_LIB([virt], [virConnectOpen],
+        [LIBVIRT_LIBS="-lvirt"], 
+       [AC_MSG_ERROR([virt library not found])],
+       [-lxenstore])
+    AC_CHECK_LIB([xml2], [xmlParseFile],
+        [LIBXML2_LIBS="-lxml2"], 
+       [AC_MSG_ERROR([xml2 library not found])])
+fi
+
+LIBXM_CFLAGS="$LIBVIRT_CFLAGS $LIBXML2_CFLAGS "
+LIBXM_LIBS="$LIBVIRT_LIBS $LIBXML2_LIBS "
+AC_SUBST([LIBXM_CFLAGS])
+AC_SUBST([LIBXM_LIBS])
 
 # Set compiler flag for CMPI API version compatibility
 # SET THE PACKAGE CMPI_VERSION HERE
_______________________________________________
Xen-cim mailing list
Xen-cim@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-cim
<Prev in Thread] Current Thread [Next in Thread>