From d7c253ae59fb193600e9976c44a6f4dbb3feb998 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Thu, 26 Mar 2015 19:08:30 +0100 Subject: [PATCH] support 64-bit preprocessor, #862 --- .gitignore | 2 ++ matlab/dynare.m | 18 ++++++++++++++++-- preprocessor/Makefile.am | 7 ++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 6feb45057..367fb3503 100644 --- a/.gitignore +++ b/.gitignore @@ -97,6 +97,8 @@ mex/build/matlab/run_m2html.m # Preprocessor /preprocessor/dynare_m /preprocessor/dynare_m.exe +/preprocessor/dynare_m64 +/preprocessor/dynare_m64.exe /preprocessor/DynareBison.cc /preprocessor/DynareBison.hh /preprocessor/FlexLexer.h diff --git a/matlab/dynare.m b/matlab/dynare.m index d72d20787..299b073e9 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -16,7 +16,7 @@ function dynare(fname, varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2001-2014 Dynare Team +% Copyright (C) 2001-2015 Dynare Team % % This file is part of Dynare. % @@ -145,7 +145,21 @@ if exist(fname(1:end-4),'dir') && exist([fname(1:end-4) filesep 'hooks'],'dir') run([fname(1:end-4) filesep 'hooks/priorprocessing']) end -command = ['"' dynareroot 'dynare_m" ' fname] ; +if ispc + [junk, arch] = getenv('PROCESSOR_ARCHITECTURE'); +else + [junk, arch] = system('uname -m'); +end + +if isempty(strfind(arch, '64')) + arch_ext64 = ''; + disp('Using 32-bit preprocessor'); +else + arch_ext64 = '64'; + disp('Using 64-bit preprocessor'); +end + +command = ['"' dynareroot 'dynare_m' arch_ext64 '" ' fname] ; for i=2:nargin command = [command ' ' varargin{i-1}]; end diff --git a/preprocessor/Makefile.am b/preprocessor/Makefile.am index aea2e45a7..bce3bbe68 100644 --- a/preprocessor/Makefile.am +++ b/preprocessor/Makefile.am @@ -69,7 +69,12 @@ DynareBison.cc DynareBison.hh location.hh stack.hh position.hh: DynareBison.yy $(YACC) -o DynareBison.cc DynareBison.yy all-local: - cd ../matlab && $(LN_S) -f $(abs_srcdir)/$(PROGRAMS) $(PROGRAMS) + if [ -z "`file $(PROGRAMS) | grep x86.64`" ]; then \ + ARCH=""; \ + else \ + ARCH="64"; \ + fi; \ + cd ../matlab && $(LN_S) -f $(abs_srcdir)/$(PROGRAMS) $(PROGRAMS)$$ARCH if HAVE_DOXYGEN html-local: