[Top][All Lists]

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

Re: Suggestion: AC_DEFINE -> m4_pattern_allow

From: Akim Demaille
Subject: Re: Suggestion: AC_DEFINE -> m4_pattern_allow
Date: Wed, 31 May 2006 16:26:17 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

>>> "Akim" == Akim Demaille <address@hidden> writes:


Some time ago I sent this message for which I had no answer.

 > I have this package at hand, say FooBar, which installs a prefixed
 > form of config.h.  Its own macros are, of course, named FB_*, which is
 > m4_pattern_forbidden.  But then I have to explicitly m4_pattern_allow
 > all my FB_PACKAGE_VERSION etc.

 > I suggest that the AC_DEFINE family explicitly allow its $1.

 > Thanks.

I suggest that Automake provide the same feature for AM_CONDITIONAL:

| [AC_PREREQ(2.52)dnl
|  ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
|       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
| if $2; then
|   $1_TRUE=
|   $1_FALSE='#'
| else
|   $1_TRUE='#'
|   $1_FALSE=
| fi
| [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
|   AC_MSG_ERROR([[conditional "$1" was never defined.
| Usually this means the macro was only invoked conditionally.]])
| fi])])

Sadly enough $1 does appear here... only in the (last) error message.
But still, if I AM_CONDITIONAL([FB_BAZ_USED], ...), I will be warned
by autoconf from terrible m4_pattern_* things.

Of course in the present case one would like to flag this precise
occurrence of $1.  Maybe something like m4_patsubst([$1],
[^\(.\)\(.*\)$], [\1@&address@hidden) (untested) should be it.  Or
m4_patsubst(quote($1)...) instead (usual dirty issues with M4 not
providing means to safely evaluate...).

Actually it might be useful to introduce m4_pattern_protect in
m4sugar, defined as above, as it is quite useful to disarm a specific
occurrence of a nasty token.

reply via email to

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