[Top][All Lists]

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

Re: canon-host problems in cygwin

From: Eric Blake
Subject: Re: canon-host problems in cygwin
Date: Wed, 15 Feb 2006 23:28:07 +0000

> Cygwin compilation of the canon-host module is giving
> warnings that need to be resolved:

And here is a patch.  The cygwin list confirmed that <sys/socket.h>
and <ws2tcpip.h> are intentionally incompatible, and that
although the later is available for use in mingw compiles, it
purposefully errors out if <sys/socket.h> was already in use.

The problem with AC_CHECK_HEADERS_ONCE is that it
unconditionally checks for headers.  So this patch works
around that by ensuring that any module that wants to
use <ws2tcpip.h> as a fallback to <sys/socket.h> also
uses the sys_socket module, then only ever try the
ws2tcpip.h header if sys/socket.h is nonexistant.  Coreutils
CVS head is broken on cygwin without this patch (which
means m4/sys_socket_h.m4 will need to be added to coreutils):

make[3]: Entering directory `/home/eblake/coreutils-head/src'
gcc -std=gnu99  -g2 -Wall   -o pinky.exe pinky.o ../lib/libcoreutils.a -lintl 
../lib/libcoreutils.a -lws2_32
../lib/libcoreutils.a(canon-host.o): In function `canon_host_r':
/home/eblake/coreutils/lib/canon-host.c:71: undefined reference to 
/home/eblake/coreutils/lib/canon-host.c:77: undefined reference to 
collect2: ld returned 1 exit status

This was because coreutils tried to use -lws2_32 (the counterpart
to <ws2tcpip.h>) for the definition of getaddrinfo, which does
not work on cygwin (only on mingw).

After the patch, this works without warning:
CFLAGS='-Wall' ./gnulib-tool --test --with-tests getaddrinfo

2006-02-15  Eric Blake  <address@hidden>

        * sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Don't attempt using
        winsock2.h or ws2tcpip.h when sys/socket.h is present. Fixes
        'present but cannot compile' warnings on cygwin.
        * socklen.m4 (gl_TYPE_SOCKLEN_T): Use gl_HEADER_SYS_SOCKET.  Don't
        use ws2tcpip.h if sys/socket.h works.
        * getaddrinfo.m4 (gl_PREREQ_GETADDRINFO): Use gl_HEADER_SYS_SOCKET.
        (gl_GETADDRINFO): Don't use ws2tcpip.h when sys/socket.h is present.

Attachment: gnulib.patch
Description: Binary data

reply via email to

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