diff --git a/Geo/GModel.h b/Geo/GModel.h
index 724b49bc4845572f8cddd7dd0b63bfebbd1cb0cf..35f34dcbb09d8d06b6fd1ad0b77cdd51a8724860 100644
--- a/Geo/GModel.h
+++ b/Geo/GModel.h
@@ -177,10 +177,8 @@ class GModel
 	       double scalingFactor=1.0);
 
   // IO for CGNS files
-#if defined(HAVE_LIBCGNS)
   int readCGNS(const std::string &name);
   int writeCGNS(const std::string &name, double scalingFactor=1.0);
-#endif
 };
 
 #endif
diff --git a/Geo/GModelIO_CGNS.cpp b/Geo/GModelIO_CGNS.cpp
index 3f817d024fe98446c6f8f9ed6a8e6c344e8c4c41..26ece440ac873ec0f8cfcf27c33f70c975f7cf69 100644
--- a/Geo/GModelIO_CGNS.cpp
+++ b/Geo/GModelIO_CGNS.cpp
@@ -1,5 +1,3 @@
-#if defined(HAVE_LIBCGNS)
-
 // Copyright (C) 2006 S. Guzik, C. Geuzaine, J.-F. Remacle
 //
 // This program is free software; you can redistribute it and/or modify
@@ -33,6 +31,8 @@
 #include "MNeighbour.h"
 #include "MVertex.h"
 
+#if defined(HAVE_LIBCGNS)
+
 #include "cgnslib.h"
 
 int cgnsErr(const int cgIndexFile = -1)
@@ -558,4 +558,19 @@ int GModel::writeCGNS(const std::string &name, double scalingFactor)
   return 1;
 }
 
+#else
+
+int GModel::readCGNS(const std::string &name)
+{
+  Msg(GERROR, "This version of Gmsh was compiled without CGNS support");
+  return 0;
+}
+
+int GModel::writeCGNS(const std::string &name, double scalingFactor)
+{
+  Msg(GERROR, "This version of Gmsh was compiled without CGNS support");
+  return 0;
+}
+
 #endif
+
diff --git a/configure b/configure
index dcfefc0ef3e24e1829405ebc08443400e04a8bc3..79a94ae2b4239ac6db56a6c31b60224fa2e9cda2 100755
--- a/configure
+++ b/configure
@@ -4607,6 +4607,9 @@ case "$UNAME" in
     if test "x$enable_cygwin" != "xyes"; then
       FLAGS="${FLAGS} -DHAVE_NO_DLL"
     fi
+    if test "x${OCC}" = "xyes"; then
+      GMSH_LIBS="${GMSH_LIBS} -lwinspool"
+    fi
     if test "x$enable_gui" != "xno"; then
       GMSH_LIBS="${GMSH_LIBS} Fltk/Win32Icon.res"
     fi
diff --git a/configure.in b/configure.in
index 1fa5fc09bac5096ce378cbf06e5c66262b1f50ee..263d5dddda83f2b9f2d5787685a2619f87800c39 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-dnl $Id: configure.in,v 1.111 2006-11-20 20:41:11 geuzaine Exp $
+dnl $Id: configure.in,v 1.112 2006-11-21 12:00:57 geuzaine Exp $
 dnl
 dnl Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 dnl
@@ -592,6 +592,9 @@ case "$UNAME" in
     if test "x$enable_cygwin" != "xyes"; then
       FLAGS="${FLAGS} -DHAVE_NO_DLL"
     fi
+    if test "x${OCC}" = "xyes"; then
+      GMSH_LIBS="${GMSH_LIBS} -lwinspool"
+    fi
     if test "x$enable_gui" != "xno"; then
       GMSH_LIBS="${GMSH_LIBS} Fltk/Win32Icon.res"
     fi