diff --git a/Geo/CellComplex.cpp b/Geo/CellComplex.cpp
index e7b608f1fc0e202c414e9d7f342396f75d9913d2..64d87e5fe10146284028cc629c3c4f0a8a8be499 100644
--- a/Geo/CellComplex.cpp
+++ b/Geo/CellComplex.cpp
@@ -7,6 +7,7 @@
 
 #include "CellComplex.h"
 
+#if defined(HAVE_KBIPACK)
 
 CellComplex::CellComplex( std::vector<GEntity*> domain, std::vector<GEntity*> subdomain ){
   
@@ -795,4 +796,4 @@ void CellComplex::printComplex(int dim){
   }
 }
 
-
+#endif
diff --git a/Geo/CellComplex.h b/Geo/CellComplex.h
index c4a415654f060d8079080efd002988b019c1b749..1252592f3186d91a0c8d8f5f6c708511cb879e60 100644
--- a/Geo/CellComplex.h
+++ b/Geo/CellComplex.h
@@ -25,6 +25,7 @@
 #include "GFace.h"
 #include "GVertex.h"
 
+#if defined(HAVE_KBIPACK)
 
 // Abstract class representing an elemtary cell of a cell complex.
 class Cell
@@ -661,3 +662,5 @@ class CellComplex
 };
 
 #endif
+
+#endif
diff --git a/Geo/ChainComplex.cpp b/Geo/ChainComplex.cpp
index c5e3fca8c8fe0e557fb26f4757df5abc632b9aa8..876f9ae76aff53451da2f5872abf42ee7a2a694b 100644
--- a/Geo/ChainComplex.cpp
+++ b/Geo/ChainComplex.cpp
@@ -437,8 +437,6 @@ std::vector<int> ChainComplex::getCoeffVector(int dim, int chainNumber){
   
 }
 
-#endif
-
 Chain::Chain(std::set<Cell*, Less_Cell> cells, std::vector<int> coeffs, CellComplex* cellComplex, std::string name){
   
   int i = 0;
@@ -524,3 +522,5 @@ void Chain::getData(std::map<int, std::vector<double> > & data){
   
   return; 
 }
+
+#endif
diff --git a/Geo/Homology.cpp b/Geo/Homology.cpp
index 6ff1b406f729f127078727cceb988e6a62028dc8..6b1f79aa2e8ffaa5405be7dafc92229b5480019e 100644
--- a/Geo/Homology.cpp
+++ b/Geo/Homology.cpp
@@ -9,7 +9,7 @@
 #include "Homology.h"
 #include "ChainComplex.h"
 
-
+#if defined(HAVE_KBIPACK)
 Homology::Homology(GModel* model, std::vector<int> physicalDomain, std::vector<int> physicalSubdomain){
   
   _model = model;
@@ -147,3 +147,4 @@ void Homology::findThickCuts(std::string fileName){
   delete chains;
   
 }
+#endif
diff --git a/Geo/Homology.h b/Geo/Homology.h
index 1e805b0db741acf2abc11f25ba66e2802e77c4e8..b5f013653b0e8cc118e28614a6f72f8c97635043 100644
--- a/Geo/Homology.h
+++ b/Geo/Homology.h
@@ -9,9 +9,10 @@
 #define _HOMOLOGY_H_
 
 #include <sstream>
-
 #include "CellComplex.h"
 
+#if defined(HAVE_KBIPACK)
+
 template <class TTypeA, class TTypeB>
 bool convert(const TTypeA& input, TTypeB& output ){
    std::stringstream stream;
@@ -40,3 +41,5 @@ class Homology
 };
 
 #endif
+
+#endif
diff --git a/Plugin/HomologyComputation.cpp b/Plugin/HomologyComputation.cpp
index 0587ec553d416bb1e769593fce23df1f9365e46d..b7d4825630aba5d476f08ffee1849c6f9e70a78d 100644
--- a/Plugin/HomologyComputation.cpp
+++ b/Plugin/HomologyComputation.cpp
@@ -13,7 +13,7 @@
 #include "PViewDataGModel.h"
 #include "HomologyComputation.h"
 
-
+#if defined(HAVE_KBIPACK)
 StringXNumber HomologyComputationOptions_Number[] = {
   {GMSH_FULLRC, "Physical group for domain", NULL, 0.},
   {GMSH_FULLRC, "Physical group for subdomain", NULL, 0.},
@@ -115,3 +115,5 @@ PView *GMSH_HomologyComputationPlugin::execute(PView *v)
   
   return 0;
 }
+
+#endif
diff --git a/Plugin/HomologyComputation.h b/Plugin/HomologyComputation.h
index 5af64b6acfb3c92105f9f573632a93824e02bd63..b5e43f87389465f1ef19a537e865a3ed8b9d1a26 100644
--- a/Plugin/HomologyComputation.h
+++ b/Plugin/HomologyComputation.h
@@ -11,6 +11,7 @@
 #include <string>
 #include "Plugin.h"
 
+#if defined(HAVE_KBIPACK)
 extern "C"
 {
   GMSH_Plugin *GMSH_RegisterHomologyComputationPlugin();
@@ -31,3 +32,5 @@ public:
 };
 
 #endif
+
+#endif
diff --git a/Plugin/PluginManager.cpp b/Plugin/PluginManager.cpp
index 64b0455ffe3839cfdb01fe432ae02a856344e395..0485342d86641294895e3f4a5f9950d14bc0300d 100644
--- a/Plugin/PluginManager.cpp
+++ b/Plugin/PluginManager.cpp
@@ -229,8 +229,10 @@ void PluginManager::registerDefaultPlugins()
 #endif
     allPlugins.insert(std::pair<const char*, GMSH_Plugin*>
                       ("FiniteElement", GMSH_RegisterFiniteElementPlugin()));
+#if defined(HAVE_KBIPACK)
     allPlugins.insert(std::pair<const char*, GMSH_Plugin*>
                       ("HomologyComputation", GMSH_RegisterHomologyComputationPlugin()));
+#endif
   }
 
 #if defined(HAVE_FLTK)