From 75434b8a69164518acc4a5f766ae95ba1a3f376a Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 11 Feb 2011 15:45:13 +0000 Subject: [PATCH] build: Modify maintainer compiler flags values We use the micro version for distinguishing released tarballs and Git builds; the maintainer compiler flags should be enabled for the latter, and not just for unstable cycles, since it makes sense to have extra warning flags even on stable cycles. We also want to allow people to turn on -Werror on demand, so let's add a third option to --enable-maintainer-flags. --- README | 5 +++-- configure.ac | 38 +++++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/README b/README index 848aa954a..dd3fb9f81 100644 --- a/README +++ b/README @@ -148,9 +148,10 @@ Clutter has additional command line options for the configure script: no: Disable support for COGL runtime debugging notes. - --enable-maintainer-flags=[no/yes] + --enable-maintainer-flags=[no/yes/error] Use strict compiler flags. This defaults to 'yes' for developers - snapshots and to 'no' for stable releases. + snapshots and to 'no' for stable releases. If 'error' is used, then + -Werror will be enabled (if available). --enable-gtk-doc use gtk-doc to build API documentation (default=no). Requires gtk-doc diff --git a/configure.ac b/configure.ac index eff94669d..42ff1fa0a 100644 --- a/configure.ac +++ b/configure.ac @@ -1061,22 +1061,38 @@ AC_SUBST([GCOV_LDFLAGS]) dnl === Enable strict compiler flags ========================================== -# use strict compiler flags only on development releases -m4_define([maintainer_flags_default], [m4_if(m4_eval(clutter_minor_version % 2), [1], [yes], [no])]) +# use strict compiler flags only when building from git; the rules for +# distcheck will take care of turning this on when making a release +m4_define([maintainer_flags_default], [m4_if(m4_eval(clutter_micro_version % 2), [1], [yes], [no])]) AC_ARG_ENABLE([maintainer-flags], - [AC_HELP_STRING([--enable-maintainer-flags=@<:@no/yes@:>@], + [AC_HELP_STRING([--enable-maintainer-flags=@<:@no/yes/error@:>@], [Use strict compiler flags @<:@default=maintainer_flags_default@:>@])], [], [enable_maintainer_flags=maintainer_flags_default]) -AS_IF([test "x$enable_maintainer_flags" = "xyes" && test "x$GCC" = "xyes"], - [ - AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], - ["-Wall -Wshadow -Wcast-align -Wuninitialized - -Wno-strict-aliasing -Wempty-body -Wformat - -Wformat-security -Winit-self - -Wdeclaration-after-statement -Wvla"]) - ] +MAINTAINER_COMPILER_FLAGS="-Wall -Wshadow -Wcast-align -Wuninitialized + -Wno-strict-aliasing -Wempty-body -Wformat + -Wformat-security -Winit-self + -Wdeclaration-after-statement -Wvla" + +AS_CASE([$enable_maintainer_flags], + [yes], + [ + AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], [$MAINTAINER_COMPILER_FLAGS]) + ], + + [no], + [ + ], + + [error], + [ + MAINTAINER_COMPILER_FLAGS="$MAINTAINER_COMPILER_FLAGS -Werror" + AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], [$MAINTAINER_COMPILER_FLAGS]) + ], + + [*], + [AC_MSG_ERROR([Invalid option for --enable-maintainer-flags])] ) AC_SUBST(MAINTAINER_CFLAGS)