set(HAVE_FCHMOD 0)
set(HAVE_SOCKETPAIR 0)
set(HAVE_SENDMSG 0)
+set(HAVE_SENDMMSG 0)
set(HAVE_ALARM 0)
set(HAVE_FCNTL 0)
set(HAVE_GETPPID 0)
include(PickyWarnings)
+if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") # Required for sendmmsg()
+endif()
+
option(ENABLE_DEBUG "Enable curl debug features" OFF)
option(ENABLE_CURLDEBUG "Enable TrackMemory feature" ${ENABLE_DEBUG})
check_symbol_exists("recv" "${CURL_INCLUDES}" HAVE_RECV)
check_symbol_exists("send" "${CURL_INCLUDES}" HAVE_SEND)
check_symbol_exists("sendmsg" "${CURL_INCLUDES}" HAVE_SENDMSG)
+check_symbol_exists("sendmmsg" "sys/socket.h" HAVE_SENDMMSG)
check_symbol_exists("select" "${CURL_INCLUDES}" HAVE_SELECT)
check_symbol_exists("strdup" "${CURL_INCLUDES};string.h" HAVE_STRDUP)
check_symbol_exists("strtok_r" "${CURL_INCLUDES};string.h" HAVE_STRTOK_R)
;;
esac
+# In order to detect support of sendmmsg(), we need to escape the POSIX
+# jail by defining _GNU_SOURCE or <sys/socket.h> will not expose it.
+case $host_os in
+ linux*)
+ CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+ ;;
+esac
+
dnl Build unit tests when option --enable-debug is given.
if test "x$want_debug" = "xyes" &&
test "x$supports_unittests" = "xyes"; then
pipe \
sched_yield \
sendmsg \
+ sendmmsg \
setlocale \
setmode \
setrlimit \
/* Define to 1 if you have the sendmsg function. */
#cmakedefine HAVE_SENDMSG 1
+/* Define to 1 if you have the sendmmsg function. */
+#cmakedefine HAVE_SENDMMSG 1
+
/* Define to 1 if you have the 'fsetxattr' function. */
#cmakedefine HAVE_FSETXATTR 1
/* please, do it beyond the point further indicated in this file. */
/* ================================================================ */
+/* Give calloc a chance to be dragging in early, so we do not redefine */
+#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
+# include <pthread.h>
+#endif
+
/*
* Disable other protocols when http is the only one desired.
*/
*
***************************************************************************/
-/* WIP, experimental: use recvmmsg() on Linux
- * we have no configure check, yet
- * and also it is only available for _GNU_SOURCE, which
- * we do not use otherwise.
-#define HAVE_SENDMMSG
- */
-#if defined(HAVE_SENDMMSG)
-#define _GNU_SOURCE
-#include <sys/socket.h>
-#undef _GNU_SOURCE
-#endif
-
#include "curl_setup.h"
#ifdef HAVE_NETINET_UDP_H
{
struct sockaddr addr;
curl_socklen_t addrlen = sizeof(addr);
+ memset(&addr, 0, sizeof(addr));
if(getsockname(sockfd, (struct sockaddr *)&addr, &addrlen) == 0)
return addr.sa_family;
return AF_UNSPEC;