diff --git a/Makefile.am b/Makefile.am index 9f02ebb3e..3b1466839 100644 --- a/Makefile.am +++ b/Makefile.am @@ -349,7 +349,7 @@ endif src/haiku/mpd.rsrc: src/haiku/mpd.rdef $(RC) -o $@ $< -if HAVE_HAIKU +if ENABLE_HAIKU noinst_DATA = src/haiku/mpd.rdef EXTRA_src_mpd_DEPENDENCIES = src/haiku/mpd.rsrc @@ -1313,9 +1313,11 @@ liboutput_plugins_a_CPPFLAGS = $(AM_CPPFLAGS) \ $(AO_CFLAGS) \ $(ALSA_CFLAGS) \ $(JACK_CFLAGS) \ + $(HAIKU_CFLAGS) \ $(OPENAL_CFLAGS) \ $(OPENSSL_CFLAGS) \ $(PULSE_CFLAGS) \ + $(SNDIO_CFLAGS) \ $(SHOUT_CFLAGS) OUTPUT_LIBS = \ @@ -1325,7 +1327,9 @@ OUTPUT_LIBS = \ $(ALSA_LIBS) \ $(ROAR_LIBS) \ $(JACK_LIBS) \ + $(HAIKU_LIBS) \ $(OPENAL_LIBS) \ + $(SNDIO_LIBS) \ $(SHOUT_LIBS) OUTPUT_API_SRC = \ @@ -1410,13 +1414,13 @@ liboutput_plugins_a_SOURCES += \ src/output/plugins/FifoOutputPlugin.hxx endif -if HAVE_SNDIO +if ENABLE_SNDIO liboutput_plugins_a_SOURCES += \ src/output/plugins/SndioOutputPlugin.cxx \ src/output/plugins/SndioOutputPlugin.hxx endif -if HAVE_HAIKU +if ENABLE_HAIKU liboutput_plugins_a_SOURCES += \ src/output/plugins/HaikuOutputPlugin.cxx \ src/output/plugins/HaikuOutputPlugin.hxx diff --git a/configure.ac b/configure.ac index d420e572c..78c93569e 100644 --- a/configure.ac +++ b/configure.ac @@ -343,16 +343,6 @@ AC_ARG_ENABLE(fifo, [disable support for writing audio to a FIFO (default: enable)]),, enable_fifo=yes) -AC_ARG_ENABLE(sndio, - AS_HELP_STRING([--enable-sndio], - [enable support for sndio output plugin (default: auto)]),, - enable_sndio=auto) - -AC_ARG_ENABLE(haiku, - AS_HELP_STRING([--enable-haiku], - [enable the Haiku output plugin (default: auto)]),, - enable_haiku=auto) - AC_ARG_ENABLE(httpd-output, AS_HELP_STRING([--enable-httpd-output], [enables the HTTP server output]),, @@ -1129,31 +1119,16 @@ MPD_DEFINE_CONDITIONAL(enable_fifo, HAVE_FIFO, [support for writing audio to a FIFO]) dnl ----------------------------------- SNDIO ---------------------------------- -if test x$enable_sndio = xauto; then - AC_CHECK_HEADER(sndio.h, - [enable_sndio=yes], - [enable_sndio=no;AC_MSG_WARN([sndio.h not found -- disabling support for sndio output])]) -fi - -if test x$enable_sndio = xyes; then - AC_DEFINE(HAVE_SNDIO,1,[Define for compiling sndio support]) - LIBS="$LIBS -lsndio" -fi - -AM_CONDITIONAL(HAVE_SNDIO, test x$enable_sndio = xyes) +MPD_ENABLE_AUTO_HEADER([sndio], [SNDIO], [sndio.h], + [-lsndio], [], + [sndio output plugin], + [libsndio not found]) dnl ----------------------------------- Haiku --------------------------------- -if test x$enable_haiku = xauto; then - AC_CHECK_HEADER(media/MediaDefs.h, - [enable_haiku=yes], - [enable_haiku=no]) -fi -if test x$enable_haiku = xyes; then - AC_DEFINE(HAVE_HAIKU,1,[Define for compiling Haiku support]) - LIBS="$LIBS -lbe -lmedia" -fi - -AM_CONDITIONAL(HAVE_HAIKU, test x$enable_haiku = xyes) +MPD_ENABLE_AUTO_HEADER([haiku], [HAIKU], [media/MediaDefs.h], + [-lbe -lmedia], [], + [Haiku output plugin], + [Haiku headers not found]) dnl ------------------------------- HTTPD Output ------------------------------ if test x$enable_httpd_output = xauto; then diff --git a/m4/mpd_auto.m4 b/m4/mpd_auto.m4 index 56957c854..ed64064d1 100644 --- a/m4/mpd_auto.m4 +++ b/m4/mpd_auto.m4 @@ -89,6 +89,19 @@ AC_DEFUN([MPD_AUTO_LIB], [ [$5])]) ]) +dnl Wrapper for AC_CHECK_HEADER. +dnl +dnl Parameters: varname1, varname2, header, libs, cflags, description, errmsg +AC_DEFUN([MPD_AUTO_HEADER], [ + AC_SUBST([$2_LIBS], []) + AC_SUBST([$2_CFLAGS], []) + + MPD_AUTO([$1], [$6], [$7], + [AC_CHECK_HEADER([$3], + [found_$1=yes $2_LIBS='$4' $2_CFLAGS='$5'], + [found_$1=no])]) +]) + dnl Convert the given string into a string for the "default value" in dnl the help text. If the string is a literal, then it is returned dnl as-is; if it contains a variable reference, just "auto" is @@ -153,6 +166,16 @@ AC_DEFUN([MPD_ENABLE_AUTO_LIB], [ ]) ]) +dnl Wrapper for AC_ARG_ENABLE and MPD_AUTO_HEADER +dnl +dnl Parameters: varname1, varname2, header, libs, cflags, description, errmsg, default, pre +AC_DEFUN([MPD_ENABLE_AUTO_HEADER], [ + MPD_ARG_ENABLE([$1], [$2], [$6], [$8], [ + $9 + MPD_AUTO_HEADER($1, $2, $3, $4, $5, $6, $7) + ]) +]) + dnl Wrapper for MPD_ENABLE_AUTO_PKG and MPD_DEPENDS dnl dnl Parameters: varname1, varname2, pkg, description, errmsg, default, dep_variable, dep_errmsg diff --git a/src/output/Registry.cxx b/src/output/Registry.cxx index 9d8d82652..38ada91eb 100644 --- a/src/output/Registry.cxx +++ b/src/output/Registry.cxx @@ -53,10 +53,10 @@ const AudioOutputPlugin *const audio_output_plugins[] = { #ifdef HAVE_FIFO &fifo_output_plugin, #endif -#ifdef HAVE_SNDIO +#ifdef ENABLE_SNDIO &sndio_output_plugin, #endif -#ifdef HAVE_HAIKU +#ifdef ENABLE_HAIKU &haiku_output_plugin, #endif #ifdef ENABLE_PIPE_OUTPUT