From bc5c34584168d0c6c0d1b9b49c2344f8c12c63b1 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 9 Jul 2010 12:14:32 +0200 Subject: Add --enable-werror and make it the default only for git builds Its not generally a good idea to have released tarballs build with -Werror, as later compilers may add warnings breaking old releases, etc. --- GITVERSION | 0 configure.ac | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 GITVERSION diff --git a/GITVERSION b/GITVERSION new file mode 100644 index 00000000..e69de29b diff --git a/configure.ac b/configure.ac index 80332526..6b70329f 100644 --- a/configure.ac +++ b/configure.ac @@ -272,7 +272,18 @@ dnl MAYBE_WARN in an ignorable way (like adding whitespace) dnl MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations" -MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations" +MAYBE_WARN="-Wall -Wno-sign-compare -Wno-deprecated-declarations" + +AC_ARG_ENABLE(werror, +AC_HELP_STRING([--enable-werror], [Use -Werror (if supported)]), +set_werror="$enableval",[ +if test -f $srcdir/GITVERSION; then + is_git_version=true + set_werror=yes +else + set_werror=no +fi +]) # invalidate cached value if MAYBE_WARN has changed @@ -297,6 +308,9 @@ AC_CACHE_CHECK([for supported warning flags], spice_cv_warn_cflags, [ for W in $MAYBE_WARN; do SPICE_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"]) done + if test "$set_werror" != "no"; then + SPICE_CC_TRY_FLAG(["-Werror"], [WARN_CFLAGS="$WARN_CFLAGS -Werror"]) + fi spice_cv_warn_cflags=$WARN_CFLAGS spice_cv_warn_maybe=$MAYBE_WARN -- cgit