diff --git a/configure.ac b/configure.ac index d25bebeb1a..65f7fa0739 100644 --- a/configure.ac +++ b/configure.ac @@ -558,6 +558,15 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [ AC_MSG_RESULT(no)] ) +dnl Check for MSG_DONTWAIT +AC_MSG_CHECKING(for MSG_DONTWAIT) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[ int f = MSG_DONTWAIT; ]])], + [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DONTWAIT, 1,[Define this symbol if you have MSG_DONTWAIT]) ], + [ AC_MSG_RESULT(no)] +) + + AC_MSG_CHECKING([for visibility attribute]) AC_LINK_IFELSE([AC_LANG_SOURCE([ int foo_def( void ) __attribute__((visibility("default"))); diff --git a/src/compat.h b/src/compat.h index 28aa77eea2..6f4d4e65f0 100644 --- a/src/compat.h +++ b/src/compat.h @@ -47,9 +47,7 @@ #include #endif -#ifdef WIN32 -#define MSG_DONTWAIT 0 -#else +#ifndef WIN32 typedef u_int SOCKET; #include "errno.h" #define WSAGetLastError() errno @@ -79,6 +77,11 @@ typedef u_int SOCKET; #define MSG_NOSIGNAL 0 #endif +// MSG_DONTWAIT is not available on some platforms, if it doesn't exist define it as 0 +#if !defined(HAVE_MSG_DONTWAIT) && !defined(MSG_DONTWAIT) +#define MSG_DONTWAIT 0 +#endif + #if HAVE_DECL_STRNLEN == 0 size_t strnlen( const char *start, size_t max_len); #endif // HAVE_DECL_STRNLEN