autoconf
[Top][All Lists]
Advanced

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

Re: RFE: macro for warning at configure-time if CFLAGS includes -Werror


From: Adrian Bunk
Subject: Re: RFE: macro for warning at configure-time if CFLAGS includes -Werror
Date: Thu, 20 Sep 2012 00:33:36 +0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Sep 19, 2012 at 03:01:24PM -0600, Eric Blake wrote:
> I just helped someone debug an issue today where their configure run was
> getting weird results, because they had called './configure
> CFLAGS="-Wall -Werror -O0 -g"', and the -Werror was causing several
> tests to guess wrong.
> 
> This issue has repeatedly come up on this list, and our advice has
> always been "don't use -Werror during configure; save it for 'make'".
> In fact, we even have examples to point to on how to write a configure
> script that will probe whether -Werror works and add it automatically at
> make time without also polluting the rest of the configure run (such as
> via coreutils' ./configure --enable-gcc-warnings, coupled with
> Makefile.am snippets to add -Werror to AM_CFLAGS as appropriate).

That doesn't solve the problem of how to add -Werror when compiling the
typical autoconf-using software that does not have any specific warning
handling implemented.

> For packages that already take care to separate out -Werror handling,
> I'm thinking it might be worthwhile to have a macro that would emit a
> warning at ./configure time if CC is detected as gcc, and CFLAGS
> contains -Werror, since this usually won't have the desired results.  Of
> course, it would need to be a new macro (we don't want to change the
> behavior of configure to add a warning without explicit request by
> package maintainers), but it seems like something that enough packages
> would like to be worth including in the next autoconf release.  It seems
> like such a macro should be called after AC_PROG_CC (need to know if the
> compiler is gcc).
> 
> Thoughts?  Does my idea make sense?  What would a good macro name be?
> AC_PROG_CC_SUSPICIOUS_CFLAGS
> AC_PROG_CC_NO_WERROR

IMHO the best solution for both package maintainers and people compiling 
software would be:
- AC_PROG_CC always filters out -Werror
- when -Werror was filtered out, configure prints a message like
  "filtering out -Werror during configure"
- when -Werror was filtered out, AC_OUTPUT re-adds it

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed




reply via email to

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