--- config/eu.am
+++ config/eu.am
@@ -73,7 +73,6 @@ AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
 	    -Wold-style-definition -Wstrict-prototypes -Wtrampolines \
 	    $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
 	    $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
-	    $(if $($(*F)_no_Werror),,-Werror) \
 	    $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
 	    $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
 	    $(if $($(*F)_no_Wpacked_not_aligned),-Wno-packed-not-aligned,) \
@@ -83,7 +82,6 @@ AM_CXXFLAGS = -std=c++11 -Wall -Wshadow \
 	   -Wtrampolines \
 	   $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
 	   $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
-	   $(if $($(*F)_no_Werror),,-Werror) \
 	   $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
 	   $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
 	   $(if $($(*F)_no_Wpacked_not_aligned),-Wno-packed-not-aligned,) \
diff --git a/source/source_subfolder/configure.ac b/source/source_subfolder/configure.ac
index 74cc749..634858d 100644
--- configure.ac
+++ configure.ac
@@ -294,6 +294,18 @@
 esac
 AC_SUBST([DEBUGPRED], $use_debugpred_val)
 
+dnl Enable -Werror
+AC_MSG_CHECKING([whether to treat warnings as errors])
+AC_ARG_ENABLE([werror],
+AS_HELP_STRING([--enable-werror],[treat warnings as errors]),
+[werror=$enableval], [werror=yes])
+if test "x$werror" = xyes; then
+  AC_MSG_RESULT([yes])
+  CFLAGS="$CFLAGS -Werror"
+else
+  AC_MSG_RESULT([no])
+fi
+
 dnl Enable gprof suport.
 AC_ARG_ENABLE([gprof],
 AS_HELP_STRING([--enable-gprof],[build binaries with gprof support]), [use_gprof=$enableval], [use_gprof=no])
