Skip to content

Instantly share code, notes, and snippets.

@luke-jr
Created December 1, 2021 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luke-jr/f8df9d7173a3f673b82b4f0c26854807 to your computer and use it in GitHub Desktop.
Save luke-jr/f8df9d7173a3f673b82b4f0c26854807 to your computer and use it in GitHub Desktop.
diff --git a/configure.ac b/configure.ac
index f969e707293..1c33cbc3a38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1372,14 +1372,24 @@ if test x$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench
if test x$TARGET_OS != xwindows; then
PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads >= 2.0.21],, [AC_MSG_ERROR([libevent_pthreads version 2.0.21 or greater not found.])])
fi
-fi
-AC_MSG_CHECKING([for evhttp_connection_get_peer])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <event2/http.h>]],
- [[ evhttp_connection_get_peer((evhttp_connection*) nullptr,(const char**) nullptr,(uint16_t *) nullptr); ]])],
- [ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR], [1], [Define this symbol if evhttp_connection_get_peer has const char]) ],
- [ AC_MSG_RESULT([no]); AC_DEFINE([HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR], [0], [Define this symbol if evhttp_connection_get_peer has const char]) ]
-)
+ TEMP_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS $EVENT_CFLAGS"
+ AC_MSG_CHECKING([if evhttp_connection_get_peer expects const char *])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <cstdint>
+ #include <event2/http.h>
+ ]],[[
+ evhttp_connection *conn = (evhttp_connection *)1;
+ const char *host;
+ uint16_t port;
+ evhttp_connection_get_peer(conn, &host, &port);
+ ]])],
+ [ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR], [1], [Define this symbol if evhttp_connection_get_peer argument has const char * type]) ],
+ [ AC_MSG_RESULT([no])]
+ )
+ CXXFLAGS="$TEMP_CXXFLAGS"
+fi
dnl QR Code encoding library check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment