build: Convert faad detection to new macros.
[paraslash.git] / configure.ac
index 32189513d02f29953c46d9fd4eccb6bd9f978560..7224e4e6cc415f5555105b5795e74da3a546d05b 100644 (file)
@@ -318,33 +318,13 @@ AC_DEFUN([NEED_OPUS_OBJECTS], [{
        test "$HAVE_OGG" = 'yes' -a "$HAVE_OPUS" = 'yes'
 }])
 ########################################################################### faad
-have_faad=yes
-OLD_CPPFLAGS="$CPPFLAGS"
-OLD_LDFLAGS="$LDFLAGS"
-OLD_LIBS="$LIBS"
-AC_ARG_WITH(faad_headers, [AS_HELP_STRING(--with-faad-headers=dir,
-       [look for neaacdec.h also in dir])])
-if test -n "$with_faad_headers"; then
-       faad_cppflags="-I$with_faad_headers"
-       CPPFLAGS="$CPPFLAGS $faad_cppflags"
-fi
-AC_ARG_WITH(faad_libs, [AS_HELP_STRING(--with-faad-libs=dir,
-       [look for libfaad also in dir])])
-if test -n "$with_faad_libs"; then
-       faad_libs="-L$with_faad_libs"
-       LDFLAGS="$LDFLAGS $faad_libs"
-fi
-AC_CHECK_HEADER(neaacdec.h, [], have_faad=no)
-AC_CHECK_LIB([faad], [NeAACDecOpen], [], have_faad=no)
-if test "$have_faad" = "yes"; then
-       AC_DEFINE(HAVE_FAAD, 1, define to 1 if you want to build the aacdec filter)
-       AC_SUBST(faad_cppflags)
-       faad_ldflags="$faad_libs -lfaad"
-       AC_SUBST(faad_ldflags)
-fi
-CPPFLAGS="$OLD_CPPFLAGS"
-LDFLAGS="$OLD_LDFLAGS"
-LIBS="$OLD_LIBS"
+STASH_FLAGS
+LIB_ARG_WITH([faad], [-lfaad])
+HAVE_FAAD=yes
+AC_CHECK_HEADER(neaacdec.h, [], HAVE_FAAD=no)
+AC_CHECK_LIB([faad], [NeAACDecOpen], [], HAVE_FAAD=no)
+LIB_SUBST_FLAGS(faad)
+UNSTASH_FLAGS
 ########################################################################### mad
 have_mad="yes"
 OLD_CPPFLAGS="$CPPFLAGS"
@@ -714,9 +694,7 @@ 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"
-       if test "$have_faad" = "yes"; then
-               server_errlist_objs="$server_errlist_objs aac_afh aac_common"
-       fi
+       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
@@ -839,7 +817,7 @@ if test -n "$CRYPTOLIB"; then
                audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common"
                audiod_audio_formats="$audiod_audio_formats opus"
        }
-       if test "$have_faad" = "yes"; then
+       if test $HAVE_FAAD = yes; then
                audiod_errlist_objs="$audiod_errlist_objs aacdec_filter aac_common"
                audiod_audio_formats="$audiod_audio_formats aac"
        fi
@@ -1007,7 +985,7 @@ NEED_OPUS_OBJECTS && {
        filters="$filters opusdec"
        filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
 }
-if test "$have_faad" = "yes"; then
+if test $HAVE_FAAD = yes; then
        filter_errlist_objs="$filter_errlist_objs aacdec_filter aac_common"
        filters="$filters aacdec"
 fi
@@ -1075,7 +1053,7 @@ 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"
 
-if test "$have_faad" = "yes"; then
+if test $HAVE_FAAD = yes; then
        recv_errlist_objs="$recv_errlist_objs aac_afh aac_common"
 fi
 if test "$have_flac" = "yes"; then
@@ -1114,7 +1092,7 @@ NEED_OPUS_OBJECTS && {
        afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
        audio_format_handlers="$audio_format_handlers opus"
 }
-if test "$have_faad" = "yes"; then
+if test $HAVE_FAAD = yes; then
        afh_errlist_objs="$afh_errlist_objs aac_common aac_afh"
        audio_format_handlers="$audio_format_handlers aac"
 fi
@@ -1191,7 +1169,7 @@ NEED_OPUS_OBJECTS &&
                opus_afh
                opus_common
        "
-if test "$have_faad" = "yes"; then
+if test $HAVE_FAAD = yes; then
        play_errlist_objs="$play_errlist_objs aacdec_filter aac_afh aac_common"
 fi
 if test "$have_mad" = "yes"; then