diff --git a/matlab/dynare_config.m b/matlab/dynare_config.m index e83e3f475..8cf824bf1 100644 --- a/matlab/dynare_config.m +++ b/matlab/dynare_config.m @@ -74,17 +74,46 @@ end % Add path to MEX files if exist('OCTAVE_VERSION') - path_to_mex_files = [dynareroot '../mex/octave/'] ; + addpath([dynareroot '../mex/octave/']); else - if matlab_ver_less_than('7.5') - path_to_mex_files = [dynareroot '../mex/2007a/'] ; - elseif matlab_ver_less_than('7.8') || isempty(regexp(computer, '.*64', 'ONCE')) - path_to_mex_files = [dynareroot '../mex/2007b/'] ; - else - path_to_mex_files = [dynareroot '../mex/2009a-64bit/'] ; + % Add win32 specific paths for Dynare Windows package + if strcmp(computer, 'PCWIN') + if matlab_ver_less_than('7.5') + mexpath = [dynareroot '../mex/matlab/win32-6.5.1-7.4']; + if exist(mexpath, 'dir') + addpath(mexpath) + end + else + mexpath = [dynareroot '../mex/matlab/win32-7.5-7.9']; + if exist(mexpath, 'dir') + addpath(mexpath) + end + end end + + % Add win64 specific paths for Dynare Windows package + if strcmp(computer, 'PCWIN64') + if matlab_ver_less_than('7.5') + mexpath = [dynareroot '../mex/matlab/win64-7.2-7.4']; + if exist(mexpath, 'dir') + addpath(mexpath) + end + elseif matlab_ver_less_than('7.8') + mexpath = [dynareroot '../mex/matlab/win64-7.5-7.7']; + if exist(mexpath, 'dir') + addpath(mexpath) + end + else + mexpath = [dynareroot '../mex/matlab/win64-7.8-7.9']; + if exist(mexpath, 'dir') + addpath(mexpath) + end + end + end + + % Add generic MATLAB path (with higher priority than the previous ones) + addpath([dynareroot '../mex/matlab/']); end -addpath(path_to_mex_files); %% Set mex routine names mex_status = cell(1,3); @@ -137,8 +166,6 @@ end disp(' ') disp('Configuring Dynare ...') -remove_path_to_mex = 1; - for i=1:number_of_mex_files test = (exist(mex_status{i,1},'file') == 3); if ~test @@ -151,14 +178,12 @@ for i=1:number_of_mex_files else message = '[mex] '; end - remove_path_to_mex = 0; end disp([ message mex_status{i,3} '.' ]) end % Test if bytecode DLL is present if exist('bytecode') == 3 - remove_path_to_mex = 0; if ~multithread_flag message = '[mex] '; else @@ -171,15 +196,10 @@ disp([ message 'Bytecode evaluation.' ]) % Test if k-order perturbation DLL is present if exist('k_order_perturbation') == 3 - remove_path_to_mex = 0; message = '[mex] '; else message = '[no] '; end disp([ message 'k-order perturbation.' ]) -if remove_path_to_mex - rmpath(path_to_mex_files); -end - disp(' ') \ No newline at end of file diff --git a/mex/build/matlab/configure.ac b/mex/build/matlab/configure.ac index 794ff7c83..e36adaaff 100644 --- a/mex/build/matlab/configure.ac +++ b/mex/build/matlab/configure.ac @@ -31,14 +31,6 @@ if test "x$ax_enable_matlab" = "xyes"; then if test "x$ax_matlab_version_ok" = "xyes"; then AX_MEXOPTS - - # Determine subdirectory of mex/ to be used for storing MATLAB MEX binaries - AX_COMPARE_VERSION([$MATLAB_VERSION], [le], [7.4], [DYNARE_MEXDIR="2007a"], [ - DYNARE_MEXDIR="2007b" - if test ${MATLAB_ARCH%64} != ${MATLAB_ARCH}; then - AX_COMPARE_VERSION([$MATLAB_VERSION], [ge], [7.8], [DYNARE_MEXDIR="2009a-64bit"]) - fi]) - AC_SUBST([DYNARE_MEXDIR]) fi CFLAGS="$MATLAB_CFLAGS" diff --git a/mex/build/matlab/mex.am b/mex/build/matlab/mex.am index faef016b1..5c01bb4e2 100644 --- a/mex/build/matlab/mex.am +++ b/mex/build/matlab/mex.am @@ -10,10 +10,10 @@ LDFLAGS += $(MATLAB_LDFLAGS) LIBS += $(MATLAB_LIBS) all-local: - cd $(top_srcdir)/../../$(DYNARE_MEXDIR) && \ + cd $(top_srcdir)/../../matlab && \ for p in $(PROGRAMS); do \ $(LN_S) -f $(abs_srcdir)/$$p $$p; \ done clean-local: - cd $(top_srcdir)/../../$(DYNARE_MEXDIR) && rm -f $(PROGRAMS) + cd $(top_srcdir)/../../matlab && rm -f $(PROGRAMS) diff --git a/mex/sources/build_matlab.m b/mex/sources/build_matlab.m index fa31e65e7..904f7a1da 100644 --- a/mex/sources/build_matlab.m +++ b/mex/sources/build_matlab.m @@ -63,13 +63,7 @@ if (strcmpi('GLNXA64', computer) || strcmpi('PCWIN64', computer)) ... COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -largeArrayDims' ]; end -if matlab_ver_less_than('7.5') - OUTPUT_DIR = '../2007a'; -elseif matlab_ver_less_than('7.8') || isempty(regexp(computer, '.*64','ONCE')) - OUTPUT_DIR = '../2007b'; -else - OUTPUT_DIR = '../2009a-64bit'; -end +OUTPUT_DIR = '../matlab'; disp(' ') if exist(OUTPUT_DIR,'dir') diff --git a/mex/sources/build_matlab_multithread.m b/mex/sources/build_matlab_multithread.m index b5eb07785..aaf4886ba 100644 --- a/mex/sources/build_matlab_multithread.m +++ b/mex/sources/build_matlab_multithread.m @@ -62,13 +62,7 @@ if (strcmpi('GLNXA64', computer) || strcmpi('PCWIN64', computer)) ... COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -largeArrayDims' ]; end -if matlab_ver_less_than('7.5') - OUTPUT_DIR = '../2007a'; -elseif matlab_ver_less_than('7.8') || isempty(regexp(computer, '.*64','ONCE')) - OUTPUT_DIR = '../2007b'; -else - OUTPUT_DIR = '../2009a-64bit'; -end +OUTPUT_DIR = '../matlab'; disp(' ') if exist(OUTPUT_DIR,'dir')