Fix support for older libwebsocket versions

LWS_WITH_EXTERNAL_POLL a new optional define for libwebsocket 4.x.
Earlier versions always supported it, without the compile-time define.

This fixes support for libwesocket 2.x (Debian, Ubuntu), and 3.x.
Also for Windows, LWS_WITH_GLIB is not available.
This commit is contained in:
Robin Gareus
2020-06-10 15:58:47 +02:00
parent f0d5d1323a
commit 5296ed141f

View File

@@ -116,13 +116,6 @@ WebsocketsServer::WebsocketsServer (ArdourSurface::ArdourWebsockets& surface)
int
WebsocketsServer::start ()
{
#if !defined(LWS_WITH_GLIB) && !defined(LWS_WITH_EXTERNAL_POLL)
PBD::error << "ArdourWebsockets: check your libwebsockets was compiled"
" with LWS_WITH_GLIB or LWS_WITH_EXTERNAL_POLL enabled"
<< endmsg;
return -1;
#endif
#ifndef NDEBUG
lws_set_log_level (LLL_ERR | LLL_WARN | LLL_DEBUG, 0);
#endif
@@ -145,6 +138,17 @@ WebsocketsServer::start ()
return -1;
}
#ifndef LWS_WITH_GLIB
/* sometimes LWS_WITH_EXTERNAL_POLL is missing from lws_config.h
but the feature is still available, hence this runtime check */
if (_fd_ctx.empty ()) {
PBD::error << "ArdourWebsockets: check your libwebsockets was compiled"
" with LWS_WITH_GLIB or LWS_WITH_EXTERNAL_POLL enabled"
<< endmsg;
return -1;
}
#endif
return 0;
}