function requirementFulfilled = checkRequirementOfElk()
% checking requriements of elk-library
%
% This function is called by configElk during setup.
%
% See also: configElk

% The elk-library: convex geometry applied to crystallization modeling.
%   Copyright (C) 2012 Alexander Reinhold
%
% This program 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.
%
% This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.

%% preset - all requirements met
requirementFulfilled = 1;

%% Computer system
versionComputer = computer;
switch lower(versionComputer)
    case 'glnxa64'
        disp('You are using 64bit Linux: elk-library was developed on that system.');
    otherwise
        warning('elk:setup', ...
            ['You are using ' versionComputer ...
             ': elk library is NOT testet on this system. \n' ...
             'If you experience problems, use a 64bit linux system']);
end


%% MATLAB Version
versionMATLAB = version('-release');
switch lower(versionMATLAB)
    case '2012a'
        disp('You are using MATLAB R2012a: elk-library was developed with that version.');
    otherwise
        warning('elk:setup', ...
            ['You are using MATLAB ' versionMATLAB ...
             ': elk-library is not tested with that version. \n' ...
             'If you experience problems, use MATLAB R2011b.']);
end

%% Compiler
[statusCompiler, versionCompiler] = system('gcc-4.4 --version');
versionCompiler = versionCompiler(1:(strfind(versionCompiler, 'Copyright') - 2));
versionCompiler = versionCompiler((find(versionCompiler == ' ', 1, 'last') + 1):end);
if statusCompiler > 0
    disp('Please install gcc-4.4! (version 4.4.7 preferred)');
    disp('Note that MATLAB often requires an old gcc version.');
    requirementFulfilled = 0;
end
switch versionCompiler
    case '4.4.7'
        disp('You have installed gcc 4.4.7: elk-library was developed with that version.');
        disp('Note that MATLAB often requires an old gcc version.');
    otherwise
        warning('elk:setup', ...
            ['You are using gcc ' versionCompiler ...
             ': elk-library is not tested with that version. \n' ...
             'If you experience problems, install gcc 4.4.7.']);
end


%% MDT (M development toolbox)
% if exist('mdtVersion', 'file') && str2num(mdtVersion) >= 1
%     disp(['You are using mdt version ' num2str(mdtVersion) '.']);
% else
%     disp('Please install mdt with a current version');
%     requirementFulfilled = 0;
% end
