Skip to content

Commit 8ae4132

Browse files
committed
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.
1 parent 71129e0 commit 8ae4132

File tree

3 files changed

+4
-19
lines changed

3 files changed

+4
-19
lines changed

configure.ac

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -643,22 +643,6 @@ AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64],,,
643643

644644
AC_CHECK_DECLS([__builtin_clz, __builtin_clzl, __builtin_clzll])
645645

646-
dnl Check for MSG_NOSIGNAL
647-
AC_MSG_CHECKING(for MSG_NOSIGNAL)
648-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]],
649-
[[ int f = MSG_NOSIGNAL; ]])],
650-
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MSG_NOSIGNAL, 1,[Define this symbol if you have MSG_NOSIGNAL]) ],
651-
[ AC_MSG_RESULT(no)]
652-
)
653-
654-
dnl Check for MSG_DONTWAIT
655-
AC_MSG_CHECKING(for MSG_DONTWAIT)
656-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]],
657-
[[ int f = MSG_DONTWAIT; ]])],
658-
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MSG_DONTWAIT, 1,[Define this symbol if you have MSG_DONTWAIT]) ],
659-
[ AC_MSG_RESULT(no)]
660-
)
661-
662646
dnl Check for malloc_info (for memory statistics information in getmemoryinfo)
663647
AC_MSG_CHECKING(for getmemoryinfo)
664648
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],

src/net.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@
4242
// We add a random period time (0 to 1 seconds) to feeler connections to prevent synchronization.
4343
#define FEELER_SLEEP_WINDOW 1
4444

45-
#if !defined(HAVE_MSG_NOSIGNAL)
45+
// MSG_NOSIGNAL is not available on some platforms, if it doesn't exist define it as 0
46+
#if !defined(MSG_NOSIGNAL)
4647
#define MSG_NOSIGNAL 0
4748
#endif
4849

4950
// MSG_DONTWAIT is not available on some platforms, if it doesn't exist define it as 0
50-
#if !defined(HAVE_MSG_DONTWAIT)
51+
#if !defined(MSG_DONTWAIT)
5152
#define MSG_DONTWAIT 0
5253
#endif
5354

src/netbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
2222
#include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith()
2323

24-
#if !defined(HAVE_MSG_NOSIGNAL)
24+
#if !defined(MSG_NOSIGNAL)
2525
#define MSG_NOSIGNAL 0
2626
#endif
2727

0 commit comments

Comments
 (0)