diff options
author | Max Kellermann <max@duempel.org> | 2014-11-22 23:18:07 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-11-22 23:50:21 +0100 |
commit | c643b6ff167fbd0b6fead4bee38a2b498ee611a7 (patch) | |
tree | 87abf17c65755134fb1c4b54a5e8ccc67ee99316 | |
parent | b3f5b4932c360efef696f7db112766c63b1de389 (diff) | |
download | mpd-c643b6ff167fbd0b6fead4bee38a2b498ee611a7.tar.gz mpd-c643b6ff167fbd0b6fead4bee38a2b498ee611a7.tar.xz mpd-c643b6ff167fbd0b6fead4bee38a2b498ee611a7.zip |
configure.ac: add macro MPD_ENABLE_AUTO_PKG_LIB
-rw-r--r-- | Makefile.am | 8 | ||||
-rw-r--r-- | configure.ac | 35 | ||||
-rw-r--r-- | m4/mpd_auto.m4 | 19 | ||||
-rw-r--r-- | src/decoder/DecoderList.cxx | 2 | ||||
-rw-r--r-- | src/decoder/plugins/DsdLib.cxx | 4 | ||||
-rw-r--r-- | src/decoder/plugins/DsdiffDecoderPlugin.cxx | 6 | ||||
-rw-r--r-- | src/decoder/plugins/DsfDecoderPlugin.cxx | 8 | ||||
-rw-r--r-- | src/decoder/plugins/MadDecoderPlugin.cxx | 14 | ||||
-rw-r--r-- | src/tag/TagId3.hxx | 2 |
9 files changed, 45 insertions, 53 deletions
diff --git a/Makefile.am b/Makefile.am index ae260c439..52c314928 100644 --- a/Makefile.am +++ b/Makefile.am @@ -792,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 \ @@ -870,7 +870,7 @@ 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 @@ -1538,7 +1538,7 @@ if ENABLE_ARCHIVE noinst_PROGRAMS += test/visit_archive endif -if HAVE_ID3TAG +if ENABLE_ID3TAG noinst_PROGRAMS += test/dump_rva2 endif @@ -1796,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 \ diff --git a/configure.ac b/configure.ac index 22072f4ca..353bcd9ee 100644 --- a/configure.ac +++ b/configure.ac @@ -306,11 +306,6 @@ AC_ARG_ENABLE(bzip2, [enable bzip2 archive support (default: auto)]),, enable_bzip2=auto) -AC_ARG_ENABLE(smbclient, - AS_HELP_STRING([--enable-smbclient], - [enable support for libsmbclient (default: auto)]),, - [enable_smbclient=auto]) - default_enable_daemon=yes if test x$host_is_android = xyes || test x$host_is_android = xyes; then default_enable_daemon=no @@ -358,11 +353,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) ]),, @@ -389,11 +379,6 @@ AC_ARG_ENABLE([libwrap], AS_HELP_STRING([--enable-libwrap], [use libwrap]),, [enable_libwrap=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)]),, @@ -686,13 +671,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 @@ -780,13 +761,9 @@ MPD_ENABLE_AUTO_PKG(curl, CURL, [libcurl >= 7.18], [libcurl HTTP streaming], [libcurl not found]) 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_ENABLE_AUTO_PKG(nfs, NFS, [libnfs], @@ -978,13 +955,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], diff --git a/m4/mpd_auto.m4 b/m4/mpd_auto.m4 index 041affc65..00e98f7f3 100644 --- a/m4/mpd_auto.m4 +++ b/m4/mpd_auto.m4 @@ -97,6 +97,25 @@ AC_DEFUN([MPD_ENABLE_AUTO_PKG], [ 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_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 diff --git a/src/decoder/DecoderList.cxx b/src/decoder/DecoderList.cxx index bfcf31435..7f665fb88 100644 --- a/src/decoder/DecoderList.cxx +++ b/src/decoder/DecoderList.cxx @@ -49,7 +49,7 @@ #include <string.h> const struct DecoderPlugin *const decoder_plugins[] = { -#ifdef HAVE_MAD +#ifdef ENABLE_MAD &mad_decoder_plugin, #endif #ifdef ENABLE_MPG123 diff --git a/src/decoder/plugins/DsdLib.cxx b/src/decoder/plugins/DsdLib.cxx index d7eb5f7a3..5e995fed4 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/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, |