[vlc-commits] configure: check socklen_t as int first

KO Myung-Hun git at videolan.org
Tue Mar 24 16:06:52 CET 2020


vlc | branch: master | KO Myung-Hun <komh at chollian.net> | Sat Jun 15 21:55:33 2019 +0900| [f50eb2a2999ef17c3f29855b4542ce47d6cdb39a] | committer: Steve Lhomme

configure: check socklen_t as int first

OS/2 socket APIs use int not unsigned int in place of socklen_t. As
a result, compilation is stopped at function call requiring socklen_t *
because of type mismatch between int * and unsigned int *.

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f50eb2a2999ef17c3f29855b4542ce47d6cdb39a
---

 configure.ac | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1e70a6ad33..ccb4dc7048 100644
--- a/configure.ac
+++ b/configure.ac
@@ -784,8 +784,21 @@ ac_cv_type_socklen_t,
 #endif]], [[socklen_t len; len = 0;]])],
 ac_cv_type_socklen_t=yes,
 ac_cv_type_socklen_t=no)])
-AS_IF([test "$ac_cv_type_socklen_t" = no],
- [AC_DEFINE(socklen_t, unsigned int)])
+AS_IF([test "$ac_cv_type_socklen_t" = no], [
+  AC_COMPILE_IFELSE([
+    AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#ifdef _WIN32
+# include <winsock2.h>
+# include <ws2tcpip.h>
+#else
+# include <sys/socket.h>
+#endif
+    ]], [[
+_Generic(getpeername, int (*)(int, struct sockaddr *, int *): 0);
+    ]])
+  ], AC_DEFINE(socklen_t, int), AC_DEFINE(socklen_t, unsigned int))
+])
 
 dnl Check for struct sockaddr_storage
 AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight



More information about the vlc-commits mailing list