configure: Split test_cflags function off from check_cflags