summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPauli Nieminen <suokkos@gmail.com>2009-07-05 18:34:29 +0300
committerPauli Nieminen <suokkos@gmail.com>2009-08-25 02:50:04 +0300
commit2ae033dfd519f061553cce12a2dd9bd916b542b5 (patch)
tree56046233956977e3eeb23375e580728e642ec327
parent7e667aa87d057663c20e73c8dd589a631dc5013a (diff)
libdrm: Add configuration option to enable strict compilation
Source is writen for c99 standard so we have to tell compiler about it with -std=c99 if we want strict warnings. Also add -pedantic to list of warning flags.
-rw-r--r--configure.ac11
1 files changed, 10 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 0794a2c9..d0854cb4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,11 @@ AC_ARG_ENABLE(radeon-experimental-api,
[Enable support for radeon's KMS API (default: disabled)]),
[RADEON=$enableval], [RADEON=no])
+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])
+
dnl ===========================================================================
dnl check compiler flags
AC_DEFUN([LIBDRM_CC_TRY_FLAG], [
@@ -94,7 +99,7 @@ MAYBE_WARN="-Wall -Wextra \
-Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
-Wdeclaration-after-statement -Wold-style-definition \
-Wno-missing-field-initializers -Wno-unused-parameter \
--Wno-attributes -Wno-long-long -Winline"
+-Wno-attributes -Wno-long-long -Winline -pedantic"
# invalidate cached value if MAYBE_WARN has changed
if test "x$libdrm_cv_warn_maybe" != "x$MAYBE_WARN"; then
@@ -125,6 +130,10 @@ AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [
AC_MSG_CHECKING([which warning flags were supported])])
WARN_CFLAGS="$libdrm_cv_warn_cflags"
+if test "x$STRICT_COMPILE" = xyes; then
+ CFLAGS="$CFLAGS $WARN_CFLAGS -std=c99 -Werror"
+fi
+
if test "x$UDEV" = xyes; then
AC_DEFINE(UDEV, 1, [Have UDEV support])
fi