[PATCH] Build changes for new libcmpiutil header placement

# HG changeset patch # User Dan Smith <danms@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@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]]],

On Fri, Oct 26, 2007 at 01:36:30PM -0700, Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@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@us.ibm.com>
I ended up with a different version in my attempt to package libvirt-cim with RPM by adding the following to configure.ac: diff -r 239f76be94c5 configure.ac --- a/configure.ac Fri Oct 26 09:15:15 2007 -0700 +++ b/configure.ac Fri Oct 26 23:11:23 2007 +0200 @@ -89,6 +89,9 @@ AC_CHECK_HEADERS([stdlib.h string.h unis # Check if the system headers conform to ANSI C AC_HEADER_STDC +dnl Need to test if pkg-config exists +PKG_PROG_PKG_CONFIG + # Check for specific add on libraries that we know we'll need # - libuuid #AC_CHECK_LIB([uuid], [uuid_generate], [have_uuid=yes], [ @@ -133,10 +136,15 @@ fi CFLAGS_STRICT="-Werror" -AC_CHECK_LIB(cmpiutil, cu_check_args, [], [ - echo "libcmpiutil not found" - exit 1 - ]) + +if test "x$PKG_CONFIG" != "x" ; then + PKG_CHECK_MODULES(LIBCMPIUTIL, libcmpiutil, ,exit) +else + AC_CHECK_LIB(cmpiutil, cu_check_args, [], [ + echo "libcmpiutil not found" + exit 1 + ]) +fi AC_ARG_ENABLE([werror], [ --enable-werror enable werror on builds [[default=yes]]], --------------------------------- and then adding references to $(LIBCMPIUTIL_LIBS) and $(LIBCMPIUTIL_CFLAGS) to src/Makefile.am and libxkutil/Makefile.am ... No idea what you would prefer, yours is probably more complete ... BTW concerning the werror, I get the following on Fedora 7 which should probably be fixed :-) gcc -DHAVE_CONFIG_H -I. -I.. -DCMPI_VERSION=100 -I/usr/include/cmpi -I/usr/include/libxml2 -I/usr/include/libvirt -g -O2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -Wall -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wformat=2 -Wformat-security -Wformat-nonliteral -Wno-format-y2k -Wcast-align -Wno-unused-value -I/usr/include/libcmpiutil -I../libxkutil -Werror -c Virt_DevicePool.c -fPIC -DPIC -o .libs/Virt_DevicePool.o cc1: warnings being treated as errors Virt_DevicePool.c: In function 'netpool_member_of': Virt_DevicePool.c:73: warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result make[3]: *** [Virt_DevicePool.lo] Error 1 make[3]: Leaving directory `/u/veillard/libvirt-cim/src' Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Fri, Oct 26, 2007 at 05:16:06PM -0400, Daniel Veillard wrote:
On Fri, Oct 26, 2007 at 01:36:30PM -0700, Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@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@us.ibm.com>
I ended up with a different version in my attempt to package libvirt-cim with RPM by adding the following to configure.ac:
Okay, please use yours, mine was broken ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

DV> +PKG_PROG_PKG_CONFIG Hmm, I'm not sure where PKG_* comes from... DV> No idea what you would prefer, yours is probably more complete ... I tested mine with several scenarios, so I'll commit mine for now. If I can find where PKG_* is, then I think I should tweak my pkg-config case to use those if possible. DV> BTW concerning the werror, I get the following on Fedora 7 which DV> should probably be fixed :-) DV> Virt_DevicePool.c:73: warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result Ooops, thanks for catching that. I'll cook up a fix. Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com
participants (2)
-
Dan Smith
-
Daniel Veillard