Thien-Thi Nguyen wrote:
Fred Proctor <[EMAIL PROTECTED]> writes:

How can one get AC_DEFINE to define a variable with an argument
list?  I want to do something like this:

AC_DEFINE(incr(x),((x)+1),"increment")

i think either you misunderstand AC_DEFINE or i misunderstand you.
where in the documentation is the possibility of such a construct
suggested?

Actually, it *is* possible to define macros+arguments with autoconf (version 2.50 or later); in fact, that's how autoconf itself defines F77_FUNC etcetera for AC_F77_WRAPPERS. However, you are correct in that (I think) it's not adequately documented.

As for the original poster's code, there are three problems that are preventing it from working. (1) It's underquoted. (2) "incr" is an m4 built-in, so that causes extra breakage unless you rename your macro. (3) When using AC_DEFINE for a macro, you need to use AH_TEMPLATE to give its config.h.in template separately. The following works for me:

        AH_TEMPLATE([INCR], [increment])
        AC_DEFINE([INCR(x)], [((x)+1)])

Cordially,
Steven G. Johnson



Reply via email to