[Libevent-users] [Patch] Install autoconf header file as evconfig.h

Nick Mathewson nickm at freehaven.net
Fri Feb 16 19:17:17 EST 2007


On Fri, Feb 16, 2007 at 04:10:03PM -0800, William Ahern wrote:
> On Fri, Feb 16, 2007 at 06:24:34PM -0500, Nick Mathewson wrote:
> > Hi, all!
> > 
> > Now that Libevent 1.3 is out, it's time for Patches Less Obvious.
> > 
> > One longstanding problems has been that it's not possible to include
> > event.h unless you first define u_int8_t, u_int32_t, struct timeval,
> > and so on.  It wasn't possible for event.h to do so itself, since the
> > info needed to decide whether to define those existed only in the
> > config.h file created by autoconf.
> > 
> > Here is a patch that solves this problem by renaming "config.h" to
> > "evconfig.h", making it get included from "event.h", and installing it
> > as a header file to $PREFIX/include.  This way, people on platforms
> > like mingw and Solaris will be able to build projects that use mingw
> > correctly.
> 
> Wouldn't it be cleaner to either
> 
> 1) Use (unsigned char) instead of (u_int8_t), (unsigned int) instead of
> (u_int32_t), and include <sys/time.h> or <timeb.h>, conditional on the
> WIN32 macro;

Actually, you'd want to do unsigned long instead of unsigned int; old C
only guarantees that int can hold 16 bits.

> or, if the above isn't portable enough from a theoretical perspective,
> 
> 2) Build an event.h using M4 and the autotools framework?
> 
> The additional header just litters things unneccesarily, especially for
> something this trivial (not to say the headaches are trivial; I build on all
> these platforms, too).

I think your approach is reasonable too in the medium term; you should
probably send a patch to the list too, so yours can win. :)

yrs,
-- 
Nick Mathewson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: not available
Url : http://monkeymail.org/archives/libevent-users/attachments/20070216/64d6dcad/attachment.bin


More information about the Libevent-users mailing list