autoconf
[Top][All Lists]
Advanced

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

Re: augmenting macros with additional expansion code


From: Bruno Haible
Subject: Re: augmenting macros with additional expansion code
Date: Sat, 12 Apr 2008 13:24:40 +0200
User-agent: KMail/1.5.4

Ralf Wildenhues answered in
http://lists.gnu.org/archive/html/bug-gnulib/2008-04/msg00116.html :

> > Eric or Ralf: I tried to add this piece of #defines to config.h only if
> > AC_PROG_CC_STDC is defined. Something like
> > 
> > AC_DEFUN([gl_COMMON_BODY], [
> >   m4_define([AC_PROG_CC_STDC], m4_defn([AC_PROG_CC_STDC])[
> >     AH_VERBATIM([...])
> >   ])
> > ])
> > 
> > but since I'm not sure whether augmenting predefined macros like this works,
> > I left it out.
> 
> In need of Gary's Trick[tm]?
> <http://lists.gnu.org/archive/html/bug-gnulib/2006-09/msg00036.html>.
> 
> It's a bit ugly in that the resulting code become pretty unobvious, and
> if more code does this, then ordering relations can easily become a
> problem.  Automake and Libtool do use it though, and it does its job.

If Automake, Libtool, Gnulib all need the functionality of augmenting a
macro's body at some point (kind of AC_REQUIRE_AFTER), then it should be
added into autoconf. Otherwise, it's unclear
  - whether the same macro can be augmented twice,
  - whether an AC_REQUIRE invocation is allowed in the augmentation,
  - whether the augmentation will be executed once, twice, or three times,
    if the macro is being invoked twice before and once after being augmented.

So what would be needed IMO is a
  AC_AUGMENT_DEFUN(macro-name, code-to-add-to-macro-definition)
macro, including documentation of what it does and what are its limitations
(e.g. that it only works on AC_DEFUNed macros).

Bruno





reply via email to

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