There was an error in AX_PROG_CC_FOR_BUILD macro that cached literal name of the cache variable `saved_ac_cv_c_compiler_gnu` instead of the value of said variable breaking the consecutive runs of ./configure script with caching enabled.