[libvirt] libvirt cannot be built with -Werror on RHEL6RC(x86_64)

Eric Blake eblake at redhat.com
Thu May 12 15:02:56 UTC 2011


On 05/12/2011 05:58 AM, Eric Blake wrote:
>> +++ b/configure.ac
>> @@ -638,7 +638,10 @@ if test "$with_libvirtd" = "no" ; then
>>    with_lxc=no
>>  fi
>>  if test "$with_lxc" = "yes" || test "$with_lxc" = "check"; then
>> -    AC_TRY_LINK([#define _GNU_SOURCE
>> +    AC_TRY_LINK([
>> +        #ifndef _GNU_SOURCE
>> +        #define _GNU_SOURCE
>> +        #endif
>>          #include <sched.h>
> 
> This hunk might be worthwhile; I'll look into it more later today.

Here, the problem was that gl_INIT already AC_DEFINE'd _GNU_SOURCE, but
with a value of 1.  It's actually an error to redefine a macro if the
redefinition is not to the identical value, but since it guaranteed to
already be defined, we can simplify your patch.  I'm pushing this
simpler fix in your name:

From 1ba6e2d926dadd6267084fe0b27209ba6c1099ff Mon Sep 17 00:00:00 2001
From: Wen Congyang <wency at cn.fujitsu.com>
Date: Thu, 12 May 2011 17:55:43 +0800
Subject: [PATCH] build: avoid compiler warning during configure

There is no need to redefine _GNU_SOURCE in tests that occur after
gl_INIT, since that macro already AC_DEFINE'd it for us.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 71c4968..a2ce97e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -638,7 +638,7 @@ if test "$with_libvirtd" = "no" ; then
   with_lxc=no
 fi
 if test "$with_lxc" = "yes" || test "$with_lxc" = "check"; then
-    AC_TRY_LINK([#define _GNU_SOURCE
+    AC_TRY_LINK([
         #include <sched.h>
     ], [
         unshare (1);
-- 
1.7.4.4



-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110512/94c20776/attachment-0001.sig>


More information about the libvir-list mailing list