On 09/19/2012 04:28 PM, 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
Eeek. Much simpler as:
case " $CFLAGS " in
*" -Werror "*) AC_MSG_WARN(...) ;;
esac
+ 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
Other than that, I very much like the idea. I also sparked a discussion
on the upstream autoconf list on whether future autoconf 2.70 should
make this sort of thing easier; although we won't be able to rely on
that until we no longer support things like RHEL 5 that will probably
never upgrade to new enough autoconf to use that type of feature.
https://lists.gnu.org/archive/html/autoconf/2012-09/msg00029.html
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org