"Help" string variable substitution for "configure --help"

autoconf, autotools, m4

Solution

Define the string as an M4 macro:

m4_define([FOOBAR_HELP_STR], [Turn on the foobar features])
AC_ARG_ENABLE([foobar], [AS_HELP_STRING([--enable-foobar], FOOBAR_HELP_STR)])

Problem

I have a string that I want to use multiple times for the output of `configure --help`. So I try doing something like this in `configure.ac`: ``` AC_ARG_ENABLE([foobar], AS_HELP_STRING([--enable-foobar], [$foobar_help_str])) ``` But no expansion or substitution is done, so the output is just `$foobar_help_str`.

Original source