--- a/dosbox/trunk/configure.ac
+++ b/dosbox/trunk/configure.ac
@@ -168,6 +168,21 @@
 ]])], [ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_BUILTIN_EXPECT)],AC_MSG_RESULT(no))
 #switch language back
 AC_LANG_POP(C++)
+
+dnl test if compiler supports -mno-ms-bitfields as it is bugged 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991
+BACKUP_CFLAGS="$CFLAGS"
+CFLAGS="-mno-ms-bitfields"
+AC_MSG_CHECKING(if compiler supports -mno-ms-bitfields)
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+void blah(){
+;
+}
+])],[
+AC_MSG_RESULT([yes])
+CXXFLAGS="$CXXFLAGS -mno-ms-bitfields"
+],[AC_MSG_RESULT([no])])
+CFLAGS="$BACKUP_CFLAGS"
 
 dnl enable disable alsa and pass it's cflags to CXXFLAGS
 AC_ARG_ENABLE(alsa-midi,