From 9aa1f3d69c0aa335b3026581defbc09eb2c4efb4 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 30 Jul 2014 10:11:15 +0200 Subject: [PATCH] build: Convert flac detection to new macros. --- configure.ac | 85 ++++++++++++++++++---------------------------------- 1 file changed, 29 insertions(+), 56 deletions(-) diff --git a/configure.ac b/configure.ac index 66b4787e..5358c6e3 100644 --- a/configure.ac +++ b/configure.ac @@ -299,6 +299,14 @@ AC_CHECK_HEADERS([opus/opus.h], [], [HAVE_OPUS=no]) AC_CHECK_LIB([opus], [opus_multistream_decode], [], [HAVE_OPUS=no]) LIB_SUBST_FLAGS(opus) UNSTASH_FLAGS +########################################################################### flac +STASH_FLAGS +LIB_ARG_WITH([flac], [-lFLAC -lm]) +HAVE_FLAC=yes +AC_CHECK_HEADER(FLAC/stream_decoder.h, [], HAVE_FLAC=no) +AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], HAVE_FLAC=no) +LIB_SUBST_FLAGS(flac) +UNSTASH_FLAGS # some helper functions for codecs which use the ogg container format AC_DEFUN([NEED_OGG_OBJECTS], [{ @@ -306,6 +314,7 @@ AC_DEFUN([NEED_OGG_OBJECTS], [{ "$HAVE_VORBIS" = 'yes' \ -o "$HAVE_SPEEX" = 'yes' \ -o "$HAVE_OPUS" = 'yes' \ + -o "$HAVE_FLAC" = 'yes' \ \) }]) AC_DEFUN([NEED_VORBIS_OBJECTS], [{ @@ -317,6 +326,9 @@ AC_DEFUN([NEED_SPEEX_OBJECTS], [{ AC_DEFUN([NEED_OPUS_OBJECTS], [{ test "$HAVE_OGG" = 'yes' -a "$HAVE_OPUS" = 'yes' }]) +AC_DEFUN([NEED_FLAC_OBJECTS], [{ + test "$HAVE_OGG" = 'yes' -a "$HAVE_FLAC" = 'yes' +}]) ########################################################################### faad STASH_FLAGS LIB_ARG_WITH([faad], [-lfaad]) @@ -341,41 +353,6 @@ AC_CHECK_HEADER(id3tag.h, [], HAVE_ID3TAG=no) AC_CHECK_LIB([id3tag], [id3_file_fdopen], [], HAVE_ID3TAG=no) LIB_SUBST_FLAGS(id3tag) UNSTASH_FLAGS -########################################################################### flac -OLD_CPPFLAGS="$CPPFLAGS" -OLD_LDFLAGS="$LDFLAGS" -OLD_LIBS="$LIBS" - -have_flac="yes" -AC_ARG_WITH(flac_headers, [AS_HELP_STRING(--with-flac-headers=dir, - [look for flac headers also in dir])]) -if test -n "$with_flac_headers"; then - flac_cppflags="-I$with_flac_headers" - CPPFLAGS="$CPPFLAGS $flac_cppflags" -fi -AC_ARG_WITH(flac_libs, [AS_HELP_STRING(--with-flac-libs=dir, - [look for flac libs also in dir])]) -if test -n "$with_flac_libs"; then - flac_libs="-L$with_flac_libs" - LDFLAGS="$LDFLAGS $flac_libs" -fi -AC_CHECK_HEADER(FLAC/stream_decoder.h, [], have_flac=no) -AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], [ - # nope, try again with -logg - AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_init_file], [], - have_flac=no, -lm -logg) - ], -lm) -if test "$have_flac" = "yes"; then - AC_DEFINE(HAVE_FLAC, 1, define to 1 if you want to build the flacdec filter) - AC_SUBST(flac_cppflags) - flac_ldflags="$flac_libs -lFLAC" - AC_SUBST(flac_ldflags) -else - AC_MSG_WARN([no flac support in para_audiod/para_filter/para_afh/para_server]) -fi -CPPFLAGS="$OLD_CPPFLAGS" -LDFLAGS="$OLD_LDFLAGS" -LIBS="$OLD_LIBS" ########################################################################### oss OLD_CPPFLAGS="$CPPFLAGS" OLD_LDFLAGS="$LDFLAGS" @@ -640,10 +617,8 @@ if test -n "$CRYPTOLIB" && test $HAVE_OSL = yes; then NEED_VORBIS_OBJECTS() && server_errlist_objs="$server_errlist_objs ogg_afh" NEED_SPEEX_OBJECTS() && server_errlist_objs="$server_errlist_objs spx_afh spx_common" NEED_OPUS_OBJECTS() && server_errlist_objs="$server_errlist_objs opus_afh opus_common" + NEED_FLAC_OBJECTS && server_errlist_objs="$server_errlist_objs flac_afh" test $HAVE_FAAD = yes && server_errlist_objs="$server_errlist_objs aac_afh aac_common" - if test "$have_flac" = "yes"; then - server_errlist_objs="$server_errlist_objs flac_afh" - fi server_objs="add_cmdline($server_cmdline_objs) $server_errlist_objs" AC_SUBST(server_objs, add_dot_o($server_objs)) AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS, @@ -763,6 +738,10 @@ if test -n "$CRYPTOLIB"; then audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common" audiod_audio_formats="$audiod_audio_formats opus" } + NEED_FLAC_OBJECTS && { + audiod_errlist_objs="$audiod_errlist_objs flacdec_filter" + audiod_audio_formats="$audiod_audio_formats flac" + } if test $HAVE_FAAD = yes; then audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common" audiod_audio_formats="$audiod_audio_formats aac" @@ -772,10 +751,6 @@ if test -n "$CRYPTOLIB"; then audiod_cmdline_objs="$audiod_cmdline_objs mp3dec_filter" audiod_errlist_objs="$audiod_errlist_objs mp3dec_filter" fi - if test "$have_flac" = "yes"; then - audiod_errlist_objs="$audiod_errlist_objs flacdec_filter" - audiod_audio_formats="$audiod_audio_formats flac" - fi if test "$have_oss" = "yes"; then audiod_errlist_objs="$audiod_errlist_objs oss_write" audiod_cmdline_objs="$audiod_cmdline_objs oss_write" @@ -931,6 +906,10 @@ NEED_OPUS_OBJECTS && { filters="$filters opusdec" filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common" } +NEED_FLAC_OBJECTS && { + filter_errlist_objs="$filter_errlist_objs flacdec_filter" + filters="$filters flacdec" +} if test $HAVE_FAAD = yes; then filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common" filters="$filters aacdec" @@ -940,10 +919,6 @@ if test $HAVE_MAD = yes; then filter_errlist_objs="$filter_errlist_objs mp3dec_filter" filters="$filters mp3dec" fi -if test "$have_flac" = "yes"; then - filter_errlist_objs="$filter_errlist_objs flacdec_filter" - filters="$filters flacdec" -fi if test "$have_samplerate" = "yes"; then filter_errlist_objs="$filter_errlist_objs resample_filter check_wav" filter_cmdline_objs="$filter_cmdline_objs resample_filter" @@ -998,13 +973,11 @@ NEED_OGG_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh_common" NEED_VORBIS_OBJECTS && recv_errlist_objs="$recv_errlist_objs ogg_afh" NEED_SPEEX_OBJECTS && recv_errlist_objs="$recv_errlist_objs spx_afh spx_common" NEED_OPUS_OBJECTS && recv_errlist_objs="$recv_errlist_objs opus_afh opus_common" +NEED_FLAC_OBJECTS && recv_errlist_objs="$recv_errlist_objs flac_afh" if test $HAVE_FAAD = yes; then recv_errlist_objs="$recv_errlist_objs aac_afh aac_common" fi -if test "$have_flac" = "yes"; then - recv_errlist_objs="$recv_errlist_objs flac_afh" -fi recv_objs="add_cmdline($recv_cmdline_objs) $recv_errlist_objs" AC_SUBST(receivers, "http dccp udp afh") AC_SUBST(recv_objs, add_dot_o($recv_objs)) @@ -1038,14 +1011,14 @@ NEED_OPUS_OBJECTS && { afh_errlist_objs="$afh_errlist_objs opus_afh opus_common" audio_format_handlers="$audio_format_handlers opus" } +NEED_FLAC_OBJECTS && { + afh_errlist_objs="$afh_errlist_objs flac_afh" + audio_format_handlers="$audio_format_handlers flac" +} if test $HAVE_FAAD = yes; then afh_errlist_objs="$afh_errlist_objs aac_common aac_afh" audio_format_handlers="$audio_format_handlers aac" fi -if test "$have_flac" = "yes"; then - afh_errlist_objs="$afh_errlist_objs flac_afh" - audio_format_handlers="$audio_format_handlers flac" -fi afh_objs="add_cmdline($afh_cmdline_objs) $afh_errlist_objs" @@ -1115,6 +1088,9 @@ NEED_OPUS_OBJECTS && opus_afh opus_common " +NEED_FLAC_OBJECTS && { + play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh" +} if test $HAVE_FAAD = yes; then play_errlist_objs="$play_errlist_objs aacdec_filter aac_afh aac_common" fi @@ -1122,9 +1098,6 @@ if test $HAVE_MAD = yes; then play_cmdline_objs="$play_cmdline_objs mp3dec_filter" play_errlist_objs="$play_errlist_objs mp3dec_filter" fi -if test "$have_flac" = "yes"; then - play_errlist_objs="$play_errlist_objs flacdec_filter flac_afh" -fi if test "$have_oss" = "yes"; then play_errlist_objs="$play_errlist_objs oss_write" play_cmdline_objs="$play_cmdline_objs oss_write" -- 2.39.2