mirror of
https://github.com/curl/curl.git
synced 2025-01-24 14:15:18 +08:00
parent
3ef67c6861
commit
0aeca41702
206
acinclude.m4
206
acinclude.m4
@ -960,212 +960,6 @@ AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
dnl CURL_CHECK_FUNC_GETNAMEINFO
|
||||
dnl -------------------------------------------------
|
||||
dnl Test if the getnameinfo function is available,
|
||||
dnl and check the types of five of its arguments.
|
||||
dnl If the function succeeds HAVE_GETNAMEINFO will be
|
||||
dnl defined, defining the types of the arguments in
|
||||
dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
|
||||
dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7,
|
||||
dnl and also defining the type qualifier of first
|
||||
dnl argument in GETNAMEINFO_QUAL_ARG1.
|
||||
|
||||
AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
|
||||
AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
|
||||
AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
|
||||
#
|
||||
AC_MSG_CHECKING([for getnameinfo])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_FUNC_LINK_TRY([getnameinfo])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
curl_cv_getnameinfo="yes"
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
curl_cv_getnameinfo="no"
|
||||
])
|
||||
#
|
||||
if test "$curl_cv_getnameinfo" != "yes"; then
|
||||
AC_MSG_CHECKING([deeper for getnameinfo])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
]],[[
|
||||
getnameinfo();
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
curl_cv_getnameinfo="yes"
|
||||
],[
|
||||
AC_MSG_RESULT([but still no])
|
||||
curl_cv_getnameinfo="no"
|
||||
])
|
||||
fi
|
||||
#
|
||||
if test "$curl_cv_getnameinfo" != "yes"; then
|
||||
AC_MSG_CHECKING([deeper and deeper for getnameinfo])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#undef inline
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#endif
|
||||
]],[[
|
||||
getnameinfo(0, 0, 0, 0, 0, 0, 0);
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
curl_cv_getnameinfo="yes"
|
||||
],[
|
||||
AC_MSG_RESULT([but still no])
|
||||
curl_cv_getnameinfo="no"
|
||||
])
|
||||
fi
|
||||
#
|
||||
if test "$curl_cv_getnameinfo" = "yes"; then
|
||||
AC_CACHE_CHECK([types of arguments for getnameinfo],
|
||||
[curl_cv_func_getnameinfo_args], [
|
||||
curl_cv_func_getnameinfo_args="unknown"
|
||||
for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
|
||||
for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
|
||||
for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
|
||||
for gni_arg7 in 'int' 'unsigned int'; do
|
||||
if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#undef inline
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#endif
|
||||
#define GNICALLCONV WSAAPI
|
||||
#else
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#define GNICALLCONV
|
||||
#endif
|
||||
extern int GNICALLCONV
|
||||
#ifdef __ANDROID__
|
||||
__attribute__((overloadable))
|
||||
#endif
|
||||
getnameinfo($gni_arg1, $gni_arg2,
|
||||
char *, $gni_arg46,
|
||||
char *, $gni_arg46,
|
||||
$gni_arg7);
|
||||
]],[[
|
||||
$gni_arg2 salen=0;
|
||||
$gni_arg46 hostlen=0;
|
||||
$gni_arg46 servlen=0;
|
||||
$gni_arg7 flags=0;
|
||||
int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
|
||||
]])
|
||||
],[
|
||||
curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
|
||||
])
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
]) # AC-CACHE-CHECK
|
||||
if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
|
||||
AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
|
||||
AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined])
|
||||
else
|
||||
gni_prev_IFS=$IFS; IFS=','
|
||||
set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
|
||||
IFS=$gni_prev_IFS
|
||||
shift
|
||||
#
|
||||
gni_qual_type_arg1=$[1]
|
||||
#
|
||||
AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
|
||||
[Define to the type of arg 2 for getnameinfo.])
|
||||
AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
|
||||
[Define to the type of args 4 and 6 for getnameinfo.])
|
||||
AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
|
||||
[Define to the type of arg 7 for getnameinfo.])
|
||||
#
|
||||
prev_sh_opts=$-
|
||||
#
|
||||
case $prev_sh_opts in
|
||||
*f*)
|
||||
;;
|
||||
*)
|
||||
set -f
|
||||
;;
|
||||
esac
|
||||
#
|
||||
case "$gni_qual_type_arg1" in
|
||||
const*)
|
||||
gni_qual_arg1=const
|
||||
gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'`
|
||||
;;
|
||||
*)
|
||||
gni_qual_arg1=
|
||||
gni_type_arg1=$gni_qual_type_arg1
|
||||
;;
|
||||
esac
|
||||
#
|
||||
AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1,
|
||||
[Define to the type qualifier of arg 1 for getnameinfo.])
|
||||
AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1,
|
||||
[Define to the type of arg 1 for getnameinfo.])
|
||||
#
|
||||
case $prev_sh_opts in
|
||||
*f*)
|
||||
;;
|
||||
*)
|
||||
set +f
|
||||
;;
|
||||
esac
|
||||
#
|
||||
AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1,
|
||||
[Define to 1 if you have the getnameinfo function.])
|
||||
curl_cv_func_getnameinfo="yes"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
dnl TYPE_SOCKADDR_STORAGE
|
||||
dnl -------------------------------------------------
|
||||
dnl Check for struct sockaddr_storage. Most IPv6-enabled
|
||||
|
@ -3653,10 +3653,6 @@ AC_CHECK_FUNCS([fnmatch \
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Check if the getnameinfo function is available
|
||||
dnl and get the types of five of its arguments.
|
||||
CURL_CHECK_FUNC_GETNAMEINFO
|
||||
|
||||
if test "$ipv6" = "yes"; then
|
||||
if test "$curl_cv_func_getaddrinfo" = "yes"; then
|
||||
AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
|
||||
|
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@ -59,39 +59,6 @@
|
||||
#include "curl_memory.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
#if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO)
|
||||
/* These are strictly for memory tracing and are using the same style as the
|
||||
* family otherwise present in memdebug.c. I put these ones here since they
|
||||
* require a bunch of structs I didn't want to include in memdebug.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* For CURLRES_ARS, this should be written using ares_gethostbyaddr()
|
||||
* (ignoring the fact c-ares doesn't return 'serv').
|
||||
*/
|
||||
|
||||
int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa,
|
||||
GETNAMEINFO_TYPE_ARG2 salen,
|
||||
char *host, GETNAMEINFO_TYPE_ARG46 hostlen,
|
||||
char *serv, GETNAMEINFO_TYPE_ARG46 servlen,
|
||||
GETNAMEINFO_TYPE_ARG7 flags,
|
||||
int line, const char *source)
|
||||
{
|
||||
int res = (getnameinfo)(sa, salen,
|
||||
host, hostlen,
|
||||
serv, servlen,
|
||||
flags);
|
||||
if(0 == res)
|
||||
/* success */
|
||||
curl_memlog("GETNAME %s:%d getnameinfo()\n",
|
||||
source, line);
|
||||
else
|
||||
curl_memlog("GETNAME %s:%d getnameinfo() failed = %d\n",
|
||||
source, line, res);
|
||||
return res;
|
||||
}
|
||||
#endif /* defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO) */
|
||||
|
||||
/*
|
||||
* Curl_ipv6works() returns TRUE if IPv6 seems to work.
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@ -137,13 +137,6 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
|
||||
#endif
|
||||
#endif /* HAVE_GETADDRINFO */
|
||||
|
||||
#ifdef HAVE_GETNAMEINFO
|
||||
#undef getnameinfo
|
||||
#define getnameinfo(sa,salen,host,hostlen,serv,servlen,flags) \
|
||||
curl_dogetnameinfo(sa, salen, host, hostlen, serv, servlen, flags, \
|
||||
__LINE__, __FILE__)
|
||||
#endif /* HAVE_GETNAMEINFO */
|
||||
|
||||
#ifdef HAVE_FREEADDRINFO
|
||||
#undef freeaddrinfo
|
||||
#define freeaddrinfo(data) \
|
||||
|
Loading…
Reference in New Issue
Block a user