Skip to content

Commit c62d763

Browse files
committed
Necessary improvements to make configure work without libevent installed
1 parent 091ccc3 commit c62d763

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

configure.ac

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,15 +1510,25 @@ if test x$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench
15101510
fi
15111511
fi
15121512

1513-
AC_MSG_CHECKING([if evhttp_connection_get_peer expects const char**])
1514-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1515-
#include <cstdint>
1516-
#include <event2/http.h>
1517-
]],
1518-
[[ evhttp_connection_get_peer((evhttp_connection*) nullptr,(const char**) nullptr,(uint16_t*) nullptr); ]])],
1519-
[ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR], [1], [Define this symbol if evhttp_connection_get_peer expects const char**]) ],
1520-
[ AC_MSG_RESULT([no]); AC_DEFINE([HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR], [0], [Define this symbol if evhttp_connection_get_peer expects const char**]) ]
1521-
)
1513+
if test x$use_libevent = xyes; then
1514+
TEMP_CXXFLAGS="$CXXFLAGS"
1515+
CXXFLAGS="$CXXFLAGS $EVENT_CFLAGS"
1516+
AC_MSG_CHECKING([if evhttp_connection_get_peer expects const char**])
1517+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1518+
#include <cstdint>
1519+
#include <event2/http.h>
1520+
]], [[
1521+
evhttp_connection *conn = (evhttp_connection *)1;
1522+
const char *host;
1523+
uint16_t port;
1524+
1525+
evhttp_connection_get_peer(conn, &host, &port);
1526+
]])],
1527+
[ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR], [1], [Define this symbol if evhttp_connection_get_peer expects const char**]) ],
1528+
[ AC_MSG_RESULT([no]) ]
1529+
)
1530+
CXXFLAGS="$TEMP_CXXFLAGS"
1531+
fi
15221532

15231533
dnl QR Code encoding library check
15241534

src/httpserver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ CService HTTPRequest::GetPeer() const
602602
const char* address = "";
603603
uint16_t port = 0;
604604

605-
#if HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR
605+
#ifdef HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR
606606
evhttp_connection_get_peer(con, &address, &port);
607607
#else
608608
evhttp_connection_get_peer(con, (char**)&address, &port);

0 commit comments

Comments
 (0)