Next: , Previous: Package Options, Up: Site Configuration


14.4 Making Your Help Strings Look Pretty

Properly formatting the `help strings' which are used in AC_ARG_WITH (see External Software) and AC_ARG_ENABLE (see Package Options) can be challenging. Specifically, you want your own `help strings' to line up in the appropriate columns of `configure --help' just like the standard Autoconf `help strings' do. This is the purpose of the AS_HELP_STRING macro.

— Macro: AS_HELP_STRING (left-hand-side, right-hand-side)

Expands into an help string that looks pretty when the user executes `configure --help'. It is typically used in AC_ARG_WITH (see External Software) or AC_ARG_ENABLE (see Package Options). The following example makes this clearer.

          AC_ARG_WITH([foo],
            [AS_HELP_STRING([--with-foo],
               [use foo (default is no)])],
            [use_foo=$withval],
            [use_foo=no])
     

The second argument of AS_HELP_STRING is not a literal, and should not be double quoted. See Autoconf Language, for a more detailed explanation. Then the last few lines of `configure --help' appear like this:

          --enable and --with options recognized:
            --with-foo              use foo (default is no)
     

The AS_HELP_STRING macro is particularly helpful when the left-hand-side and/or right-hand-side are composed of macro arguments, as shown in the following example.

          AC_DEFUN([MY_ARG_WITH],
            [AC_ARG_WITH([$1],
               [AS_HELP_STRING([--with-$1], [use $1 (default is $2)])],
               [use_[]$1=$withval],
               [use_[]$1=$2])])