diff -u5 curl-7.19.0/configure.ac curl-7.19.0-new/configure.ac
--- curl-7.19.0/configure.ac	2008-08-27 07:52:32.000000000 +0200
+++ curl-7.19.0-new/configure.ac	2008-09-17 14:58:24.856995200 +0200
@@ -1250,10 +1250,28 @@
         AC_MSG_RESULT([no])
       fi
     fi
   fi
 
+  dnl This is for Msys/Mingw
+  case $host in
+    *-*-msys* | *-*-mingw*)
+      AC_MSG_CHECKING([for gdi32])
+      my_ac_save_LIBS=$LIBS
+      LIBS="-lgdi32 $LIBS"
+      AC_TRY_LINK([#include <windef.h>
+                   #include <wingdi.h>],
+                   [GdiFlush();],
+                   [ dnl worked!
+                   AC_MSG_RESULT([yes])],
+                   [ dnl failed, restore LIBS
+                   LIBS=$my_ac_save_LIBS
+                   AC_MSG_RESULT(no)]
+                  )
+      ;;
+  esac
+
   AC_CHECK_LIB(crypto, CRYPTO_lock,[
      HAVECRYPTO="yes"
      LIBS="-lcrypto $LIBS"
      ],[
      LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
