diff options
author | Alon Bar-Lev <alon.barlev@gmail.com> | 2011-03-04 23:14:33 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2011-03-24 21:58:25 +0100 |
commit | aab2f95439c28e2aa9358dbfe1ce7a15c774a766 (patch) | |
tree | 389987dc6318dc633e528d54276645b09b35f8f4 /acinclude.m4 | |
parent | Clarified --client-config-dir section on the man-page. (diff) | |
download | openvpn-aab2f95439c28e2aa9358dbfe1ce7a15c774a766.tar.xz |
Windows cross-compile cleanup
It should be sufficient to just try to see if socklen_t is defined.
Next, on all platforms it would be int in all other platforms.
And, there is no need to check for the type in monolitic environment
like Windows, as it will be always the same.
Currently it fails cross compile windows in mingw-w64 compiler, as
winsock.h is as follows:
"""
/* define WINSOCK_API_LINKAGE and WSAAPI for less
* diff output between winsock.h and winsock2.h, but
* remember to undefine them at the end of file */
"""
And the macro uses these macros which are internal winsock macros and
should not be used anyway.
Also, when did the autodefs.h went mandatory? Why is it in
tap-win32/common.h while no constant is actually used?
The use of WSA_IO_INCOMPLETE without including winsock2.h is invalid!
Look at http://msdn.microsoft.com/en-us/library/aa921087.aspx
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: James Yonan <james@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | acinclude.m4 | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index f037484..185907f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -90,34 +90,30 @@ AC_DEFUN([TYPE_SOCKLEN_T], AC_MSG_CHECKING([for socklen_t equivalent]) AC_CACHE_VAL([curl_cv_socklen_t_equiv], [ - # Systems have either "struct sockaddr *" or - # "void *" as the second argument to getpeername - curl_cv_socklen_t_equiv= - for arg2 in "struct sockaddr" void; do - for t in int size_t unsigned long "unsigned long"; do - AC_TRY_COMPILE([ - #ifdef _WIN32 - #include <windows.h> - #define PREFIX1 WINSOCK_API_LINKAGE - #define PREFIX2 PASCAL - #else - #include <sys/types.h> - #include <sys/socket.h> - #define PREFIX1 - #define PREFIX2 - #define SOCKET int - #endif + case "$host" in + *-mingw*) curl_cv_socklen_t_equiv=int ;; + *) + # Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + curl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void; do + for t in int size_t unsigned long "unsigned long"; do + AC_TRY_COMPILE([ + #include <sys/types.h> + #include <sys/socket.h> - PREFIX1 int PREFIX2 getpeername (SOCKET, $arg2 *, $t *); - ],[ - $t len; - getpeername(0,0,&len); - ],[ - curl_cv_socklen_t_equiv="$t" - break - ]) + int getpeername (int, $arg2 *, $t *); + ],[ + $t len; + getpeername(0,0,&len); + ],[ + curl_cv_socklen_t_equiv="$t" + break + ]) + done done - done + ;; + esac if test "x$curl_cv_socklen_t_equiv" = x; then AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) |