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)