bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_PROG_CC_C99 fails when configure with CFLAGS="-Werror -Wall"


From: Eric Blake
Subject: Re: AC_PROG_CC_C99 fails when configure with CFLAGS="-Werror -Wall"
Date: Mon, 10 Dec 2012 09:31:29 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

On 12/10/2012 05:25 AM, ChangZhuo Chen wrote:
> Hi,
> 
> There is a problem in autoconf that cannot use AC_PROG_CC_C99 to detect C99
> support when configure with CFLAGS="-Werror -Wall".

There's your problem right there.  We really do not recommend the use of
CFLAGS=-Werror during configuration, because it simply does not work.
There are just too many compiler variants out there, with too many
divergent definitions of what forms a warning, such that there is no
portable way to write configure tests that are warning-free on all
possible compilers.

Seriously - the recommendation on this list is that you never use
-Werror during configure (except maybe to temporarily probe whether
-Werror even works); it's okay to use -Werror during 'make', and even to
write a configure script that will auto-add -Werror when it works (in
fact, coreutils is a good example package that adds -Werror
automatically when you build from coreutils.git or when you use
./configure --enable-gcc-warnings).

> The attached patch can fix the problem by using the unused variables, but I
> am not sure if that is the correct way to do.

Thanks for the attempted patch.  It may still be worth doing something
for the patch, but using printf() as the way to silence an otherwise
unused variable warning is a bit too strong.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]