Instead of reproducing the same code on each configure.ac use the common macro.
Make sure the m4 directory is known to autoconf. Also ignore the macro files copied over by libtool, gettext and the other tools.