]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: avoid requiring -lm
authorEric Blake <eblake@redhat.com>
Mon, 11 Jul 2011 23:22:20 +0000 (17:22 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 11 Jul 2011 23:32:11 +0000 (17:32 -0600)
log2() is heavy when ffs() can do the same thing.  But ffs()
requires gnulib support for mingw.

This patch solves this linker error on Fedora 14.

/usr/bin/ld: libvirt_lxc-domain_conf.o: undefined reference to symbol 'log2@@GLIBC_2.2.5'
/usr/bin/ld: note: 'log2@@GLIBC_2.2.5' is defined in DSO /lib64/libm.so.6 so try adding it to the linker command line
/lib64/libm.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status

* .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.

.gnulib
bootstrap.conf
src/conf/domain_conf.c

diff --git a/.gnulib b/.gnulib
index 56005a21e8f9f434212a19dcb628c6d3b179fd08..a918da4d61d28be61a12605c9d35e2cf3966d866 160000 (submodule)
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 56005a21e8f9f434212a19dcb628c6d3b179fd08
+Subproject commit a918da4d61d28be61a12605c9d35e2cf3966d866
index a800534908c335a04be75b066df3389f4e634a71..3c3d0e07deee7d6a309e113be571bacdb511e8b2 100644 (file)
@@ -36,6 +36,7 @@ count-one-bits
 crypto/md5
 dirname-lgpl
 fcntl-h
+ffs
 fnmatch
 func
 getaddrinfo
index 3cf7f4421712090ce1ec2ef32d5bb94d8544af06..d75a2669c11cd04247a377e692ea40519dabf36b 100644 (file)
@@ -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;