summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeng-Yu Chen <pengyu@libstarrify.so>2021-05-20 11:11:42 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-05-21 08:39:39 +0200
commit07d20f5dfa45fe0c3e7ef56b89028887e3c4dc47 (patch)
treebe687c680a02f9cff416f5247c54289515624c0e /lib
parent84d2839740ca78041ac7419d9aaeac55c1e1c729 (diff)
downloadcurl-07d20f5dfa45fe0c3e7ef56b89028887e3c4dc47.tar.gz
cmake: detect CURL_SA_FAMILY_T
Fixes #7049 Closes #7065
Diffstat (limited to 'lib')
-rw-r--r--lib/curl_config.h.cmake6
-rw-r--r--lib/curl_setup.h11
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake
index 6da7489cd..96a19afc5 100644
--- a/lib/curl_config.h.cmake
+++ b/lib/curl_config.h.cmake
@@ -313,6 +313,12 @@
/* Define to 1 if you have a IPv6 capable working inet_pton function. */
#cmakedefine HAVE_INET_PTON 1
+/* Define to 1 if symbol `sa_family_t' exists */
+#cmakedefine HAVE_SA_FAMILY_T 1
+
+/* Define to 1 if symbol `ADDRESS_FAMILY' exists */
+#cmakedefine HAVE_ADDRESS_FAMILY 1
+
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
diff --git a/lib/curl_setup.h b/lib/curl_setup.h
index 5f4e4244a..b6ef53244 100644
--- a/lib/curl_setup.h
+++ b/lib/curl_setup.h
@@ -777,9 +777,16 @@ endings either CRLF or LF so 't' is appropriate.
# endif
#endif /* DONT_USE_RECV_BEFORE_SEND_WORKAROUND */
-/* for systems that don't detect this in configure, use a sensible default */
+/* for systems that don't detect this in configure */
#ifndef CURL_SA_FAMILY_T
-#define CURL_SA_FAMILY_T unsigned short
+# if defined(HAVE_SA_FAMILY_T)
+# define CURL_SA_FAMILY_T sa_family_t
+# elif defined(HAVE_ADDRESS_FAMILY)
+# define CURL_SA_FAMILY_T ADDRESS_FAMILY
+# else
+/* use a sensible default */
+# define CURL_SA_FAMILY_T unsigned short
+# endif
#endif
/* Some convenience macros to get the larger/smaller value out of two given.