Improve extension lookup and config.m4 file finding