Commit dcaed91f authored by Houtan Bastani's avatar Houtan Bastani
Browse files

fix to license call (checkout only works for Matlab version >= 2011a)

parent f9d2dec9
......@@ -15,7 +15,7 @@ function dynareroot = dynare_config(path_to_dynare,verbose)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2001-2011 Dynare Team
% Copyright (C) 2001-2012 Dynare Team
%
% This file is part of Dynare.
%
......@@ -70,8 +70,7 @@ if ~exist('OCTAVE_VERSION')
addpath([dynareroot '/missing/rows_columns'])
% Replacement for vec() (inexistent under MATLAB)
addpath([dynareroot '/missing/vec'])
[has_statistics_toolbox junk] = license('checkout','statistics_toolbox');
if ~has_statistics_toolbox
if ~user_has_matlab_license('statistics_toolbox')
% Replacements for functions of the stats toolbox
addpath([dynareroot '/missing/stats/'])
end
......@@ -101,8 +100,7 @@ if exist('OCTAVE_VERSION')
addpath([dynareroot '/missing/nanmean'])
end
else
[has_statistics_toolbox junk] = license('checkout','statistics_toolbox');
if ~has_statistics_toolbox
if ~user_has_matlab_license('statistics_toolbox')
addpath([dynareroot '/missing/nanmean'])
end
end
......
......@@ -16,7 +16,7 @@ function [x,info] = dynare_solve(func,x,jacobian_flag,varargin)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2001-2011 Dynare Team
% Copyright (C) 2001-2012 Dynare Team
%
% This file is part of Dynare.
%
......@@ -39,8 +39,7 @@ options_ = set_default_option(options_,'solve_algo',2);
info = 0;
if options_.solve_algo == 0
if ~exist('OCTAVE_VERSION')
[has_optimization_toolbox junk] = license('checkout','optimization_toolbox');
if ~has_optimization_toolbox
if ~user_has_matlab_license('optimization_toolbox')
error('You can''t use solve_algo=0 since you don''t have MATLAB''s Optimization Toolbox')
end
end
......
......@@ -55,7 +55,7 @@ function [y, info] = solve_one_boundary(fname, y, x, params, steady_state, ...
% none.
%
% Copyright (C) 1996-2011 Dynare Team
% Copyright (C) 1996-2012 Dynare Team
%
% This file is part of Dynare.
%
......@@ -225,8 +225,7 @@ for it_=start:incr:finish
disp('steady: fsolve');
end
if ~exist('OCTAVE_VERSION')
[has_optimization_toolbox junk] = license('checkout','optimization_toolbox');
if ~has_optimization_toolbox
if ~user_has_matlab_license('optimization_toolbox')
error('SOLVE_ONE_BOUNDARY: you can''t use solve_algo=0 since you don''t have MATLAB''s Optimization Toolbox')
end
end
......
function [hasLicense] = user_has_matlab_license(toolbox)
%[hasLicense] = user_has_matlab_license(toolbox)
% checks for license using the appropriate function call
%
% INPUTS
% toolbox: string for toolbox name
%
% OUTPUTS
% hasLicense: bool indicating whether or not the user has the license
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2012 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if matlab_ver_less_than('7.12')
hasLicense = license('test', toolbox);
else
[hasLicense ~] = license('checkout',toolbox);
end
end
% Copyright (C) 2011 Dynare Team
% Copyright (C) 2011-2012 Dynare Team
%
% This file is part of Dynare.
%
......@@ -71,7 +71,7 @@ end
failedBlock = {};
num_block_tests = 0;
cd([top_test_dir '/block_bytecode']);
[has_optimization_toolbox junk] = license('checkout','optimization_toolbox');
has_optimization_toolbox = user_has_matlab_license('optimization_toolbox');
for blockFlag = 0:1
for bytecodeFlag = 0:1
default_solve_algo = 2;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment