function [installer,major,minor,update,platform]=mcrinstaller
%MCRINSTALLER Display version and location of available MATLAB Runtime Installers
%
%   This function returns version and location information for the MATLAB Runtime
%   installer corresponding to the current platform.
%
%   [INSTALLER, MAJOR, MINOR, UPDATE, PLATFORM] = mcrinstaller;
%
%   INSTALLER: The full path to the installer for the current platform.
%   MAJOR: The major version number of the installer.
%   MINOR: The minor version number of the installer.
%   UPDATE: The update version number of the installer.
%   PLATFORM: The name of the current platform, all uppercase. (The value 
%             returned by UPPER(COMPUTER('arch'))).
%
%   You must distribute the MATLAB Runtime library to your end users to enable 
%   them to run applications developed with the MATLAB Compiler.
% 
%   Prebuilt MATLAB Runtime installers for all your licensed platforms ship with the 
%   MATLAB Compiler. 
%
%   Run the DOC command and search for 'MATLAB Runtime Installer' for complete 
%   instructions.

% Copyright 2007-2017 The MathWorks, Inc.

% Locate the MATLAB Runtime installer on this machine
s = settings;
downloaded_installer = '';
if s.hasGroup('matlabCompiler')
    compilerGroup = s.matlabCompiler;
    if compilerGroup.hasSetting('RuntimeInstaller')
        downloaded_installer = compilerGroup.RuntimeInstaller.PersonalValue;
    end
end

if exist(downloaded_installer, 'file') == 2
    installer = downloaded_installer;
    [major, minor, update] = mcrversion;
    platform = upper(computer('arch'));
else
    installer = '';
    major = []; minor = []; update = [];
    platform = '';
    disp(getString(message('Compiler:runtime:downloadCommand')));
end
