Fix build with older gccs by detecting flags