From b175fe0e07fce86cf029695e9e93b573ada54b0c Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 1 Nov 2011 11:53:44 -0700 Subject: Use XORG_TESTSET_CFLAG in XORG_STRICT_OPTION Signed-off-by: Jeremy Huddleston --- xorg-macros.m4.in | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in index 1ece326..6f3bd3e 100644 --- a/xorg-macros.m4.in +++ b/xorg-macros.m4.in @@ -1468,31 +1468,21 @@ AC_SUBST(CWARNFLAGS) # Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or # when strict compilation is unconditionally desired. AC_DEFUN([XORG_STRICT_OPTION], [ -# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89 -AC_REQUIRE([AC_PROG_CC_C99]) -AC_REQUIRE([XORG_COMPILER_BRAND]) AC_REQUIRE([XORG_CWARNFLAGS]) AC_ARG_ENABLE(strict-compilation, AS_HELP_STRING([--enable-strict-compilation], [Enable all warnings from compiler and make them errors (default: disabled)]), [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) -if test "x$GCC" = xyes ; then - STRICT_CFLAGS="-pedantic -Werror" - # Add -Werror=attributes if supported (gcc 4.2 & later) - AC_MSG_CHECKING([if $CC supports -Werror=attributes]) - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $STRICT_CFLAGS -Werror=attributes" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], - [STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes" - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])]) - CFLAGS="$save_CFLAGS" -elif test "x$SUNCC" = "xyes"; then - STRICT_CFLAGS="-errwarn" -elif test "x$INTELCC" = "xyes"; then - STRICT_CFLAGS="-Werror" -fi + +STRICT_CFLAGS="" +XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic]) +XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn]) + +# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not +# activate it with -Werror, so we add it here explicitly. +XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes]) + if test "x$STRICT_COMPILE" = "xyes"; then CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" fi -- cgit v1.2.1