diff --git a/configure b/configure
index c16637c659b81ad438f61d518871b259632bbe41..5a7516d1f236fff8bf2ff5cc22e007166d1b7259 100755
--- a/configure
+++ b/configure
@@ -11753,6 +11753,42 @@ $as_echo "$ac_cv_c_string_h_warnings" >&6; }
   then
     EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith"
   fi
+
+    if test "${enable_maintainer_mode+set}" = set
+  then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Werror" >&5
+$as_echo_n "checking whether the compiler supports -Werror... " >&6; }
+if test "${ac_cv_cflags__Werror+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_wine_try_cflags_saved=$CFLAGS
+CFLAGS="$CFLAGS -Werror"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_cflags__Werror=yes
+else
+  ac_cv_cflags__Werror=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+CFLAGS=$ac_wine_try_cflags_saved
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Werror" >&5
+$as_echo "$ac_cv_cflags__Werror" >&6; }
+if test $ac_cv_cflags__Werror = yes; then :
+  EXTRACFLAGS="$EXTRACFLAGS -Werror"
+fi
+  fi
 fi
 
 
diff --git a/configure.ac b/configure.ac
index 6210c2f4f6b9fefb1a832b213f58b5568bfb277a..0cc339b2bb9115fcb2655424bef8f4e9974616ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1498,6 +1498,12 @@ then
   then
     EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith"
   fi
+
+  dnl Enable -Werror for maintainer mode
+  if test "${enable_maintainer_mode+set}" = set
+  then
+      WINE_TRY_CFLAGS([-Werror])
+  fi
 fi
 
 dnl **** Check for underscore on external symbols ****