Hardcode paths in dynare_config.m, reflecting the FHS compliance of the package
--- a/matlab/dynare_config.m
+++ b/matlab/dynare_config.m
@@ -35,42 +35,43 @@
 if nargin
     addpath(path_to_dynare);
 end
-dynareroot = strrep(which('dynare'),'dynare.m','');
+dynareroot = '/usr/lib/dynare/matlab/';
+dynareroot_mfiles = '/usr/share/dynare/matlab/';
 
-addpath([dynareroot '/distributions/'])
-addpath([dynareroot '/kalman/'])
-addpath([dynareroot '/kalman/likelihood'])
-addpath([dynareroot '/AIM/'])
+addpath([dynareroot_mfiles '/distributions/'])
+addpath([dynareroot_mfiles '/kalman/'])
+addpath([dynareroot_mfiles '/kalman/likelihood'])
+addpath([dynareroot_mfiles '/AIM/'])
 
 % For functions that exist only under some Octave versions
 % or some MATLAB versions, and for which we provide some replacement functions
 
 if ~exist('OCTAVE_VERSION')
     % Replacements for rows() and columns() (inexistent under MATLAB)
-    addpath([dynareroot '/missing/rows_columns'])
+    addpath([dynareroot_mfiles '/missing/rows_columns'])
     % Replacement for vec() (inexistent under MATLAB)
-    addpath([dynareroot '/missing/vec'])
+    addpath([dynareroot_mfiles '/missing/vec'])
     if isempty(ver('stats'))
         % Replacements for functions of the stats toolbox
-        addpath([dynareroot '/missing/stats/'])
+        addpath([dynareroot_mfiles '/missing/stats/'])
     end
 end
 
 % ordeig() was introducted in MATLAB 7.0.1, and doesn't exist in Octave
 if exist('OCTAVE_VERSION') || matlab_ver_less_than('7.0.1')
-    addpath([dynareroot '/missing/ordeig'])
+    addpath([dynareroot_mfiles '/missing/ordeig'])
 end
 
 % rcond() and bicgstable() were introduced in Octave 3.2.0
 if exist('OCTAVE_VERSION') && octave_ver_less_than('3.2.0')
-    addpath([dynareroot '/missing/rcond'])
-    addpath([dynareroot '/missing/bicgstab'])
+    addpath([dynareroot_mfiles '/missing/rcond'])
+    addpath([dynareroot_mfiles '/missing/bicgstab'])
 end
 
 % orschur() is missing in Octave; we don't have a real replacement;
 % the one we provide just exits with an error message
 if exist('OCTAVE_VERSION')
-    addpath([dynareroot '/missing/ordschur'])
+    addpath([dynareroot_mfiles '/missing/ordschur'])
 end
 
 % Add path to MEX files
@@ -141,10 +142,10 @@
 %% subfolders if valid mex files exist.
 matlab_path = path;
 for i=1:number_of_mex_files
-    test = strfind(matlab_path,[dynareroot mex_status{i,2}]);
+    test = strfind(matlab_path,[dynareroot_mfiles mex_status{i,2}]);
     action = length(test);
     if action
-        rmpath([dynareroot mex_status{i,2}]);
+        rmpath([dynareroot_mfiles mex_status{i,2}]);
         matlab_path = path;
     end
 end
@@ -156,7 +157,7 @@
 for i=1:number_of_mex_files
     test = (exist(mex_status{i,1},'file') == 3);
     if ~test
-        addpath([dynareroot mex_status{i,2}]);
+        addpath([dynareroot_mfiles mex_status{i,2}]);
         message = '[m]   ';
     else
         message = '[mex] ';
