diff --git a/Geo/ChainComplex.cpp b/Geo/ChainComplex.cpp
index 4c73f7ee054ba7c5704d83902e23bdd257ac4094..4c7b811497cb90cd29680f79e7286358e1cdb584 100644
--- a/Geo/ChainComplex.cpp
+++ b/Geo/ChainComplex.cpp
@@ -6,6 +6,9 @@
 //  See LICENCE.txt for license information.
 //  See README.txt for more information.
 
+#include "GmshConfig.h"
+#if defined(HAVE_KBIPACK)
+
 #include "ChainComplex.h"
 
 ChainComplex::ChainComplex(CellComplex* cellComplex, int domain)
@@ -1030,3 +1033,4 @@ void HomologySequence::blockHBasis(gmp_matrix* block1T,
   destroy_gmp_matrix(temp2);
 }
 
+#endif