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?
To create a configure script with Autoconf, you need to write an Autoconf input file configure.ac (or configure.in ) and run autoconf on it. If you write your own feature tests to supplement those that come with Autoconf, you might also write files called aclocal. m4 and acsite. m4 .
Autoconf is an extensible package of M4 macros that produce shell scripts to automatically configure software source code packages. These scripts can adapt the packages to many kinds of UNIX-like systems without manual user intervention.
The configure.ac file is used to create the ./configure script. It consists of a series of macros which are processed and expanded by autoconf . These macros can check for packages and libraries, handle --enable and --with switches, and generate various files.
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.
I had this exact same question, and it was harder to find an answer than I thought. It looked like AC_CONFIG_MACRO_DIR
was what I wanted, but if you are not using libtoolize, it appears that AC_CONFIG_MACRO_DIR
is useless at present.
If you're using automake, I think the answer above is right.
I'm not using automake, so the only way I've found is to use the m4_include
macro to suck in each .m4 file individually. I found this approach here:
http://www.flameeyes.eu/autotools-mythbuster/autoconf/macros.html
Hope this helps. (Considering how long autoconf has been around, it boggles my mind somewhat that there's no built-in way to just specify a directory in the .ac file. Seems like it would be an awefully common use case. Oh, well.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With