diff --git a/src/configure.in b/src/configure.in
index 8e91694d68f83e5ed7a38cfadf23dea48bf68723..c3d565d7e06bc711601c25cc7870e32779f6187f 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1676,6 +1676,9 @@ OPTIMIZE="${OPTFLAGS-}"
 AC_ARG_ENABLE(pedantic, MY_DESCR([--enable-pedantic],
    [enable -pedantic compilation]))
 
+AC_ARG_ENABLE(werror, MY_DESCR([--enable-werror],
+   [enable -Werror compilation]))
+
 if test "$cflags_is_set" = "no"; then
   if test "x$with_cdebug" = "xno" ; then
     CFLAGS=`echo " $CFLAGS " | sed -e 's@ -g @ @g'`
@@ -1687,6 +1690,9 @@ if test "$cflags_is_set" = "no"; then
     AC_SYS_COMPILER_FLAG(-pedantic,pedantic,WARN)
   fi
 
+  if test "x$enable_werror" = "xyes"; then
+    AC_SYS_COMPILER_FLAG(-Werror,error,WARN)
+  fi
 
   if test "x${GCC-}" = xyes ; then
   # Do not use -Wall, since that produces a lot of warnings that are not