
On Wed, Sep 19, 2012 at 07:28:02PM -0300, Marcelo Cerri wrote:
Some tests performed by configure to check what is supported can be broken if -Werror is defined in CFLAGS variable when configure is executed.
This patch checks if CFLAGS contains -Werror and shows a warning for user recommending to use --enable-compile-warnings=error instead. ---
Please, note that this is a work in progress patch and suggestions are welcome.
configure.ac | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/configure.ac b/configure.ac index 3e90672..38d6263 100644 --- a/configure.ac +++ b/configure.ac @@ -3232,3 +3232,10 @@ AC_MSG_NOTICE([Privileges]) AC_MSG_NOTICE([]) AC_MSG_NOTICE([ QEMU: $QEMU_USER:$QEMU_GROUP]) AC_MSG_NOTICE([]) + +# -Werror can break some configure tests +if echo "$CFLAGS" | sed -e 's/\s\+/\n/g' | grep -E '^-Werror$' >/dev/null 2>&1; then + AC_MSG_WARN([CFLAGS contains -Werror flag. This might break some tests performed by]) + AC_MSG_WARN([configure and cause some compilation errors.]) + AC_MSG_WARN([Please use --enable-compile-warnings=error instead.]) +fi
Libvirt should not be leaving -Werror set in $CFLAGS - we should only have it in WARNING_CFLAGS. Yes, the user might have done something like CFLAGS="-Werror" ./configure, but IMHO, they should be letting libvirt do this, and I don't think should be in the business of trying to deal with this ourselves. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|