From ac5caa2c888144ff27c30e0eb26536f7ffedc8e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sat, 29 Nov 2014 13:14:22 +0200 Subject: [PATCH] mad: clean up build rules --- configure.ac | 51 ++++++++++++++++++++------------- modules/MODULES_LIST | 2 +- modules/audio_filter/Modules.am | 9 +++++- modules/codec/mpeg_audio.c | 2 +- 4 files changed, 41 insertions(+), 23 deletions(-) diff --git a/configure.ac b/configure.ac index 7800624b1c..188fd1911b 100644 --- a/configure.ac +++ b/configure.ac @@ -2199,29 +2199,40 @@ fi dnl dnl mad plugin dnl +have_mad="no" +MAD_CFLAGS="" +MAD_LIBS="" + +AC_ARG_WITH(mad, [ --with-mad=PATH path to libmad], [ + enable_mad="yes" +], [ + with_mad="no" +]) +AS_IF([test "${with_mad}" != "no"], [ + MAD_CFLAGS="-I${with_mad}/include" + MAD_LIBS="-L${with_mad}/lib" +]) + AC_ARG_ENABLE(mad, [ --enable-mad libmad module (default enabled)]) -if test "${enable_mad}" != "no" -then - AC_ARG_WITH(mad, - [ --with-mad=PATH path to libmad],[],[]) - if test "${with_mad}" != "no" -a -n "${with_mad}" - then - VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${with_mad}/include]) - VLC_ADD_LIBS([mpgatofixed32],[-L${with_mad}/lib]) - fi - - VLC_SAVE_FLAGS - CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_mpgatofixed32}" - LDFLAGS="${LDFLAGS} ${LIBS_mpgatofixed32}" - AC_CHECK_HEADERS(mad.h, , - [ AC_MSG_ERROR([Could not find libmad on your system: you may get it from http://www.underbit.com/products/mad/. Alternatively you can use --disable-mad to disable the mad plugin.]) ]) +AS_IF([test "${enable_mad}" != "no"], [ + VLC_SAVE_FLAGS + CPPFLAGS="${CPPFLAGS} ${MAD_CFLAGS}" + LDFLAGS="${LDFLAGS} ${MAD_LIBS}" + AC_CHECK_HEADERS(mad.h, [ AC_CHECK_LIB(mad, mad_bit_init, [ - VLC_ADD_PLUGIN([mpgatofixed32]) - VLC_ADD_LIBS([mpgatofixed32],[-lmad])], - [ AC_MSG_ERROR([Cannot find libmad library...]) ]) - VLC_RESTORE_FLAGS -fi + have_mad="yes" + MAD_LIBS="${MAD_LIBS} -lmad" + ]) + ]) + VLC_RESTORE_FLAGS + AS_IF([test -n "$enable_mad" -a "${have_mad}" = "no"], [ + AC_MSG_ERROR([Could not find libmad. Install it or pass --disable-mad to disable it.]) + ]) +]) +AC_SUBST(MAD_CFLAGS) +AC_SUBST(MAD_LIBS) +AM_CONDITIONAL([HAVE_MAD], [test "${have_mad}" = "yes"]) AC_ARG_ENABLE(merge-ffmpeg, diff --git a/modules/MODULES_LIST b/modules/MODULES_LIST index 6d93386e74..c40247d6d2 100644 --- a/modules/MODULES_LIST +++ b/modules/MODULES_LIST @@ -202,6 +202,7 @@ $Id$ * lua: Lua scripting inteface * macosx: Video output, and interface module for Mac OS X * macosx_dialog_provider: Minimal Dialog Provider for Mac OS X + * mad: MPEG-1 & 2 audio layer I,II,III audio decoder using MAD * magnify: zoom video filter * marq: Overlays a marquee on the video * mediacodec: Android Jelly Bean MediaCodec decoder module @@ -224,7 +225,6 @@ $Id$ * mp4: MP4 file input module * mpc: Musepack decoder * mpeg_audio: MPEG audio parser/packetizer - * mpgatofixed32: MPEG-1 & 2 audio layer I,II,III audio decoder using MAD * mpgv: MPEG-I/II Video demuxer * mtp: MTP interface module * mux_asf: ASF muxer diff --git a/modules/audio_filter/Modules.am b/modules/audio_filter/Modules.am index 89f8783155..ba994e605b 100644 --- a/modules/audio_filter/Modules.am +++ b/modules/audio_filter/Modules.am @@ -50,7 +50,14 @@ SOURCES_a52tospdif = converter/a52tospdif.c SOURCES_a52tofloat32 = converter/a52tofloat32.c SOURCES_dtstospdif = converter/dtstospdif.c SOURCES_dtstofloat32 = converter/dtstofloat32.c -SOURCES_mpgatofixed32 = converter/mpgatofixed32.c + +libmad_plugin_la_SOURCES = converter/mpgatofixed32.c +libmad_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(MAD_CFLAGS) +libmad_plugin_la_LIBADD = $(AM_LIBADD) $(MAD_LIBS) +if HAVE_MAD +audio_filter_LTLIBRARIES += libmad_plugin.la +endif + libaudio_format_plugin_la_SOURCES = converter/format.c libaudio_format_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) libaudio_format_plugin_la_LIBADD = $(LIBM) diff --git a/modules/codec/mpeg_audio.c b/modules/codec/mpeg_audio.c index f893dd257a..404939aacc 100644 --- a/modules/codec/mpeg_audio.c +++ b/modules/codec/mpeg_audio.c @@ -161,7 +161,7 @@ static int Open( vlc_object_t *p_this ) static int OpenDecoder( vlc_object_t *p_this ) { /* HACK: Don't use this codec if we don't have an mpga audio filter */ - if( !module_exists( "mpgatofixed32" ) ) + if( !module_exists( "mad" ) ) return VLC_EGENERIC; return Open( p_this );