automake
[Top][All Lists]
Advanced

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

Re: How to get AC_DEFINE to generate a macro, e.g., #define incr(x) ((x)


From: Steven G. Johnson
Subject: Re: How to get AC_DEFINE to generate a macro, e.g., #define incr(x) ((x)+1) ?
Date: Thu, 09 Jun 2005 23:21:15 -0400
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

Thien-Thi Nguyen wrote:
Fred Proctor <address@hidden> 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

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