diff -ur fltk-1.3.1-orig/FL/Fl_Device.H fltk-1.3.1/FL/Fl_Device.H
--- fltk-1.3.1-orig/FL/Fl_Device.H	2012-11-06 15:46:14 -0500
+++ fltk-1.3.1/FL/Fl_Device.H	2013-07-17 19:22:49 -0400
@@ -213,7 +213,7 @@
   friend void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D);
   friend FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D);
   friend FL_EXPORT void gl_start();
-  friend void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
+  friend FL_EXPORT void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
   matrix *fl_matrix; /**< Points to the current coordinate transformation matrix */
 
   /** \brief The constructor. */
diff -ur fltk-1.3.1-orig/configure.in fltk-1.3.1/configure.in
--- fltk-1.3.1-orig/configure.in	2013-07-17 19:22:33 -0400
+++ fltk-1.3.1/configure.in	2013-07-17 19:22:49 -0400
@@ -164,6 +164,31 @@
     fi
 fi
 
+case $uname in
+    MINGW*)
+	if test x$GCC != xyes; then
+		dnl Assume VC++ compiler
+		LINKFLTK="../lib/fltk.lib"
+		LINKFLTKFORMS=
+		LINKFLTKGL=
+		LINKFLTKIMG=
+
+		LIBEXT=".lib"
+		LIBNAME="../lib/fltk.lib"
+		FLLIBNAME=
+		GLLIBNAME=
+		IMGLIBNAME=
+		CAIROLIBNAME=
+
+		LIBBASENAME="fltk.lib"
+		FLLIBBASENAME=
+		GLLIBBASENAME=
+		IMGLIBBASENAME=
+		CAIROLIBBASENAME=
+	fi
+	;;
+esac
+
 AC_SUBST(CAIRODIR)
 AC_SUBST(CAIROFLAGS)
 AC_SUBST(CAIROLIBS)
@@ -287,36 +312,47 @@
             ;;
         CYGWIN* | MINGW*)
 	    PICFLAG=0
-	    if test x$enable_cygwin != xyes; then
-		DSONAME="mgwfltknox-$FL_API_VERSION.dll"
-		FLDSONAME="mgwfltknox_forms-$FL_API_VERSION.dll"
-		GLDSONAME="mgwfltknox_gl-$FL_API_VERSION.dll"
-		IMGDSONAME="mgwfltknox_images-$FL_API_VERSION.dll"
-		CAIRODSONAME="mgwfltknox_cairo-$FL_API_VERSION.dll"
+	    if test x$GCC = xyes; then
+		    if test x$enable_cygwin != xyes; then
+			DSONAME="mgwfltknox-$FL_API_VERSION.dll"
+			FLDSONAME="mgwfltknox_forms-$FL_API_VERSION.dll"
+			GLDSONAME="mgwfltknox_gl-$FL_API_VERSION.dll"
+			IMGDSONAME="mgwfltknox_images-$FL_API_VERSION.dll"
+			CAIRODSONAME="mgwfltknox_cairo-$FL_API_VERSION.dll"
+		    else
+			if test x$enable_x11 = xyes; then
+			    DSONAME="cygfltk-$FL_API_VERSION.dll"
+			    FLDSONAME="cygfltk_forms-$FL_API_VERSION.dll"
+			    GLDSONAME="cygfltk_gl-$FL_API_VERSION.dll"
+			    IMGDSONAME="cygfltk_images-$FL_API_VERSION.dll"
+			    CAIRODSONAME="cygfltk_cairo-$FL_API_VERSION.dll"
+			else
+			    DSONAME="cygfltknox-$FL_API_VERSION.dll"
+			    FLDSONAME="cygfltknox_forms-$FL_API_VERSION.dll"
+			    GLDSONAME="cygfltknox_gl-$FL_API_VERSION.dll"
+			    IMGDSONAME="cygfltknox_images-$FL_API_VERSION.dll"
+			    CAIRODSONAME="cygfltknox_cairo-$FL_API_VERSION.dll"
+			fi
+		    fi
+		    #-----------------------------------------------------------
+		    # -Wl,--enable-runtime-pseudo-reloc: See str 1585
+		    # appears to be necessary for older binutils versions < 2.16
+		    #-----------------------------------------------------------
+		    LDFLAGS="$LDFLAGS -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
+		    DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -shared \
+			-Wl,--whole-archive -Wl,--export-all-symbols \
+			-Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-import \
+			-Wl,--enable-auto-image-base -o \$@"
 	    else
