mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Experimental check for socklen_t CURL_CHECK_TYPE_SOCKLEN_T
This commit is contained in:
parent
51581c034d
commit
a6a5bba0a9
81
acinclude.m4
81
acinclude.m4
@ -8,6 +8,7 @@ AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
|
|||||||
AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
|
AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
|
||||||
AC_COMPILE_IFELSE([
|
AC_COMPILE_IFELSE([
|
||||||
AC_LANG_PROGRAM([
|
AC_LANG_PROGRAM([
|
||||||
|
#undef inline
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
],[
|
],[
|
||||||
@ -35,6 +36,7 @@ AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
|
|||||||
AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
|
AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
|
||||||
AC_COMPILE_IFELSE([
|
AC_COMPILE_IFELSE([
|
||||||
AC_LANG_PROGRAM([
|
AC_LANG_PROGRAM([
|
||||||
|
#undef inline
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
@ -63,6 +65,7 @@ AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
|
|||||||
AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
|
AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
|
||||||
AC_COMPILE_IFELSE([
|
AC_COMPILE_IFELSE([
|
||||||
AC_LANG_PROGRAM([
|
AC_LANG_PROGRAM([
|
||||||
|
#undef inline
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
@ -91,6 +94,7 @@ AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
|
|||||||
AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
|
AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
|
||||||
AC_COMPILE_IFELSE([
|
AC_COMPILE_IFELSE([
|
||||||
AC_LANG_PROGRAM([
|
AC_LANG_PROGRAM([
|
||||||
|
#undef inline
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
@ -111,6 +115,83 @@ AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
dnl CURL_CHECK_TYPE_SOCKLEN_T
|
||||||
|
dnl -------------------------------------------------
|
||||||
|
dnl Checks for existing socklen_t type, and provides
|
||||||
|
dnl an equivalent type if socklen_t is not available
|
||||||
|
dnl This function is experimental and shall not be
|
||||||
|
dnl used while this notice is in place --------------
|
||||||
|
|
||||||
|
AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [
|
||||||
|
AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
|
||||||
|
AC_CHECK_TYPE([socklen_t], ,[
|
||||||
|
AC_CACHE_CHECK([for socklen_t equivalent bis],
|
||||||
|
[curl_cv_socklen_t_equiv_bis], [
|
||||||
|
curl_cv_socklen_t_equiv_bis=
|
||||||
|
for arg2 in "struct sockaddr" void; do
|
||||||
|
for t in int size_t unsigned long "unsigned long"; do
|
||||||
|
AC_COMPILE_IFELSE([
|
||||||
|
AC_LANG_PROGRAM([
|
||||||
|
#undef inline
|
||||||
|
#ifdef HAVE_WINDOWS_H
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#ifdef HAVE_WINSOCK2_H
|
||||||
|
#include <winsock2.h>
|
||||||
|
#else
|
||||||
|
#ifdef HAVE_WINSOCK_H
|
||||||
|
#include <winsock.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
int getpeername (int, $arg2 *, $t *);
|
||||||
|
int getsockname (int, $arg2 *, $t *);
|
||||||
|
int bind (int, $arg2 *, $t *);
|
||||||
|
int accept (int, $arg2 *, $t *);
|
||||||
|
],[
|
||||||
|
$t len;
|
||||||
|
getpeername(0,0,&len);
|
||||||
|
getsockname(0,0,&len);
|
||||||
|
bind(0,0,&len);
|
||||||
|
accept(0,0,&len);
|
||||||
|
])
|
||||||
|
],[
|
||||||
|
curl_cv_socklen_t_equiv_bis="$t"
|
||||||
|
break 2
|
||||||
|
])
|
||||||
|
done
|
||||||
|
done
|
||||||
|
])
|
||||||
|
if test "x$curl_cv_socklen_t_equiv_bis" = "x"; then
|
||||||
|
AC_MSG_ERROR([Cannot find a type to use in place of socklen_t bis])
|
||||||
|
else
|
||||||
|
AC_DEFINE_UNQUOTED(socklen_t_bis, $curl_cv_socklen_t_equiv_bis,
|
||||||
|
[type to use in place of socklen_t if not defined])
|
||||||
|
fi
|
||||||
|
],[
|
||||||
|
#ifdef HAVE_WINDOWS_H
|
||||||
|
#ifdef HAVE_WS2TCPIP_H
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl Check for how to set a socket to non-blocking state. There seems to exist
|
dnl Check for how to set a socket to non-blocking state. There seems to exist
|
||||||
dnl four known different ways, with the one used almost everywhere being POSIX
|
dnl four known different ways, with the one used almost everywhere being POSIX
|
||||||
dnl and XPG3, while the other different ways for different systems (old BSD,
|
dnl and XPG3, while the other different ways for different systems (old BSD,
|
||||||
|
33
configure.ac
33
configure.ac
@ -289,23 +289,6 @@ AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
|
|||||||
dnl The actual use of the USE_MANUAL variable is done much later in this
|
dnl The actual use of the USE_MANUAL variable is done much later in this
|
||||||
dnl script to allow other actions to disable it as well.
|
dnl script to allow other actions to disable it as well.
|
||||||
|
|
||||||
dnl **********************************************************************
|
|
||||||
dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
|
|
||||||
dnl and ws2tcpip.h take precedence over any other further check done later.
|
|
||||||
dnl **********************************************************************
|
|
||||||
|
|
||||||
dnl Do we have a compilable and valid windows.h header ?
|
|
||||||
CURL_CHECK_HEADER_WINDOWS
|
|
||||||
|
|
||||||
dnl Do we have a compilable and valid winsock.h header ?
|
|
||||||
CURL_CHECK_HEADER_WINSOCK
|
|
||||||
|
|
||||||
dnl Do we have a compilable and valid winsock2.h header ?
|
|
||||||
CURL_CHECK_HEADER_WINSOCK2
|
|
||||||
|
|
||||||
dnl Do we have a compilable and valid ws2tcpip.h header ?
|
|
||||||
CURL_CHECK_HEADER_WS2TCPIP
|
|
||||||
|
|
||||||
dnl **********************************************************************
|
dnl **********************************************************************
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries.
|
||||||
dnl **********************************************************************
|
dnl **********************************************************************
|
||||||
@ -1411,7 +1394,18 @@ dnl **********************************************************************
|
|||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
|
|
||||||
dnl First check for the very most basic headers. Then we can use these
|
dnl **********************************************************************
|
||||||
|
dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
|
||||||
|
dnl and ws2tcpip.h take precedence over any other further check which
|
||||||
|
dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS.
|
||||||
|
dnl **********************************************************************
|
||||||
|
|
||||||
|
CURL_CHECK_HEADER_WINDOWS
|
||||||
|
CURL_CHECK_HEADER_WINSOCK
|
||||||
|
CURL_CHECK_HEADER_WINSOCK2
|
||||||
|
CURL_CHECK_HEADER_WS2TCPIP
|
||||||
|
|
||||||
|
dnl Now check for the very most basic headers. Then we can use these
|
||||||
dnl ones as default-headers when checking for the rest!
|
dnl ones as default-headers when checking for the rest!
|
||||||
AC_CHECK_HEADERS(
|
AC_CHECK_HEADERS(
|
||||||
sys/types.h \
|
sys/types.h \
|
||||||
@ -1509,6 +1503,9 @@ fi
|
|||||||
AC_CHECK_TYPE(ssize_t, ,
|
AC_CHECK_TYPE(ssize_t, ,
|
||||||
AC_DEFINE(ssize_t, int, [the signed version of size_t]))
|
AC_DEFINE(ssize_t, int, [the signed version of size_t]))
|
||||||
|
|
||||||
|
# Experimental check
|
||||||
|
CURL_CHECK_TYPE_SOCKLEN_T
|
||||||
|
|
||||||
TYPE_SOCKLEN_T
|
TYPE_SOCKLEN_T
|
||||||
TYPE_IN_ADDR_T
|
TYPE_IN_ADDR_T
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user