function [ok,msg] = runtimeInitializationChecks
% help for RUNTIMEINITIALIZATIONCHECKS
% This function is only used in deployed mode and is called in the 
% postinit step in mclmcr. This is a utility function that performs several
% checks:
% 1) If the environment variable needs to be set, ensure it was set to yes
% Return false and an error message if any check fails.  Otherwise, return
% true

%   Copyright 2018-2020 The MathWorks, Inc.

keyfile = fullfile(matlabroot,'appdata','UserAgreementRequired');

ok = exist(keyfile,'file') ~= 2 || ...
    any(strcmpi(getenv('AgreeToMATLABRuntimeLicense'),{'y','yes'}));

if ok
    msg = '';
else
    msg = message('MCR:runtimeInitializationChecks:USER_MUST_SET_ENV_VAR').getString;
    return
end

end
