[libvirt] [PATCH] Missing htonl (etc) on MinGW

Jim Meyering jim at meyering.net
Tue Jul 8 17:43:07 UTC 2008


"Richard W.M. Jones" <rjones at redhat.com> wrote:
> With the attached patch you can get all the way through a compile of
> libvirt using the MinGW cross-compiler.
...
> Index: configure.in
> ===================================================================
...
> -AC_CHECK_FUNCS([cfmakeraw regexec uname sched_getaffinity])
> +AC_CHECK_FUNCS([cfmakeraw regexec uname sched_getaffinity ntohl htonl ntohs htons])

Hi Rich,

That looks fine.
Two suggestions and a question:

If you add those on a separate line, not only will these related
checks be all by themselves (less risk of eventual conflict, however small),
you'll also avoid going over the 80-col line-length limit ;-)

AC_CHECK_FUNCS([ntohl htonl ntohs htons])

...
> Index: include/byteswap.h
> ===================================================================
...
> +#ifndef _PORTABLEXDR_BYTESWAP_H
> +#define _PORTABLEXDR_BYTESWAP_H 1

A different name file name might be nice, so this file is not
confused (by people) with the system-provided <byteswap.h>.
Maybe byteswap-pxdr.h or something similar.

...
> +#if BYTE_ORDER == BIG_ENDIAN
> +  return x;
> +#elif BYTE_ORDER == LITTLE_ENDIAN
> +  return __bswap_32 (x);
> +#else
> +# error "What kind of system is this?"
> +#endif

Where is BYTE_ORDER defined?  normally in endian.h.
More curiosity than anything, since I'm sure it works
everywhere you built it.  I sort of expected to
see an "#include <endian.h>" somewhere.




More information about the libvir-list mailing list