[Libvirt-cim] [PATCH] Build changes for new libcmpiutil header placement

Dan Smith danms at us.ibm.com
Fri Oct 26 20:36:30 UTC 2007


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1193430866 25200
# Node ID aaad430ea766d9a3bc0be035e595d8da17ee2122
# Parent  239f76be94c5fbf730a315408af156c3b0b0d092
Build changes for new libcmpiutil header placement
This attempts to find libcmpiutil by pkg-config, but falls back on
looking in some of the normal locations.

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r 239f76be94c5 -r aaad430ea766 acinclude.m4
--- a/acinclude.m4	Fri Oct 26 09:15:15 2007 -0700
+++ b/acinclude.m4	Fri Oct 26 13:34:26 2007 -0700
@@ -258,7 +258,45 @@ AC_DEFUN([CHECK_LIBXML2],
 	fi 
 	]
 )
-                                                               
+
+AC_DEFUN([_CHECK_LIBCU_PC],
+	[
+	if pkg-config --exists libcmpiutil; then
+		CPPFLAGS="$CPPFLAGS `pkg-config --cflags libcmpiutil`"
+		LDFLAGS="$LDFLAGS `pkg-config --libs libcmpiutil`"
+		found_libcu=yes
+	fi
+	]
+)
+
+AC_DEFUN([_CHECK_LIBCU_NOPC],
+	[
+	DIRS="/usr /usr/local"
+	for dir in $DIRS; do
+		if test -f "${dir}/include/libcmpiutil/libcmpiutil.h"; then
+			CPPFLAGS="$CPPFLAGS -I${dir}/include/libcmpiutil"
+			LDFLAGS="$LDFLAGS -lcmpiutil -L${dir}/lib"
+			found_libcu=yes
+		fi
+	done
+	]
+)
+
+AC_DEFUN([CHECK_LIBCU],
+	[
+	_CHECK_LIBCU_PC
+	if test "x$found_libcu" != "xyes"; then
+		_CHECK_LIBCU_NOPC
+	fi
+	AC_CHECK_LIB(cmpiutil, cu_check_args, [], [
+		     AC_MSG_ERROR(libcmpiutil not found)
+                     ])
+	AC_CHECK_HEADER([libcmpiutil.h], [], [
+                        AC_MSG_ERROR([libcmpiutil.h not found])
+		     ])
+	]
+)
+
 dnl
 dnl The check for the libvirt library
 dnl Sets the LIBVIRTDIR variable
diff -r 239f76be94c5 -r aaad430ea766 configure.ac
--- a/configure.ac	Fri Oct 26 09:15:15 2007 -0700
+++ b/configure.ac	Fri Oct 26 13:34:26 2007 -0700
@@ -133,10 +133,7 @@ fi
 
 CFLAGS_STRICT="-Werror"
 
-AC_CHECK_LIB(cmpiutil, cu_check_args, [], [
-		       echo "libcmpiutil not found"
-		       exit 1
-		       ])
+CHECK_LIBCU
 
 AC_ARG_ENABLE([werror],
     [  --enable-werror         enable werror on builds [[default=yes]]],




More information about the Libvirt-cim mailing list