summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-11-01 11:53:44 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-11-06 16:07:57 -0800
commitb175fe0e07fce86cf029695e9e93b573ada54b0c (patch)
treea26762d930be53402402870f54879ffef16937fd
parent9f427611f4bb6db60cb8cbdda6296a3bf66a5a6c (diff)
Use XORG_TESTSET_CFLAG in XORG_STRICT_OPTION
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--xorg-macros.m4.in28
1 files 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