diff --git a/smartmontools/CHANGELOG b/smartmontools/CHANGELOG
index ce320f883dd87c7a9c1403a9e4a74f66efca4da3..3a4d665455d66813926024a8da787a594e2ece74 100644
--- a/smartmontools/CHANGELOG
+++ b/smartmontools/CHANGELOG
@@ -43,6 +43,10 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [CF] Windows: Check support of gcc '-mno-cygwin' option in configure.
+       This option has been removed in Cygwin gcc 4.x.  Update INSTALL
+       instructions accordingly.
+
   [CF] Increase SCSI_TIMEOUT_DEFAULT from 6 to 20 seconds to avoid
        timeouts when a disk spins up from standby mode.
 
diff --git a/smartmontools/INSTALL b/smartmontools/INSTALL
index d3f5fae911049a6d7da74fa97ad004970cb4d442..7628be6d20bc4d5bd8a48b0e5ab2d92e355cca54 100644
--- a/smartmontools/INSTALL
+++ b/smartmontools/INSTALL
@@ -434,16 +434,32 @@ Same as Red Hat:
   instead. This is not necessary for the generated ./configure script.
 
 [10] Guidelines for Windows
-==========================
+===========================
 
-To compile the Windows release with MinGW, use the following on Cygwin:
+To compile the Windows release with MinGW gcc on MSYS, use:
 
-  ./configure --build=mingw32
+  ./configure
   make
 
   Instead of using "make install", copy the .exe files into
   some directory in the PATH.
 
+To compile with MinGW gcc 3.x on Cygwin, use:
+
+  ./configure --build=i686-pc-mingw32
+
+  The above does not work if gcc 4.x is installed and selected as
+  default by /usr/sbin/alternatives.  If the configure command aborts
+  with error message '... does not support -mno-cygwin', select
+  gcc 3.x by:
+
+  CC=gcc-3 CXX=g++-3 ./configure --build=i686-pc-mingw32
+
+  Alternatively, a MinGW-targeted cross-compiler can be used if available:
+
+  ./configure --build=i686-pc-cygwin --host=i686-pc-mingw32
+
+
 To build the Windows binary distribution, use:
 
   make dist-win32
diff --git a/smartmontools/configure.in b/smartmontools/configure.in
index 990ba20786f7faa8523c927a9390303c2f674dae..8154ae6f4e2383817d410b0f6ca37f882529918f 100644
--- a/smartmontools/configure.in
+++ b/smartmontools/configure.in
@@ -34,8 +34,18 @@ AC_CANONICAL_HOST
 dnl Set flags which may affect AC_CHECK_*.
 case "${host}" in
 	*-*-mingw*)
-		CPPFLAGS="$CPPFLAGS -mno-cygwin"
-		LDFLAGS="$LDFLAGS -mno-cygwin"
+		# If building on Cygwin and not cross-compiling add '-mno-cygwin'
+		# to select MinGW gcc. This does no longer work for gcc 4.x.
+		if test "${build}" = "${host}" && test -x /usr/bin/uname && \
+		   /usr/bin/uname | grep -i '^CYGWIN' >/dev/null; then
+		  if $CC  -v -mno-cygwin >/dev/null 2>&1 && \
+		     $CXX -v -mno-cygwin >/dev/null 2>&1; then
+		    CPPFLAGS="$CPPFLAGS -mno-cygwin"
+		    LDFLAGS="$LDFLAGS -mno-cygwin"
+		  else
+		    AC_MSG_ERROR([$CC and $CXX do not support -mno-cygwin, see INSTALL file for details.])
+		  fi
+		fi
 		CPPFLAGS="$CPPFLAGS -idirafter ${srcdir}/posix -idirafter ${srcdir}/os_win32"
 		;;
 	*-*-freebsd*)