GNU bug report logs - #7990
Quoting problem with AM_COND_IF

Previous Next

Package: automake;

Reported by: Dennis Schridde <devurandom <at> gmx.net>

Date: Sat, 5 Feb 2011 19:46:02 UTC

Severity: normal

Tags: notabug

Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: bug-automake <at> gnu.org
Cc: 7990 <at> debbugs.gnu.org, Dennis Schridde <devurandom <at> gmx.net>
Subject: bug#7990: Quoting problem with AM_COND_IF
Date: Sat, 5 Feb 2011 22:13:47 +0100
Hello Dennis.

Thanks for the report, but what you're describing is indeed a user
error, not an automake/autoconf bug.  I'm thus closing this bug
report as invalid.

Details follow ...

On Saturday 05 February 2011, Dennis Schridde wrote:
> When I write configure.ac as quoted below and run:
>  aclocal -I m4
>  autoconf
>  automake
> the latter will respond with:
> "configure.ac:7: missing m4 quoting, macro depth 2"
>
That's because you're underquoting the call to `AM_COND_IF'.

> Changing the AS_IF line to:
>  AS_IF([test -x /bin],[
> fixes that. (Of course also insert the obvious ']')
>
It would be better to fix the `AM_COND_IF' line.  See below.

> When I then run ./configure (after running autoconf and automake again), I get 
> this error:
> ./configure: line 2428: syntax error near unexpected token `('
>
That's because you're underquoting the call to `AC_MSG_ERROR'.

> The cause is that the error message is cut off at (before) the ',' comma.
> This can be fixed by changing the AM_COND_IF line to:
>  AM_COND_IF([CONDITION],,[
> (Of course also insert the obvious ']')
>
It would be better to fix the `AC_MSG_ERROR' line.  See below.

> Since other macros defined by autoconf and automake do not have to be quoted 
> in this way,
>
Yes, they do.  See:
 <http://www.gnu.org/software/autoconf/manual/html_node/Quotation-Rule-Of-Thumb.html>
and for more details:
 <http://www.gnu.org/software/autoconf/manual/html_node/M4-Quotation.html>

> I assume that there is a quoting problem specific to AM_COND_IF. 
> I.e. AM_COND_IF does not quote its arguments hard enough, or something 
> similar.
>
No, the underquoting is in your macro calls.

> 
> --- configure.ac ---
> AC_INIT([test], [0])
> AC_CONFIG_MACRO_DIR([m4])
> AM_INIT_AUTOMAKE
> 
> AM_CONDITIONAL([CONDITION],[test -x /tmp])
> AS_IF([test -x /bin],
>     AM_COND_IF([CONDITION],,
>         AC_MSG_ERROR([comma separated, message])
>     )
> )
> 
> AC_OUTPUT([Makefile])
>
FWIW, I'd write this as:

  AC_INIT([test], [0])
  AC_CONFIG_MACRO_DIR([m4])
  AM_INIT_AUTOMAKE(foreign)

  AM_CONDITIONAL([CONDITION],[test -x /tmp])
  AS_IF([test -x /bin],
        [AM_COND_IF([CONDITION], [],
            [AC_MSG_ERROR([comma separated, message])])])

  AC_OUTPUT([Makefile])


Sorry for the curt answer, but I'm in a hurry right now.

HTH,
  Stefano




This bug report was last modified 14 years and 108 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.