[Top][All Lists]

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

Re: Network-related functions and configuring for MinGW

From: Eric Blake
Subject: Re: Network-related functions and configuring for MinGW
Date: Sat, 07 Jan 2012 07:56:49 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0

On 01/07/2012 07:38 AM, Eli Zaretskii wrote:
> [Please CC me on the responses, as I'm not subscribed to the list.]

Using reply-all is list policy, anyways.

> Configuring several packages for building on MS-Windows with MinGW, I
> bumped several times into a situation where the configure script
> reports the lack of network-related functions such as gethostbyname,
> getdomainname, and others.  The build then at best produces warnings
> (due to missing or incompatible declarations) or even errors.

Have you considered priming a config.site cache to work around these
problems by default?

Also, patching autoconf won't help you right away - it may take several
years before the changes percolate through to the affected packages.
While that's not an argument against fixing things, I'm just trying to
set expectations, and to point out that you may want to also report
these issues to affected packages in parallel.

> This happens because the configure script assumes the prototypes of
> these functions are in certain headers, but winsock2.h on Windows is
> not included in the list of those headers.  And that's where those
> prototypes are found on Windows.  However, the only Windows-specific
> header searched by configure is io.h.

Blindly testing for winsock2.h is wrong on Cygwin.  Gnulib has much
better support for detecting network-related functions, using the
correct headers, and where needed, adding the appropriate windows
libraries into the link line.

> There's another group of network-related functions that needs
> _WIN32_WINNT to be defined to 0x0501, otherwise the prototypes will
> not be seen by the compiler.  This group of functions includes
> getaddrinfo, getnameinfo, and freeaddrinfo.  Because the configure
> script does not define this macro in the test programs it runs, it
> incorrectly concludes that these functions are missing, which leads to
> warnings and errors during the build.
> Is it possible to update the Autoconf tests so as to eliminate these
> problems?

Which macros in particular?  For example, autoconf does NOT have any
macros for getaddrinfo.  At this point, I think this is more a case of
autoconf not providing any higher-level macros for the situation, so
many packages are (poorly) re-inventing the checks by building on
lower-level autoconf primitives, rather than reusing existing
higher-level macros from places like gnulib.

Adding new macros to autoconf won't help things until those packages use
the new macros.  And at this point, since gnulib's macros are better,
and the packagers are going to have to pick up better macros from
somewhere, it may be easier to point them to gnulib (which has the
macros now) rather than adding new macros to autoconf (which has a
percolation delay).

That is, I'm not opposed to helping, but I'm not sure what help we can
offer from autoconf other than documenting that functions like
getaddrinfo are complex enough to warrant using gnulib for proper detection.

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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