aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am90
-rw-r--r--NEWS7
-rw-r--r--configure.ac519
-rw-r--r--doc/protocol.xml9
-rw-r--r--m4/mpd_auto.m4136
-rw-r--r--src/Main.cxx23
-rw-r--r--src/archive/ArchiveList.cxx2
-rw-r--r--src/command/AllCommands.cxx10
-rw-r--r--src/command/DatabaseCommands.cxx14
-rw-r--r--src/command/PlaylistCommands.cxx8
-rw-r--r--src/command/PlaylistCommands.hxx5
-rw-r--r--src/db/DatabasePrint.cxx28
-rw-r--r--src/db/DatabasePrint.hxx6
-rw-r--r--src/db/Registry.cxx4
-rw-r--r--src/db/plugins/simple/SimpleDatabasePlugin.cxx18
-rw-r--r--src/db/plugins/simple/SimpleDatabasePlugin.hxx2
-rw-r--r--src/db/plugins/upnp/Directory.cxx60
-rw-r--r--src/db/plugins/upnp/Object.hxx27
-rw-r--r--src/db/plugins/upnp/UpnpDatabasePlugin.cxx14
-rw-r--r--src/decoder/DecoderList.cxx20
-rw-r--r--src/decoder/plugins/DsdLib.cxx4
-rw-r--r--src/decoder/plugins/DsdiffDecoderPlugin.cxx6
-rw-r--r--src/decoder/plugins/DsfDecoderPlugin.cxx8
-rw-r--r--src/decoder/plugins/MadDecoderPlugin.cxx14
-rw-r--r--src/decoder/plugins/WavpackDecoderPlugin.cxx6
-rw-r--r--src/encoder/EncoderList.cxx8
-rw-r--r--src/fs/io/TextFile.cxx6
-rw-r--r--src/fs/io/TextFile.hxx2
-rw-r--r--src/input/Registry.cxx8
-rw-r--r--src/ls.cxx4
-rw-r--r--src/neighbor/Registry.cxx2
-rw-r--r--src/output/Registry.cxx10
-rw-r--r--src/output/plugins/PulseOutputPlugin.cxx6
-rw-r--r--src/pcm/ConfiguredResampler.cxx16
-rw-r--r--src/playlist/PlaylistRegistry.cxx2
-rw-r--r--src/playlist/plugins/SoundCloudPlaylistPlugin.cxx63
-rw-r--r--src/sticker/SongSticker.cxx8
-rw-r--r--src/system/fd_util.h2
-rw-r--r--src/tag/TagId3.hxx2
-rw-r--r--src/util/Alloc.cxx63
-rw-r--r--src/util/Alloc.hxx19
-rw-r--r--test/DumpDatabase.cxx2
42 files changed, 570 insertions, 693 deletions
diff --git a/Makefile.am b/Makefile.am
index 72b6a0ca4..52c314928 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -186,9 +186,14 @@ if ANDROID
else
libmpd_a_SOURCES += \
src/unix/SignalHandlers.cxx src/unix/SignalHandlers.hxx \
- src/unix/Daemon.cxx src/unix/Daemon.hxx \
- src/unix/PidFile.hxx \
src/CommandLine.cxx src/CommandLine.hxx
+
+if ENABLE_DAEMON
+libmpd_a_SOURCES += \
+ src/unix/Daemon.cxx src/unix/Daemon.hxx \
+ src/unix/PidFile.hxx
+endif
+
endif
if ENABLE_DATABASE
@@ -487,12 +492,12 @@ libpcm_a_SOURCES = \
src/pcm/PcmUtils.hxx
libpcm_a_CPPFLAGS = $(AM_CPPFLAGS) \
$(SOXR_CFLAGS) \
- $(SAMPLERATE_CFLAGS)
+ $(LIBSAMPLERATE_CFLAGS)
PCM_LIBS = \
libpcm.a \
$(SOXR_LIBS) \
- $(SAMPLERATE_LIBS)
+ $(LIBSAMPLERATE_LIBS)
if ENABLE_DSD
libpcm_a_SOURCES += \
@@ -500,12 +505,12 @@ libpcm_a_SOURCES += \
src/pcm/dsd2pcm/dsd2pcm.c src/pcm/dsd2pcm/dsd2pcm.h
endif
-if HAVE_LIBSAMPLERATE
+if ENABLE_LIBSAMPLERATE
libpcm_a_SOURCES += \
src/pcm/LibsamplerateResampler.cxx src/pcm/LibsamplerateResampler.hxx
endif
-if HAVE_SOXR
+if ENABLE_SOXR
libpcm_a_SOURCES += \
src/pcm/SoxrResampler.cxx src/pcm/SoxrResampler.hxx
endif
@@ -537,7 +542,7 @@ libfs_a_SOURCES = \
src/fs/DirectoryReader.hxx
libfs_a_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS)
-if HAVE_ZLIB
+if ENABLE_ZLIB
libfs_a_SOURCES += \
src/lib/zlib/Domain.cxx src/lib/zlib/Domain.hxx \
src/fs/io/GunzipReader.cxx src/fs/io/GunzipReader.hxx \
@@ -633,7 +638,7 @@ NEIGHBOR_LIBS = \
$(SMBCLIENT_LIBS) \
libneighbor.a
-if HAVE_LIBUPNP
+if ENABLE_UPNP
libneighbor_a_SOURCES += \
$(UPNP_SOURCES) \
src/neighbor/plugins/UpnpNeighborPlugin.cxx src/neighbor/plugins/UpnpNeighborPlugin.hxx
@@ -672,7 +677,7 @@ libdb_plugins_a_SOURCES = \
src/db/plugins/simple/SimpleDatabasePlugin.cxx \
src/db/plugins/simple/SimpleDatabasePlugin.hxx
-if HAVE_LIBMPDCLIENT
+if ENABLE_LIBMPDCLIENT
libdb_plugins_a_SOURCES += \
src/db/plugins/ProxyDatabasePlugin.cxx src/db/plugins/ProxyDatabasePlugin.hxx
endif
@@ -681,7 +686,7 @@ DB_LIBS = \
libdb_plugins.a \
$(LIBMPDCLIENT_LIBS)
-if HAVE_LIBUPNP
+if ENABLE_UPNP
libdb_plugins_a_SOURCES += \
$(UPNP_SOURCES) \
src/db/plugins/upnp/UpnpDatabasePlugin.cxx src/db/plugins/upnp/UpnpDatabasePlugin.hxx \
@@ -730,7 +735,7 @@ libarchive_a_SOURCES += \
src/archive/plugins/Bzip2ArchivePlugin.hxx
endif
-if HAVE_ZZIP
+if ENABLE_ZZIP
libarchive_a_SOURCES += \
src/archive/plugins/ZzipArchivePlugin.cxx \
src/archive/plugins/ZzipArchivePlugin.hxx
@@ -787,7 +792,7 @@ libtag_a_SOURCES =\
src/tag/ApeReplayGain.cxx src/tag/ApeReplayGain.hxx \
src/tag/ApeTag.cxx src/tag/ApeTag.hxx
-if HAVE_ID3TAG
+if ENABLE_ID3TAG
libtag_a_SOURCES += \
src/tag/TagId3.cxx src/tag/TagId3.hxx \
src/tag/TagRva2.cxx src/tag/TagRva2.hxx \
@@ -797,7 +802,7 @@ endif
# ffmpeg
-if HAVE_FFMPEG
+if ENABLE_FFMPEG
noinst_LIBRARIES += libffmpeg.a
libffmpeg_a_SOURCES = \
src/lib/ffmpeg/Error.cxx src/lib/ffmpeg/Error.hxx \
@@ -865,13 +870,13 @@ libdecoder_a_SOURCES += \
src/decoder/plugins/DsdLib.hxx
endif
-if HAVE_MAD
+if ENABLE_MAD
libdecoder_a_SOURCES += \
src/decoder/plugins/MadDecoderPlugin.cxx \
src/decoder/plugins/MadDecoderPlugin.hxx
endif
-if HAVE_MPG123
+if ENABLE_MPG123
libdecoder_a_SOURCES += \
src/decoder/plugins/Mpg123DecoderPlugin.cxx \
src/decoder/plugins/Mpg123DecoderPlugin.hxx
@@ -883,7 +888,7 @@ libdecoder_a_SOURCES += \
src/decoder/plugins/MpcdecDecoderPlugin.hxx
endif
-if HAVE_OPUS
+if ENABLE_OPUS
libdecoder_a_SOURCES += \
src/decoder/plugins/OggUtil.cxx \
src/decoder/plugins/OggUtil.hxx \
@@ -899,13 +904,13 @@ libdecoder_a_SOURCES += \
src/decoder/plugins/OpusDecoderPlugin.h
endif
-if HAVE_WAVPACK
+if ENABLE_WAVPACK
libdecoder_a_SOURCES += \
src/decoder/plugins/WavpackDecoderPlugin.cxx \
src/decoder/plugins/WavpackDecoderPlugin.hxx
endif
-if HAVE_ADPLUG
+if ENABLE_ADPLUG
libdecoder_a_SOURCES += \
src/decoder/plugins/AdPlugDecoderPlugin.cxx \
src/decoder/plugins/AdPlugDecoderPlugin.h
@@ -929,7 +934,7 @@ libdecoder_a_SOURCES += \
src/decoder/plugins/VorbisDecoderPlugin.cxx src/decoder/plugins/VorbisDecoderPlugin.h
endif
-if HAVE_FLAC
+if ENABLE_FLAC
libdecoder_a_SOURCES += \
src/decoder/plugins/FlacInput.cxx src/decoder/plugins/FlacInput.hxx \
src/decoder/plugins/FlacIOHandle.cxx src/decoder/plugins/FlacIOHandle.hxx \
@@ -941,7 +946,7 @@ libdecoder_a_SOURCES += \
src/decoder/plugins/FlacDecoderPlugin.h
endif
-if HAVE_AUDIOFILE
+if ENABLE_AUDIOFILE
libdecoder_a_SOURCES += \
src/decoder/plugins/AudiofileDecoderPlugin.cxx \
src/decoder/plugins/AudiofileDecoderPlugin.hxx
@@ -953,7 +958,7 @@ libdecoder_a_SOURCES += \
src/decoder/plugins/MikmodDecoderPlugin.hxx
endif
-if HAVE_MODPLUG
+if ENABLE_MODPLUG
libmodplug_decoder_plugin_a_SOURCES = \
src/decoder/plugins/ModplugDecoderPlugin.cxx \
src/decoder/plugins/ModplugDecoderPlugin.hxx
@@ -987,7 +992,7 @@ libdecoder_a_SOURCES += \
src/decoder/plugins/WildmidiDecoderPlugin.hxx
endif
-if HAVE_FFMPEG
+if ENABLE_FFMPEG
libdecoder_a_SOURCES += \
src/decoder/plugins/FfmpegMetaData.cxx \
src/decoder/plugins/FfmpegMetaData.hxx \
@@ -1050,13 +1055,13 @@ libencoder_plugins_a_SOURCES += \
src/encoder/plugins/WaveEncoderPlugin.hxx
endif
-if ENABLE_VORBIS_ENCODER
+if ENABLE_VORBISENC
libencoder_plugins_a_SOURCES += \
src/encoder/plugins/VorbisEncoderPlugin.cxx \
src/encoder/plugins/VorbisEncoderPlugin.hxx
endif
-if HAVE_OPUS
+if ENABLE_OPUS
libencoder_plugins_a_SOURCES += \
src/encoder/plugins/OpusEncoderPlugin.cxx \
src/encoder/plugins/OpusEncoderPlugin.hxx
@@ -1068,7 +1073,7 @@ libencoder_plugins_a_SOURCES += \
src/encoder/plugins/LameEncoderPlugin.hxx
endif
-if ENABLE_TWOLAME_ENCODER
+if ENABLE_TWOLAME
libencoder_plugins_a_SOURCES += \
src/encoder/plugins/TwolameEncoderPlugin.cxx \
src/encoder/plugins/TwolameEncoderPlugin.hxx
@@ -1080,7 +1085,7 @@ libencoder_plugins_a_SOURCES += \
src/encoder/plugins/FlacEncoderPlugin.hxx
endif
-if ENABLE_SHINE_ENCODER
+if ENABLE_SHINE
libencoder_plugins_a_SOURCES += \
src/encoder/plugins/ShineEncoderPlugin.cxx \
src/encoder/plugins/ShineEncoderPlugin.hxx
@@ -1146,7 +1151,7 @@ INPUT_LIBS = \
$(DESPOTIFY_LIBS) \
$(MMS_LIBS)
-if HAVE_ALSA
+if ENABLE_ALSA
libinput_a_SOURCES += \
src/input/plugins/AlsaInputPlugin.cxx \
src/input/plugins/AlsaInputPlugin.hxx
@@ -1179,7 +1184,7 @@ libinput_a_SOURCES += \
src/input/plugins/CdioParanoiaInputPlugin.hxx
endif
-if HAVE_FFMPEG
+if ENABLE_FFMPEG
libinput_a_SOURCES += \
src/input/plugins/FfmpegInputPlugin.cxx src/input/plugins/FfmpegInputPlugin.hxx
endif
@@ -1258,7 +1263,7 @@ libmixer_plugins_a_CPPFLAGS = $(AM_CPPFLAGS) \
$(ALSA_CFLAGS) \
$(PULSE_CFLAGS)
-if HAVE_ALSA
+if ENABLE_ALSA
liboutput_plugins_a_SOURCES += \
src/output/plugins/AlsaOutputPlugin.cxx \
src/output/plugins/AlsaOutputPlugin.hxx
@@ -1276,14 +1281,14 @@ liboutput_plugins_a_SOURCES += \
OUTPUT_LIBS += -lOpenSLES
endif
-if HAVE_ROAR
+if ENABLE_ROAR
liboutput_plugins_a_SOURCES += \
src/output/plugins/RoarOutputPlugin.cxx \
src/output/plugins/RoarOutputPlugin.hxx
libmixer_plugins_a_SOURCES += src/mixer/plugins/RoarMixerPlugin.cxx
endif
-if HAVE_AO
+if ENABLE_AO
liboutput_plugins_a_SOURCES += \
src/output/plugins/AoOutputPlugin.cxx \
src/output/plugins/AoOutputPlugin.hxx
@@ -1301,7 +1306,7 @@ liboutput_plugins_a_SOURCES += \
src/output/plugins/PipeOutputPlugin.hxx
endif
-if HAVE_JACK
+if ENABLE_JACK
liboutput_plugins_a_SOURCES += \
src/output/plugins/JackOutputPlugin.cxx \
src/output/plugins/JackOutputPlugin.hxx
@@ -1326,7 +1331,7 @@ liboutput_plugins_a_SOURCES += \
src/output/plugins/OSXOutputPlugin.hxx
endif
-if HAVE_PULSE
+if ENABLE_PULSE
liboutput_plugins_a_SOURCES += \
src/output/plugins/PulseOutputPlugin.cxx \
src/output/plugins/PulseOutputPlugin.hxx
@@ -1417,7 +1422,7 @@ libplaylist_plugins_a_SOURCES += \
PLAYLIST_LIBS += $(YAJL_LIBS)
endif
-if HAVE_EXPAT
+if ENABLE_EXPAT
libplaylist_plugins_a_SOURCES += \
src/lib/expat/ExpatParser.cxx src/lib/expat/ExpatParser.hxx \
src/playlist/plugins/XspfPlaylistPlugin.cxx \
@@ -1533,11 +1538,11 @@ if ENABLE_ARCHIVE
noinst_PROGRAMS += test/visit_archive
endif
-if HAVE_ID3TAG
+if ENABLE_ID3TAG
noinst_PROGRAMS += test/dump_rva2
endif
-if HAVE_ALSA
+if ENABLE_ALSA
# this debug program is still ALSA specific
noinst_PROGRAMS += test/read_mixer
endif
@@ -1585,7 +1590,7 @@ test_DumpDatabase_SOURCES = test/DumpDatabase.cxx \
src/TagSave.cxx \
src/SongFilter.cxx
-if HAVE_LIBUPNP
+if ENABLE_UPNP
test_DumpDatabase_SOURCES += src/lib/expat/ExpatParser.cxx
endif
@@ -1642,7 +1647,7 @@ test_run_neighbor_explorer_LDADD = $(AM_LDADD) \
libthread.a \
libutil.a
-if HAVE_LIBUPNP
+if ENABLE_UPNP
test_run_neighbor_explorer_SOURCES += src/lib/expat/ExpatParser.cxx
endif
@@ -1675,7 +1680,7 @@ test_visit_archive_SOURCES = test/visit_archive.cxx \
endif
-if HAVE_ZLIB
+if ENABLE_ZLIB
noinst_PROGRAMS += test/run_gzip test/run_gunzip
@@ -1737,7 +1742,7 @@ test_dump_playlist_SOURCES = test/dump_playlist.cxx \
src/AudioFormat.cxx src/CheckAudioFormat.cxx \
src/DetachedSong.cxx
-if HAVE_FLAC
+if ENABLE_FLAC
test_dump_playlist_SOURCES += \
src/ReplayGainInfo.cxx \
src/decoder/plugins/FlacMetadata.cxx
@@ -1791,7 +1796,7 @@ test_read_tags_SOURCES = test/read_tags.cxx \
src/AudioFormat.cxx src/CheckAudioFormat.cxx \
$(DECODER_SRC)
-if HAVE_ID3TAG
+if ENABLE_ID3TAG
test_dump_rva2_LDADD = \
$(TAG_LIBS) \
libutil.a \
@@ -1838,7 +1843,7 @@ test_run_encoder_LDADD = \
$(GLIB_LIBS)
endif
-if ENABLE_VORBIS_ENCODER
+if ENABLE_VORBISENC
noinst_PROGRAMS += test/test_vorbis_encoder
test_test_vorbis_encoder_SOURCES = test/test_vorbis_encoder.cxx \
test/stdbin.h \
@@ -1894,6 +1899,7 @@ test_run_normalize_LDADD = \
$(GLIB_LIBS)
test_run_convert_SOURCES = test/run_convert.cxx \
+ src/config/ConfigError.cxx \
src/Log.cxx src/LogBackend.cxx \
src/AudioFormat.cxx \
src/CheckAudioFormat.cxx \
diff --git a/NEWS b/NEWS
index fb5fd19b5..96cd0cd46 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+ver 0.20 (not yet released)
+* protocol
+ - "commands" returns playlist commands only if playlist_directory configured
+ - "search"/"find" have a "window" parameter
+* output
+ - pulse: set channel map to WAVE-EX
+
ver 0.19.5 (not yet released)
* decoder
- dsdiff, dsf, opus: fix deadlock while seeking
diff --git a/configure.ac b/configure.ac
index 5a44fa5c8..16ce66cf4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
AC_PREREQ(2.60)
-AC_INIT(mpd, 0.19.5, musicpd-dev-team@lists.sourceforge.net)
+AC_INIT(mpd, 0.20, musicpd-dev-team@lists.sourceforge.net)
VERSION_MAJOR=0
-VERSION_MINOR=19
-VERSION_REVISION=5
+VERSION_MINOR=20
+VERSION_REVISION=0
VERSION_EXTRA=0
AC_CONFIG_SRCDIR([src/Main.cxx])
@@ -195,8 +195,17 @@ dnl ---------------------------------------------------------------------------
AC_SEARCH_LIBS([clock_gettime], [rt])
-AC_SEARCH_LIBS([syslog], [bsd socket inet],
- [AC_DEFINE(HAVE_SYSLOG, 1, [Define if syslog() is available])])
+AC_ARG_ENABLE(syslog,
+ AS_HELP_STRING([--enable-syslog],
+ [enable syslog support (default: auto)]),,
+ enable_syslog=auto)
+MPD_AUTO(syslog, [syslog support], [syslog() not available],
+ [AC_SEARCH_LIBS([syslog], [bsd socket inet],
+ [found_syslog=yes],
+ [found_syslog=no])])
+if test x$enable_syslog = xyes; then
+ AC_DEFINE(HAVE_SYSLOG, 1, [Define if syslog() is available])
+fi
AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([gethostbyname], [nsl])
@@ -290,82 +299,23 @@ else
database_auto=no
fi
-AC_ARG_ENABLE(libmpdclient,
- AS_HELP_STRING([--enable-libmpdclient],
- [enable support for the MPD client]),,
- enable_libmpdclient=auto)
-MPD_DEPENDS([enable_libmpdclient], [enable_database],
- [Cannot use --enable-libmpdclient with --disable-database])
-
-AC_ARG_ENABLE(expat,
- AS_HELP_STRING([--enable-expat],
- [enable the expat XML parser]),,
- enable_expat=auto)
-
-AC_ARG_ENABLE(upnp,
- AS_HELP_STRING([--enable-upnp],
- [enable UPnP client support (default: auto)]),,
- enable_upnp=auto)
-MPD_DEPENDS([enable_upnp], [enable_database],
- [Cannot use --enable-upnp with --disable-database])
-
-AC_ARG_ENABLE(adplug,
- AS_HELP_STRING([--enable-adplug],
- [enable the AdPlug decoder plugin (default: auto)]),,
- enable_adplug=auto)
-
-AC_ARG_ENABLE(alsa,
- AS_HELP_STRING([--enable-alsa], [enable ALSA support]),,
- [enable_alsa=$linux_auto])
-
-AC_ARG_ENABLE(roar,
- AS_HELP_STRING([--enable-roar],
- [enable support for RoarAudio]),,
- [enable_roar=auto])
-
-AC_ARG_ENABLE(ao,
- AS_HELP_STRING([--enable-ao],
- [enable support for libao]),,
- enable_ao=auto)
-MPD_DEPENDS([enable_ao], [enable_glib],
- [Cannot use --enable-ao with --disable-glib])
-
-AC_ARG_ENABLE(audiofile,
- AS_HELP_STRING([--enable-audiofile],
- [enable audiofile support (WAV and others)]),,
- enable_audiofile=auto)
-
-AC_ARG_ENABLE(zlib,
- AS_HELP_STRING([--enable-zlib],
- [enable zlib support (default: auto)]),,
- enable_zlib=auto)
-
AC_ARG_ENABLE(bzip2,
AS_HELP_STRING([--enable-bzip2],
[enable bzip2 archive support (default: auto)]),,
enable_bzip2=auto)
-AC_ARG_ENABLE(cdio-paranoia,
- AS_HELP_STRING([--enable-cdio-paranoia],
- [enable support for audio CD support]),,
- enable_cdio_paranoia=auto)
-MPD_DEPENDS([enable_cdio_paranoia], [enable_glib],
- [Cannot use --enable-cdio-paranoia with --disable-glib])
-
-AC_ARG_ENABLE(curl,
- AS_HELP_STRING([--enable-curl],
- [enable support for libcurl HTTP streaming (default: auto)]),,
- [enable_curl=auto])
-
-AC_ARG_ENABLE(smbclient,
- AS_HELP_STRING([--enable-smbclient],
- [enable support for libsmbclient (default: auto)]),,
- [enable_smbclient=auto])
-
-AC_ARG_ENABLE(nfs,
- AS_HELP_STRING([--enable-nfs],
- [enable support for libnfs (default: auto)]),,
- [enable_nfs=auto])
+default_enable_daemon=yes
+if test x$host_is_android = xyes || test x$host_is_android = xyes; then
+ default_enable_daemon=no
+fi
+AC_ARG_ENABLE(daemon,
+ AS_HELP_STRING([--enable-daemon],
+ [enable daemonization (default: enabled)]),,
+ enable_daemon=$default_enable_daemon)
+AM_CONDITIONAL([ENABLE_DAEMON], [test x$enable_daemon = xyes])
+if test x$enable_daemon = xyes; then
+ AC_DEFINE([ENABLE_DAEMON], 1, [Enable daemonization?])
+fi
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
@@ -382,26 +332,11 @@ AC_ARG_ENABLE(dsd,
[enable DSD decoder (default: enable)]),,
[enable_dsd=yes])
-AC_ARG_ENABLE(ffmpeg,
- AS_HELP_STRING([--enable-ffmpeg],
- [enable FFMPEG support]),,
- enable_ffmpeg=auto)
-
AC_ARG_ENABLE(fifo,
AS_HELP_STRING([--disable-fifo],
[disable support for writing audio to a FIFO (default: enable)]),,
enable_fifo=yes)
-AC_ARG_ENABLE(flac,
- AS_HELP_STRING([--enable-flac],
- [enable FLAC decoder]),,
- enable_flac=auto)
-
-AC_ARG_ENABLE(fluidsynth,
- AS_HELP_STRING([--enable-fluidsynth],
- [enable MIDI support via fluidsynth (default: auto)]),,
- enable_fluidsynth=auto)
-
AC_ARG_ENABLE(gme,
AS_HELP_STRING([--enable-gme],
[enable Blargg's game music emulator plugin]),,
@@ -416,11 +351,6 @@ AC_ARG_ENABLE(httpd-output,
MPD_DEPENDS([enable_httpd_output], [enable_glib],
[Cannot use --enable-httpd-output with --disable-glib])
-AC_ARG_ENABLE(id3,
- AS_HELP_STRING([--enable-id3],
- [enable id3 support]),,
- enable_id3=auto)
-
AC_ARG_ENABLE(inotify,
AS_HELP_STRING([--disable-inotify],
[disable support Inotify automatic database update (default: enabled) ]),,
@@ -431,31 +361,12 @@ AC_ARG_ENABLE(ipv6,
[disable IPv6 support (default: enable)]),,
[enable_ipv6=yes])
-AC_ARG_ENABLE(iso9660,
- AS_HELP_STRING([--enable-iso9660],
- [enable iso9660 archive support (default: disabled)]),,
- enable_iso9660=no)
-
-AC_ARG_ENABLE(jack,
- AS_HELP_STRING([--enable-jack],
- [enable jack support]),,
- enable_jack=auto)
-MPD_DEPENDS([enable_jack], [enable_glib],
- [Cannot use --enable-jack with --disable-glib])
-
AC_SYS_LARGEFILE
-AC_ARG_ENABLE(despotify,
- AS_HELP_STRING([--enable-despotify],
- [enable support for despotify (default: disable)]),,
- [enable_despotify=no])
-
AC_ARG_ENABLE(soundcloud,
AS_HELP_STRING([--enable-soundcloud],
[enable support for soundcloud.com]),,
[enable_soundcloud=auto])
-MPD_DEPENDS([enable_soundcloud], [enable_glib],
- [Cannot use --enable-soundcloud with --disable-glib])
AC_ARG_ENABLE(lame-encoder,
AS_HELP_STRING([--enable-lame-encoder],
@@ -466,36 +377,11 @@ AC_ARG_ENABLE([libwrap],
AS_HELP_STRING([--enable-libwrap], [use libwrap]),,
[enable_libwrap=auto])
-AC_ARG_ENABLE(lsr,
- AS_HELP_STRING([--enable-lsr],
- [enable libsamplerate support]),,
- enable_lsr=auto)
-
-AC_ARG_ENABLE(soxr,
- AS_HELP_STRING([--enable-soxr],
- [enable the libsoxr resampler]),,
- enable_soxr=auto)
-
-AC_ARG_ENABLE(mad,
- AS_HELP_STRING([--enable-mad],
- [enable libmad mp3 decoder plugin]),,
- enable_mad=auto)
-
AC_ARG_ENABLE(mikmod,
AS_HELP_STRING([--enable-mikmod],
[enable the mikmod decoder (default: disable)]),,
enable_mikmod=no)
-AC_ARG_ENABLE(mms,
- AS_HELP_STRING([--enable-mms],
- [enable the MMS protocol with libmms]),,
- [enable_mms=auto])
-
-AC_ARG_ENABLE(modplug,
- AS_HELP_STRING([--enable-modplug],
- [enable modplug decoder plugin]),,
- enable_modplug=auto)
-
AC_ARG_ENABLE(mp4v2,
AS_HELP_STRING([--enable-mp4v2],
[enable libmp4v2 decoder plugin]),,
@@ -506,21 +392,11 @@ AC_ARG_ENABLE(mpc,
[disable musepack (MPC) support (default: auto)]),,
enable_mpc=auto)
-AC_ARG_ENABLE(mpg123,
- AS_HELP_STRING([--enable-mpg123],
- [enable libmpg123 decoder plugin]),,
- enable_mpg123=auto)
-
AC_ARG_ENABLE(openal,
AS_HELP_STRING([--enable-openal],
[enable OpenAL support (default: auto)]),,
enable_openal=auto)
-AC_ARG_ENABLE(opus,
- AS_HELP_STRING([--enable-opus],
- [enable Opus codec support (default: auto)]),,
- enable_opus=auto)
-
AC_ARG_ENABLE(oss,
AS_HELP_STRING([--disable-oss],
[disable OSS support (default: enable)]),,
@@ -536,11 +412,6 @@ AC_ARG_ENABLE(pipe-output,
[enable support for writing audio to a pipe (default: disable)]),,
enable_pipe_output=no)
-AC_ARG_ENABLE(pulse,
- AS_HELP_STRING([--enable-pulse],
- [enable support for the PulseAudio sound server]),,
- enable_pulse=auto)
-
AC_ARG_ENABLE(recorder-output,
AS_HELP_STRING([--enable-recorder-output],
[enables the recorder file output plugin (default: disable)]),,
@@ -553,38 +424,16 @@ AC_ARG_ENABLE(sidplay,
MPD_DEPENDS([enable_sidplay], [enable_glib],
[Cannot use --enable-sidplay with --disable-glib])
-AC_ARG_ENABLE(shine-encoder,
- AS_HELP_STRING([--enable-shine-encoder],
- [enables shine encoder]),,
- [enable_shine_encoder=auto])
-
AC_ARG_ENABLE(shout,
AS_HELP_STRING([--enable-shout],
[enables the shoutcast streaming output]),,
[enable_shout=auto])
-AC_ARG_ENABLE(sndfile,
- AS_HELP_STRING([--enable-sndfile],
- [enable sndfile support]),,
- enable_sndfile=auto)
-
AC_ARG_ENABLE(solaris_output,
AS_HELP_STRING([--enable-solaris-output],
[enables the Solaris /dev/audio output]),,
[enable_solaris_output=$host_is_solaris])
-AC_ARG_ENABLE(sqlite,
- AS_HELP_STRING([--enable-sqlite],
- [enable support for the SQLite database]),,
- [enable_sqlite=$database_auto])
-MPD_DEPENDS([enable_sqlite], [enable_glib],
- [Cannot use --enable-sqlite with --disable-glib])
-
-AC_ARG_ENABLE(systemd-daemon,
- AS_HELP_STRING([--enable-systemd-daemon],
- [use the systemd daemon library (default=auto)]),,
- [enable_systemd_daemon=$linux_auto])
-
AC_ARG_ENABLE(tcp,
AS_HELP_STRING([--disable-tcp],
[disable support for clients connecting via TCP (default: enable)]),,
@@ -600,11 +449,6 @@ AC_ARG_WITH(tremor,
[use Tremor (vorbisidec) integer Ogg Vorbis decoder (with optional prefix)]),,
with_tremor=no)
-AC_ARG_ENABLE(twolame-encoder,
- AS_HELP_STRING([--enable-twolame-encoder],
- [enable the TwoLAME mp2 encoder]),,
- enable_twolame_encoder=auto)
-
AC_ARG_ENABLE(un,
AS_HELP_STRING([--disable-un],
[disable support for clients connecting via unix domain sockets (default: enable)]),,
@@ -615,25 +459,11 @@ AC_ARG_ENABLE(vorbis,
[enable Ogg Vorbis decoder]),,
enable_vorbis=auto)
-AC_ARG_ENABLE(vorbis-encoder,
- AS_HELP_STRING([--enable-vorbis-encoder],
- [enable the Ogg Vorbis encoder]),,
- [enable_vorbis_encoder=auto])
-MPD_DEPENDS([enable_vorbis_encoder], [enable_glib],
- [Cannot use --enable-vorbis-encoder with --disable-glib])
-
AC_ARG_ENABLE(wave-encoder,
AS_HELP_STRING([--enable-wave-encoder],
[enable the PCM wave encoder]),,
enable_wave_encoder=yes)
-AC_ARG_ENABLE(wavpack,
- AS_HELP_STRING([--enable-wavpack],
- [enable WavPack support]),,
- enable_wavpack=auto)
-MPD_DEPENDS([enable_wavpack], [enable_glib],
- [Cannot use --enable-wavpack with --disable-glib])
-
AC_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror],
[treat warnings as errors (default: disabled)]),,
@@ -649,12 +479,6 @@ AC_ARG_WITH(zeroconf,
[enable zeroconf backend (default=auto)]),,
with_zeroconf="auto")
-AC_ARG_ENABLE(zzip,
- AS_HELP_STRING([--enable-zzip],
- [enable zip archive support (default: disabled)]),,
- enable_zzip=no)
-
-
AC_ARG_WITH(tremor-libraries,
AS_HELP_STRING([--with-tremor-libraries=DIR],
[directory where Tremor library is installed (optional)]),,
@@ -770,12 +594,9 @@ if
AC_MSG_ERROR([No client interfaces configured!])
fi
-MPD_AUTO_PKG(systemd_daemon, SYSTEMD_DAEMON, libsystemd-daemon,
- [systemd activation], [libsystemd-daemon not found])
-AM_CONDITIONAL(ENABLE_SYSTEMD_DAEMON, test x$enable_systemd_daemon = xyes)
-if test x$enable_systemd_daemon = xyes; then
- AC_DEFINE([ENABLE_SYSTEMD_DAEMON], 1, [Define to use the systemd daemon library])
-fi
+MPD_ENABLE_AUTO_PKG(systemd_daemon, SYSTEMD_DAEMON, libsystemd-daemon,
+ [systemd socket activation], [libsystemd-daemon not found],
+ [$linux_auto])
dnl ---------------------------------------------------------------------------
dnl LIBC Features
@@ -789,22 +610,14 @@ dnl Miscellaneous Libraries
dnl ---------------------------------------------------------------------------
dnl -------------------------------- libmpdclient --------------------------------
-MPD_AUTO_PKG(libmpdclient, LIBMPDCLIENT, [libmpdclient >= 2.2],
- [MPD client library], [libmpdclient not found])
-if test x$enable_libmpdclient = xyes; then
- AC_DEFINE(HAVE_LIBMPDCLIENT, 1, [Define to use libmpdclient])
-fi
-
-AM_CONDITIONAL(HAVE_LIBMPDCLIENT, test x$enable_libmpdclient = xyes)
+MPD_ENABLE_AUTO_PKG_DEPENDS(libmpdclient, LIBMPDCLIENT,
+ [libmpdclient >= 2.2],
+ [MPD client library], [libmpdclient not found], [],
+ [enable_database], [Cannot use --enable-libmpdclient with --disable-database])
dnl -------------------------------- expat --------------------------------
-MPD_AUTO_PKG(expat, EXPAT, [expat],
+MPD_ENABLE_AUTO_PKG(expat, EXPAT, [expat],
[expat XML parser], [expat not found])
-if test x$enable_expat = xyes; then
- AC_DEFINE(HAVE_EXPAT, 1, [Define to use the expat XML parser])
-fi
-
-AM_CONDITIONAL(HAVE_EXPAT, test x$enable_expat = xyes)
dnl --------------------------------- inotify ---------------------------------
AC_CHECK_FUNCS(inotify_init inotify_init1)
@@ -856,13 +669,9 @@ dnl Metadata Plugins
dnl ---------------------------------------------------------------------------
dnl -------------------------------- libid3tag --------------------------------
-MPD_AUTO_PKG_LIB(id3, ID3TAG, id3tag, id3tag, id3_file_open, [-lid3tag -lz], [],
+MPD_ENABLE_AUTO_PKG_LIB(id3, ID3TAG,
+ id3tag, id3tag, id3_file_open, [-lid3tag -lz], [],
[id3tag], [libid3tag not found])
-if test x$enable_id3 = xyes; then
- AC_DEFINE(HAVE_ID3TAG, 1, [Define to use id3tag])
-fi
-
-AM_CONDITIONAL(HAVE_ID3TAG, test x$enable_id3 = xyes)
dnl ---------------------------------------------------------------------------
dnl Autodiscovery
@@ -925,82 +734,50 @@ dnl ---------------------------------------------------------------------------
dnl ---------------------------------- sqlite ---------------------------------
-MPD_AUTO_PKG(sqlite, SQLITE, [sqlite3],
- [SQLite database support], [sqlite not found])
-if test x$enable_sqlite = xyes; then
- AC_DEFINE([ENABLE_SQLITE], 1, [Define to enable sqlite database support])
-fi
-
-AM_CONDITIONAL(ENABLE_SQLITE, test x$enable_sqlite = xyes)
+MPD_ENABLE_AUTO_PKG(sqlite, SQLITE, [sqlite3],
+ [SQLite database support], [sqlite not found],
+ [$database_auto])
dnl ---------------------------------------------------------------------------
dnl Converter Plugins
dnl ---------------------------------------------------------------------------
dnl ------------------------------ libsamplerate ------------------------------
-MPD_AUTO_PKG(lsr, SAMPLERATE, [samplerate >= 0.1.3],
+MPD_ENABLE_AUTO_PKG(lsr, LIBSAMPLERATE, [samplerate >= 0.1.3],
[libsamplerate resampling], [libsamplerate not found])
-if test x$enable_lsr = xyes; then
- AC_DEFINE([HAVE_LIBSAMPLERATE], 1,
- [Define to enable libsamplerate])
-fi
-AM_CONDITIONAL(HAVE_LIBSAMPLERATE, test x$enable_lsr = xyes)
dnl ------------------------------ libsoxr ------------------------------------
-MPD_AUTO_PKG(soxr, SOXR, [soxr],
+MPD_ENABLE_AUTO_PKG(soxr, SOXR, [soxr],
[libsoxr resampler], [libsoxr not found])
-if test x$enable_soxr = xyes; then
- AC_DEFINE([HAVE_SOXR], 1, [Define to enable libsoxr])
-fi
-
-AM_CONDITIONAL(HAVE_SOXR, test x$enable_soxr = xyes)
dnl ---------------------------------------------------------------------------
dnl Input Plugins
dnl ---------------------------------------------------------------------------
dnl ----------------------------------- CURL ----------------------------------
-MPD_AUTO_PKG(curl, CURL, [libcurl >= 7.18],
+MPD_ENABLE_AUTO_PKG(curl, CURL, [libcurl >= 7.18],
[libcurl HTTP streaming], [libcurl not found])
-if test x$enable_curl = xyes; then
- AC_DEFINE(ENABLE_CURL, 1, [Define when libcurl is used for HTTP streaming])
-fi
-AM_CONDITIONAL(ENABLE_CURL, test x$enable_curl = xyes)
dnl ----------------------------------- smbclient -----------------------------
-MPD_AUTO_PKG_LIB(smbclient, SMBCLIENT, [smbclient >= 0.2],
+MPD_ENABLE_AUTO_PKG_LIB(smbclient, SMBCLIENT, [smbclient >= 0.2],
[smbclient], [smbc_init], [-lsmbclient], [],
[smbclient input plugin], [libsmbclient not found])
-if test x$enable_smbclient = xyes; then
- AC_DEFINE(ENABLE_SMBCLIENT, 1, [Define when libsmbclient is used])
-fi
-AM_CONDITIONAL(ENABLE_SMBCLIENT, test x$enable_smbclient = xyes)
dnl ----------------------------------- NFS -----------------------------
-MPD_AUTO_PKG(nfs, NFS, [libnfs],
+MPD_ENABLE_AUTO_PKG(nfs, NFS, [libnfs],
[NFS input plugin], [libnfs not found])
-if test x$enable_nfs = xyes; then
- AC_DEFINE(ENABLE_NFS, 1, [Define when libnfs is used])
-fi
-AM_CONDITIONAL(ENABLE_NFS, test x$enable_nfs = xyes)
dnl --------------------------------- Despotify ---------------------------------
-MPD_AUTO_PKG(despotify, DESPOTIFY, [despotify],
+MPD_ENABLE_AUTO_PKG(despotify, DESPOTIFY, [despotify],
[Despotify support], [despotify not found])
-if test x$enable_despotify = xyes; then
- AC_DEFINE(ENABLE_DESPOTIFY, 1, [Define when despotify is enabled])
-fi
-AM_CONDITIONAL(ENABLE_DESPOTIFY, test x$enable_despotify = xyes)
dnl --------------------------------- Soundcloud ------------------------------
-if test x$enable_soundcloud != xno; then
- PKG_CHECK_MODULES([YAJL], [yajl >= 2.0],
+MPD_AUTO([soundcloud], [soundcloud.com support], [libyajl not found],
+ [PKG_CHECK_MODULES([YAJL], [yajl >= 2.0],
[found_soundcloud=yes],
AC_CHECK_LIB([yajl], [yajl_parse_complete],
[found_soundcloud=yes YAJL_CFLAGS=-DHAVE_YAJL1 YAJL_LIBS=-lyajl],
- [found_soundcloud=no]))
-fi
-MPD_AUTO_RESULT([soundcloud], [soundcloud.com support], [libyajl not found])
+ [found_soundcloud=no]))])
if test x$enable_soundcloud = xyes; then
AC_DEFINE(ENABLE_SOUNDCLOUD, 1, [Define when soundcloud is enabled])
fi
@@ -1008,24 +785,15 @@ AM_CONDITIONAL(ENABLE_SOUNDCLOUD, test x$enable_soundcloud = xyes)
AC_SUBST(YAJL_LIBS)
dnl ---------------------------------- cdio ---------------------------------
-MPD_AUTO_PKG(cdio_paranoia, CDIO_PARANOIA, [libcdio_paranoia],
- [libcdio_paranoia audio CD library], [libcdio_paranoia not found])
+MPD_ENABLE_AUTO_PKG_DEPENDS(cdio_paranoia, CDIO_PARANOIA, [libcdio_paranoia],
+ [libcdio_paranoia input plugin], [libcdio_paranoia not found], [],
+ [enable_glib], [Cannot use --enable-cdio-paranoia with --disable-glib])
if test x$enable_cdio_paranoia = xyes; then
- AC_DEFINE([ENABLE_CDIO_PARANOIA], 1,
- [Define to enable libcdio_paranoia support])
AC_CHECK_HEADERS(cdio/paranoia/paranoia.h)
fi
-AM_CONDITIONAL(ENABLE_CDIO_PARANOIA, test x$enable_cdio_paranoia = xyes)
-
-dnl ---------------------------------- libmms ---------------------------------
-MPD_AUTO_PKG(mms, MMS, [libmms >= 0.4],
+MPD_ENABLE_AUTO_PKG(mms, MMS, [libmms >= 0.4],
[libmms mms:// protocol support], [libmms not found])
-if test x$enable_mms = xyes; then
- AC_DEFINE(ENABLE_MMS, 1,
- [Define when libmms is used for the MMS protocol])
-fi
-AM_CONDITIONAL(ENABLE_MMS, test x$enable_mms = xyes)
dnl ---------------------------------------------------------------------------
dnl Neighbor Plugins
@@ -1056,8 +824,8 @@ dnl Archive Plugins
dnl ---------------------------------------------------------------------------
dnl --------------------------------- iso9660 ---------------------------------
-MPD_AUTO_PKG(iso9660, ISO9660, [libiso9660],
- [libiso9660 archive library], [libiso9660 not found])
+MPD_ENABLE_AUTO_PKG(iso9660, ISO9660, [libiso9660],
+ [libiso9660 archive plugin], [libiso9660 not found])
AM_CONDITIONAL(HAVE_ISO9660, test x$enable_iso9660 = xyes)
if test x$enable_iso9660 = xyes; then
@@ -1072,14 +840,9 @@ AM_CONDITIONAL(ENABLE_ISO9660_TEST, test x$MKISOFS != xno)
dnl ---------------------------------- zlib ---------------------------------
-MPD_AUTO_PKG(zlib, ZLIB, [zlib],
+MPD_ENABLE_AUTO_PKG(zlib, ZLIB, [zlib],
[zlib support], [zlib not found])
-AM_CONDITIONAL(HAVE_ZLIB, test x$enable_zlib = xyes)
-if test x$enable_zlib = xyes; then
- AC_DEFINE(HAVE_ZLIB, 1, [Define to enable zlib support])
-fi
-
dnl ---------------------------------- libbz2 ---------------------------------
MPD_AUTO_LIB(bzip2, BZ2, bz2, BZ2_bzDecompressInit, [-lbz2], [],
@@ -1107,21 +870,16 @@ if test x$enable_expat = xno; then
fi
fi
-MPD_AUTO_PKG(upnp, UPNP, [libupnp],
- [UPnP client support], [libupnp not found])
-if test x$enable_upnp = xyes; then
- AC_DEFINE(HAVE_LIBUPNP, 1, [Define when libupnp is used])
-fi
-AM_CONDITIONAL(HAVE_LIBUPNP, test x$enable_upnp = xyes)
+MPD_ENABLE_AUTO_PKG_DEPENDS(upnp, UPNP, [libupnp],
+ [UPnP client support], [libupnp not found], [],
+ [enable_database], [Cannot use --enable-upnp with --disable-database])
dnl --------------------------------- libzzip ---------------------------------
-MPD_AUTO_PKG(zzip, ZZIP, [zziplib >= 0.13],
- [libzzip archive library], [libzzip not found])
+MPD_ENABLE_AUTO_PKG(zzip, ZZIP, [zziplib >= 0.13],
+ [libzzip archive library], [libzzip not found],
+ [no])
-AM_CONDITIONAL(HAVE_ZZIP, test x$enable_zzip = xyes)
if test x$enable_zzip = xyes; then
- AC_DEFINE(HAVE_ZZIP, 1, [Define to have zip archive support])
-
AC_PATH_PROG(ZIP, zip, no)
else
ZIP="no"
@@ -1147,20 +905,12 @@ dnl Decoder Plugins
dnl ---------------------------------------------------------------------------
dnl -------------------------------- libadplug --------------------------------
-MPD_AUTO_PKG(adplug, ADPLUG, [adplug],
+MPD_ENABLE_AUTO_PKG(adplug, ADPLUG, [adplug],
[AdPlug decoder plugin], [libadplug not found])
-if test x$enable_adplug = xyes; then
- AC_DEFINE(HAVE_ADPLUG, 1, [Define to use libadplug])
-fi
-AM_CONDITIONAL(HAVE_ADPLUG, test x$enable_adplug = xyes)
dnl -------------------------------- audiofile --------------------------------
-MPD_AUTO_PKG(audiofile, AUDIOFILE, [audiofile >= 0.3],
+MPD_ENABLE_AUTO_PKG(audiofile, AUDIOFILE, [audiofile >= 0.3],
[audiofile decoder plugin], [libaudiofile not found])
-AM_CONDITIONAL(HAVE_AUDIOFILE, test x$enable_audiofile = xyes)
-if test x$enable_audiofile = xyes; then
- AC_DEFINE(HAVE_AUDIOFILE, 1, [Define for audiofile support])
-fi
dnl ----------------------------------- DSD -----------------------------------
@@ -1176,38 +926,21 @@ AM_PATH_FAAD()
AM_CONDITIONAL(HAVE_FAAD, test x$enable_aac = xyes)
dnl ---------------------------------- ffmpeg ---------------------------------
-MPD_AUTO_PKG(ffmpeg, FFMPEG, [libavformat >= 53.17 libavcodec >= 53.25 libavutil >= 51.17],
+MPD_ENABLE_AUTO_PKG(ffmpeg, FFMPEG,
+ [libavformat >= 53.17 libavcodec >= 53.25 libavutil >= 51.17],
[ffmpeg decoder library], [libavformat+libavcodec+libavutil not found])
-if test x$enable_ffmpeg = xyes; then
- AC_DEFINE(HAVE_FFMPEG, 1, [Define for FFMPEG support])
-fi
-
-AM_CONDITIONAL(HAVE_FFMPEG, test x$enable_ffmpeg = xyes)
-
dnl ----------------------------------- FLAC ----------------------------------
-MPD_AUTO_PKG(flac, FLAC, [flac >= 1.2],
+MPD_ENABLE_AUTO_PKG(flac, FLAC, [flac >= 1.2],
[FLAC decoder], [libFLAC not found])
-if test x$enable_flac = xyes; then
- AC_DEFINE(HAVE_FLAC, 1, [Define for FLAC support])
-fi
-
-AM_CONDITIONAL(HAVE_FLAC, test x$enable_flac = xyes)
-
enable_flac_encoder=$enable_flac
dnl -------------------------------- FluidSynth -------------------------------
-MPD_AUTO_PKG(fluidsynth, FLUIDSYNTH, [fluidsynth >= 1.1],
- [fluidsynth decoder], [fluidsynth not found])
-
-if test x$enable_fluidsynth = xyes; then
- AC_DEFINE(ENABLE_FLUIDSYNTH, 1, [Define for fluidsynth support])
-fi
-
-AM_CONDITIONAL(ENABLE_FLUIDSYNTH, test x$enable_fluidsynth = xyes)
+MPD_ENABLE_AUTO_PKG(fluidsynth, FLUIDSYNTH, [fluidsynth >= 1.1],
+ [fluidsynth MIDI decoder plugin], [fluidsynth not found])
dnl ---------------------------------- libgme ---------------------------------
MPD_AUTO_PKG_LIB(gme, GME, [libgme], gme, gme_open_file, [-lgme -lstdc++], [],
@@ -1218,13 +951,9 @@ if test x$enable_gme = xyes; then
fi
dnl ---------------------------------- libmad ---------------------------------
-MPD_AUTO_PKG_LIB(mad, MAD, [mad],
+MPD_ENABLE_AUTO_PKG_LIB(mad, MAD, [mad],
mad, mad_stream_init, [-lmad], [],
[libmad MP3 decoder plugin], [libmad not found])
-if test x$enable_mad = xyes; then
- AC_DEFINE(HAVE_MAD, 1, [Define to use libmad])
-fi
-AM_CONDITIONAL(HAVE_MAD, test x$enable_mad = xyes)
enable_shout2="$enable_shout"
MPD_AUTO_PKG(shout, SHOUT, [shout],
@@ -1234,12 +963,8 @@ if test x$enable_shout = xyes && test x$enable_shout2 = xauto; then
fi
dnl -------------------------------- libmpg123 --------------------------------
-MPD_AUTO_PKG(mpg123, MPG123, [libmpg123],
+MPD_ENABLE_AUTO_PKG(mpg123, MPG123, [libmpg123],
[libmpg123 decoder plugin], [libmpg123 not found])
-if test x$enable_mpg123 = xyes; then
- AC_DEFINE(HAVE_MPG123, 1, [Define to use libmpg123])
-fi
-AM_CONDITIONAL(HAVE_MPG123, test x$enable_mpg123 = xyes)
dnl -------------------------------- libmikmod --------------------------------
if test x$enable_mikmod = xyes; then
@@ -1256,14 +981,9 @@ fi
AM_CONDITIONAL(ENABLE_MIKMOD_DECODER, test x$enable_mikmod = xyes)
dnl -------------------------------- libmodplug -------------------------------
-MPD_AUTO_PKG(modplug, MODPLUG, [libmodplug],
+MPD_ENABLE_AUTO_PKG(modplug, MODPLUG, [libmodplug],
[modplug decoder plugin], [libmodplug not found])
-if test x$enable_modplug = xyes; then
- AC_DEFINE(HAVE_MODPLUG, 1, [Define for modplug support])
-fi
-AM_CONDITIONAL(HAVE_MODPLUG, test x$enable_modplug = xyes)
-
dnl -------------------------------- libmp4v2 ---------------------------------
if test x$enable_aac = xyes; then
MPD_AUTO_LIB(mp4v2, MP4V2, mp4v2, MP4Create, [-lmp4v2], [],
@@ -1283,23 +1003,14 @@ fi
AM_CONDITIONAL(HAVE_MP4V2, test x$enable_mp4v2 = xyes)
dnl -------------------------------- libopus ----------------------------------
-MPD_AUTO_PKG(opus, OPUS, [opus ogg],
+MPD_ENABLE_AUTO_PKG(opus, OPUS, [opus ogg],
[opus decoder plugin], [libopus not found])
-if test x$enable_opus = xyes; then
- AC_DEFINE(HAVE_OPUS, 1, [Define to use libopus])
-fi
-AM_CONDITIONAL(HAVE_OPUS, test x$enable_opus = xyes)
dnl -------------------------------- libsndfile -------------------------------
dnl See above test, which may disable this.
-MPD_AUTO_PKG(sndfile, SNDFILE, [sndfile],
+MPD_ENABLE_AUTO_PKG(sndfile, SNDFILE, [sndfile],
[libsndfile decoder plugin], [libsndfile not found])
-if test x$enable_sndfile = xyes; then
- AC_DEFINE(ENABLE_SNDFILE, 1, [Define to enable the sndfile decoder plugin])
-fi
-AM_CONDITIONAL(ENABLE_SNDFILE, test x$enable_sndfile = xyes)
-
dnl --------------------------------- musepack --------------------------------
MPD_AUTO_LIB(mpc, MPCDEC, mpcdec, mpc_demux_init, [-lmpcdec], [],
@@ -1405,12 +1116,8 @@ fi
AM_CONDITIONAL(ENABLE_SIDPLAY, test x$enable_sidplay = xyes)
dnl --------------------------------- wavpack ---------------------------------
-MPD_AUTO_PKG(wavpack, WAVPACK, [wavpack],
+MPD_ENABLE_AUTO_PKG(wavpack, WAVPACK, [wavpack],
[WavPack decoder plugin], [libwavpack not found])
-AM_CONDITIONAL(HAVE_WAVPACK, test x$enable_wavpack = xyes)
-if test x$enable_wavpack = xyes; then
- AC_DEFINE([HAVE_WAVPACK], 1, [Define to enable WavPack support])
-fi
dnl --------------------------------- WildMidi --------------------------------
MPD_AUTO_LIB(wildmidi, WILDMIDI, WildMidi, WildMidi_Init, [-lWildMidi], [],
@@ -1462,24 +1169,13 @@ AM_CONDITIONAL(ENABLE_FLAC_ENCODER, test x$enable_flac_encoder = xyes)
dnl ------------------------------- Shine Encoder ------------------------------
-MPD_AUTO_PKG(shine_encoder, SHINE, [shine >= 3.1],
+MPD_ENABLE_AUTO_PKG(shine_encoder, SHINE, [shine >= 3.1],
[shine encoder], [libshine not found])
-if test x$enable_shine_encoder = xyes; then
- AC_DEFINE(ENABLE_SHINE_ENCODER, 1,
- [Define to enable the shine encoder plugin])
-fi
-AM_CONDITIONAL(ENABLE_SHINE_ENCODER, test x$enable_shine_encoder = xyes)
-
dnl ---------------------------- Ogg Vorbis Encoder ---------------------------
-MPD_AUTO_PKG(vorbis_encoder, VORBISENC, [vorbisenc vorbis ogg],
- [Ogg Vorbis encoder], [libvorbisenc not found])
-
-if test x$enable_vorbis_encoder = xyes; then
- AC_DEFINE(ENABLE_VORBIS_ENCODER, 1,
- [Define to enable the vorbis encoder plugin])
-fi
-AM_CONDITIONAL(ENABLE_VORBIS_ENCODER, test x$enable_vorbis_encoder = xyes)
+MPD_ENABLE_AUTO_PKG_DEPENDS(vorbis_encoder, VORBISENC, [vorbisenc vorbis ogg],
+ [Ogg Vorbis encoder], [libvorbisenc not found], [],
+ [enable_glib], [Cannot use --enable-vorbis-encoder with --disable-glib])
dnl ------------------------------- LAME Encoder ------------------------------
@@ -1492,14 +1188,8 @@ fi
AM_CONDITIONAL(ENABLE_LAME_ENCODER, test x$enable_lame_encoder = xyes)
dnl ----------------------------- TwoLAME Encoder -----------------------------
-MPD_AUTO_PKG(twolame_encoder, TWOLAME, [twolame],
- [TwoLAME encoder], [libtwolame not found])
-
-if test x$enable_twolame_encoder = xyes; then
- AC_DEFINE(ENABLE_TWOLAME_ENCODER, 1,
- [Define to enable the TwoLAME encoder plugin])
-fi
-AM_CONDITIONAL(ENABLE_TWOLAME_ENCODER, test x$enable_twolame_encoder = xyes)
+MPD_ENABLE_AUTO_PKG(twolame_encoder, TWOLAME, [twolame],
+ [TwoLAME encoder plugin], [libtwolame not found])
dnl ------------------------------- WAVE Encoder ------------------------------
AM_CONDITIONAL(ENABLE_WAVE_ENCODER, test x$enable_wave_encoder = xyes)
@@ -1539,24 +1229,13 @@ dnl Audio Output Plugins
dnl ---------------------------------------------------------------------------
dnl ----------------------------------- ALSA ----------------------------------
-MPD_AUTO_PKG(alsa, ALSA, [alsa >= 0.9.0],
- [ALSA output plugin], [libasound not found])
-
-if test x$enable_alsa = xyes; then
- AC_DEFINE(HAVE_ALSA, 1, [Define to enable ALSA support])
-fi
-
-AM_CONDITIONAL(HAVE_ALSA, test x$enable_alsa = xyes)
+MPD_ENABLE_AUTO_PKG(alsa, ALSA, [alsa >= 0.9.0],
+ [ALSA output plugin], [libasound not found],
+ [$linux_auto])
dnl ----------------------------------- ROAR ----------------------------------
-MPD_AUTO_PKG(roar, ROAR, [libroar >= 0.4.0],
- [ROAR output plugin], [libroar not found])
-
-if test x$enable_roar = xyes; then
- AC_DEFINE(HAVE_ROAR, 1, [Define to enable ROAR support])
-fi
-
-AM_CONDITIONAL(HAVE_ROAR, test x$enable_roar = xyes)
+MPD_ENABLE_AUTO_PKG(roar, ROAR, [libroar >= 0.4.0],
+ [RoarAudio output plugin], [libroar not found])
dnl ----------------------------------- FIFO ----------------------------------
if test x$enable_fifo = xyes; then
@@ -1586,11 +1265,9 @@ fi
AM_CONDITIONAL(ENABLE_HTTPD_OUTPUT, test x$enable_httpd_output = xyes)
dnl ----------------------------------- JACK ----------------------------------
-MPD_AUTO_PKG(jack, JACK, [jack >= 0.100],
- [JACK output plugin], [libjack not found])
-if test x$enable_jack = xyes; then
- AC_DEFINE([HAVE_JACK], 1, [Define to enable JACK support])
-fi
+MPD_ENABLE_AUTO_PKG_DEPENDS(jack, JACK, [jack >= 0.100],
+ [JACK output plugin], [libjack not found], [],
+ [enable_glib], [Cannot use --enable-jack with --disable-glib])
if test x$enable_jack = xyes; then
# check whether jack_set_info_function() is available
@@ -1602,16 +1279,10 @@ if test x$enable_jack = xyes; then
LIBS=$old_LIBS
fi
-AM_CONDITIONAL(HAVE_JACK, test x$enable_jack = xyes)
-
dnl ---------------------------------- libao ----------------------------------
-MPD_AUTO_PKG(ao, AO, [ao],
- [libao output plugin], [libao not found])
-if test x$enable_ao = xyes; then
- AC_DEFINE(HAVE_AO, 1, [Define to play with ao])
-fi
-
-AM_CONDITIONAL(HAVE_AO, test x$enable_ao = xyes)
+MPD_ENABLE_AUTO_PKG_DEPENDS(ao, AO, [ao],
+ [libao output plugin], [libao not found], [],
+ [enable_glib], [Cannot use --enable-ao with --disable-glib])
dnl ---------------------------------- OpenAL ---------------------------------
AC_SUBST(OPENAL_CFLAGS,"")
@@ -1665,14 +1336,8 @@ fi
AM_CONDITIONAL(ENABLE_PIPE_OUTPUT, test x$enable_pipe_output = xyes)
dnl -------------------------------- PulseAudio -------------------------------
-MPD_AUTO_PKG(pulse, PULSE, [libpulse >= 0.9.16],
+MPD_ENABLE_AUTO_PKG(pulse, PULSE, [libpulse >= 0.9.16],
[PulseAudio output plugin], [libpulse not found])
-if test x$enable_pulse = xyes; then
- AC_DEFINE([HAVE_PULSE], 1,
- [Define to enable PulseAudio support])
-fi
-
-AM_CONDITIONAL(HAVE_PULSE, test x$enable_pulse = xyes)
dnl --------------------------------- Recorder --------------------------------
if test x$enable_recorder_output = xauto; then
diff --git a/doc/protocol.xml b/doc/protocol.xml
index 05468e535..a0145053a 100644
--- a/doc/protocol.xml
+++ b/doc/protocol.xml
@@ -1559,6 +1559,7 @@ OK
<arg choice="req"><replaceable>TYPE</replaceable></arg>
<arg choice="req"><replaceable>WHAT</replaceable></arg>
<arg choice="opt"><replaceable>...</replaceable></arg>
+ <arg choice="opt">window <replaceable>START</replaceable>:<replaceable>END</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
@@ -1603,6 +1604,13 @@ OK
<para>
<varname>WHAT</varname> is what to find.
</para>
+
+ <para>
+ <varname>window</varname> can be used to query only a
+ portion of the real response. The parameter is two
+ zero-based record numbers; a start number and an end
+ number.
+ </para>
</listitem>
</varlistentry>
<varlistentry id="command_findadd">
@@ -1795,6 +1803,7 @@ OK
<arg choice="req"><replaceable>TYPE</replaceable></arg>
<arg choice="req"><replaceable>WHAT</replaceable></arg>
<arg choice="opt"><replaceable>...</replaceable></arg>
+ <arg choice="opt">window <replaceable>START</replaceable>:<replaceable>END</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
diff --git a/m4/mpd_auto.m4 b/m4/mpd_auto.m4
index ff922fadc..a851afd4a 100644
--- a/m4/mpd_auto.m4
+++ b/m4/mpd_auto.m4
@@ -1,23 +1,16 @@
AC_DEFUN([MPD_AUTO_ENABLED], [
- var="enable_$1"
- feature="$2"
-
- if eval "test x`echo '$'$var` = xauto"; then
- AC_MSG_NOTICE([auto-detected $feature])
- eval "$var=yes"
+ if test x$[]enable_$1 = xauto; then
+ AC_MSG_NOTICE([auto-detected $2])
+ enable_$1=no
fi
])
AC_DEFUN([MPD_AUTO_DISABLED], [
- var="enable_$1"
- feature="$2"
- msg="$3"
-
- if eval "test x`echo '$'$var` = xauto"; then
- AC_MSG_WARN([$msg -- disabling $feature])
- eval "$var=no"
- elif eval "test x`echo '$'$var` = xyes"; then
- AC_MSG_ERROR([$feature: $msg])
+ if test x$[]enable_$1 = xauto; then
+ AC_MSG_WARN([$3 -- disabling $2])
+ enable_$1=no
+ elif test x$[]enable_$1 = xyes; then
+ AC_MSG_ERROR([$2: $3])
fi
])
@@ -25,59 +18,49 @@ dnl Check whether a prerequisite for a feature was found. This is
dnl very similar to MPD_AUTO_RESULT, but does not finalize the
dnl detection; it assumes that more checks will follow.
AC_DEFUN([MPD_AUTO_PRE], [
- name="$1"
- var="enable_$1"
- found="found_$name"
- feature="$2"
- msg="$3"
-
- if eval "test x`echo '$'$var` != xno" && eval "test x`echo '$'$found` = xno"; then
- MPD_AUTO_DISABLED([$name], [$feature], [$msg])
+ if test x$[]enable_$1 != xno && test x$[]found_$1 = xno; then
+ MPD_AUTO_DISABLED([$1], [$2], [$3])
fi
])
AC_DEFUN([MPD_AUTO_RESULT], [
- name="$1"
- var="enable_$1"
- found="found_$name"
- feature="$2"
- msg="$3"
-
- if eval "test x`echo '$'$var` = xno"; then
- eval "$found=no"
+ if test x$[]enable_$1 = xno; then
+ found_$1=no
fi
- if eval "test x`echo '$'$found` = xyes"; then
- MPD_AUTO_ENABLED([$name], [$feature])
+ if test x$[]found_$1 = xyes; then
+ MPD_AUTO_ENABLED([$1], [$2])
else
- MPD_AUTO_DISABLED([$name], [$feature], [$msg])
+ MPD_AUTO_DISABLED([$1], [$2], [$3])
fi
])
-AC_DEFUN([MPD_AUTO_PKG], [
- if eval "test x`echo '$'enable_$1` != xno"; then
- PKG_CHECK_MODULES([$2], [$3],
- [eval "found_$1=yes"],
- [eval "found_$1=no"])
+dnl Parameters: varname1, description, errmsg, check
+AC_DEFUN([MPD_AUTO], [
+ if test x$[]enable_$1 != xno; then
+ $4
fi
+ MPD_AUTO_RESULT([$1], [$2], [$3])
+])
- MPD_AUTO_RESULT([$1], [$4], [$5])
+AC_DEFUN([MPD_AUTO_PKG], [
+ MPD_AUTO([$1], [$4], [$5],
+ [PKG_CHECK_MODULES([$2], [$3],
+ [found_$1=yes],
+ [found_$1=no])])
])
dnl Check with pkg-config first, fall back to AC_CHECK_LIB.
dnl
dnl Parameters: varname1, varname2, pkgname, libname, symname, libs, cflags, description, errmsg
AC_DEFUN([MPD_AUTO_PKG_LIB], [
- if eval "test x`echo '$'enable_$1` != xno"; then
- PKG_CHECK_MODULES([$2], [$3],
- [eval "found_$1=yes"],
+ MPD_AUTO([$1], [$8], [$9],
+ [PKG_CHECK_MODULES([$2], [$3],
+ [found_$1=yes],
AC_CHECK_LIB($4, $5,
- [eval "found_$1=yes $2_LIBS='$6' $2_CFLAGS='$7'"],
- [eval "found_$1=no"],
- [$6]))
- fi
-
- MPD_AUTO_RESULT([$1], [$8], [$9])
+ [found_$1=yes $2_LIBS='$6' $2_CFLAGS='$7'],
+ [found_$1=no],
+ [$6]))])
])
dnl Wrapper for AC_CHECK_LIB.
@@ -87,12 +70,55 @@ AC_DEFUN([MPD_AUTO_LIB], [
AC_SUBST([$2_LIBS], [])
AC_SUBST([$2_CFLAGS], [])
- if eval "test x`echo '$'enable_$1` != xno"; then
- AC_CHECK_LIB($3, $4,
- [eval "found_$1=yes $2_LIBS='$5' $2_CFLAGS='$6'"],
- [eval "found_$1=no"],
- [$5])
+ MPD_AUTO([$1], [$7], [$8],
+ [AC_CHECK_LIB($3, $4,
+ [found_$1=yes $2_LIBS='$5' $2_CFLAGS='$6'],
+ [found_$1=no],
+ [$5])])
+])
+
+dnl Wrapper for AC_ARG_ENABLE and MPD_AUTO_PKG
+dnl
+dnl Parameters: varname1, varname2, pkg, description, errmsg, default, pre
+AC_DEFUN([MPD_ENABLE_AUTO_PKG], [
+ AC_ARG_ENABLE(translit([$1], [_], [-]),
+ AS_HELP_STRING([--enable-]translit([$1], [_], [-]),
+ [enable $4 (default: auto)]),,
+ [enable_$1=]ifelse([$6], [], [auto], [$6]))
+
+ $7
+
+ MPD_AUTO_PKG($1, $2, $3, $4, $5)
+ if test x$[]enable_$1 = xyes; then
+ AC_DEFINE(ENABLE_$2, 1,
+ [Define to enable $4])
fi
+ AM_CONDITIONAL(ENABLE_$2, test x$[]enable_$1 = xyes)
+])
+
+dnl Wrapper for AC_ARG_ENABLE and MPD_AUTO_PKG_LIB
+dnl
+dnl Parameters: varname1, varname2, pkg, libname, symname, libs, cflags, description, errmsg, default, pre
+AC_DEFUN([MPD_ENABLE_AUTO_PKG_LIB], [
+ AC_ARG_ENABLE(translit([$1], [_], [-]),
+ AS_HELP_STRING([--enable-]translit([$1], [_], [-]),
+ [enable $4 (default: auto)]),,
+ [enable_$1=]ifelse([$10], [], [auto], [$10]))
+
+ $11
- MPD_AUTO_RESULT([$1], [$7], [$8])
+ MPD_AUTO_PKG_LIB($1, $2, $3, $4, $5, $6, $7, $8, $9)
+ if test x$[]enable_$1 = xyes; then
+ AC_DEFINE(ENABLE_$2, 1,
+ [Define to enable $4])
+ fi
+ AM_CONDITIONAL(ENABLE_$2, test x$[]enable_$1 = xyes)
+])
+
+dnl Wrapper for MPD_ENABLE_AUTO_PKG and MPD_DEPENDS
+dnl
+dnl Parameters: varname1, varname2, pkg, description, errmsg, default, dep_variable, dep_errmsg
+AC_DEFUN([MPD_ENABLE_AUTO_PKG_DEPENDS], [
+ MPD_ENABLE_AUTO_PKG([$1], [$2], [$3], [$4], [$5], [$6],
+ [MPD_DEPENDS([enable_$1], [$7], [$8])])
])
diff --git a/src/Main.cxx b/src/Main.cxx
index 26d4e7ae4..b1960b5f2 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -50,7 +50,6 @@
#include "AudioConfig.hxx"
#include "pcm/PcmConvert.hxx"
#include "unix/SignalHandlers.hxx"
-#include "unix/Daemon.hxx"
#include "system/FatalError.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
@@ -65,6 +64,10 @@
#include "config/ConfigError.hxx"
#include "Stats.hxx"
+#ifdef ENABLE_DAEMON
+#include "unix/Daemon.hxx"
+#endif
+
#ifdef ENABLE_DATABASE
#include "db/update/Service.hxx"
#include "db/Configured.hxx"
@@ -133,7 +136,7 @@ Instance *instance;
static StateFile *state_file;
-#ifndef ANDROID
+#ifdef ENABLE_DAEMON
static bool
glue_daemonize_init(const struct options *options, Error &error)
@@ -422,9 +425,11 @@ int mpd_main(int argc, char *argv[])
struct options options;
Error error;
-#ifndef ANDROID
+#ifdef ENABLE_DAEMON
daemonize_close_stdin();
+#endif
+#ifndef ANDROID
#ifdef HAVE_LOCALE_H
/* initialize locale */
setlocale(LC_CTYPE,"");
@@ -470,7 +475,9 @@ int mpd_main(int argc, char *argv[])
LogError(error);
return EXIT_FAILURE;
}
+#endif
+#ifdef ENABLE_DAEMON
if (!glue_daemonize_init(&options, error)) {
LogError(error);
return EXIT_FAILURE;
@@ -512,7 +519,7 @@ int mpd_main(int argc, char *argv[])
return EXIT_FAILURE;
}
-#ifndef ANDROID
+#ifdef ENABLE_DAEMON
daemonize_set_user();
daemonize_begin(options.daemon);
#endif
@@ -585,9 +592,11 @@ static int mpd_main_after_fork(struct options options)
playlist_list_global_init();
-#ifndef ANDROID
+#ifdef ENABLE_DAEMON
daemonize_commit();
+#endif
+#ifndef ANDROID
setup_log_output(options.log_stderr);
SignalHandlersInit(*instance->event_loop);
@@ -724,9 +733,11 @@ static int mpd_main_after_fork(struct options options)
delete instance->event_loop;
delete instance;
instance = nullptr;
-#ifndef ANDROID
+
+#ifdef ENABLE_DAEMON
daemonize_finish();
#endif
+
#ifdef WIN32
WSACleanup();
#endif
diff --git a/src/archive/ArchiveList.cxx b/src/archive/ArchiveList.cxx
index 79c3a16fe..4a39ea8a5 100644
--- a/src/archive/ArchiveList.cxx
+++ b/src/archive/ArchiveList.cxx
@@ -32,7 +32,7 @@ const ArchivePlugin *const archive_plugins[] = {
#ifdef HAVE_BZ2
&bz2_archive_plugin,
#endif
-#ifdef HAVE_ZZIP
+#ifdef ENABLE_ZZIP
&zzip_archive_plugin,
#endif
#ifdef HAVE_ISO9660
diff --git a/src/command/AllCommands.cxx b/src/command/AllCommands.cxx
index 6a4b18198..be3a343a5 100644
--- a/src/command/AllCommands.cxx
+++ b/src/command/AllCommands.cxx
@@ -210,6 +210,16 @@ command_available(gcc_unused const Partition &partition,
return neighbor_commands_available(partition.instance);
#endif
+ if (strcmp(cmd->cmd, "save") == 0 ||
+ strcmp(cmd->cmd, "rm") == 0 ||
+ strcmp(cmd->cmd, "rename") == 0 ||
+ strcmp(cmd->cmd, "playlistdelete") == 0 ||
+ strcmp(cmd->cmd, "playlistmove") == 0 ||
+ strcmp(cmd->cmd, "playlistclear") == 0 ||
+ strcmp(cmd->cmd, "playlistadd") == 0 ||
+ strcmp(cmd->cmd, "listplaylists") == 0)
+ return playlist_commands_available();
+
return true;
}
diff --git a/src/command/DatabaseCommands.cxx b/src/command/DatabaseCommands.cxx
index a3ea8d0ae..988542f44 100644
--- a/src/command/DatabaseCommands.cxx
+++ b/src/command/DatabaseCommands.cxx
@@ -32,6 +32,7 @@
#include "util/Error.hxx"
#include "SongFilter.hxx"
#include "protocol/Result.hxx"
+#include "protocol/ArgParser.hxx"
#include "BulkEdit.hxx"
#include <string.h>
@@ -70,6 +71,16 @@ handle_match(Client &client, unsigned argc, char *argv[], bool fold_case)
{
ConstBuffer<const char *> args(argv + 1, argc - 1);
+ unsigned window_start = 0, window_end = std::numeric_limits<int>::max();
+ if (args.size >= 2 && strcmp(args[args.size - 2], "window") == 0) {
+ if (!check_range(client, &window_start, &window_end,
+ args.back()))
+ return CommandResult::ERROR;
+
+ args.pop_back();
+ args.pop_back();
+ }
+
SongFilter filter;
if (!filter.Parse(args, fold_case)) {
command_error(client, ACK_ERROR_ARG, "incorrect arguments");
@@ -79,7 +90,8 @@ handle_match(Client &client, unsigned argc, char *argv[], bool fold_case)
const DatabaseSelection selection("", true, &filter);
Error error;
- return db_selection_print(client, selection, true, false, error)
+ return db_selection_print(client, selection, true, false,
+ window_start, window_end, error)
? CommandResult::OK
: print_error(client, error);
}
diff --git a/src/command/PlaylistCommands.cxx b/src/command/PlaylistCommands.cxx
index c2b18064c..593eab865 100644
--- a/src/command/PlaylistCommands.cxx
+++ b/src/command/PlaylistCommands.cxx
@@ -35,9 +35,17 @@
#include "protocol/ArgParser.hxx"
#include "protocol/Result.hxx"
#include "ls.hxx"
+#include "Mapper.hxx"
+#include "fs/AllocatedPath.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
+bool
+playlist_commands_available()
+{
+ return !map_spl_path().IsNull();
+}
+
static void
print_spl_list(Client &client, const PlaylistVector &list)
{
diff --git a/src/command/PlaylistCommands.hxx b/src/command/PlaylistCommands.hxx
index fba4e1318..6dc589c8b 100644
--- a/src/command/PlaylistCommands.hxx
+++ b/src/command/PlaylistCommands.hxx
@@ -21,9 +21,14 @@
#define MPD_PLAYLIST_COMMANDS_HXX
#include "CommandResult.hxx"
+#include "Compiler.h"
class Client;
+gcc_const
+bool
+playlist_commands_available();
+
CommandResult
handle_save(Client &client, unsigned argc, char *argv[]);
diff --git a/src/db/DatabasePrint.cxx b/src/db/DatabasePrint.cxx
index 498aedf97..945ac6ab9 100644
--- a/src/db/DatabasePrint.cxx
+++ b/src/db/DatabasePrint.cxx
@@ -147,27 +147,49 @@ PrintPlaylistFull(Client &client, bool base,
bool
db_selection_print(Client &client, const DatabaseSelection &selection,
- bool full, bool base, Error &error)
+ bool full, bool base,
+ unsigned window_start, unsigned window_end,
+ Error &error)
{
const Database *db = client.GetDatabase(error);
if (db == nullptr)
return false;
+ unsigned i = 0;
+
using namespace std::placeholders;
const auto d = selection.filter == nullptr
? std::bind(full ? PrintDirectoryFull : PrintDirectoryBrief,
std::ref(client), base, _1)
: VisitDirectory();
- const auto s = std::bind(full ? PrintSongFull : PrintSongBrief,
- std::ref(client), base, _1);
+ VisitSong s = std::bind(full ? PrintSongFull : PrintSongBrief,
+ std::ref(client), base, _1);
const auto p = selection.filter == nullptr
? std::bind(full ? PrintPlaylistFull : PrintPlaylistBrief,
std::ref(client), base, _1, _2)
: VisitPlaylist();
+ if (window_start > 0 || window_end < std::numeric_limits<int>::max())
+ s = [s, window_start, window_end, &i](const LightSong &song,
+ Error &error2){
+ const bool in_window = i >= window_start && i < window_end;
+ ++i;
+ return !in_window || s(song, error2);
+ };
+
return db->Visit(selection, d, s, p, error);
}
+bool
+db_selection_print(Client &client, const DatabaseSelection &selection,
+ bool full, bool base,
+ Error &error)
+{
+ return db_selection_print(client, selection, full, base,
+ 0, std::numeric_limits<int>::max(),
+ error);
+}
+
static bool
PrintSongURIVisitor(Client &client, const LightSong &song)
{
diff --git a/src/db/DatabasePrint.hxx b/src/db/DatabasePrint.hxx
index 2ab5e703d..7e4dd8572 100644
--- a/src/db/DatabasePrint.hxx
+++ b/src/db/DatabasePrint.hxx
@@ -38,6 +38,12 @@ db_selection_print(Client &client, const DatabaseSelection &selection,
bool full, bool base, Error &error);
bool
+db_selection_print(Client &client, const DatabaseSelection &selection,
+ bool full, bool base,
+ unsigned window_start, unsigned window_end,
+ Error &error);
+
+bool
PrintUniqueTags(Client &client, unsigned type, uint32_t group_mask,
const SongFilter *filter,
Error &error);
diff --git a/src/db/Registry.cxx b/src/db/Registry.cxx
index 5681a9b82..a7d6dc05e 100644
--- a/src/db/Registry.cxx
+++ b/src/db/Registry.cxx
@@ -28,10 +28,10 @@
const DatabasePlugin *const database_plugins[] = {
&simple_db_plugin,
-#ifdef HAVE_LIBMPDCLIENT
+#ifdef ENABLE_LIBMPDCLIENT
&proxy_db_plugin,
#endif
-#ifdef HAVE_LIBUPNP
+#ifdef ENABLE_UPNP
&upnp_db_plugin,
#endif
nullptr
diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.cxx b/src/db/plugins/simple/SimpleDatabasePlugin.cxx
index 7b1886f1c..bc9c42d2d 100644
--- a/src/db/plugins/simple/SimpleDatabasePlugin.cxx
+++ b/src/db/plugins/simple/SimpleDatabasePlugin.cxx
@@ -41,7 +41,7 @@
#include "util/Domain.hxx"
#include "Log.hxx"
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
#include "fs/io/GzipOutputStream.hxx"
#endif
@@ -52,21 +52,21 @@ static constexpr Domain simple_db_domain("simple_db");
inline SimpleDatabase::SimpleDatabase()
:Database(simple_db_plugin),
path(AllocatedPath::Null()),
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
compress(true),
#endif
cache_path(AllocatedPath::Null()),
prefixed_light_song(nullptr) {}
inline SimpleDatabase::SimpleDatabase(AllocatedPath &&_path,
-#ifndef HAVE_ZLIB
+#ifndef ENABLE_ZLIB
gcc_unused
#endif
bool _compress)
:Database(simple_db_plugin),
path(std::move(_path)),
path_utf8(path.ToUTF8()),
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
compress(_compress),
#endif
cache_path(AllocatedPath::Null()),
@@ -104,7 +104,7 @@ SimpleDatabase::Configure(const config_param &param, Error &error)
if (path.IsNull() && error.IsDefined())
return false;
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
compress = param.GetBlockValue("compress", compress);
#endif
@@ -389,7 +389,7 @@ SimpleDatabase::Save(Error &error)
OutputStream *os = &fos;
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
GzipOutputStream *gzip = nullptr;
if (compress) {
gzip = new GzipOutputStream(*os, error);
@@ -407,13 +407,13 @@ SimpleDatabase::Save(Error &error)
db_save_internal(bos, *root);
if (!bos.Flush(error)) {
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
delete gzip;
#endif
return false;
}
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
if (gzip != nullptr) {
bool success = gzip->Flush(error);
delete gzip;
@@ -484,7 +484,7 @@ SimpleDatabase::Mount(const char *local_uri, const char *storage_uri,
std::string name(storage_uri);
std::replace_if(name.begin(), name.end(), IsUnsafeChar, '_');
-#ifndef HAVE_ZLIB
+#ifndef ENABLE_ZLIB
constexpr bool compress = false;
#endif
auto db = new SimpleDatabase(AllocatedPath::Build(cache_path,
diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.hxx b/src/db/plugins/simple/SimpleDatabasePlugin.hxx
index 7ba71e272..eb225b2c8 100644
--- a/src/db/plugins/simple/SimpleDatabasePlugin.hxx
+++ b/src/db/plugins/simple/SimpleDatabasePlugin.hxx
@@ -39,7 +39,7 @@ class SimpleDatabase : public Database {
AllocatedPath path;
std::string path_utf8;
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
bool compress;
#endif
diff --git a/src/db/plugins/upnp/Directory.cxx b/src/db/plugins/upnp/Directory.cxx
index e94a1a997..55f2693ae 100644
--- a/src/db/plugins/upnp/Directory.cxx
+++ b/src/db/plugins/upnp/Directory.cxx
@@ -89,18 +89,18 @@ ParseDuration(const char *duration)
* this. Twonky returns directory names (titles) like 'Artist/Album'.
*/
gcc_pure
-static std::string
-titleToPathElt(std::string &&s)
+static std::string &&
+TitleToPathSegment(std::string &&s)
{
std::replace(s.begin(), s.end(), '/', '_');
- return s;
+ return std::move(s);
}
/**
* An XML parser which builds directory contents from DIDL lite input.
*/
class UPnPDirParser final : public CommonExpatParser {
- UPnPDirContent &m_dir;
+ UPnPDirContent &directory;
enum {
NONE,
@@ -120,22 +120,22 @@ class UPnPDirParser final : public CommonExpatParser {
*/
std::string value;
- UPnPDirObject m_tobj;
+ UPnPDirObject object;
TagBuilder tag;
public:
- UPnPDirParser(UPnPDirContent& dir)
- :m_dir(dir),
+ UPnPDirParser(UPnPDirContent &_directory)
+ :directory(_directory),
state(NONE),
tag_type(TAG_NUM_OF_ITEM_TYPES)
{
- m_tobj.clear();
+ object.Clear();
}
protected:
virtual void StartElement(const XML_Char *name, const XML_Char **attrs)
{
- if (m_tobj.type != UPnPDirObject::Type::UNKNOWN &&
+ if (object.type != UPnPDirObject::Type::UNKNOWN &&
tag_type == TAG_NUM_OF_ITEM_TYPES) {
tag_type = tag_table_lookup(upnp_tags, name);
if (tag_type != TAG_NUM_OF_ITEM_TYPES)
@@ -147,31 +147,31 @@ protected:
switch (name[0]) {
case 'c':
if (!strcmp(name, "container")) {
- m_tobj.clear();
- m_tobj.type = UPnPDirObject::Type::CONTAINER;
+ object.Clear();
+ object.type = UPnPDirObject::Type::CONTAINER;
const char *id = GetAttribute(attrs, "id");
if (id != nullptr)
- m_tobj.m_id = id;
+ object.id = id;
const char *pid = GetAttribute(attrs, "parentID");
if (pid != nullptr)
- m_tobj.m_pid = pid;
+ object.parent_id = pid;
}
break;
case 'i':
if (!strcmp(name, "item")) {
- m_tobj.clear();
- m_tobj.type = UPnPDirObject::Type::ITEM;
+ object.Clear();
+ object.type = UPnPDirObject::Type::ITEM;
const char *id = GetAttribute(attrs, "id");
if (id != nullptr)
- m_tobj.m_id = id;
+ object.id = id;
const char *pid = GetAttribute(attrs, "parentID");
if (pid != nullptr)
- m_tobj.m_pid = pid;
+ object.parent_id = pid;
}
break;
@@ -197,25 +197,15 @@ protected:
}
}
- bool checkobjok() {
- if (m_tobj.m_id.empty() || m_tobj.m_pid.empty() ||
- m_tobj.name.empty() ||
- (m_tobj.type == UPnPDirObject::Type::ITEM &&
- m_tobj.item_class == UPnPDirObject::ItemClass::UNKNOWN))
- return false;
-
- return true;
- }
-
virtual void EndElement(const XML_Char *name)
{
if (tag_type != TAG_NUM_OF_ITEM_TYPES) {
- assert(m_tobj.type != UPnPDirObject::Type::UNKNOWN);
+ assert(object.type != UPnPDirObject::Type::UNKNOWN);
tag.AddItem(tag_type, value.c_str());
if (tag_type == TAG_TITLE)
- m_tobj.name = titleToPathElt(std::move(value));
+ object.name = TitleToPathSegment(std::move(value));
value.clear();
tag_type = TAG_NUM_OF_ITEM_TYPES;
@@ -223,9 +213,9 @@ protected:
}
if ((!strcmp(name, "container") || !strcmp(name, "item")) &&
- checkobjok()) {
- tag.Commit(m_tobj.tag);
- m_dir.objects.emplace_back(std::move(m_tobj));
+ object.Check()) {
+ tag.Commit(object.tag);
+ directory.objects.emplace_back(std::move(object));
}
state = NONE;
@@ -234,7 +224,7 @@ protected:
virtual void CharacterData(const XML_Char *s, int len)
{
if (tag_type != TAG_NUM_OF_ITEM_TYPES) {
- assert(m_tobj.type != UPnPDirObject::Type::UNKNOWN);
+ assert(object.type != UPnPDirObject::Type::UNKNOWN);
value.append(s, len);
return;
@@ -245,11 +235,11 @@ protected:
break;
case RES:
- m_tobj.url.assign(s, len);
+ object.url.assign(s, len);
break;
case CLASS:
- m_tobj.item_class = ParseItemClass(s, len);
+ object.item_class = ParseItemClass(s, len);
break;
}
}
diff --git a/src/db/plugins/upnp/Object.hxx b/src/db/plugins/upnp/Object.hxx
index 16a66c774..6d71c158b 100644
--- a/src/db/plugins/upnp/Object.hxx
+++ b/src/db/plugins/upnp/Object.hxx
@@ -21,6 +21,7 @@
#define MPD_UPNP_OBJECT_HXX
#include "tag/Tag.hxx"
+#include "Compiler.h"
#include <string>
@@ -50,8 +51,16 @@ public:
PLAYLIST,
};
- std::string m_id; // ObjectId
- std::string m_pid; // Parent ObjectId
+ /**
+ * ObjectId
+ */
+ std::string id;
+
+ /**
+ * Parent's ObjectId
+ */
+ std::string parent_id;
+
std::string url;
/**
@@ -71,15 +80,21 @@ public:
UPnPDirObject &operator=(UPnPDirObject &&) = default;
- void clear()
- {
- m_id.clear();
- m_pid.clear();
+ void Clear() {
+ id.clear();
+ parent_id.clear();
url.clear();
type = Type::UNKNOWN;
item_class = ItemClass::UNKNOWN;
tag.Clear();
}
+
+ gcc_pure
+ bool Check() const {
+ return !id.empty() && !parent_id.empty() && !name.empty() &&
+ (type != UPnPDirObject::Type::ITEM ||
+ item_class != UPnPDirObject::ItemClass::UNKNOWN);
+ }
};
#endif /* _UPNPDIRCONTENT_H_X_INCLUDED_ */
diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
index 21ddb8790..f038a668c 100644
--- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
@@ -412,7 +412,7 @@ UpnpDatabase::SearchSongs(const ContentDirectoryService &server,
// So we return synthetic and ugly paths based on the object id,
// which we later have to detect.
const std::string path = songPath(server.getFriendlyName(),
- dirent.m_id);
+ dirent.id);
if (!visitSong(std::move(dirent), path.c_str(),
selection, visit_song,
error))
@@ -447,13 +447,13 @@ UpnpDatabase::BuildPath(const ContentDirectoryService &server,
std::string &path,
Error &error) const
{
- const char *pid = idirent.m_id.c_str();
+ const char *pid = idirent.id.c_str();
path.clear();
UPnPDirObject dirent;
while (strcmp(pid, rootid) != 0) {
if (!ReadNode(server, pid, dirent, error))
return false;
- pid = dirent.m_pid.c_str();
+ pid = dirent.parent_id.c_str();
if (path.empty())
path = dirent.name;
@@ -509,7 +509,7 @@ UpnpDatabase::Namei(const ContentDirectoryService &server,
return false;
}
- objid = std::move(child->m_id);
+ objid = std::move(child->id);
}
}
@@ -621,7 +621,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server,
}
std::string path = songPath(server.getFriendlyName(),
- dirent.m_id);
+ dirent.id);
if (!visitSong(std::move(dirent), path.c_str(),
selection,
visit_song, error))
@@ -640,7 +640,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server,
recursion (1-deep) here, which will handle the "add dir"
case. */
if (selection.recursive && selection.filter)
- return SearchSongs(server, tdirent.m_id.c_str(), selection,
+ return SearchSongs(server, tdirent.id.c_str(), selection,
visit_song, error);
const char *const base_uri = selection.uri.empty()
@@ -658,7 +658,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server,
and loop here, but it's not useful as mpd will only return
data to the client when we're done anyway. */
UPnPDirContent dirbuf;
- if (!server.readDir(handle, tdirent.m_id.c_str(), dirbuf,
+ if (!server.readDir(handle, tdirent.id.c_str(), dirbuf,
error))
return false;
diff --git a/src/decoder/DecoderList.cxx b/src/decoder/DecoderList.cxx
index 0a31d9eac..7f665fb88 100644
--- a/src/decoder/DecoderList.cxx
+++ b/src/decoder/DecoderList.cxx
@@ -49,10 +49,10 @@
#include <string.h>
const struct DecoderPlugin *const decoder_plugins[] = {
-#ifdef HAVE_MAD
+#ifdef ENABLE_MAD
&mad_decoder_plugin,
#endif
-#ifdef HAVE_MPG123
+#ifdef ENABLE_MPG123
&mpg123_decoder_plugin,
#endif
#ifdef HAVE_MP4V2
@@ -61,19 +61,17 @@ const struct DecoderPlugin *const decoder_plugins[] = {
#ifdef ENABLE_VORBIS_DECODER
&vorbis_decoder_plugin,
#endif
-#if defined(HAVE_FLAC)
+#ifdef ENABLE_FLAC
&oggflac_decoder_plugin,
-#endif
-#ifdef HAVE_FLAC
&flac_decoder_plugin,
#endif
-#ifdef HAVE_OPUS
+#ifdef ENABLE_OPUS
&opus_decoder_plugin,
#endif
#ifdef ENABLE_SNDFILE
&sndfile_decoder_plugin,
#endif
-#ifdef HAVE_AUDIOFILE
+#ifdef ENABLE_AUDIOFILE
&audiofile_decoder_plugin,
#endif
#ifdef ENABLE_DSD
@@ -86,10 +84,10 @@ const struct DecoderPlugin *const decoder_plugins[] = {
#ifdef HAVE_MPCDEC
&mpcdec_decoder_plugin,
#endif
-#ifdef HAVE_WAVPACK
+#ifdef ENABLE_WAVPACK
&wavpack_decoder_plugin,
#endif
-#ifdef HAVE_MODPLUG
+#ifdef ENABLE_MODPLUG
&modplug_decoder_plugin,
#endif
#ifdef ENABLE_MIKMOD_DECODER
@@ -104,10 +102,10 @@ const struct DecoderPlugin *const decoder_plugins[] = {
#ifdef ENABLE_FLUIDSYNTH
&fluidsynth_decoder_plugin,
#endif
-#ifdef HAVE_ADPLUG
+#ifdef ENABLE_ADPLUG
&adplug_decoder_plugin,
#endif
-#ifdef HAVE_FFMPEG
+#ifdef ENABLE_FFMPEG
&ffmpeg_decoder_plugin,
#endif
#ifdef HAVE_GME
diff --git a/src/decoder/plugins/DsdLib.cxx b/src/decoder/plugins/DsdLib.cxx
index 8892ed387..13f6bc846 100644
--- a/src/decoder/plugins/DsdLib.cxx
+++ b/src/decoder/plugins/DsdLib.cxx
@@ -32,7 +32,7 @@
#include <string.h>
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
#include <id3tag.h>
#endif
@@ -101,7 +101,7 @@ dsdlib_valid_freq(uint32_t samplefreq)
}
}
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
void
dsdlib_tag_id3(InputStream &is,
const struct tag_handler *handler,
diff --git a/src/decoder/plugins/DsdiffDecoderPlugin.cxx b/src/decoder/plugins/DsdiffDecoderPlugin.cxx
index b6c79e11e..33f433330 100644
--- a/src/decoder/plugins/DsdiffDecoderPlugin.cxx
+++ b/src/decoder/plugins/DsdiffDecoderPlugin.cxx
@@ -244,7 +244,7 @@ dsdiff_read_metadata_extra(Decoder *decoder, InputStream &is,
/** offset for title tag */
offset_type title_offset = 0;
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
offset_type id3_offset = 0;
#endif
@@ -269,7 +269,7 @@ dsdiff_read_metadata_extra(Decoder *decoder, InputStream &is,
chunk_size = chunk_header->GetSize();
title_offset = is.GetOffset();
}
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
/* 'ID3 ' chunk, offspec. Used by sacdextract */
if (chunk_header->id.Equals("ID3 ")) {
chunk_size = chunk_header->GetSize();
@@ -283,7 +283,7 @@ dsdiff_read_metadata_extra(Decoder *decoder, InputStream &is,
/* done processing chunk headers, process tags if any */
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
if (id3_offset != 0) {
/* a ID3 tag has preference over the other tags, do not process
other tags if we have one */
diff --git a/src/decoder/plugins/DsfDecoderPlugin.cxx b/src/decoder/plugins/DsfDecoderPlugin.cxx
index 690616d15..b8ae837f7 100644
--- a/src/decoder/plugins/DsfDecoderPlugin.cxx
+++ b/src/decoder/plugins/DsfDecoderPlugin.cxx
@@ -47,7 +47,7 @@ struct DsfMetaData {
unsigned sample_rate, channels;
bool bitreverse;
offset_type n_blocks;
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
offset_type id3_offset;
#endif
};
@@ -111,7 +111,7 @@ dsf_read_metadata(Decoder *decoder, InputStream &is,
if (sizeof(dsf_header) != chunk_size)
return false;
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
const offset_type metadata_offset = dsf_header.pmeta.Read();
#endif
@@ -174,7 +174,7 @@ dsf_read_metadata(Decoder *decoder, InputStream &is,
metadata->n_blocks = data_size / block_size;
metadata->channels = channels;
metadata->sample_rate = samplefreq;
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
metadata->id3_offset = metadata_offset;
#endif
/* check bits per sample format, determine if bitreverse is needed */
@@ -352,7 +352,7 @@ dsf_scan_stream(InputStream &is,
audio_format.sample_rate);
tag_handler_invoke_duration(handler, handler_ctx, songtime);
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
/* Add available tags from the ID3 tag */
dsdlib_tag_id3(is, handler, handler_ctx, metadata.id3_offset);
#endif
diff --git a/src/decoder/plugins/MadDecoderPlugin.cxx b/src/decoder/plugins/MadDecoderPlugin.cxx
index de6c9b127..62f31974f 100644
--- a/src/decoder/plugins/MadDecoderPlugin.cxx
+++ b/src/decoder/plugins/MadDecoderPlugin.cxx
@@ -36,7 +36,7 @@
#include <mad.h>
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
#include <id3tag.h>
#endif
@@ -251,7 +251,7 @@ MadDecoder::FillBuffer()
return true;
}
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
static bool
parse_id3_replay_gain_info(ReplayGainInfo &rgi,
struct id3_tag *tag)
@@ -285,7 +285,7 @@ parse_id3_replay_gain_info(ReplayGainInfo &rgi,
}
#endif
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
gcc_pure
static MixRampInfo
parse_id3_mixramp(struct id3_tag *tag)
@@ -317,7 +317,7 @@ parse_id3_mixramp(struct id3_tag *tag)
inline void
MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
{
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
id3_byte_t *allocated = nullptr;
const id3_length_t count = stream.bufend - stream.this_frame;
@@ -369,7 +369,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
id3_tag_delete(id3_tag);
delete[] allocated;
-#else /* !HAVE_ID3TAG */
+#else /* !ENABLE_ID3TAG */
(void)mpd_tag;
/* This code is enabled when libid3tag is disabled. Instead
@@ -386,7 +386,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
#endif
}
-#ifndef HAVE_ID3TAG
+#ifndef ENABLE_ID3TAG
/**
* This function emulates libid3tag when it is disabled. Instead of
* doing a real analyzation of the frame, it just checks whether the
@@ -402,7 +402,7 @@ id3_tag_query(const void *p0, size_t length)
? (p[8] << 7) + p[9] + 10
: 0;
}
-#endif /* !HAVE_ID3TAG */
+#endif /* !ENABLE_ID3TAG */
static enum mp3_action
RecoverFrameError(struct mad_stream &stream)
diff --git a/src/decoder/plugins/WavpackDecoderPlugin.cxx b/src/decoder/plugins/WavpackDecoderPlugin.cxx
index 67859bbd2..0b41d052e 100644
--- a/src/decoder/plugins/WavpackDecoderPlugin.cxx
+++ b/src/decoder/plugins/WavpackDecoderPlugin.cxx
@@ -28,10 +28,10 @@
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "util/Macros.hxx"
+#include "util/Alloc.hxx"
#include "Log.hxx"
#include <wavpack/wavpack.h>
-#include <glib.h>
#include <assert.h>
#include <stdio.h>
@@ -484,10 +484,10 @@ wavpack_open_wvc(Decoder &decoder, const char *uri)
if (uri == nullptr)
return nullptr;
- char *wvc_url = g_strconcat(uri, "c", nullptr);
+ char *wvc_url = xstrcatdup(uri, "c");
InputStream *is_wvc = decoder_open_uri(decoder, uri, IgnoreError());
- g_free(wvc_url);
+ free(wvc_url);
if (is_wvc == nullptr)
return nullptr;
diff --git a/src/encoder/EncoderList.cxx b/src/encoder/EncoderList.cxx
index 4bca5a4fe..f3e3ffa64 100644
--- a/src/encoder/EncoderList.cxx
+++ b/src/encoder/EncoderList.cxx
@@ -33,16 +33,16 @@
const EncoderPlugin *const encoder_plugins[] = {
&null_encoder_plugin,
-#ifdef ENABLE_VORBIS_ENCODER
+#ifdef ENABLE_VORBISENC
&vorbis_encoder_plugin,
#endif
-#ifdef HAVE_OPUS
+#ifdef ENABLE_OPUS
&opus_encoder_plugin,
#endif
#ifdef ENABLE_LAME_ENCODER
&lame_encoder_plugin,
#endif
-#ifdef ENABLE_TWOLAME_ENCODER
+#ifdef ENABLE_TWOLAME
&twolame_encoder_plugin,
#endif
#ifdef ENABLE_WAVE_ENCODER
@@ -51,7 +51,7 @@ const EncoderPlugin *const encoder_plugins[] = {
#ifdef ENABLE_FLAC_ENCODER
&flac_encoder_plugin,
#endif
-#ifdef ENABLE_SHINE_ENCODER
+#ifdef ENABLE_SHINE
&shine_encoder_plugin,
#endif
nullptr
diff --git a/src/fs/io/TextFile.cxx b/src/fs/io/TextFile.cxx
index 28d6dabcb..1710e0e89 100644
--- a/src/fs/io/TextFile.cxx
+++ b/src/fs/io/TextFile.cxx
@@ -28,14 +28,14 @@
TextFile::TextFile(Path path_fs, Error &error)
:file_reader(new FileReader(path_fs, error)),
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
gunzip_reader(file_reader->IsDefined()
? new AutoGunzipReader(*file_reader)
: nullptr),
#endif
buffered_reader(file_reader->IsDefined()
? new BufferedReader(*
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
gunzip_reader
#else
file_reader
@@ -48,7 +48,7 @@ TextFile::TextFile(Path path_fs, Error &error)
TextFile::~TextFile()
{
delete buffered_reader;
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
delete gunzip_reader;
#endif
delete file_reader;
diff --git a/src/fs/io/TextFile.hxx b/src/fs/io/TextFile.hxx
index 5577363e7..425797ce7 100644
--- a/src/fs/io/TextFile.hxx
+++ b/src/fs/io/TextFile.hxx
@@ -34,7 +34,7 @@ class BufferedReader;
class TextFile {
FileReader *const file_reader;
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
AutoGunzipReader *const gunzip_reader;
#endif
diff --git a/src/input/Registry.cxx b/src/input/Registry.cxx
index 2b981df1c..6be3233e4 100644
--- a/src/input/Registry.cxx
+++ b/src/input/Registry.cxx
@@ -22,7 +22,7 @@
#include "util/Macros.hxx"
#include "plugins/FileInputPlugin.hxx"
-#ifdef HAVE_ALSA
+#ifdef ENABLE_ALSA
#include "plugins/AlsaInputPlugin.hxx"
#endif
@@ -34,7 +34,7 @@
#include "plugins/CurlInputPlugin.hxx"
#endif
-#ifdef HAVE_FFMPEG
+#ifdef ENABLE_FFMPEG
#include "plugins/FfmpegInputPlugin.hxx"
#endif
@@ -60,7 +60,7 @@
const InputPlugin *const input_plugins[] = {
&input_plugin_file,
-#ifdef HAVE_ALSA
+#ifdef ENABLE_ALSA
&input_plugin_alsa,
#endif
#ifdef ENABLE_ARCHIVE
@@ -69,7 +69,7 @@ const InputPlugin *const input_plugins[] = {
#ifdef ENABLE_CURL
&input_plugin_curl,
#endif
-#ifdef HAVE_FFMPEG
+#ifdef ENABLE_FFMPEG
&input_plugin_ffmpeg,
#endif
#ifdef ENABLE_SMBCLIENT
diff --git a/src/ls.cxx b/src/ls.cxx
index 96c9f60e5..4e8fc88ab 100644
--- a/src/ls.cxx
+++ b/src/ls.cxx
@@ -41,7 +41,7 @@ static const char *remoteUrlPrefixes[] = {
"mmst://",
"mmsu://",
#endif
-#ifdef HAVE_FFMPEG
+#ifdef ENABLE_FFMPEG
"gopher://",
"rtp://",
"rtsp://",
@@ -61,7 +61,7 @@ static const char *remoteUrlPrefixes[] = {
#ifdef ENABLE_DESPOTIFY
"spt://",
#endif
-#ifdef HAVE_ALSA
+#ifdef ENABLE_ALSA
"alsa://",
#endif
NULL
diff --git a/src/neighbor/Registry.cxx b/src/neighbor/Registry.cxx
index f6d1f97b3..6f0651423 100644
--- a/src/neighbor/Registry.cxx
+++ b/src/neighbor/Registry.cxx
@@ -29,7 +29,7 @@ const NeighborPlugin *const neighbor_plugins[] = {
#ifdef ENABLE_SMBCLIENT
&smbclient_neighbor_plugin,
#endif
-#ifdef HAVE_LIBUPNP
+#ifdef ENABLE_UPNP
&upnp_neighbor_plugin,
#endif
nullptr
diff --git a/src/output/Registry.cxx b/src/output/Registry.cxx
index 566f6b6a8..2ce844179 100644
--- a/src/output/Registry.cxx
+++ b/src/output/Registry.cxx
@@ -54,13 +54,13 @@ const AudioOutputPlugin *const audio_output_plugins[] = {
#ifdef ENABLE_PIPE_OUTPUT
&pipe_output_plugin,
#endif
-#ifdef HAVE_ALSA
+#ifdef ENABLE_ALSA
&alsa_output_plugin,
#endif
-#ifdef HAVE_ROAR
+#ifdef ENABLE_ROAR
&roar_output_plugin,
#endif
-#ifdef HAVE_AO
+#ifdef ENABLE_AO
&ao_output_plugin,
#endif
#ifdef HAVE_OSS
@@ -75,10 +75,10 @@ const AudioOutputPlugin *const audio_output_plugins[] = {
#ifdef ENABLE_SOLARIS_OUTPUT
&solaris_output_plugin,
#endif
-#ifdef HAVE_PULSE
+#ifdef ENABLE_PULSE
&pulse_output_plugin,
#endif
-#ifdef HAVE_JACK
+#ifdef ENABLE_JACK
&jack_output_plugin,
#endif
#ifdef ENABLE_HTTPD_OUTPUT
diff --git a/src/output/plugins/PulseOutputPlugin.cxx b/src/output/plugins/PulseOutputPlugin.cxx
index 120bad090..5dc733383 100644
--- a/src/output/plugins/PulseOutputPlugin.cxx
+++ b/src/output/plugins/PulseOutputPlugin.cxx
@@ -523,7 +523,11 @@ pulse_output_setup_stream(PulseOutput *po, const pa_sample_spec *ss,
assert(po != nullptr);
assert(po->context != nullptr);
- po->stream = pa_stream_new(po->context, po->name, ss, nullptr);
+ /* WAVE-EX is been adopted as the speaker map for most media files */
+ pa_channel_map chan_map;
+ pa_channel_map_init_auto(&chan_map, ss->channels,
+ PA_CHANNEL_MAP_WAVEEX);
+ po->stream = pa_stream_new(po->context, po->name, ss, &chan_map);
if (po->stream == nullptr) {
SetError(error, po->context, "pa_stream_new() has failed");
return false;
diff --git a/src/pcm/ConfiguredResampler.cxx b/src/pcm/ConfiguredResampler.cxx
index f6aec3f95..a65ec8702 100644
--- a/src/pcm/ConfiguredResampler.cxx
+++ b/src/pcm/ConfiguredResampler.cxx
@@ -25,11 +25,11 @@
#include "config/ConfigError.hxx"
#include "util/Error.hxx"
-#ifdef HAVE_LIBSAMPLERATE
+#ifdef ENABLE_LIBSAMPLERATE
#include "LibsamplerateResampler.hxx"
#endif
-#ifdef HAVE_SOXR
+#ifdef ENABLE_SOXR
#include "SoxrResampler.hxx"
#endif
@@ -38,11 +38,11 @@
enum class SelectedResampler {
FALLBACK,
-#ifdef HAVE_LIBSAMPLERATE
+#ifdef ENABLE_LIBSAMPLERATE
LIBSAMPLERATE,
#endif
-#ifdef HAVE_SOXR
+#ifdef ENABLE_SOXR
SOXR,
#endif
};
@@ -58,14 +58,14 @@ pcm_resampler_global_init(Error &error)
if (strcmp(converter, "internal") == 0)
return true;
-#ifdef HAVE_SOXR
+#ifdef ENABLE_SOXR
if (memcmp(converter, "soxr", 4) == 0) {
selected_resampler = SelectedResampler::SOXR;
return pcm_resample_soxr_global_init(converter, error);
}
#endif
-#ifdef HAVE_LIBSAMPLERATE
+#ifdef ENABLE_LIBSAMPLERATE
selected_resampler = SelectedResampler::LIBSAMPLERATE;
return pcm_resample_lsr_global_init(converter, error);
#endif
@@ -86,12 +86,12 @@ pcm_resampler_create()
case SelectedResampler::FALLBACK:
return new FallbackPcmResampler();
-#ifdef HAVE_LIBSAMPLERATE
+#ifdef ENABLE_LIBSAMPLERATE
case SelectedResampler::LIBSAMPLERATE:
return new LibsampleratePcmResampler();
#endif
-#ifdef HAVE_SOXR
+#ifdef ENABLE_SOXR
case SelectedResampler::SOXR:
return new SoxrPcmResampler();
#endif
diff --git a/src/playlist/PlaylistRegistry.cxx b/src/playlist/PlaylistRegistry.cxx
index 4e9ef890e..aed8e1567 100644
--- a/src/playlist/PlaylistRegistry.cxx
+++ b/src/playlist/PlaylistRegistry.cxx
@@ -49,7 +49,7 @@ const struct playlist_plugin *const playlist_plugins[] = {
// TODO: enable without GLib
&pls_playlist_plugin,
#endif
-#ifdef HAVE_EXPAT
+#ifdef ENABLE_EXPAT
&xspf_playlist_plugin,
&asx_playlist_plugin,
&rss_playlist_plugin,
diff --git a/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx b/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx
index ec4d240a5..3fe8d57b1 100644
--- a/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx
+++ b/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx
@@ -25,16 +25,17 @@
#include "input/InputStream.hxx"
#include "tag/TagBuilder.hxx"
#include "util/StringUtil.hxx"
+#include "util/Alloc.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
-#include <glib.h>
#include <yajl/yajl_parse.h>
#include <string>
#include <string.h>
+#include <stdlib.h>
static struct {
std::string apikey;
@@ -60,7 +61,7 @@ soundcloud_init(const config_param &param)
/**
* Construct a full soundcloud resolver URL from the given fragment.
* @param uri uri of a soundcloud page (or just the path)
- * @return Constructed URL. Must be freed with g_free.
+ * @return Constructed URL. Must be freed with free().
*/
static char *
soundcloud_resolve(const char* uri)
@@ -68,18 +69,18 @@ soundcloud_resolve(const char* uri)
char *u, *ru;
if (StringStartsWith(uri, "https://")) {
- u = g_strdup(uri);
+ u = xstrdup(uri);
} else if (StringStartsWith(uri, "soundcloud.com")) {
- u = g_strconcat("https://", uri, nullptr);
+ u = xstrcatdup("https://", uri);
} else {
/* assume it's just a path on soundcloud.com */
- u = g_strconcat("https://soundcloud.com/", uri, nullptr);
+ u = xstrcatdup("https://soundcloud.com/", uri);
}
- ru = g_strconcat("https://api.soundcloud.com/resolve.json?url=",
- u, "&client_id=",
- soundcloud_config.apikey.c_str(), nullptr);
- g_free(u);
+ ru = xstrcatdup("https://api.soundcloud.com/resolve.json?url=",
+ u, "&client_id=",
+ soundcloud_config.apikey.c_str());
+ free(u);
return ru;
}
@@ -145,12 +146,12 @@ handle_string(void *ctx, const unsigned char* stringval,
switch (data->key) {
case Title:
- g_free(data->title);
- data->title = g_strndup(s, stringlen);
+ free(data->title);
+ data->title = xstrndup(s, stringlen);
break;
case Stream_URL:
- g_free(data->stream_url);
- data->stream_url = g_strndup(s, stringlen);
+ free(data->stream_url);
+ data->stream_url = xstrndup(s, stringlen);
data->got_url = 1;
break;
default:
@@ -211,8 +212,8 @@ handle_end_map(void *ctx)
/* got_url == 1, track finished, make it into a song */
data->got_url = 0;
- char *u = g_strconcat(data->stream_url, "?client_id=",
- soundcloud_config.apikey.c_str(), nullptr);
+ char *u = xstrcatdup(data->stream_url, "?client_id=",
+ soundcloud_config.apikey.c_str());
TagBuilder tag;
tag.SetDuration(SignedSongTime::FromMS(data->duration));
@@ -220,7 +221,7 @@ handle_end_map(void *ctx)
tag.AddItem(TAG_NAME, data->title);
data->songs.emplace_front(u, tag.Commit());
- g_free(u);
+ free(u);
return 1;
}
@@ -325,24 +326,24 @@ soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond)
char *u = nullptr;
if (memcmp(uri, "track/", 6) == 0) {
const char *rest = uri + 6;
- u = g_strconcat("https://api.soundcloud.com/tracks/",
- rest, ".json?client_id=",
- soundcloud_config.apikey.c_str(), nullptr);
+ u = xstrcatdup("https://api.soundcloud.com/tracks/",
+ rest, ".json?client_id=",
+ soundcloud_config.apikey.c_str());
} else if (memcmp(uri, "playlist/", 9) == 0) {
const char *rest = uri + 9;
- u = g_strconcat("https://api.soundcloud.com/playlists/",
- rest, ".json?client_id=",
- soundcloud_config.apikey.c_str(), nullptr);
+ u = xstrcatdup("https://api.soundcloud.com/playlists/",
+ rest, ".json?client_id=",
+ soundcloud_config.apikey.c_str());
} else if (memcmp(uri, "user/", 5) == 0) {
const char *rest = uri + 5;
- u = g_strconcat("https://api.soundcloud.com/users/",
- rest, "/tracks.json?client_id=",
- soundcloud_config.apikey.c_str(), nullptr);
+ u = xstrcatdup("https://api.soundcloud.com/users/",
+ rest, "/tracks.json?client_id=",
+ soundcloud_config.apikey.c_str());
} else if (memcmp(uri, "search/", 7) == 0) {
const char *rest = uri + 7;
- u = g_strconcat("https://api.soundcloud.com/tracks.json?q=",
- rest, "&client_id=",
- soundcloud_config.apikey.c_str(), nullptr);
+ u = xstrcatdup("https://api.soundcloud.com/tracks.json?q=",
+ rest, "&client_id=",
+ soundcloud_config.apikey.c_str());
} else if (memcmp(uri, "url/", 4) == 0) {
const char *rest = uri + 4;
/* Translate to soundcloud resolver call. libcurl will automatically
@@ -368,10 +369,10 @@ soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond)
int ret = soundcloud_parse_json(u, hand, mutex, cond);
- g_free(u);
+ free(u);
yajl_free(hand);
- g_free(data.title);
- g_free(data.stream_url);
+ free(data.title);
+ free(data.stream_url);
if (ret == -1)
return nullptr;
diff --git a/src/sticker/SongSticker.cxx b/src/sticker/SongSticker.cxx
index b6f46f167..b0b74b1a6 100644
--- a/src/sticker/SongSticker.cxx
+++ b/src/sticker/SongSticker.cxx
@@ -23,11 +23,11 @@
#include "db/LightSong.hxx"
#include "db/Interface.hxx"
#include "util/Error.hxx"
-
-#include <glib.h>
+#include "util/Alloc.hxx"
#include <assert.h>
#include <string.h>
+#include <stdlib.h>
std::string
sticker_song_get_value(const LightSong &song, const char *name)
@@ -109,7 +109,7 @@ sticker_song_find(const Database &db, const char *base_uri, const char *name,
if (*data.base_uri != 0)
/* append slash to base_uri */
data.base_uri = allocated =
- g_strconcat(data.base_uri, "/", nullptr);
+ xstrcatdup(data.base_uri, "/");
else
/* searching in root directory - no trailing slash */
allocated = nullptr;
@@ -118,7 +118,7 @@ sticker_song_find(const Database &db, const char *base_uri, const char *name,
bool success = sticker_find("song", data.base_uri, name,
sticker_song_find_cb, &data);
- g_free(allocated);
+ free(allocated);
return success;
}
diff --git a/src/system/fd_util.h b/src/system/fd_util.h
index f4a940e91..6d6fe1e69 100644
--- a/src/system/fd_util.h
+++ b/src/system/fd_util.h
@@ -103,7 +103,7 @@ socketpair_cloexec_nonblock(int domain, int type, int protocol, int sv[2]);
#endif
-#ifdef HAVE_LIBMPDCLIENT
+#ifdef ENABLE_LIBMPDCLIENT
/* Avoid symbol conflict with statically linked libmpdclient */
#define socket_cloexec_nonblock socket_cloexec_nonblock_noconflict
#endif
diff --git a/src/tag/TagId3.hxx b/src/tag/TagId3.hxx
index 1928d539d..ece7a599b 100644
--- a/src/tag/TagId3.hxx
+++ b/src/tag/TagId3.hxx
@@ -29,7 +29,7 @@ struct Tag;
struct id3_tag;
class Error;
-#ifdef HAVE_ID3TAG
+#ifdef ENABLE_ID3TAG
bool
tag_id3_scan(Path path_fs,
diff --git a/src/util/Alloc.cxx b/src/util/Alloc.cxx
index ec3579470..403ad535d 100644
--- a/src/util/Alloc.cxx
+++ b/src/util/Alloc.cxx
@@ -74,3 +74,66 @@ xstrndup(const char *s, size_t n)
return p;
}
+
+template<typename... Args>
+static inline size_t
+FillLengths(size_t *lengths, const char *a, Args&&... args)
+{
+ return FillLengths(lengths, a) + FillLengths(lengths + 1, args...);
+}
+
+template<>
+inline size_t
+FillLengths(gcc_unused size_t *lengths, const char *a)
+{
+ return *lengths = strlen(a);
+}
+
+template<typename... Args>
+static inline void
+StringCat(char *p, const size_t *lengths, const char *a, Args&&... args)
+{
+ StringCat(p, lengths, a);
+ StringCat(p + *lengths, lengths + 1, args...);
+}
+
+template<>
+inline void
+StringCat(char *p, const size_t *lengths, const char *a)
+{
+ memcpy(p, a, *lengths);
+}
+
+template<typename... Args>
+gcc_malloc gcc_nonnull_all
+static inline char *
+t_xstrcatdup(Args&&... args)
+{
+ constexpr size_t n = sizeof...(args);
+
+ size_t lengths[n];
+ const size_t total = FillLengths(lengths, args...);
+
+ char *p = (char *)xalloc(total + 1);
+ StringCat(p, lengths, args...);
+ p[total] = 0;
+ return p;
+}
+
+char *
+xstrcatdup(const char *a, const char *b)
+{
+ return t_xstrcatdup(a, b);
+}
+
+char *
+xstrcatdup(const char *a, const char *b, const char *c)
+{
+ return t_xstrcatdup(a, b, c);
+}
+
+char *
+xstrcatdup(const char *a, const char *b, const char *c, const char *d)
+{
+ return t_xstrcatdup(a, b, c, d);
+}
diff --git a/src/util/Alloc.hxx b/src/util/Alloc.hxx
index 15c123b7a..654b7d0fe 100644
--- a/src/util/Alloc.hxx
+++ b/src/util/Alloc.hxx
@@ -64,4 +64,23 @@ gcc_malloc gcc_nonnull_all
char *
xstrndup(const char *s, size_t n);
+/**
+ * Concatenate two strings, returning a new allocation. Use free() to
+ * free it.
+ *
+ * This function never fails; in out-of-memory situations, it aborts
+ * the process.
+ */
+gcc_malloc gcc_nonnull_all
+char *
+xstrcatdup(const char *a, const char *b);
+
+gcc_malloc gcc_nonnull_all
+char *
+xstrcatdup(const char *a, const char *b, const char *c);
+
+gcc_malloc gcc_nonnull_all
+char *
+xstrcatdup(const char *a, const char *b, const char *c, const char *d);
+
#endif
diff --git a/test/DumpDatabase.cxx b/test/DumpDatabase.cxx
index 07f342319..a4d3e6407 100644
--- a/test/DumpDatabase.cxx
+++ b/test/DumpDatabase.cxx
@@ -44,7 +44,7 @@ using std::endl;
#include <stdlib.h>
-#ifdef HAVE_LIBUPNP
+#ifdef ENABLE_UPNP
#include "input/InputStream.hxx"
size_t
InputStream::LockRead(void *, size_t, Error &)