From be798998bf44f740943cf82f6edb6d3616a8606a Mon Sep 17 00:00:00 2001
From: Simon Kagstrom <simon.kagstrom@gmail.com>
Date: Sun, 27 Mar 2011 08:41:40 +0200
Subject: build: Add despotify to build system

---
 Makefile.am  | 27 +++++++++++++++++++++++++++
 configure.ac | 15 +++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 64c474358..7251f769f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -109,7 +109,9 @@ mpd_headers = \
 	src/input/curl_input_plugin.h \
 	src/input/rewind_input_plugin.h \
 	src/input/mms_input_plugin.h \
+	src/input/despotify_input_plugin.h \
 	src/input/cdio_paranoia_input_plugin.h \
+	src/despotify_utils.h \
 	src/text_file.h \
 	src/text_input_stream.h \
 	src/icy_server.h \
@@ -181,6 +183,7 @@ mpd_headers = \
 	src/playlist/asx_playlist_plugin.h \
 	src/playlist/rss_playlist_plugin.h \
 	src/playlist/lastfm_playlist_plugin.h \
+	src/playlist/despotify_playlist_plugin.h \
 	src/playlist/cue_playlist_plugin.h \
 	src/playlist/flac_playlist_plugin.h \
 	src/poison.h \
@@ -361,6 +364,11 @@ src_mpd_SOURCES = \
 	src/stored_playlist.c \
 	src/timer.c
 
+if ENABLE_DESPOTIFY
+src_mpd_SOURCES += \
+	src/despotify_utils.c
+endif
+
 if ENABLE_INOTIFY
 src_mpd_SOURCES += \
 	src/inotify_source.c \
@@ -660,6 +668,10 @@ if ENABLE_MMS
 INPUT_SRC += src/input/mms_input_plugin.c
 endif
 
+if ENABLE_DESPOTIFY
+INPUT_SRC += src/input/despotify_input_plugin.c
+endif
+
 
 OUTPUT_CFLAGS = \
 	$(AO_CFLAGS) \
@@ -802,6 +814,10 @@ if ENABLE_LASTFM
 PLAYLIST_SRC += src/playlist/lastfm_playlist_plugin.c
 endif
 
+if ENABLE_DESPOTIFY
+PLAYLIST_SRC += src/playlist/despotify_playlist_plugin.c
+endif
+
 if HAVE_CUE
 PLAYLIST_SRC += src/playlist/cue_playlist_plugin.c
 endif
@@ -995,6 +1011,17 @@ if HAVE_LIBSAMPLERATE
 test_run_filter_SOURCES += src/pcm_resample_libsamplerate.c
 endif
 
+if ENABLE_DESPOTIFY
+test_read_tags_SOURCES += \
+	src/despotify_utils.c
+test_run_input_SOURCES += \
+	src/despotify_utils.c
+test_dump_playlist_SOURCES += \
+	src/despotify_utils.c
+test_run_decoder_SOURCES += \
+	src/despotify_utils.c
+endif
+
 if ENABLE_ENCODER
 noinst_PROGRAMS += test/run_encoder
 test_run_encoder_SOURCES = test/run_encoder.c \
diff --git a/configure.ac b/configure.ac
index 2142bcfc1..5af8324ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -242,6 +242,11 @@ AC_ARG_ENABLE(lastfm,
 		[enable support for last.fm radio (default: disable)]),,
 	[enable_lastfm=no])
 
+AC_ARG_ENABLE(despotify,
+	AS_HELP_STRING([--enable-despotify],
+		[enable support for despotify (default: disable)]),,
+	[enable_despotify=no])
+
 AC_ARG_ENABLE(lame-encoder,
 	AS_HELP_STRING([--enable-lame-encoder],
 		[enable the LAME mp3 encoder]),,
@@ -649,6 +654,15 @@ if test x$enable_lastfm = xyes; then
 fi
 AM_CONDITIONAL(ENABLE_LASTFM, test x$enable_lastfm = xyes)
 
+dnl --------------------------------- Despotify ---------------------------------
+MPD_AUTO_PKG(despotify, DESPOTIFY, [despotify],
+	[libcurl HTTP streaming], [libcurl not found])
+if test x$enable_despotify = xyes; then
+	AC_DEFINE(ENABLE_DESPOTIFY, 1, [Define when despotify is enabled])
+	MPD_LIBS="$MPD_LIBS $DESPOTIFY_LIBS"
+fi
+AM_CONDITIONAL(ENABLE_DESPOTIFY, test x$enable_despotify = xyes)
+
 dnl ---------------------------------- libcue ---------------------------------
 MPD_AUTO_PKG(cdio_paranoia, CDIO_PARANOIA, [libcdio_paranoia],
 	[libcdio_paranoia audio CD library], [libcdio_paranoia not found])
@@ -1625,6 +1639,7 @@ results(curl,[CURL])
 results(lastfm,[Last.FM])
 results(mms,[MMS])
 results(cdio_paranoia, [CDIO_PARANOIA])
+results(despotify,[Despotify])
 
 printf '\n\n##########################################\n\n'
 
-- 
cgit v1.2.3