From 4d437416daee0f626988b8c056ae9cd22486c655 Mon Sep 17 00:00:00 2001
From: Yang Tse <yangsita@gmail.com>
Date: Wed, 24 Sep 2008 19:13:01 +0000
Subject: [PATCH] HAVE_INET_PTON will only be defined when an IPv6 capable
 working inet_pton function is available.

---
 ares/Makefile.netware      |   1 -
 ares/configure.ac          |  30 +------
 ares/inet_net_pton.c       |   5 +-
 ares/inet_net_pton.h       |   2 +-
 ares/m4/cares-functions.m4 | 161 +++++++++++++++++++++++++++++++++++++
 configure.ac               |  11 +--
 lib/Makefile.netware       |   1 -
 lib/config-symbian.h       |  10 +--
 lib/config-tpf.h           |   8 +-
 lib/config.dos             |   1 -
 lib/inet_pton.h            |   5 --
 m4/curl-functions.m4       | 161 +++++++++++++++++++++++++++++++++++++
 src/Makefile.netware       |   1 -
 13 files changed, 336 insertions(+), 61 deletions(-)

diff --git a/ares/Makefile.netware b/ares/Makefile.netware
index 854de9c034..9ed7ba0c91 100644
--- a/ares/Makefile.netware
+++ b/ares/Makefile.netware
@@ -310,7 +310,6 @@ else
 	@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
 	@echo $(DL)#define HAVE_FTRUNCATE 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_LIMITS_H 1$(DL) >> $@
 	@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
diff --git a/ares/configure.ac b/ares/configure.ac
index 5c43e006a0..97d830434d 100644
--- a/ares/configure.ac
+++ b/ares/configure.ac
@@ -661,6 +661,7 @@ CURL_CHECK_MSG_NOSIGNAL
 CARES_CHECK_FUNC_GETHOSTNAME
 CARES_CHECK_FUNC_GETSERVBYPORT_R
 CARES_CHECK_FUNC_INET_NTOP
+CARES_CHECK_FUNC_INET_PTON
 CARES_CHECK_FUNC_STRCASECMP
 CARES_CHECK_FUNC_STRCMPI
 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
 AC_CHECK_FUNCS(inet_net_pton)
 dnl Again, some systems have it, but not IPv6
diff --git a/ares/inet_net_pton.c b/ares/inet_net_pton.c
index 0936aa143f..a3e93385a2 100644
--- a/ares/inet_net_pton.c
+++ b/ares/inet_net_pton.c
@@ -46,8 +46,7 @@
 #include "ares_ipv6.h"
 #include "inet_net_pton.h"
 
-#if !defined(HAVE_INET_NET_PTON) || !defined(HAVE_INET_NET_PTON_IPV6) || \
-    !defined(HAVE_INET_PTON) || !defined(HAVE_INET_PTON_IPV6)
+#if !defined(HAVE_INET_NET_PTON) || !defined(HAVE_INET_NET_PTON_IPV6)
 
 /*
  * static int
@@ -424,7 +423,7 @@ ares_inet_net_pton(int af, const char *src, void *dst, size_t size)
 
 #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 size, result;
diff --git a/ares/inet_net_pton.h b/ares/inet_net_pton.h
index 0f454602ef..f5642a505e 100644
--- a/ares/inet_net_pton.h
+++ b/ares/inet_net_pton.h
@@ -18,7 +18,7 @@
  * 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)
 #else
 int ares_inet_pton(int af, const char *src, void *dst);
diff --git a/ares/m4/cares-functions.m4 b/ares/m4/cares-functions.m4
index bdec24b112..520e99a29b 100644
--- a/ares/m4/cares-functions.m4
+++ b/ares/m4/cares-functions.m4
@@ -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 -------------------------------------------------
 dnl Verify if strcasecmp is available, prototyped, and
diff --git a/configure.ac b/configure.ac
index 1f66edbcb2..42ceb73e35 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2077,6 +2077,7 @@ CURL_CHECK_FUNC_GETSERVBYPORT_R
 CURL_CHECK_FUNC_GMTIME_R
 CURL_CHECK_FUNC_INET_NTOA_R
 CURL_CHECK_FUNC_INET_NTOP
+CURL_CHECK_FUNC_INET_PTON
 CURL_CHECK_FUNC_LOCALTIME_R
 CURL_CHECK_FUNC_SIGACTION
 CURL_CHECK_FUNC_STRCASECMP
@@ -2118,7 +2119,6 @@ AC_CHECK_FUNCS([basename \
   getrlimit \
   gettimeofday \
   inet_addr \
-  inet_pton \
   perror \
   pipe \
   poll \
@@ -2186,15 +2186,6 @@ AC_CHECK_DECL(basename, ,
 #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 and get the types of five of its arguments.
diff --git a/lib/Makefile.netware b/lib/Makefile.netware
index a2aa1623f0..619aa55be1 100644
--- a/lib/Makefile.netware
+++ b/lib/Makefile.netware
@@ -404,7 +404,6 @@ else
 	@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
 	@echo $(DL)#define HAVE_FTRUNCATE 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_LIMITS_H 1$(DL) >> $@
 	@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
diff --git a/lib/config-symbian.h b/lib/config-symbian.h
index 3f0ddf1582..d35443f2cc 100644
--- a/lib/config-symbian.h
+++ b/lib/config-symbian.h
@@ -222,8 +222,11 @@
 /* Define to 1 if you have the `inet_addr' function. */
 /*#define HAVE_INET_ADDR 1*/
 
