From 5ce93d6fa8df7d238e1aa2aa2314762d1af9a597 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 19 Sep 2017 19:38:15 +0200 Subject: [PATCH] output/sndio: refuse to build with libroarsndio RoarAudio's sndio emulation has been a source for annoyances. First, their headers turned out to be broken with C++, due to their use of the "new" keyword. Then they used a preprocessor macro to rename "sio_hdl" to something else, effectively disallowing the use of forward declarations. Enough is enough, and I'm removing support for it. RoarAudio users should better use the RoarAudio output plugin. --- NEWS | 1 + configure.ac | 24 ++++++++++++++++++++---- src/output/plugins/SndioOutputPlugin.cxx | 8 -------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index 4d473bb85..099a59694 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ ver 0.21 (not yet released) - pcm: support audio/L24 (RFC 3190) * output - alsa: non-blocking mode + - sndio: remove support for the broken RoarAudio sndio emulation * mixer - sndio: new mixer plugin diff --git a/configure.ac b/configure.ac index afe98f779..19fc4ce84 100644 --- a/configure.ac +++ b/configure.ac @@ -1131,10 +1131,26 @@ MPD_DEFINE_CONDITIONAL(enable_fifo, HAVE_FIFO, [support for writing audio to a FIFO]) dnl ----------------------------------- SNDIO ---------------------------------- -MPD_ENABLE_AUTO_HEADER([sndio], [SNDIO], [sndio.h], - [-lsndio], [], - [sndio output plugin], - [libsndio not found]) +MPD_ARG_ENABLE([sndio], [SNDIO], [sndio output plugin], [], [ + AC_SUBST([SNDIO_LIBS], []) + AC_SUBST([SNDIO_CFLAGS], []) + + found_sndio=no + MPD_AUTO([sndio], [SNDIO], [sndio output plugin], + [AC_CHECK_HEADER([sndio.h], + [AC_PREPROC_IFELSE( + [AC_LANG_PROGRAM([ + #include + #ifdef ROAR_VERSION + #error libroarsndio not supported + #endif + ])], + [found_sndio=yes SNDIO_LIBS='-lsndio' SNDIO_CFLAGS=''], + [AC_MSG_WARN([Found libroarsndio, which is known to be broken; ignoring it.])], + )] + )] + ) +]) dnl ----------------------------------- Haiku --------------------------------- MPD_ENABLE_AUTO_HEADER([haiku], [HAIKU], [media/MediaDefs.h], diff --git a/src/output/plugins/SndioOutputPlugin.cxx b/src/output/plugins/SndioOutputPlugin.cxx index 1c74ed6c3..6913c270c 100644 --- a/src/output/plugins/SndioOutputPlugin.cxx +++ b/src/output/plugins/SndioOutputPlugin.cxx @@ -24,16 +24,8 @@ #include "util/Domain.hxx" #include "Log.hxx" -/* work around a C++ incompatibility if the sndio API is emulated by - libroar: libroar's "struct roar_service_stream" has a member named - "new", which is an illegal identifier in C++ */ -#define new new_ - #include -/* undo the libroar workaround */ -#undef new - #include #ifndef SIO_DEVANY