add gcc 4.8 support and build optimisation flags