mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
HAVE_INET_PTON will only be defined when an IPv6 capable working
inet_pton function is available.
This commit is contained in:
parent
267b942383
commit
4d437416da
@ -310,7 +310,6 @@ else
|
|||||||
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
|
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
|
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
|
||||||
|
@ -661,6 +661,7 @@ CURL_CHECK_MSG_NOSIGNAL
|
|||||||
CARES_CHECK_FUNC_GETHOSTNAME
|
CARES_CHECK_FUNC_GETHOSTNAME
|
||||||
CARES_CHECK_FUNC_GETSERVBYPORT_R
|
CARES_CHECK_FUNC_GETSERVBYPORT_R
|
||||||
CARES_CHECK_FUNC_INET_NTOP
|
CARES_CHECK_FUNC_INET_NTOP
|
||||||
|
CARES_CHECK_FUNC_INET_PTON
|
||||||
CARES_CHECK_FUNC_STRCASECMP
|
CARES_CHECK_FUNC_STRCASECMP
|
||||||
CARES_CHECK_FUNC_STRCMPI
|
CARES_CHECK_FUNC_STRCMPI
|
||||||
CARES_CHECK_FUNC_STRDUP
|
CARES_CHECK_FUNC_STRDUP
|
||||||
@ -860,35 +861,6 @@ AC_CHECK_FUNCS([bitncmp \
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl check for inet_pton
|
|
||||||
AC_CHECK_FUNCS(inet_pton)
|
|
||||||
dnl Some systems have it, but not IPv6
|
|
||||||
if test "$ac_cv_func_inet_pton" = "yes" ; then
|
|
||||||
AC_MSG_CHECKING(if inet_pton supports IPv6)
|
|
||||||
AC_TRY_RUN(
|
|
||||||
[
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NETINET_IN_H
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#endif
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
struct in6_addr addr6;
|
|
||||||
if (inet_pton(AF_INET6, "::1", &addr6) < 1)
|
|
||||||
exit(1);
|
|
||||||
else
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
], [
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE_UNQUOTED(HAVE_INET_PTON_IPV6,1,[Define to 1 if inet_pton supports IPv6.])
|
|
||||||
], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
|
|
||||||
fi
|
|
||||||
dnl Check for inet_net_pton
|
dnl Check for inet_net_pton
|
||||||
AC_CHECK_FUNCS(inet_net_pton)
|
AC_CHECK_FUNCS(inet_net_pton)
|
||||||
dnl Again, some systems have it, but not IPv6
|
dnl Again, some systems have it, but not IPv6
|
||||||
|
@ -46,8 +46,7 @@
|
|||||||
#include "ares_ipv6.h"
|
#include "ares_ipv6.h"
|
||||||
#include "inet_net_pton.h"
|
#include "inet_net_pton.h"
|
||||||
|
|
||||||
#if !defined(HAVE_INET_NET_PTON) || !defined(HAVE_INET_NET_PTON_IPV6) || \
|
#if !defined(HAVE_INET_NET_PTON) || !defined(HAVE_INET_NET_PTON_IPV6)
|
||||||
!defined(HAVE_INET_PTON) || !defined(HAVE_INET_PTON_IPV6)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static int
|
* static int
|
||||||
@ -424,7 +423,7 @@ ares_inet_net_pton(int af, const char *src, void *dst, size_t size)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_INET_PTON) || !defined(HAVE_INET_PTON_IPV6)
|
#ifndef HAVE_INET_PTON
|
||||||
int ares_inet_pton(int af, const char *src, void *dst)
|
int ares_inet_pton(int af, const char *src, void *dst)
|
||||||
{
|
{
|
||||||
int size, result;
|
int size, result;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* without express or implied warranty.
|
* without express or implied warranty.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(HAVE_INET_PTON) && defined(HAVE_INET_PTON_IPV6)
|
#ifdef HAVE_INET_PTON
|
||||||
#define ares_inet_pton(x,y,z) inet_pton(x,y,z)
|
#define ares_inet_pton(x,y,z) inet_pton(x,y,z)
|
||||||
#else
|
#else
|
||||||
int ares_inet_pton(int af, const char *src, void *dst);
|
int ares_inet_pton(int af, const char *src, void *dst);
|
||||||
|
@ -552,6 +552,167 @@ AC_DEFUN([CARES_CHECK_FUNC_INET_NTOP], [
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
dnl CARES_CHECK_FUNC_INET_PTON
|
||||||
|
dnl -------------------------------------------------
|
||||||
|
dnl Verify if inet_pton is available, prototyped, can
|
||||||
|
dnl be compiled and seems to work. If all of these are
|
||||||
|
dnl true, and usage has not been previously disallowed
|
||||||
|
dnl with shell variable cares_disallow_inet_pton, then
|
||||||
|
dnl HAVE_INET_PTON will be defined.
|
||||||
|
|
||||||
|
AC_DEFUN([CARES_CHECK_FUNC_INET_PTON], [
|
||||||
|
AC_REQUIRE([CARES_INCLUDES_ARPA_INET])dnl
|
||||||
|
AC_REQUIRE([CARES_INCLUDES_STRING])dnl
|
||||||
|
#
|
||||||
|
tst_links_inet_pton="unknown"
|
||||||
|
tst_proto_inet_pton="unknown"
|
||||||
|
tst_compi_inet_pton="unknown"
|
||||||
|
tst_works_inet_pton="unknown"
|
||||||
|
tst_allow_inet_pton="unknown"
|
||||||
|
#
|
||||||
|
AC_MSG_CHECKING([if inet_pton can be linked])
|
||||||
|
AC_LINK_IFELSE([
|
||||||
|
AC_LANG_FUNC_LINK_TRY([inet_pton])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
tst_links_inet_pton="yes"
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
tst_links_inet_pton="no"
|
||||||
|
])
|
||||||
|
#
|
||||||
|
if test "$tst_links_inet_pton" = "yes"; then
|
||||||
|
AC_MSG_CHECKING([if inet_pton is prototyped])
|
||||||
|
AC_EGREP_CPP([inet_pton],[
|
||||||
|
$cares_includes_arpa_inet
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
tst_proto_inet_pton="yes"
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
tst_proto_inet_pton="no"
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
if test "$tst_proto_inet_pton" = "yes"; then
|
||||||
|
AC_MSG_CHECKING([if inet_pton is compilable])
|
||||||
|
AC_COMPILE_IFELSE([
|
||||||
|
AC_LANG_PROGRAM([[
|
||||||
|
$cares_includes_arpa_inet
|
||||||
|
]],[[
|
||||||
|
if(0 != inet_pton(0, 0, 0))
|
||||||
|
return 1;
|
||||||
|
]])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
tst_compi_inet_pton="yes"
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
tst_compi_inet_pton="no"
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
dnl only do runtime verification when not cross-compiling
|
||||||
|
if test "x$cross_compiling" != "xyes" &&
|
||||||
|
test "$tst_compi_inet_pton" = "yes"; then
|
||||||
|
AC_MSG_CHECKING([if inet_pton seems to work])
|
||||||
|
AC_RUN_IFELSE([
|
||||||
|
AC_LANG_PROGRAM([[
|
||||||
|
$cares_includes_arpa_inet
|
||||||
|
$cares_includes_string
|
||||||
|
]],[[
|
||||||
|
unsigned char ipv6a[26];
|
||||||
|
unsigned char ipv4a[5];
|
||||||
|
const char *ipv6src = "fe80::214:4fff:fe0b:76c8";
|
||||||
|
const char *ipv4src = "192.168.100.1";
|
||||||
|
/* - */
|
||||||
|
memset(ipv4a, 1, sizeof(ipv4a));
|
||||||
|
if(1 != inet_pton(AF_INET, ipv4src, ipv4a))
|
||||||
|
exit(1); /* fail */
|
||||||
|
/* - */
|
||||||
|
if( (ipv4a[0] != 0xc0) ||
|
||||||
|
(ipv4a[1] != 0xa8) ||
|
||||||
|
(ipv4a[2] != 0x64) ||
|
||||||
|
(ipv4a[3] != 0x01) ||
|
||||||
|
(ipv4a[4] != 0x01) )
|
||||||
|
exit(1); /* fail */
|
||||||
|
/* - */
|
||||||
|
memset(ipv6a, 1, sizeof(ipv6a));
|
||||||
|
if(1 != inet_pton(AF_INET6, ipv6src, ipv6a))
|
||||||
|
exit(1); /* fail */
|
||||||
|
/* - */
|
||||||
|
ipv6res[0] = '\0';
|
||||||
|
memset(ipv6a, 0, sizeof(ipv6a));
|
||||||
|
if( (ipv6a[0] != 0xfe) ||
|
||||||
|
(ipv6a[1] != 0x80) ||
|
||||||
|
(ipv6a[8] != 0x02) ||
|
||||||
|
(ipv6a[9] != 0x14) ||
|
||||||
|
(ipv6a[10] != 0x4f) ||
|
||||||
|
(ipv6a[11] != 0xff) ||
|
||||||
|
(ipv6a[12] != 0xfe) ||
|
||||||
|
(ipv6a[13] != 0x0b) ||
|
||||||
|
(ipv6a[14] != 0x76) ||
|
||||||
|
(ipv6a[15] != 0xc8) ||
|
||||||
|
(ipv6a[25] != 0x01) )
|
||||||
|
exit(1); /* fail */
|
||||||
|
/* - */
|
||||||
|
if( (ipv6a[2] != 0x0) ||
|
||||||
|
(ipv6a[3] != 0x0) ||
|
||||||
|
(ipv6a[4] != 0x0) ||
|
||||||
|
(ipv6a[5] != 0x0) ||
|
||||||
|
(ipv6a[6] != 0x0) ||
|
||||||
|
(ipv6a[7] != 0x0) ||
|
||||||
|
(ipv6a[16] != 0x0) ||
|
||||||
|
(ipv6a[17] != 0x0) ||
|
||||||
|
(ipv6a[18] != 0x0) ||
|
||||||
|
(ipv6a[19] != 0x0) ||
|
||||||
|
(ipv6a[20] != 0x0) ||
|
||||||
|
(ipv6a[21] != 0x0) ||
|
||||||
|
(ipv6a[22] != 0x0) ||
|
||||||
|
(ipv6a[23] != 0x0) ||
|
||||||
|
(ipv6a[24] != 0x0) )
|
||||||
|
exit(1); /* fail */
|
||||||
|
/* - */
|
||||||
|
exit(0);
|
||||||
|
]])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
tst_works_inet_pton="yes"
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
tst_works_inet_pton="no"
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
if test "$tst_compi_inet_pton" = "yes" &&
|
||||||
|
test "$tst_works_inet_pton" != "no"; then
|
||||||
|
AC_MSG_CHECKING([if inet_pton usage allowed])
|
||||||
|
if test "x$cares_disallow_inet_pton" != "xyes"; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
tst_allow_inet_pton="yes"
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
tst_allow_inet_pton="no"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
AC_MSG_CHECKING([if inet_pton might be used])
|
||||||
|
if test "$tst_links_inet_pton" = "yes" &&
|
||||||
|
test "$tst_proto_inet_pton" = "yes" &&
|
||||||
|
test "$tst_compi_inet_pton" = "yes" &&
|
||||||
|
test "$tst_allow_inet_pton" = "yes" &&
|
||||||
|
test "$tst_works_inet_pton" != "no"; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1,
|
||||||
|
[Define to 1 if you have a IPv6 capable working inet_pton function.])
|
||||||
|
ac_cv_func_inet_pton="yes"
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
ac_cv_func_inet_pton="no"
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl CARES_CHECK_FUNC_STRCASECMP
|
dnl CARES_CHECK_FUNC_STRCASECMP
|
||||||
dnl -------------------------------------------------
|
dnl -------------------------------------------------
|
||||||
dnl Verify if strcasecmp is available, prototyped, and
|
dnl Verify if strcasecmp is available, prototyped, and
|
||||||
|
11
configure.ac
11
configure.ac
@ -2077,6 +2077,7 @@ CURL_CHECK_FUNC_GETSERVBYPORT_R
|
|||||||
CURL_CHECK_FUNC_GMTIME_R
|
CURL_CHECK_FUNC_GMTIME_R
|
||||||
CURL_CHECK_FUNC_INET_NTOA_R
|
CURL_CHECK_FUNC_INET_NTOA_R
|
||||||
CURL_CHECK_FUNC_INET_NTOP
|
CURL_CHECK_FUNC_INET_NTOP
|
||||||
|
CURL_CHECK_FUNC_INET_PTON
|
||||||
CURL_CHECK_FUNC_LOCALTIME_R
|
CURL_CHECK_FUNC_LOCALTIME_R
|
||||||
CURL_CHECK_FUNC_SIGACTION
|
CURL_CHECK_FUNC_SIGACTION
|
||||||
CURL_CHECK_FUNC_STRCASECMP
|
CURL_CHECK_FUNC_STRCASECMP
|
||||||
@ -2118,7 +2119,6 @@ AC_CHECK_FUNCS([basename \
|
|||||||
getrlimit \
|
getrlimit \
|
||||||
gettimeofday \
|
gettimeofday \
|
||||||
inet_addr \
|
inet_addr \
|
||||||
inet_pton \
|
|
||||||
perror \
|
perror \
|
||||||
pipe \
|
pipe \
|
||||||
poll \
|
poll \
|
||||||
@ -2186,15 +2186,6 @@ AC_CHECK_DECL(basename, ,
|
|||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
|
|
||||||
AC_CHECK_DECL(inet_pton, ,
|
|
||||||
AC_DEFINE(HAVE_NO_INET_PTON_PROTO, 1,
|
|
||||||
[Defined if no inet_pton() prototype available]),
|
|
||||||
[
|
|
||||||
#ifdef HAVE_ARPA_INET_H
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#endif
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
dnl Check if the getnameinfo function is available
|
dnl Check if the getnameinfo function is available
|
||||||
dnl and get the types of five of its arguments.
|
dnl and get the types of five of its arguments.
|
||||||
|
@ -404,7 +404,6 @@ else
|
|||||||
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
|
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
|
||||||
|
@ -222,8 +222,11 @@
|
|||||||
/* Define to 1 if you have the `inet_addr' function. */
|
/* Define to 1 if you have the `inet_addr' function. */
|
||||||
/*#define HAVE_INET_ADDR 1*/
|
/*#define HAVE_INET_ADDR 1*/
|
||||||
|
|
||||||
/* Define to 1 if you have the `inet_pton' function. */
|
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */
|
||||||
#define HAVE_INET_PTON 1
|
/*#define HAVE_INET_NTOP 1*/
|
||||||
|
|
||||||
|
/* Define to 1 if you have a IPv6 capable working inet_pton function. */
|
||||||
|
/*#define HAVE_INET_PTON 1*/
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#define HAVE_INTTYPES_H 1
|
#define HAVE_INTTYPES_H 1
|
||||||
@ -330,9 +333,6 @@
|
|||||||
/* Define to 1 if NI_WITHSCOPEID exists and works. */
|
/* Define to 1 if NI_WITHSCOPEID exists and works. */
|
||||||
/*#define HAVE_NI_WITHSCOPEID 1*/
|
/*#define HAVE_NI_WITHSCOPEID 1*/
|
||||||
|
|
||||||
/* Defined if no inet_pton() prototype available */
|
|
||||||
/* #undef HAVE_NO_INET_PTON_PROTO */
|
|
||||||
|
|
||||||
/* we have no strerror_r() proto */
|
/* we have no strerror_r() proto */
|
||||||
/* #undef HAVE_NO_STRERROR_R_DECL */
|
/* #undef HAVE_NO_STRERROR_R_DECL */
|
||||||
|
|
||||||
|
@ -208,7 +208,10 @@
|
|||||||
/* Define to 1 if you have the `inet_addr' function. */
|
/* Define to 1 if you have the `inet_addr' function. */
|
||||||
#define HAVE_INET_ADDR 1
|
#define HAVE_INET_ADDR 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `inet_pton' function. */
|
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */
|
||||||
|
/* #undef HAVE_INET_NTOP */
|
||||||
|
|
||||||
|
/* Define to 1 if you have a IPv6 capable working inet_pton function. */
|
||||||
/* #undef HAVE_INET_PTON */
|
/* #undef HAVE_INET_PTON */
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
@ -290,9 +293,6 @@
|
|||||||
/* Define if NI_WITHSCOPEID exists and works */
|
/* Define if NI_WITHSCOPEID exists and works */
|
||||||
/* #undef HAVE_NI_WITHSCOPEID */
|
/* #undef HAVE_NI_WITHSCOPEID */
|
||||||
|
|
||||||
/* Defined if no inet_pton() prototype available */
|
|
||||||
/* #undef HAVE_NO_INET_PTON_PROTO */
|
|
||||||
|
|
||||||
/* we have no strerror_r() proto */
|
/* we have no strerror_r() proto */
|
||||||
/* #undef HAVE_NO_STRERROR_R_DECL */
|
/* #undef HAVE_NO_STRERROR_R_DECL */
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#define HAVE_GETTIMEOFDAY 1
|
#define HAVE_GETTIMEOFDAY 1
|
||||||
#define HAVE_IO_H 1
|
#define HAVE_IO_H 1
|
||||||
#define HAVE_IOCTLSOCKET 1
|
#define HAVE_IOCTLSOCKET 1
|
||||||
#define HAVE_INET_PTON 1
|
|
||||||
#define HAVE_LOCALE_H 1
|
#define HAVE_LOCALE_H 1
|
||||||
#define HAVE_LONGLONG 1
|
#define HAVE_LONGLONG 1
|
||||||
#define HAVE_MEMORY_H 1
|
#define HAVE_MEMORY_H 1
|
||||||
|
@ -28,11 +28,6 @@
|
|||||||
int Curl_inet_pton(int, const char *, void *);
|
int Curl_inet_pton(int, const char *, void *);
|
||||||
|
|
||||||
#ifdef HAVE_INET_PTON
|
#ifdef HAVE_INET_PTON
|
||||||
|
|
||||||
#if defined(HAVE_NO_INET_PTON_PROTO)
|
|
||||||
int inet_pton(int af, const char *src, void *dst);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ARPA_INET_H
|
#ifdef HAVE_ARPA_INET_H
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1427,6 +1427,167 @@ AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
dnl CURL_CHECK_FUNC_INET_PTON
|
||||||
|
dnl -------------------------------------------------
|
||||||
|
dnl Verify if inet_pton is available, prototyped, can
|
||||||
|
dnl be compiled and seems to work. If all of these are
|
||||||
|
dnl true, and usage has not been previously disallowed
|
||||||
|
dnl with shell variable curl_disallow_inet_pton, then
|
||||||
|
dnl HAVE_INET_PTON will be defined.
|
||||||
|
|
||||||
|
AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [
|
||||||
|
AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
|
||||||
|
AC_REQUIRE([CURL_INCLUDES_STRING])dnl
|
||||||
|
#
|
||||||
|
tst_links_inet_pton="unknown"
|
||||||
|
tst_proto_inet_pton="unknown"
|
||||||
|
tst_compi_inet_pton="unknown"
|
||||||
|
tst_works_inet_pton="unknown"
|
||||||
|
tst_allow_inet_pton="unknown"
|
||||||
|
#
|
||||||
|
AC_MSG_CHECKING([if inet_pton can be linked])
|
||||||
|
AC_LINK_IFELSE([
|
||||||
|
AC_LANG_FUNC_LINK_TRY([inet_pton])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
tst_links_inet_pton="yes"
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
tst_links_inet_pton="no"
|
||||||
|
])
|
||||||
|
#
|
||||||
|
if test "$tst_links_inet_pton" = "yes"; then
|
||||||
|
AC_MSG_CHECKING([if inet_pton is prototyped])
|
||||||
|
AC_EGREP_CPP([inet_pton],[
|
||||||
|
$curl_includes_arpa_inet
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
tst_proto_inet_pton="yes"
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
tst_proto_inet_pton="no"
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
if test "$tst_proto_inet_pton" = "yes"; then
|
||||||
|
AC_MSG_CHECKING([if inet_pton is compilable])
|
||||||
|
AC_COMPILE_IFELSE([
|
||||||
|
AC_LANG_PROGRAM([[
|
||||||
|
$curl_includes_arpa_inet
|
||||||
|
]],[[
|
||||||
|
if(0 != inet_pton(0, 0, 0))
|
||||||
|
return 1;
|
||||||
|
]])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
tst_compi_inet_pton="yes"
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
tst_compi_inet_pton="no"
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
dnl only do runtime verification when not cross-compiling
|
||||||
|
if test "x$cross_compiling" != "xyes" &&
|
||||||
|
test "$tst_compi_inet_pton" = "yes"; then
|
||||||
|
AC_MSG_CHECKING([if inet_pton seems to work])
|
||||||
|
AC_RUN_IFELSE([
|
||||||
|
AC_LANG_PROGRAM([[
|
||||||
|
$curl_includes_arpa_inet
|
||||||
|
$curl_includes_string
|
||||||
|
]],[[
|
||||||
|
unsigned char ipv6a[26];
|
||||||
|
unsigned char ipv4a[5];
|
||||||
|
const char *ipv6src = "fe80::214:4fff:fe0b:76c8";
|
||||||
|
const char *ipv4src = "192.168.100.1";
|
||||||
|
/* - */
|
||||||
|
memset(ipv4a, 1, sizeof(ipv4a));
|
||||||
|
if(1 != inet_pton(AF_INET, ipv4src, ipv4a))
|
||||||
|
exit(1); /* fail */
|
||||||
|
/* - */
|
||||||
|
if( (ipv4a[0] != 0xc0) ||
|
||||||
|
(ipv4a[1] != 0xa8) ||
|
||||||
|
(ipv4a[2] != 0x64) ||
|
||||||
|
(ipv4a[3] != 0x01) ||
|
||||||
|
(ipv4a[4] != 0x01) )
|
||||||
|
exit(1); /* fail */
|
||||||
|
/* - */
|
||||||
|
memset(ipv6a, 1, sizeof(ipv6a));
|
||||||
|
if(1 != inet_pton(AF_INET6, ipv6src, ipv6a))
|
||||||
|
exit(1); /* fail */
|
||||||
|
/* - */
|
||||||
|
ipv6res[0] = '\0';
|
||||||
|
memset(ipv6a, 0, sizeof(ipv6a));
|
||||||
|
if( (ipv6a[0] != 0xfe) ||
|
||||||
|
(ipv6a[1] != 0x80) ||
|
||||||
|
(ipv6a[8] != 0x02) ||
|
||||||
|
(ipv6a[9] != 0x14) ||
|
||||||
|
(ipv6a[10] != 0x4f) ||
|
||||||
|
(ipv6a[11] != 0xff) ||
|
||||||
|
(ipv6a[12] != 0xfe) ||
|
||||||
|
(ipv6a[13] != 0x0b) ||
|
||||||
|
(ipv6a[14] != 0x76) ||
|
||||||
|
(ipv6a[15] != 0xc8) ||
|
||||||
|
(ipv6a[25] != 0x01) )
|
||||||
|
exit(1); /* fail */
|
||||||
|
/* - */
|
||||||
|
if( (ipv6a[2] != 0x0) ||
|
||||||
|
(ipv6a[3] != 0x0) ||
|
||||||
|
(ipv6a[4] != 0x0) ||
|
||||||
|
(ipv6a[5] != 0x0) ||
|
||||||
|
(ipv6a[6] != 0x0) ||
|
||||||
|
(ipv6a[7] != 0x0) ||
|
||||||
|
(ipv6a[16] != 0x0) ||
|
||||||
|
(ipv6a[17] != 0x0) ||
|
||||||
|
(ipv6a[18] != 0x0) ||
|
||||||
|
(ipv6a[19] != 0x0) ||
|
||||||
|
(ipv6a[20] != 0x0) ||
|
||||||
|
(ipv6a[21] != 0x0) ||
|
||||||
|
(ipv6a[22] != 0x0) ||
|
||||||
|
(ipv6a[23] != 0x0) ||
|
||||||
|
(ipv6a[24] != 0x0) )
|
||||||
|
exit(1); /* fail */
|
||||||
|
/* - */
|
||||||
|
exit(0);
|
||||||
|
]])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
tst_works_inet_pton="yes"
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
tst_works_inet_pton="no"
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
if test "$tst_compi_inet_pton" = "yes" &&
|
||||||
|
test "$tst_works_inet_pton" != "no"; then
|
||||||
|
AC_MSG_CHECKING([if inet_pton usage allowed])
|
||||||
|
if test "x$curl_disallow_inet_pton" != "xyes"; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
tst_allow_inet_pton="yes"
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
tst_allow_inet_pton="no"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
AC_MSG_CHECKING([if inet_pton might be used])
|
||||||
|
if test "$tst_links_inet_pton" = "yes" &&
|
||||||
|
test "$tst_proto_inet_pton" = "yes" &&
|
||||||
|
test "$tst_compi_inet_pton" = "yes" &&
|
||||||
|
test "$tst_allow_inet_pton" = "yes" &&
|
||||||
|
test "$tst_works_inet_pton" != "no"; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1,
|
||||||
|
[Define to 1 if you have a IPv6 capable working inet_pton function.])
|
||||||
|
ac_cv_func_inet_pton="yes"
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
ac_cv_func_inet_pton="no"
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl CURL_CHECK_FUNC_LOCALTIME_R
|
dnl CURL_CHECK_FUNC_LOCALTIME_R
|
||||||
dnl -------------------------------------------------
|
dnl -------------------------------------------------
|
||||||
dnl Verify if localtime_r is available, prototyped, can
|
dnl Verify if localtime_r is available, prototyped, can
|
||||||
|
@ -392,7 +392,6 @@ else
|
|||||||
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
|
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
|
||||||
|
Loading…
Reference in New Issue
Block a user