Thursday, December 11, 2008

autoconf: square brackets in AS_HELP_STRING

With autoconf(2.63) if I wanted to use square brackets for AS_HELP_STRING I didn't succeed. I have been trying to add extra [] around the helpstring according to manual:

Each time there can be a macro expansion, there is a quotation expansion, i.e., one level of quotes is stripped:
int tab[10];
     =>int tab10;
     [int tab[10];]
     =>int tab[10];

The solution I've found in configure.ac of qore programming language.
The quadrigraphs are used there.
'@<:@' for '[' and '@:>@' for ']' could be used in autoconf input file.
So now I have nice output of ./configure --help in my project:
....
  --with-mysql[=DIR]      use mysql
  --with-fcgi[=DIR]       use fast CGI
  --with-pcre[=DIR]       use pcre
....
The code in configure.in looks like:
....
AS_HELP_STRING([--with-sqlite@<:@=DIR@:>@], [use sqlite])...
....

2 comments:

Unknown said...

I'm glad that qore was finally useful for someone :-)

David (author of the qore programming language)

Ni@m said...

I thought it's widely used in banking systems =)
How's the work there, David?
Can we have a chat somehow?