[libvirt] [PATCH] build: avoid requiring -lm

Eric Blake eblake at redhat.com
Mon Jul 11 23:29:24 UTC 2011


log2() is heavy when ffs() can do the same thing.  But ffs()
requires gnulib support for mingw.

* .gnulib: Update to latest, for ffs.
* bootstrap.conf (gnulib_modules): Import ffs.
* src/conf/domain_conf.c (virDomainDefParseXML): Use ffs instead
of log2.
Reported by Dave Allan.
---

Pushing under the build-breaker rule, as I reproduced the log2
failure on F14.

* .gnulib 56005a2...a918da4 (28):
  > ffs: new module
  > * ChangeLog: Fix typo.
  > regex: avoid compiler warning
  > stdint: respect system's intmax_t if INTMAX_MAX
  > pthread_sigmask tests: Avoid a compiler warning.
  > sigprocmask tests: A better way to avoid a compiler warning.
  > pthread_sigmask: Work around IRIX bug.
  > pthread_sigmask: Work around Cygwin bug.
  > pthread_sigmask: Work around bug in single-threaded implementation.
  > test-sigprocmask: avoid compiler warning
  > test-snprintf: avoid compiler warning
  > Tests for module 'pthread_sigmask'.
  > test-getopt.h: avoid warning about an unused variable
  > maint: reduce list of files exempt from sc_prohibit_leading_TABs
  > pthread_sigmask: Assume POSIX when not gl_THREADLIB.
  > pthread_sigmask: fix typo when testing for libraries
  > fts: introduce FTS_NOATIME
  > Tests for module 'thread'.
  > thread: Avoid gcc warnings when using gl_thread_self().
  > signal-c++-tests: Check declaration of pthread_sigmask.
  > pthread_sigmask: Fix link requirements on OSF/1 5.1 and with pth.
  > pthread_sigmask: Ensure declaration in <signal.h> also on Solaris 2.6.
  > pthread_sigmask: Ensure declaration in <signal.h>.
  > pthread_sigmask: Document the module.
  > pthread_sigmask: Follow gnulib conventions.
  > pthread_sigmask: Make declaration C++ safe.
  > pthread_sigmask: Fix return value.
  > getopt: more portable argv creation

 .gnulib                |    2 +-
 bootstrap.conf         |    1 +
 src/conf/domain_conf.c |    4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/.gnulib b/.gnulib
index 56005a2..a918da4 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 56005a21e8f9f434212a19dcb628c6d3b179fd08
+Subproject commit a918da4d61d28be61a12605c9d35e2cf3966d866
diff --git a/bootstrap.conf b/bootstrap.conf
index a800534..3c3d0e0 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -36,6 +36,7 @@ count-one-bits
 crypto/md5
 dirname-lgpl
 fcntl-h
+ffs
 fnmatch
 func
 getaddrinfo
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3cf7f44..d75a266 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -29,7 +29,7 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <sys/time.h>
-#include <math.h>
+#include <strings.h>

 #include "virterror_internal.h"
 #include "datatypes.h"
@@ -5865,7 +5865,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
             virDomainReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("unexpected domain type %s, expecting %s"),
                                  virDomainVirtTypeToString(def->virtType),
-                                 virDomainVirtTypeToString(log2(expectedVirtTypes)));
+                                 virDomainVirtTypeToString(ffs(expectedVirtTypes) - 1));
         } else {
             virBuffer buffer = VIR_BUFFER_INITIALIZER;
             char *string;
-- 
1.7.4.4




More information about the libvir-list mailing list