diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt
index 072823a8d08070bbeb01a4800153671ba0e54c52..bceaadf8339117c640d78ac24e5843cd7f300293 100644
--- a/Common/CMakeLists.txt
+++ b/Common/CMakeLists.txt
@@ -5,7 +5,6 @@
 
 set(SRC  
   Gmsh.cpp
-    GmshRemote.cpp
     GmshMessage.cpp
   gmshPopplerWrapper.cpp
   Context.cpp
@@ -29,6 +28,7 @@ set(SRC
 if(ENABLE_ONELAB AND NOT ENABLE_ONELAB2)
   set(SRC
     ${SRC}
+    GmshRemote.cpp
     gmshLocalNetworkClient.cpp
   )
 endif(ENABLE_ONELAB AND NOT ENABLE_ONELAB2)
diff --git a/Common/Gmsh.cpp b/Common/Gmsh.cpp
index b4351fccd4973bd04c33af8d210dcf551cdae085..d56738295ca6957e2cf5d853e6dace1bd6c060dd 100644
--- a/Common/Gmsh.cpp
+++ b/Common/Gmsh.cpp
@@ -28,7 +28,7 @@
 //test new algo generation points
 #include "BasisFactory.h"
 
-#if defined(HAVE_ONELAB)
+#if defined(HAVE_ONELAB) && not defined(HAVE_ONELAB2)
 #include "gmshLocalNetworkClient.h"
 #endif
 
@@ -234,7 +234,9 @@ int GmshBatch()
 #endif
 
   if(CTX::instance()->batch == -3){
+#if not defined(HAVE_ONELAB2)
     GmshRemote();
+#endif
   }
   else if(CTX::instance()->batch == -2){
     GModel::current()->checkMeshCoherence(CTX::instance()->geom.tolerance);
diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp
index 863d1b59486f69eb156bcea22d8e251c6cbacd5b..8a926dd44f7a2b4435c7cd021d2fb84142900352 100644
--- a/Common/GmshMessage.cpp
+++ b/Common/GmshMessage.cpp
@@ -28,7 +28,9 @@
 #if defined(HAVE_ONELAB)
 #include "onelab.h"
 #endif
+#if not defined(HAVE_ONELAB2)
 #include "gmshLocalNetworkClient.h"
+#endif
 
 #if defined(HAVE_ONELAB2)
 #include "OnelabDatabase.h"
@@ -63,7 +65,9 @@ std::string Msg::_firstError;
 GmshMessage *Msg::_callback = 0;
 std::string Msg::_commandLine;
 std::string Msg::_launchDate;
+#if not defined(HAVE_ONELAB2)
 GmshClient *Msg::_client = 0;
+#endif
 std::string Msg::_execName;
 #if defined(HAVE_ONELAB2)
 OnelabDatabase *OnelabDatabase::_instance = NULL;
@@ -260,7 +264,9 @@ void Msg::Fatal(const char *fmt, ...)
   va_end(args);
 
   if(_callback) (*_callback)("Fatal", str);
+#if not defined(HAVE_ONELAB2)
   if(_client) _client->Error(str);
+#endif
 
 #if defined(HAVE_FLTK)
   if(FlGui::available()){
@@ -306,7 +312,9 @@ void Msg::Error(const char *fmt, ...)
   va_end(args);
 
   if(_callback) (*_callback)("Error", str);
+#if not defined(HAVE_ONELAB2)
   if(_client) _client->Error(str);
+#endif
 
 #if defined(HAVE_FLTK)
   if(FlGui::available()){
@@ -344,8 +352,9 @@ void Msg::Warning(const char *fmt, ...)
   va_end(args);
 
   if(_callback) (*_callback)("Warning", str);
+#if not defined(HAVE_ONELAB2)
   if(_client) _client->Warning(str);
-
+#endif
 #if defined(HAVE_FLTK)
   if(FlGui::available()){
     if(FlGui::instance()->in_main_thread()) FlGui::instance()->check();
@@ -380,7 +389,9 @@ void Msg::Info(const char *fmt, ...)
   va_end(args);
 
   if(_callback) (*_callback)("Info", str);
+#if not defined(HAVE_ONELAB2)
   if(_client) _client->Info(str);
+#endif
 
 #if defined(HAVE_FLTK)
 #if defined(_OPENMP)
@@ -419,7 +430,9 @@ void Msg::Direct(const char *fmt, ...)
   va_end(args);
 
   if(_callback) (*_callback)("Direct", str);
+#if not defined(HAVE_ONELAB2)
   if(_client) _client->Info(str);
+#endif
 
 #if defined(HAVE_FLTK)
 #if defined(_OPENMP)
@@ -458,7 +471,9 @@ void Msg::StatusBar(bool log, const char *fmt, ...)
   va_end(args);
 
   if(_callback && log) (*_callback)("Info", str);
+#if not defined(HAVE_ONELAB2)
   if(_client && log) _client->Info(str);
+#endif
 
 #if defined(HAVE_FLTK)
 #if defined(_OPENMP)
@@ -511,7 +526,9 @@ void Msg::Debug(const char *fmt, ...)
   va_end(args);
 
   if(_callback) (*_callback)("Debug", str);
+#if not defined(HAVE_ONELAB2)
   if(_client) _client->Info(str);
+#endif
 
 #if defined(HAVE_FLTK)
   if(FlGui::available()){
@@ -544,7 +561,9 @@ void Msg::ProgressMeter(int n, int N, bool log, const char *fmt, ...)
     va_end(args);
     sprintf(str2, "%3d%%    : %s", _progressMeterCurrent, str);
 
+#if not defined(HAVE_ONELAB2)
     if(_client) _client->Progress(str2);
+#endif
 
 #if defined(HAVE_FLTK)
     if(FlGui::available() && _verbosity > 4){
@@ -836,11 +855,7 @@ void Msg::InitializeOnelab(const std::string &name, const std::string &sockname)
     SetOnelabString(name + "/9CheckCommand", "-", false);
     SetOnelabString(name + "/9ComputeCommand", "-3", false);
     std::vector<onelab::string> ps;
-#ifdef HAVE_ONELAB2
     _onelabClient->get(ps, name + "/Action", "Gmsh");
-#else
-    _onelabClient->get(ps, name + "/Action");
-#endif
     if(ps.size()){
       Info("Performing ONELAB '%s'", ps[0].getValue().c_str());
       if(ps[0].getValue() == "initialize") Exit(0);
@@ -871,11 +886,7 @@ void Msg::InitializeOnelab(const std::string &name, const std::string &sockname)
     SetOnelabString(name + "/9ComputeCommand", "-3", false);
 
     std::vector<onelab::string> ps;
-#ifdef HAVE_ONELAB2
-    _onelabClient->get(ps, name + "/Action", "Gmsh");
-#else
     _onelabClient->get(ps, name + "/Action");
-#endif
     if(ps.size()){
       //Info("Performing ONELAB '%s'", ps[0].getValue().c_str());
       if(ps[0].getValue() == "initialize") Exit(0);
@@ -901,17 +912,17 @@ void Msg::LoadOnelabClient(const std::string &clientName, const std::string &soc
       std::vector<onelab::string> ps;
       client->get(ps,clientName+"/FullCmdLine");
       if(ps.size() && ps[0].getValue().size())
-	cmd.assign(ps[0].getValue());
+        cmd.assign(ps[0].getValue());
 
       if(cmd.size()){
-	Msg::Info("Loader calls <%s>",cmd.c_str());
-	//client->sendInfo(strcat("Loader calls",cmd.c_str()));
-	std::cout << "Loader calls " << cmd << std::endl;
-	SystemCall(cmd.c_str(),true); //true->blocking
+        Msg::Info("Loader calls <%s>",cmd.c_str());
+	      //client->sendInfo(strcat("Loader calls",cmd.c_str()));
+	      std::cout << "Loader calls " << cmd << std::endl;
+	      SystemCall(cmd.c_str(),true); //true->blocking
       }
       else
-	Msg::Info("No full command line found for <%s>",
-		    clientName.c_str());
+	      Msg::Info("No full command line found for <%s>",
+		      clientName.c_str());
     }
     Msg::Info("Stopping client <%s>", clientName.c_str());
     delete client;
@@ -1175,7 +1186,7 @@ void Msg::ImportPhysicalsAsOnelabRegions()
 
 void Msg::RunOnelabClient(const std::string &name, const std::string &command)
 {
-#if defined(HAVE_ONELAB)
+#if defined(HAVE_ONELAB) && not defined(HAVE_ONELAB2)
   onelab::server::citer it = onelab::server::instance()->findClient(name);
   onelab::client *client = 0;
   if(it != onelab::server::instance()->lastClient()){
diff --git a/Common/GmshMessage.h b/Common/GmshMessage.h
index 37e59c8da42de5105d569aa0c94efed95774d86d..26ec702da4f06213da5c4e20c13c3ad0759614cc 100644
--- a/Common/GmshMessage.h
+++ b/Common/GmshMessage.h
@@ -46,8 +46,10 @@ class Msg {
   static GmshMessage *_callback;
   // command-line and startup time
   static std::string _commandLine, _launchDate;
+#if not defined(HAVE_ONELAB2)
   // communication with Gmsh when run remotely
   static GmshClient *_client;
+#endif
 #if defined(HAVE_ONELAB2)
   // communication with onelab server (replace _client and old _onelabClient)
   static OnelabDatabase *_onelabClient;
@@ -106,7 +108,11 @@ class Msg {
   static void SetExecutableName(const std::string &name) { _execName.assign(name); }
   static std::string GetExecutableName() { return _execName; }
   static void LoadOnelabClient(const std::string &name, const std::string &sockName);
+#if not defined(HAVE_ONELAB2)
   static GmshClient *GetGmshClient(){ return _client; }
+#else
+  static int GetGmshClient(){ return 1; }
+#endif
 #if defined(HAVE_ONELAB2)
   static OnelabDatabase *GetOnelabClient(){ return _onelabClient; }
 #elif defined(HAVE_ONELAB)
diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp
index a7b53a44380e17bc08f21d756f6efccba134d922..3ba3cfef2136eceb9605122e22a72adeee7de0c3 100644
--- a/Fltk/graphicWindow.cpp
+++ b/Fltk/graphicWindow.cpp
@@ -33,7 +33,9 @@ typedef unsigned long intptr_t;
 #include "fieldWindow.h"
 #include "pluginWindow.h"
 #include "helpWindow.h"
+#if not defined(HAVE_ONELAB2)
 #include "gmshLocalNetworkClient.h"
+#endif
 #include "fileDialogs.h"
 #include "extraDialogs.h"
 #include "partitionDialog.h"
@@ -180,6 +182,7 @@ static void file_clear_cb(Fl_Widget *w, void *data)
 
 static void file_remote_cb(Fl_Widget *w, void *data)
 {
+#if not defined(HAVE_ONELAB2)
   onelab::localNetworkClient *c;
   onelab::server::citer it = onelab::server::instance()->findClient("GmshRemote");
   if(it == onelab::server::instance()->lastClient()){
@@ -223,6 +226,7 @@ static void file_remote_cb(Fl_Widget *w, void *data)
       server->SendString(GmshSocket::GMSH_SPEED_TEST, "Speed test");
     }
   }
+#endif
 }
 
 static void file_window_cb(Fl_Widget *w, void *data)
diff --git a/Fltk/onelab2Group.h b/Fltk/onelab2Group.h
index 5a945860dd7895ea5acfeb22f847b1c72f503fd4..7981a28e039aa4db19e121578f71d6422ac7085e 100644
--- a/Fltk/onelab2Group.h
+++ b/Fltk/onelab2Group.h
@@ -89,6 +89,7 @@ public:
 void connect_cb(Fl_Widget *w, void *arg);
 void onelab_cb(Fl_Widget *w, void *data);
 inline void onelab_cb(void *data) {onelab_cb(0, data);}
-void solver_cb(void *data);
+void solver_cb(Fl_Widget *w, void *data);
+inline void solver_batch_cb(void *data){} // TODO ?
 
 #endif
diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp
index e560be4ccb7975efedf6212a8bd1fc23854d00f4..34f69a04d384b427a3ce8f6c3d87ba295bf3c52e 100644
--- a/Fltk/optionWindow.cpp
+++ b/Fltk/optionWindow.cpp
@@ -36,7 +36,7 @@ typedef unsigned long intptr_t;
 #include "Context.h"
 #include "StringUtils.h"
 
-#if defined(HAVE_ONELAB)
+#if defined(HAVE_ONELAB) && not defined(HAVE_ONELAB2)
 #include "gmshLocalNetworkClient.h"
 #endif
 
@@ -569,7 +569,7 @@ static void solver_options_ok_cb(Fl_Widget *w, void *data)
   optionWindow *o = FlGui::instance()->options;
   o->activate((const char*)data);
 
-#if defined(HAVE_ONELAB)
+#if defined(HAVE_ONELAB) && not defined(HAVE_ONELAB2)
   int old_listen = (int)opt_solver_listen(0, GMSH_GET, o->solver.butt[0]->value());
   opt_solver_listen(0, GMSH_SET, o->solver.butt[0]->value());
   if(!old_listen && o->solver.butt[0]->value()){