[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In addition to the problem of writing portable sh
code, another
problem which confronts first-time ‘configure.in’ writers is
determining the order in which to run the various tests. Autoconf
indirectly (via the autoscan
program, which we cover in
Migrating an Existing Package to GNU Autotools) suggests a standard ordering, which
is what we describe here.
The standard ordering is:
AC_INIT
(which must be first),
AM_INIT_AUTOMAKE
, AC_CONFIG_HEADER
, and perhaps
AC_REVISION
.
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 example from libgcj
:
AC_ARG_ENABLE(getenv-properties, [ --disable-getenv-properties don't set system properties from GCJ_PROPERTIES]) dnl Whether GCJ_PROPERTIES is used depends on the target. if test -n "$enable_getenv_properties"; then enable_getenv_properties=${enable_getenv_properties_default-yes} fi if test "$enable_getenv_properties" = no; then AC_DEFINE(DISABLE_GETENV_PROPERTIES) fi |
AC_CHECK_PROG
and AC_PATH_TOOL
.
AC_OUTPUT
.
This ordering should be considered a rough guideline, and not a list of hard-and-fast rules. Sometimes it is necessary to interleave tests, either to make ‘configure.in’ easier to maintain, or because the tests themselves do need to be in a different order. For instance, if your project uses both C and C++ you might choose to do all the C++ checks after all the C checks are done, in order to make ‘configure.in’ a bit easier to read.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by Ben Elliston on July 10, 2015 using texi2html 1.82.