diff --git a/Common/GmshMessage.h b/Common/GmshMessage.h
index 420cedcb11d903377c3330bd0212f89b540372d5..38ebc84d90a23fe72890dc7e501be6dda713c700 100644
--- a/Common/GmshMessage.h
+++ b/Common/GmshMessage.h
@@ -107,9 +107,9 @@ class Msg {
   static std::string GetExecutableName() { return _execName; }
   static void LoadOnelabClient(const std::string &name, const std::string &sockName);
   static GmshClient *GetGmshClient(){ return _client; }
-#ifdef HAVE_ONELAB2
+#if defined(HAVE_ONELAB2)
   static GmshNetworkClient *GetOnelabClient(){ return _onelabClient; }
-#else
+#elif defined(HAVE_ONELAB)
   static onelab::client *GetOnelabClient(){ return _onelabClient; }
 #endif
   static void FinalizeOnelab();