-		if test x$enable_x11 = xyes; then
-		    DSONAME="cygfltk-$FL_API_VERSION.dll"
-		    FLDSONAME="cygfltk_forms-$FL_API_VERSION.dll"
-		    GLDSONAME="cygfltk_gl-$FL_API_VERSION.dll"
-		    IMGDSONAME="cygfltk_images-$FL_API_VERSION.dll"
-		    CAIRODSONAME="cygfltk_cairo-$FL_API_VERSION.dll"
-		else
-		    DSONAME="cygfltknox-$FL_API_VERSION.dll"
-		    FLDSONAME="cygfltknox_forms-$FL_API_VERSION.dll"
-		    GLDSONAME="cygfltknox_gl-$FL_API_VERSION.dll"
-		    IMGDSONAME="cygfltknox_images-$FL_API_VERSION.dll"
-		    CAIRODSONAME="cygfltknox_cairo-$FL_API_VERSION.dll"
-		fi
+		    dnl Assume VC++ compiler
+		    DSONAME="@@LIBRARY_PREFIX@@fltk-$FL_API_VERSION@@LIBRARY_SUFFIX@@.dll"
+		    FLDSONAME=
+		    GLDSONAME=
+		    IMGDSONAME=
+		    CAIRODSONAME=
+
+		    DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -shared -o \$@"
 	    fi
-	    #-----------------------------------------------------------
-	    # -Wl,--enable-runtime-pseudo-reloc: See str 1585
-	    # appears to be necessary for older binutils versions < 2.16
-	    #-----------------------------------------------------------
-            LDFLAGS="$LDFLAGS -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
-	    DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -shared \
-	    	-Wl,--whole-archive -Wl,--export-all-symbols \
-		-Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-import \
-		-Wl,--enable-auto-image-base -o \$@"
 	    ;;
 	*)
             AC_MSG_WARN(Shared libraries may not be supported.  Trying -shared option with compiler.)
@@ -330,6 +366,15 @@
     esac
 
     LINKSHARED="-L../src $FLTKCAIROOPTION -lfltk_images$SHAREDSUFFIX -lfltk_forms$SHAREDSUFFIX -lfltk$SHAREDSUFFIX"
+
+    case $uname in
+	MINGW*)
+	    if test x$GCC != xyes; then
+		dnl Assume VC++ compiler
+		LINKSHARED="-L../src $FLTKCAIROOPTION -lfltk$SHAREDSUFFIX"
+	    fi
+	    ;;
+    esac
 else
     DSOCOMMAND="echo"
     DSOLINK=""
@@ -705,7 +750,7 @@
 syspnglib_ok=no
 syspnginc_ok=no
 if test x$enable_localpng != xyes; then
