From 061591ba5d00c1e65900256c1b0ef4c4156311b3 Mon Sep 17 00:00:00 2001
From: SilvanScherrer <silvan.scherrer@aroa.ch>
Date: Wed, 10 Mar 2021 11:48:26 +0100
Subject: [PATCH 3/6] add libcx functions in configure and fix build breaks
 because of it

---
 lib/asyn-thread.c    |  4 ++++
 lib/curl_addrinfo.h  |  4 ++++
 m4/curl-functions.m4 | 19 +++++++++++++++++++
 3 files changed, 27 insertions(+)

diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
index 9fcbc3c1f..6ec575db8 100644
--- a/lib/asyn-thread.c
+++ b/lib/asyn-thread.c
@@ -57,6 +57,10 @@
 #define in_addr_t unsigned long
 #endif
 
+#ifdef __OS2__
+#include <libcx/net.h>
+#endif
+
 #ifdef HAVE_GETADDRINFO
 #  define RESOLVER_ENOMEM  EAI_MEMORY
 #else
diff --git a/lib/curl_addrinfo.h b/lib/curl_addrinfo.h
index 73a8c1b33..8d6a5783b 100644
--- a/lib/curl_addrinfo.h
+++ b/lib/curl_addrinfo.h
@@ -40,6 +40,10 @@
 #  include <stdlib.h>
 #endif
 
+#ifdef __OS2__
+#  include <libcx/net.h>
+#endif
+
 /*
  * Curl_addrinfo is our internal struct definition that we use to allow
  * consistent internal handling of this data. We use this even when the
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
index 58a3cf443..ae00f0fc5 100644
--- a/m4/curl-functions.m4
+++ b/m4/curl-functions.m4
@@ -170,6 +170,9 @@ curl_includes_netdb="\
 #ifdef HAVE_NETDB_H
 #  include <netdb.h>
 #endif
+#ifdef __OS2__
+#  include <libcx/net.h>
+#endif
 /* includes end */"
   AC_CHECK_HEADERS(
     sys/types.h netdb.h,
@@ -574,6 +577,10 @@ curl_includes_netif="\
 #ifdef HAVE_NET_IF_H
 #  include <net/if.h>
 #endif
+#ifdef __OS2__
+#  include <libcx/net.h>
+#endif
+
 /* includes end */"
   AC_CHECK_HEADERS(
     net/if.h,
@@ -2346,6 +2353,9 @@ AC_DEFUN([CURL_CHECK_FUNC_GAI_STRERROR], [
       $curl_includes_winsock2
       $curl_includes_bsdsocket
       $curl_includes_netdb
+      #ifdef __OS2__
+      #include <libcx/net.h>
+      #endif
     ]],[[
       if(0 != gai_strerror(0))
         return 1;
@@ -2364,6 +2374,9 @@ AC_DEFUN([CURL_CHECK_FUNC_GAI_STRERROR], [
       $curl_includes_winsock2
       $curl_includes_bsdsocket
       $curl_includes_netdb
+      #ifdef __OS2__
+      #include <libcx/net.h>
+      #endif
     ],[
       AC_MSG_RESULT([yes])
       tst_proto_gai_strerror="yes"
@@ -2380,6 +2393,9 @@ AC_DEFUN([CURL_CHECK_FUNC_GAI_STRERROR], [
         $curl_includes_winsock2
       $curl_includes_bsdsocket
         $curl_includes_netdb
+      #ifdef __OS2__
+      #include <libcx/net.h>
+      #endif
       ]],[[
         if(0 != gai_strerror(0))
           return 1;
@@ -3149,6 +3165,9 @@ AC_DEFUN([CURL_CHECK_FUNC_IF_NAMETOINDEX], [
       $curl_includes_winsock2
       $curl_includes_bsdsocket
       #include <net/if.h>
+      #ifdef __OS2__
+      #include <libcx/net.h>
+      #endif
     ]],[[
       if(0 != if_nametoindex(""))
         return 1;
-- 
2.30.2

