Configure.ac improvements and add custom m4 macro.