[libvirt] [PATCH] build: fix broken mingw cross-compilation

Eric Blake eblake at redhat.com
Fri Feb 18 19:08:41 UTC 2011


Two regressions:
Commit df1011ca broke builds for systems that lack devmapper
(non-Linux, as well as Linux with ./autogen.sh --without-libvirtd
and without the libraries present).
Commit ce6fd650 broke cross-compilation, due to a gnulib bug.

* .gnulib: Update to latest, for cross-compilation fix.
* src/util/util.c (virIsDevMapperDevice): Provide stub for
platforms not using storage driver.
* configure.ac (devmapper): Arrange to define HAVE_LIBDEVMAPPER_H.
devmapper issue reported by Wen Congyang.
---

Thankfully, neither regression was in the 0.8.7 release.

Pushing this under the build-breaker rule, as verified by
./autobuild.sh.

* .gnulib aa0f5d7...17adb5d (9):
  > longlong: skip, rather than fail, on cross-compilation
  > * NEWS: Mention 2011-02-08 change to stdlib.
  > getloadavg: Add comments about platforms.
  > getloadavg: Fix link error on Solaris 2.6.
  > * lib/getloadavg.c (getloadavg) [sgi]: Make ldav_off of type ptrdiff_t.
  > Oops, fix syntax error in last config.rpath commit.
  > havelib: Fix comments.
  > havelib: Update config.rpath.
  > getloadavg test: Add some plausibility checks.

 .gnulib         |    2 +-
 configure.ac    |    2 +-
 src/util/util.c |   11 ++++++++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/.gnulib b/.gnulib
index aa0f5d7..17adb5d 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit aa0f5d7586efe7044f6ca9e07be3f579ee0d5618
+Subproject commit 17adb5d75404cf6cdde0eb3b2edc6110d9fa8001
diff --git a/configure.ac b/configure.ac
index f79babb..2b26e57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1711,12 +1711,12 @@ if test "$with_storage_mpath" = "yes"; then
      save_LIBS="$LIBS"
      save_CFLAGS="$CFLAGS"
      DEVMAPPER_FOUND=yes
-     AC_CHECK_HEADER([libdevmapper.h],,[DEVMAPPER_FOUND=no])
      AC_CHECK_LIB([devmapper], [dm_task_run],,[DEVMAPPER_FOUND=no])
      DEVMAPPER_LIBS="-ldevmapper"
      LIBS="$save_LIBS"
      CFLAGS="$save_CFLAGS"
    fi
+   AC_CHECK_HEADERS([libdevmapper.h],,[DEVMAPPER_FOUND=no])
    if test "$DEVMAPPER_FOUND" = "no" ; then
      AC_MSG_ERROR([You must install device-mapper-devel/libdevmapper >= $DEVMAPPER_REQUIRED to compile libvirt])
    fi
diff --git a/src/util/util.c b/src/util/util.c
index a7ce4b3..cbdae67 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -45,7 +45,9 @@
 #include <string.h>
 #include <signal.h>
 #include <termios.h>
-#include <libdevmapper.h>
+#if HAVE_LIBDEVMAPPER_H
+# include <libdevmapper.h>
+#endif
 #include "c-ctype.h"

 #ifdef HAVE_PATHS_H
@@ -3125,6 +3127,7 @@ virTimestamp(void)
     return timestamp;
 }

+#if HAVE_LIBDEVMAPPER_H
 bool
 virIsDevMapperDevice(const char *devname)
 {
@@ -3137,3 +3140,9 @@ virIsDevMapperDevice(const char *devname)

     return false;
 }
+#else
+bool virIsDevMapperDevice(const char *devname ATTRIBUTE_UNUSED)
+{
+    return false;
+}
+#endif
-- 
1.7.4




More information about the libvir-list mailing list