Autoconf, Automake, and Libtool: Syntactic conventions

| ### 21.5.1 Syntactic conventions Some conventions have grown over the life of the GNU Autotools, mostly as a disciplined way of avoiding M4 pitfalls. These conventions are designed to make your macros more robust, your code easier to read and, most importantly, improve your chances for getting things to work the first time! A brief list of recommended conventions appears below: Do not use the M4 built-in `changequote`. Any good macro will already perform sufficient quoting. Never use the argument macros (e.g. ``$1'`) within shell comments and dnl remarks. If such a comment were to be placed within a macro definition, M4 will expand the argument macros leading to strange results. Instead, quote the argument number to prevent unwanted expansion. For instance, you would use ``$[1]'` in the comment. Quote the M4 comment character, ``#'`. This can appear often in shell code fragments and can have undesirable effects if M4 ignores any expansions in the text between the ``#'` and the next newline. In general, macros invoked from ``configure.in'` should be placed one per line. Many of the GNU Autotools macros conclude their definitions with a `dnl` to prevent unwanted whitespace from accumulating in ``configure'`. Many of the `AC_` macros, and others which emulate their good behavior, permit default values for unspecified arguments. It is considered good style to explicitly show your intention to use an empty argument by using a pair of quotes, such as `[]`. Always quote the names of macros used within the definitions of other macros. When writing new macros, generate a small ``configure.in'` that uses (and abuses!) the macro--particularly with respect to quoting. Generate a ``configure'` script with `autoconf` and inspect the results.

This document was generated by Gary V. Vaughan on February, 8 2006 using texi2html