Remove redundant checks for MSG_* from configure.ac

It is redundant to check for the presence of MSG_NOSIGNAL macro in
configure.ac, define HAVE_MSG_NOSIGNAL and then check whether the later
is defined in the source code. Instead we can check directly whether
MSG_NOSIGNAL is defined. Same for MSG_DONTWAIT.

In addition to that, the checks we had in configure.ac produce a
compiler warning about unused variable and thus could fail if
-Werror is present and erroneously proclaim that the macros are
not available.
This commit is contained in:
Vasil Dimov 2018-03-11 20:19:26 +01:00
parent 71129e0265
commit 8ae413235d
No known key found for this signature in database
GPG key ID: 170E923FF6C1A420
3 changed files with 4 additions and 19 deletions

View file

@ -643,22 +643,6 @@ AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64],,,
AC_CHECK_DECLS([__builtin_clz, __builtin_clzl, __builtin_clzll]) AC_CHECK_DECLS([__builtin_clz, __builtin_clzl, __builtin_clzll])
dnl Check for MSG_NOSIGNAL
AC_MSG_CHECKING(for MSG_NOSIGNAL)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]],
[[ int f = MSG_NOSIGNAL; ]])],
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MSG_NOSIGNAL, 1,[Define this symbol if you have MSG_NOSIGNAL]) ],
[ AC_MSG_RESULT(no)]
)
dnl Check for MSG_DONTWAIT
AC_MSG_CHECKING(for MSG_DONTWAIT)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]],
[[ int f = MSG_DONTWAIT; ]])],
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MSG_DONTWAIT, 1,[Define this symbol if you have MSG_DONTWAIT]) ],
[ AC_MSG_RESULT(no)]
)
dnl Check for malloc_info (for memory statistics information in getmemoryinfo) dnl Check for malloc_info (for memory statistics information in getmemoryinfo)
AC_MSG_CHECKING(for getmemoryinfo) AC_MSG_CHECKING(for getmemoryinfo)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],

View file

@ -42,12 +42,13 @@
// We add a random period time (0 to 1 seconds) to feeler connections to prevent synchronization. // We add a random period time (0 to 1 seconds) to feeler connections to prevent synchronization.
#define FEELER_SLEEP_WINDOW 1 #define FEELER_SLEEP_WINDOW 1
#if !defined(HAVE_MSG_NOSIGNAL) // MSG_NOSIGNAL is not available on some platforms, if it doesn't exist define it as 0
#if !defined(MSG_NOSIGNAL)
#define MSG_NOSIGNAL 0 #define MSG_NOSIGNAL 0
#endif #endif
// MSG_DONTWAIT is not available on some platforms, if it doesn't exist define it as 0 // MSG_DONTWAIT is not available on some platforms, if it doesn't exist define it as 0
#if !defined(HAVE_MSG_DONTWAIT) #if !defined(MSG_DONTWAIT)
#define MSG_DONTWAIT 0 #define MSG_DONTWAIT 0
#endif #endif

View file

@ -21,7 +21,7 @@
#include <boost/algorithm/string/case_conv.hpp> // for to_lower() #include <boost/algorithm/string/case_conv.hpp> // for to_lower()
#include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith() #include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith()
#if !defined(HAVE_MSG_NOSIGNAL) #if !defined(MSG_NOSIGNAL)
#define MSG_NOSIGNAL 0 #define MSG_NOSIGNAL 0
#endif #endif