autoconf
[Top][All Lists]
Advanced

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

Re: AC_ARG_WITH


From: Stepan Kasal
Subject: Re: AC_ARG_WITH
Date: Sat, 23 Oct 2004 14:21:23 +0200
User-agent: Mutt/1.4.1i

Hello,

On Sat, Oct 23, 2004 at 11:06:10AM +1000, Russell Shaw wrote:
> AC_ARG_WITH(
>     [border],
>     AC_HELP_STRING([--with-border],
>                    [set default border size for negative plots (mm)]),
>     [[border=$withval]],
>     [[border=3]]
> )
> if test "$withval" = "yes" -o "$withval" = "no" ; then
>     AC_MSG_ERROR([Invalid value for excellon format: $withval],1)
> fi

you are out of the AC_ARG_WITH macro, so you'd be safer if you used the
$with_border variable instead of $withval.

> AC_DEFINE_UNQUOTED([GERBTOEPS_DEFAULT_BORDER],[$border],[Default border 
> size])
> 
> (i'm still not sure if double quotes [[...]] are the right thing or not)

Double brackets should be used to quote ``literal strings'', ie. strings
which don't contain m4 macros.  In your example, all single brackets can
be replaced with double, with two exceptions: the last parameter of macro
AC_HELP_STRING and AC_DEFINE_UNQUOTED---these texts may be subject to line
breaking, so they are not literal strings.

OTOH, if the text is simple and there is no danger that a m4 macro could
be invoked, you don't need any quoting.  From this perspective, you could
delete all chars [ and ] from your example and it would still work.
But it is good habit to leave the (single) brackets at least around the
descriptive texts (last params of AC_HELP_STRING and AC_DEFINE_UNQUOTED),
as they could easily contain a comma.

When you quote a parameter with single brackets, you only indicate "this
is the parameter" and nothing else.  The brackets are removed and the
rest is subject to macro expansion later.

So you can happily write:

AC_ARG_WITH(border,
        [AS_HELP_STRING(--with-border,
                [set default border size for negative plots (mm)])],
        ...

but, of course, the following would be a disaster:

AC_ARG_WITH(border,
        [[AS_HELP_STRING(--with-border,
                [set default border size for negative plots (mm)])]],

Hope this explains it.  The autoconf manual has a section about quoting.

Have a nice day,
        Stepan Kasal




reply via email to

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