]> granicus.if.org Git - libevent/commitdiff
autotools: include win32 specific headers for socklen_t detection on win32/mingw
authorAzat Khuzhin <a3at.mail@gmail.com>
Tue, 31 Jul 2018 21:58:02 +0000 (00:58 +0300)
committerAzat Khuzhin <azat@libevent.org>
Sat, 2 Feb 2019 12:17:58 +0000 (15:17 +0300)
The [1] removes EVENT__ prefix, and now if we will incorrectly detect
that "foobar" (or socklen_t in our case) type is not available, but
somewhere later it will be available then we will get next error [2]:
  error: two or more data types in declaration specifiers

According to [3]:
- Compile something in Cygwin and you are compiling it for Cygwin.
- Compile something in MinGW and you are compiling it for Windows.
  And I can confirm this, since there is _WIN32 defined (according to [4])

And since according to [5] our image in appveyour (Visual Studion 2015)
has mingw (and we use it, not cygwin) we need ws2tcpip.h (over
sys/socket.h -- which does not exist in win32) header to detect
socklen_t existence.

[1]: 587e9f5828c4eb3c6e79e9eb29f174e4ae0c05bd ("config.h can't be prefixed unconditionally")
[2]: https://ci.appveyor.com/project/nmathewson/libevent/build/job/yonukoc5q3tr3e5e#L372
[3]: https://stackoverflow.com/questions/771756/what-is-the-difference-between-cygwin-and-mingw
[4]: https://www.appveyor.com/docs/build-environment/#mingw-msys-cygwin
[5]: https://ci.appveyor.com/project/nmathewson/libevent/build/job/yonukoc5q3tr3e5e#L164

Fixes: #649
(cherry picked from commit 4728ffed865985ab663b2e067afb904d124fc1db)

configure.ac

index a3b7fd419bd711725bcb28a8fb0d4e9f5f2fa727..d28c591860b58f5e58a0456d95aae6e881d210bf 100644 (file)
@@ -727,7 +727,11 @@ AC_CHECK_TYPES([struct linger],,,
 AC_MSG_CHECKING([for socklen_t])
 AC_TRY_COMPILE([
  #include <sys/types.h>
- #include <sys/socket.h>],
+ #ifdef _WIN32
+ #include <ws2tcpip.h>
+ #else
+ #include <sys/socket.h>
+ #endif],
   [socklen_t x;],
   AC_MSG_RESULT([yes]),
   [AC_MSG_RESULT([no])