--- plplot/cmake/modules/FindGD.cmake.orig	2014-04-06 11:52:17.031600000 +0400
+++ plplot/cmake/modules/FindGD.cmake	2014-04-06 11:52:53.208000000 +0400
@@ -14,11 +14,11 @@
 /usr/include
 )
 
-if(WIN32_AND_NOT_CYGWIN)
+if(WIN32_AND_NOT_CYGWIN AND NOT MINGW)
   set(GD_NAMES ${GD_NAMES} bgd)
 else(WIN32_AND_NOT_CYGWIN)
   set(GD_NAMES ${GD_NAMES} gd)
-endif(WIN32_AND_NOT_CYGWIN)
+endif(WIN32_AND_NOT_CYGWIN AND NOT MINGW)
 
 find_library(GD_LIBRARY
   NAMES ${GD_NAMES}
@@ -33,12 +33,12 @@
 endif(GD_LIBRARY AND GD_INCLUDE_DIR)
 
 if(GD_FOUND)
-  if(WIN32_AND_NOT_CYGWIN)
+  if(WIN32_AND_NOT_CYGWIN AND NOT MINGW)
     set(GD_SUPPORTS_PNG ON)
     set(GD_SUPPORTS_JPEG ON)
     set(GD_SUPPORTS_GIF ON)
     get_filename_component(GD_LIBRARY_DIR ${GD_LIBRARY} PATH)
-  else(WIN32_AND_NOT_CYGWIN)
+  else(WIN32_AND_NOT_CYGWIN AND NOT MINGW)
     include(CheckLibraryExists)
     get_filename_component(GD_LIB_PATH ${GD_LIBRARY} PATH)
     get_filename_component(GD_LIB ${GD_LIBRARY} NAME)
@@ -110,7 +110,7 @@
         set(GD_LIBRARY_DIR "${GD_LIBRARY_DIR}" "${GD_NEXTLIBDIR}")
       endif(NOT GD_TMP_FOUND)
     endforeach(GD_LIB ${GD_LIBRARIES})
-  endif(WIN32_AND_NOT_CYGWIN)
+  endif(WIN32_AND_NOT_CYGWIN AND NOT MINGW)
 endif(GD_FOUND)
 
 if(GD_FOUND)