Subject: bug#7990: Quoting problem with AM_COND_IF

From: Dennis Schridde <[email-masked]>
Date: Sat, 5 Feb 2011 20:26:39 +0100

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"

Changing the AS_IF line to:
 AS_IF([test -x /bin],[
fixes that. (Of course also insert the obvious ']')

When I then run ./configure (after running autoconf and automake again), I get 
this error:
./configure: line 2428: syntax error near unexpected token `('

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 ']')

Since other macros defined by autoconf and automake do not have to be quoted 
in this way, 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.

--- 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])

--- Makefile.am ---
ACLOCAL_AMFLAGS = -I m4