Set -O2 compiler flag by default for gcc

But only if no other optimization flags could be found.