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

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

-- 
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Autoconf mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/autoconf

Reply via email to