autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic strings in help text


From: Stepan Kasal
Subject: Re: dynamic strings in help text
Date: Mon, 20 Mar 2006 22:48:19 +0100
User-agent: Mutt/1.4.1i

Hello,

On Mon, Mar 20, 2006 at 03:58:50PM -0500, Dan McMahill wrote:
> I have a configure.ac file which has some shell commands to set a 
> variable which I want to later use in a help string.  The shell commands 
> basically just enumerate modules contained in the source directory.

generally speaking, this is not supported.  You are supposed to list all
the possible values staticly (or not to list them) and do the check
whether the particular value is allowed only as part of the real
configuration.
Perhaps you could live with that limitation?

You can do some hacks to work around this, but the hacks will depend on
specific version of Autoconf, and may break in the future.

Though I advise against such hacks, I'll describe them below.

> # some shell commands which give a value for the
> # hid_guis variables
> 
> AC_MSG_CHECKING([for which gui to use])
> AC_ARG_WITH([gui],
> [  --with-gui=  Specify the GUI to use: $hid_guis],
> [],
> [with_gui=gtk]
> )
> 
> This doesn't work for 2 reasons.
> 
> 1)  The help string stuff ends up in configure before the code which 
> sets hid_guis.

You can send the shell code to the top, perhaps by

m4_divert_text([DEFAULTS], [
...
hid_guis=...
])

> 2)  The help string is printed with
> 
> cat <<\_AC_EOF
> 
> help text
> 
> AC_EOF

You can give empty help text and insert the help manually:

AC_ARG_WITH([gui], [], [...], [...])
m4_divert_text([HELP_WITH],
[AC_EOF
cat <<_AC_EOF
  --with-gui=  Specify the GUI to use: $hid_guis
AC_EOF
cat <<\_AC_EOF]

The empty help text becomes an empty line, but I suppose you don't mind
that much.

Happy hacking,
        Stepan Kasal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]