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
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 (21. M4).
Another aspect of macro writing which is extremely hard to get right is
writing portable Bourne shell scripts (see section 22. 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
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