Do check for the C compiler and its features

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
Simplify the main function by moving out some platform dependent code

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>