build: avoid requiring -lm

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.
This commit is contained in:
Eric Blake
2011-07-11 17:22:20 -06:00
parent 00d3c5a603
commit df94811f71
3 changed files with 4 additions and 3 deletions

Submodule .gnulib updated: 56005a21e8...a918da4d61

View File

@@ -36,6 +36,7 @@ count-one-bits
crypto/md5
dirname-lgpl
fcntl-h
ffs
fnmatch
func
getaddrinfo

View 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;