autoconf-patches
[Top][All Lists]
Advanced

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

Re: Why doesn't this quote properly?


From: Stepan Kasal
Subject: Re: Why doesn't this quote properly?
Date: Thu, 25 Nov 2004 15:48:05 +0100
User-agent: Mutt/1.4.1i

Hello Akim,

On Thu, Nov 25, 2004 at 03:04:03PM +0100, Akim Demaille wrote:
> >>> "Stepan" == Stepan Kasal <address@hidden> writes:
>  > I second the voices asking for maximal quoting.
> 
> Nope, I don't promote maximal quoting, which is painful (have a look
> at Bison's skeletons).  I recommend regular quoting: 1 per level.

well, I admit we can go this way for the first example.

> [...] (ie. the situation you describe, where someone named an M4 macro
> ac_* which explicitly belongs to sh).

No, my example is not of that kind.

I admit it is tricky.  So please let me describe the situation.  With the
following code:

AC_DEFUN([MY_ARG_WITH],
  [AC_ARG_WITH([$1],
     [AS_HELP_STRING([--with-$1], [use $1 (default is $2)])],
     [ac_cv_use_$1=$withval],
     [ac_cv_use_$1=$2])])

AC_DEFUN([MY_FOO], [foo])
AC_DEFUN([MY_NO], [no])
MY_ARG_WITH([MY_FOO], [MY_NO])

The last line expands to:

AC_ARG_WITH([MY_FOO],
     [AS_HELP_STRING([--with-MY_FOO], [use MY_FOO (default is MY_NO)])],
     [ac_cv_use_MY_FOO=$withval],
     [ac_cv_use_MY_FOO=MY_NO])

later on, the word ac_cv_use_MY_FOO is outputted literally. So you have
        ac_cv_use_MY_FOO=$withval
insted of
        ac_cv_use_foo=$withval
and the resulting configure script is broken.

This can be fixed this way:
     [[ac_cv_use_]$1=$withval],
     [[ac_cv_use_]$1=$2])])
or this way:
     [ac_cv_use_[]$1=$withval],
     [ac_cv_use_[]$1=$2])])

If you used the following instead:
        MY_ARG_WITH(MY_FOO, MY_NO)
the bug wouldn't bite, as the macros would have been expanded before
parameter substitution.

Of course, we don't have to explain these subtleties to the manual reader,
but we should get the example correct for general usage.

Regards,
        Stepan




reply via email to

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