[PATCH] (#2) Configure: Check for libuuid

Formatting is perfect. Will review later and provide feedback. Sharad Mishra Open Virtualization Linux Technology Center IBM libvirt-cim-bounces@redhat.com wrote on 05/09/2011 01:14:42 PM:
"Eduardo Lima \(Etrunko\)" <eblima@linux.vnet.ibm.com> Sent by: libvirt-cim-bounces@redhat.com
05/09/2011 01:14 PM
Please respond to List for discussion and development of libvirt CIM <libvirt-cim@redhat.com>
To
libvirt-cim@redhat.com
cc
Subject
[Libvirt-cim] [PATCH] (#2) Configure: Check for libuuid
# HG changeset patch # User Eduardo Lima (Etrunko) <eblima@br.ibm.com> # Date 1304971973 10800 # Node ID 8ec3cf0d005f5325cfd408c986853b3489404233 # Parent 8b428df21c360d1eaedba7157b0dfd429d2db121 Configure: Check for libuuid
This patch introduces a macro in acinclude.m4 to check for libuuid development files and fixes the build accordingly.
Changes from v1: Added specific check for libuuid version < 1.41.2
diff -r 8b428df21c36 -r 8ec3cf0d005f acinclude.m4 --- a/acinclude.m4 Wed Apr 13 12:27:33 2011 -0700 +++ b/acinclude.m4 Mon May 09 17:12:53 2011 -0300 @@ -238,10 +238,29 @@ AC_DEFUN([CHECK_LIBVIRT], [ PKG_CHECK_MODULES([LIBVIRT], [libvirt >= 0.3.2]) + AC_SUBST([LIBVIRT_CFLAGS]) + AC_SUBST([LIBVIRT_LIBS]) CPPFLAGS="$CPPFLAGS $LIBVIRT_CFLAGS" LDFLAGS="$LDFLAGS $LIBVIRT_LIBS" ])
+AC_DEFUN([CHECK_LIBUUID], + [ + PKG_CHECK_MODULES([LIBUUID], [uuid >= 1.41.2], [LIBUUID_FOUND=yes], [LIBUUID_FOUND=no]) + if test "$LIBUUID_FOUND" = "no" ; then + PKG_CHECK_MODULES([LIBUUID], [uuid], [LIBUUID_FOUND=yes], [LIBUUID_FOUND=no]) + if test "$LIBUUID_FOUND" = "no" ; then + AC_MSG_ERROR([libuuid development files required]) + else + LIBUUID_CFLAGS+=" -I$(pkg-config -- variable=includedir uuid)/uuid " + fi + fi + AC_SUBST([LIBUUID_CFLAGS]) + AC_SUBST([LIBUUID_LIBS]) + CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS" + LDFLAGS="$LDFLAGS $LIBUUID_LIBS" + ]) + # A convenience macro that spits out a fail message for a particular test # # AC_CHECK_FAIL($LIBNAME,$PACKAGE_SUGGEST,$URL,$EXTRA) diff -r 8b428df21c36 -r 8ec3cf0d005f configure.ac --- a/configure.ac Wed Apr 13 12:27:33 2011 -0700 +++ b/configure.ac Mon May 09 17:12:53 2011 -0300 @@ -148,10 +148,14 @@ # Check for presense of a CIM server (this macro is defined in acinclude.m4) CHECK_CIMSERVER
+# Check pkg-config program +PKG_PROG_PKG_CONFIG + # Check for presence of libraries CHECK_LIBVIRT CHECK_LIBXML2 CHECK_LIBCU +CHECK_LIBUUID
CFLAGS_STRICT="-Werror"
diff -r 8b428df21c36 -r 8ec3cf0d005f libxkutil/Makefile.am --- a/libxkutil/Makefile.am Wed Apr 13 12:27:33 2011 -0700 +++ b/libxkutil/Makefile.am Mon May 09 17:12:53 2011 -0300 @@ -1,7 +1,6 @@ # Copyright IBM Corp. 2007 SUBDIRS = tests
- CFLAGS += $(CFLAGS_STRICT)
noinst_HEADERS = cs_util.h misc_util.h device_parsing.h xmlgen.h infostore.h \ @@ -9,14 +8,14 @@
lib_LTLIBRARIES = libxkutil.la
-AM_LDFLAGS = -lvirt -luuid - libxkutil_la_SOURCES = cs_util_instance.c misc_util.c device_parsing.c \ xmlgen.c infostore.c pool_parsing.c
+libxkutil_la_LIBADD = @LIBVIRT_LIBS@ \ + @LIBUUID_LIBS@ + noinst_PROGRAMS = xml_parse_test
xml_parse_test_SOURCES = xml_parse_test.c -xml_parse_test_LDADD = -lvirt -xml_parse_test_LDFLAGS = libxkutil.la -xml_parse_test_DEPENDENCIES = libxkutil.la +xml_parse_test_LDADD = libxkutil.la \ + @LIBVIRT_LIBS@ diff -r 8b428df21c36 -r 8ec3cf0d005f libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Wed Apr 13 12:27:33 2011 -0700 +++ b/libxkutil/xmlgen.c Mon May 09 17:12:53 2011 -0300 @@ -22,7 +22,7 @@ #include <string.h> #include <stdlib.h> #include <inttypes.h> -#include <uuid/uuid.h> +#include <uuid.h>
#include <libxml/tree.h> #include <libxml/xmlsave.h> diff -r 8b428df21c36 -r 8ec3cf0d005f src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Wed Apr 13 12:27:33 2011 -0700 +++ b/src/Virt_SettingsDefineCapabilities.c Mon May 09 17:12:53 2011 -0300 @@ -26,7 +26,7 @@ #include <stdbool.h> #include <sys/vfs.h> #include <errno.h> -#include <uuid/uuid.h> +#include <uuid.h>
#include <libvirt/libvirt.h>
diff -r 8b428df21c36 -r 8ec3cf0d005f src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Wed Apr 13 12:27:33 2011 -0700 +++ b/src/Virt_VSMigrationService.c Mon May 09 17:12:53 2011 -0300 @@ -29,7 +29,7 @@ #include <dirent.h> #include <errno.h>
-#include <uuid/uuid.h> +#include <uuid.h>
#include <libvirt/libvirt.h>
diff -r 8b428df21c36 -r 8ec3cf0d005f src/Virt_VirtualSystemSnapshotService.c --- a/src/Virt_VirtualSystemSnapshotService.c Wed Apr 13 12:27:33 2011 -0700 +++ b/src/Virt_VirtualSystemSnapshotService.c Mon May 09 17:12:53 2011 -0300 @@ -24,7 +24,7 @@ #include <string.h> #include <stdbool.h>
-#include <uuid/uuid.h> +#include <uuid.h>
#include <cmpidt.h> #include <cmpift.h> _______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

Eduardo, Good work. Few minor issues. All patches should have the line "Signed-off-by:" There are a couple of lines longer than 80 characters, we need to limit them to 79 or less. Thanks Sharad Mishra Open Virtualization Linux Technology Center IBM libvirt-cim-bounces@redhat.com wrote on 05/09/2011 01:14:42 PM:
"Eduardo Lima \(Etrunko\)" <eblima@linux.vnet.ibm.com> Sent by: libvirt-cim-bounces@redhat.com
05/09/11 01:14 PM
Please respond to List for discussion and development of libvirt CIM <libvirt-cim@redhat.com>
To
libvirt-cim@redhat.com
cc
Subject
[Libvirt-cim] [PATCH] (#2) Configure: Check for libuuid
# HG changeset patch # User Eduardo Lima (Etrunko) <eblima@br.ibm.com> # Date 1304971973 10800 # Node ID 8ec3cf0d005f5325cfd408c986853b3489404233 # Parent 8b428df21c360d1eaedba7157b0dfd429d2db121 Configure: Check for libuuid
This patch introduces a macro in acinclude.m4 to check for libuuid development files and fixes the build accordingly.
Changes from v1: Added specific check for libuuid version < 1.41.2
diff -r 8b428df21c36 -r 8ec3cf0d005f acinclude.m4 --- a/acinclude.m4 Wed Apr 13 12:27:33 2011 -0700 +++ b/acinclude.m4 Mon May 09 17:12:53 2011 -0300 @@ -238,10 +238,29 @@ AC_DEFUN([CHECK_LIBVIRT], [ PKG_CHECK_MODULES([LIBVIRT], [libvirt >= 0.3.2]) + AC_SUBST([LIBVIRT_CFLAGS]) + AC_SUBST([LIBVIRT_LIBS]) CPPFLAGS="$CPPFLAGS $LIBVIRT_CFLAGS" LDFLAGS="$LDFLAGS $LIBVIRT_LIBS" ])
+AC_DEFUN([CHECK_LIBUUID], + [ + PKG_CHECK_MODULES([LIBUUID], [uuid >= 1.41.2], [LIBUUID_FOUND=yes], [LIBUUID_FOUND=no]) + if test "$LIBUUID_FOUND" = "no" ; then + PKG_CHECK_MODULES([LIBUUID], [uuid], [LIBUUID_FOUND=yes], [LIBUUID_FOUND=no]) + if test "$LIBUUID_FOUND" = "no" ; then + AC_MSG_ERROR([libuuid development files required]) + else + LIBUUID_CFLAGS+=" -I$(pkg-config -- variable=includedir uuid)/uuid " + fi + fi + AC_SUBST([LIBUUID_CFLAGS]) + AC_SUBST([LIBUUID_LIBS]) + CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS" + LDFLAGS="$LDFLAGS $LIBUUID_LIBS" + ]) + # A convenience macro that spits out a fail message for a particular test # # AC_CHECK_FAIL($LIBNAME,$PACKAGE_SUGGEST,$URL,$EXTRA) diff -r 8b428df21c36 -r 8ec3cf0d005f configure.ac --- a/configure.ac Wed Apr 13 12:27:33 2011 -0700 +++ b/configure.ac Mon May 09 17:12:53 2011 -0300 @@ -148,10 +148,14 @@ # Check for presense of a CIM server (this macro is defined in acinclude.m4) CHECK_CIMSERVER
+# Check pkg-config program +PKG_PROG_PKG_CONFIG + # Check for presence of libraries CHECK_LIBVIRT CHECK_LIBXML2 CHECK_LIBCU +CHECK_LIBUUID
CFLAGS_STRICT="-Werror"
diff -r 8b428df21c36 -r 8ec3cf0d005f libxkutil/Makefile.am --- a/libxkutil/Makefile.am Wed Apr 13 12:27:33 2011 -0700 +++ b/libxkutil/Makefile.am Mon May 09 17:12:53 2011 -0300 @@ -1,7 +1,6 @@ # Copyright IBM Corp. 2007 SUBDIRS = tests
- CFLAGS += $(CFLAGS_STRICT)
noinst_HEADERS = cs_util.h misc_util.h device_parsing.h xmlgen.h infostore.h \ @@ -9,14 +8,14 @@
lib_LTLIBRARIES = libxkutil.la
-AM_LDFLAGS = -lvirt -luuid - libxkutil_la_SOURCES = cs_util_instance.c misc_util.c device_parsing.c \ xmlgen.c infostore.c pool_parsing.c
+libxkutil_la_LIBADD = @LIBVIRT_LIBS@ \ + @LIBUUID_LIBS@ + noinst_PROGRAMS = xml_parse_test
xml_parse_test_SOURCES = xml_parse_test.c -xml_parse_test_LDADD = -lvirt -xml_parse_test_LDFLAGS = libxkutil.la -xml_parse_test_DEPENDENCIES = libxkutil.la +xml_parse_test_LDADD = libxkutil.la \ + @LIBVIRT_LIBS@ diff -r 8b428df21c36 -r 8ec3cf0d005f libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Wed Apr 13 12:27:33 2011 -0700 +++ b/libxkutil/xmlgen.c Mon May 09 17:12:53 2011 -0300 @@ -22,7 +22,7 @@ #include <string.h> #include <stdlib.h> #include <inttypes.h> -#include <uuid/uuid.h> +#include <uuid.h>
#include <libxml/tree.h> #include <libxml/xmlsave.h> diff -r 8b428df21c36 -r 8ec3cf0d005f src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Wed Apr 13 12:27:33 2011 -0700 +++ b/src/Virt_SettingsDefineCapabilities.c Mon May 09 17:12:53 2011 -0300 @@ -26,7 +26,7 @@ #include <stdbool.h> #include <sys/vfs.h> #include <errno.h> -#include <uuid/uuid.h> +#include <uuid.h>
#include <libvirt/libvirt.h>
diff -r 8b428df21c36 -r 8ec3cf0d005f src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Wed Apr 13 12:27:33 2011 -0700 +++ b/src/Virt_VSMigrationService.c Mon May 09 17:12:53 2011 -0300 @@ -29,7 +29,7 @@ #include <dirent.h> #include <errno.h>
-#include <uuid/uuid.h> +#include <uuid.h>
#include <libvirt/libvirt.h>
diff -r 8b428df21c36 -r 8ec3cf0d005f src/Virt_VirtualSystemSnapshotService.c --- a/src/Virt_VirtualSystemSnapshotService.c Wed Apr 13 12:27:33 2011 -0700 +++ b/src/Virt_VirtualSystemSnapshotService.c Mon May 09 17:12:53 2011 -0300 @@ -24,7 +24,7 @@ #include <string.h> #include <stdbool.h>
-#include <uuid/uuid.h> +#include <uuid.h>
#include <cmpidt.h> #include <cmpift.h> _______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

On 05/13/2011 11:41 AM, Sharad Mishra wrote:
Eduardo,
Good work. Few minor issues. All patches should have the line "Signed-off-by:" There are a couple of lines longer than 80 characters, we need to limit them to 79 or less.
Hi Sharad, I have fixed those issues and the new version has been already sent. Hope it's all ok now. Cheers, -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima@br.ibm.com
participants (2)
-
Eduardo Lima (Etrunko)
-
Sharad Mishra