From f460264c6f0a182bb166b49c5207b18243ac9db1 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Sat, 25 Jul 2009 00:07:36 +0300 Subject: [PATCH] Add XORG_STRICT_OPTION macro for strict compilation option Strict compilation option can be used to get rid of warnings that often are showing real hidden bug in code. That just waits to cause problems. --- xorg-macros.m4.in | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in index bcf8c44..6c2bfc7 100644 --- a/xorg-macros.m4.in +++ b/xorg-macros.m4.in @@ -455,3 +455,24 @@ else fi AC_SUBST(CWARNFLAGS) ]) # XORG_CWARNFLAGS + +# XORG_STRICT_OPTION +# ----------------------- +# Minimum version: 1.2.3 +# +# Add configure option to enable strict compilation +AC_DEFUN([XORG_STRICT_OPTION], [ +AC_REQUIRE([AC_PROG_CC]) +if test "x$GCC" = xyes ; then + + 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$STRICT_COMPILE" = "xyes"; then + # Set C standard to C99 because that is closest standard to what code uses + AC_PROG_CC_C99 + STRICT_CFLAGS="$CFLAGS -pedantic -Werror" + fi +fi +]) # XORG_STRICT_OPTION -- 1.6.3.3