]> granicus.if.org Git - libevent/commitdiff
build: struct sockaddr_un detection (sys/un.h, afunix.h)
authorAzat Khuzhin <azat@libevent.org>
Sun, 12 May 2019 13:12:06 +0000 (16:12 +0300)
committerAzat Khuzhin <azat@libevent.org>
Sun, 12 May 2019 15:17:53 +0000 (18:17 +0300)
- On UNIX:     sys/un.h
- Since win10: afunix.h

And windows has AF_UNIX but do not have sockaddr_un (before windows
build 17061 [1]), hence the sockaddr_un detection.

  [1]: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/

CMakeLists.txt
configure.ac
event-config.h.cmake

index aecff4677e0c267907c06e4ef50375452e1d10ad..fd3375bca71b6184c336838dd07e0841de3cf5ef 100644 (file)
@@ -357,6 +357,19 @@ if(EVENT__HAVE_NETINET_IN_H)
     list(APPEND CMAKE_EXTRA_INCLUDE_FILES netinet/in.h)
 endif()
 
+CHECK_INCLUDE_FILE(sys/un.h EVENT__HAVE_SYS_UN_H)
+if(EVENT__HAVE_SYS_UN_H)
+    list(APPEND CMAKE_EXTRA_INCLUDE_FILES sys/un.h)
+endif()
+
+if(WIN32)
+    CHECK_INCLUDE_FILE(afunix.h EVENT__HAVE_AFUNIX_H)
+    if(EVENT__HAVE_AFUNIX_H)
+        list(APPEND CMAKE_EXTRA_INCLUDE_FILES afunix.h)
+    endif()
+endif()
+CHECK_TYPE_SIZE("struct sockaddr_un" EVENT__HAVE_STRUCT_SOCKADDR_UN)
+
 CHECK_INCLUDE_FILE(netinet/in6.h EVENT__HAVE_NETINET_IN6_H)
 if(EVENT__HAVE_NETINET_IN6_H)
     list(APPEND CMAKE_EXTRA_INCLUDE_FILES netinet/in6.h)
index b68a0acb79c2a243c9db77ca9358a4bd76a775f4..4c17e553865bbba6420ee76b741fe849fedc424f 100644 (file)
@@ -230,6 +230,7 @@ AC_CHECK_HEADERS([ \
   netinet/in.h \
   netinet/in6.h \
   netinet/tcp.h \
+  sys/un.h \
   poll.h \
   port.h \
   stdarg.h \
@@ -667,7 +668,7 @@ AC_CHECK_SIZEOF(void *)
 AC_CHECK_SIZEOF(off_t)
 AC_CHECK_SIZEOF(time_t)
 
-AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t, struct addrinfo, struct sockaddr_storage], , ,
+AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, struct sockaddr_un, sa_family_t, struct addrinfo, struct sockaddr_storage], , ,
 [#define _GNU_SOURCE 1
 #include <sys/types.h>
 #ifdef HAVE_NETINET_IN_H
@@ -676,6 +677,9 @@ AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t, struct addrin
 #ifdef HAVE_NETINET_IN6_H
 #include <netinet/in6.h>
 #endif
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index c13128a097e7fc1cfb73cc750d8bf584aaad549b..a1b39a11301db2f7bda59b26d5f935cd4db65932 100644 (file)
 /* Define to 1 if you have the <netinet/tcp.h> header file. */
 #cmakedefine EVENT__HAVE_NETINET_TCP_H 1
 
+/* Define to 1 if you have the <sys/un.h> header file. */
+#cmakedefine EVENT__HAVE_SYS_UN_H 1
+
+/* Define to 1 if you have the <afunix.h> header file. */
+#cmakedefine EVENT__HAVE_AFUNIX_H 1
+
 /* Define if the system has openssl */
 #cmakedefine EVENT__HAVE_OPENSSL 1
 
 /* Define to 1 if `sin_len' is member of `struct sockaddr_in'. */
 #cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1
 
+/* Define to 1 if the system has the type `struct sockaddr_un'. */
+#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_UN 1
+
 /* Define to 1 if the system has the type `struct sockaddr_storage'. */
 #cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1