www.delorie.com/gnu/docs/autoconf/autoconf_132.html   search  
Buy the book!


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.3 Making Your Help Strings Look Pretty

Properly formatting the `help strings' which are used in AC_ARG_WITH (see section 12.1 Working With External Software) and AC_ARG_ENABLE (see section 12.2 Choosing 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 AC_HELP_STRING macro.

Macro: AC_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 section 12.1 Working With External Software) or AC_ARG_ENABLE (see section 12.2 Choosing Package Options). The following example will make this clearer.

                            [use foo (default is NO)]),
             [ac_cv_use_foo=$withval], [ac_cv_use_foo=no])
AC_CACHE_CHECK([whether to use foo],
               [ac_cv_use_foo], [ac_cv_use_foo=no])])

Please note that the call to AC_HELP_STRING is unquoted. Then the last few lines of `configure --help' will appear like this:

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

The AC_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_HELP_STRING([--with-$1], [use $1 (default is $2)]),
             ac_cv_use_$1=$withval, ac_cv_use_$1=no),
AC_CACHE_CHECK(whether to use $1, ac_cv_use_$1, ac_cv_use_$1=$2)])

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003