[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

23.5 Future directions for macro writers

A future trend for Autoconf is to make it easier to write reliable macros and re-use macros written by others. This section will describe some of the ideas that are currently being explored by those actively working on Autoconf.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

23.5.1 Autoconf macro archive

In mid-1999, an official Autoconf macro archive was established on the World Wide Web by Peter Simons in Germany. The archive collects useful Autoconf macros that might be useful to some users, but are not sufficiently general purpose to include in the core Autoconf distribution. The URL for the macro archive is:


It is possible to retrieve macros that perform different kinds of tests from this archive. The macros can then be inserted, in line, into your ‘aclocal.m4’ or ‘acinclude.m4’ file. The archive has been steadily growing since its inception. Please try and submit your macros to the archive!

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

23.5.2 Primitive macros to aid in building macros

Writing new macros is one aspect of Autoconf that has proven troublesome to users in the past, since this is one area where Autoconf’s implementation details leak out. Autoconf extensively uses m4 to perform the translation of ‘configure.in’ to ‘configure’. Thus, it is necessary to understand implementation details such as M4s quoting rules in order to write Autoconf macros (M4).

Another aspect of macro writing which is extremely hard to get right is writing portable Bourne shell scripts (see section Writing Portable Bourne Shell). Writing portable software, be it in Bourne shell or C++, is something that can only be mastered with years of experience–and exposure to many different kinds of machines! Rather than expect all macro writers to acquire this experience, it makes sense for Autoconf to become a ‘knowledge base’ for this experience.

With this in mind, one future direction for Autoconf will be to provide a library of low-level macros to assist in writing new macros. By way of hypothetical example, consider the benefit of using a macro named AC_FOREACH instead of needing to learn the hard way that some vendor’s implementation of Bourne shell has a broken for loop construct. This idea will be explored in future versions of Autoconf.

When migrating existing packages to the GNU Autotools, which is the topic of the next chapter, it is worth remember these guidelines for best practices as you write the necessary tests to make those packages portable.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Ben Elliston on July 10, 2015 using texi2html 1.82.