-  AC_CHECK_LIB(png, png_read_info, 
+  AC_CHECK_LIB(png16, png_read_info, 
     [AC_CHECK_HEADER(png.h, 
 	AC_DEFINE(HAVE_PNG_H)
 	syspnginc_ok=yes)
@@ -734,11 +779,11 @@
 else
     PNGINC=""
     PNG=""
-    IMAGELIBS="-lpng $IMAGELIBS"
-    STATICIMAGELIBS="-lpng $STATICIMAGELIBS"
+    IMAGELIBS="-lpng16 $IMAGELIBS"
+    STATICIMAGELIBS="-lpng16 $STATICIMAGELIBS"
     AC_DEFINE(HAVE_LIBPNG)
-    AC_CHECK_LIB(png,png_get_valid, AC_DEFINE(HAVE_PNG_GET_VALID))
-    AC_CHECK_LIB(png,png_set_tRNS_to_alpha, AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA))
+    AC_CHECK_LIB(png16,png_get_valid, AC_DEFINE(HAVE_PNG_GET_VALID))
+    AC_CHECK_LIB(png16,png_set_tRNS_to_alpha, AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA))
 fi
 
 AC_SUBST(JPEG)
@@ -824,11 +869,17 @@
 	# checks don't work because the shell puts out \r\n instead of
 	# \n.  Here we just force U32 to be defined to "unsigned"...
         AC_DEFINE(U32,unsigned)
-	CFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CFLAGS"
-	CXXFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CXXFLAGS"
-	LDFLAGS="-mwindows $LDFLAGS"
-	DSOFLAGS="-mwindows $DSOFLAGS"
-	LIBS="$LIBS -lole32 -luuid -lcomctl32"
+	if test x$GCC = xyes; then
+	    CFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CFLAGS"
+	    CXXFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CXXFLAGS"
+	    LDFLAGS="-mwindows $LDFLAGS"
+	    DSOFLAGS="-mwindows $DSOFLAGS"
+	    LIBS="$LIBS -lole32 -luuid -lcomctl32"
+	else
+	    CFLAGS="-DWIN32 -DUSE_OPENGL32 -DFL_DLL $CFLAGS"
+	    CXXFLAGS="-DWIN32 -DUSE_OPENGL32 -DFL_DLL $CXXFLAGS"
+	    LIBS="$LIBS -lole32 -luuid -lcomctl32 -lcomdlg32 -lgdi32"
+	fi
 	if test "x$with_optim" = x; then
 	    dnl Avoid -Os optimization on Cygwin/MinGW
 	    with_optim="-O3"
@@ -837,10 +888,10 @@
 	if test x$enable_gl != xno; then
 	    AC_CHECK_HEADER(GL/gl.h,
 	        AC_DEFINE(HAVE_GL)
-		GLLIB="-lopengl32")
+		GLLIB="-lopengl32", [], [#include <windows.h>])
 	    AC_CHECK_HEADER(GL/glu.h,
         	AC_DEFINE(HAVE_GL_GLU_H)
-		GLLIB="-lglu32 $GLLIB")
+		GLLIB="-lglu32 $GLLIB", [], [#include <windows.h>])
 	else
 	    LINKFLTKGL=""
 	    GLLIBNAME=""
diff -ur fltk-1.3.1-orig/fltk-config.in fltk-1.3.1/fltk-config.in
--- fltk-1.3.1-orig/fltk-config.in	2013-07-17 19:22:36 -0400
+++ fltk-1.3.1/fltk-config.in	2013-07-17 19:23:21 -0400
@@ -28,7 +28,7 @@
 ### BEGIN fltk-config
 selfdir=`dirname "$0"`
 
-prefix=@prefix@
+prefix=`cd $selfdir && pwd -W | sed -e 's,/bin$,,'`
 exec_prefix=@exec_prefix@
 exec_prefix_set=no
 bindir=@bindir@
@@ -233,18 +233,18 @@
 LDSTATIC="$libdir/libfltk.a $LDLIBS"
 LDLIBS="-lfltk$SHAREDSUFFIX $LDLIBS"
 
-if test x$use_forms = xyes; then
-    LDLIBS="-lfltk_forms$SHAREDSUFFIX $LDLIBS"
-    LDSTATIC="$libdir/libfltk_forms.a $LDSTATIC"
-fi
+#if test x$use_forms = xyes; then
+#    LDLIBS="-lfltk_forms$SHAREDSUFFIX $LDLIBS"
+#    LDSTATIC="$libdir/libfltk_forms.a $LDSTATIC"
+#fi
 if test x$use_gl = xyes; then
-    LDLIBS="-lfltk_gl$SHAREDSUFFIX @GLLIB@ $LDLIBS"
-    LDSTATIC="$libdir/libfltk_gl.a @GLLIB@ $LDSTATIC"
-fi
-if test x$use_images = xyes; then
-    LDLIBS="-lfltk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS"
-    LDSTATIC="$libdir/libfltk_images.a $STATICIMAGELIBS $LDSTATIC"
+    LDLIBS="@GLLIB@ $LDLIBS"
+    LDSTATIC="@GLLIB@ $LDSTATIC"
 fi
+#if test x$use_images = xyes; then
+#    LDLIBS="-lfltk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS"
+#    LDSTATIC="$libdir/libfltk_images.a $STATICIMAGELIBS $LDSTATIC"
+#fi
 
 if test x$use_cairo = xyes; then
     LDLIBS="-lfltk_cairo$SHAREDSUFFIX $CAIROLIBS $LDLIBS"
diff -ur fltk-1.3.1-orig/fluid/factory.cxx fltk-1.3.1/fluid/factory.cxx
--- fltk-1.3.1-orig/fluid/factory.cxx	2011-07-19 00:49:30 -0400
+++ fltk-1.3.1/fluid/factory.cxx	2013-07-17 19:22:49 -0400
@@ -37,7 +37,7 @@
 
 extern Fl_Pixmap *pixmap[];
 
-#if !HAVE_STRCASECMP
+#if !HAVE_STRCASECMP && !defined(strcasecmp)
 //
 // 'strcasecmp()' - Do a case-insensitive compare...
 //
diff -ur fltk-1.3.1-orig/makeinclude.in fltk-1.3.1/makeinclude.in
--- fltk-1.3.1-orig/makeinclude.in	2011-07-19 00:49:30 -0400
+++ fltk-1.3.1/makeinclude.in	2013-07-17 19:22:49 -0400
@@ -50,7 +50,7 @@
 # flags for C++ compiler:
 ARCHFLAGS	= @ARCHFLAGS@
 OPTIM		= @OPTIM@
-CFLAGS		= $(OPTIM) @LARGEFILE@ @PTHREAD_FLAGS@ @CPPFLAGS@ @CFLAGS@
+CFLAGS		= $(OPTIM) @LARGEFILE@ @PTHREAD_FLAGS@ @CPPFLAGS@ @CFLAGS@ $(FLTKFLAGS)
 CXXFLAGS	= $(OPTIM) @LARGEFILE@ @PTHREAD_FLAGS@ @CPPFLAGS@ @CXXFLAGS@ $(FLTKFLAGS)
 
 # program to make the archive:
diff -ur fltk-1.3.1-orig/src/Makefile fltk-1.3.1/src/Makefile
--- fltk-1.3.1-orig/src/Makefile	2012-11-06 16:13:54 -0500
+++ fltk-1.3.1/src/Makefile	2013-07-17 19:22:49 -0400
@@ -459,6 +459,13 @@
 		-L. -lfltk -Wl,--exclude-libs -Wl,libfltk_png.a \
 			$(IMAGELIBS) $(LDLIBS)
 
+$(LIBNAME):
+	true
+
+@@LIBRARY_PREFIX@@fltk-1.3@@LIBRARY_SUFFIX@@.dll: $(OBJECTS) $(FLOBJECTS) $(GLOBJECTS) $(IMGOBJECTS)
+	echo $(DSOCOMMAND) ...
+	$(DSOCOMMAND) $^ -Wl,--out-implib=$(LIBNAME) $(IMAGELIBS) $(LDLIBS) $(GLDLIBS)
+
 clean:
 	-$(RM) *.o xutf8/*.o *.dll.a core.* *~ *.bak *.bck
 	-$(RM) $(DSONAME) $(FLDSONAME) $(GLDSONAME) $(IMGDSONAME) \
@@ -554,15 +561,19 @@
 	-$(INSTALL_DIR) $(DESTDIR)$(bindir)
 	$(RM) $(DESTDIR)$(libdir)/$(LIBBASENAME)
 	$(INSTALL_LIB) $(LIBNAME) $(DESTDIR)$(libdir)
-	$(INSTALL_LIB) $(FLLIBNAME) $(DESTDIR)$(libdir)
-	$(INSTALL_LIB) $(IMGLIBNAME) $(DESTDIR)$(libdir)
 	$(RANLIB) $(DESTDIR)$(libdir)/$(LIBBASENAME)
-	$(RANLIB) $(DESTDIR)$(libdir)/$(FLLIBBASENAME)
+	if test x$(FLLIBNAME) != x; then \
+		$(INSTALL_LIB) $(FLLIBNAME) $(DESTDIR)$(libdir); \
+		$(RANLIB) $(DESTDIR)$(libdir)/$(FLLIBBASENAME); \
+	fi
+	if test x$(IMGLIBNAME) != x; then \
+		$(INSTALL_LIB) $(IMGLIBNAME) $(DESTDIR)$(libdir); \
+		$(RANLIB) $(DESTDIR)$(libdir)/$(IMGLIBBASENAME); \
+	fi
 	if test x$(GLLIBNAME) != x; then \
 		$(INSTALL_LIB) $(GLLIBNAME) $(DESTDIR)$(libdir); \
 		$(RANLIB) $(DESTDIR)$(libdir)/$(GLLIBBASENAME); \
 	fi
-	$(RANLIB) $(DESTDIR)$(libdir)/$(IMGLIBBASENAME)
 	if test x$(DSONAME) = xlibfltk.so.1.3; then\
 		$(RM) $(DESTDIR)$(libdir)/libfltk.so*;\
 		$(INSTALL_LIB) libfltk.so.1.3 $(DESTDIR)$(libdir); \
@@ -687,6 +698,10 @@
 		$(RM) $(DESTDIR)$(libdir)/libfltk_images.dll.a;\
 		$(INSTALL_LIB) libfltk_images.dll.a $(DESTDIR)$(libdir); \
 	fi
+	if test x$(DSONAME) = x@@LIBRARY_PREFIX@@fltk-1.3@@LIBRARY_SUFFIX@@.dll; then\
+		$(RM) $(DESTDIR)$(bindir)/$(DSONAME);\
+		$(INSTALL_LIB) $(DSONAME) $(DESTDIR)$(bindir); \
+	fi
 
 
 uninstall:
diff -ur fltk-1.3.1-orig/test/Makefile fltk-1.3.1/test/Makefile
--- fltk-1.3.1-orig/test/Makefile	2011-07-19 00:49:30 -0400
+++ fltk-1.3.1/test/Makefile	2013-07-17 19:22:49 -0400
@@ -260,7 +260,7 @@
 # FLUID file rules
 .fl.cxx .fl.h:	../fluid/fluid$(EXEEXT)
 	echo Generating $@ and header from $<...
-	../fluid/fluid$(EXEEXT) -c $<
+	PATH=../src:$$PATH ../fluid/fluid$(EXEEXT) -c $<
 
 # All demos depend on the FLTK library...
 $(ALL): $(LIBNAME)
