autoconf
[Top][All Lists]
Advanced

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

Re: local macro problem


From: Andreas Schwab
Subject: Re: local macro problem
Date: Sun, 25 Aug 2002 20:29:47 +0200
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.3.50 (ia64-suse-linux)

Harlan Stenn <address@hidden> writes:

|> I'm looking for a way to define unsigned-long constants.  I have to support
|> K&R and Ansi C compilers.
|> 
|> I have been using:
|> 
|> acconfig.h:
|> #undef ULONG_CONST
|> 
|> acinclude.m4:
|> AC_DEFUN(hs_ULONG_CONST,
|> [ AC_EGREP_CPP(Circus,
|>  [#define ACAT(a,b)a ## b
|> ACAT(Cir,cus)
|> ], AC_DEFINE([ULONG_CONST(a)], [a ## UL]),
|>     AC_EGREP_CPP(Reiser,
|> [#define RCAT(a,b)a/**/b
|> RCAT(Rei,ser)
|> ], AC_DEFINE([ULONG_CONST(a)], [a/**/L]),
|>     AC_MSG_ERROR([How do we create an unsigned long constant?])))])
|> 
|> and I'm trying to lose the entry in acconfig.h and use the "template" form
|> of AC_DEFINE.
|> 
|> The bad news is that I apparently haven't gotten the quoting right.
|> 
|> If I just add the template to AC_DEFINE(ULONG_CONST...) autosomething goes
|> insane becuase it's under-quoted.
|> 
|> If I add [] around the AC_DEFINE(ULONG_CONST...) bit then auto* is happy but
|> the resulting entry in config.h.in is Wrong.
|> 
|> Anybody have something I can swipe, or ideas on what I'm doing wrong?

Have you tried using the @%:@ quadrigraph?  Also, you should put [] around
every macro argument, especially if it contains nested macro invocations.

AC_DEFUN(hs_ULONG_CONST,
[ AC_EGREP_CPP(Circus,
 [#define ACAT(a,b)a ## b
ACAT(Cir,cus)
], [AC_DEFINE([ULONG_CONST(a)], [a @%:@@%:@ UL], [...])],
   [AC_EGREP_CPP(Reiser,
[#define RCAT(a,b)a/**/b
RCAT(Rei,ser)
], [AC_DEFINE([ULONG_CONST(a)], [a/**/L], [...])],
   [AC_MSG_ERROR([How do we create an unsigned long constant?])])])])

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

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