]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: detect CURL_SA_FAMILY_T
authorPeng-Yu Chen <pengyu@libstarrify.so>
Thu, 20 May 2021 10:11:42 +0000 (11:11 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 21 May 2021 06:39:39 +0000 (08:39 +0200)
Fixes #7049
Closes #7065

CMakeLists.txt
lib/curl_config.h.cmake
lib/curl_setup.h

index 2ffb72fafa105822903a6169f3162c2d3509630a..fcbf9ed2b6191d217c6f9e3cb2ec8c8fe4b17e4d 100644 (file)
@@ -1062,6 +1062,16 @@ if(HAVE_FSETXATTR)
   endforeach()
 endif()
 
+set(CMAKE_EXTRA_INCLUDE_FILES   "sys/socket.h")
+check_type_size("sa_family_t"   SIZEOF_SA_FAMILY_T)
+set(HAVE_SA_FAMILY_T            ${HAVE_SIZEOF_SA_FAMILY_T})
+set(CMAKE_EXTRA_INCLUDE_FILES   "")
+
+set(CMAKE_EXTRA_INCLUDE_FILES   "ws2def.h")
+check_type_size("ADDRESS_FAMILY"    SIZEOF_ADDRESS_FAMILY)
+set(HAVE_ADDRESS_FAMILY         ${HAVE_SIZEOF_ADDRESS_FAMILY})
+set(CMAKE_EXTRA_INCLUDE_FILES   "")
+
 # sigaction and sigsetjmp are special. Use special mechanism for
 # detecting those, but only if previous attempt failed.
 if(HAVE_SIGNAL_H)
index 6da7489cda9928b48e5577362563ca817c04f2de..96a19afc51e71b7a6977148cb028939d5e77ac7b 100644 (file)
 /* 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
 
index 5f4e4244a47f1ab6da255a4f3cdf57300ba2288d..b6ef532448719aff0f0c22b5216959c12ff4f48b 100644 (file)
@@ -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.