-/* Define to 1 if you have the `inet_pton' function. */
-#define HAVE_INET_PTON 1
+/* Define to 1 if you have a IPv6 capable working inet_ntop function. */
+/*#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 HAVE_INTTYPES_H 1
@@ -330,9 +333,6 @@
 /* Define to 1 if NI_WITHSCOPEID exists and works. */
 /*#define HAVE_NI_WITHSCOPEID 1*/
 
-/* Defined if no inet_pton() prototype available */
-/* #undef HAVE_NO_INET_PTON_PROTO */
-
 /* we have no strerror_r() proto */
 /* #undef HAVE_NO_STRERROR_R_DECL */
 
diff --git a/lib/config-tpf.h b/lib/config-tpf.h
index 35231976a5..35c44ed70d 100644
--- a/lib/config-tpf.h
+++ b/lib/config-tpf.h
@@ -208,7 +208,10 @@
 /* Define to 1 if you have the `inet_addr' function. */
 #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 */
 
 /* Define to 1 if you have the <inttypes.h> header file. */
@@ -290,9 +293,6 @@
 /* Define if NI_WITHSCOPEID exists and works */
 /* #undef HAVE_NI_WITHSCOPEID */
 
-/* Defined if no inet_pton() prototype available */
-/* #undef HAVE_NO_INET_PTON_PROTO */
-
 /* we have no strerror_r() proto */
 /* #undef HAVE_NO_STRERROR_R_DECL */
 
diff --git a/lib/config.dos b/lib/config.dos
index 7f40bdf863..de751da128 100644
--- a/lib/config.dos
+++ b/lib/config.dos
@@ -24,7 +24,6 @@
 #define HAVE_GETTIMEOFDAY      1
 #define HAVE_IO_H              1
 #define HAVE_IOCTLSOCKET       1
-#define HAVE_INET_PTON         1
 #define HAVE_LOCALE_H          1
 #define HAVE_LONGLONG          1
 #define HAVE_MEMORY_H          1
diff --git a/lib/inet_pton.h b/lib/inet_pton.h
index a659a97744..8331ba9dc1 100644
--- a/lib/inet_pton.h
+++ b/lib/inet_pton.h
@@ -28,11 +28,6 @@
 int Curl_inet_pton(int, const char *, void *);
 
 #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
 #include <arpa/inet.h>
 #endif
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
index e91147550d..4f4b995304 100644
--- a/m4/curl-functions.m4
+++ b/m4/curl-functions.m4
@@ -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 -------------------------------------------------
 dnl Verify if localtime_r is available, prototyped, can
diff --git a/src/Makefile.netware b/src/Makefile.netware
index 0defac8fd0..e1d283ee41 100644
--- a/src/Makefile.netware
+++ b/src/Makefile.netware
@@ -392,7 +392,6 @@ else
 	@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
 	@echo $(DL)#define HAVE_FTRUNCATE 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_LIMITS_H 1$(DL) >> $@
 	@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
-- 
GitLab