[vlc-commits] use the proper check for sys/socket.h availability
Steve Lhomme
git at videolan.org
Thu Apr 12 13:11:47 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Apr 12 13:00:54 2018 +0200| [58c448df279229d4983eee56f6934cf09106c031] | committer: Steve Lhomme
use the proper check for sys/socket.h availability
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=58c448df279229d4983eee56f6934cf09106c031
---
compat/inet_pton.c | 4 ++--
include/vlc_fixups.h | 4 ++--
include/vlc_interrupt.h | 4 ++--
include/vlc_network.h | 4 +++-
modules/access/http/h1conn_test.c | 2 ++
modules/access/http/h2conn_test.c | 2 ++
modules/access_output/udp.c | 2 +-
src/network/httpd.c | 2 +-
src/os2/filesystem.c | 2 ++
src/os2/thread.c | 2 ++
test/modules/misc/tls.c | 2 ++
11 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/compat/inet_pton.c b/compat/inet_pton.c
index 7052a1a7a5..38c2281d2e 100644
--- a/compat/inet_pton.c
+++ b/compat/inet_pton.c
@@ -26,9 +26,9 @@
#include <errno.h>
#include <sys/types.h>
-#ifndef _WIN32
+#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
-#else
+#elif defined(_WIN32)
# include <winsock2.h>
# include <ws2tcpip.h>
# undef EAFNOSUPPORT
diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index 037f67da31..0d9abed520 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -370,9 +370,9 @@ void swab (const void *, void *, ssize_t);
/* Socket stuff */
#ifndef HAVE_INET_PTON
-# ifndef _WIN32
+# ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
-#else
+# elif defined(_WIN32)
typedef int socklen_t;
# endif
int inet_pton(int, const char *, void *);
diff --git a/include/vlc_interrupt.h b/include/vlc_interrupt.h
index a6fb303200..1195c19d33 100644
--- a/include/vlc_interrupt.h
+++ b/include/vlc_interrupt.h
@@ -21,9 +21,9 @@
#ifndef VLC_INTERRUPT_H
# define VLC_INTERRUPT_H 1
# include <vlc_threads.h>
-# ifndef _WIN32
+# ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> /* socklen_t */
-# else
+# elif defined(_WIN32)
# include <ws2tcpip.h>
# endif
diff --git a/include/vlc_network.h b/include/vlc_network.h
index 184c23acae..1a80759dd5 100644
--- a/include/vlc_network.h
+++ b/include/vlc_network.h
@@ -50,7 +50,9 @@
# define IPV6_V6ONLY 27
# endif
#else
-# include <sys/socket.h>
+# ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+# endif
# include <netinet/in.h>
# include <netdb.h>
# define net_errno errno
diff --git a/modules/access/http/h1conn_test.c b/modules/access/http/h1conn_test.c
index 2817b45e2d..0e792274c1 100644
--- a/modules/access/http/h1conn_test.c
+++ b/modules/access/http/h1conn_test.c
@@ -29,7 +29,9 @@
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
#include <vlc_common.h>
#include <vlc_block.h>
diff --git a/modules/access/http/h2conn_test.c b/modules/access/http/h2conn_test.c
index 109e6c0cf0..1fb9a15d61 100644
--- a/modules/access/http/h2conn_test.c
+++ b/modules/access/http/h2conn_test.c
@@ -29,7 +29,9 @@
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
#include <vlc_common.h>
#include <vlc_block.h>
diff --git a/modules/access_output/udp.c b/modules/access_output/udp.c
index 1204eab750..472fd8c4a2 100644
--- a/modules/access_output/udp.c
+++ b/modules/access_output/udp.c
@@ -43,7 +43,7 @@
#ifdef _WIN32
# include <winsock2.h>
# include <ws2tcpip.h>
-#else
+#elif defined (HAVE_SYS_SOCKET_H)
# include <sys/socket.h>
#endif
diff --git a/src/network/httpd.c b/src/network/httpd.c
index d9237ebb9c..a22d9208cc 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -55,7 +55,7 @@
#if defined(_WIN32)
# include <winsock2.h>
-#else
+#elif defined(HAVE_SYS_SOCKET_H)
# include <sys/socket.h>
#endif
diff --git a/src/os2/filesystem.c b/src/os2/filesystem.c
index bbb4ab346b..651f73d486 100644
--- a/src/os2/filesystem.c
+++ b/src/os2/filesystem.c
@@ -38,7 +38,9 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <dirent.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
#include <signal.h>
#include <vlc_common.h>
diff --git a/src/os2/thread.c b/src/os2/thread.c
index 8f7b335ea4..364fb78307 100644
--- a/src/os2/thread.c
+++ b/src/os2/thread.c
@@ -40,7 +40,9 @@
#include <time.h>
#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
#include <sys/time.h>
#include <sys/select.h>
diff --git a/test/modules/misc/tls.c b/test/modules/misc/tls.c
index f44f26f04f..2860f5ba03 100644
--- a/test/modules/misc/tls.c
+++ b/test/modules/misc/tls.c
@@ -29,7 +29,9 @@
#include <string.h>
#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
#include <poll.h>
#include <vlc_common.h>
More information about the vlc-commits
mailing list