How to include .m4 files in Autoconf?

petersohn picture petersohn · Mar 14, 2011 · Viewed 17.4k times · Source

I have downloaded a macro from Autoconf Archive, and I want to use it. What do I have to put in my configure.ac file to make use this macro?

Answer

ldav1s picture ldav1s · Mar 14, 2011

You may want to add AC_CONFIG_MACRO_DIR to configure.ac to the directory where the macro is:

AC_CONFIG_MACRO_DIR([path/to/macros])

You'll need to invoke the macro somewhere in this file also.

and in Makefile.am you'll probably need to set up ACLOCAL_AMFLAGS (if you are using automake):

ACLOCAL_AMFLAGS         = -I path/to/macros

Then invoke autoreconf -fvi and you should be set.