[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A few suggestions for autoheader
From: |
Nicholas Wourms |
Subject: |
A few suggestions for autoheader |
Date: |
Thu, 16 Oct 2003 15:58:49 -0400 |
User-agent: |
Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) |
Hi,
I think that maximum control over the format of the generated template
is very desirable if not crucial, especially if it is an installed file.
However the convenience of autoheader is just too good to go without.
So, in the spirit of that, I have a few suggestions about how to make
the various AH_* macros more extensible:
1) Allow another (optional) argument which would define the ordinal of
placement for the cpp macro template, placing it before any cpp macros
without ordinal definitions. The ones without ordinal definitions will
revert to the default ordering scheme currently being used. Of course,
one could really go farther building on this idea, but for now I just
wanted to keep it simple.
i.e:
...
AH_TEMPLATE([FOO1], [Define to 1 if foo1], [1])
...
AH_TEMPLATE([FOO2], [Define to 1 if foo2])
...
AH_TEMPLATE([FOO3], [Define to 1 if foo3], [2])
would be placed like:
>>>>>>>>>>>
/* Define to 1 if foo1 */
#undef FOO1
/* Define to 1 if foo3 */
#undef FOO3
/* Define to 1 if foo2*/
#undef FOO2
>>>>>>>>>>>
2)Often times you might want to group a set of cpp macros together under
one comment, so something analogous to the relationship between
AC_CHECK_FUNC and AC_CHECK_FUNCS would be ideal. So tentatively this
functionality would be in the form of AC_DEFINES, AH_TEMPLATE, and
AH_VERBATIMS.
i.e.
AH_TEMPLATES([FOO1 FOO2 FOO3],
[At least one of the following should be defined if blah... ])
would look like:
>>>>>>>>>>>
/* At least one of the following should be defined if blah... */
#undef FOO1
#undef FOO2
#undef FOO3
>>>>>>>>>>>
3)There are instances of packages installing autoheader generated files
into global include subdirectories (i.e. cyrus snmp). This can be a
real pain if, as a developer, you are building against two packages,
both of which have installed config.h files and made them public. This
inevitably leads to the definition and redefinition the same cpp macro
(thus causing lots of gcc noise and errors if they conflict). To
mitigate this, I suggest another new autoconf macro, AH_IFNDEF. The
idea is that given AH_IFNDEF without any args in configure.in,
autoheader will guard each cpp macro by wrapping it like so:
>>>>>>>>>>>
#ifndef <macro name>
# undef <macro name>
#endif /* !<macro name> */
>>>>>>>>>>>
If given a list of cpp macro name(s) as argument(s), AH_IFNDEF will only
guard those specific cpp macro(s) in the list. This is useful since it
could really save a lot of unnecessary tedious AH_VERBATIM redundancy.
Of course it is left as an exercise to the developer using the package
as to which config.h comes first, but you get the point. The basic idea
is to make installed config.h's as sanitary as possible.
Working with m4 often give me a headache, not to mention I'm really
terrible at it. So, I hope someone finds one or all of these ideas
interesting and can actually do the m4 programming needed to bring them
to fruition.
Cheers,
Nicholas
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- A few suggestions for autoheader,
Nicholas Wourms <=