5.3. Ordering Tests

In addition to the problem of writing portable sh code, another problem confronts first-time 'configure.in' writers: determining the order in which to run the various tests. Autoconf indirectly (via the autoscan program covered in Chapter 23) suggests a standard ordering, as described here.

The standard ordering is as follows:

  1. Boilerplate. This section should include standard boilerplate code, such as the call to AC_INIT (which must be first), AM_INIT_AUTOMAKE, AC_CONFIG_HEADER, and perhaps AC_REVISION.

  2. Options. The next section should include macros that add command-line options to configure, such as AC_ARG_ENABLE. It is typical to put support code for the option in this section as well, if it is short enough, like this ...

Get GNU Autoconf, Automake, and Libtool now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.