Improved C flags and build configuration handling