aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-26 21:58:37 +0100
committerMax Kellermann <max@duempel.org>2008-10-26 21:58:37 +0100
commit0800c6f4ca36012b65e3cde825663adc1eafeae2 (patch)
tree5d0f24a02042c48a30d6b67920f77ef65e7e6215
parent3dac99034afe14e61554f327329c11d32962ae04 (diff)
downloadmpd-0800c6f4ca36012b65e3cde825663adc1eafeae2.tar.gz
mpd-0800c6f4ca36012b65e3cde825663adc1eafeae2.tar.xz
mpd-0800c6f4ca36012b65e3cde825663adc1eafeae2.zip
output: don't compile plugins which are disabled
Don't compile the sources of disabled output plugins at all.
-rw-r--r--configure.ac20
-rw-r--r--src/Makefile.am61
-rw-r--r--src/output/alsa_plugin.c14
-rw-r--r--src/output/ao_plugin.c8
-rw-r--r--src/output/fifo_plugin.c9
-rw-r--r--src/output/jack_plugin.c9
-rw-r--r--src/output/mvp_plugin.c8
-rw-r--r--src/output/oss_plugin.c8
-rw-r--r--src/output/osx_plugin.c12
-rw-r--r--src/output/pulse_plugin.c8
-rw-r--r--src/output/shout_mp3.c6
-rw-r--r--src/output/shout_ogg.c6
-rw-r--r--src/output/shout_plugin.h5
-rw-r--r--src/output_list.c18
-rw-r--r--src/output_list.h4
15 files changed, 92 insertions, 104 deletions
diff --git a/configure.ac b/configure.ac
index d79240ff9..ee129f5ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -327,6 +327,8 @@ case $host in
enable_osx=yes ;;
esac
+AM_CONDITIONAL(HAVE_OSX, test x$enable_osx = xyes)
+
if test x$enable_curl = xyes; then
PKG_CHECK_MODULES(CURL, [libcurl],
AC_DEFINE(HAVE_CURL, 1, [Define when libcurl is used for HTTP streaming]),
@@ -375,16 +377,24 @@ if test x$enable_shout_mp3 = xyes; then
fi
fi
+AM_CONDITIONAL(HAVE_SHOUT, test x$enable_shout = xyes)
+AM_CONDITIONAL(HAVE_SHOUT_OGG, test x$enable_shout_ogg = xyes)
+AM_CONDITIONAL(HAVE_SHOUT_MP3, test x$enable_shout_mp3 = xyes)
+
if test x$enable_ao = xyes; then
PKG_CHECK_MODULES(AO, [ao],
AC_DEFINE(HAVE_AO, 1, [Define to play with ao]),
enable_ao=no)
fi
+AM_CONDITIONAL(HAVE_AO, test x$enable_ao = xyes)
+
if test x$enable_oss = xyes; then
AC_CHECK_HEADER(sys/soundcard.h,[enable_oss=yes;AC_DEFINE(HAVE_OSS,1,[Define to enable OSS])],[AC_MSG_WARN(Soundcard headers not found -- disabling OSS support);enable_oss=no])
fi
+AM_CONDITIONAL(HAVE_OSS, test x$enable_oss = xyes)
+
PKG_PROG_PKG_CONFIG
if test x$enable_pulse = xyes; then
@@ -393,6 +403,8 @@ if test x$enable_pulse = xyes; then
[enable_pulse=no;AC_MSG_WARN([PulseAudio not found -- disabling])])
fi
+AM_CONDITIONAL(HAVE_PULSE, test x$enable_pulse = xyes)
+
if test x$enable_lsr = xyes; then
PKG_CHECK_MODULES([SAMPLERATE], [samplerate >= 0.0.15],
[enable_lsr=yes;AC_DEFINE([HAVE_LIBSAMPLERATE], 1, [Define to enable libsamplerate])] MPD_LIBS="$MPD_LIBS $SAMPLERATE_LIBS" MPD_CFLAGS="$MPD_CFLAGS $SAMPLERATE_CFLAGS",
@@ -412,22 +424,30 @@ if test x$enable_fifo = xyes; then
[enable_fifo=no;AC_MSG_WARN([mkfifo not found -- disabling support for writing audio to a FIFO])])
fi
+AM_CONDITIONAL(HAVE_FIFO, test x$enable_fifo = xyes)
+
if test x$enable_mvp = xyes; then
AC_DEFINE(HAVE_MVP,1,[Define to enable Hauppauge Media MVP support])
fi
+AM_CONDITIONAL(HAVE_MVP, test x$enable_mvp = xyes)
+
if test x$enable_alsa = xyes; then
PKG_CHECK_MODULES(ALSA, [alsa >= 0.9.0],
AC_DEFINE(HAVE_ALSA, 1, [Define to enable ALSA support]),
enable_alsa=no)
fi
+AM_CONDITIONAL(HAVE_ALSA, test x$enable_alsa = xyes)
+
if test x$enable_jack = xyes; then
PKG_CHECK_MODULES([JACK], [jack >= 0.4],
[enable_jack=yes;AC_DEFINE([HAVE_JACK], 1, [Define to enable JACK support])] MPD_LIBS="$MPD_LIBS $JACK_LIBS" MPD_CFLAGS="$MPD_CFLAGS $JACK_CFLAGS",
[enable_jack=no;AC_MSG_WARN([JACK not found -- disabling])])
fi
+AM_CONDITIONAL(HAVE_JACK, test x$enable_jack = xyes)
+
if test x$enable_id3 = xyes; then
PKG_CHECK_MODULES([ID3TAG], [id3tag],
AC_DEFINE(HAVE_ID3TAG, 1, [Define to use id3tag]),
diff --git a/src/Makefile.am b/src/Makefile.am
index 15d15e175..511ffac77 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,19 +1,5 @@
bin_PROGRAMS = mpd
-mpd_output = \
- output/shout_plugin.c \
- output/shout_ogg.c \
- output/shout_mp3.c \
- output/null_plugin.c \
- output/fifo_plugin.c \
- output/alsa_plugin.c \
- output/ao_plugin.c \
- output/oss_plugin.c \
- output/osx_plugin.c \
- output/pulse_plugin.c \
- output/mvp_plugin.c \
- output/jack_plugin.c
-
mpd_headers = \
notify.h \
ack.h \
@@ -102,7 +88,6 @@ mpd_headers = \
mpd_SOURCES = \
$(mpd_headers) \
- $(mpd_output) \
notify.c \
audio.c \
audioOutput.c \
@@ -111,6 +96,7 @@ mpd_SOURCES = \
output_thread.c \
output_control.c \
output_init.c \
+ output/null_plugin.c \
buffer2array.c \
command.c \
idle.c \
@@ -248,6 +234,51 @@ mpd_SOURCES += input_curl.c
endif
+if HAVE_ALSA
+mpd_SOURCES += output/alsa_plugin.c
+endif
+
+if HAVE_AO
+mpd_SOURCES += output/ao_plugin.c
+endif
+
+if HAVE_FIFO
+mpd_SOURCES += output/fifo_plugin.c
+endif
+
+if HAVE_JACK
+mpd_SOURCES += output/jack_plugin.c
+endif
+
+if HAVE_MVP
+mpd_SOURCES += output/mvp_plugin.c
+endif
+
+if HAVE_OSS
+mpd_SOURCES += output/oss_plugin.c
+endif
+
+if HAVE_OSX
+mpd_SOURCES += output/osx_plugin.c
+endif
+
+if HAVE_PULSE
+mpd_SOURCES += output/pulse_plugin.c
+endif
+
+if HAVE_SHOUT
+mpd_SOURCES += output/shout_plugin.c
+endif
+
+if HAVE_SHOUT_MP3
+mpd_SOURCES += output/shout_mp3.c
+endif
+
+if HAVE_SHOUT_OGG
+mpd_SOURCES += output/shout_ogg.c
+endif
+
+
mpd_CFLAGS = $(MPD_CFLAGS)
mpd_CPPFLAGS = \
$(CURL_CFLAGS) \
diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c
index 1845f1b76..e812e49fc 100644
--- a/src/output/alsa_plugin.c
+++ b/src/output/alsa_plugin.c
@@ -17,8 +17,10 @@
*/
#include "../output_api.h"
+#include "../utils.h"
+#include "../log.h"
-#ifdef HAVE_ALSA
+#include <alsa/asoundlib.h>
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
@@ -27,11 +29,6 @@ static const char default_device[] = "default";
#define MPD_ALSA_RETRY_NR 5
-#include "../utils.h"
-#include "../log.h"
-
-#include <alsa/asoundlib.h>
-
typedef snd_pcm_sframes_t alsa_writei_t(snd_pcm_t * pcm, const void *buffer,
snd_pcm_uframes_t size);
@@ -437,8 +434,3 @@ const struct audio_output_plugin alsaPlugin = {
.cancel = alsa_dropBufferedAudio,
.close = alsa_closeDevice,
};
-
-#else /* HAVE ALSA */
-
-DISABLED_AUDIO_OUTPUT_PLUGIN(alsaPlugin)
-#endif /* HAVE_ALSA */
diff --git a/src/output/ao_plugin.c b/src/output/ao_plugin.c
index e731f972a..b5cebc93b 100644
--- a/src/output/ao_plugin.c
+++ b/src/output/ao_plugin.c
@@ -17,9 +17,6 @@
*/
#include "../output_api.h"
-
-#ifdef HAVE_AO
-
#include "../utils.h"
#include "../log.h"
@@ -246,8 +243,3 @@ const struct audio_output_plugin aoPlugin = {
.cancel = audioOutputAo_dropBufferedAudio,
.close = audioOutputAo_closeDevice,
};
-
-#else
-
-DISABLED_AUDIO_OUTPUT_PLUGIN(aoPlugin)
-#endif
diff --git a/src/output/fifo_plugin.c b/src/output/fifo_plugin.c
index d7eb91ff6..cd83177f8 100644
--- a/src/output/fifo_plugin.c
+++ b/src/output/fifo_plugin.c
@@ -17,9 +17,6 @@
*/
#include "../output_api.h"
-
-#ifdef HAVE_FIFO
-
#include "../log.h"
#include "../utils.h"
#include "../timer.h"
@@ -282,9 +279,3 @@ const struct audio_output_plugin fifoPlugin = {
.cancel = fifo_dropBufferedAudio,
.close = fifo_closeDevice,
};
-
-#else /* HAVE_FIFO */
-
-DISABLED_AUDIO_OUTPUT_PLUGIN(fifoPlugin)
-
-#endif /* !HAVE_FIFO */
diff --git a/src/output/jack_plugin.c b/src/output/jack_plugin.c
index 6f2bcd3a1..7f10db976 100644
--- a/src/output/jack_plugin.c
+++ b/src/output/jack_plugin.c
@@ -16,9 +16,6 @@
*/
#include "../output_api.h"
-
-#ifdef HAVE_JACK
-
#include "../utils.h"
#include "../log.h"
@@ -478,9 +475,3 @@ const struct audio_output_plugin jackPlugin = {
.cancel = mpd_jack_cancel,
.close = mpd_jack_close,
};
-
-#else /* HAVE JACK */
-
-DISABLED_AUDIO_OUTPUT_PLUGIN(jackPlugin)
-
-#endif /* HAVE_JACK */
diff --git a/src/output/mvp_plugin.c b/src/output/mvp_plugin.c
index 70dd25f9d..94f4f0ea7 100644
--- a/src/output/mvp_plugin.c
+++ b/src/output/mvp_plugin.c
@@ -20,9 +20,6 @@
*/
#include "../output_api.h"
-
-#ifdef HAVE_MVP
-
#include "../utils.h"
#include "../log.h"
@@ -273,8 +270,3 @@ const struct audio_output_plugin mvpPlugin = {
.cancel = mvp_dropBufferedAudio,
.close = mvp_closeDevice,
};
-
-#else /* HAVE_MVP */
-
-DISABLED_AUDIO_OUTPUT_PLUGIN(mvpPlugin)
-#endif /* HAVE_MVP */
diff --git a/src/output/oss_plugin.c b/src/output/oss_plugin.c
index 67ea11fe4..53d047101 100644
--- a/src/output/oss_plugin.c
+++ b/src/output/oss_plugin.c
@@ -20,9 +20,6 @@
*/
#include "../output_api.h"
-
-#ifdef HAVE_OSS
-
#include "../utils.h"
#include "../log.h"
@@ -564,8 +561,3 @@ const struct audio_output_plugin ossPlugin = {
.cancel = oss_dropBufferedAudio,
.close = oss_closeDevice,
};
-
-#else /* HAVE OSS */
-
-DISABLED_AUDIO_OUTPUT_PLUGIN(ossPlugin)
-#endif /* HAVE_OSS */
diff --git a/src/output/osx_plugin.c b/src/output/osx_plugin.c
index 65060cc8c..a3f67fa68 100644
--- a/src/output/osx_plugin.c
+++ b/src/output/osx_plugin.c
@@ -17,14 +17,11 @@
*/
#include "../output_api.h"
-
-#ifdef HAVE_OSX
-
-#include <AudioUnit/AudioUnit.h>
-
#include "../utils.h"
#include "../log.h"
+#include <AudioUnit/AudioUnit.h>
+
typedef struct _OsxData {
AudioUnit au;
pthread_mutex_t mutex;
@@ -361,8 +358,3 @@ const struct audio_output_plugin osxPlugin = {
.cancel = osx_dropBufferedAudio,
.close = osx_closeDevice,
};
-
-#else
-
-DISABLED_AUDIO_OUTPUT_PLUGIN(osxPlugin)
-#endif
diff --git a/src/output/pulse_plugin.c b/src/output/pulse_plugin.c
index b1ce3d049..ff3c2f126 100644
--- a/src/output/pulse_plugin.c
+++ b/src/output/pulse_plugin.c
@@ -17,9 +17,6 @@
*/
#include "../output_api.h"
-
-#ifdef HAVE_PULSE
-
#include "../utils.h"
#include "../log.h"
@@ -211,8 +208,3 @@ const struct audio_output_plugin pulsePlugin = {
.cancel = pulse_dropBufferedAudio,
.close = pulse_closeDevice,
};
-
-#else /* HAVE_PULSE */
-
-DISABLED_AUDIO_OUTPUT_PLUGIN(pulsePlugin)
-#endif /* HAVE_PULSE */
diff --git a/src/output/shout_mp3.c b/src/output/shout_mp3.c
index e57b0c385..804d3af12 100644
--- a/src/output/shout_mp3.c
+++ b/src/output/shout_mp3.c
@@ -17,10 +17,8 @@
*/
#include "shout_plugin.h"
-
-#ifdef HAVE_SHOUT_MP3
-
#include "../utils.h"
+
#include <lame/lame.h>
struct lame_data {
@@ -184,5 +182,3 @@ const struct shout_encoder_plugin shout_mp3_encoder = {
shout_mp3_encoder_init_encoder,
shout_mp3_encoder_send_metadata,
};
-
-#endif
diff --git a/src/output/shout_ogg.c b/src/output/shout_ogg.c
index 248ffd1e8..441093e90 100644
--- a/src/output/shout_ogg.c
+++ b/src/output/shout_ogg.c
@@ -17,10 +17,8 @@
*/
#include "shout_plugin.h"
-
-#ifdef HAVE_SHOUT_OGG
-
#include "../utils.h"
+
#include <vorbis/vorbisenc.h>
struct ogg_vorbis_data {
@@ -302,5 +300,3 @@ const struct shout_encoder_plugin shout_ogg_encoder = {
shout_ogg_encoder_init_encoder,
shout_ogg_encoder_send_metadata,
};
-
-#endif
diff --git a/src/output/shout_plugin.h b/src/output/shout_plugin.h
index 2cfe68f29..ae7d23b03 100644
--- a/src/output/shout_plugin.h
+++ b/src/output/shout_plugin.h
@@ -20,9 +20,6 @@
#define AUDIO_OUTPUT_SHOUT_H
#include "../output_api.h"
-
-#ifdef HAVE_SHOUT
-
#include "../conf.h"
#include "../timer.h"
@@ -89,5 +86,3 @@ extern const struct shout_encoder_plugin shout_mp3_encoder;
extern const struct shout_encoder_plugin shout_ogg_encoder;
#endif
-
-#endif
diff --git a/src/output_list.c b/src/output_list.c
index 7f597b687..c45227c4b 100644
--- a/src/output_list.c
+++ b/src/output_list.c
@@ -32,16 +32,34 @@ extern const struct audio_output_plugin mvpPlugin;
extern const struct audio_output_plugin jackPlugin;
const struct audio_output_plugin *audio_output_plugins[] = {
+#ifdef HAVE_SHOUT
&shoutPlugin,
+#endif
&nullPlugin,
+#ifdef HAVE_FIFO
&fifoPlugin,
+#endif
+#ifdef HAVE_ALSA
&alsaPlugin,
+#endif
+#ifdef HAVE_AO
&aoPlugin,
+#endif
+#ifdef HAVE_OSS
&ossPlugin,
+#endif
+#ifdef HAVE_OSX
&osxPlugin,
+#endif
+#ifdef HAVE_PULSE
&pulsePlugin,
+#endif
+#ifdef HAVE_MVP
&mvpPlugin,
+#endif
+#ifdef HAVE_JACK
&jackPlugin,
+#endif
NULL
};
diff --git a/src/output_list.h b/src/output_list.h
index d0fcf1285..1be0b8169 100644
--- a/src/output_list.h
+++ b/src/output_list.h
@@ -25,8 +25,6 @@ const struct audio_output_plugin *
audio_output_plugin_get(const char *name);
#define audio_output_plugins_for_each(plugin, i) \
- for (i = 0; (plugin = audio_output_plugins[i]) != NULL; ++i) \
- if (plugin->name != NULL)
-
+ for (i = 0; (plugin = audio_output_plugins[i]) != NULL; ++i)
#endif