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.
This commit is contained in:
Emmanuele Bassi 2011-02-11 15:45:13 +00:00
parent 7decee300e
commit 75434b8a69
2 changed files with 30 additions and 13 deletions

5
README
View File

@ -148,9 +148,10 @@ Clutter has additional command line options for the configure script:
no: no:
Disable support for COGL runtime debugging notes. 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 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 --enable-gtk-doc
use gtk-doc to build API documentation (default=no). Requires gtk-doc use gtk-doc to build API documentation (default=no). Requires gtk-doc

View File

@ -1061,22 +1061,38 @@ AC_SUBST([GCOV_LDFLAGS])
dnl === Enable strict compiler flags ========================================== dnl === Enable strict compiler flags ==========================================
# use strict compiler flags only on development releases # use strict compiler flags only when building from git; the rules for
m4_define([maintainer_flags_default], [m4_if(m4_eval(clutter_minor_version % 2), [1], [yes], [no])]) # 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_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@:>@])], [Use strict compiler flags @<:@default=maintainer_flags_default@:>@])],
[], [],
[enable_maintainer_flags=maintainer_flags_default]) [enable_maintainer_flags=maintainer_flags_default])
AS_IF([test "x$enable_maintainer_flags" = "xyes" && test "x$GCC" = "xyes"], MAINTAINER_COMPILER_FLAGS="-Wall -Wshadow -Wcast-align -Wuninitialized
[ -Wno-strict-aliasing -Wempty-body -Wformat
AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], -Wformat-security -Winit-self
["-Wall -Wshadow -Wcast-align -Wuninitialized -Wdeclaration-after-statement -Wvla"
-Wno-strict-aliasing -Wempty-body -Wformat
-Wformat-security -Winit-self AS_CASE([$enable_maintainer_flags],
-Wdeclaration-after-statement -Wvla"]) [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) AC_SUBST(MAINTAINER_CFLAGS)