Index: trunk/MagicSoft/Mars/macros/rootlogon.C
===================================================================
--- trunk/MagicSoft/Mars/macros/rootlogon.C	(revision 1864)
+++ trunk/MagicSoft/Mars/macros/rootlogon.C	(revision 1865)
@@ -42,5 +42,5 @@
 }
 
-void load()
+void load(TString &dir)
 {
     if (isloaded())
@@ -49,5 +49,5 @@
     cout << "Loading 'mars.so'... " << flush;
 
-    if (gSystem->Load("mars.so")!=0)
+    if (gSystem->Load(dir.IsNull() ? "mars.so" : dir+"lib/mars.so")!=0)
         cout << "error." << endl;
     else
@@ -60,5 +60,5 @@
     cout << endl;
 }
-
+/*
 void make()
 {
@@ -73,25 +73,35 @@
     load();
 }
-
+*/
 void rootlogon()
 {
     cout << endl;
 
-    load();
+    TString dir = gSystem->Getenv("MARSSYS");
 
-    gInterpreter->AddIncludePath("macros");
-    gInterpreter->AddIncludePath("manalysis");
-    gInterpreter->AddIncludePath("mbase");
-    gInterpreter->AddIncludePath("mdata");
-    gInterpreter->AddIncludePath("mfileio");
-    gInterpreter->AddIncludePath("mfilter");
-    gInterpreter->AddIncludePath("mgeom");
-    gInterpreter->AddIncludePath("mgui");
-    gInterpreter->AddIncludePath("mhist");
-    gInterpreter->AddIncludePath("mmain");
-    gInterpreter->AddIncludePath("mmc");
-    gInterpreter->AddIncludePath("mmontecarlo");
-    gInterpreter->AddIncludePath("mraw");
-    gInterpreter->AddIncludePath("mtools");
+    if (!dir.IsNull())
+    {
+        cout << "Mars found in " << dir << " (MARSSYS)" << endl << endl;
+
+        if (!dir.EndsWith("/"))
+            dir += "/";
+    }
+
+    load(dir);
+
+    gInterpreter->AddIncludePath(dir+"macros");
+    gInterpreter->AddIncludePath(dir+"manalysis");
+    gInterpreter->AddIncludePath(dir+"mbase");
+    gInterpreter->AddIncludePath(dir+"mdata");
+    gInterpreter->AddIncludePath(dir+"mfileio");
+    gInterpreter->AddIncludePath(dir+"mfilter");
+    gInterpreter->AddIncludePath(dir+"mgeom");
+    gInterpreter->AddIncludePath(dir+"mgui");
+    gInterpreter->AddIncludePath(dir+"mhist");
+    gInterpreter->AddIncludePath(dir+"mmain");
+    gInterpreter->AddIncludePath(dir+"mmc");
+    gInterpreter->AddIncludePath(dir+"mmontecarlo");
+    gInterpreter->AddIncludePath(dir+"mraw");
+    gInterpreter->AddIncludePath(dir+"mtools");
 
     if (TString("linux")==gSystem->GetBuildArch())
